From f83af12336c6f685d483ead801359cc0a449972f Mon Sep 17 00:00:00 2001 From: MaddMugsy Date: Wed, 21 Jun 2006 19:16:31 +0000 Subject: [PATCH] -restored previous light check changes -fixed enemies getting closer w/out firing git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@283 3b4a5df2-a311-0410-b5c6-a8a6f20db521 --- TacticalAI/Attacks.cpp | 2 +- TacticalAI/DecideAction.cpp | 25 +++++++++++++------------ TacticalAI/FindLocations.cpp | 7 +++++++ 3 files changed, 21 insertions(+), 13 deletions(-) diff --git a/TacticalAI/Attacks.cpp b/TacticalAI/Attacks.cpp index 98c72860f..87475a77a 100644 --- a/TacticalAI/Attacks.cpp +++ b/TacticalAI/Attacks.cpp @@ -262,7 +262,7 @@ void CalcBestShot(SOLDIERTYPE *pSoldier, ATTACKTYPE *pBestShot, BOOLEAN shootUns // consider the various aiming times if ( !Weapon[pSoldier->usAttackingWeapon].NoSemiAuto ) { - for (ubAimTime = AllowedAimingLevels(pSoldier); ubAimTime <= ubMaxPossibleAimTime; ubAimTime++) + for (ubAimTime = AP_MIN_AIM_ATTACK; ubAimTime <= ubMaxPossibleAimTime; ubAimTime++) { //HandleMyMouseCursor(KEYBOARDALSO); diff --git a/TacticalAI/DecideAction.cpp b/TacticalAI/DecideAction.cpp index d57a44262..e6c5db5a0 100644 --- a/TacticalAI/DecideAction.cpp +++ b/TacticalAI/DecideAction.cpp @@ -2036,18 +2036,6 @@ INT8 DecideActionRed(SOLDIERTYPE *pSoldier, UINT8 ubUnconsciousOK) } } - //////////////////////////////////////////////////////////////////////////// - // WHEN IN THE LIGHT, GET OUT OF THERE! - //////////////////////////////////////////////////////////////////////////// - if ( ubCanMove && InLightAtNight( pSoldier->sGridNo, pSoldier->bLevel ) && pSoldier->bOrders != STATIONARY ) - { - pSoldier->usActionData = FindNearbyDarkerSpot( pSoldier ); - if ( pSoldier->usActionData != NOWHERE ) - { - // move as if leaving water or gas - return( AI_ACTION_LEAVE_WATER_GAS ); - } - } if ( fCivilian && !( pSoldier->ubBodyType == COW || pSoldier->ubBodyType == CRIPPLECIV ) ) { @@ -2351,6 +2339,19 @@ if ( !fCivilian && pSoldier->bTeam != MILITIA_TEAM && gGameOptions.fAirStrikes & } */ + //////////////////////////////////////////////////////////////////////////// + // WHEN IN THE LIGHT, GET OUT OF THERE! + //////////////////////////////////////////////////////////////////////////// + if ( ubCanMove && InLightAtNight( pSoldier->sGridNo, pSoldier->bLevel ) && pSoldier->bOrders != STATIONARY ) + { + pSoldier->usActionData = FindNearbyDarkerSpot( pSoldier ); + if ( pSoldier->usActionData != NOWHERE ) + { + // move as if leaving water or gas + return( AI_ACTION_LEAVE_WATER_GAS ); + } + } + DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"decideactionred: crouch and rest if running out of breath"); //////////////////////////////////////////////////////////////////////// // CROUCH & REST IF RUNNING OUT OF BREATH diff --git a/TacticalAI/FindLocations.cpp b/TacticalAI/FindLocations.cpp index c9c706df8..b033bcac8 100644 --- a/TacticalAI/FindLocations.cpp +++ b/TacticalAI/FindLocations.cpp @@ -1309,6 +1309,10 @@ INT16 FindSpotMaxDistFromOpponents(SOLDIERTYPE *pSoldier) continue; } + //Madd: skip lighted spots + if ( InLightAtNight( sGridNo, pSoldier->bLevel ) ) + continue; + // OK, this place shows potential. How useful is it as cover? //NumMessage("Promising seems gridno #",gridno); @@ -2494,6 +2498,9 @@ INT16 FindFlankingSpot(SOLDIERTYPE *pSoldier, INT16 sPos, INT8 bAction ) continue; } + //Madd: skip lighted spots + if ( InLightAtNight( sGridNo, pSoldier->bLevel ) ) + continue; // allow an extra direction for flanking if ( bAction == AI_ACTION_FLANK_LEFT )