From ee27f27895271049d14eb58cec6486b4020771ce Mon Sep 17 00:00:00 2001 From: Flugente Date: Sun, 31 Aug 2014 20:42:20 +0000 Subject: [PATCH] removed obsolete code git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@7464 3b4a5df2-a311-0410-b5c6-a8a6f20db521 --- GameInitOptionsScreen.cpp | 90 ++------------ GameInitOptionsScreen.h | 13 +- GameSettings.cpp | 6 +- GameSettings.h | 24 +--- MPHostScreen.cpp | 1 - Strategic/Assignments.cpp | 47 +------- Strategic/Campaign Init.cpp | 47 +------- Strategic/Creature Spreading.cpp | 149 +++-------------------- Strategic/Game Init.cpp | 36 +----- Strategic/LuaInitNPCs.cpp | 30 +---- Strategic/Meanwhile.cpp | 6 +- Strategic/Player Command.cpp | 13 +- Strategic/PreBattle Interface.cpp | 12 +- Strategic/Queen Command.cpp | 7 +- Strategic/Reinforcement.cpp | 4 +- Strategic/Strategic AI.cpp | 190 +++++------------------------- Strategic/XML_ExtraItems.cpp | 69 ++--------- Strategic/mapscreen.cpp | 4 +- Tactical/Air Raid.cpp | 3 +- Tactical/Campaign.cpp | 51 +------- Tactical/Ja25_Tactical.cpp | 7 +- Tactical/Soldier Control.cpp | 47 +------- Tactical/Weapons.cpp | 4 - Tactical/opplist.cpp | 6 +- TacticalAI/AIUtils.cpp | 35 +++--- 25 files changed, 126 insertions(+), 775 deletions(-) diff --git a/GameInitOptionsScreen.cpp b/GameInitOptionsScreen.cpp index aec6b1e2..f0a06e13 100644 --- a/GameInitOptionsScreen.cpp +++ b/GameInitOptionsScreen.cpp @@ -288,22 +288,9 @@ #define JA2SP_UB_RPC_TEX_AND_JOHN "RPC_TEX_AND_JOHN" #define JA2SP_UB_RANDOM_MANUEL_TEXT "RANDOM_MANUEL_TEXT" -//#define NUM_DIFF_SETTINGS 4 DIFFICULTY_SETTINGS_VALUES zDeffSetting[15]; UINT8 MaxDifficultySettingsValues; -//Difficulty settings -enum -{ - GIO_DIFF_EASY, - GIO_DIFF_MED, - GIO_DIFF_HARD, - GIO_DIFF_INSANE, - GIO_DIFF_NEW = GIO_DIFF_INSANE + 245, -// NUM_DIFF_SETTINGS, - -}; - enum { GIO_TRAITS_OLD, @@ -1427,12 +1414,11 @@ void BtnGIODifficultySelectionRightCallback( GUI_BUTTON *btn,INT32 reason ) if( reason & MSYS_CALLBACK_REASON_LBUTTON_REPEAT ) { - if ( iCurrentDifficulty < MaxDifficultySettingsValues /*NUM_DIFF_SETTINGS*/ - 2 ) - // if ( iCurrentDifficulty < MaxDifficultySettingsValues /*2*/ ) + if ( iCurrentDifficulty < MaxDifficultySettingsValues /*NUM_DIFF_SETTINGS*/ - 2 ) { PlayButtonSound( giGIODifficultyButton[1], BUTTON_SOUND_CLICKED_ON ); - iCurrentDifficulty++; + ++iCurrentDifficulty; gfReRenderGIOScreen =TRUE; } else @@ -1444,12 +1430,11 @@ void BtnGIODifficultySelectionRightCallback( GUI_BUTTON *btn,INT32 reason ) { btn->uiFlags|=(BUTTON_CLICKED_ON); - if ( iCurrentDifficulty < MaxDifficultySettingsValues /*NUM_DIFF_SETTINGS*/ - 2 ) //2 - //if ( iCurrentDifficulty < MaxDifficultySettingsValues /*2*/ ) + if ( iCurrentDifficulty < MaxDifficultySettingsValues /*NUM_DIFF_SETTINGS*/ - 2 ) //2 { PlayButtonSound( giGIODifficultyButton[1], BUTTON_SOUND_CLICKED_ON ); - iCurrentDifficulty++; + ++iCurrentDifficulty; gfReRenderGIOScreen =TRUE; } else @@ -2688,7 +2673,6 @@ BOOLEAN RenderGIOScreen() DisplayWrappedString( (UINT16)(GIO_DIF_SETTING_X+GIO_OFFSET_TO_TEXT + 1), (UINT16)(GIO_DIF_SETTING_Y-GIO_GAP_BN_SETTINGS + GIO_TITLE_DISTANCE - 12), GIO_DIF_SETTING_WIDTH, 2, GIO_TOGGLE_TEXT_FONT, GIO_TOGGLE_TEXT_COLOR, gzGIOScreenText[ GIO_DIF_LEVEL_TEXT ], FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED ); DisplayWrappedString( (UINT16)(GIO_DIF_SETTING_X+GIO_OFFSET_TO_TEXT + 1), (GIO_DIF_SETTING_Y+6), GIO_DIF_SETTING_WIDTH, 2, GIO_TOGGLE_TEXT_FONT, GIO_TOGGLE_TEXT_COLOR, zDeffSetting[ iCurrentDifficulty + 1].szDeffName, FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED ); -// DisplayWrappedString( (UINT16)(GIO_DIF_SETTING_X+GIO_OFFSET_TO_TEXT + 1), (GIO_DIF_SETTING_Y+6), GIO_DIF_SETTING_WIDTH, 2, GIO_TOGGLE_TEXT_FONT, GIO_TOGGLE_TEXT_COLOR, gzGIOScreenText[ iCurrentDifficulty + 9 ], FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED ); //Display the IMP number Title Text RenderGIOSmallSelectionFrame( (GIO_IMP_SETTING_X + 36), (GIO_IMP_SETTING_Y - 3) ); @@ -3060,7 +3044,6 @@ void DoneFadeOutForExitGameInitOptionScreen( void ) gGameUBOptions.fRandomManuelText = GetCurrentTextStyleButtonSetting(); gGameOptions.ubDifficultyLevel = min( MaxDifficultySettingsValues-1, ( max( 1, (iCurrentDifficulty + 1)) )); - //gGameOptions.ubDifficultyLevel = min( NUM_DIFF_SETTINGS-1, ( max( 1, (iCurrentDifficulty + 1)) )); gGameOptions.fTurnTimeLimit = FALSE; @@ -3168,26 +3151,7 @@ BOOLEAN DoGioMessageBox( UINT8 ubStyle, const STR16 zString, UINT32 uiExitScreen void DisplayMessageToUserAboutGameDifficulty() { - UINT8 ubDiffLevel = iCurrentDifficulty; - - DoGioMessageBox( MSG_BOX_BASIC_STYLE, zDeffSetting[ubDiffLevel + 1].szConfirmText, GAME_INIT_OPTIONS_SCREEN, MSG_BOX_FLAG_YESNO, ConfirmGioDifSettingMessageBoxCallBack ); -/* - switch( ubDiffLevel ) - { - case 0: - DoGioMessageBox( MSG_BOX_BASIC_STYLE, zGioDifConfirmText[GIO_CFS_NOVICE], GAME_INIT_OPTIONS_SCREEN, MSG_BOX_FLAG_YESNO, ConfirmGioDifSettingMessageBoxCallBack ); - break; - case 1: - DoGioMessageBox( MSG_BOX_BASIC_STYLE, zGioDifConfirmText[GIO_CFS_EXPERIENCED], GAME_INIT_OPTIONS_SCREEN, MSG_BOX_FLAG_YESNO, ConfirmGioDifSettingMessageBoxCallBack ); - break; - case 2: - DoGioMessageBox( MSG_BOX_BASIC_STYLE, zGioDifConfirmText[GIO_CFS_EXPERT], GAME_INIT_OPTIONS_SCREEN, MSG_BOX_FLAG_YESNO, ConfirmGioDifSettingMessageBoxCallBack ); - break; - case 3: - DoGioMessageBox( MSG_BOX_BASIC_STYLE, zGioDifConfirmText[GIO_CFS_INSANE], GAME_INIT_OPTIONS_SCREEN, MSG_BOX_FLAG_YESNO, ConfirmGioDifSettingMessageBoxCallBack ); - break; - } -*/ + DoGioMessageBox( MSG_BOX_BASIC_STYLE, zDeffSetting[ubDiffLevel + 1].szConfirmText, GAME_INIT_OPTIONS_SCREEN, MSG_BOX_FLAG_YESNO, ConfirmGioDifSettingMessageBoxCallBack ); } @@ -3426,22 +3390,9 @@ void RenderGIOSmallSelectionFrame(INT16 sX, INT16 sY) #define JA2SP_BACKGROUNDS "BACKGROUNDS" #define JA2SP_FOODSYSTEM "FOOD_SYSTEM" -//#define NUM_DIFF_SETTINGS 3 -DIFFICULTY_SETTINGS_VALUES zDeffSetting[15]; +DIFFICULTY_SETTINGS_VALUES zDeffSetting[MAX_DIF_LEVEL]; UINT8 MaxDifficultySettingsValues; -//Difficulty settings -enum -{ - GIO_DIFF_EASY, - GIO_DIFF_MED, - GIO_DIFF_HARD, - GIO_DIFF_INSANE, - GIO_DIFF_NEW = GIO_DIFF_INSANE + 245, -// NUM_DIFF_SETTINGS, - -}; - enum { GIO_TRAITS_OLD, @@ -4530,11 +4481,10 @@ void BtnGIODifficultySelectionRightCallback( GUI_BUTTON *btn,INT32 reason ) if( reason & MSYS_CALLBACK_REASON_LBUTTON_REPEAT ) { if ( iCurrentDifficulty < MaxDifficultySettingsValues /*NUM_DIFF_SETTINGS*/ - 1 ) //3 - //if ( iCurrentDifficulty < 3 ) { PlayButtonSound( giGIODifficultyButton[1], BUTTON_SOUND_CLICKED_ON ); - iCurrentDifficulty++; + ++iCurrentDifficulty; gfReRenderGIOScreen =TRUE; } else @@ -4547,11 +4497,10 @@ void BtnGIODifficultySelectionRightCallback( GUI_BUTTON *btn,INT32 reason ) btn->uiFlags|=(BUTTON_CLICKED_ON); if ( iCurrentDifficulty < MaxDifficultySettingsValues /*NUM_DIFF_SETTINGS*/ - 1 ) //2 - //if ( iCurrentDifficulty < 3 ) { PlayButtonSound( giGIODifficultyButton[1], BUTTON_SOUND_CLICKED_ON ); - iCurrentDifficulty++; + ++iCurrentDifficulty; gfReRenderGIOScreen =TRUE; } else @@ -5757,7 +5706,6 @@ BOOLEAN RenderGIOScreen() DisplayWrappedString( (UINT16)(GIO_DIF_SETTING_X+GIO_OFFSET_TO_TEXT + 1), (UINT16)(GIO_DIF_SETTING_Y-GIO_GAP_BN_SETTINGS + GIO_TITLE_DISTANCE - 12), GIO_DIF_SETTING_WIDTH, 2, GIO_TOGGLE_TEXT_FONT, GIO_TOGGLE_TEXT_COLOR, gzGIOScreenText[ GIO_DIF_LEVEL_TEXT ], FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED ); DisplayWrappedString( (UINT16)(GIO_DIF_SETTING_X+GIO_OFFSET_TO_TEXT + 1), (GIO_DIF_SETTING_Y+6), GIO_DIF_SETTING_WIDTH, 2, GIO_TOGGLE_TEXT_FONT, GIO_TOGGLE_TEXT_COLOR, zDeffSetting[ iCurrentDifficulty + 1].szDeffName, FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED ); - //DisplayWrappedString( (UINT16)(GIO_DIF_SETTING_X+GIO_OFFSET_TO_TEXT + 1), (GIO_DIF_SETTING_Y+6), GIO_DIF_SETTING_WIDTH, 2, GIO_TOGGLE_TEXT_FONT, GIO_TOGGLE_TEXT_COLOR, gzGIOScreenText[ iCurrentDifficulty + 9 ], FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED ); //Display the IMP number Title Text RenderGIOSmallSelectionFrame( (GIO_IMP_SETTING_X + 36), (GIO_IMP_SETTING_Y - 3) ); @@ -6114,7 +6062,6 @@ void DoneFadeOutForExitGameInitOptionScreen( void ) gGameOptions.ubGameStyle = GetCurrentGameStyleButtonSetting(); gGameOptions.ubDifficultyLevel = min( MaxDifficultySettingsValues, ( max( 1, (iCurrentDifficulty + 1)) )); - //gGameOptions.ubDifficultyLevel = min( NUM_DIFF_SETTINGS, ( max( 1, (iCurrentDifficulty + 1)) )); gGameOptions.fTurnTimeLimit = FALSE; @@ -6213,26 +6160,7 @@ BOOLEAN DoGioMessageBox( UINT8 ubStyle, const STR16 zString, UINT32 uiExitScreen void DisplayMessageToUserAboutGameDifficulty() { - UINT8 ubDiffLevel = iCurrentDifficulty; - - DoGioMessageBox( MSG_BOX_BASIC_STYLE, zDeffSetting[ubDiffLevel + 1].szConfirmText, GAME_INIT_OPTIONS_SCREEN, MSG_BOX_FLAG_YESNO, ConfirmGioDifSettingMessageBoxCallBack ); -/* - switch( ubDiffLevel ) - { - case 0: - DoGioMessageBox( MSG_BOX_BASIC_STYLE, zGioDifConfirmText[GIO_CFS_NOVICE], GAME_INIT_OPTIONS_SCREEN, MSG_BOX_FLAG_YESNO, ConfirmGioDifSettingMessageBoxCallBack ); - break; - case 1: - DoGioMessageBox( MSG_BOX_BASIC_STYLE, zGioDifConfirmText[GIO_CFS_EXPERIENCED], GAME_INIT_OPTIONS_SCREEN, MSG_BOX_FLAG_YESNO, ConfirmGioDifSettingMessageBoxCallBack ); - break; - case 2: - DoGioMessageBox( MSG_BOX_BASIC_STYLE, zGioDifConfirmText[GIO_CFS_EXPERT], GAME_INIT_OPTIONS_SCREEN, MSG_BOX_FLAG_YESNO, ConfirmGioDifSettingMessageBoxCallBack ); - break; - case 3: - DoGioMessageBox( MSG_BOX_BASIC_STYLE, zGioDifConfirmText[GIO_CFS_INSANE], GAME_INIT_OPTIONS_SCREEN, MSG_BOX_FLAG_YESNO, ConfirmGioDifSettingMessageBoxCallBack ); - break; - } -*/ + DoGioMessageBox( MSG_BOX_BASIC_STYLE, zDeffSetting[iCurrentDifficulty + 1].szConfirmText, GAME_INIT_OPTIONS_SCREEN, MSG_BOX_FLAG_YESNO, ConfirmGioDifSettingMessageBoxCallBack ); } diff --git a/GameInitOptionsScreen.h b/GameInitOptionsScreen.h index da57a9eb..10f9febc 100644 --- a/GameInitOptionsScreen.h +++ b/GameInitOptionsScreen.h @@ -8,6 +8,17 @@ UINT32 GameInitOptionsScreenShutdown( void ); BOOLEAN SpIniExists(); +// Flugente: moved enums +//Enums for the difficulty levels +enum +{ + DIF_LEVEL_EASY = 1, + DIF_LEVEL_MEDIUM, + DIF_LEVEL_HARD, + DIF_LEVEL_INSANE, + MAX_DIF_LEVEL = 15, +}; + typedef struct { UINT16 uiIndex; @@ -79,6 +90,6 @@ typedef struct } DIFFICULTY_SETTINGS_VALUES; extern UINT8 MaxDifficultySettingsValues; -extern DIFFICULTY_SETTINGS_VALUES zDeffSetting[15]; +extern DIFFICULTY_SETTINGS_VALUES zDeffSetting[MAX_DIF_LEVEL]; #endif diff --git a/GameSettings.cpp b/GameSettings.cpp index b5372539..c008af8f 100644 --- a/GameSettings.cpp +++ b/GameSettings.cpp @@ -3924,13 +3924,9 @@ void DisplayGameSettings( ) //Display the difficulty level ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"%s: %s", gzGIOScreenText[ GIO_DIF_LEVEL_TEXT ], zDeffSetting[gGameOptions.ubDifficultyLevel].szDeffName ); - //ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"%s: %s", gzGIOScreenText[ GIO_DIF_LEVEL_TEXT ], gzGIOScreenText[ gGameOptions.ubDifficultyLevel + GIO_EASY_TEXT - 1 ] ); //Test Settings - if ( gGameExternalOptions.gfAllowReinforcements == TRUE ) - ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"%s: %s", L"AllowReinforcements", L"YES"); - else - ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"%s: %s", L"AllowReinforcements", L"NO"); + ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"%s: %s", L"AllowReinforcements", gGameExternalOptions.gfAllowReinforcements ? L"YES" : L"NO" ); //Bobby Ray option 1 if ( gGameOptions.ubBobbyRayQuality >= BR_GOOD && gGameOptions.ubBobbyRayQuality < BR_GREAT ) diff --git a/GameSettings.h b/GameSettings.h index b16eba0c..6f700945 100644 --- a/GameSettings.h +++ b/GameSettings.h @@ -175,29 +175,7 @@ enum ATTACHMENT_NEW = 1, }; - -//Enums for the difficulty levels -enum -{ - DIF_LEVEL_ZERO, - DIF_LEVEL_EASY, - DIF_LEVEL_MEDIUM, - DIF_LEVEL_HARD, - DIF_LEVEL_INSANE, - DIF_LEVEL_FIVE, - DIF_LEVEL_6, - DIF_LEVEL_7, - DIF_LEVEL_8, - DIF_LEVEL_9, - DIF_LEVEL_10, - DIF_LEVEL_11, - DIF_LEVEL_12, - DIF_LEVEL_13, - DIF_LEVEL_14, - DIF_LEVEL_15, -}; - -//Enums for the difficulty levels +//Enums for game styles enum { STYLE_REALISTIC = 0, //the specific indices are there to keep compartibility wiht old saves (back when there were only 2 styles) diff --git a/MPHostScreen.cpp b/MPHostScreen.cpp index 4e89ba37..4779ea87 100644 --- a/MPHostScreen.cpp +++ b/MPHostScreen.cpp @@ -2670,7 +2670,6 @@ BOOLEAN RenderMPHScreen() DisplayWrappedString( (UINT16)(MPH_DIFFICULTY_SETTING_X+MPH_OFFSET_TO_TEXT + 1), (UINT16)(MPH_DIFFICULTY_SETTING_Y-MPH_GAP_BN_SETTINGS + MPH_TITLE_DISTANCE - 12), MPH_DIFFICULTY_SETTING_WIDTH, 2, MPH_TOGGLE_TEXT_FONT, MPH_TOGGLE_TEXT_COLOR, gzGIOScreenText[ GIO_DIF_LEVEL_TEXT ], FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED ); DisplayWrappedString( (UINT16)(MPH_DIFFICULTY_SETTING_X+MPH_OFFSET_TO_TEXT + 1), (MPH_DIFFICULTY_SETTING_Y+6), MPH_DIFFICULTY_SETTING_WIDTH, 2, MPH_TOGGLE_TEXT_FONT, MPH_TOGGLE_TEXT_COLOR, zDeffSetting[ iMPHDifficulty + 1].szDeffName, FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED ); - //DisplayWrappedString( (UINT16)(MPH_DIFFICULTY_SETTING_X+MPH_OFFSET_TO_TEXT + 1), (MPH_DIFFICULTY_SETTING_Y+6), MPH_DIFFICULTY_SETTING_WIDTH, 2, MPH_TOGGLE_TEXT_FONT, MPH_TOGGLE_TEXT_COLOR, gzGIOScreenText[ iMPHDifficulty + 9 ], FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED ); // --------------- // --------------- diff --git a/Strategic/Assignments.cpp b/Strategic/Assignments.cpp index 664e7113..057309ab 100644 --- a/Strategic/Assignments.cpp +++ b/Strategic/Assignments.cpp @@ -5656,29 +5656,7 @@ void HandleRadioScanInSector( INT16 sMapX, INT16 sMapY, INT8 bZ ) if ( range < 1 ) return; - UINT8 normalgroupsize = 0; - - normalgroupsize = zDeffSetting[gGameOptions.ubDifficultyLevel].iMinEnemyGroupSize; - /* - switch( gGameOptions.ubDifficultyLevel ) - { - case DIF_LEVEL_EASY: - normalgroupsize = gGameExternalOptions.ubMinEnemyGroupSizeNovice; - break; - case DIF_LEVEL_MEDIUM: - normalgroupsize = gGameExternalOptions.ubMinEnemyGroupSizeExperienced; - break; - case DIF_LEVEL_HARD: - normalgroupsize = gGameExternalOptions.ubMinEnemyGroupSizeExpert; - break; - case DIF_LEVEL_INSANE: - default: - normalgroupsize = gGameExternalOptions.ubMinEnemyGroupSizeInsane; - break; - } - */ - - normalgroupsize *= 2; + UINT16 normalgroupsize = 2 * zDeffSetting[gGameOptions.ubDifficultyLevel].iMinEnemyGroupSize; FLOAT detect_basechance = 1.0f - pow(0.5f, numberofradiooperators); FLOAT detect_rangefactor = .0f; @@ -6006,28 +5984,7 @@ void HandleGatheringInformationBySoldier( SOLDIERTYPE* pSoldier ) } } - UINT16 usNormalGroupSize = 0; - - usNormalGroupSize = zDeffSetting[gGameOptions.ubDifficultyLevel].iMinEnemyGroupSize; - /* - switch( gGameOptions.ubDifficultyLevel ) - { - case DIF_LEVEL_EASY: - usNormalGroupSize = gGameExternalOptions.ubMinEnemyGroupSizeNovice; - break; - case DIF_LEVEL_MEDIUM: - usNormalGroupSize = gGameExternalOptions.ubMinEnemyGroupSizeExperienced; - break; - case DIF_LEVEL_HARD: - usNormalGroupSize = gGameExternalOptions.ubMinEnemyGroupSizeExpert; - break; - case DIF_LEVEL_INSANE: - default: - usNormalGroupSize = gGameExternalOptions.ubMinEnemyGroupSizeInsane; - break; - } - */ - usNormalGroupSize *= 2; + UINT16 usNormalGroupSize = 2 * zDeffSetting[gGameOptions.ubDifficultyLevel].iMinEnemyGroupSize; FLOAT fBaseChance = ( EffectiveLeadership(pSoldier) + EffectiveWisdom(pSoldier) + EffectiveExpLevel(pSoldier) * 10 ) / 3000.0f; diff --git a/Strategic/Campaign Init.cpp b/Strategic/Campaign Init.cpp index 96d57e32..0c34f92a 100644 --- a/Strategic/Campaign Init.cpp +++ b/Strategic/Campaign Init.cpp @@ -431,43 +431,20 @@ void BuildUndergroundSectorInfoList() //J9 curr = NewUndergroundNode( 9, 10, 1 ); curr->ubNumTroops = zDeffSetting[gGameOptions.ubDifficultyLevel].iJ9B1NumTroops; - /* - switch( gGameOptions.ubDifficultyLevel ) - { - case DIF_LEVEL_EASY: - curr->ubNumTroops = 8; - break; - case DIF_LEVEL_MEDIUM: - curr->ubNumTroops = 11; - break; - case DIF_LEVEL_HARD: - curr->ubNumTroops = 15; - break; - case DIF_LEVEL_INSANE: - curr->ubNumTroops = 20; - break; - } - */ + //J9 feeding zone curr = NewUndergroundNode( 9, 10, 2 ); - curr->ubNumCreatures = (UINT8)(2 + zDeffSetting[gGameOptions.ubDifficultyLevel].iJ9B2NumCreatures*2 + Random( 2 )); - //curr->ubNumCreatures = (UINT8)(2 + gGameOptions.ubDifficultyLevel*2 + Random( 2 )); - + curr->ubNumCreatures = (UINT8)(2 + zDeffSetting[gGameOptions.ubDifficultyLevel].iJ9B2NumCreatures*2 + Random( 2 )); //K4 curr = NewUndergroundNode( 4, 11, 1 ); curr->ubNumTroops = (UINT8)(6 + zDeffSetting[gGameOptions.ubDifficultyLevel].iK4B1NumTroops*2 + Random( 3 )); curr->ubNumElites = (UINT8)(4 + zDeffSetting[gGameOptions.ubDifficultyLevel].iK4B1NumElites + Random( 2 )); - //curr->ubNumTroops = (UINT8)(6 + gGameOptions.ubDifficultyLevel*2 + Random( 3 )); - //curr->ubNumElites = (UINT8)(4 + gGameOptions.ubDifficultyLevel + Random( 2 )); //O3 curr = NewUndergroundNode( 3, 15, 1 ); curr->ubNumTroops = (UINT8)(6 + zDeffSetting[gGameOptions.ubDifficultyLevel].iO3B1NumTroops*2 + Random( 3 )); - curr->ubNumElites = (UINT8)(4 + zDeffSetting[gGameOptions.ubDifficultyLevel].iO3B1NumElites + Random( 2 )); - //curr->ubNumTroops = (UINT8)(6 + gGameOptions.ubDifficultyLevel*2 + Random( 3 )); - //curr->ubNumElites = (UINT8)(4 + gGameOptions.ubDifficultyLevel + Random( 2 )); - + curr->ubNumElites = (UINT8)(4 + zDeffSetting[gGameOptions.ubDifficultyLevel].iO3B1NumElites + Random( 2 )); //P3 curr = NewUndergroundNode( 3, 16, 1 ); @@ -479,23 +456,7 @@ void BuildUndergroundSectorInfoList() curr->ubNumElites = (UINT8)(zDeffSetting[gGameOptions.ubDifficultyLevel].iP3B1NumElites + Random( 6 )); else curr->ubNumElites = zDeffSetting[gGameOptions.ubDifficultyLevel].iP3B1NumElites; - /* - switch( gGameOptions.ubDifficultyLevel ) - { - case DIF_LEVEL_EASY: - curr->ubNumElites = (UINT8)(8 + Random( 3 )); - break; - case DIF_LEVEL_MEDIUM: - curr->ubNumElites = (UINT8)(10 + Random( 5 )); - break; - case DIF_LEVEL_HARD: - curr->ubNumElites = (UINT8)(14 + Random( 6 )); - break; - case DIF_LEVEL_INSANE: - curr->ubNumElites = 20; - break; - } - */ + //Do all of the mandatory underground mine sectors //Drassen's mine diff --git a/Strategic/Creature Spreading.cpp b/Strategic/Creature Spreading.cpp index dcaf9a65..494324a1 100644 --- a/Strategic/Creature Spreading.cpp +++ b/Strategic/Creature Spreading.cpp @@ -348,24 +348,7 @@ void InitCreatureQuest() giHabitatedDistance = 0; giPopulationModifier = zDeffSetting[gGameOptions.ubDifficultyLevel].iCreaturePopulationModifier; - /* - switch( gGameOptions.ubDifficultyLevel ) - { - case DIF_LEVEL_EASY: - giPopulationModifier = EASY_POPULATION_MODIFIER; - break; - case DIF_LEVEL_MEDIUM: - giPopulationModifier = NORMAL_POPULATION_MODIFIER; - break; - case DIF_LEVEL_HARD: - giPopulationModifier = HARD_POPULATION_MODIFIER; - break; - case DIF_LEVEL_INSANE: - giPopulationModifier = INSANE_POPULATION_MODIFIER; - break; - } - */ - + //Determine which of the maps are infectible by creatures. Infectible mines //are those that are player controlled and unlimited. We don't want the creatures to //infect the mine that runs out. @@ -410,7 +393,7 @@ void InitCreatureQuest() */ // determine mine infectible status in initmines.lua script - for (x = 0; x < MAX_NUMBER_OF_MINES; x++) + for (x = 0; x < MAX_NUMBER_OF_MINES; ++x) { if( gMineStatus[ x ].fInfectible ) { @@ -436,7 +419,7 @@ void InitCreatureQuest() //iNumMinesInfectible = fMineInfectible[0] + fMineInfectible[1] + fMineInfectible[2] + fMineInfectible[3]; //count actual infectible sites, use min of infectible sites defined in xml and initmines.lua script in case they do not tally - for (x = 0; x < min( NUMBER_OF_INFECTIBLE_SITES, iNumMinesInfectibleLUA ); x++) + for (x = 0; x < min( NUMBER_OF_INFECTIBLE_SITES, iNumMinesInfectibleLUA ); ++x) { iNumMinesInfectible += fMineInfectible[x]; } @@ -455,14 +438,14 @@ void InitCreatureQuest() iChosenMine = 0; - for( x = 0; x < min( NUMBER_OF_INFECTIBLE_SITES, iNumMinesInfectibleLUA ); x++ ) + for( x = 0; x < min( NUMBER_OF_INFECTIBLE_SITES, iNumMinesInfectibleLUA ); ++x ) { if( iRandom ) { iChosenMine++; if( fMineInfectible[x] ) { - iRandom--; + --iRandom; } } } @@ -514,30 +497,9 @@ void InitCreatureQuest() //Now determine how often we will spread the creatures. - i = zDeffSetting[gGameOptions.ubDifficultyLevel].iQueenInitBonusSpread; - AddPeriodStrategicEvent( EVENT_CREATURE_SPREAD, zDeffSetting[gGameOptions.ubDifficultyLevel].iCreatureSpreadTime, 0 ); - /* - switch( gGameOptions.ubDifficultyLevel ) - { - case DIF_LEVEL_EASY: - i = EASY_QUEEN_INIT_BONUS_SPREADS; - AddPeriodStrategicEvent( EVENT_CREATURE_SPREAD, EASY_SPREAD_TIME_IN_MINUTES, 0 ); - break; - case DIF_LEVEL_MEDIUM: - i = NORMAL_QUEEN_INIT_BONUS_SPREADS; - AddPeriodStrategicEvent( EVENT_CREATURE_SPREAD, NORMAL_SPREAD_TIME_IN_MINUTES, 0 ); - break; - case DIF_LEVEL_HARD: - i = HARD_QUEEN_INIT_BONUS_SPREADS; - AddPeriodStrategicEvent( EVENT_CREATURE_SPREAD, HARD_SPREAD_TIME_IN_MINUTES, 0 ); - break; - case DIF_LEVEL_INSANE: - i = INSANE_QUEEN_INIT_BONUS_SPREADS; - AddPeriodStrategicEvent( EVENT_CREATURE_SPREAD, INSANE_SPREAD_TIME_IN_MINUTES, 0 ); - break; - } - */ - + i = zDeffSetting[gGameOptions.ubDifficultyLevel].iQueenInitBonusSpread; + AddPeriodStrategicEvent( EVENT_CREATURE_SPREAD, zDeffSetting[gGameOptions.ubDifficultyLevel].iCreatureSpreadTime, 0 ); + //Set things up so that the creatures can plan attacks on helpless miners and civilians while //they are sleeping. They do their planning at 10PM every day, and decide to attack sometime //during the night. @@ -686,8 +648,6 @@ DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"CreatureSpreading1"); void SpreadCreatures() { - UINT16 usNewCreatures=0; - if( giLairID == -1 ) { DecayCreatures(); @@ -695,25 +655,8 @@ void SpreadCreatures() } //queen just produced a litter of creature larvae. Let's do some spreading now. - usNewCreatures = (UINT16)( zDeffSetting[gGameOptions.ubDifficultyLevel].iQueenReproductionBase + Random( 1 + zDeffSetting[gGameOptions.ubDifficultyLevel].iQueenReproductionBonus )); - /* - switch( gGameOptions.ubDifficultyLevel ) - { - case DIF_LEVEL_EASY: - usNewCreatures = (UINT16)(EASY_QUEEN_REPRODUCTION_BASE + Random( 1 + EASY_QUEEN_REPRODUCTION_BONUS )); - break; - case DIF_LEVEL_MEDIUM: - usNewCreatures = (UINT16)(NORMAL_QUEEN_REPRODUCTION_BASE + Random( 1 + NORMAL_QUEEN_REPRODUCTION_BONUS )); - break; - case DIF_LEVEL_HARD: - usNewCreatures = (UINT16)(HARD_QUEEN_REPRODUCTION_BASE + Random( 1 + HARD_QUEEN_REPRODUCTION_BONUS )); - break; - case DIF_LEVEL_INSANE: - usNewCreatures = (UINT16)(INSANE_QUEEN_REPRODUCTION_BASE + Random( 1 + INSANE_QUEEN_REPRODUCTION_BONUS )); - break; - } - */ - + UINT16 usNewCreatures = (UINT16)(zDeffSetting[gGameOptions.ubDifficultyLevel].iQueenReproductionBase + Random( 1 + zDeffSetting[gGameOptions.ubDifficultyLevel].iQueenReproductionBonus )); + while( usNewCreatures-- ) { //Note, this function can and will fail if the population gets dense. This is a necessary @@ -1721,81 +1664,17 @@ BOOLEAN PrepareCreaturesForBattle() void CreatureNightPlanning() { //Check the populations of the mine exits, and factor a chance for them to attack at night. - UINT8 ubNumCreatures; - INT32 i; - - /* // externalize to xml data - ubNumCreatures = CreaturesInUndergroundSector( SEC_H3, 1 ); - if( ubNumCreatures > 1 && ubNumCreatures * 10 > (INT32)PreRandom( 100 ) ) - { //10% chance for each creature to decide it's time to attack. - AddStrategicEvent( EVENT_CREATURE_ATTACK, GetWorldTotalMin() + 1 + PreRandom( 429 ), SEC_H3 ); - } - ubNumCreatures = CreaturesInUndergroundSector( SEC_D13, 1 ); - if( ubNumCreatures > 1 && ubNumCreatures * 10 > (INT32)PreRandom( 100 ) ) - { //10% chance for each creature to decide it's time to attack. - AddStrategicEvent( EVENT_CREATURE_ATTACK, GetWorldTotalMin() + 1 + PreRandom( 429 ), SEC_D13 ); - } - ubNumCreatures = CreaturesInUndergroundSector( SEC_I14, 1 ); - if( ubNumCreatures > 1 && ubNumCreatures * 10 > (INT32)PreRandom( 100 ) ) - { //10% chance for each creature to decide it's time to attack. - AddStrategicEvent( EVENT_CREATURE_ATTACK, GetWorldTotalMin() + 1 + PreRandom( 429 ), SEC_I14 ); - } - ubNumCreatures = CreaturesInUndergroundSector( SEC_H8, 1 ); - if( ubNumCreatures > 1 && ubNumCreatures * 10 > (INT32)PreRandom( 100 ) ) - { //10% chance for each creature to decide it's time to attack. - AddStrategicEvent( EVENT_CREATURE_ATTACK, GetWorldTotalMin() + 1 +PreRandom( 429 ), SEC_H8 ); - } - */ - + UINT8 ubSectorID = SECTOR( gCreaturePlacements[ giLairID ].sAttackSourceX, gCreaturePlacements[ giLairID ].sAttackSourceY ); // Attacksource B1 underground sector must be a valid creature habitat! - ubNumCreatures = CreaturesInUndergroundSector( ubSectorID , 1 ); + UINT8 ubNumCreatures = CreaturesInUndergroundSector( ubSectorID, 1 ); - //10% chance for each creature with difficulty modifier to decide it's time to attack. - - i = zDeffSetting[gGameOptions.ubDifficultyLevel].iCreatureTownAggressiveness; - if( ubNumCreatures > 1 && ubNumCreatures * 10 + i > (INT32)PreRandom( 100 ) ) + //10% chance for each creature with difficulty modifier to decide it's time to attack. + if ( ubNumCreatures > 1 && ubNumCreatures * 10 + zDeffSetting[gGameOptions.ubDifficultyLevel].iCreatureTownAggressiveness > (INT32)PreRandom( 100 ) ) { AddStrategicEvent( EVENT_CREATURE_ATTACK, GetWorldTotalMin() + 1 + PreRandom( 429 ), ubSectorID ); } - /* - switch( gGameOptions.ubDifficultyLevel ) - { - case DIF_LEVEL_EASY: - i = EASY_CREATURE_TOWN_AGGRESSIVENESS; - if( ubNumCreatures > 1 && ubNumCreatures * 10 + i > (INT32)PreRandom( 100 ) ) - { - AddStrategicEvent( EVENT_CREATURE_ATTACK, GetWorldTotalMin() + 1 + PreRandom( 429 ), ubSectorID ); - } - break; - case DIF_LEVEL_MEDIUM: - i = NORMAL_CREATURE_TOWN_AGGRESSIVENESS; - if( ubNumCreatures > 1 && ubNumCreatures * 10 + i > (INT32)PreRandom( 100 ) ) - { - AddStrategicEvent( EVENT_CREATURE_ATTACK, GetWorldTotalMin() + 1 + PreRandom( 429 ), ubSectorID ); - } - break; - case DIF_LEVEL_HARD: - i = HARD_CREATURE_TOWN_AGGRESSIVENESS; - if( ubNumCreatures > 1 && ubNumCreatures * 10 + i > (INT32)PreRandom( 100 ) ) - { - AddStrategicEvent( EVENT_CREATURE_ATTACK, GetWorldTotalMin() + 1 + PreRandom( 429 ), ubSectorID ); - } - break; - case DIF_LEVEL_INSANE: - i = INSANE_CREATURE_TOWN_AGGRESSIVENESS; - if( ubNumCreatures > 1 && ubNumCreatures * 10 + i > (INT32)PreRandom( 100 ) ) - { - AddStrategicEvent( EVENT_CREATURE_ATTACK, GetWorldTotalMin() + 1 + PreRandom( 429 ), ubSectorID ); - } - break; - } - */ - //if( ubNumCreatures > 1 && ubNumCreatures * 10 > (INT32)PreRandom( 100 ) ) - //{ //10% chance for each creature to decide it's time to attack. - // AddStrategicEvent( EVENT_CREATURE_ATTACK, GetWorldTotalMin() + 1 + PreRandom( 429 ), ubSectorID ); - //} } diff --git a/Strategic/Game Init.cpp b/Strategic/Game Init.cpp index 76cb6d76..2e6a06c2 100644 --- a/Strategic/Game Init.cpp +++ b/Strategic/Game Init.cpp @@ -747,40 +747,8 @@ fFirstTimeInMapScreen = TRUE; } // ATE: Set starting cash.... - iStartingCash = zDeffSetting[gGameOptions.ubDifficultyLevel].iStartingCash; - /* - switch( gGameOptions.ubDifficultyLevel ) - { - case DIF_LEVEL_EASY: - - iStartingCash = gGameExternalOptions.iStartingCashNovice; - //iStartingCash = 45000; - break; - - case DIF_LEVEL_MEDIUM: - - iStartingCash = gGameExternalOptions.iStartingCashExperienced; - //iStartingCash = 35000; - break; - - case DIF_LEVEL_HARD: - - iStartingCash = gGameExternalOptions.iStartingCashExpert; - //iStartingCash = 30000; - break; - - case DIF_LEVEL_INSANE: - - iStartingCash = gGameExternalOptions.iStartingCashInsane; - // iStartingCash = 15000; - break; - - default: - Assert(0); - return( FALSE ); - } - */ - + iStartingCash = zDeffSetting[gGameOptions.ubDifficultyLevel].iStartingCash; + // Setup initial money AddTransactionToPlayersBook( ANONYMOUS_DEPOSIT, 0, GetWorldTotalMin(), iStartingCash ); #endif diff --git a/Strategic/LuaInitNPCs.cpp b/Strategic/LuaInitNPCs.cpp index 93e50e99..189de580 100644 --- a/Strategic/LuaInitNPCs.cpp +++ b/Strategic/LuaInitNPCs.cpp @@ -12964,33 +12964,9 @@ static int l_SetStartingCashDifLevel (lua_State *L) if ( lua_gettop(L) >= 1 ) { INT32 DifficultyLevel = lua_tointeger(L,1); - INT32 iStartingCash = 0; - AddTransactionToPlayersBook( ANONYMOUS_DEPOSIT, 0, GetWorldTotalMin(), zDeffSetting[DifficultyLevel].iStartingCash ); - /* - switch( DifficultyLevel ) - { - case DIF_LEVEL_EASY: - iStartingCash = gGameExternalOptions.iStartingCashNovice; - break; + AddTransactionToPlayersBook( ANONYMOUS_DEPOSIT, 0, GetWorldTotalMin(), zDeffSetting[DifficultyLevel].iStartingCash ); + } - case DIF_LEVEL_MEDIUM: - iStartingCash = gGameExternalOptions.iStartingCashExperienced; - break; - - case DIF_LEVEL_HARD: - iStartingCash = gGameExternalOptions.iStartingCashExpert; - break; - - case DIF_LEVEL_INSANE: - iStartingCash = gGameExternalOptions.iStartingCashInsane; - break; - - default: - iStartingCash = 4500; - } - AddTransactionToPlayersBook( ANONYMOUS_DEPOSIT, 0, GetWorldTotalMin(), iStartingCash ); - */ - } -return 0; + return 0; } \ No newline at end of file diff --git a/Strategic/Meanwhile.cpp b/Strategic/Meanwhile.cpp index 16862866..4eb74ba0 100644 --- a/Strategic/Meanwhile.cpp +++ b/Strategic/Meanwhile.cpp @@ -700,9 +700,9 @@ void ProcessImplicationsOfMeanwhile( void ) { case END_OF_PLAYERS_FIRST_BATTLE: - if( zDeffSetting[gGameOptions.ubDifficultyLevel].bStrategicAiActionWakeQueen == TRUE ) - //if( gGameOptions.ubDifficultyLevel >= DIF_LEVEL_HARD ) - { //Wake up the queen earlier to punish the good players! + if( zDeffSetting[gGameOptions.ubDifficultyLevel].bStrategicAiActionWakeQueen ) + { + //Wake up the queen earlier to punish the good players! ExecuteStrategicAIAction( STRATEGIC_AI_ACTION_WAKE_QUEEN, 0, 0 ); } //HandleNPCDoAction( QUEEN, NPC_ACTION_SEND_SOLDIERS_TO_BATTLE_LOCATION, 0 ); diff --git a/Strategic/Player Command.cpp b/Strategic/Player Command.cpp index 6f7e00bd..38ad13f1 100644 --- a/Strategic/Player Command.cpp +++ b/Strategic/Player Command.cpp @@ -328,18 +328,7 @@ BOOLEAN SetThisSectorAsPlayerControlled( INT16 sMapX, INT16 sMapY, INT8 bMapZ, B if ( !SectorInfo[ SECTOR( sMapX, sMapY ) ].fSurfaceWasEverPlayerControlled ) { // grant grace period - UpdateLastDayOfPlayerActivity( ( UINT16 ) ( GetWorldDay() + zDeffSetting[gGameOptions.ubDifficultyLevel].iUpdateLastDayOfPlayerActivity ) ); - /* - if ( gGameOptions.ubDifficultyLevel >= DIF_LEVEL_HARD ) - - { - UpdateLastDayOfPlayerActivity( ( UINT16 ) ( GetWorldDay() + 2 ) ); - } - else - { - UpdateLastDayOfPlayerActivity( ( UINT16 ) ( GetWorldDay() + 1 ) ); - } - */ + UpdateLastDayOfPlayerActivity( ( UINT16 ) ( GetWorldDay() + zDeffSetting[gGameOptions.ubDifficultyLevel].iUpdateLastDayOfPlayerActivity ) ); } } diff --git a/Strategic/PreBattle Interface.cpp b/Strategic/PreBattle Interface.cpp index 8f5cd005..7f3368e1 100644 --- a/Strategic/PreBattle Interface.cpp +++ b/Strategic/PreBattle Interface.cpp @@ -654,17 +654,7 @@ void InitPreBattleInterface( GROUP *pBattleGroup, BOOLEAN fPersistantPBI ) iChance -= (2 * ((ubNumMobileEnemies + ubNumStationaryEnemies) - 6)); // -2% adjustment per enemy beyond 6 // adjust the chance for difficulty setting - iChance = iChance + (zDeffSetting[gGameOptions.ubDifficultyLevel].iChanceOfEnemyAmbushes); - /* - if( gGameOptions.ubDifficultyLevel == DIF_LEVEL_EASY ) - iChance -= 15; - else if( gGameOptions.ubDifficultyLevel == DIF_LEVEL_MEDIUM ) - iChance += 5; - else if( gGameOptions.ubDifficultyLevel == DIF_LEVEL_HARD ) - iChance += 12; - else if( gGameOptions.ubDifficultyLevel == DIF_LEVEL_INSANE ) - iChance += 25; - */ + iChance = iChance + (zDeffSetting[gGameOptions.ubDifficultyLevel].iChanceOfEnemyAmbushes); // adjust the chance for what we know about the sector if( WhatPlayerKnowsAboutEnemiesInSector( gubPBSectorX, gubPBSectorY ) == KNOWS_NOTHING ) diff --git a/Strategic/Queen Command.cpp b/Strategic/Queen Command.cpp index 037885b3..1ff784f4 100644 --- a/Strategic/Queen Command.cpp +++ b/Strategic/Queen Command.cpp @@ -570,10 +570,9 @@ BOOLEAN PrepareEnemyForSectorBattle() HandleArrivalOfReinforcements( gpBattleGroup ); // Reinforcement groups? Bring it on! + // only if not Omerta on a non-insane difficulty level if( gGameExternalOptions.gfAllowReinforcements && - !( (GetTownIdForSector( gWorldSectorX, gWorldSectorY ) == OMERTA ) ) ) - //!( (GetTownIdForSector( gWorldSectorX, gWorldSectorY ) == OMERTA )&&( gGameOptions.ubDifficultyLevel != DIF_LEVEL_INSANE ) ) ) - + !( ( GetTownIdForSector( gWorldSectorX, gWorldSectorY ) == OMERTA) && (gGameOptions.ubDifficultyLevel != DIF_LEVEL_INSANE) ) ) { UINT16 pusMoveDir[4][3]; UINT8 ubDirNumber = 0; @@ -585,7 +584,7 @@ BOOLEAN PrepareEnemyForSectorBattle() GenerateDirectionInfos( gWorldSectorX, gWorldSectorY, &ubDirNumber, pusMoveDir, FALSE, TRUE ); - for( unsigned ubIndex = 0; ubIndex < ubDirNumber; ubIndex++ ) + for( unsigned ubIndex = 0; ubIndex < ubDirNumber; ++ubIndex ) { while ( NumMobileEnemiesInSector( SECTORX( pusMoveDir[ ubIndex ][ 0 ] ), SECTORY( pusMoveDir[ ubIndex ][ 0 ] ) ) && GetEnemyGroupInSector( SECTORX( pusMoveDir[ ubIndex][ 0 ] ), SECTORY( pusMoveDir[ ubIndex ][ 0 ] ) ) ) { diff --git a/Strategic/Reinforcement.cpp b/Strategic/Reinforcement.cpp index 1756e78b..ff8fcafe 100644 --- a/Strategic/Reinforcement.cpp +++ b/Strategic/Reinforcement.cpp @@ -51,10 +51,8 @@ void GetNumberOfEnemiesInFiveSectors( INT16 sSectorX, INT16 sSectorY, UINT8 *pub if( !gGameExternalOptions.gfAllowReinforcements ) return; - if ( ( GetTownIdForSector( sSectorX, sSectorY ) == OMERTA )&&( zDeffSetting[gGameOptions.ubDifficultyLevel].bAllowReinforcementsOmerta == FALSE ) ) //Madd: skip Omerta //Lal: but not on insane ;-) + if ( ( GetTownIdForSector( sSectorX, sSectorY ) == OMERTA )&& ( !zDeffSetting[gGameOptions.ubDifficultyLevel].bAllowReinforcementsOmerta ) ) //Madd: skip Omerta //Lal: but not on insane ;-) return; - //if ( ( GetTownIdForSector( sSectorX, sSectorY ) == OMERTA )&&( gGameOptions.ubDifficultyLevel != DIF_LEVEL_INSANE ) ) //Madd: skip Omerta //Lal: but not on insane ;-) - // return; GenerateDirectionInfos( sSectorX, sSectorY, &ubDirNumber, pusMoveDir, FALSE, TRUE ); diff --git a/Strategic/Strategic AI.cpp b/Strategic/Strategic AI.cpp index db4fe7f3..d8471086 100644 --- a/Strategic/Strategic AI.cpp +++ b/Strategic/Strategic AI.cpp @@ -1185,68 +1185,20 @@ void InitStrategicAI() dEnemyGeneralsSpeedupFactor = max( 0.5f, dEnemyGeneralsSpeedupFactor - gStrategicStatus.usVIPsLeft * gGameExternalOptions.fEnemyGeneralStrategicDecisionSpeedBonus ); } - giReinforcementPool = zDeffSetting[gGameOptions.ubDifficultyLevel].iQueensInitialPoolOfTroops; - giForcePercentage = zDeffSetting[gGameOptions.ubDifficultyLevel].iInitialGarrisonPercentages; - giArmyAlertness = zDeffSetting[gGameOptions.ubDifficultyLevel].iEnemyStartingAlertLevel; - giArmyAlertnessDecay = zDeffSetting[gGameOptions.ubDifficultyLevel].iEnemyAlertDecay; - gubMinEnemyGroupSize = zDeffSetting[gGameOptions.ubDifficultyLevel].iMinEnemyGroupSize; - gubHoursGracePeriod = zDeffSetting[gGameOptions.ubDifficultyLevel].iGracePeriodInHoursAfterSectorLiberation; - gfUnlimitedTroops = zDeffSetting[gGameOptions.ubDifficultyLevel].bUnlimitedPoolOfTroops; - gfAggressiveQueen = zDeffSetting[gGameOptions.ubDifficultyLevel].bAggressiveQueenAi; - // 475 is 7:55am in minutes since midnight, the time the game starts on day 1 - AddStrategicEvent( EVENT_EVALUATE_QUEEN_SITUATION, 475 + dEnemyGeneralsSpeedupFactor * (zDeffSetting[gGameOptions.ubDifficultyLevel].iBaseDelayInMinutesBetweenEvaluations + Random( zDeffSetting[gGameOptions.ubDifficultyLevel].iEvaluationDelayVariance )), 0 ); - /* - switch( gGameOptions.ubDifficultyLevel ) - { - case DIF_LEVEL_EASY: - giReinforcementPool = gGameExternalOptions.iReinforcementPoolNovice; - giForcePercentage = gGameExternalOptions.iForcePercentageNovice; - giArmyAlertness = gGameExternalOptions.ubEasyEnemyStartingAlertLevel; - giArmyAlertnessDecay = gGameExternalOptions.ubEasyEnemyStartingAlertDecay; - gubMinEnemyGroupSize = gGameExternalOptions.ubMinEnemyGroupSizeNovice; - gubHoursGracePeriod = gGameExternalOptions.ubEasyGracePeriodInHours; - gfUnlimitedTroops = gGameExternalOptions.gfEasyUnlimitedTroops; - gfAggressiveQueen = gGameExternalOptions.gfEasyAggressiveQueen; - // 475 is 7:55am in minutes since midnight, the time the game starts on day 1 - AddStrategicEvent( EVENT_EVALUATE_QUEEN_SITUATION, 475 + dEnemyGeneralsSpeedupFactor * (gGameExternalOptions.ubEasyTimeEvaluateInMinutes + Random( gGameExternalOptions.ubEasyTimeEvaluateVariance )), 0 ); - break; - case DIF_LEVEL_MEDIUM: - giReinforcementPool = gGameExternalOptions.iReinforcementPoolExperienced; - giForcePercentage = gGameExternalOptions.iForcePercentageExperienced; - giArmyAlertness = gGameExternalOptions.ubNormalEnemyStartingAlertLevel; - giArmyAlertnessDecay = gGameExternalOptions.ubNormalEnemyStartingAlertDecay; - gubMinEnemyGroupSize = gGameExternalOptions.ubMinEnemyGroupSizeExperienced; - gubHoursGracePeriod = gGameExternalOptions.ubNormalGracePeriodInHours; - gfUnlimitedTroops = gGameExternalOptions.gfNormalUnlimitedTroops; - gfAggressiveQueen = gGameExternalOptions.gfNormalAggressiveQueen; - AddStrategicEvent( EVENT_EVALUATE_QUEEN_SITUATION, 475 + dEnemyGeneralsSpeedupFactor * (gGameExternalOptions.ubNormalTimeEvaluateInMinutes + Random( gGameExternalOptions.ubNormalTimeEvaluateVariance )), 0); - break; - case DIF_LEVEL_HARD: - giReinforcementPool = gGameExternalOptions.iReinforcementPoolExpert; - giForcePercentage = gGameExternalOptions.iForcePercentageExpert; - giArmyAlertness = gGameExternalOptions.ubHardEnemyStartingAlertLevel; - giArmyAlertnessDecay = gGameExternalOptions.ubHardEnemyStartingAlertDecay; - gubMinEnemyGroupSize = gGameExternalOptions.ubMinEnemyGroupSizeExpert; - gubHoursGracePeriod = gGameExternalOptions.ubHardGracePeriodInHours; - gfUnlimitedTroops = gGameExternalOptions.gfHardUnlimitedTroops; - gfAggressiveQueen = gGameExternalOptions.gfHardAggressiveQueen; - AddStrategicEvent( EVENT_EVALUATE_QUEEN_SITUATION, 475 + dEnemyGeneralsSpeedupFactor * (gGameExternalOptions.ubHardTimeEvaluateInMinutes + Random( gGameExternalOptions.ubHardTimeEvaluateVariance )), 0); - break; - case DIF_LEVEL_INSANE: - giReinforcementPool = gGameExternalOptions.iReinforcementPoolInsane; - giForcePercentage = gGameExternalOptions.iForcePercentageInsane; - giArmyAlertness = gGameExternalOptions.ubInsaneEnemyStartingAlertLevel; - giArmyAlertnessDecay = gGameExternalOptions.ubInsaneEnemyStartingAlertDecay; - gubMinEnemyGroupSize = gGameExternalOptions.ubMinEnemyGroupSizeInsane; - gubHoursGracePeriod = gGameExternalOptions.ubInsaneGracePeriodInHours; - gfUnlimitedTroops = gGameExternalOptions.gfInsaneUnlimitedTroops; - gfAggressiveQueen = gGameExternalOptions.gfInsaneAggressiveQueen; - AddStrategicEvent( EVENT_EVALUATE_QUEEN_SITUATION, 475 + dEnemyGeneralsSpeedupFactor * (gGameExternalOptions.ubInsaneTimeEvaluateInMinutes + Random( gGameExternalOptions.ubInsaneTimeEvaluateVariance )), 0); - break; - } - */ + giReinforcementPool = zDeffSetting[gGameOptions.ubDifficultyLevel].iQueensInitialPoolOfTroops; + giForcePercentage = zDeffSetting[gGameOptions.ubDifficultyLevel].iInitialGarrisonPercentages; + giArmyAlertness = zDeffSetting[gGameOptions.ubDifficultyLevel].iEnemyStartingAlertLevel; + giArmyAlertnessDecay = zDeffSetting[gGameOptions.ubDifficultyLevel].iEnemyAlertDecay; + gubMinEnemyGroupSize = zDeffSetting[gGameOptions.ubDifficultyLevel].iMinEnemyGroupSize; + gubHoursGracePeriod = zDeffSetting[gGameOptions.ubDifficultyLevel].iGracePeriodInHoursAfterSectorLiberation; + gfUnlimitedTroops = zDeffSetting[gGameOptions.ubDifficultyLevel].bUnlimitedPoolOfTroops; + gfAggressiveQueen = zDeffSetting[gGameOptions.ubDifficultyLevel].bAggressiveQueenAi; + + // 475 is 7:55am in minutes since midnight, the time the game starts on day 1 + AddStrategicEvent( EVENT_EVALUATE_QUEEN_SITUATION, 475 + dEnemyGeneralsSpeedupFactor * (zDeffSetting[gGameOptions.ubDifficultyLevel].iBaseDelayInMinutesBetweenEvaluations + Random( zDeffSetting[gGameOptions.ubDifficultyLevel].iEvaluationDelayVariance )), 0 ); + //Initialize the sectorinfo structure so all sectors don't point to a garrisonID. - for( i = 0; i <= 255; i++ ) + for( i = 0; i <= 255; ++i ) { SectorInfo[ i ].ubGarrisonID = NO_GARRISON; } @@ -1271,16 +1223,16 @@ void InitStrategicAI() if (zDeffSetting[gGameOptions.ubDifficultyLevel].iDesiredPopulationL3 == FALSE && zDeffSetting[gGameOptions.ubDifficultyLevel].iDesiredPopulationL3 == FALSE) { - for( i = 0; i < NUM_ARMY_COMPOSITIONS; i++ ) + for( i = 0; i < NUM_ARMY_COMPOSITIONS; ++i ) + { + if ( i != OMERTA_WELCOME_WAGON ) { - if ( i != OMERTA_WELCOME_WAGON ) - { - iPercentElitesBonus = zDeffSetting[gGameOptions.ubDifficultyLevel].iPercentElitesBonus; - gArmyComp[ i ].bElitePercentage = min(100,gArmyComp[ i ].bElitePercentage + iPercentElitesBonus); - gArmyComp[ i ].bTroopPercentage = max(0,gArmyComp[ i ].bTroopPercentage - iPercentElitesBonus); - gArmyComp[ i ].bAdminPercentage = 0; - } + iPercentElitesBonus = zDeffSetting[gGameOptions.ubDifficultyLevel].iPercentElitesBonus; + gArmyComp[ i ].bElitePercentage = min(100,gArmyComp[ i ].bElitePercentage + iPercentElitesBonus); + gArmyComp[ i ].bTroopPercentage = max(0,gArmyComp[ i ].bTroopPercentage - iPercentElitesBonus); + gArmyComp[ i ].bAdminPercentage = 0; } + } } /* switch( gGameOptions.ubDifficultyLevel ) @@ -1650,8 +1602,7 @@ void InitStrategicAI() { pSector = &SectorInfo[ SECTOR( gModSettings.ubWeaponCache1X, gModSettings.ubWeaponCache1Y ) ]; //SEC_E11 pSector->uiFlags |= SF_USE_ALTERNATE_MAP; - pSector->ubNumTroops = (UINT8)(6 + zDeffSetting[gGameOptions.ubDifficultyLevel].iWeaponCacheTroops1 * 2); - //pSector->ubNumTroops = (UINT8)(6 + gGameOptions.ubDifficultyLevel * 2); + pSector->ubNumTroops = (UINT8)(6 + zDeffSetting[gGameOptions.ubDifficultyLevel].iWeaponCacheTroops1 * 2); if (ubPicked[0] == 0) ubPicked[0] = ubSector; else if (ubPicked[1] == 0) @@ -1670,7 +1621,6 @@ void InitStrategicAI() pSector = &SectorInfo[ SECTOR( gModSettings.ubWeaponCache2X, gModSettings.ubWeaponCache2Y ) ]; //SEC_H5 pSector->uiFlags |= SF_USE_ALTERNATE_MAP; pSector->ubNumTroops = (UINT8)(6 + zDeffSetting[gGameOptions.ubDifficultyLevel].iWeaponCacheTroops2 * 2); - //pSector->ubNumTroops = (UINT8)(6 + gGameOptions.ubDifficultyLevel * 2); if (ubPicked[0] == 0) ubPicked[0] = ubSector; else if (ubPicked[1] == 0) @@ -1689,7 +1639,6 @@ void InitStrategicAI() pSector = &SectorInfo[ SECTOR( gModSettings.ubWeaponCache3X, gModSettings.ubWeaponCache3Y ) ]; //SEC_H10 pSector->uiFlags |= SF_USE_ALTERNATE_MAP; pSector->ubNumTroops = (UINT8)(6 + zDeffSetting[gGameOptions.ubDifficultyLevel].iWeaponCacheTroops3 * 2); - //pSector->ubNumTroops = (UINT8)(6 + gGameOptions.ubDifficultyLevel * 2); if (ubPicked[0] == 0) ubPicked[0] = ubSector; else if (ubPicked[1] == 0) @@ -1708,7 +1657,6 @@ void InitStrategicAI() pSector = &SectorInfo[ SECTOR( gModSettings.ubWeaponCache4X, gModSettings.ubWeaponCache4Y ) ]; //SEC_J12 pSector->uiFlags |= SF_USE_ALTERNATE_MAP; pSector->ubNumTroops = (UINT8)(6 + zDeffSetting[gGameOptions.ubDifficultyLevel].iWeaponCacheTroops4 * 2); - //pSector->ubNumTroops = (UINT8)(6 + gGameOptions.ubDifficultyLevel * 2); if (ubPicked[0] == 0) ubPicked[0] = ubSector; else if (ubPicked[1] == 0) @@ -1727,7 +1675,6 @@ void InitStrategicAI() pSector = &SectorInfo[ SECTOR( gModSettings.ubWeaponCache5X, gModSettings.ubWeaponCache5Y ) ]; //SEC_M9 pSector->uiFlags |= SF_USE_ALTERNATE_MAP; pSector->ubNumTroops = (UINT8)(6 + zDeffSetting[gGameOptions.ubDifficultyLevel].iWeaponCacheTroops5 * 2); - //pSector->ubNumTroops = (UINT8)(6 + gGameOptions.ubDifficultyLevel * 2); if (ubPicked[0] == 0) ubPicked[0] = ubSector; else if (ubPicked[1] == 0) @@ -3425,32 +3372,16 @@ void EvaluateQueenSituation() { dEnemyGeneralsSpeedupFactor = max( 0.5f, dEnemyGeneralsSpeedupFactor - gStrategicStatus.usVIPsLeft * gGameExternalOptions.fEnemyGeneralStrategicDecisionSpeedBonus ); } - uiOffset += dEnemyGeneralsSpeedupFactor * (zDeffSetting[gGameOptions.ubDifficultyLevel].iBaseDelayInMinutesBetweenEvaluations + Random( zDeffSetting[gGameOptions.ubDifficultyLevel].iEvaluationDelayVariance )); - /* - switch( gGameOptions.ubDifficultyLevel ) - { - case DIF_LEVEL_EASY: - uiOffset += dEnemyGeneralsSpeedupFactor * (gGameExternalOptions.ubEasyTimeEvaluateInMinutes + Random( gGameExternalOptions.ubEasyTimeEvaluateVariance )); - break; - case DIF_LEVEL_MEDIUM: - uiOffset += dEnemyGeneralsSpeedupFactor * (gGameExternalOptions.ubNormalTimeEvaluateInMinutes + Random( gGameExternalOptions.ubNormalTimeEvaluateVariance )); - break; - case DIF_LEVEL_HARD: - uiOffset += dEnemyGeneralsSpeedupFactor * (gGameExternalOptions.ubHardTimeEvaluateInMinutes + Random( gGameExternalOptions.ubHardTimeEvaluateVariance )); - break; - case DIF_LEVEL_INSANE: - uiOffset += dEnemyGeneralsSpeedupFactor * (gGameExternalOptions.ubInsaneTimeEvaluateInMinutes + Random( gGameExternalOptions.ubInsaneTimeEvaluateVariance )); - break; - } - */ - + + uiOffset += dEnemyGeneralsSpeedupFactor * (zDeffSetting[gGameOptions.ubDifficultyLevel].iBaseDelayInMinutesBetweenEvaluations + Random( zDeffSetting[gGameOptions.ubDifficultyLevel].iEvaluationDelayVariance )); + if( !giReinforcementPool ) - { //Queen has run out of reinforcements. Simulate recruiting and training new troops + { + //Queen has run out of reinforcements. Simulate recruiting and training new troops uiOffset *= 10; //Madd: don't need an unlimited troops check here, since they can never run out like this - giReinforcementPool += ( zDeffSetting[gGameOptions.ubDifficultyLevel].iQueenPoolIncrementPerDifficultyLevel * gGameOptions.ubDifficultyLevel ) * ( 100 + CurrentPlayerProgressPercentage() ) / 100 ; - //giReinforcementPool += ( gGameExternalOptions.guiBaseQueenPoolIncrement * gGameOptions.ubDifficultyLevel ) * ( 100 + CurrentPlayerProgressPercentage() ) / 100 ; + giReinforcementPool += ( zDeffSetting[gGameOptions.ubDifficultyLevel].iQueenPoolIncrementPerDifficultyLevel * gGameOptions.ubDifficultyLevel ) * ( 100 + CurrentPlayerProgressPercentage() ) / 100 ; AddStrategicEvent( EVENT_EVALUATE_QUEEN_SITUATION, GetWorldTotalMin() + uiOffset, 0 ); return; @@ -3711,27 +3642,6 @@ BOOLEAN LoadStrategicAI( HWFILE hFile ) gfUnlimitedTroops = zDeffSetting[gGameOptions.ubDifficultyLevel].bUnlimitedPoolOfTroops; gfAggressiveQueen = zDeffSetting[gGameOptions.ubDifficultyLevel].bAggressiveQueenAi; - /* - switch( gGameOptions.ubDifficultyLevel ) - { - case DIF_LEVEL_EASY: - gfUnlimitedTroops = gGameExternalOptions.gfEasyUnlimitedTroops; - gfAggressiveQueen = gGameExternalOptions.gfEasyAggressiveQueen; - break; - case DIF_LEVEL_MEDIUM: - gfUnlimitedTroops = gGameExternalOptions.gfNormalUnlimitedTroops; - gfAggressiveQueen = gGameExternalOptions.gfNormalAggressiveQueen; - break; - case DIF_LEVEL_HARD: - gfUnlimitedTroops = gGameExternalOptions.gfHardUnlimitedTroops; - gfAggressiveQueen = gGameExternalOptions.gfHardAggressiveQueen; - break; - case DIF_LEVEL_INSANE: - gfUnlimitedTroops = gGameExternalOptions.gfInsaneUnlimitedTroops; - gfAggressiveQueen = gGameExternalOptions.gfInsaneAggressiveQueen; - break; - } - */ DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"Strategic6"); FileRead( hFile, gbPadding2, 3, &uiNumBytesRead ); @@ -5477,23 +5387,6 @@ void ExecuteStrategicAIAction( UINT16 usActionCode, INT16 sSectorX, INT16 sSecto case NPC_ACTION_GIVE_KNOWLEDGE_OF_ALL_MERCS: //temporarily make the queen's forces more aware (high alert) gubNumAwareBattles = zDeffSetting[gGameOptions.ubDifficultyLevel].iNumAwareBattles; - /* - switch( gGameOptions.ubDifficultyLevel ) - { - case DIF_LEVEL_EASY: - gubNumAwareBattles = gGameExternalOptions.ubEasyNumAwareBattles; - break; - case DIF_LEVEL_MEDIUM: - gubNumAwareBattles = gGameExternalOptions.ubNormalNumAwareBattles; - break; - case DIF_LEVEL_HARD: - gubNumAwareBattles = gGameExternalOptions.ubHardNumAwareBattles; - break; - case DIF_LEVEL_INSANE: - gubNumAwareBattles = gGameExternalOptions.ubInsaneNumAwareBattles; - break; - } - */ break; default: @@ -5911,8 +5804,7 @@ void StrategicHandleQueenLosingControlOfSector( INT16 sSectorX, INT16 sSectorY, if (value9 == 0) value9 = 1; } - if( pSector->ubInvestigativeState >= ( 4 * value9 ) && zDeffSetting[gGameOptions.ubDifficultyLevel].bQueenLosingControlOfSector == FALSE ) - //if( pSector->ubInvestigativeState >= ( 4 * gGameOptions.ubDifficultyLevel ) && gGameOptions.ubDifficultyLevel < DIF_LEVEL_INSANE ) + if( pSector->ubInvestigativeState >= ( 4 * value9 ) && !zDeffSetting[gGameOptions.ubDifficultyLevel].bQueenLosingControlOfSector ) { //This is the 4th time the player has conquered this sector. We won't pester the player with probing attacks here anymore. return; @@ -6470,8 +6362,7 @@ void UpgradeAdminsToTroops() while ( ubAdminsToCheck > 0) { // chance to upgrade at each check is random, and also dependant on the garrison's priority - if ( Chance ( bPriority ) || zDeffSetting[gGameOptions.ubDifficultyLevel].bUpgradeAdminsToTroops == TRUE ) - //if ( Chance ( bPriority ) || gGameOptions.ubDifficultyLevel > DIF_LEVEL_HARD ) // Madd: Always happens on Insane + if ( Chance ( bPriority ) || zDeffSetting[gGameOptions.ubDifficultyLevel].bUpgradeAdminsToTroops ) { pSector->ubNumAdmins--; pSector->ubNumTroops++; @@ -6526,8 +6417,7 @@ void UpgradeAdminsToTroops() while ( ubAdminsToCheck > 0) { // chance to upgrade at each check is random, and also dependant on the group's priority - if ( Chance ( bPriority ) || zDeffSetting[gGameOptions.ubDifficultyLevel].bUpgradeAdminsToTroops2 == TRUE ) - //if ( Chance ( bPriority ) || gGameOptions.ubDifficultyLevel >= DIF_LEVEL_HARD )// Madd: Always happens on Expert and Insane + if ( Chance ( bPriority ) || zDeffSetting[gGameOptions.ubDifficultyLevel].bUpgradeAdminsToTroops2 ) { pGroup->pEnemyGroup->ubNumAdmins--; pGroup->pEnemyGroup->ubNumTroops++; @@ -6767,23 +6657,7 @@ void TagSAIGroupWithGracePeriod( GROUP *pGroup ) if( iPatrolID != -1 ) { - gPatrolGroup[ iPatrolID ].bFillPermittedAfterDayMod100 = (UINT8)((GetWorldDay() + zDeffSetting[gGameOptions.ubDifficultyLevel].iGracePeriodInDaysAfterPatrolDestroyed) % 100); - /* - switch( gGameOptions.ubDifficultyLevel ) { - case DIF_LEVEL_EASY: - gPatrolGroup[ iPatrolID ].bFillPermittedAfterDayMod100 = (UINT8)((GetWorldDay() + gGameExternalOptions.ubEasyPatrolGracePeriodInDays) % 100); - break; - case DIF_LEVEL_MEDIUM: - gPatrolGroup[ iPatrolID ].bFillPermittedAfterDayMod100 = (UINT8)((GetWorldDay() + gGameExternalOptions.ubNormalPatrolGracePeriodInDays) % 100); - break; - case DIF_LEVEL_HARD: - gPatrolGroup[ iPatrolID ].bFillPermittedAfterDayMod100 = (UINT8)((GetWorldDay() + gGameExternalOptions.ubHardPatrolGracePeriodInDays) % 100); - break; - case DIF_LEVEL_INSANE: - gPatrolGroup[ iPatrolID ].bFillPermittedAfterDayMod100 = (UINT8)((GetWorldDay() + gGameExternalOptions.ubInsanePatrolGracePeriodInDays) % 100); - break; - } - */ + gPatrolGroup[ iPatrolID ].bFillPermittedAfterDayMod100 = (UINT8)((GetWorldDay() + zDeffSetting[gGameOptions.ubDifficultyLevel].iGracePeriodInDaysAfterPatrolDestroyed) % 100); } } } diff --git a/Strategic/XML_ExtraItems.cpp b/Strategic/XML_ExtraItems.cpp index c7565a3d..c5151d63 100644 --- a/Strategic/XML_ExtraItems.cpp +++ b/Strategic/XML_ExtraItems.cpp @@ -187,9 +187,8 @@ void AddExtraItems(UINT8 x, UINT8 y, UINT8 z, bool sectorIsLoaded) int baseFNLength = strlen(fileName); // Append a suffix based on the difficulty - switch (gGameOptions.ubDifficultyLevel) { - case DIF_LEVEL_ZERO: - break; + switch (gGameOptions.ubDifficultyLevel) + { case DIF_LEVEL_EASY: strcat(fileName, "_Novice"); break; @@ -202,65 +201,15 @@ void AddExtraItems(UINT8 x, UINT8 y, UINT8 z, bool sectorIsLoaded) case DIF_LEVEL_INSANE: strcat(fileName, "_Insane"); break; - case DIF_LEVEL_FIVE: - strcat(fileName, "_Diff_5"); - break; - case 6: - strcat(fileName, "_Diff_6"); - break; - case 7: - strcat(fileName, "_Diff_7"); - break; - case 8: - strcat(fileName, "_Diff_8"); - break; - case 9: - strcat(fileName, "_Diff_9"); - break; - case 10: - strcat(fileName, "_Diff_10"); - break; - case 11: - strcat(fileName, "_Diff_11"); - break; - case 12: - strcat(fileName, "_Diff_12"); - break; - case 13: - strcat(fileName, "_Diff_13"); - break; - case 14: - strcat(fileName, "_Diff_14"); - break; - case 15: - strcat(fileName, "_Diff_15"); - break; default: - break; + { + CHAR8 str[20]; + sprintf( str, "_Diff_%d", gGameOptions.ubDifficultyLevel ); + strcat( fileName, str ); + } + break; } - /* - switch (gGameOptions.ubDifficultyLevel) { - case DIF_LEVEL_ZERO: - break; - case DIF_LEVEL_EASY: - strcat(fileName, "_Novice"); - break; - case DIF_LEVEL_MEDIUM: - strcat(fileName, "_Experienced"); - break; - case DIF_LEVEL_HARD: - strcat(fileName, "_Expert"); - break; - case DIF_LEVEL_INSANE: - strcat(fileName, "_Insane"); - break; - case DIF_LEVEL_FIVE: - break; - default: - break; - } - */ - + strcat(fileName, ".xml"); if(!FileExists(fileName))//dnl ch75 261013 just to avoid sdd::exception under debug from VFS when file not exist return; diff --git a/Strategic/mapscreen.cpp b/Strategic/mapscreen.cpp index 8f9a71f4..9043f67f 100644 --- a/Strategic/mapscreen.cpp +++ b/Strategic/mapscreen.cpp @@ -15403,9 +15403,7 @@ void DumpSectorDifficultyInfo( void ) // NOTE: This operates on the selected map sector! CHAR16 wSectorName[ 128 ]; - ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_TESTVERSION, L"Playing Difficulty: %s", zDeffSetting[gGameOptions.ubDifficultyLevel].szDeffName ); - //ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_TESTVERSION, L"Playing Difficulty: %s", gzGIOScreenText[ GIO_DIF_LEVEL_TEXT + gGameOptions.ubDifficultyLevel ] ); - + ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_TESTVERSION, L"Playing Difficulty: %s", zDeffSetting[gGameOptions.ubDifficultyLevel].szDeffName ); ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_TESTVERSION, L"Highest Progress (0-100) = %d%%", HighestPlayerProgressPercentage() ); ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_TESTVERSION, L"Player Kills = %d", gStrategicStatus.usPlayerKills ); diff --git a/Tactical/Air Raid.cpp b/Tactical/Air Raid.cpp index 9a382ac5..7c1a361e 100644 --- a/Tactical/Air Raid.cpp +++ b/Tactical/Air Raid.cpp @@ -512,8 +512,7 @@ void AirRaidLookForDive( ) { // If we are are beginning game, only do gun dives.. - if ( gAirRaidDef.uiFlags & AIR_RAID_BEGINNING_GAME && zDeffSetting[gGameOptions.ubDifficultyLevel].bAirRaidLookForDive == FALSE) - //if ( gAirRaidDef.uiFlags & AIR_RAID_BEGINNING_GAME && gGameOptions.ubDifficultyLevel < DIF_LEVEL_HARD ) + if ( gAirRaidDef.uiFlags & AIR_RAID_BEGINNING_GAME && !zDeffSetting[gGameOptions.ubDifficultyLevel].bAirRaidLookForDive ) { if ( gbNumDives == 0 ) { diff --git a/Tactical/Campaign.cpp b/Tactical/Campaign.cpp index 05bf41fc..cab0134f 100644 --- a/Tactical/Campaign.cpp +++ b/Tactical/Campaign.cpp @@ -1288,7 +1288,6 @@ void HandleUnhiredMercDeaths( INT32 iProfileID ) INT16 sChance; MERCPROFILESTRUCT *pProfile = &(gMercProfiles[ iProfileID ]); - // if the player has never yet had the chance to hire this merc if ( !( pProfile->ubMiscFlags3 & PROFILE_MISC_FLAG3_PLAYER_HAD_CHANCE_TO_HIRE) ) { @@ -1296,36 +1295,14 @@ void HandleUnhiredMercDeaths( INT32 iProfileID ) return; } - ubMaxDeaths = zDeffSetting[gGameOptions.ubDifficultyLevel].iMaxMercDeaths; - /* - // how many in total can be killed like this depends on player's difficulty setting - switch( gGameOptions.ubDifficultyLevel ) - { - case DIF_LEVEL_EASY: //Kaiden Externalized ubMaxDeaths Values - ubMaxDeaths = gGameExternalOptions.giEasyMercDeaths; - break; - case DIF_LEVEL_MEDIUM: - ubMaxDeaths = gGameExternalOptions.giExperiencedMercDeaths; - break; - case DIF_LEVEL_HARD: - ubMaxDeaths = gGameExternalOptions.giExpertMercDeaths; - break; - case DIF_LEVEL_INSANE: - ubMaxDeaths = gGameExternalOptions.giInsaneMercDeaths; - break; - default: - Assert(FALSE); - ubMaxDeaths = 0; - break; - } - */ + ubMaxDeaths = zDeffSetting[gGameOptions.ubDifficultyLevel].iMaxMercDeaths; + // if we've already hit the limit in this game, skip these checks if (gStrategicStatus.ubUnhiredMercDeaths >= ubMaxDeaths) { return; } - // calculate this merc's (small) chance to get killed today (out of 1000) sChance = 10 - pProfile->bExpLevel; @@ -1617,28 +1594,8 @@ UINT8 CurrentPlayerProgressPercentage(void) // kills per point depends on difficulty, and should match the ratios of starting enemy populations (730/1050/1500) // HEADROCK HAM 3: Externalized all four Kills-per-point ratios. - ubKillsPerPoint = zDeffSetting[gGameOptions.ubDifficultyLevel].iNumKillsPerProgressPoint; - /* - switch( gGameOptions.ubDifficultyLevel ) - { - case DIF_LEVEL_EASY: - ubKillsPerPoint = gGameExternalOptions.usNumKillsPerProgressPointNovice; - break; - case DIF_LEVEL_MEDIUM: - ubKillsPerPoint = gGameExternalOptions.usNumKillsPerProgressPointExperienced; - break; - case DIF_LEVEL_HARD: - ubKillsPerPoint = gGameExternalOptions.usNumKillsPerProgressPointExpert; - break; - case DIF_LEVEL_INSANE: - ubKillsPerPoint = gGameExternalOptions.usNumKillsPerProgressPointInsane; - break; - default: - Assert(FALSE); - ubKillsPerPoint = 10; - break; - } - */ + ubKillsPerPoint = zDeffSetting[gGameOptions.ubDifficultyLevel].iNumKillsPerProgressPoint; + usKillsProgress = gStrategicStatus.usPlayerKills / ubKillsPerPoint; if (usKillsProgress > usMaxKillsProgress) { diff --git a/Tactical/Ja25_Tactical.cpp b/Tactical/Ja25_Tactical.cpp index 526d98a5..534679eb 100644 --- a/Tactical/Ja25_Tactical.cpp +++ b/Tactical/Ja25_Tactical.cpp @@ -1821,11 +1821,8 @@ void HandleInitialEventsInHeliCrash() UINT32 GetNumberOfTurnsPowerGenFanWillBeStoppedFor() -{ - UINT32 uiNumTurns = PGF__NUM_TURNS_TILL_START_FAN_BACK_UP_EASY; - uiNumTurns = zDeffSetting[gGameOptions.ubDifficultyLevel].iGetNumberOfTurnsPowerGenFanWillBeStoppedFor; - - return( uiNumTurns ); +{ + return( zDeffSetting[gGameOptions.ubDifficultyLevel].iGetNumberOfTurnsPowerGenFanWillBeStoppedFor ); } diff --git a/Tactical/Soldier Control.cpp b/Tactical/Soldier Control.cpp index ac84e64e..f7548021 100644 --- a/Tactical/Soldier Control.cpp +++ b/Tactical/Soldier Control.cpp @@ -2063,34 +2063,7 @@ INT16 SOLDIERTYPE::CalcActionPoints( void ) //if ( this->bTeam != CIV_TEAM && this->bTeam != gbPlayerNum) if ( this->bTeam == ENEMY_TEAM ) { - ubPoints += zDeffSetting[gGameOptions.ubDifficultyLevel].iEnemyAPBonus; - /* - switch( gGameOptions.ubDifficultyLevel ) - { - case DIF_LEVEL_EASY: - - ubPoints += gGameExternalOptions.iEasyAPBonus; - break; - - case DIF_LEVEL_MEDIUM: - - ubPoints += gGameExternalOptions.iExperiencedAPBonus; - break; - - case DIF_LEVEL_HARD: - - ubPoints += gGameExternalOptions.iExpertAPBonus; - break; - - case DIF_LEVEL_INSANE: - - ubPoints += gGameExternalOptions.iInsaneAPBonus; - break; - - default: - ubPoints += 0; - } - */ + ubPoints += zDeffSetting[gGameOptions.ubDifficultyLevel].iEnemyAPBonus; } // Bonus to Militia APs else if ( this->bTeam == MILITIA_TEAM ) @@ -2197,26 +2170,10 @@ void SOLDIERTYPE::CalcNewActionPoints( void ) // +5% APs per trait (+15% is max) usMaxActionPnts += (usMaxActionPnts * gSkillTraitValues.ubSLBonusAPsPercent * GetSquadleadersCountInVicinity( this, FALSE, FALSE ) / 100); } + if ( this->bTeam == ENEMY_TEAM ) { usMaxActionPnts += zDeffSetting[gGameOptions.ubDifficultyLevel].iEnemyAPBonus; - /* - switch( gGameOptions.ubDifficultyLevel ) - { - case DIF_LEVEL_EASY: - usMaxActionPnts += gGameExternalOptions.iEasyAPBonus; - break; - case DIF_LEVEL_MEDIUM: - usMaxActionPnts += gGameExternalOptions.iExperiencedAPBonus; - break; - case DIF_LEVEL_HARD: - usMaxActionPnts += gGameExternalOptions.iExpertAPBonus; - break; - case DIF_LEVEL_INSANE: - usMaxActionPnts += gGameExternalOptions.iInsaneAPBonus; - break; - } - */ } // Bonus to Militia APs else if ( this->bTeam == MILITIA_TEAM ) diff --git a/Tactical/Weapons.cpp b/Tactical/Weapons.cpp index f3dc0283..a2267563 100644 --- a/Tactical/Weapons.cpp +++ b/Tactical/Weapons.cpp @@ -5934,7 +5934,6 @@ else if ( !(pSoldier->flags.uiStatusFlags & SOLDIER_PC ) && (pSoldier->bSide != gbPlayerNum) ) { iBaseModifier += zDeffSetting[gGameOptions.ubDifficultyLevel].NewDifficualtySetingsBASE_DIFFICULTY; - //iBaseModifier += gGameCTHConstants.BASE_DIFFICULTY[gGameOptions.ubDifficultyLevel]; } // Percentage based-modifier from the weapon and its attachments @@ -6268,7 +6267,6 @@ else if ( !(pSoldier->flags.uiStatusFlags & SOLDIER_PC ) && (pSoldier->bSide != gbPlayerNum) ) { iAimModifier += zDeffSetting[gGameOptions.ubDifficultyLevel].NewDifficualtySetingsAIM_DIFFICULTY; - //iAimModifier += gGameCTHConstants.AIM_DIFFICULTY[gGameOptions.ubDifficultyLevel]; } // Percent modifier from the weapon and its attachments @@ -12869,7 +12867,6 @@ FLOAT CalcNewChanceToHitBaseSpecialBonus(SOLDIERTYPE *pSoldier) if ( !(pSoldier->flags.uiStatusFlags & SOLDIER_PC ) && (pSoldier->bSide != gbPlayerNum) ) { fBaseModifier += zDeffSetting[gGameOptions.ubDifficultyLevel].NewDifficualtySetingsBASE_DIFFICULTY; - //fBaseModifier += gGameCTHConstants.BASE_DIFFICULTY[gGameOptions.ubDifficultyLevel]; } return fBaseModifier; @@ -13169,7 +13166,6 @@ FLOAT CalcNewChanceToHitAimSpecialBonus(SOLDIERTYPE *pSoldier) if ( !(pSoldier->flags.uiStatusFlags & SOLDIER_PC ) && (pSoldier->bSide != gbPlayerNum) ) { fAimModifier += zDeffSetting[gGameOptions.ubDifficultyLevel].NewDifficualtySetingsAIM_DIFFICULTY; - //fAimModifier += gGameCTHConstants.AIM_DIFFICULTY[gGameOptions.ubDifficultyLevel]; } return fAimModifier; diff --git a/Tactical/opplist.cpp b/Tactical/opplist.cpp index e397ee47..85f85d44 100644 --- a/Tactical/opplist.cpp +++ b/Tactical/opplist.cpp @@ -933,8 +933,7 @@ void HandleSight(SOLDIERTYPE *pSoldier, UINT8 ubSightFlags) RevealRoofsAndItems(pSoldier,TRUE, TRUE, pSoldier->pathing.bLevel, FALSE ); } // unless in easy mode allow alerted enemies to radio - else if ( zDeffSetting[gGameOptions.ubDifficultyLevel].bRadioSightings == TRUE ) - //else if ( gGameOptions.ubDifficultyLevel >= DIF_LEVEL_MEDIUM ) + else if ( zDeffSetting[gGameOptions.ubDifficultyLevel].bRadioSightings ) { // don't allow admins to radio //Madd: Huh? why not admins? removed. @@ -981,8 +980,7 @@ void HandleSight(SOLDIERTYPE *pSoldier, UINT8 ubSightFlags) RadioSightings(pThem,pSoldier->ubID, pThem->bTeam); } // unless in easy mode allow alerted enemies to radio - else if ( zDeffSetting[gGameOptions.ubDifficultyLevel].bRadioSightings2 == TRUE ) - //else if ( gGameOptions.ubDifficultyLevel >= DIF_LEVEL_MEDIUM ) + else if ( zDeffSetting[gGameOptions.ubDifficultyLevel].bRadioSightings2 ) { // don't allow admins to radio if ( pThem->bTeam == ENEMY_TEAM && gTacticalStatus.Team[ ENEMY_TEAM ].bAwareOfOpposition && pThem->ubSoldierClass != SOLDIER_CLASS_ADMINISTRATOR ) diff --git a/TacticalAI/AIUtils.cpp b/TacticalAI/AIUtils.cpp index 256d7310..6a2ac03b 100644 --- a/TacticalAI/AIUtils.cpp +++ b/TacticalAI/AIUtils.cpp @@ -2266,13 +2266,13 @@ INT8 CalcMorale(SOLDIERTYPE *pSoldier) bMoraleCategory++; - // if adjustments made it outside the allowed limits - if (bMoraleCategory < MORALE_HOPELESS) - bMoraleCategory = MORALE_HOPELESS; - else + // if adjustments made it outside the allowed limits + if (bMoraleCategory < MORALE_HOPELESS) + bMoraleCategory = MORALE_HOPELESS; + else { - if (bMoraleCategory > MORALE_FEARLESS) - bMoraleCategory = MORALE_FEARLESS; + if (bMoraleCategory > MORALE_FEARLESS) + bMoraleCategory = MORALE_FEARLESS; } // if only 1/4 of side left, reduce morale @@ -2286,24 +2286,21 @@ INT8 CalcMorale(SOLDIERTYPE *pSoldier) } */ - // brave guys never get hopeless, at worst they get worried - if (bMoraleCategory == MORALE_HOPELESS && - (pSoldier->aiData.bAttitude == BRAVESOLO || pSoldier->aiData.bAttitude == BRAVEAID)) - bMoraleCategory = MORALE_WORRIED; - - // SANDRO - on Insane difficulty enemy morale cannot go below worried - if (bMoraleCategory == MORALE_HOPELESS && zDeffSetting[gGameOptions.ubDifficultyLevel].bEnemyMoraleWorried == TRUE ) - //if (bMoraleCategory == MORALE_HOPELESS && gGameOptions.ubDifficultyLevel == DIF_LEVEL_INSANE ) - bMoraleCategory = MORALE_WORRIED; + // brave guys never get hopeless, at worst they get worried + // SANDRO - on Insane difficulty enemy morale cannot go below worried + if ( bMoraleCategory == MORALE_HOPELESS ) + { + if ( pSoldier->aiData.bAttitude == BRAVESOLO || pSoldier->aiData.bAttitude == BRAVEAID || zDeffSetting[gGameOptions.ubDifficultyLevel].bEnemyMoraleWorried ) + bMoraleCategory = MORALE_WORRIED; + } #ifdef DEBUGDECISIONS - STR tempstr; - sprintf( tempstr, "Morale = %d (category %d)\n", - pSoldier->aiData.bMorale,bMoraleCategory); + STR tempstr; + sprintf( tempstr, "Morale = %d (category %d)\n", pSoldier->aiData.bMorale,bMoraleCategory); DebugAI (tempstr); #endif - return(bMoraleCategory); + return(bMoraleCategory); } INT32 CalcManThreatValue( SOLDIERTYPE *pEnemy, INT32 sMyGrid, UINT8 ubReduceForCover, SOLDIERTYPE * pMe )