From 561a3c97477fac90f53ecd80a5bb47ecd0dda2e0 Mon Sep 17 00:00:00 2001 From: lalien Date: Wed, 31 May 2006 20:04:47 +0000 Subject: [PATCH] - externalized settings for mobile militia - made default militia settings less aggressive - added a message for breaking locks/doors git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@147 3b4a5df2-a311-0410-b5c6-a8a6f20db521 --- GameSettings.cpp | 15 +++++++++++---- GameSettings.h | 9 +++++++++ GameVersion.cpp | 2 +- JA2.vcproj | 4 ++-- Strategic/MilitiaSquads.cpp | 32 ++++++++++++++++---------------- Strategic/MilitiaSquads.h | 2 +- Strategic/Reinforcement.cpp | 6 +++--- Tactical/Keys.cpp | 4 ++++ 8 files changed, 47 insertions(+), 27 deletions(-) diff --git a/GameSettings.cpp b/GameSettings.cpp index 915e34b8..5a3ac7fc 100644 --- a/GameSettings.cpp +++ b/GameSettings.cpp @@ -353,11 +353,18 @@ void LoadGameExternalOptions() // Militia Settings gGameExternalOptions.fAllowTacticalMilitiaCommand = iniReader.ReadBoolean("JA2 Tactical Settings","ALLOW_TACTICAL_MILITIA_COMMAND",1); - gGameExternalOptions.gfAllowMilitiaGroups = iniReader.ReadBoolean("JA2 Gameplay Settings","ALLOW_MILITIA_MOBILE_GROUPS",1); - gGameExternalOptions.gfAllowReinforcements = iniReader.ReadBoolean("JA2 Gameplay Settings","ALLOW_REINFORCEMENTS",1); - gGameExternalOptions.gfAllowReinforcementsOnlyInCity = iniReader.ReadBoolean("JA2 Gameplay Settings","ALLOW_REINFORCEMENTS_ONLY_IN_CITIES",0); - gGameExternalOptions.guiBaseQueenPoolIncrement = iniReader.ReadInteger("JA2 Gameplay Settings","QUEEN_POOL_INCREMENT_PER_DIFFICULTY_LEVEL",60); + gGameExternalOptions.gfAllowMilitiaGroups = iniReader.ReadBoolean("JA2 Gameplay Settings","ALLOW_MILITIA_MOBILE_GROUPS",1); + gGameExternalOptions.gfAllowReinforcements = iniReader.ReadBoolean("JA2 Gameplay Settings","ALLOW_REINFORCEMENTS",1); + gGameExternalOptions.gfAllowReinforcementsOnlyInCity = iniReader.ReadBoolean("JA2 Gameplay Settings","ALLOW_REINFORCEMENTS_ONLY_IN_CITIES",0); + gGameExternalOptions.guiBaseQueenPoolIncrement = iniReader.ReadInteger("JA2 Gameplay Settings","QUEEN_POOL_INCREMENT_PER_DIFFICULTY_LEVEL",60); + gGameExternalOptions.guiCreateEachNHours = iniReader.ReadInteger("JA2 Gameplay Settings","CREATE_EACH_N_HOURS",24); + gGameExternalOptions.guiDivOfOriginalMilitia = iniReader.ReadInteger("JA2 Gameplay Settings","DIV_OF_ORIGINAL_MILITIA",4); + gGameExternalOptions.guiMinMilitiaSquadSize = iniReader.ReadInteger("JA2 Gameplay Settings","MINIMUM_MILITIA_SQUAD_SIZE",5); + gGameExternalOptions.guiMaxMilitiaSquadSize = iniReader.ReadInteger("JA2 Gameplay Settings","MAXIMUM_MILITIA_SQUAD_SIZE",20); + gGameExternalOptions.guiMaxMilitiaSquadSizeBattle = iniReader.ReadInteger("JA2 Gameplay Settings","MAXIMUM_MILITIA_SQUAD_SIZE_BATTLE",20); + + //Sight range gGameExternalOptions.ubStraightSightRange = iniReader.ReadInteger("JA2 Tactical Settings","BASE_SIGHT_RANGE",13); gGameExternalOptions.ubVisDistDecreasePerRainIntensity = iniReader.ReadInteger("JA2 Tactical Settings","VISUAL_DISTANCE_DECREASE_PER_RAIN_INTENSITY",20); diff --git a/GameSettings.h b/GameSettings.h index f10d9c94..02065959 100644 --- a/GameSettings.h +++ b/GameSettings.h @@ -204,6 +204,15 @@ typedef struct BOOLEAN gfAllowReinforcementsOnlyInCity; UINT32 guiBaseQueenPoolIncrement; + UINT32 guiCreateEachNHours; + UINT32 guiDivOfOriginalMilitia; + UINT32 guiMinMilitiaSquadSize; + UINT32 guiMaxMilitiaSquadSize; + UINT32 guiMaxMilitiaSquadSizeBattle; + + + + //Sight range UINT8 ubStraightSightRange; UINT32 ubVisDistDecreasePerRainIntensity; diff --git a/GameVersion.cpp b/GameVersion.cpp index 7a826cd3..694696d1 100644 --- a/GameVersion.cpp +++ b/GameVersion.cpp @@ -23,7 +23,7 @@ INT16 zVersionLabel[256] = { L"Beta v. 0.98" }; #else //RELEASE BUILD VERSION - INT16 zVersionLabel[256] = { L"Release v1.13.146" }; + INT16 zVersionLabel[256] = { L"Release v1.13.147" }; #endif diff --git a/JA2.vcproj b/JA2.vcproj index c7c1a17c..e40996bf 100644 --- a/JA2.vcproj +++ b/JA2.vcproj @@ -43,7 +43,7 @@ ubNumberOfCivsAtLevel[ GREEN_MILITIA ] / DIV_OF_ORIGINAL_MILITIA); - StrategicAddMilitiaToSector( sTMapX, sTMapY, REGULAR_MILITIA, pSectorInfo->ubNumberOfCivsAtLevel[ REGULAR_MILITIA ] / DIV_OF_ORIGINAL_MILITIA); - StrategicAddMilitiaToSector( sTMapX, sTMapY, ELITE_MILITIA, pSectorInfo->ubNumberOfCivsAtLevel[ ELITE_MILITIA ] / DIV_OF_ORIGINAL_MILITIA); + StrategicAddMilitiaToSector( sTMapX, sTMapY, GREEN_MILITIA, pSectorInfo->ubNumberOfCivsAtLevel[ GREEN_MILITIA ] / gGameExternalOptions.guiDivOfOriginalMilitia); + StrategicAddMilitiaToSector( sTMapX, sTMapY, REGULAR_MILITIA, pSectorInfo->ubNumberOfCivsAtLevel[ REGULAR_MILITIA ] / gGameExternalOptions.guiDivOfOriginalMilitia); + StrategicAddMilitiaToSector( sTMapX, sTMapY, ELITE_MILITIA, pSectorInfo->ubNumberOfCivsAtLevel[ ELITE_MILITIA ] / gGameExternalOptions.guiDivOfOriginalMilitia); pSectorInfo = &( SectorInfo[ SECTOR( sTMapX, sTMapY ) ] ); - while( CountMilitia(pSectorInfo) > MAXIMUM_MILITIA_SQUAD_SIZE ) + while( CountMilitia(pSectorInfo) > gGameExternalOptions.guiMaxMilitiaSquadSize ) if(pSectorInfo->ubNumberOfCivsAtLevel[GREEN_MILITIA])--pSectorInfo->ubNumberOfCivsAtLevel[GREEN_MILITIA];else if(pSectorInfo->ubNumberOfCivsAtLevel[REGULAR_MILITIA])--pSectorInfo->ubNumberOfCivsAtLevel[REGULAR_MILITIA];else if(pSectorInfo->ubNumberOfCivsAtLevel[ELITE_MILITIA])--pSectorInfo->ubNumberOfCivsAtLevel[ELITE_MILITIA]; @@ -160,8 +160,8 @@ void MoveMilitiaSquad(INT16 sMapX, INT16 sMapY, INT16 sTMapX, INT16 sTMapY, BOOL StrategicRemoveMilitiaFromSector( sMapX, sMapY, REGULAR_MILITIA, pSectorInfo->ubNumberOfCivsAtLevel[ REGULAR_MILITIA ] ); StrategicRemoveMilitiaFromSector( sMapX, sMapY, ELITE_MILITIA, pSectorInfo->ubNumberOfCivsAtLevel[ ELITE_MILITIA ] ); - while( !fAlternativeMax && CountMilitia(pTSectorInfo) > MAXIMUM_MILITIA_SQUAD_SIZE || - fAlternativeMax && CountMilitia(pTSectorInfo) > MAXIMUM_MILITIA_SQUAD_SIZE_BATTLE ) + while( !fAlternativeMax && CountMilitia(pTSectorInfo) > gGameExternalOptions.guiMaxMilitiaSquadSize || + fAlternativeMax && CountMilitia(pTSectorInfo) > gGameExternalOptions.guiMaxMilitiaSquadSizeBattle ) if(pTSectorInfo->ubNumberOfCivsAtLevel[GREEN_MILITIA]) {--pTSectorInfo->ubNumberOfCivsAtLevel[GREEN_MILITIA];++pSectorInfo->ubNumberOfCivsAtLevel[GREEN_MILITIA];}else if(pTSectorInfo->ubNumberOfCivsAtLevel[REGULAR_MILITIA]) @@ -289,7 +289,7 @@ UINT16 CountDirectionRating( INT16 sMapX, INT16 sMapY, UINT8 uiDir ) } if( CountAllMilitiaInSector( sDMapX, sDMapY ) && - CountAllMilitiaInSector( sDMapX, sDMapY ) + CountAllMilitiaInSector( sMapX, sMapY ) <= MAXIMUM_MILITIA_SQUAD_SIZE ) + CountAllMilitiaInSector( sDMapX, sDMapY ) + CountAllMilitiaInSector( sMapX, sMapY ) <= gGameExternalOptions.guiMaxMilitiaSquadSize ) iRes += DIR_WITH_UNFULL_SQUAD_RATING_BONUS; if( NumEnemiesInSector( sDMapX, sDMapY ) ) @@ -328,7 +328,7 @@ BOOLEAN CheckStandardConditionsForDirection( INT16 sSMapX, INT16 sSMapY, INT16 s return (GetTownIdForSector( sMapX, sMapY ) == BLANK_SECTOR || fWithCities) && !IsThisSectorASAMSector( sMapX, sMapY , 0 ) && (GetTownIdForSector( sMapX, sMapY ) != BLANK_SECTOR || !fOnlyCitySectors);// && // ( !NumEnemiesInSector( sMapX, sMapY ) || GetEnemyGroupIdInSector(sMapX, sMapY ) || fForBattle ) && -// ( fForBattle || CountAllMilitiaInSector( sMapX, sMapY ) < MAXIMUM_MILITIA_SQUAD_SIZE || PlayerMercsInSector( sMapX, sMapY, 0 ) ) +// ( fForBattle || CountAllMilitiaInSector( sMapX, sMapY ) < gGameExternalOptions.guiMaxMilitiaSquadSize || PlayerMercsInSector( sMapX, sMapY, 0 ) ) } void GenerateDirectionInfos( INT16 sMapX, INT16 sMapY, UINT8* uiDirNumber, UINT16 pMoveDir[4][3], BOOLEAN fWithCities, BOOLEAN fForBattle, BOOLEAN fOnlyCitySectors ) @@ -459,7 +459,7 @@ void UpdateMilitiaSquads(INT16 sMapX, INT16 sMapY ) // new squad if( GetTownIdForSector( sMapX, sMapY ) != BLANK_SECTOR ) { - if( GetWorldHour() % CREATE_EACH_N_HOURS )return; + if( GetWorldHour() % gGameExternalOptions.guiCreateEachNHours )return; GenerateDirectionInfos( sMapX, sMapY, &uiDirNumber, pMoveDir, FALSE, FALSE, FALSE ); @@ -524,7 +524,7 @@ void UpdateMilitiaSquads(INT16 sMapX, INT16 sMapY ) // ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"%ld,%ld", x, pMoveDir[x][1]); iRandom = Random( pMoveDir[ uiDirNumber - 1 ][1] + - ( uiMilitiaCount >= MINIMUM_MILITIA_SQUAD_SIZE ? CHANCE_TO_MOVE_A_SQUAD : CHANCE_TO_MOVE_AN_UNFULL_SQUAD ) ); + ( uiMilitiaCount >= gGameExternalOptions.guiMinMilitiaSquadSize ? CHANCE_TO_MOVE_A_SQUAD : CHANCE_TO_MOVE_AN_UNFULL_SQUAD ) ); //ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"Roll %ld", iRandomRes); @@ -601,7 +601,7 @@ void DoMilitiaHelpFromAdjacentSectors( INT16 sMapX, INT16 sMapY ) guiDirNumber = uiDirNumber + 1; x = 0; - while( CountMilitia(pSectorInfo ) < MAXIMUM_MILITIA_SQUAD_SIZE_BATTLE && + while( CountMilitia(pSectorInfo ) < gGameExternalOptions.guiMaxMilitiaSquadSizeBattle && ( fMoreTroopsLeft[0] || fMoreTroopsLeft[1] || fMoreTroopsLeft[2] || fMoreTroopsLeft[3] || fFirstLoop ) ) { fMoreTroopsLeft[ x ] = MoveOneBestMilitiaMan( SECTORX( pMoveDir[ x ][0] ), SECTORY( pMoveDir[ x ][0] ), sMapX, sMapY ); @@ -663,7 +663,7 @@ void MilitiaHelpFromAdjacentSectors( INT16 sMapX, INT16 sMapY ) if( CountAllMilitiaInSector( sMapX, sMapY ) ) MSCallBack( MSG_BOX_RETURN_YES ); - if( IsThereMilitiaInAdjacentSector( sMapX, sMapY ) && CountAllMilitiaInSector( sMapX, sMapY ) < MAXIMUM_MILITIA_SQUAD_SIZE_BATTLE ) + if( IsThereMilitiaInAdjacentSector( sMapX, sMapY ) && CountAllMilitiaInSector( sMapX, sMapY ) < gGameExternalOptions.guiMaxMilitiaSquadSizeBattle ) DoScreenIndependantMessageBox( gzCWStrings[0], MSG_BOX_FLAG_YESNO, MSCallBack ); } diff --git a/Strategic/MilitiaSquads.h b/Strategic/MilitiaSquads.h index e539b630..c7d3b314 100644 --- a/Strategic/MilitiaSquads.h +++ b/Strategic/MilitiaSquads.h @@ -6,7 +6,7 @@ #include "Types.h" #include "Soldier Control.h" -#define MAXIMUM_MILITIA_SQUAD_SIZE 30 +//#define MAXIMUM_MILITIA_SQUAD_SIZE 30 extern UINT8 gpAttackDirs[5][4]; extern UINT8 guiDirNumber; diff --git a/Strategic/Reinforcement.cpp b/Strategic/Reinforcement.cpp index 0d3fe837..41953b65 100644 --- a/Strategic/Reinforcement.cpp +++ b/Strategic/Reinforcement.cpp @@ -179,7 +179,7 @@ BOOLEAN ARMoveBestMilitiaManFromAdjacentSector(INT16 sMapX, INT16 sMapY) if( !gGameExternalOptions.gfAllowReinforcements ) return FALSE; - if( CountAllMilitiaInSector( sMapX, sMapY ) >= MAXIMUM_MILITIA_SQUAD_SIZE || + if( CountAllMilitiaInSector( sMapX, sMapY ) >= gGameExternalOptions.guiMaxMilitiaSquadSize || CountAllMilitiaInFiveSectors( sMapX, sMapY ) - CountAllMilitiaInSector( sMapX, sMapY ) == 0 ) return FALSE; @@ -315,7 +315,7 @@ UINT8 NumFreeMilitiaSlots() if( !pSoldier->bActive ) ubNumFreeSlots++; } - return max( 0 , ubNumFreeSlots - ( 32 - MAXIMUM_MILITIA_SQUAD_SIZE ) ); + return max( 0 , ubNumFreeSlots - ( 32 - gGameExternalOptions.guiMaxMilitiaSquadSize ) ); } UINT8 DoReinforcementAsPendingMilitia( INT16 sMapX, INT16 sMapY, UINT8 *pubRank ) @@ -379,7 +379,7 @@ void AddPossiblePendingMilitiaToBattle() if( !PlayerMercsInSector( gWorldSectorX, gWorldSectorY, 0 ) || !CountAllMilitiaInSector( gWorldSectorX, gWorldSectorY ) || !NumEnemiesInSector( gWorldSectorX, gWorldSectorY ) ) return; -//MAXIMUM_MILITIA_SQUAD_SIZE - CountAllMilitiaInSector( gWorldSectorX, gWorldSectorY ); +//gGameExternalOptions.guiMaxMilitiaSquadSize - CountAllMilitiaInSector( gWorldSectorX, gWorldSectorY ); ubSlots = NumFreeMilitiaSlots(); if( !ubSlots ) { //no available slots to add militia to. Try again later... diff --git a/Tactical/Keys.cpp b/Tactical/Keys.cpp index 4c4dbc95..365c5fc6 100644 --- a/Tactical/Keys.cpp +++ b/Tactical/Keys.cpp @@ -367,6 +367,8 @@ BOOLEAN AttemptToCrowbarLock( SOLDIERTYPE * pSoldier, DOOR * pDoor ) { if (iResult > -10) { + ScreenMsg( MSG_FONT_YELLOW, MSG_INTERFACE, TacticalStr[ LOCK_HAS_BEEN_HIT ] ); + // STR GAIN - Damaged a lock by prying StatChange( pSoldier, STRAMT, 5, FALSE ); @@ -445,6 +447,8 @@ BOOLEAN AttemptToSmashDoor( SOLDIERTYPE * pSoldier, DOOR * pDoor ) { if (iResult > -10) { + ScreenMsg( MSG_FONT_YELLOW, MSG_INTERFACE, TacticalStr[ LOCK_HAS_BEEN_HIT ] ); + // STR GAIN - Damaged a lock by prying StatChange( pSoldier, STRAMT, 5, FALSE );