diff --git a/GameInitOptionsScreen.h b/GameInitOptionsScreen.h index 3f297d62..213ae016 100644 --- a/GameInitOptionsScreen.h +++ b/GameInitOptionsScreen.h @@ -16,7 +16,7 @@ enum DIF_LEVEL_MEDIUM, DIF_LEVEL_HARD, DIF_LEVEL_INSANE, - MAX_DIF_LEVEL = 15, + MAX_DIF_LEVEL, }; typedef struct @@ -31,6 +31,7 @@ typedef struct UINT16 iNumKillsPerProgressPoint; INT32 iInitialGarrisonPercentages; UINT8 iMinEnemyGroupSize; + UINT8 iCounterAttackGroupSize; BOOLEAN bUnlimitedPoolOfTroops; INT32 iQueensInitialPoolOfTroops; UINT32 iQueenPoolIncrementPerDifficultyLevel; diff --git a/GameVersion.cpp b/GameVersion.cpp index 1491551b..e8017151 100644 --- a/GameVersion.cpp +++ b/GameVersion.cpp @@ -15,9 +15,9 @@ #ifdef JA2EDITOR #ifdef JA2UB - CHAR16 zVersionLabel[256] = { L"Unfinished Business - Map Editor v1.13.8384 (Development Build)" }; + CHAR16 zVersionLabel[256] = { L"Unfinished Business - Map Editor v1.13.8396 (Development Build)" }; #else - CHAR16 zVersionLabel[256] = { L"Map Editor v1.13.8384 (Development Build)" }; + CHAR16 zVersionLabel[256] = { L"Map Editor v1.13.8396 (Development Build)" }; #endif // ------------------------------ @@ -27,11 +27,11 @@ //DEBUG BUILD VERSION #ifdef JA2UB - CHAR16 zVersionLabel[256] = { L"Debug: Unfinished Business - v1.13.8384 (Development Build)" }; + CHAR16 zVersionLabel[256] = { L"Debug: Unfinished Business - v1.13.8396 (Development Build)" }; #elif defined (JA113DEMO) - CHAR16 zVersionLabel[256] = { L"Debug: JA2 Demo - v1.13.8384 (Development Build)" }; + CHAR16 zVersionLabel[256] = { L"Debug: JA2 Demo - v1.13.8396 (Development Build)" }; #else - CHAR16 zVersionLabel[256] = { L"Debug: v1.13.8384 (Development Build)" }; + CHAR16 zVersionLabel[256] = { L"Debug: v1.13.8396 (Development Build)" }; #endif #elif defined CRIPPLED_VERSION @@ -46,16 +46,16 @@ //RELEASE BUILD VERSION #ifdef JA2UB - CHAR16 zVersionLabel[256] = { L"Release Unfinished Business - v1.13.8384 (Development Build)" }; + CHAR16 zVersionLabel[256] = { L"Release Unfinished Business - v1.13.8396 (Development Build)" }; #elif defined (JA113DEMO) - CHAR16 zVersionLabel[256] = { L"Release JA2 Demo - v1.13.8384 (Development Build)" }; + CHAR16 zVersionLabel[256] = { L"Release JA2 Demo - v1.13.8396 (Development Build)" }; #else - CHAR16 zVersionLabel[256] = { L"Release v1.13.8384 (Development Build)" }; + CHAR16 zVersionLabel[256] = { L"Release v1.13.8396 (Development Build)" }; #endif #endif -CHAR8 czVersionNumber[16] = { "Build 17.01.29" }; //YY.MM.DD +CHAR8 czVersionNumber[16] = { "Build 17.03.14" }; //YY.MM.DD CHAR16 zTrackingNumber[16] = { L"Z" }; // SAVE_GAME_VERSION is defined in header, change it there diff --git a/Strategic/Strategic AI.cpp b/Strategic/Strategic AI.cpp index b787de55..90bda79c 100644 --- a/Strategic/Strategic AI.cpp +++ b/Strategic/Strategic AI.cpp @@ -4556,23 +4556,8 @@ void ExecuteStrategicAIAction( UINT16 usActionCode, INT16 sSectorX, INT16 sSecto if ( !NumNonPlayerTeamMembersInSector( SECTORX( ubSourceSectorID ), SECTORY( ubSourceSectorID ), ENEMY_TEAM ) ) ubSourceSectorID = SECTOR( gModSettings.ubSAISpawnSectorX, gModSettings.ubSAISpawnSectorY ); - UINT8 val; - if( gGameOptions.ubDifficultyLevel == DIF_LEVEL_EASY ) - val = 1; - else if( gGameOptions.ubDifficultyLevel == DIF_LEVEL_MEDIUM ) - val = 2; - else if( gGameOptions.ubDifficultyLevel == DIF_LEVEL_HARD ) - val = 3; - else if( gGameOptions.ubDifficultyLevel == DIF_LEVEL_INSANE ) - val = 4; - else - { - val = Random (4); - if (val == 0) - val = 1; - } - - ubNumSoldiers = (UINT8)( gubMinEnemyGroupSize + val * 3); + // make sure that we use at least the min group size + ubNumSoldiers = (UINT8)( __max(zDiffSetting[gGameOptions.ubDifficultyLevel].iCounterAttackGroupSize, zDiffSetting[gGameOptions.ubDifficultyLevel].iMinEnemyGroupSize) ); // anv: replace one of soldiers with tank if ( ubNumSoldiers ) @@ -4584,7 +4569,7 @@ void ExecuteStrategicAIAction( UINT16 usActionCode, INT16 sSectorX, INT16 sSecto grouptanks[ubCounter] = 0; groupjeeps[ubCounter] = 0; - if ( Random( 10 ) < val ) + if ( Random( 10 ) < gGameOptions.ubDifficultyLevel ) { if ( gGameExternalOptions.fArmyUsesJeepsInAttacks && ASDSoldierUpgradeToJeep( ) ) { @@ -4598,8 +4583,12 @@ void ExecuteStrategicAIAction( UINT16 usActionCode, INT16 sSectorX, INT16 sSecto } } - if ( val > 0 ) - groupelites[ubCounter] = grouptroops[ubCounter] - grouptroops[ubCounter] / val; + // replace some soldiers with elites + if ( gGameOptions.ubDifficultyLevel > 0 ) + { + groupelites[ubCounter] = grouptroops[ubCounter] - grouptroops[ubCounter] / gGameOptions.ubDifficultyLevel; + grouptroops[ubCounter] -= groupelites[ubCounter]; + } totalusedsoldiers += grouptroops[ubCounter] + groupelites[ubCounter] + grouptanks[ubCounter] + groupjeeps[ubCounter]; } @@ -4655,23 +4644,9 @@ void ExecuteStrategicAIAction( UINT16 usActionCode, INT16 sSectorX, INT16 sSecto break; } - UINT8 value; - if( gGameOptions.ubDifficultyLevel == DIF_LEVEL_EASY ) - value = 1; - else if( gGameOptions.ubDifficultyLevel == DIF_LEVEL_MEDIUM ) - value = 2; - else if( gGameOptions.ubDifficultyLevel == DIF_LEVEL_HARD ) - value = 3; - else if( gGameOptions.ubDifficultyLevel == DIF_LEVEL_INSANE ) - value = 4; - else - { - value = Random (4); - if (value == 0) value = 1; - } - - ubNumSoldiers = (UINT8)( gubMinEnemyGroupSize + value * 3); - + // make sure that we use at least the min group size + ubNumSoldiers = (UINT8)( __max(zDiffSetting[gGameOptions.ubDifficultyLevel].iCounterAttackGroupSize, zDiffSetting[gGameOptions.ubDifficultyLevel].iMinEnemyGroupSize) ); + // anv: replace one of soldiers with tank for( UINT8 ubCounter = 0; ubCounter < 4; ++ubCounter ) { @@ -4682,7 +4657,7 @@ void ExecuteStrategicAIAction( UINT16 usActionCode, INT16 sSectorX, INT16 sSecto if( ubNumSoldiers ) { - if ( Random( 10 ) < value ) + if ( Random( 10 ) < gGameOptions.ubDifficultyLevel ) { if ( gGameExternalOptions.fArmyUsesJeepsInAttacks && ASDSoldierUpgradeToJeep( ) ) { @@ -4697,8 +4672,11 @@ void ExecuteStrategicAIAction( UINT16 usActionCode, INT16 sSectorX, INT16 sSecto } } - if ( value > 0 ) - groupelites[ubCounter] = grouptroops[ubCounter] - grouptroops[ubCounter] / value; + if ( gGameOptions.ubDifficultyLevel > 0 ) + { + groupelites[ubCounter] = grouptroops[ubCounter] - grouptroops[ubCounter] / gGameOptions.ubDifficultyLevel; + grouptroops[ubCounter] -= groupelites[ubCounter]; + } totalusedsoldiers += grouptroops[ubCounter] + groupelites[ubCounter] + grouptanks[ubCounter] + groupjeeps[ubCounter]; } diff --git a/XML_DifficultySettings.cpp b/XML_DifficultySettings.cpp index 8796d918..becb2ec8 100644 --- a/XML_DifficultySettings.cpp +++ b/XML_DifficultySettings.cpp @@ -55,6 +55,7 @@ DifficultySettingsParseDataStartElementHandle(void *userData, const XML_Char *na strcmp(name, "NumKillsPerProgressPoint") == 0 || strcmp(name, "InitialGarrisonPercentages") == 0 || strcmp(name, "MinEnemyGroupSize") == 0 || + strcmp(name, "CounterAttackGroupSize") == 0 || strcmp(name, "UnlimitedPoolOfTroops") == 0 || strcmp(name, "QueensInitialPoolOfTroops") == 0 || strcmp(name, "QueenPoolIncrementPerDifficultyLevel") == 0 || @@ -161,6 +162,7 @@ difficultySettingsEndElementHandle(void *userData, const XML_Char *name) zDiffSetting[pData->curDifficultySettings.uiIndex].iNumKillsPerProgressPoint = pData->curDifficultySettings.iNumKillsPerProgressPoint; zDiffSetting[pData->curDifficultySettings.uiIndex].iInitialGarrisonPercentages = pData->curDifficultySettings.iInitialGarrisonPercentages; zDiffSetting[pData->curDifficultySettings.uiIndex].iMinEnemyGroupSize = pData->curDifficultySettings.iMinEnemyGroupSize; + zDiffSetting[pData->curDifficultySettings.uiIndex].iCounterAttackGroupSize = pData->curDifficultySettings.iCounterAttackGroupSize; zDiffSetting[pData->curDifficultySettings.uiIndex].bUnlimitedPoolOfTroops = pData->curDifficultySettings.bUnlimitedPoolOfTroops; zDiffSetting[pData->curDifficultySettings.uiIndex].iQueensInitialPoolOfTroops = pData->curDifficultySettings.iQueensInitialPoolOfTroops; zDiffSetting[pData->curDifficultySettings.uiIndex].iQueenPoolIncrementPerDifficultyLevel = pData->curDifficultySettings.iQueenPoolIncrementPerDifficultyLevel; @@ -286,6 +288,11 @@ difficultySettingsEndElementHandle(void *userData, const XML_Char *name) pData->curElement = ELEMENT; pData->curDifficultySettings.iMinEnemyGroupSize = (UINT8) atol(pData->szCharData); } + else if(strcmp(name, "CounterAttackGroupSize") == 0) + { + pData->curElement = ELEMENT; + pData->curDifficultySettings.iCounterAttackGroupSize = (UINT8) atol(pData->szCharData); + } else if(strcmp(name, "PercentElitesBonus") == 0) { pData->curElement = ELEMENT;