From e8d9acba8c67aff6ffd094afc72b012526c7d8e0 Mon Sep 17 00:00:00 2001 From: Flugente Date: Thu, 11 Apr 2013 21:33:28 +0000 Subject: [PATCH] - added team-specific modifiers for AI suppression - Fix: incorrect platoon spawning wehn initializing Cambria counter attack git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@5996 3b4a5df2-a311-0410-b5c6-a8a6f20db521 --- GameSettings.cpp | 4 ++++ GameSettings.h | 4 ++++ Strategic/Strategic AI.cpp | 18 +++++++++++++----- Tactical/Overhead.cpp | 8 +++++++- 4 files changed, 28 insertions(+), 6 deletions(-) diff --git a/GameSettings.cpp b/GameSettings.cpp index 6a7e3d152..5d2ea0f3c 100644 --- a/GameSettings.cpp +++ b/GameSettings.cpp @@ -1331,6 +1331,10 @@ void LoadGameExternalOptions() gGameExternalOptions.ubSuppressionToleranceMax = iniReader.ReadInteger("Tactical Suppression Fire Settings","SUPPRESSION_TOLERANCE_MAX", 18, 1, 24); gGameExternalOptions.ubSuppressionToleranceMin = iniReader.ReadInteger("Tactical Suppression Fire Settings","SUPPRESSION_TOLERANCE_MIN", 1, 0, 24); + // Flugente: suppression effectiveness modifiers for teams + gGameExternalOptions.usSuppressionEffectivenessPlayer = iniReader.ReadInteger("Tactical Suppression Fire Settings","SUPPRESSION_EFFECTIVENESS_PLAYER", 100, 0, 1000); + gGameExternalOptions.usSuppressionEffectivenessAI = iniReader.ReadInteger("Tactical Suppression Fire Settings","SUPPRESSION_EFFECTIVENESS_AI", 100, 0, 1000); + // HEADROCK HAM 3.2: This feature allows the status, leadership and experience of nearby friendlies help/hinder a character's tolerance, based on their distance from him. gGameExternalOptions.fFriendliesAffectTolerance = iniReader.ReadBoolean("Tactical Suppression Fire Settings","NEARBY_FRIENDLIES_AFFECT_TOLERANCE", FALSE); diff --git a/GameSettings.h b/GameSettings.h index b12184cd0..dd04b37f1 100644 --- a/GameSettings.h +++ b/GameSettings.h @@ -809,6 +809,10 @@ typedef struct UINT8 ubSuppressionToleranceMax; UINT8 ubSuppressionToleranceMin; + // Flugente: suppression modifiers for player and other teams + UINT16 usSuppressionEffectivenessPlayer; + UINT16 usSuppressionEffectivenessAI; + // HEADROCK HAM B2: Suppression Shock effectiveness (percentage, 100 = "normal", 0 = deactivated. Range 0-65535) UINT16 usSuppressionShockEffect; diff --git a/Strategic/Strategic AI.cpp b/Strategic/Strategic AI.cpp index d03ea1526..f0779fb95 100644 --- a/Strategic/Strategic AI.cpp +++ b/Strategic/Strategic AI.cpp @@ -4432,8 +4432,8 @@ void ExecuteStrategicAIAction( UINT16 usActionCode, INT16 sSectorX, INT16 sSecto ubSourceSectorID = SEC_P3; stagesector0 = SEC_M2; - stagesector1 = SEC_M3; - stagesector2 = SEC_M3; + stagesector1 = ubSourceSectorID; + stagesector2 = ubSourceSectorID; stagesector3 = SEC_M6; assaultsector0 = SEC_H4; @@ -4449,11 +4449,19 @@ void ExecuteStrategicAIAction( UINT16 usActionCode, INT16 sSectorX, INT16 sSecto if ( !(SectorInfo[ ubSourceSectorID ].ubNumTroops > 0) ) ubSourceSectorID = SEC_P3; - stagesector0 = SEC_M6; - stagesector1 = SEC_M6; - stagesector2 = SEC_M6; + stagesector0 = ubSourceSectorID; + stagesector1 = ubSourceSectorID; + stagesector2 = ubSourceSectorID; stagesector3 = SEC_L11; + if ( !(SectorInfo[ stagesector3 ].ubNumTroops > 0) ) + { + ubSourceSectorID = SEC_N9; + + if ( !(SectorInfo[ stagesector3 ].ubNumTroops > 0) ) + ubSourceSectorID = ubSourceSectorID; + } + assaultsector0 = SEC_I8; assaultsector1 = SEC_I8; assaultsector2 = SEC_H7; diff --git a/Tactical/Overhead.cpp b/Tactical/Overhead.cpp index d152a5bb2..9f5619d1c 100644 --- a/Tactical/Overhead.cpp +++ b/Tactical/Overhead.cpp @@ -8224,6 +8224,12 @@ void HandleSuppressionFire( UINT8 ubTargetedMerc, UINT8 ubCausedAttacker ) // more shallow. // The relation between AP Loss and Suppression Points is LINEAR. ubPointsLost = ( ( (pSoldier->ubSuppressionPoints * APBPConstants[AP_SUPPRESSION_MOD]) / (bTolerance + 6) ) * 2 + 1 ) / 2; + + // Flugente: added ini options for suppression effectiveness for player team and everybody else + if ( pSoldier->bTeam == gbPlayerNum ) + sFinalSuppressionEffectiveness = sFinalSuppressionEffectiveness * gGameExternalOptions.usSuppressionEffectivenessPlayer / 100; + else + sFinalSuppressionEffectiveness = sFinalSuppressionEffectiveness * gGameExternalOptions.usSuppressionEffectivenessAI / 100; // INI-Controlled intensity. SuppressionEffectiveness acts as a percentage applied to the number of lost APs. // To turn off the entire Suppression system, simply set the INI value to 0. (0% AP Loss) @@ -8236,7 +8242,7 @@ void HandleSuppressionFire( UINT8 ubTargetedMerc, UINT8 ubCausedAttacker ) { if (ubPointsLost > usLimitSuppressionAPsLostPerAttack) { - // Flugente: eh.. woudln't this _always_ be 255? I suspect this should be __min + // Flugente: eh.. wouldn't this _always_ be 255? I suspect this should be __min //ubPointsLost = __max(255,(UINT8)usLimitSuppressionAPsLostPerAttack); ubPointsLost = __min(255,(UINT8)usLimitSuppressionAPsLostPerAttack); }