mirror of
https://github.com/1dot13/source.git
synced 2026-08-19 14:20:30 +02:00
New Feature: Improved ambushes have mercs face the enemy and be somewhat scattered, while the enemy encircles the player but is not at point-blank range.
git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@7846 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
@@ -56,6 +56,7 @@
|
||||
#include "Campaign.h" // added by Flugente for HighestPlayerProgressPercentage()
|
||||
#include "CampaignStats.h" // added by Flugente
|
||||
#include "Town Militia.h" // added by Flugente
|
||||
#include "PreBattle Interface.h" // added by Flugente
|
||||
|
||||
BOOLEAN gfOriginalList = TRUE;
|
||||
|
||||
@@ -769,6 +770,33 @@ BOOLEAN AddPlacementToWorld( SOLDIERINITNODE *curr, GROUP *pGroup = NULL )
|
||||
DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("AddPlacementToWorld: set npcs to enemies"));
|
||||
OkayToUpgradeEliteToSpecialProfiledEnemy( &tempDetailedPlacement );
|
||||
}
|
||||
|
||||
// Flugente: if this is an enemy, and we are using ambush code, place us somewhat away from the map center, where the player will be
|
||||
if ( (tempDetailedPlacement.bTeam == ENEMY_TEAM && gubEnemyEncounterCode == ENEMY_AMBUSH_CODE) ||
|
||||
(tempDetailedPlacement.bTeam == CREATURE_TEAM && gubEnemyEncounterCode == BLOODCAT_AMBUSH_CODE) )
|
||||
{
|
||||
if ( ( gGameExternalOptions.uAmbushEnemyEncircle == 1 && PythSpacesAway( tempDetailedPlacement.sInsertionGridNo, gMapInformation.sCenterGridNo ) <= gGameExternalOptions.usAmbushEnemyEncircleRadius1 ) ||
|
||||
( gGameExternalOptions.uAmbushEnemyEncircle == 2) )
|
||||
{
|
||||
// we simply look for a entry point inside a bigger circle, but not inside the merc deployment zone.
|
||||
INT32 bettergridno = NOWHERE;
|
||||
UINT16 counter = 0;
|
||||
UINT8 ubDirection = DIRECTION_IRRELEVANT;
|
||||
|
||||
while ( counter < 100 && (bettergridno == NOWHERE || PythSpacesAway( bettergridno, gMapInformation.sCenterGridNo ) <= gGameExternalOptions.usAmbushEnemyEncircleRadius1) )
|
||||
{
|
||||
bettergridno = FindRandomGridNoBetweenCircles( gMapInformation.sCenterGridNo, gGameExternalOptions.usAmbushEnemyEncircleRadius1, gGameExternalOptions.usAmbushEnemyEncircleRadius2, ubDirection );
|
||||
}
|
||||
|
||||
if ( bettergridno != NOWHERE )
|
||||
{
|
||||
tempDetailedPlacement.sInsertionGridNo = bettergridno;
|
||||
|
||||
// have the soldier look inward. We add + 100 because later on we use this to signify that we want really enforce this direction
|
||||
tempDetailedPlacement.ubDirection = (UINT8)GetDirectionToGridNoFromGridNo( tempDetailedPlacement.sInsertionGridNo, gMapInformation.sCenterGridNo ) + 100;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("AddPlacementToWorld: create soldier"));
|
||||
|
||||
Reference in New Issue
Block a user