diff --git a/TacticalAI/Attacks.cpp b/TacticalAI/Attacks.cpp index 39177334..abb36e91 100644 --- a/TacticalAI/Attacks.cpp +++ b/TacticalAI/Attacks.cpp @@ -2423,7 +2423,7 @@ void CheckIfShotPossible(SOLDIERTYPE *pSoldier, ATTACKTYPE *pBestShot, BOOLEAN s { DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("CheckIfShotPossible: CalcBestShot")); // then look around for a worthy target (which sets bestThrow.ubPossible) - CalcBestShot( pSoldier, pBestShot,!suppressionFire); + CalcBestShot( pSoldier, pBestShot,TRUE); DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("CheckIfShotPossible: CalcBestShot done")); } } diff --git a/TacticalAI/DecideAction.cpp b/TacticalAI/DecideAction.cpp index 0965c481..e6c5db5a 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 @@ -3747,7 +3748,11 @@ bCanAttack = FALSE; if (pSoldier->bActionPoints >= ubMinAPCost) { // look around for a worthy target (which sets BestShot.ubPossible) - CalcBestShot(pSoldier,&BestShot,FALSE); + BOOLEAN shootUnseen = FALSE; + if (gGameOptions.ubDifficultyLevel > DIF_LEVEL_MEDIUM ) + shootUnseen = TRUE; + + CalcBestShot(pSoldier,&BestShot,shootUnseen); if (pSoldier->bTeam == gbPlayerNum && pSoldier->bRTPCombat == RTP_COMBAT_CONSERVE) { diff --git a/TacticalAI/FindLocations.cpp b/TacticalAI/FindLocations.cpp index e9362e18..fc630de4 100644 --- a/TacticalAI/FindLocations.cpp +++ b/TacticalAI/FindLocations.cpp @@ -914,14 +914,16 @@ INT16 FindBestNearbyCover(SOLDIERTYPE *pSoldier, INT32 morale, INT32 *piPercentB continue; } - if ( !fHasGasMask ) + if ( InGas( pSoldier, sGridNo ) ) { - if ( InGas( pSoldier, sGridNo ) ) - { - continue; - } + continue; } + //Madd: skip cover in light + if ( InLightAtNight( sGridNo, pSoldier->bLevel ) ) + continue; + + // ignore blacklisted spot if ( sGridNo == pSoldier->sBlackList ) { @@ -1322,14 +1324,6 @@ INT16 FindSpotMaxDistFromOpponents(SOLDIERTYPE *pSoldier) continue; } - if ( !fHasGasMask ) - { - if ( InGas( pSoldier, sGridNo ) ) - { - continue; - } - } - if ( pSoldier->bTeam == CIV_TEAM ) { iRoamRange = RoamingRange( pSoldier, &sOrigin ); @@ -1345,6 +1339,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); @@ -2535,20 +2533,16 @@ INT16 FindFlankingSpot(SOLDIERTYPE *pSoldier, INT16 sPos, INT8 bAction ) continue; } - if ( !fHasGasMask ) - { - if ( InGas( pSoldier, sGridNo ) ) - { - continue; - } - } - // exclude locations with tear/mustard gas (at this point, smoke is cool!) if ( InGas( pSoldier, sGridNo ) ) { continue; } + //Madd: skip lighted spots + if ( InLightAtNight( sGridNo, pSoldier->bLevel ) ) + continue; + // allow an extra direction for flanking if ( bAction == AI_ACTION_FLANK_LEFT ) {