New Feature: Added up to 15 game difficulty settings (by Jazz)

- Externalized the difficulty setings to "TableData\DifficultySettings.xml" file
- Some INI Settings (ja2_options.ini, CTHConstants.ini and Creature_Settings.ini) moved from INI file to this xml file
- see #define DIFFICULTY_SETTING

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@7447 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
Wanne
2014-08-28 10:30:40 +00:00
parent 6b728e56ac
commit 344797f6af
47 changed files with 1976 additions and 49 deletions
+74 -10
View File
@@ -288,6 +288,11 @@
#define JA2SP_UB_RPC_TEX_AND_JOHN "RPC_TEX_AND_JOHN"
#define JA2SP_UB_RANDOM_MANUEL_TEXT "RANDOM_MANUEL_TEXT"
#ifdef DIFFICULTY_SETTING
//#define NUM_DIFF_SETTINGS 4
DIFFICULTY_SETTINGS_VALUES zDeffSetting[15];
UINT8 MaxDifficultySettingsValues;
#endif
//Difficulty settings
enum
@@ -296,8 +301,13 @@ enum
GIO_DIFF_MED,
GIO_DIFF_HARD,
GIO_DIFF_INSANE,
#ifdef DIFFICULTY_SETTING
GIO_DIFF_NEW = GIO_DIFF_INSANE + 245,
#else
NUM_DIFF_SETTINGS,
#endif
};
enum
@@ -1422,8 +1432,12 @@ void BtnGIODifficultySelectionRightCallback( GUI_BUTTON *btn,INT32 reason )
return;
if( reason & MSYS_CALLBACK_REASON_LBUTTON_REPEAT )
{
if ( iCurrentDifficulty < 2 )
{
#ifdef DIFFICULTY_SETTING
if ( iCurrentDifficulty < MaxDifficultySettingsValues /*NUM_DIFF_SETTINGS*/ - 2 ) //2
#else
if ( iCurrentDifficulty < MaxDifficultySettingsValues /*2*/ )
#endif
{
PlayButtonSound( giGIODifficultyButton[1], BUTTON_SOUND_CLICKED_ON );
@@ -1438,8 +1452,12 @@ void BtnGIODifficultySelectionRightCallback( GUI_BUTTON *btn,INT32 reason )
else if( reason & MSYS_CALLBACK_REASON_LBUTTON_DWN )
{
btn->uiFlags|=(BUTTON_CLICKED_ON);
if ( iCurrentDifficulty < 2 )
#ifdef DIFFICULTY_SETTING
if ( iCurrentDifficulty < MaxDifficultySettingsValues /*NUM_DIFF_SETTINGS*/ - 2 ) //2
#else
if ( iCurrentDifficulty < MaxDifficultySettingsValues /*2*/ )
#endif
{
PlayButtonSound( giGIODifficultyButton[1], BUTTON_SOUND_CLICKED_ON );
@@ -2680,8 +2698,13 @@ BOOLEAN RenderGIOScreen()
//Display the Dif Settings Title Text
RenderGIOSmallSelectionFrame( (GIO_DIF_SETTING_X + 36), (GIO_DIF_SETTING_Y - 3) );
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 );
#ifdef DIFFICULTY_SETTING
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 );
#else
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 );
#endif
//Display the IMP number Title Text
RenderGIOSmallSelectionFrame( (GIO_IMP_SETTING_X + 36), (GIO_IMP_SETTING_Y - 3) );
DisplayWrappedString( (UINT16)(GIO_IMP_SETTING_X+GIO_OFFSET_TO_TEXT + 1), (UINT16)(GIO_IMP_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_IMP_NUMBER_TITLE_TEXT ], FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED );
@@ -3050,8 +3073,12 @@ void DoneFadeOutForExitGameInitOptionScreen( void )
gGameOptions.ubGameStyle = FALSE;
gGameUBOptions.fRandomManuelText = GetCurrentTextStyleButtonSetting();
#ifdef DIFFICULTY_SETTING
gGameOptions.ubDifficultyLevel = min( MaxDifficultySettingsValues-1, ( max( 1, (iCurrentDifficulty + 1)) ));
#else
gGameOptions.ubDifficultyLevel = min( NUM_DIFF_SETTINGS-1, ( max( 1, (iCurrentDifficulty + 1)) ));
#endif
gGameOptions.fTurnTimeLimit = FALSE;
@@ -3161,6 +3188,9 @@ void DisplayMessageToUserAboutGameDifficulty()
{
UINT8 ubDiffLevel = iCurrentDifficulty;
#ifdef DIFFICULTY_SETTING
DoGioMessageBox( MSG_BOX_BASIC_STYLE, zDeffSetting[ubDiffLevel + 1].szConfirmText, GAME_INIT_OPTIONS_SCREEN, MSG_BOX_FLAG_YESNO, ConfirmGioDifSettingMessageBoxCallBack );
#else
switch( ubDiffLevel )
{
case 0:
@@ -3176,6 +3206,7 @@ void DisplayMessageToUserAboutGameDifficulty()
DoGioMessageBox( MSG_BOX_BASIC_STYLE, zGioDifConfirmText[GIO_CFS_INSANE], GAME_INIT_OPTIONS_SCREEN, MSG_BOX_FLAG_YESNO, ConfirmGioDifSettingMessageBoxCallBack );
break;
}
#endif
}
@@ -3415,6 +3446,12 @@ void RenderGIOSmallSelectionFrame(INT16 sX, INT16 sY)
#define JA2SP_FOODSYSTEM "FOOD_SYSTEM"
#ifdef DIFFICULTY_SETTING
//#define NUM_DIFF_SETTINGS 3
DIFFICULTY_SETTINGS_VALUES zDeffSetting[15];
UINT8 MaxDifficultySettingsValues;
#endif
//Difficulty settings
enum
{
@@ -3422,8 +3459,13 @@ enum
GIO_DIFF_MED,
GIO_DIFF_HARD,
GIO_DIFF_INSANE,
#ifdef DIFFICULTY_SETTING
GIO_DIFF_NEW = GIO_DIFF_INSANE + 245,
#else
NUM_DIFF_SETTINGS,
#endif
};
enum
@@ -4513,7 +4555,11 @@ void BtnGIODifficultySelectionRightCallback( GUI_BUTTON *btn,INT32 reason )
if( reason & MSYS_CALLBACK_REASON_LBUTTON_REPEAT )
{
#ifdef DIFFICULTY_SETTING
if ( iCurrentDifficulty < MaxDifficultySettingsValues /*NUM_DIFF_SETTINGS*/ - 1 ) //3
#else
if ( iCurrentDifficulty < 3 )
#endif
{
PlayButtonSound( giGIODifficultyButton[1], BUTTON_SOUND_CLICKED_ON );
@@ -4529,7 +4575,11 @@ void BtnGIODifficultySelectionRightCallback( GUI_BUTTON *btn,INT32 reason )
{
btn->uiFlags|=(BUTTON_CLICKED_ON);
#ifdef DIFFICULTY_SETTING
if ( iCurrentDifficulty < MaxDifficultySettingsValues /*NUM_DIFF_SETTINGS*/ - 1 ) //2
#else
if ( iCurrentDifficulty < 3 )
#endif
{
PlayButtonSound( giGIODifficultyButton[1], BUTTON_SOUND_CLICKED_ON );
@@ -5737,8 +5787,13 @@ BOOLEAN RenderGIOScreen()
//Display the Dif Settings Title Text
RenderGIOSmallSelectionFrame( (GIO_DIF_SETTING_X + 36), (GIO_DIF_SETTING_Y - 3) );
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 );
#ifdef DIFFICULTY_SETTING
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 );
#else
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 );
#endif
//Display the IMP number Title Text
RenderGIOSmallSelectionFrame( (GIO_IMP_SETTING_X + 36), (GIO_IMP_SETTING_Y - 3) );
DisplayWrappedString( (UINT16)(GIO_IMP_SETTING_X+GIO_OFFSET_TO_TEXT + 1), (UINT16)(GIO_IMP_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_IMP_NUMBER_TITLE_TEXT ], FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED );
@@ -6092,8 +6147,13 @@ void DoneFadeOutForExitGameInitOptionScreen( void )
// loop through and get the status of all the buttons
gGameOptions.fGunNut = GetCurrentGunButtonSetting();
gGameOptions.ubGameStyle = GetCurrentGameStyleButtonSetting();
#ifdef DIFFICULTY_SETTING
gGameOptions.ubDifficultyLevel = min( MaxDifficultySettingsValues, ( max( 1, (iCurrentDifficulty + 1)) ));
#else
gGameOptions.ubDifficultyLevel = min( NUM_DIFF_SETTINGS, ( max( 1, (iCurrentDifficulty + 1)) ));
#endif
gGameOptions.fTurnTimeLimit = FALSE;
// iron man
@@ -6193,6 +6253,9 @@ void DisplayMessageToUserAboutGameDifficulty()
{
UINT8 ubDiffLevel = iCurrentDifficulty;
#ifdef DIFFICULTY_SETTING
DoGioMessageBox( MSG_BOX_BASIC_STYLE, zDeffSetting[ubDiffLevel + 1].szConfirmText, GAME_INIT_OPTIONS_SCREEN, MSG_BOX_FLAG_YESNO, ConfirmGioDifSettingMessageBoxCallBack );
#else
switch( ubDiffLevel )
{
case 0:
@@ -6208,6 +6271,7 @@ void DisplayMessageToUserAboutGameDifficulty()
DoGioMessageBox( MSG_BOX_BASIC_STYLE, zGioDifConfirmText[GIO_CFS_INSANE], GAME_INIT_OPTIONS_SCREEN, MSG_BOX_FLAG_YESNO, ConfirmGioDifSettingMessageBoxCallBack );
break;
}
#endif
}
+74
View File
@@ -8,5 +8,79 @@ UINT32 GameInitOptionsScreenShutdown( void );
BOOLEAN SpIniExists();
#ifdef DIFFICULTY_SETTING
typedef struct
{
UINT16 uiIndex;
CHAR16 szDeffName[128];
CHAR16 szConfirmText[255];
CHAR16 szPrefixXmlName[128];
INT32 iStartingCash;
INT8 iEnemyAPBonus;
UINT16 iNumKillsPerProgressPoint;
INT32 iInitialGarrisonPercentages;
UINT8 iMinEnemyGroupSize;
BOOLEAN bUnlimitedPoolOfTroops;
INT32 iQueensInitialPoolOfTroops;
UINT32 iQueenPoolIncrementPerDifficultyLevel;
UINT32 iEnemyStartingAlertLevel;
UINT32 iEnemyAlertDecay;
UINT32 iNumAwareBattles;
UINT32 iBaseDelayInMinutesBetweenEvaluations;
UINT32 iEvaluationDelayVariance;
UINT32 iGracePeriodInHoursAfterSectorLiberation;
UINT32 iGracePeriodInDaysAfterPatrolDestroyed;
BOOLEAN bAggressiveQueenAi;
INT32 iMaxMercDeaths;
//Creatures Settings
UINT16 iCreatureSpreadTime;
UINT8 iQueenReproductionBase;
UINT8 iQueenReproductionBonus;
UINT8 iQueenInitBonusSpread;
INT8 iCreaturePopulationModifier;
INT8 iCreatureTownAggressiveness;
//sectors
UINT8 iJ9B1NumTroops;
UINT8 iJ9B2NumCreatures;
UINT8 iK4B1NumTroops;
UINT8 iK4B1NumElites;
UINT8 iO3B1NumTroops;
UINT8 iO3B1NumElites;
UINT8 iP3B1NumElites;
BOOLEAN bStrategicAiActionWakeQueen;
UINT16 iUpdateLastDayOfPlayerActivity;
INT32 iChanceOfEnemyAmbushes;
BOOLEAN bAllowReinforcements;
BOOLEAN bAllowReinforcementsOmerta;
INT32 iPercentElitesBonus;
BOOLEAN iDesiredPopulationL3;
BOOLEAN iDesiredPopulationL2;
UINT8 iWeaponCacheTroops1;
UINT8 iWeaponCacheTroops2;
UINT8 iWeaponCacheTroops3;
UINT8 iWeaponCacheTroops4;
UINT8 iWeaponCacheTroops5;
BOOLEAN bUpgradeAdminsToTroops;
BOOLEAN bUpgradeAdminsToTroops2;
BOOLEAN bQueenLosingControlOfSector;
BOOLEAN bBloodcatAmbush;
BOOLEAN bAirRaidLookForDive;
UINT32 iGetNumberOfTurnsPowerGenFanWillBeStoppedFor; //UB
BOOLEAN bRadioSightings;
BOOLEAN bRadioSightings2;
FLOAT NewDifficualtySetingsBASE_DIFFICULTY;
FLOAT NewDifficualtySetingsAIM_DIFFICULTY;
BOOLEAN bEnemyMoraleWorried;
} DIFFICULTY_SETTINGS_VALUES;
extern UINT8 MaxDifficultySettingsValues;
extern DIFFICULTY_SETTINGS_VALUES zDeffSetting[15];
#endif
#endif
+17 -1
View File
@@ -47,6 +47,10 @@
#include "Map Information.h"
#ifdef DIFFICULTY_SETTING
#include "GameInitOptionsScreen.h"
#endif
#include <vfs/Core/vfs.h>
#include <vfs/Core/vfs_file_raii.h>
#include <vfs/Core/File/vfs_file.h>
@@ -4041,8 +4045,20 @@ void DisplayGameSettings( )
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"%s: %s (%S)", pMessageStrings[ MSG_VERSION ], zVersionLabel, czVersionNumber );
//Display the difficulty level
#ifdef DIFFICULTY_SETTING
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"%s: %s", gzGIOScreenText[ GIO_DIF_LEVEL_TEXT ], zDeffSetting[gGameOptions.ubDifficultyLevel].szDeffName );
#else
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"%s: %s", gzGIOScreenText[ GIO_DIF_LEVEL_TEXT ], gzGIOScreenText[ gGameOptions.ubDifficultyLevel + GIO_EASY_TEXT - 1 ] );
#endif
#ifdef DIFFICULTY_SETTING
//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");
#endif
//Bobby Ray option 1
if ( gGameOptions.ubBobbyRayQuality >= BR_GOOD && gGameOptions.ubBobbyRayQuality < BR_GREAT )
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"%s: %s (%d)", gzGIOScreenText[ GIO_BR_QUALITY_TEXT ], gzGIOScreenText[ GIO_BR_GOOD_TEXT ], BR_GOOD );
+16
View File
@@ -5,6 +5,10 @@
#include "Strategic Status.h"
#include "Morale.h"
#ifdef DIFFICULTY_SETTING
#include "GameInitOptionsScreen.h"
#endif
#define GAME_INI_FILE "Ja2.ini"
@@ -185,6 +189,18 @@ enum
DIF_LEVEL_HARD,
DIF_LEVEL_INSANE,
DIF_LEVEL_FIVE,
#ifdef DIFFICULTY_SETTING
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,
#endif
};
//Enums for the difficulty levels
+19
View File
@@ -1455,6 +1455,25 @@ BackupBRandEncyclopedia ( gBriefingRoomData, gBriefingRoomDataBackup, 0);
LetLuaMusicControl(0);
}
#endif
#ifdef DIFFICULTY_SETTING
strcpy(fileName, directoryName);
strcat(fileName, DIFFICULTYFILENAME);
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName));
SGP_THROW_IFFALSE(ReadInDifficultySettings(fileName,FALSE), DIFFICULTYFILENAME);
#ifndef ENGLISH
AddLanguagePrefix(fileName);
if ( FileExists(fileName) )
{
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName));
SGP_THROW_IFFALSE(ReadInDifficultySettings(fileName,TRUE), fileName);
}
#endif
#endif
LuaState::INIT(lua::LUA_STATE_STRATEGIC_MINES_AND_UNDERGROUND, true);
g_luaUnderground.LoadScript(GetLanguagePrefix());
// load Lua for Strategic Mines initialization
+13
View File
@@ -29,6 +29,10 @@
#include "network.h"
#include "saveloadscreen.h"
#ifdef DIFFICULTY_SETTING
#include "GameInitOptionsScreen.h"
#endif
#include <vfs/Core/vfs.h>
#include <vfs/Core/vfs_init.h>
#include <vfs/Tools/vfs_property_container.h>
@@ -844,7 +848,11 @@ void BtnMPHDifficultySelectionRightCallback( GUI_BUTTON *btn,INT32 reason )
if( reason & MSYS_CALLBACK_REASON_LBUTTON_REPEAT || reason & MSYS_CALLBACK_REASON_LBUTTON_DWN )
{
#ifdef DIFFICULTY_SETTING
if ( iMPHDifficulty < MaxDifficultySettingsValues - 1)
#else
if ( iMPHDifficulty < 3 )
#endif
{
PlayButtonSound( giMPHDifficultyButton[1], BUTTON_SOUND_CLICKED_ON );
@@ -2665,7 +2673,12 @@ BOOLEAN RenderMPHScreen()
// Difficulty
RenderMPHSmallSelectionFrame( (MPH_DIFFICULTY_SETTING_X + 36), (MPH_DIFFICULTY_SETTING_Y - 3) );
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 );
#ifdef DIFFICULTY_SETTING
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 );
#else
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 );
#endif
// ---------------
// ---------------
+14 -1
View File
@@ -75,6 +75,10 @@
#include "Vehicles.h"
#ifdef DIFFICULTY_SETTING
#include "GameInitOptionsScreen.h"
#endif
//forward declarations of common classes to eliminate includes
class OBJECTTYPE;
class SOLDIERTYPE;
@@ -5651,6 +5655,10 @@ void HandleRadioScanInSector( INT16 sMapX, INT16 sMapY, INT8 bZ )
return;
UINT8 normalgroupsize = 0;
#ifdef DIFFICULTY_SETTING
normalgroupsize = zDeffSetting[gGameOptions.ubDifficultyLevel].iMinEnemyGroupSize;
#else
switch( gGameOptions.ubDifficultyLevel )
{
case DIF_LEVEL_EASY:
@@ -5667,6 +5675,7 @@ void HandleRadioScanInSector( INT16 sMapX, INT16 sMapY, INT8 bZ )
normalgroupsize = gGameExternalOptions.ubMinEnemyGroupSizeInsane;
break;
}
#endif
normalgroupsize *= 2;
@@ -5997,6 +6006,10 @@ void HandleGatheringInformationBySoldier( SOLDIERTYPE* pSoldier )
}
UINT16 usNormalGroupSize = 0;
#ifdef DIFFICULTY_SETTING
usNormalGroupSize = zDeffSetting[gGameOptions.ubDifficultyLevel].iMinEnemyGroupSize;
#else
switch( gGameOptions.ubDifficultyLevel )
{
case DIF_LEVEL_EASY:
@@ -6013,7 +6026,7 @@ void HandleGatheringInformationBySoldier( SOLDIERTYPE* pSoldier )
usNormalGroupSize = gGameExternalOptions.ubMinEnemyGroupSizeInsane;
break;
}
#endif
usNormalGroupSize *= 2;
FLOAT fBaseChance = ( EffectiveLeadership(pSoldier) + EffectiveWisdom(pSoldier) + EffectiveExpLevel(pSoldier) * 10 ) / 3000.0f;
+36 -4
View File
@@ -24,6 +24,10 @@
#include "UndergroundInit.h"
#ifdef DIFFICULTY_SETTING
#include "GameInitOptionsScreen.h"
#endif
extern BOOLEAN InitStrategicMovementCosts();
void InitKnowFacilitiesFlags( );
@@ -428,6 +432,9 @@ void BuildUndergroundSectorInfoList()
//J9
curr = NewUndergroundNode( 9, 10, 1 );
#ifdef DIFFICULTY_SETTING
curr->ubNumTroops = zDeffSetting[gGameOptions.ubDifficultyLevel].iJ9B1NumTroops;
#else
switch( gGameOptions.ubDifficultyLevel )
{
case DIF_LEVEL_EASY:
@@ -443,22 +450,47 @@ void BuildUndergroundSectorInfoList()
curr->ubNumTroops = 20;
break;
}
#endif
//J9 feeding zone
curr = NewUndergroundNode( 9, 10, 2 );
#ifdef DIFFICULTY_SETTING
curr->ubNumCreatures = (UINT8)(2 + zDeffSetting[gGameOptions.ubDifficultyLevel].iJ9B2NumCreatures*2 + Random( 2 ));
#else
curr->ubNumCreatures = (UINT8)(2 + gGameOptions.ubDifficultyLevel*2 + Random( 2 ));
#endif
//K4
curr = NewUndergroundNode( 4, 11, 1 );
#ifdef DIFFICULTY_SETTING
curr->ubNumTroops = (UINT8)(6 + zDeffSetting[gGameOptions.ubDifficultyLevel].iK4B1NumTroops*2 + Random( 3 ));
curr->ubNumElites = (UINT8)(4 + zDeffSetting[gGameOptions.ubDifficultyLevel].iK4B1NumElites + Random( 2 ));
#else
curr->ubNumTroops = (UINT8)(6 + gGameOptions.ubDifficultyLevel*2 + Random( 3 ));
curr->ubNumElites = (UINT8)(4 + gGameOptions.ubDifficultyLevel + Random( 2 ));
#endif
//O3
curr = NewUndergroundNode( 3, 15, 1 );
#ifdef DIFFICULTY_SETTING
curr->ubNumTroops = (UINT8)(6 + zDeffSetting[gGameOptions.ubDifficultyLevel].iO3B1NumTroops*2 + Random( 3 ));
curr->ubNumElites = (UINT8)(4 + zDeffSetting[gGameOptions.ubDifficultyLevel].iO3B1NumElites + Random( 2 ));
#else
curr->ubNumTroops = (UINT8)(6 + gGameOptions.ubDifficultyLevel*2 + Random( 3 ));
curr->ubNumElites = (UINT8)(4 + gGameOptions.ubDifficultyLevel + Random( 2 ));
#endif
//P3
curr = NewUndergroundNode( 3, 16, 1 );
#ifdef DIFFICULTY_SETTING
if (gGameOptions.ubDifficultyLevel == DIF_LEVEL_EASY )
curr->ubNumElites = (UINT8)(zDeffSetting[gGameOptions.ubDifficultyLevel].iP3B1NumElites + Random( 3 ));
else if (gGameOptions.ubDifficultyLevel == DIF_LEVEL_MEDIUM )
curr->ubNumElites = (UINT8)(zDeffSetting[gGameOptions.ubDifficultyLevel].iP3B1NumElites + Random( 5 ));
else if (gGameOptions.ubDifficultyLevel == DIF_LEVEL_HARD )
curr->ubNumElites = (UINT8)(zDeffSetting[gGameOptions.ubDifficultyLevel].iP3B1NumElites + Random( 6 ));
else
curr->ubNumElites = zDeffSetting[gGameOptions.ubDifficultyLevel].iP3B1NumElites;
#else
switch( gGameOptions.ubDifficultyLevel )
{
case DIF_LEVEL_EASY:
@@ -474,7 +506,7 @@ void BuildUndergroundSectorInfoList()
curr->ubNumElites = 20;
break;
}
#endif
//Do all of the mandatory underground mine sectors
//Drassen's mine
+33 -1
View File
@@ -36,6 +36,9 @@
#include "Strategic Mines.h"
#include "connect.h"
#ifdef DIFFICULTY_SETTING
#include "GameInitOptionsScreen.h"
#endif
#ifdef JA2BETAVERSION
BOOLEAN gfClearCreatureQuest = FALSE;
@@ -345,6 +348,10 @@ void InitCreatureQuest()
}
#endif
giHabitatedDistance = 0;
#ifdef DIFFICULTY_SETTING
giPopulationModifier = zDeffSetting[gGameOptions.ubDifficultyLevel].iCreaturePopulationModifier;
#else
switch( gGameOptions.ubDifficultyLevel )
{
case DIF_LEVEL_EASY:
@@ -360,7 +367,8 @@ void InitCreatureQuest()
giPopulationModifier = INSANE_POPULATION_MODIFIER;
break;
}
#endif
//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.
@@ -508,6 +516,11 @@ void InitCreatureQuest()
curr->uiFlags |= SF_PENDING_ALTERNATE_MAP;
//Now determine how often we will spread the creatures.
#ifdef DIFFICULTY_SETTING
i = zDeffSetting[gGameOptions.ubDifficultyLevel].iQueenInitBonusSpread;
AddPeriodStrategicEvent( EVENT_CREATURE_SPREAD, zDeffSetting[gGameOptions.ubDifficultyLevel].iCreatureSpreadTime, 0 );
#else
switch( gGameOptions.ubDifficultyLevel )
{
case DIF_LEVEL_EASY:
@@ -527,6 +540,7 @@ void InitCreatureQuest()
AddPeriodStrategicEvent( EVENT_CREATURE_SPREAD, INSANE_SPREAD_TIME_IN_MINUTES, 0 );
break;
}
#endif
//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
@@ -637,6 +651,11 @@ DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"CreatureSpreading1");
case DIF_LEVEL_INSANE: //200%
iAbsoluteMaxPopulation *= 2;
break;
#ifdef DIFFICULTY_SETTING
default:
iAbsoluteMaxPopulation /= 2; //Half
break;
#endif
}
//Calculate the desired max population percentage based purely on current distant to creature range.
@@ -682,6 +701,9 @@ void SpreadCreatures()
}
//queen just produced a litter of creature larvae. Let's do some spreading now.
#ifdef DIFFICULTY_SETTING
usNewCreatures = (UINT16)( zDeffSetting[gGameOptions.ubDifficultyLevel].iQueenReproductionBase + Random( 1 + zDeffSetting[gGameOptions.ubDifficultyLevel].iQueenReproductionBonus ));
#else
switch( gGameOptions.ubDifficultyLevel )
{
case DIF_LEVEL_EASY:
@@ -697,6 +719,7 @@ void SpreadCreatures()
usNewCreatures = (UINT16)(INSANE_QUEEN_REPRODUCTION_BASE + Random( 1 + INSANE_QUEEN_REPRODUCTION_BONUS ));
break;
}
#endif
while( usNewCreatures-- )
{
@@ -1737,6 +1760,14 @@ void CreatureNightPlanning()
ubNumCreatures = CreaturesInUndergroundSector( ubSectorID , 1 );
//10% chance for each creature with difficulty modifier to decide it's time to attack.
#ifdef DIFFICULTY_SETTING
i = zDeffSetting[gGameOptions.ubDifficultyLevel].iCreatureTownAggressiveness;
if( ubNumCreatures > 1 && ubNumCreatures * 10 + i > (INT32)PreRandom( 100 ) )
{
AddStrategicEvent( EVENT_CREATURE_ATTACK, GetWorldTotalMin() + 1 + PreRandom( 429 ), ubSectorID );
}
#else
switch( gGameOptions.ubDifficultyLevel )
{
case DIF_LEVEL_EASY:
@@ -1768,6 +1799,7 @@ void CreatureNightPlanning()
}
break;
}
#endif
//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 );
+12
View File
@@ -84,6 +84,10 @@
#include "Map Screen Interface Bottom.h"
#endif
#ifdef DIFFICULTY_SETTING
#include "GameInitOptionsScreen.h"
#endif
#include "PostalService.h"
extern CPostalService gPostalService;
@@ -558,6 +562,10 @@ BOOLEAN InitNewGame( BOOLEAN fReset )
AutoSaveToSlot[3] = FALSE;
AutoSaveToSlot[4] = FALSE;
#ifdef DIFFICULTY_SETTING
gGameExternalOptions.gfAllowReinforcements = zDeffSetting[gGameOptions.ubDifficultyLevel].bAllowReinforcements;
#endif
#ifdef JA2UB
//Ja25 no meanwhiles
@@ -740,6 +748,9 @@ fFirstTimeInMapScreen = TRUE;
}
// ATE: Set starting cash....
#ifdef DIFFICULTY_SETTING
iStartingCash = zDeffSetting[gGameOptions.ubDifficultyLevel].iStartingCash;
#else
switch( gGameOptions.ubDifficultyLevel )
{
case DIF_LEVEL_EASY:
@@ -770,6 +781,7 @@ fFirstTimeInMapScreen = TRUE;
Assert(0);
return( FALSE );
}
#endif
// Setup initial money
AddTransactionToPlayersBook( ANONYMOUS_DEPOSIT, 0, GetWorldTotalMin(), iStartingCash );
+46
View File
@@ -45,6 +45,10 @@
#include "Music Control.h"
#include "NPC.h"
#ifdef DIFFICULTY_SETTING
#include "GameInitOptionsScreen.h"
#endif
#ifdef JA2UB
#include "Ja25 Strategic Ai.h"
#include "Ja25_Tactical.h"
@@ -81,6 +85,8 @@ extern INT8 Test;
static int l_HireMerc (lua_State *L);
static int l_SetStartingCashDifLevel (lua_State *L);
//Briefing room
static int l_SetEndMission(lua_State *L);
static int l_SetStartMission(lua_State *L);
@@ -932,6 +938,8 @@ void IniFunction(lua_State *L, BOOLEAN bQuests )
{
lua_register(L, "HireMerc", l_HireMerc);
lua_register(L, "SetStartingCashDifLevel", l_SetStartingCashDifLevel);
lua_register(L, "SetLaptopBroken", l_SetLaptopBroken);
//------Briefing Room------
@@ -12951,3 +12959,41 @@ BOOLEAN LoadLuaGlobalFromLoadGameFile( HWFILE hFile )
return( TRUE );
}
//--------------------------------------------------------------
static int l_SetStartingCashDifLevel (lua_State *L)
{
if ( lua_gettop(L) >= 1 )
{
INT32 DifficultyLevel = lua_tointeger(L,1);
INT32 iStartingCash = 0;
#ifdef DIFFICULTY_SETTING
AddTransactionToPlayersBook( ANONYMOUS_DEPOSIT, 0, GetWorldTotalMin(), zDeffSetting[DifficultyLevel].iStartingCash );
#else
switch( DifficultyLevel )
{
case DIF_LEVEL_EASY:
iStartingCash = gGameExternalOptions.iStartingCashNovice;
break;
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 );
#endif
}
return 0;
}
+9
View File
@@ -38,6 +38,10 @@
#include "Random.h"
#endif
#ifdef DIFFICULTY_SETTING
#include "GameInitOptionsScreen.h"
#endif
#define MAX_MEANWHILE_PROFILES 10
INT8 gzMeanwhileStr[][30] =
@@ -697,7 +701,12 @@ void ProcessImplicationsOfMeanwhile( void )
switch( gCurrentMeanwhileDef.ubMeanwhileID )
{
case END_OF_PLAYERS_FIRST_BATTLE:
#ifdef DIFFICULTY_SETTING
if( zDeffSetting[gGameOptions.ubDifficultyLevel].bStrategicAiActionWakeQueen == TRUE )
#else
if( gGameOptions.ubDifficultyLevel >= DIF_LEVEL_HARD )
#endif
{ //Wake up the queen earlier to punish the good players!
ExecuteStrategicAIAction( STRATEGIC_AI_ACTION_WAKE_QUEEN, 0, 0 );
}
+9
View File
@@ -32,6 +32,10 @@
#include "postalservice.h"
#ifdef DIFFICULTY_SETTING
#include "GameInitOptionsScreen.h"
#endif
extern BOOLEAN fMapScreenBottomDirty;
extern CPostalService gPostalService;
@@ -326,7 +330,11 @@ BOOLEAN SetThisSectorAsPlayerControlled( INT16 sMapX, INT16 sMapY, INT8 bMapZ, B
if ( !SectorInfo[ SECTOR( sMapX, sMapY ) ].fSurfaceWasEverPlayerControlled )
{
// grant grace period
#ifdef DIFFICULTY_SETTING
UpdateLastDayOfPlayerActivity( ( UINT16 ) ( GetWorldDay() + zDeffSetting[gGameOptions.ubDifficultyLevel].iUpdateLastDayOfPlayerActivity ) );
#else
if ( gGameOptions.ubDifficultyLevel >= DIF_LEVEL_HARD )
{
UpdateLastDayOfPlayerActivity( ( UINT16 ) ( GetWorldDay() + 2 ) );
}
@@ -334,6 +342,7 @@ BOOLEAN SetThisSectorAsPlayerControlled( INT16 sMapX, INT16 sMapY, INT8 bMapZ, B
{
UpdateLastDayOfPlayerActivity( ( UINT16 ) ( GetWorldDay() + 1 ) );
}
#endif
}
}
+9
View File
@@ -54,6 +54,10 @@
#include "ub_config.h"
#endif
#ifdef DIFFICULTY_SETTING
#include "GameInitOptionsScreen.h"
#endif
extern void InitializeTacticalStatusAtBattleStart();
extern BOOLEAN gfDelayAutoResolveStart;
extern BOOLEAN gfTransitionMapscreenToAutoResolve;
@@ -652,6 +656,10 @@ void InitPreBattleInterface( GROUP *pBattleGroup, BOOLEAN fPersistantPBI )
iChance -= (2 * ((ubNumMobileEnemies + ubNumStationaryEnemies) - 6)); // -2% adjustment per enemy beyond 6
// adjust the chance for difficulty setting
#ifdef DIFFICULTY_SETTING
iChance = iChance + (zDeffSetting[gGameOptions.ubDifficultyLevel].iChanceOfEnemyAmbushes);
#else
if( gGameOptions.ubDifficultyLevel == DIF_LEVEL_EASY )
iChance -= 15;
else if( gGameOptions.ubDifficultyLevel == DIF_LEVEL_MEDIUM )
@@ -660,6 +668,7 @@ void InitPreBattleInterface( GROUP *pBattleGroup, BOOLEAN fPersistantPBI )
iChance += 12;
else if( gGameOptions.ubDifficultyLevel == DIF_LEVEL_INSANE )
iChance += 25;
#endif
// adjust the chance for what we know about the sector
if( WhatPlayerKnowsAboutEnemiesInSector( gubPBSectorX, gubPBSectorY ) == KNOWS_NOTHING )
+8
View File
@@ -64,6 +64,10 @@
#include "Arms Dealer Init.h"
#endif
#ifdef DIFFICULTY_SETTING
#include "GameInitOptionsScreen.h"
#endif
#include <vector>
//The sector information required for the strategic AI. Contains the number of enemy troops,
@@ -569,7 +573,11 @@ BOOLEAN PrepareEnemyForSectorBattle()
// Reinforcement groups? Bring it on!
if( gGameExternalOptions.gfAllowReinforcements &&
#ifdef DIFFICULTY_SETTING
!( (GetTownIdForSector( gWorldSectorX, gWorldSectorY ) == OMERTA ) ) )
#else
!( (GetTownIdForSector( gWorldSectorX, gWorldSectorY ) == OMERTA )&&( gGameOptions.ubDifficultyLevel != DIF_LEVEL_INSANE ) ) )
#endif
{
UINT16 pusMoveDir[4][3];
UINT8 ubDirNumber = 0;
+10 -1
View File
@@ -24,6 +24,10 @@
#include "Inventory Choosing.h"
#endif
#ifdef DIFFICULTY_SETTING
#include "GameInitOptionsScreen.h"
#endif
#include "connect.h"
#include "Reinforcement.h"
#include "MilitiaSquads.h"
@@ -49,9 +53,14 @@ void GetNumberOfEnemiesInFiveSectors( INT16 sSectorX, INT16 sSectorY, UINT8 *pub
if( !gGameExternalOptions.gfAllowReinforcements )
return;
#ifdef DIFFICULTY_SETTING
if ( ( GetTownIdForSector( sSectorX, sSectorY ) == OMERTA )&&( zDeffSetting[gGameOptions.ubDifficultyLevel].bAllowReinforcementsOmerta == FALSE ) ) //Madd: skip Omerta //Lal: but not on insane ;-)
return;
#else
if ( ( GetTownIdForSector( sSectorX, sSectorY ) == OMERTA )&&( gGameOptions.ubDifficultyLevel != DIF_LEVEL_INSANE ) ) //Madd: skip Omerta //Lal: but not on insane ;-)
return;
#endif
GenerateDirectionInfos( sSectorX, sSectorY, &ubDirNumber, pusMoveDir, FALSE, TRUE );
for( ubIndex = 0; ubIndex < ubDirNumber; ubIndex++ )
+425 -13
View File
@@ -37,6 +37,10 @@
#include "interface dialogue.h"
#endif
#ifdef DIFFICULTY_SETTING
#include "GameInitOptionsScreen.h"
#endif
#define SAI_VERSION 29
/*
@@ -547,6 +551,10 @@ void Ensure_RepairedGarrisonGroup( GARRISON_GROUP **ppGarrison, INT32 *pGarraySi
//returns the number of reinforcements permitted to be sent. Will increased if the denied counter is non-zero.
INT32 GarrisonReinforcementsRequested( INT32 iGarrisonID, UINT8 *pubExtraReinforcements )
{
#ifdef DIFFICULTY_SETTING
INT32 iExtraReinforcements;
#endif
INT32 iReinforcementsRequested;
INT32 iExistingForces;
SECTORINFO *pSector;
@@ -561,7 +569,25 @@ INT32 GarrisonReinforcementsRequested( INT32 iGarrisonID, UINT8 *pubExtraReinfor
//Record how many of the reinforcements are additionally provided due to being denied in the past. This will grow
//until it is finally excepted or an absolute max is made.
#ifdef DIFFICULTY_SETTING
if( gGameOptions.ubDifficultyLevel == DIF_LEVEL_EASY )
iExtraReinforcements = 1;
else if( gGameOptions.ubDifficultyLevel == DIF_LEVEL_MEDIUM )
iExtraReinforcements = 2;
else if( gGameOptions.ubDifficultyLevel == DIF_LEVEL_HARD )
iExtraReinforcements = 3;
else if( gGameOptions.ubDifficultyLevel == DIF_LEVEL_INSANE )
iExtraReinforcements = 4;
else
{
iExtraReinforcements = Random (4);
if (iExtraReinforcements == 0) iExtraReinforcements = 1;
}
*pubExtraReinforcements = (UINT8)(gubGarrisonReinforcementsDenied[ iGarrisonID ] / (6 - iExtraReinforcements));
#else
*pubExtraReinforcements = (UINT8)(gubGarrisonReinforcementsDenied[ iGarrisonID ] / (6 - gGameOptions.ubDifficultyLevel));
#endif
//Make sure the number of extra reinforcements don't bump the force size past the max of MAX_STRATEGIC_TEAM_SIZE.
*pubExtraReinforcements = (UINT16)min( (INT32)*pubExtraReinforcements, min( (INT32)(*pubExtraReinforcements), iMaxEnemyGroupSize - iReinforcementsRequested ) );
@@ -1164,6 +1190,19 @@ void InitStrategicAI()
dEnemyGeneralsSpeedupFactor = max( 0.5f, dEnemyGeneralsSpeedupFactor - gStrategicStatus.usVIPsLeft * gGameExternalOptions.fEnemyGeneralStrategicDecisionSpeedBonus );
}
#ifdef DIFFICULTY_SETTING
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 );
#else
switch( gGameOptions.ubDifficultyLevel )
{
case DIF_LEVEL_EASY:
@@ -1212,6 +1251,7 @@ void InitStrategicAI()
AddStrategicEvent( EVENT_EVALUATE_QUEEN_SITUATION, 475 + dEnemyGeneralsSpeedupFactor * (gGameExternalOptions.ubInsaneTimeEvaluateInMinutes + Random( gGameExternalOptions.ubInsaneTimeEvaluateVariance )), 0);
break;
}
#endif
//Initialize the sectorinfo structure so all sectors don't point to a garrisonID.
for( i = 0; i <= 255; i++ )
@@ -1224,6 +1264,34 @@ void InitStrategicAI()
memcpy( gArmyComp, gOrigArmyComp, sizeof( gArmyComp ) );
//Eliminate more perimeter defenses on the easier levels.
#ifdef DIFFICULTY_SETTING
if (zDeffSetting[gGameOptions.ubDifficultyLevel].iDesiredPopulationL2 == FALSE)
{
gArmyComp[ LEVEL2_DEFENCE ].bDesiredPopulation = 0;
gArmyComp[ LEVEL2_DEFENCE ].bStartPopulation = 0;
}
if (zDeffSetting[gGameOptions.ubDifficultyLevel].iDesiredPopulationL3 == FALSE)
{
gArmyComp[ LEVEL3_DEFENCE ].bDesiredPopulation = 0;
gArmyComp[ LEVEL3_DEFENCE ].bStartPopulation = 0;
}
if (zDeffSetting[gGameOptions.ubDifficultyLevel].iDesiredPopulationL3 == FALSE && zDeffSetting[gGameOptions.ubDifficultyLevel].iDesiredPopulationL3 == FALSE)
{
for( i = 0; i < NUM_ARMY_COMPOSITIONS; i++ )
{
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;
}
}
}
#else
switch( gGameOptions.ubDifficultyLevel )
{
case DIF_LEVEL_EASY:
@@ -1286,7 +1354,7 @@ void InitStrategicAI()
}
break;
}
#endif
//initialize the patrol group definitions
giPatrolArraySize = iOrigPatrolArraySize;
if( gPatrolGroup )
@@ -1461,7 +1529,26 @@ void InitStrategicAI()
//Now post an event which allows them to check adjacent sectors periodically.
//Spread them out so that they process at different times.
#ifdef DIFFICULTY_SETTING
UINT32 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;
}
AddPeriodStrategicEventWithOffset( EVENT_CHECK_ENEMY_CONTROLLED_SECTOR, 140 - 20 * val + Random( 4 ), 475 + i, gGarrisonGroup[ i ].ubSectorID );
#else
AddPeriodStrategicEventWithOffset( EVENT_CHECK_ENEMY_CONTROLLED_SECTOR, 140 - 20 * gGameOptions.ubDifficultyLevel + Random( 4 ), 475 + i, gGarrisonGroup[ i ].ubSectorID );
#endif
}
//Now, initialize each of the patrol groups
@@ -1477,7 +1564,27 @@ void InitStrategicAI()
if( ubNumTroops && gGameExternalOptions.fArmyUsesTanksInPatrols )
{
#ifdef DIFFICULTY_SETTING
UINT32 val2;
if( gGameOptions.ubDifficultyLevel == DIF_LEVEL_EASY )
val2 = 1;
else if( gGameOptions.ubDifficultyLevel == DIF_LEVEL_MEDIUM )
val2 = 2;
else if( gGameOptions.ubDifficultyLevel == DIF_LEVEL_HARD )
val2 = 3;
else if( gGameOptions.ubDifficultyLevel == DIF_LEVEL_INSANE )
val2 = 4;
else
{
val2 = Random( 4 );
if (val2 == 0) val2 = 1;
}
if( Random( 10 ) < val2 && i != 3 && i != 4)
#else
if( Random( 10 ) < gGameOptions.ubDifficultyLevel && i != 3 && i != 4)
#endif
{
ubNumTroops--;
ubNumTanks++;
@@ -1554,7 +1661,11 @@ void InitStrategicAI()
{
pSector = &SectorInfo[ SECTOR( gModSettings.ubWeaponCache1X, gModSettings.ubWeaponCache1Y ) ]; //SEC_E11
pSector->uiFlags |= SF_USE_ALTERNATE_MAP;
#ifdef DIFFICULTY_SETTING
pSector->ubNumTroops = (UINT8)(6 + zDeffSetting[gGameOptions.ubDifficultyLevel].iWeaponCacheTroops1 * 2);
#else
pSector->ubNumTroops = (UINT8)(6 + gGameOptions.ubDifficultyLevel * 2);
#endif
if (ubPicked[0] == 0)
ubPicked[0] = ubSector;
else if (ubPicked[1] == 0)
@@ -1572,7 +1683,11 @@ void InitStrategicAI()
{
pSector = &SectorInfo[ SECTOR( gModSettings.ubWeaponCache2X, gModSettings.ubWeaponCache2Y ) ]; //SEC_H5
pSector->uiFlags |= SF_USE_ALTERNATE_MAP;
#ifdef DIFFICULTY_SETTING
pSector->ubNumTroops = (UINT8)(6 + zDeffSetting[gGameOptions.ubDifficultyLevel].iWeaponCacheTroops2 * 2);
#else
pSector->ubNumTroops = (UINT8)(6 + gGameOptions.ubDifficultyLevel * 2);
#endif
if (ubPicked[0] == 0)
ubPicked[0] = ubSector;
else if (ubPicked[1] == 0)
@@ -1590,7 +1705,11 @@ void InitStrategicAI()
{
pSector = &SectorInfo[ SECTOR( gModSettings.ubWeaponCache3X, gModSettings.ubWeaponCache3Y ) ]; //SEC_H10
pSector->uiFlags |= SF_USE_ALTERNATE_MAP;
#ifdef DIFFICULTY_SETTING
pSector->ubNumTroops = (UINT8)(6 + zDeffSetting[gGameOptions.ubDifficultyLevel].iWeaponCacheTroops3 * 2);
#else
pSector->ubNumTroops = (UINT8)(6 + gGameOptions.ubDifficultyLevel * 2);
#endif
if (ubPicked[0] == 0)
ubPicked[0] = ubSector;
else if (ubPicked[1] == 0)
@@ -1608,7 +1727,11 @@ void InitStrategicAI()
{
pSector = &SectorInfo[ SECTOR( gModSettings.ubWeaponCache4X, gModSettings.ubWeaponCache4Y ) ]; //SEC_J12
pSector->uiFlags |= SF_USE_ALTERNATE_MAP;
#ifdef DIFFICULTY_SETTING
pSector->ubNumTroops = (UINT8)(6 + zDeffSetting[gGameOptions.ubDifficultyLevel].iWeaponCacheTroops4 * 2);
#else
pSector->ubNumTroops = (UINT8)(6 + gGameOptions.ubDifficultyLevel * 2);
#endif
if (ubPicked[0] == 0)
ubPicked[0] = ubSector;
else if (ubPicked[1] == 0)
@@ -1626,7 +1749,11 @@ void InitStrategicAI()
{
pSector = &SectorInfo[ SECTOR( gModSettings.ubWeaponCache5X, gModSettings.ubWeaponCache5Y ) ]; //SEC_M9
pSector->uiFlags |= SF_USE_ALTERNATE_MAP;
#ifdef DIFFICULTY_SETTING
pSector->ubNumTroops = (UINT8)(6 + zDeffSetting[gGameOptions.ubDifficultyLevel].iWeaponCacheTroops5 * 2);
#else
pSector->ubNumTroops = (UINT8)(6 + gGameOptions.ubDifficultyLevel * 2);
#endif
if (ubPicked[0] == 0)
ubPicked[0] = ubSector;
else if (ubPicked[1] == 0)
@@ -1648,6 +1775,28 @@ void InitStrategicAI()
}
else
{
#ifdef DIFFICULTY_SETTING
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 = &SectorInfo[ SECTOR( gModSettings.ubWeaponCache2X, gModSettings.ubWeaponCache2Y ) ]; //SEC_H5
pSector->uiFlags |= SF_USE_ALTERNATE_MAP;
pSector->ubNumTroops = (UINT8)(6 + zDeffSetting[gGameOptions.ubDifficultyLevel].iWeaponCacheTroops2 * 2);
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 = &SectorInfo[ SECTOR( gModSettings.ubWeaponCache4X, gModSettings.ubWeaponCache4Y ) ]; //SEC_J12
pSector->uiFlags |= SF_USE_ALTERNATE_MAP;
pSector->ubNumTroops = (UINT8)(6 + zDeffSetting[gGameOptions.ubDifficultyLevel].iWeaponCacheTroops4 * 2);
pSector = &SectorInfo[ SECTOR( gModSettings.ubWeaponCache5X, gModSettings.ubWeaponCache5Y ) ]; //SEC_M9
pSector->uiFlags |= SF_USE_ALTERNATE_MAP;
pSector->ubNumTroops = (UINT8)(6 + zDeffSetting[gGameOptions.ubDifficultyLevel].iWeaponCacheTroops5 * 2);
#else
pSector = &SectorInfo[ SECTOR( gModSettings.ubWeaponCache1X, gModSettings.ubWeaponCache1Y ) ]; //SEC_E11
pSector->uiFlags |= SF_USE_ALTERNATE_MAP;
pSector->ubNumTroops = (UINT8)(6 + gGameOptions.ubDifficultyLevel * 2);
@@ -1667,6 +1816,7 @@ void InitStrategicAI()
pSector = &SectorInfo[ SECTOR( gModSettings.ubWeaponCache5X, gModSettings.ubWeaponCache5Y ) ]; //SEC_M9
pSector->uiFlags |= SF_USE_ALTERNATE_MAP;
pSector->ubNumTroops = (UINT8)(6 + gGameOptions.ubDifficultyLevel * 2);
#endif
}
ValidateWeights( 1 );
@@ -3302,7 +3452,9 @@ void EvaluateQueenSituation()
{
dEnemyGeneralsSpeedupFactor = max( 0.5f, dEnemyGeneralsSpeedupFactor - gStrategicStatus.usVIPsLeft * gGameExternalOptions.fEnemyGeneralStrategicDecisionSpeedBonus );
}
#ifdef DIFFICULTY_SETTING
uiOffset += dEnemyGeneralsSpeedupFactor * (zDeffSetting[gGameOptions.ubDifficultyLevel].iBaseDelayInMinutesBetweenEvaluations + Random( zDeffSetting[gGameOptions.ubDifficultyLevel].iEvaluationDelayVariance ));
#else
switch( gGameOptions.ubDifficultyLevel )
{
case DIF_LEVEL_EASY:
@@ -3318,12 +3470,19 @@ void EvaluateQueenSituation()
uiOffset += dEnemyGeneralsSpeedupFactor * (gGameExternalOptions.ubInsaneTimeEvaluateInMinutes + Random( gGameExternalOptions.ubInsaneTimeEvaluateVariance ));
break;
}
#endif
if( !giReinforcementPool )
{ //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
#ifdef DIFFICULTY_SETTING
giReinforcementPool += ( zDeffSetting[gGameOptions.ubDifficultyLevel].iQueenPoolIncrementPerDifficultyLevel * gGameOptions.ubDifficultyLevel ) * ( 100 + CurrentPlayerProgressPercentage() ) / 100 ;
#else
giReinforcementPool += ( gGameExternalOptions.guiBaseQueenPoolIncrement * gGameOptions.ubDifficultyLevel ) * ( 100 + CurrentPlayerProgressPercentage() ) / 100 ;
#endif
AddStrategicEvent( EVENT_EVALUATE_QUEEN_SITUATION, GetWorldTotalMin() + uiOffset, 0 );
return;
}
@@ -3581,6 +3740,10 @@ BOOLEAN LoadStrategicAI( HWFILE hFile )
UINT8 ubSAIVersion;
INT32 iMaxEnemyGroupSize = gGameExternalOptions.iMaxEnemyGroupSize;
#ifdef DIFFICULTY_SETTING
gfUnlimitedTroops = zDeffSetting[gGameOptions.ubDifficultyLevel].bUnlimitedPoolOfTroops;
gfAggressiveQueen = zDeffSetting[gGameOptions.ubDifficultyLevel].bAggressiveQueenAi;
#else
switch( gGameOptions.ubDifficultyLevel )
{
case DIF_LEVEL_EASY:
@@ -3600,6 +3763,7 @@ BOOLEAN LoadStrategicAI( HWFILE hFile )
gfAggressiveQueen = gGameExternalOptions.gfInsaneAggressiveQueen;
break;
}
#endif
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"Strategic6");
FileRead( hFile, gbPadding2, 3, &uiNumBytesRead );
@@ -3934,6 +4098,12 @@ BOOLEAN LoadStrategicAI( HWFILE hFile )
SectorInfo[ SEC_N5 ].bBloodCatPlacements = 12;
SectorInfo[ SEC_N5 ].bBloodCats = 15;
break;
#ifdef DIFFICULTY_SETTING
default:
SectorInfo[ SEC_N5 ].bBloodCatPlacements = 8;
SectorInfo[ SEC_N5 ].bBloodCats = 10;
break;
#endif
}
}
if( ubSAIVersion < 23 )
@@ -4237,8 +4407,27 @@ DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"Strategic7");
//if gfExtraElites is set, then augment the composition sizes
if( gfExtraElites && iFactor >= 15 && gArmyComp[ i ].bElitePercentage )
{
#ifdef DIFFICULTY_SETTING
INT32 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;
}
iChange = val * 5;
#else
iChange = gGameOptions.ubDifficultyLevel * 5;
#endif
//increase elite % (max 100)
iNew = gArmyComp[ i ].bElitePercentage + iChange;
iNew = (INT8)min( 100, iNew );
@@ -4418,8 +4607,26 @@ void ExecuteStrategicAIAction( UINT16 usActionCode, INT16 sSectorX, INT16 sSecto
ubSourceSectorID = SECTOR( gModSettings.ubSAISpawnSectorX, gModSettings.ubSAISpawnSectorY );
}
#ifdef DIFFICULTY_SETTING
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);
#else
ubNumSoldiers = (UINT8)( gubMinEnemyGroupSize + gGameOptions.ubDifficultyLevel * 3);
#endif
// anv: replace one of soldiers with tank
for( UINT8 ubCounter = 0; ubCounter < 4; ubCounter++ )
{
@@ -4427,19 +4634,28 @@ void ExecuteStrategicAIAction( UINT16 usActionCode, INT16 sSectorX, INT16 sSecto
grouptanks[ubCounter] = 0;
if( ubNumSoldiers && gGameExternalOptions.fArmyUsesTanksInAttacks )
{
#ifdef DIFFICULTY_SETTING
if( Random(10) < val )
#else
if( Random(10) < gGameOptions.ubDifficultyLevel )
#endif
{
grouptroops[ubCounter]--;
grouptanks[ubCounter]++;
}
}
}
#ifdef DIFFICULTY_SETTING
pGroup0 = CreateNewEnemyGroupDepartingFromSector( ubSourceSectorID, 0, grouptroops[0], grouptroops[0] - grouptroops[0] / val, grouptanks[0] );
pGroup1 = CreateNewEnemyGroupDepartingFromSector( ubSourceSectorID, 0, grouptroops[1], grouptroops[1] - grouptroops[1] / val, grouptanks[1] );
pGroup2 = CreateNewEnemyGroupDepartingFromSector( ubSourceSectorID, 0, grouptroops[2], grouptroops[2] - grouptroops[2] / val, grouptanks[2] );
pGroup3 = CreateNewEnemyGroupDepartingFromSector( ubSourceSectorID, 0, grouptroops[3], grouptroops[3] - grouptroops[3] / val, grouptanks[3] );
#else
pGroup0 = CreateNewEnemyGroupDepartingFromSector( ubSourceSectorID, 0, grouptroops[0], grouptroops[0] - grouptroops[0] / gGameOptions.ubDifficultyLevel, grouptanks[0] );
pGroup1 = CreateNewEnemyGroupDepartingFromSector( ubSourceSectorID, 0, grouptroops[1], grouptroops[1] - grouptroops[1] / gGameOptions.ubDifficultyLevel, grouptanks[1] );
pGroup2 = CreateNewEnemyGroupDepartingFromSector( ubSourceSectorID, 0, grouptroops[2], grouptroops[2] - grouptroops[2] / gGameOptions.ubDifficultyLevel, grouptanks[2] );
pGroup3 = CreateNewEnemyGroupDepartingFromSector( ubSourceSectorID, 0, grouptroops[3], grouptroops[3] - grouptroops[3] / gGameOptions.ubDifficultyLevel, grouptanks[3] );
#endif
if( !gGarrisonGroup[ SectorInfo[ ubTargetSectorID ].ubGarrisonID ].ubPendingGroupID )
{
pGroup0->pEnemyGroup->ubIntention = STAGE;
@@ -4483,8 +4699,27 @@ void ExecuteStrategicAIAction( UINT16 usActionCode, INT16 sSectorX, INT16 sSecto
break;
}
#ifdef DIFFICULTY_SETTING
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);
#else
ubNumSoldiers = (UINT8)( gubMinEnemyGroupSize + gGameOptions.ubDifficultyLevel * 3);
#endif
// anv: replace one of soldiers with tank
for( UINT8 ubCounter = 0; ubCounter < 4; ubCounter++ )
{
@@ -4492,15 +4727,24 @@ void ExecuteStrategicAIAction( UINT16 usActionCode, INT16 sSectorX, INT16 sSecto
grouptanks[ubCounter] = 0;
if( ubNumSoldiers && gGameExternalOptions.fArmyUsesTanksInAttacks )
{
#ifdef DIFFICULTY_SETTING
if( Random(10) < gGameOptions.ubDifficultyLevel )
#else
if( Random(10) < value )
#endif
{
grouptroops[ubCounter]--;
grouptanks[ubCounter]++;
}
}
groupelites[ubCounter] = 0;
#ifdef DIFFICULTY_SETTING
if ( value > 0 )
groupelites[ubCounter] = grouptroops[ubCounter] - grouptroops[ubCounter] / value;
#else
if ( gGameOptions.ubDifficultyLevel > 0 )
groupelites[ubCounter] = grouptroops[ubCounter] - grouptroops[ubCounter] / gGameOptions.ubDifficultyLevel;
#endif
}
//UINT32 totalusedsoldiers = 4 * min(grouptroops + groupelites + ubNumTanks, (UINT32)gGameExternalOptions.iMaxEnemyGroupSize);
@@ -4678,9 +4922,26 @@ void ExecuteStrategicAIAction( UINT16 usActionCode, INT16 sSectorX, INT16 sSecto
BOOLEAN fAttack_Alma = !(SectorInfo[ SEC_I13 ].ubNumTroops > 0);
BOOLEAN fAttack_Balime = !(SectorInfo[ SEC_L11 ].ubNumTroops > 0);
BOOLEAN fAttack_Chitzena = !(SectorInfo[ SEC_L11 ].ubNumTroops > 0);
ubNumSoldiers = (UINT8)( gubMinEnemyGroupSize + gGameOptions.ubDifficultyLevel * 3);
#ifdef DIFFICULTY_SETTING
UINT8 value2;
if( gGameOptions.ubDifficultyLevel == DIF_LEVEL_EASY )
value2 = 1;
else if( gGameOptions.ubDifficultyLevel == DIF_LEVEL_MEDIUM )
value2 = 2;
else if( gGameOptions.ubDifficultyLevel == DIF_LEVEL_HARD )
value2 = 3;
else if( gGameOptions.ubDifficultyLevel == DIF_LEVEL_INSANE )
value2 = 4;
else
{
value2 = Random (4);
if (value2 == 0) value2 = 1;
}
ubNumSoldiers = (UINT8)( gubMinEnemyGroupSize + value2 * 3);
#else
ubNumSoldiers = (UINT8)( gubMinEnemyGroupSize + gGameOptions.ubDifficultyLevel * 3);
#endif
// anv: replace one of soldiers with tank
if( ubNumSoldiers && gGameExternalOptions.fArmyUsesTanksInAttacks )
{
@@ -4690,9 +4951,16 @@ void ExecuteStrategicAIAction( UINT16 usActionCode, INT16 sSectorX, INT16 sSecto
UINT32 grouptroops = ubNumSoldiers;
UINT32 groupelites = 0;
#ifdef DIFFICULTY_SETTING
if ( value2 > 0 )
#else
if ( gGameOptions.ubDifficultyLevel > 0 )
#endif
#ifdef DIFFICULTY_SETTING
groupelites = ubNumSoldiers - ubNumSoldiers / value2;
#else
groupelites = ubNumSoldiers - ubNumSoldiers / gGameOptions.ubDifficultyLevel;
#endif
UINT32 totalusedsoldiers = 0;
if ( fAttack_Grumm )
@@ -4927,12 +5195,34 @@ void ExecuteStrategicAIAction( UINT16 usActionCode, INT16 sSectorX, INT16 sSecto
//those troops will get reassigned.
ubSectorID = (UINT8)STRATEGIC_INDEX_TO_SECTOR_INFO( sWorldSectorLocationOfFirstBattle );
pSector = &SectorInfo[ ubSectorID ];
ubNumSoldiers = (UINT8)( gubMinEnemyGroupSize + gGameOptions.ubDifficultyLevel * 4);
#ifdef DIFFICULTY_SETTING
UINT8 value4;
if( gGameOptions.ubDifficultyLevel == DIF_LEVEL_EASY )
value4 = 1;
else if( gGameOptions.ubDifficultyLevel == DIF_LEVEL_MEDIUM )
value4 = 2;
else if( gGameOptions.ubDifficultyLevel == DIF_LEVEL_HARD )
value4 = 3;
else if( gGameOptions.ubDifficultyLevel == DIF_LEVEL_INSANE )
value4 = 4;
else
{
value4 = Random (4);
if (value4 == 0) value4 = 1;
}
ubNumSoldiers = (UINT8)( gubMinEnemyGroupSize + value4 * 4);
#else
ubNumSoldiers = (UINT8)( gubMinEnemyGroupSize + gGameOptions.ubDifficultyLevel * 4);
#endif
// anv: replace one of soldiers with tank
if( ubNumSoldiers && gGameExternalOptions.fArmyUsesTanksInAttacks )
{
#ifdef DIFFICULTY_SETTING
if( Random( 10 ) < value4 )
#else
if( Random( 10 ) < gGameOptions.ubDifficultyLevel )
#endif
{
ubNumSoldiers--;
ubNumTanks++;
@@ -4984,12 +5274,35 @@ void ExecuteStrategicAIAction( UINT16 usActionCode, INT16 sSectorX, INT16 sSecto
Assert(direness >= 0 && direness <= 100);
unsigned intention = (unsigned) option2;
Assert(intention < NUM_ENEMY_INTENTIONS);
#ifdef DIFFICULTY_SETTING
UINT8 value5;
if( gGameOptions.ubDifficultyLevel == DIF_LEVEL_EASY )
value5 = 1;
else if( gGameOptions.ubDifficultyLevel == DIF_LEVEL_MEDIUM )
value5 = 2;
else if( gGameOptions.ubDifficultyLevel == DIF_LEVEL_HARD )
value5 = 3;
else if( gGameOptions.ubDifficultyLevel == DIF_LEVEL_INSANE )
value5 = 4;
else
{
value5 = Random (4);
if (value5 == 0) value5 = 1;
}
ubNumSoldiers = ( gubMinEnemyGroupSize +
value5 * 3 +
Random(HighestPlayerProgressPercentage() / 5) +
Random(option1 / 5)
);
#else
ubNumSoldiers = ( gubMinEnemyGroupSize +
gGameOptions.ubDifficultyLevel * 3 +
Random(HighestPlayerProgressPercentage() / 5) +
Random(option1 / 5)
);
#endif
if ( !gfUnlimitedTroops )
giReinforcementPool -= ubNumSoldiers;
@@ -5036,7 +5349,12 @@ void ExecuteStrategicAIAction( UINT16 usActionCode, INT16 sSectorX, INT16 sSecto
// anv: replace one of soldiers with tank
if( ubNumSoldiers && gGameExternalOptions.fArmyUsesTanksInAttacks )
{
#ifdef DIFFICULTY_SETTING
if( Random( 10 * 100 ) < value5 * direness )
#else
if( Random( 10 * 100 ) < gGameOptions.ubDifficultyLevel * direness )
#endif
{
elitesThisSquad--;
tanksThisSquad++;
@@ -5127,7 +5445,26 @@ void ExecuteStrategicAIAction( UINT16 usActionCode, INT16 sSectorX, INT16 sSecto
break;
case NPC_ACTION_SEND_SOLDIERS_TO_OMERTA:
#ifdef DIFFICULTY_SETTING
UINT8 value6;
if( gGameOptions.ubDifficultyLevel == DIF_LEVEL_EASY )
value6 = 1;
else if( gGameOptions.ubDifficultyLevel == DIF_LEVEL_MEDIUM )
value6 = 2;
else if( gGameOptions.ubDifficultyLevel == DIF_LEVEL_HARD )
value6 = 3;
else if( gGameOptions.ubDifficultyLevel == DIF_LEVEL_INSANE )
value6 = 4;
else
{
value6 = Random (4);
if (value6 == 0) value6 = 1;
}
ubNumSoldiers = (UINT8)( gubMinEnemyGroupSize + value6 * 6); //6, 12, or 18 based on difficulty.
#else
ubNumSoldiers = (UINT8)( gubMinEnemyGroupSize + gGameOptions.ubDifficultyLevel * 6); //6, 12, or 18 based on difficulty.
#endif
pGroup = CreateNewEnemyGroupDepartingFromSector( SECTOR( gModSettings.ubSAISpawnSectorX, gModSettings.ubSAISpawnSectorY ), 0, ubNumSoldiers, (UINT8)(ubNumSoldiers/7), 0 ); //add 1 elite to normal, and 2 for hard
ubNumSoldiers = (UINT8)(ubNumSoldiers + ubNumSoldiers / 7);
@@ -5152,8 +5489,25 @@ void ExecuteStrategicAIAction( UINT16 usActionCode, INT16 sSectorX, INT16 sSecto
case NPC_ACTION_SEND_TROOPS_TO_SAM:
ubSectorID = (UINT8)SECTOR( sSectorX, sSectorY );
#ifdef DIFFICULTY_SETTING
UINT8 value7;
if( gGameOptions.ubDifficultyLevel == DIF_LEVEL_EASY )
value7 = 1;
else if( gGameOptions.ubDifficultyLevel == DIF_LEVEL_MEDIUM )
value7 = 2;
else if( gGameOptions.ubDifficultyLevel == DIF_LEVEL_HARD )
value7 = 3;
else if( gGameOptions.ubDifficultyLevel == DIF_LEVEL_INSANE )
value7 = 4;
else
{
value7 = Random (4);
if (value7 == 0) value7 = 1;
}
ubNumSoldiers = (UINT8)( gubMinEnemyGroupSize + value7 + HighestPlayerProgressPercentage() / 15 );
#else
ubNumSoldiers = (UINT8)( gubMinEnemyGroupSize + gGameOptions.ubDifficultyLevel + HighestPlayerProgressPercentage() / 15 );
#endif
//Madd: unlimited reinforcements?
if ( !gfUnlimitedTroops )
giReinforcementPool -= ubNumSoldiers;
@@ -5161,7 +5515,11 @@ void ExecuteStrategicAIAction( UINT16 usActionCode, INT16 sSectorX, INT16 sSecto
// anv: replace one of soldiers with tank
if( ubNumSoldiers && gGameExternalOptions.fArmyUsesTanksInAttacks )
{
#ifdef DIFFICULTY_SETTING
if( Random( 10 * 100 ) < value7 * HighestPlayerProgressPercentage() )
#else
if( Random( 10 * 100 ) < gGameOptions.ubDifficultyLevel * HighestPlayerProgressPercentage() )
#endif
{
ubNumSoldiers--;
ubNumTanks++;
@@ -5199,6 +5557,9 @@ 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)
#ifdef DIFFICULTY_SETTING
gubNumAwareBattles = zDeffSetting[gGameOptions.ubDifficultyLevel].iNumAwareBattles;
#else
switch( gGameOptions.ubDifficultyLevel )
{
case DIF_LEVEL_EASY:
@@ -5214,6 +5575,7 @@ void ExecuteStrategicAIAction( UINT16 usActionCode, INT16 sSectorX, INT16 sSecto
gubNumAwareBattles = gGameExternalOptions.ubInsaneNumAwareBattles;
break;
}
#endif
break;
default:
@@ -5478,7 +5840,26 @@ void StrategicHandleQueenLosingControlOfSector( INT16 sSectorX, INT16 sSectorY,
//Keep track of victories and wake up the queen after x number of battles.
gusPlayerBattleVictories++;
#ifdef DIFFICULTY_SETTING
UINT8 value8;
if( gGameOptions.ubDifficultyLevel == DIF_LEVEL_EASY )
value8 = 1;
else if( gGameOptions.ubDifficultyLevel == DIF_LEVEL_MEDIUM )
value8 = 2;
else if( gGameOptions.ubDifficultyLevel == DIF_LEVEL_HARD )
value8 = 3;
else if( gGameOptions.ubDifficultyLevel == DIF_LEVEL_INSANE )
value8 = 4;
else
{
value8 = Random (4);
if (value8 == 0) value8 = 1;
}
if( gusPlayerBattleVictories == 5 - value8 )
#else
if( gusPlayerBattleVictories == 5 - gGameOptions.ubDifficultyLevel )
#endif
{ //4 victories for easy, 3 for normal, 2 for hard
WakeUpQueen();
}
@@ -5600,7 +5981,26 @@ void StrategicHandleQueenLosingControlOfSector( INT16 sSectorX, INT16 sSectorY,
}
//Madd: tweaked to increase attacks for experienced and expert to 8 and 12, and unlimited for insane
#ifdef DIFFICULTY_SETTING
UINT8 value9;
if( gGameOptions.ubDifficultyLevel == DIF_LEVEL_EASY )
value9 = 1;
else if( gGameOptions.ubDifficultyLevel == DIF_LEVEL_MEDIUM )
value9 = 2;
else if( gGameOptions.ubDifficultyLevel == DIF_LEVEL_HARD )
value9 = 3;
else if( gGameOptions.ubDifficultyLevel == DIF_LEVEL_INSANE )
value9 = 4;
else
{
value9 = Random (4);
if (value9 == 0) value9 = 1;
}
if( pSector->ubInvestigativeState >= ( 4 * value9 ) && zDeffSetting[gGameOptions.ubDifficultyLevel].bQueenLosingControlOfSector == FALSE )
#else
if( pSector->ubInvestigativeState >= ( 4 * gGameOptions.ubDifficultyLevel ) && gGameOptions.ubDifficultyLevel < DIF_LEVEL_INSANE )
#endif
{
//This is the 4th time the player has conquered this sector. We won't pester the player with probing attacks here anymore.
return;
@@ -6158,7 +6558,11 @@ void UpgradeAdminsToTroops()
while ( ubAdminsToCheck > 0)
{
// chance to upgrade at each check is random, and also dependant on the garrison's priority
#ifdef DIFFICULTY_SETTING
if ( Chance ( bPriority ) || zDeffSetting[gGameOptions.ubDifficultyLevel].bUpgradeAdminsToTroops == TRUE )
#else
if ( Chance ( bPriority ) || gGameOptions.ubDifficultyLevel > DIF_LEVEL_HARD ) // Madd: Always happens on Insane
#endif
{
pSector->ubNumAdmins--;
pSector->ubNumTroops++;
@@ -6213,7 +6617,11 @@ void UpgradeAdminsToTroops()
while ( ubAdminsToCheck > 0)
{
// chance to upgrade at each check is random, and also dependant on the group's priority
#ifdef DIFFICULTY_SETTING
if ( Chance ( bPriority ) || zDeffSetting[gGameOptions.ubDifficultyLevel].bUpgradeAdminsToTroops2 == TRUE )
#else
if ( Chance ( bPriority ) || gGameOptions.ubDifficultyLevel >= DIF_LEVEL_HARD )// Madd: Always happens on Expert and Insane
#endif
{
pGroup->pEnemyGroup->ubNumAdmins--;
pGroup->pEnemyGroup->ubNumTroops++;
@@ -6453,6 +6861,9 @@ void TagSAIGroupWithGracePeriod( GROUP *pGroup )
if( iPatrolID != -1 )
{
#ifdef DIFFICULTY_SETTING
gPatrolGroup[ iPatrolID ].bFillPermittedAfterDayMod100 = (UINT8)((GetWorldDay() + zDeffSetting[gGameOptions.ubDifficultyLevel].iGracePeriodInDaysAfterPatrolDestroyed) % 100);
#else
switch( gGameOptions.ubDifficultyLevel ) {
case DIF_LEVEL_EASY:
gPatrolGroup[ iPatrolID ].bFillPermittedAfterDayMod100 = (UINT8)((GetWorldDay() + gGameExternalOptions.ubEasyPatrolGracePeriodInDays) % 100);
@@ -6467,6 +6878,7 @@ void TagSAIGroupWithGracePeriod( GROUP *pGroup )
gPatrolGroup[ iPatrolID ].bFillPermittedAfterDayMod100 = (UINT8)((GetWorldDay() + gGameExternalOptions.ubInsanePatrolGracePeriodInDays) % 100);
break;
}
#endif
}
}
}
+8
View File
@@ -24,6 +24,10 @@
#include "Facilities.h"
#endif
#ifdef DIFFICULTY_SETTING
#include "GameInitOptionsScreen.h"
#endif
#include "Strategic Mines LUA.h"
#include <vector>
@@ -194,7 +198,11 @@ void InitializeMines( void )
ubMineProductionIncreases = 15;
break;
default:
#ifdef DIFFICULTY_SETTING
ubMineProductionIncreases = 25;
#else
Assert( 0 );
#endif
return;
}
+17
View File
@@ -61,6 +61,10 @@
//extern JA25_SECTOR_AI *gJa25AiSectorStruct;
#endif
#ifdef DIFFICULTY_SETTING
#include "GameInitOptionsScreen.h"
#endif
#include "connect.h"
//forward declarations of common classes to eliminate includes
class OBJECTTYPE;
@@ -4877,6 +4881,19 @@ BOOLEAN TestForBloodcatAmbush( GROUP *pGroup )
{ //no ambushes underground (no bloodcats either)
return FALSE;
}
#ifdef DIFFICULTY_SETTING
if( gGameOptions.ubDifficultyLevel == DIF_LEVEL_EASY )
ubDifficulty = 0;
else if( gGameOptions.ubDifficultyLevel == DIF_LEVEL_MEDIUM )
ubDifficulty = 1;
else if( gGameOptions.ubDifficultyLevel == DIF_LEVEL_HARD )
ubDifficulty = 2;
else if( gGameOptions.ubDifficultyLevel == DIF_LEVEL_INSANE )
ubDifficulty = 3;
else
ubDifficulty = 0;
#endif
ubSectorID = (UINT8)SECTOR( pGroup->ubSectorX, pGroup->ubSectorY );
pSector = &SectorInfo[ ubSectorID ];
+28 -1
View File
@@ -18,6 +18,9 @@
#include "SaveLoadGame.h" // added by Flugente
#endif
#ifdef DIFFICULTY_SETTING
#include "GameInitOptionsScreen.h"
#endif
STRATEGIC_STATUS gStrategicStatus;
@@ -217,13 +220,37 @@ void UpdateLastDayOfPlayerActivity( UINT16 usDay )
UINT8 LackOfProgressTolerance( void )
{
#ifdef DIFFICULTY_SETTING
UINT8 iTolerance;
#endif
#ifdef DIFFICULTY_SETTING
if ( gGameOptions.ubDifficultyLevel == DIF_LEVEL_HARD || gGameOptions.ubDifficultyLevel == DIF_LEVEL_INSANE )
#else
if ( gGameOptions.ubDifficultyLevel >= DIF_LEVEL_HARD )
#endif
{
// give an EXTRA day over normal
return( 7 - DIF_LEVEL_MEDIUM + gStrategicStatus.ubHighestProgress / 42 );
}
#ifdef DIFFICULTY_SETTING
if( gGameOptions.ubDifficultyLevel == DIF_LEVEL_EASY )
iTolerance = 1;
else if( gGameOptions.ubDifficultyLevel == DIF_LEVEL_MEDIUM )
iTolerance = 2;
else if( gGameOptions.ubDifficultyLevel == DIF_LEVEL_HARD )
iTolerance = 3;
else if( gGameOptions.ubDifficultyLevel == DIF_LEVEL_INSANE )
iTolerance = 4;
else
iTolerance = 1;
return( 6 - iTolerance + gStrategicStatus.ubHighestProgress / 42 );
#else
return( 6 - gGameOptions.ubDifficultyLevel + gStrategicStatus.ubHighestProgress / 42 );
#endif
}
+27
View File
@@ -44,6 +44,10 @@
#include "LuaInitNPCs.h"
#include "Interface.h"
#ifdef DIFFICULTY_SETTING
#include "GameInitOptionsScreen.h"
#endif
// the max loyalty rating for any given town
#define MAX_LOYALTY_VALUE 100
@@ -1874,7 +1878,12 @@ void CheckIfEntireTownHasBeenLiberated( INT8 bTownId, INT16 sSectorX, INT16 sSec
}
// even taking over non-trainable "towns" like Orta/Tixa for the first time should count as "player activity"
#ifdef DIFFICULTY_SETTING
if ( gGameOptions.ubDifficultyLevel == DIF_LEVEL_HARD || gGameOptions.ubDifficultyLevel == DIF_LEVEL_INSANE)
#else
if ( gGameOptions.ubDifficultyLevel >= DIF_LEVEL_HARD )
#endif
{
UpdateLastDayOfPlayerActivity( ( UINT16 ) ( GetWorldDay() + 4 ) );
}
@@ -2053,7 +2062,25 @@ void HandleLoyaltyImplicationsOfMercRetreat( INT8 bRetreatCode, INT16 sSectorX,
{
// if not worse than 2:1 odds, then penalize morale
// SANDRO - Set the odds based on difficulty level
#ifdef DIFFICULTY_SETTING
UINT8 DiffLevel;
if( gGameOptions.ubDifficultyLevel == DIF_LEVEL_EASY )
DiffLevel = 1;
else if( gGameOptions.ubDifficultyLevel == DIF_LEVEL_MEDIUM )
DiffLevel = 2;
else if( gGameOptions.ubDifficultyLevel == DIF_LEVEL_HARD )
DiffLevel = 3;
else if( gGameOptions.ubDifficultyLevel == DIF_LEVEL_INSANE )
DiffLevel = 4;
else
DiffLevel = 1;
if ( gTacticalStatus.fEnemyInSector && ( (PlayerStrength() * (2 + DiffLevel)) >= EnemyStrength() ) )
#else
if ( gTacticalStatus.fEnemyInSector && ( (PlayerStrength() * (2 + gGameOptions.ubDifficultyLevel)) >= EnemyStrength() ) )
#endif
{
HandleMoraleEvent( NULL, MORALE_RAN_AWAY, sSectorX, sSectorY, (INT8)sSectorZ );
}
+57
View File
@@ -10,6 +10,9 @@
#include "Debug Control.h"
#include "GameSettings.h"
#ifdef DIFFICULTY_SETTING
#include "GameInitOptionsScreen.h"
#endif
typedef enum
{
@@ -187,6 +190,59 @@ void AddExtraItems(UINT8 x, UINT8 y, UINT8 z, bool sectorIsLoaded)
int baseFNLength = strlen(fileName);
// Append a suffix based on the difficulty
#ifdef DIFFICULTY_SETTING
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:
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;
}
#else
switch (gGameOptions.ubDifficultyLevel) {
case DIF_LEVEL_ZERO:
break;
@@ -207,6 +263,7 @@ void AddExtraItems(UINT8 x, UINT8 y, UINT8 z, bool sectorIsLoaded)
default:
break;
}
#endif
strcat(fileName, ".xml");
if(!FileExists(fileName))//dnl ch75 261013 just to avoid sdd::exception under debug from VFS when file not exist
+9
View File
@@ -161,6 +161,10 @@
#define MINS_TO_FLASH_CONTRACT_TIME (4 * 60)
#ifdef DIFFICULTY_SETTING
#include "GameInitOptionsScreen.h"
#endif
#ifdef JA2UB
void MakeBadSectorListFromMapsOnHardDrive( BOOLEAN fDisplayMessages ); // ja25 UB
#endif
@@ -15401,7 +15405,12 @@ void DumpSectorDifficultyInfo( void )
// NOTE: This operates on the selected map sector!
CHAR16 wSectorName[ 128 ];
#ifdef DIFFICULTY_SETTING
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_TESTVERSION, L"Playing Difficulty: %s", zDeffSetting[gGameOptions.ubDifficultyLevel].szDeffName );
#else
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_TESTVERSION, L"Playing Difficulty: %s", gzGIOScreenText[ GIO_DIF_LEVEL_TEXT + gGameOptions.ubDifficultyLevel ] );
#endif
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 );
+20
View File
@@ -109,6 +109,10 @@
#include "LuaInitNPCs.h"
#include "Luaglobal.h"
#ifdef DIFFICULTY_SETTING
#include "GameInitOptionsScreen.h"
#endif
#ifdef JA2UB
#include "SaveLoadGame.h"
#include "email.h"
@@ -7318,7 +7322,12 @@ void CreateAndAddMoneyObjectToGround( UINT32 sGridNo, INT32 iEasyAmount, INT32 i
break;
default:
#ifdef DIFFICULTY_SETTING
iCash = iNormalAmount;
break;
#else
Assert(0);
#endif
}
CreateMoney( iCash, &Object );
@@ -7515,6 +7524,12 @@ void HandleMovingEnemiesOntoRoofs()
MoveEnemyFromGridNoToRoofGridNo( 15446, 13993 );
MoveEnemyFromGridNoToRoofGridNo( 15436, 14006 );
break;
#ifdef DIFFICULTY_SETTING
default:
MoveEnemyFromGridNoToRoofGridNo( 15446, 13993 );
MoveEnemyFromGridNoToRoofGridNo( 15436, 14006 );
break;
#endif
}
}
@@ -7529,6 +7544,11 @@ void HandleMovingEnemiesOntoRoofs()
case DIF_LEVEL_HARD:
MoveEnemyFromGridNoToRoofGridNo( 8711, 5521 );
break;
#ifdef DIFFICULTY_SETTING
default:
MoveEnemyFromGridNoToRoofGridNo( 8711, 5521 );
break;
#endif
}
}
}
+9
View File
@@ -33,6 +33,10 @@
#include "meanwhile.h"
#endif
#ifdef DIFFICULTY_SETTING
#include "GameInitOptionsScreen.h"
#endif
#define SCRIPT_DELAY 10
#define AIR_RAID_SAY_QUOTE_TIME 3000
#define AIR_RAID_DIVE_INTERVAL 10000
@@ -509,7 +513,12 @@ void AirRaidLookForDive( )
if ( fDoDive )
{
// If we are are beginning game, only do gun dives..
#ifdef DIFFICULTY_SETTING
if ( gAirRaidDef.uiFlags & AIR_RAID_BEGINNING_GAME && zDeffSetting[gGameOptions.ubDifficultyLevel].bAirRaidLookForDive == FALSE)
#else
if ( gAirRaidDef.uiFlags & AIR_RAID_BEGINNING_GAME && gGameOptions.ubDifficultyLevel < DIF_LEVEL_HARD )
#endif
{
if ( gbNumDives == 0 )
{
+12 -3
View File
@@ -49,6 +49,10 @@
#include "ub_config.h"
#endif
#ifdef DIFFICULTY_SETTING
#include "GameInitOptionsScreen.h"
#endif
#include "email.h"
#include "mercs.h"
@@ -1293,7 +1297,9 @@ void HandleUnhiredMercDeaths( INT32 iProfileID )
// then we're not allowed to kill him (to avoid really pissing off player by killing his very favorite merc)
return;
}
#ifdef DIFFICULTY_SETTING
ubMaxDeaths = zDeffSetting[gGameOptions.ubDifficultyLevel].iMaxMercDeaths;
#else
// how many in total can be killed like this depends on player's difficulty setting
switch( gGameOptions.ubDifficultyLevel )
{
@@ -1314,7 +1320,7 @@ void HandleUnhiredMercDeaths( INT32 iProfileID )
ubMaxDeaths = 0;
break;
}
#endif
// if we've already hit the limit in this game, skip these checks
if (gStrategicStatus.ubUnhiredMercDeaths >= ubMaxDeaths)
{
@@ -1613,6 +1619,9 @@ 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.
#ifdef DIFFICULTY_SETTING
ubKillsPerPoint = zDeffSetting[gGameOptions.ubDifficultyLevel].iNumKillsPerProgressPoint;
#else
switch( gGameOptions.ubDifficultyLevel )
{
case DIF_LEVEL_EASY:
@@ -1632,7 +1641,7 @@ UINT8 CurrentPlayerProgressPercentage(void)
ubKillsPerPoint = 10;
break;
}
#endif
usKillsProgress = gStrategicStatus.usPlayerKills / ubKillsPerPoint;
if (usKillsProgress > usMaxKillsProgress)
{
+34 -2
View File
@@ -58,6 +58,10 @@
#include "Explosion Control.h"
#include "ub_config.h"
#ifdef DIFFICULTY_SETTING
#include "GameInitOptionsScreen.h"
#endif
//*******************************************************************
//
// Local Defines
@@ -1547,6 +1551,31 @@ void HandleJa25EnemyExpLevelModifier( )
}
}
break;
#ifdef DIFFICULTY_SETTING
default:
//Get the 2nd highest player exp level
bPlayerExpLevel = JA25SecondHighestExpLevelOnPlayersTeam( );
//get the enemies exp level
bEnemyExpLevel = JA25SecondHighestExpLevelOnEnemiesTeam( );
//get the difference b/n the 2
bDifference = bPlayerExpLevel - bEnemyExpLevel;
//if the players exp level is less then enemies
if( bDifference < 0 )
{
//if the difference
if( bDifference < JA25__MAX_EXP_DECREASE )
{
bDifference = JA25__MAX_EXP_DECREASE;
}
//Degrade all the enemies exp levels by difference
Ja25ScaleAllEnemiesByValue( bDifference );
}
break;
#endif
}
}
@@ -1798,7 +1827,10 @@ void HandleInitialEventsInHeliCrash()
UINT32 GetNumberOfTurnsPowerGenFanWillBeStoppedFor()
{
UINT32 uiNumTurns = PGF__NUM_TURNS_TILL_START_FAN_BACK_UP_EASY;
#ifdef DIFFICULTY_SETTING
uiNumTurns = zDeffSetting[gGameOptions.ubDifficultyLevel].iGetNumberOfTurnsPowerGenFanWillBeStoppedFor;
#else
switch( gGameOptions.ubDifficultyLevel )
{
case DIF_LEVEL_EASY:
@@ -1811,7 +1843,7 @@ UINT32 GetNumberOfTurnsPowerGenFanWillBeStoppedFor()
uiNumTurns = PGF__NUM_TURNS_TILL_START_FAN_BACK_UP_HARD;
break;
}
#endif
return( uiNumTurns );
}
+24
View File
@@ -55,6 +55,10 @@
#include "CampaignStats.h" // added by Flugente
#include "AIInternals.h"//dnl ch61 180813
#ifdef DIFFICULTY_SETTING
#include "GameInitOptionsScreen.h"
#endif
//forward declarations of common classes to eliminate includes
class OBJECTTYPE;
class SOLDIERTYPE;
@@ -2217,7 +2221,23 @@ INT32 SoldierToSoldierLineOfSightTest( SOLDIERTYPE * pStartSoldier, SOLDIERTYPE
if (PlacementType == BLOODCAT_PLACEMENT_STATIC)
{
// Are bloodcats set to forgo attacking enemies?
#ifdef DIFFICULTY_SETTING
UINT8 DiffLev;
if( gGameOptions.ubDifficultyLevel == DIF_LEVEL_EASY )
DiffLev = 1;
else if( gGameOptions.ubDifficultyLevel == DIF_LEVEL_MEDIUM )
DiffLev = 2;
else if( gGameOptions.ubDifficultyLevel == DIF_LEVEL_HARD )
DiffLev = 3;
else if( gGameOptions.ubDifficultyLevel == DIF_LEVEL_INSANE )
DiffLev = 4;
else
DiffLev = 1;
if (gBloodcatPlacements[ ubSectorID ][ DiffLev-1 ].ubFactionAffiliation == QUEENS_CIV_GROUP)
#else
if (gBloodcatPlacements[ ubSectorID ][ gGameOptions.ubDifficultyLevel-1 ].ubFactionAffiliation == QUEENS_CIV_GROUP)
#endif
{
// skip sight between army & bloodcats
if ( pStartSoldier->bTeam == ENEMY_TEAM && pEndSoldier->bTeam == CREATURE_TEAM && pEndSoldier->ubBodyType == BLOODCAT )
@@ -2229,7 +2249,11 @@ INT32 SoldierToSoldierLineOfSightTest( SOLDIERTYPE * pStartSoldier, SOLDIERTYPE
return( 0 );
}
}
#ifdef DIFFICULTY_SETTING
else if (gBloodcatPlacements[ ubSectorID ][ DiffLev-1 ].ubFactionAffiliation > NON_CIV_GROUP)
#else
else if (gBloodcatPlacements[ ubSectorID ][ gGameOptions.ubDifficultyLevel-1 ].ubFactionAffiliation > NON_CIV_GROUP)
#endif
{
// Bloodcats in this sector belong to a faction. They adhere to certain rules as a result.
if ( pEndSoldier->bTeam == CREATURE_TEAM && pEndSoldier->ubBodyType == BLOODCAT && pStartSoldier->bSide != gbPlayerNum)
+74 -4
View File
@@ -134,6 +134,9 @@
#endif
#include "XML.h"
#ifdef DIFFICULTY_SETTING
#include "GameInitOptionsScreen.h"
#endif
// OJW - 20090419
UINT8 giMAXIMUM_NUMBER_OF_PLAYER_MERCS = CODE_MAXIMUM_NUMBER_OF_PLAYER_MERCS;
@@ -4352,9 +4355,25 @@ SOLDIERTYPE * CivilianGroupMemberChangesSides( SOLDIERTYPE * pAttacked )
}
// HEADROCK HAM 3.6: If this sector has affiliated bloodcats, make them all hostile.
#ifdef DIFFICULTY_SETTING
UINT8 DiffLevel;
if( gGameOptions.ubDifficultyLevel == DIF_LEVEL_EASY )
DiffLevel = 1;
else if( gGameOptions.ubDifficultyLevel == DIF_LEVEL_MEDIUM )
DiffLevel = 2;
else if( gGameOptions.ubDifficultyLevel == DIF_LEVEL_HARD )
DiffLevel = 3;
else if( gGameOptions.ubDifficultyLevel == DIF_LEVEL_INSANE )
DiffLevel = 4;
else
DiffLevel = 1;
if ( gBloodcatPlacements[SECTOR(pNewAttacked->sSectorX,pNewAttacked->sSectorY)][0].PlacementType == BLOODCAT_PLACEMENT_STATIC &&
gBloodcatPlacements[SECTOR(pNewAttacked->sSectorX,pNewAttacked->sSectorY)][ DiffLevel-1 ].ubFactionAffiliation == pNewAttacked->ubCivilianGroup )
#else
if ( gBloodcatPlacements[SECTOR(pNewAttacked->sSectorX,pNewAttacked->sSectorY)][0].PlacementType == BLOODCAT_PLACEMENT_STATIC &&
gBloodcatPlacements[SECTOR(pNewAttacked->sSectorX,pNewAttacked->sSectorY)][ gGameOptions.ubDifficultyLevel-1 ].ubFactionAffiliation == pNewAttacked->ubCivilianGroup )
{
#endif
{
MakeBloodcatsHostile();
}
@@ -8853,13 +8872,47 @@ BOOLEAN ProcessImplicationsOfPCAttack( SOLDIERTYPE * pSoldier, SOLDIERTYPE ** pp
// Attacked a bloodcat.
MakeBloodcatsHostile();
// Are bloodcats in this sector affiliated with a faction?
#ifdef DIFFICULTY_SETTING
UINT8 DiffLevel;
if( gGameOptions.ubDifficultyLevel == DIF_LEVEL_EASY )
DiffLevel = 1;
else if( gGameOptions.ubDifficultyLevel == DIF_LEVEL_MEDIUM )
DiffLevel = 2;
else if( gGameOptions.ubDifficultyLevel == DIF_LEVEL_HARD )
DiffLevel = 3;
else if( gGameOptions.ubDifficultyLevel == DIF_LEVEL_INSANE )
DiffLevel = 4;
else
DiffLevel = 1;
if ( gBloodcatPlacements[SECTOR(pTarget->sSectorX,pTarget->sSectorY)][0].PlacementType == BLOODCAT_PLACEMENT_STATIC &&
gBloodcatPlacements[SECTOR(pTarget->sSectorX,pTarget->sSectorY)][ DiffLevel-1 ].ubFactionAffiliation > NON_CIV_GROUP )
#else
if ( gBloodcatPlacements[SECTOR(pTarget->sSectorX,pTarget->sSectorY)][0].PlacementType == BLOODCAT_PLACEMENT_STATIC &&
gBloodcatPlacements[SECTOR(pTarget->sSectorX,pTarget->sSectorY)][ gGameOptions.ubDifficultyLevel-1 ].ubFactionAffiliation > NON_CIV_GROUP )
{
#endif
{
// Temporarily change bloodcat's civilian group
UINT8 ubFaction = pTarget->ubCivilianGroup;
#ifdef DIFFICULTY_SETTING
UINT8 DiffLevel2;
if( gGameOptions.ubDifficultyLevel == DIF_LEVEL_EASY )
DiffLevel2 = 1;
else if( gGameOptions.ubDifficultyLevel == DIF_LEVEL_MEDIUM )
DiffLevel2 = 2;
else if( gGameOptions.ubDifficultyLevel == DIF_LEVEL_HARD )
DiffLevel2 = 3;
else if( gGameOptions.ubDifficultyLevel == DIF_LEVEL_INSANE )
DiffLevel2 = 4;
else
DiffLevel2 = 1;
pTarget->ubCivilianGroup = gBloodcatPlacements[SECTOR(pTarget->sSectorX,pTarget->sSectorY)][ DiffLevel2-1 ].ubFactionAffiliation;
#else
pTarget->ubCivilianGroup = gBloodcatPlacements[SECTOR(pTarget->sSectorX,pTarget->sSectorY)][ gGameOptions.ubDifficultyLevel-1 ].ubFactionAffiliation;
// Make entire faction hostile
#endif
// Make entire faction hostile
CivilianGroupMembersChangeSidesWithinProximity( pTarget );
// Change back
pTarget->ubCivilianGroup = ubFaction;
@@ -8909,9 +8962,26 @@ BOOLEAN ProcessImplicationsOfPCAttack( SOLDIERTYPE * pSoldier, SOLDIERTYPE ** pp
CivilianGroupMembersChangeSidesWithinProximity( pTarget );
// HEADROCK HAM 3.6: If there are bloodcats affiliated with his group...
#ifdef DIFFICULTY_SETTING
UINT8 DiffLevel;
if( gGameOptions.ubDifficultyLevel == DIF_LEVEL_EASY )
DiffLevel = 1;
else if( gGameOptions.ubDifficultyLevel == DIF_LEVEL_MEDIUM )
DiffLevel = 2;
else if( gGameOptions.ubDifficultyLevel == DIF_LEVEL_HARD )
DiffLevel = 3;
else if( gGameOptions.ubDifficultyLevel == DIF_LEVEL_INSANE )
DiffLevel = 4;
else
DiffLevel = 1;
if ( gBloodcatPlacements[SECTOR(pTarget->sSectorX,pTarget->sSectorY)][0].PlacementType == BLOODCAT_PLACEMENT_STATIC &&
gBloodcatPlacements[SECTOR(pTarget->sSectorX,pTarget->sSectorY)][ DiffLevel-1 ].ubFactionAffiliation == pTarget->ubCivilianGroup )
#else
if ( gBloodcatPlacements[SECTOR(pTarget->sSectorX,pTarget->sSectorY)][0].PlacementType == BLOODCAT_PLACEMENT_STATIC &&
gBloodcatPlacements[SECTOR(pTarget->sSectorX,pTarget->sSectorY)][ gGameOptions.ubDifficultyLevel-1 ].ubFactionAffiliation == pTarget->ubCivilianGroup )
{
#endif
{
// Make them hostile.
MakeBloodcatsHostile();
}
+20
View File
@@ -41,6 +41,11 @@
#include "CampaignStats.h" // added by Flugente
#endif
#include "connect.h"
#ifdef DIFFICULTY_SETTING
#include "GameInitOptionsScreen.h"
#endif
//rain
//#define BREATH_GAIN_REDUCTION_PER_RAIN_INTENSITY 25
//end rain
@@ -1387,6 +1392,11 @@ void UnusedAPsToBreath( SOLDIERTYPE * pSoldier )
case DIF_LEVEL_INSANE:
sBreathPerAP *= 6/5; // +20%
break;
#ifdef DIFFICULTY_SETTING
default:
sBreathPerAP *= 9/10; // -10%
break;
#endif
}
}
// SANDRO: this simple thing is the correct calculation
@@ -4312,6 +4322,11 @@ INT32 GetBPCostPer10APsForGunHolding( SOLDIERTYPE * pSoldier, BOOLEAN fEstimate
case DIF_LEVEL_INSANE:
iBPcost /= 2; // -50%
break;
#ifdef DIFFICULTY_SETTING
default:
iBPcost = (iBPcost * 9)/10; // -10%
break;
#endif
}
}
@@ -4476,6 +4491,11 @@ INT32 GetBPCostForRecoilkick( SOLDIERTYPE * pSoldier )
case DIF_LEVEL_INSANE:
iKickPower /= 2; // -50%
break;
#ifdef DIFFICULTY_SETTING
default:
iKickPower = (iKickPower * 9)/10; // -10%
break;
#endif
}
}
+20 -1
View File
@@ -51,6 +51,10 @@
#include "Animation Control.h"
#ifdef DIFFICULTY_SETTING
#include "GameInitOptionsScreen.h"
#endif
//forward declarations of common classes to eliminate includes
class OBJECTTYPE;
class SOLDIERTYPE;
@@ -976,8 +980,23 @@ BOOLEAN TurnSoldierIntoCorpse( SOLDIERTYPE *pSoldier, BOOLEAN fRemoveMerc, BOOLE
{
gTacticalStatus.fLockItemLocators = FALSE;
#ifdef DIFFICULTY_SETTING
UINT8 DiffLevel;
if( gGameOptions.ubDifficultyLevel == DIF_LEVEL_EASY )
DiffLevel = 1;
else if( gGameOptions.ubDifficultyLevel == DIF_LEVEL_MEDIUM )
DiffLevel = 2;
else if( gGameOptions.ubDifficultyLevel == DIF_LEVEL_HARD )
DiffLevel = 3;
else if( gGameOptions.ubDifficultyLevel == DIF_LEVEL_INSANE )
DiffLevel = 4;
else
DiffLevel = 1;
ubNumGoo = 6 - ( DiffLevel - DIF_LEVEL_EASY );
#else
ubNumGoo = 6 - ( gGameOptions.ubDifficultyLevel - DIF_LEVEL_EASY );
#endif
sNewGridNo = pSoldier->sGridNo + ( WORLD_COLS * 2 );
for ( cnt = 0; cnt < ubNumGoo; cnt++ )
+14 -2
View File
@@ -103,6 +103,10 @@
#include "Ja25 Strategic Ai.h"
#endif
#ifdef DIFFICULTY_SETTING
#include "GameInitOptionsScreen.h"
#endif
#include "fresh_header.h"
#include "Dialogue Control.h"
@@ -2061,7 +2065,10 @@ INT16 SOLDIERTYPE::CalcActionPoints( void )
//if ( this->bTeam != CIV_TEAM && this->bTeam != gbPlayerNum)
if ( this->bTeam == ENEMY_TEAM )
{
switch ( gGameOptions.ubDifficultyLevel )
#ifdef DIFFICULTY_SETTING
ubPoints += zDeffSetting[gGameOptions.ubDifficultyLevel].iEnemyAPBonus;
#else
switch( gGameOptions.ubDifficultyLevel )
{
case DIF_LEVEL_EASY:
@@ -2086,6 +2093,7 @@ INT16 SOLDIERTYPE::CalcActionPoints( void )
default:
ubPoints += 0;
}
#endif
}
// Bonus to Militia APs
else if ( this->bTeam == MILITIA_TEAM )
@@ -2194,7 +2202,10 @@ void SOLDIERTYPE::CalcNewActionPoints( void )
}
if ( this->bTeam == ENEMY_TEAM )
{
switch ( gGameOptions.ubDifficultyLevel )
#ifdef DIFFICULTY_SETTING
usMaxActionPnts += zDeffSetting[gGameOptions.ubDifficultyLevel].iEnemyAPBonus;
#else
switch( gGameOptions.ubDifficultyLevel )
{
case DIF_LEVEL_EASY:
usMaxActionPnts += gGameExternalOptions.iEasyAPBonus;
@@ -2209,6 +2220,7 @@ void SOLDIERTYPE::CalcNewActionPoints( void )
usMaxActionPnts += gGameExternalOptions.iInsaneAPBonus;
break;
}
#endif
}
// Bonus to Militia APs
else if ( this->bTeam == MILITIA_TEAM )
+48 -2
View File
@@ -56,6 +56,10 @@
#include "Ja25 Strategic Ai.h"
#endif
#ifdef DIFFICULTY_SETTING
#include "GameInitOptionsScreen.h"
#endif
// THESE 3 DIFFICULTY FACTORS MUST ALWAYS ADD UP TO 100% EXACTLY!!!
#define DIFF_FACTOR_PLAYER_PROGRESS 50
#define DIFF_FACTOR_PALACE_DISTANCE 30
@@ -2214,6 +2218,12 @@ INT8 CalcDifficultyModifier( UINT8 ubSoldierClass )
bDiffModifier += (INT8)(DIFF_FACTOR_GAME_DIFFICULTY * 1.5);
}
break;
#ifdef DIFFICULTY_SETTING
default:
// equally strong militia, enemies, creatures, bloodcats (+10)
bDiffModifier += ( DIFF_FACTOR_GAME_DIFFICULTY / 2 );
break;
#endif
}
@@ -2472,7 +2482,26 @@ void CreateDetailedPlacementGivenBasicPlacementInfo( SOLDIERCREATE_STRUCT *pp, B
UINT8 PlacementType = gBloodcatPlacements[ SECTOR(gWorldSectorX, gWorldSectorY) ][0].PlacementType;
if( PlacementType == BLOODCAT_PLACEMENT_LAIR )
{
#ifdef DIFFICULTY_SETTING
UINT8 DiffLevel;
if( gGameOptions.ubDifficultyLevel == DIF_LEVEL_EASY )
DiffLevel = 1;
else if( gGameOptions.ubDifficultyLevel == DIF_LEVEL_MEDIUM )
DiffLevel = 2;
else if( gGameOptions.ubDifficultyLevel == DIF_LEVEL_HARD )
DiffLevel = 3;
else if( gGameOptions.ubDifficultyLevel == DIF_LEVEL_INSANE )
DiffLevel = 4;
else
{
DiffLevel = Random (4);
if (DiffLevel == 0) DiffLevel = 1;
}
pp->bExpLevel += DiffLevel;
#else
pp->bExpLevel += gGameOptions.ubDifficultyLevel;
#endif
}
break;
}
@@ -2498,9 +2527,26 @@ void CreateDetailedPlacementGivenBasicPlacementInfo( SOLDIERCREATE_STRUCT *pp, B
pp->bExpLevel = min( 10, pp->bExpLevel ); //maximum exp. level of 9 // 10 - Madd
ubStatsLevel = pp->bExpLevel + bStatsModifier;
#ifdef DIFFICULTY_SETTING
UINT8 DiffLevel;
if( gGameOptions.ubDifficultyLevel == DIF_LEVEL_EASY )
DiffLevel = 1;
else if( gGameOptions.ubDifficultyLevel == DIF_LEVEL_MEDIUM )
DiffLevel = 2;
else if( gGameOptions.ubDifficultyLevel == DIF_LEVEL_HARD )
DiffLevel = 3;
else if( gGameOptions.ubDifficultyLevel == DIF_LEVEL_INSANE )
DiffLevel = 4;
else
{
DiffLevel = Random (4);
if (DiffLevel == 0) DiffLevel = 1;
}
ubStatsLevel = max( DiffLevel, ubStatsLevel ); //minimum stats level of 0 -- madd->= dif level
#else
ubStatsLevel = max( gGameOptions.ubDifficultyLevel, ubStatsLevel ); //minimum stats level of 0 -- madd->= dif level
#endif
if ( gGameOptions.ubDifficultyLevel == DIF_LEVEL_INSANE )
ubStatsLevel = max( 6, ubStatsLevel ); //minimum stats level of 6 in insane
+20
View File
@@ -61,6 +61,10 @@ class SOLDIERTYPE;
// anv: for taunts on miss
#include "Civ Quotes.h"
#ifdef DIFFICULTY_SETTING
#include "GameInitOptionsScreen.h"
#endif
//rain
//#define WEAPON_RELIABILITY_REDUCTION_PER_RAIN_INTENSITY 0
extern INT8 gbCurrentRainIntensity;
@@ -5902,7 +5906,11 @@ else
// GAME DIFFICULTY
if ( !(pSoldier->flags.uiStatusFlags & SOLDIER_PC ) && (pSoldier->bSide != gbPlayerNum) )
{
#ifdef DIFFICULTY_SETTING
iBaseModifier += zDeffSetting[gGameOptions.ubDifficultyLevel].NewDifficualtySetingsBASE_DIFFICULTY;
#else
iBaseModifier += gGameCTHConstants.BASE_DIFFICULTY[gGameOptions.ubDifficultyLevel];
#endif
}
// Percentage based-modifier from the weapon and its attachments
@@ -6235,7 +6243,11 @@ else
// GAME DIFFICULTY
if ( !(pSoldier->flags.uiStatusFlags & SOLDIER_PC ) && (pSoldier->bSide != gbPlayerNum) )
{
#ifdef DIFFICULTY_SETTING
iAimModifier += zDeffSetting[gGameOptions.ubDifficultyLevel].NewDifficualtySetingsAIM_DIFFICULTY;
#else
iAimModifier += gGameCTHConstants.AIM_DIFFICULTY[gGameOptions.ubDifficultyLevel];
#endif
}
// Percent modifier from the weapon and its attachments
@@ -12835,7 +12847,11 @@ FLOAT CalcNewChanceToHitBaseSpecialBonus(SOLDIERTYPE *pSoldier)
// GAME DIFFICULTY
if ( !(pSoldier->flags.uiStatusFlags & SOLDIER_PC ) && (pSoldier->bSide != gbPlayerNum) )
{
#ifdef DIFFICULTY_SETTING
fBaseModifier += zDeffSetting[gGameOptions.ubDifficultyLevel].NewDifficualtySetingsBASE_DIFFICULTY;
#else
fBaseModifier += gGameCTHConstants.BASE_DIFFICULTY[gGameOptions.ubDifficultyLevel];
#endif
}
return fBaseModifier;
@@ -13134,7 +13150,11 @@ FLOAT CalcNewChanceToHitAimSpecialBonus(SOLDIERTYPE *pSoldier)
// GAME DIFFICULTY
if ( !(pSoldier->flags.uiStatusFlags & SOLDIER_PC ) && (pSoldier->bSide != gbPlayerNum) )
{
#ifdef DIFFICULTY_SETTING
fAimModifier += zDeffSetting[gGameOptions.ubDifficultyLevel].NewDifficualtySetingsAIM_DIFFICULTY;
#else
fAimModifier += gGameCTHConstants.AIM_DIFFICULTY[gGameOptions.ubDifficultyLevel];
#endif
}
return fAimModifier;
+7
View File
@@ -257,6 +257,10 @@ typedef PARSE_STAGE;
#define HISTORYNAMEFILENAME "History.xml"
#ifdef DIFFICULTY_SETTING
#define DIFFICULTYFILENAME "DifficultySettings.xml"
#endif
extern BOOLEAN ReadInItemStats(STR fileName, BOOLEAN localizedVersion);
extern BOOLEAN WriteItemStats();
@@ -553,4 +557,7 @@ extern BOOLEAN ReadInLanguageLocation(STR fileName, BOOLEAN localizedVersion, LA
extern BOOLEAN ReadInAimOldArchive(STR fileName, BOOLEAN localizedVersion);
extern BOOLEAN ReadInHistorys(STR fileName, BOOLEAN localizedVersion );
#ifdef DIFFICULTY_SETTING
extern BOOLEAN ReadInDifficultySettings(STR fileName, BOOLEAN localizedVersion);
#endif
#endif
+54 -2
View File
@@ -55,6 +55,10 @@
#include "Ja25_Tactical.h"
#endif
#ifdef DIFFICULTY_SETTING
#include "GameInitOptionsScreen.h"
#endif
#include "Music Control.h"
#include "connect.h"
@@ -931,7 +935,11 @@ void HandleSight(SOLDIERTYPE *pSoldier, UINT8 ubSightFlags)
RevealRoofsAndItems(pSoldier,TRUE, TRUE, pSoldier->pathing.bLevel, FALSE );
}
// unless in easy mode allow alerted enemies to radio
#ifdef DIFFICULTY_SETTING
else if ( zDeffSetting[gGameOptions.ubDifficultyLevel].bRadioSightings == TRUE )
#else
else if ( gGameOptions.ubDifficultyLevel >= DIF_LEVEL_MEDIUM )
#endif
{
// don't allow admins to radio
//Madd: Huh? why not admins? removed.
@@ -978,7 +986,11 @@ void HandleSight(SOLDIERTYPE *pSoldier, UINT8 ubSightFlags)
RadioSightings(pThem,pSoldier->ubID, pThem->bTeam);
}
// unless in easy mode allow alerted enemies to radio
#ifdef DIFFICULTY_SETTING
else if ( zDeffSetting[gGameOptions.ubDifficultyLevel].bRadioSightings2 == TRUE )
#else
else if ( gGameOptions.ubDifficultyLevel >= DIF_LEVEL_MEDIUM )
#endif
{
// don't allow admins to radio
if ( pThem->bTeam == ENEMY_TEAM && gTacticalStatus.Team[ ENEMY_TEAM ].bAwareOfOpposition && pThem->ubSoldierClass != SOLDIER_CLASS_ADMINISTRATOR )
@@ -2503,10 +2515,28 @@ void ManSeesMan(SOLDIERTYPE *pSoldier, SOLDIERTYPE *pOpponent, INT32 sOppGridNo,
else if ( pOpponent->ubBodyType == BLOODCAT && pOpponent->aiData.bNeutral)
{
// HEADROCK HAM 3.6: If bloodcats are set as affiliated with civilians, do not trigger hostilities.
#ifdef DIFFICULTY_SETTING
UINT8 DiffLevel;
if( gGameOptions.ubDifficultyLevel == DIF_LEVEL_EASY )
DiffLevel = 1;
else if( gGameOptions.ubDifficultyLevel == DIF_LEVEL_MEDIUM )
DiffLevel = 2;
else if( gGameOptions.ubDifficultyLevel == DIF_LEVEL_HARD )
DiffLevel = 3;
else if( gGameOptions.ubDifficultyLevel == DIF_LEVEL_INSANE )
DiffLevel = 4;
else
DiffLevel = 1;
if ( gBloodcatPlacements[SECTOR(pSoldier->sSectorX, pSoldier->sSectorY)][ 0 ].PlacementType != BLOODCAT_PLACEMENT_STATIC ||
gBloodcatPlacements[SECTOR(pSoldier->sSectorX, pSoldier->sSectorY)][ DiffLevel - 1 ].ubFactionAffiliation == NON_CIV_GROUP ||
gBloodcatPlacements[SECTOR(pSoldier->sSectorX, pSoldier->sSectorY)][ DiffLevel - 1 ].ubFactionAffiliation == QUEENS_CIV_GROUP )
#else
if ( gBloodcatPlacements[SECTOR(pSoldier->sSectorX, pSoldier->sSectorY)][ 0 ].PlacementType != BLOODCAT_PLACEMENT_STATIC ||
gBloodcatPlacements[SECTOR(pSoldier->sSectorX, pSoldier->sSectorY)][ gGameOptions.ubDifficultyLevel - 1 ].ubFactionAffiliation == NON_CIV_GROUP ||
gBloodcatPlacements[SECTOR(pSoldier->sSectorX, pSoldier->sSectorY)][ gGameOptions.ubDifficultyLevel - 1 ].ubFactionAffiliation == QUEENS_CIV_GROUP )
{
#endif
{
MakeBloodcatsHostile();
}
/*
@@ -6020,9 +6050,27 @@ void ProcessNoise(UINT8 ubNoiseMaker, INT32 sGridNo, INT8 bLevel, UINT8 ubTerrTy
UINT8 ubSectorID = SECTOR(gWorldSectorX, gWorldSectorY);
UINT8 PlacementType = gBloodcatPlacements[ ubSectorID ][0].PlacementType;
#ifdef DIFFICULTY_SETTING
UINT8 DiffLevel;
if( gGameOptions.ubDifficultyLevel == DIF_LEVEL_EASY )
DiffLevel = 1;
else if( gGameOptions.ubDifficultyLevel == DIF_LEVEL_MEDIUM )
DiffLevel = 2;
else if( gGameOptions.ubDifficultyLevel == DIF_LEVEL_HARD )
DiffLevel = 3;
else if( gGameOptions.ubDifficultyLevel == DIF_LEVEL_INSANE )
DiffLevel = 4;
else
DiffLevel = 1;
#endif
if (PlacementType == BLOODCAT_PLACEMENT_STATIC)
{
if (gBloodcatPlacements[ ubSectorID ][ gGameOptions.ubDifficultyLevel-1 ].ubFactionAffiliation == QUEENS_CIV_GROUP)
#ifdef DIFFICULTY_SETTING
if (gBloodcatPlacements[ ubSectorID ][ DiffLevel-1 ].ubFactionAffiliation == QUEENS_CIV_GROUP)
#else
if (gBloodcatPlacements[ ubSectorID ][ gGameOptions.ubDifficultyLevel-1 ].ubFactionAffiliation == QUEENS_CIV_GROUP)
#endif
{
// skip noises between army & bloodcats
if ( pSoldier->bTeam == ENEMY_TEAM && MercPtrs[ ubNoiseMaker ]->ubBodyType == BLOODCAT && MercPtrs[ ubNoiseMaker ]->bTeam == CREATURE_TEAM )
@@ -6034,7 +6082,11 @@ void ProcessNoise(UINT8 ubNoiseMaker, INT32 sGridNo, INT8 bLevel, UINT8 ubTerrTy
continue;
}
}
#ifdef DIFFICULTY_SETTING
else if (gBloodcatPlacements[ ubSectorID ][ DiffLevel-1 ].ubFactionAffiliation > NON_CIV_GROUP)
#else
else if (gBloodcatPlacements[ ubSectorID ][ gGameOptions.ubDifficultyLevel-1 ].ubFactionAffiliation > NON_CIV_GROUP)
#endif
{
if ( MercPtrs[ ubNoiseMaker ]->ubBodyType == BLOODCAT && MercPtrs[ ubNoiseMaker ]->bTeam == CREATURE_TEAM && pSoldier->bSide != gbPlayerNum)
{
+8
View File
@@ -26,6 +26,10 @@
#include "Vehicles.h" // added by silversurfer
#endif
#ifdef DIFFICULTY_SETTING
#include "GameInitOptionsScreen.h"
#endif
//////////////////////////////////////////////////////////////////////////////
// SANDRO - In this file, all APBPConstants[AP_CROUCH] and APBPConstants[AP_PRONE] were changed to GetAPsCrouch() and GetAPsProne()
// On the bottom here, there are these functions made
@@ -2290,7 +2294,11 @@ INT8 CalcMorale(SOLDIERTYPE *pSoldier)
bMoraleCategory = MORALE_WORRIED;
// SANDRO - on Insane difficulty enemy morale cannot go below worried
#ifdef DIFFICULTY_SETTING
if (bMoraleCategory == MORALE_HOPELESS && zDeffSetting[gGameOptions.ubDifficultyLevel].bEnemyMoraleWorried == TRUE )
#else
if (bMoraleCategory == MORALE_HOPELESS && gGameOptions.ubDifficultyLevel == DIF_LEVEL_INSANE )
#endif
bMoraleCategory = MORALE_WORRIED;
#ifdef DEBUGDECISIONS
+8 -1
View File
@@ -39,6 +39,10 @@
#include "connect.h"
#ifdef DIFFICULTY_SETTING
#include "GameInitOptionsScreen.h"
#endif
//forward declarations of common classes to eliminate includes
class OBJECTTYPE;
class SOLDIERTYPE;
@@ -1950,8 +1954,11 @@ void CalculateLaunchItemBasicParams( SOLDIERTYPE *pSoldier, OBJECTTYPE *pItem, I
}
fGLauncher = TRUE;
sMinRange = MIN_MORTAR_RANGE/2;
#ifdef DIFFICULTY_SETTING
if ( (gGameSettings.fOptions[TOPTION_GL_HIGH_ANGLE] && pSoldier->bTeam == OUR_TEAM) || ( pSoldier->bTeam == ENEMY_TEAM && ( gGameOptions.ubDifficultyLevel == DIF_LEVEL_HARD || gGameOptions.ubDifficultyLevel == DIF_LEVEL_INSANE ) ) )
#else
if ( (gGameSettings.fOptions[TOPTION_GL_HIGH_ANGLE] && pSoldier->bTeam == OUR_TEAM) || ( pSoldier->bTeam == ENEMY_TEAM && gGameOptions.ubDifficultyLevel >= DIF_LEVEL_HARD ) )
#endif
dDegrees *= 2;
//fLauncher = TRUE;
}
+596
View File
@@ -0,0 +1,596 @@
#ifdef PRECOMPILEDHEADERS
#include "Tactical All.h"
#else
#include "sgp.h"
#include "Debug Control.h"
#include "expat.h"
#include "XML.h"
#include "Interface.h"
#include "Text.h"
#include "GameInitOptionsScreen.h"
#endif
#ifdef DIFFICULTY_SETTING
struct
{
PARSE_STAGE curElement;
CHAR8 szCharData[MAX_CHAR_DATA_LENGTH+1];
DIFFICULTY_SETTINGS_VALUES curDifficultySettings;
DIFFICULTY_SETTINGS_VALUES * curArray;
UINT32 maxArraySize;
UINT32 curIndex;
UINT32 currentDepth;
UINT32 maxReadDepth;
}
typedef difficultySettingsParseData;
BOOLEAN DifficultySettings_TextOnly;
static void XMLCALL
DifficultySettingsParseDataStartElementHandle(void *userData, const XML_Char *name, const XML_Char **atts)
{
difficultySettingsParseData * pData = (difficultySettingsParseData *)userData;
if(pData->currentDepth <= pData->maxReadDepth) //are we reading this element?
{
if(strcmp(name, "DIFFICULTY_SETTINGS") == 0 && pData->curElement == ELEMENT_NONE)
{
pData->curElement = ELEMENT_LIST;
pData->maxReadDepth++; //we are not skipping this element
}
else if(strcmp(name, "DIFFICULTY") == 0 && pData->curElement == ELEMENT_LIST)
{
pData->curElement = ELEMENT;
pData->maxReadDepth++; //we are not skipping this element
}
else if(pData->curElement == ELEMENT &&
(strcmp(name, "uiIndex") == 0 ||
strcmp(name, "Name") == 0 ||
strcmp(name, "ConfirmText") == 0 ||
strcmp(name, "StartingCash") == 0 ||
strcmp(name, "EnemyAPBonus") == 0 ||
strcmp(name, "NumKillsPerProgressPoint") == 0 ||
strcmp(name, "InitialGarrisonPercentages") == 0 ||
strcmp(name, "MinEnemyGroupSize") == 0 ||
strcmp(name, "UnlimitedPoolOfTroops") == 0 ||
strcmp(name, "QueensInitialPoolOfTroops") == 0 ||
strcmp(name, "QueenPoolIncrementPerDifficultyLevel") == 0 ||
strcmp(name, "EnemyStartingAlertLevel") == 0 ||
strcmp(name, "EnemyAlertDecay") == 0 ||
strcmp(name, "NumAwareBattles") == 0 ||
strcmp(name, "BaseDelayInMinutesBetweenEvaluations") == 0 ||
strcmp(name, "EvaluationDelayVariance") == 0 ||
strcmp(name, "GracePeriodInHoursAfterSectorLiberation") == 0 ||
strcmp(name, "GracePeriodInDaysAfterPatrolDestroyed") == 0 ||
strcmp(name, "AggressiveQueenAi") == 0 ||
strcmp(name, "MaxMercDeaths") == 0 ||
strcmp(name, "CreatureSpreadTime") == 0 ||
strcmp(name, "QueenReproductionBase") == 0 ||
strcmp(name, "QueenReproductionBonus") == 0 ||
strcmp(name, "QueenInitBonusSpread") == 0 ||
strcmp(name, "CreaturePopulationModifier") == 0 ||
strcmp(name, "CreatureTownAggressiveness") == 0 ||
strcmp(name, "SectorJ9B1NumTroops") == 0 ||
strcmp(name, "SectorJ9B2NumCreatures") == 0 ||
strcmp(name, "SectorK4B1NumTroops") == 0 ||
strcmp(name, "SectorK4B2NumElites") == 0 ||
strcmp(name, "SectorO3B1NumTroops") == 0 ||
strcmp(name, "SectorO3B2NumElites") == 0 ||
strcmp(name, "SectorP3B1NumElites") == 0 ||
strcmp(name, "StrategicAiActionWakeQueen") == 0 ||
strcmp(name, "UpdateLastDayOfPlayerActivity") == 0 ||
strcmp(name, "ChanceOfEnemyAmbushes") == 0 ||
strcmp(name, "AllowReinforcements") == 0 ||
strcmp(name, "AllowReinforcementsOmerta") == 0 ||
strcmp(name, "PopulationLevel2") == 0 ||
strcmp(name, "PopulationLevel3") == 0 ||
strcmp(name, "PercentElitesBonus") == 0 ||
strcmp(name, "WeaponCacheTroops1") == 0 ||
strcmp(name, "WeaponCacheTroops2") == 0 ||
strcmp(name, "WeaponCacheTroops3") == 0 ||
strcmp(name, "WeaponCacheTroops4") == 0 ||
strcmp(name, "WeaponCacheTroops5") == 0 ||
strcmp(name, "UpgradeAdminsToTroops") == 0 ||
strcmp(name, "UpgradeGarrisonsAdminsToTroops") == 0 ||
strcmp(name, "QueenAttackLosingControlOfSector") == 0 ||
strcmp(name, "BloodcatAmbushSectors") == 0 ||
strcmp(name, "AirRaidLookForDive") == 0 ||
strcmp(name, "NumberOfTurnsPowerGenFanWillBeStoppedFor") == 0 ||
strcmp(name, "RadioSightings") == 0 ||
strcmp(name, "RadioSightings2") == 0 ||
strcmp(name, "EnemyMoraleWorried") == 0 ||
strcmp(name, "CthConstantsAimDifficulty") == 0 ||
strcmp(name, "CthConstantsBaseDifficulty") == 0
))
{
pData->curElement = ELEMENT_PROPERTY;
pData->maxReadDepth++; //we are not skipping this element
}
pData->szCharData[0] = '\0';
}
pData->currentDepth++;
}
static void XMLCALL
DifficultySettingsDataHandle(void *userData, const XML_Char *str, int len)
{
difficultySettingsParseData * pData = (difficultySettingsParseData *)userData;
if( (pData->currentDepth <= pData->maxReadDepth) &&
(strlen(pData->szCharData) < MAX_CHAR_DATA_LENGTH)
){
strncat(pData->szCharData,str,__min((unsigned int)len,MAX_CHAR_DATA_LENGTH-strlen(pData->szCharData)));
}
}
static void XMLCALL
difficultySettingsEndElementHandle(void *userData, const XML_Char *name)
{
difficultySettingsParseData * pData = (difficultySettingsParseData *)userData;
if(pData->currentDepth <= pData->maxReadDepth) //we're at the end of an element that we've been reading
{
if(strcmp(name, "DIFFICULTY_SETTINGS") == 0)
{
pData->curElement = ELEMENT_NONE;
}
else if(strcmp(name, "DIFFICULTY") == 0)
{
pData->curElement = ELEMENT_LIST;
if (!DifficultySettings_TextOnly)
{
wcscpy(zDeffSetting[pData->curDifficultySettings.uiIndex].szDeffName, pData->curDifficultySettings.szDeffName);
wcscpy(zDeffSetting[pData->curDifficultySettings.uiIndex].szConfirmText, pData->curDifficultySettings.szConfirmText);
zDeffSetting[pData->curDifficultySettings.uiIndex].iStartingCash = pData->curDifficultySettings.iStartingCash;
zDeffSetting[pData->curDifficultySettings.uiIndex].iEnemyAPBonus = pData->curDifficultySettings.iEnemyAPBonus;
zDeffSetting[pData->curDifficultySettings.uiIndex].iNumKillsPerProgressPoint = pData->curDifficultySettings.iNumKillsPerProgressPoint;
zDeffSetting[pData->curDifficultySettings.uiIndex].iInitialGarrisonPercentages = pData->curDifficultySettings.iInitialGarrisonPercentages;
zDeffSetting[pData->curDifficultySettings.uiIndex].iMinEnemyGroupSize = pData->curDifficultySettings.iMinEnemyGroupSize;
zDeffSetting[pData->curDifficultySettings.uiIndex].bUnlimitedPoolOfTroops = pData->curDifficultySettings.bUnlimitedPoolOfTroops;
zDeffSetting[pData->curDifficultySettings.uiIndex].iQueensInitialPoolOfTroops = pData->curDifficultySettings.iQueensInitialPoolOfTroops;
zDeffSetting[pData->curDifficultySettings.uiIndex].iQueenPoolIncrementPerDifficultyLevel = pData->curDifficultySettings.iQueenPoolIncrementPerDifficultyLevel;
zDeffSetting[pData->curDifficultySettings.uiIndex].iEnemyStartingAlertLevel = pData->curDifficultySettings.iEnemyStartingAlertLevel;
zDeffSetting[pData->curDifficultySettings.uiIndex].iEnemyAlertDecay = pData->curDifficultySettings.iEnemyAlertDecay;
zDeffSetting[pData->curDifficultySettings.uiIndex].iNumAwareBattles = pData->curDifficultySettings.iNumAwareBattles;
zDeffSetting[pData->curDifficultySettings.uiIndex].iBaseDelayInMinutesBetweenEvaluations = pData->curDifficultySettings.iBaseDelayInMinutesBetweenEvaluations;
zDeffSetting[pData->curDifficultySettings.uiIndex].iEvaluationDelayVariance = pData->curDifficultySettings.iEvaluationDelayVariance;
zDeffSetting[pData->curDifficultySettings.uiIndex].iGracePeriodInHoursAfterSectorLiberation = pData->curDifficultySettings.iGracePeriodInHoursAfterSectorLiberation;
zDeffSetting[pData->curDifficultySettings.uiIndex].iGracePeriodInDaysAfterPatrolDestroyed = pData->curDifficultySettings.iGracePeriodInDaysAfterPatrolDestroyed;
zDeffSetting[pData->curDifficultySettings.uiIndex].bAggressiveQueenAi = pData->curDifficultySettings.bAggressiveQueenAi;
zDeffSetting[pData->curDifficultySettings.uiIndex].iMaxMercDeaths = pData->curDifficultySettings.iMaxMercDeaths;
//Creatures Settings
zDeffSetting[pData->curDifficultySettings.uiIndex].iCreatureSpreadTime = pData->curDifficultySettings.iCreatureSpreadTime;
zDeffSetting[pData->curDifficultySettings.uiIndex].iQueenReproductionBase = pData->curDifficultySettings.iQueenReproductionBase;
zDeffSetting[pData->curDifficultySettings.uiIndex].iQueenReproductionBonus = pData->curDifficultySettings.iQueenReproductionBonus;
zDeffSetting[pData->curDifficultySettings.uiIndex].iQueenInitBonusSpread = pData->curDifficultySettings.iQueenInitBonusSpread;
zDeffSetting[pData->curDifficultySettings.uiIndex].iCreaturePopulationModifier = pData->curDifficultySettings.iCreaturePopulationModifier;
zDeffSetting[pData->curDifficultySettings.uiIndex].iCreatureTownAggressiveness = pData->curDifficultySettings.iCreatureTownAggressiveness;
//sectors
zDeffSetting[pData->curDifficultySettings.uiIndex].iJ9B1NumTroops = pData->curDifficultySettings.iJ9B1NumTroops;
zDeffSetting[pData->curDifficultySettings.uiIndex].iJ9B2NumCreatures = pData->curDifficultySettings.iJ9B2NumCreatures;
zDeffSetting[pData->curDifficultySettings.uiIndex].iK4B1NumTroops = pData->curDifficultySettings.iK4B1NumTroops;
zDeffSetting[pData->curDifficultySettings.uiIndex].iK4B1NumElites = pData->curDifficultySettings.iK4B1NumElites;
zDeffSetting[pData->curDifficultySettings.uiIndex].iO3B1NumTroops = pData->curDifficultySettings.iO3B1NumTroops;
zDeffSetting[pData->curDifficultySettings.uiIndex].iO3B1NumElites = pData->curDifficultySettings.iO3B1NumElites;
zDeffSetting[pData->curDifficultySettings.uiIndex].iP3B1NumElites = pData->curDifficultySettings.iP3B1NumElites;
//Other
zDeffSetting[pData->curDifficultySettings.uiIndex].bStrategicAiActionWakeQueen = pData->curDifficultySettings.bStrategicAiActionWakeQueen;
zDeffSetting[pData->curDifficultySettings.uiIndex].iUpdateLastDayOfPlayerActivity = pData->curDifficultySettings.iUpdateLastDayOfPlayerActivity;
zDeffSetting[pData->curDifficultySettings.uiIndex].iChanceOfEnemyAmbushes = pData->curDifficultySettings.iChanceOfEnemyAmbushes;
zDeffSetting[pData->curDifficultySettings.uiIndex].bAllowReinforcements = pData->curDifficultySettings.bAllowReinforcements;
zDeffSetting[pData->curDifficultySettings.uiIndex].bAllowReinforcementsOmerta = pData->curDifficultySettings.bAllowReinforcementsOmerta;
zDeffSetting[pData->curDifficultySettings.uiIndex].iPercentElitesBonus = pData->curDifficultySettings.iPercentElitesBonus;
zDeffSetting[pData->curDifficultySettings.uiIndex].iDesiredPopulationL2 = pData->curDifficultySettings.iDesiredPopulationL2;
zDeffSetting[pData->curDifficultySettings.uiIndex].iDesiredPopulationL3 = pData->curDifficultySettings.iDesiredPopulationL3;
zDeffSetting[pData->curDifficultySettings.uiIndex].iWeaponCacheTroops1 = pData->curDifficultySettings.iWeaponCacheTroops1;
zDeffSetting[pData->curDifficultySettings.uiIndex].iWeaponCacheTroops2 = pData->curDifficultySettings.iWeaponCacheTroops2;
zDeffSetting[pData->curDifficultySettings.uiIndex].iWeaponCacheTroops3 = pData->curDifficultySettings.iWeaponCacheTroops3;
zDeffSetting[pData->curDifficultySettings.uiIndex].iWeaponCacheTroops4 = pData->curDifficultySettings.iWeaponCacheTroops4;
zDeffSetting[pData->curDifficultySettings.uiIndex].iWeaponCacheTroops5 = pData->curDifficultySettings.iWeaponCacheTroops5;
zDeffSetting[pData->curDifficultySettings.uiIndex].bUpgradeAdminsToTroops = pData->curDifficultySettings.bUpgradeAdminsToTroops;
zDeffSetting[pData->curDifficultySettings.uiIndex].bUpgradeAdminsToTroops2 = pData->curDifficultySettings.bUpgradeAdminsToTroops2;
zDeffSetting[pData->curDifficultySettings.uiIndex].bQueenLosingControlOfSector = pData->curDifficultySettings.bQueenLosingControlOfSector;
zDeffSetting[pData->curDifficultySettings.uiIndex].bBloodcatAmbush = pData->curDifficultySettings.bBloodcatAmbush;
zDeffSetting[pData->curDifficultySettings.uiIndex].bAirRaidLookForDive = pData->curDifficultySettings.bAirRaidLookForDive;
zDeffSetting[pData->curDifficultySettings.uiIndex].iGetNumberOfTurnsPowerGenFanWillBeStoppedFor = pData->curDifficultySettings.iGetNumberOfTurnsPowerGenFanWillBeStoppedFor;
zDeffSetting[pData->curDifficultySettings.uiIndex].bRadioSightings = pData->curDifficultySettings.bRadioSightings;
zDeffSetting[pData->curDifficultySettings.uiIndex].bRadioSightings2 = pData->curDifficultySettings.bRadioSightings2;
zDeffSetting[pData->curDifficultySettings.uiIndex].NewDifficualtySetingsAIM_DIFFICULTY = pData->curDifficultySettings.NewDifficualtySetingsAIM_DIFFICULTY;
zDeffSetting[pData->curDifficultySettings.uiIndex].NewDifficualtySetingsBASE_DIFFICULTY = pData->curDifficultySettings.NewDifficualtySetingsBASE_DIFFICULTY;
zDeffSetting[pData->curDifficultySettings.uiIndex].bEnemyMoraleWorried = pData->curDifficultySettings.bEnemyMoraleWorried;
}
else
{
wcscpy(zDeffSetting[pData->curDifficultySettings.uiIndex].szDeffName, pData->curDifficultySettings.szDeffName);
wcscpy(zDeffSetting[pData->curDifficultySettings.uiIndex].szConfirmText, pData->curDifficultySettings.szConfirmText);
}
}
else if(strcmp(name, "uiIndex") == 0)
{
pData->curElement = ELEMENT;
pData->curDifficultySettings.uiIndex = (UINT16) atol(pData->szCharData);
MaxDifficultySettingsValues++;
}
else if(strcmp(name, "Name") == 0 )
{
pData->curElement = ELEMENT;
MultiByteToWideChar( CP_UTF8, 0, pData->szCharData, -1, pData->curDifficultySettings.szDeffName, sizeof(pData->curDifficultySettings.szDeffName)/sizeof(pData->curDifficultySettings.szDeffName[0]) );
pData->curDifficultySettings.szDeffName[sizeof(pData->curDifficultySettings.szDeffName)/sizeof(pData->curDifficultySettings.szDeffName[0]) - 1] = '\0';
}
else if(strcmp(name, "ConfirmText") == 0 )
{
pData->curElement = ELEMENT;
MultiByteToWideChar( CP_UTF8, 0, pData->szCharData, -1, pData->curDifficultySettings.szConfirmText, sizeof(pData->curDifficultySettings.szConfirmText)/sizeof(pData->curDifficultySettings.szConfirmText[0]) );
pData->curDifficultySettings.szConfirmText[sizeof(pData->curDifficultySettings.szConfirmText)/sizeof(pData->curDifficultySettings.szConfirmText[0]) - 1] = '\0';
}
else if(strcmp(name, "StartingCash") == 0)
{
pData->curElement = ELEMENT;
pData->curDifficultySettings.iStartingCash = (INT32) atol(pData->szCharData);
}
else if(strcmp(name, "EnemyAPBonus") == 0)
{
pData->curElement = ELEMENT;
pData->curDifficultySettings.iEnemyAPBonus = (INT8) atol(pData->szCharData);
}
else if(strcmp(name, "NumKillsPerProgressPoint") == 0)
{
pData->curElement = ELEMENT;
pData->curDifficultySettings.iNumKillsPerProgressPoint = (UINT16) atol(pData->szCharData);
}
else if(strcmp(name, "InitialGarrisonPercentages") == 0)
{
pData->curElement = ELEMENT;
pData->curDifficultySettings.iInitialGarrisonPercentages = (INT32) atol(pData->szCharData);
}
else if(strcmp(name, "MinEnemyGroupSize") == 0)
{
pData->curElement = ELEMENT;
pData->curDifficultySettings.iMinEnemyGroupSize = (UINT8) atol(pData->szCharData);
}
else if(strcmp(name, "PercentElitesBonus") == 0)
{
pData->curElement = ELEMENT;
pData->curDifficultySettings.iPercentElitesBonus = (INT32) atol(pData->szCharData);
}
else if(strcmp(name, "UnlimitedPoolOfTroops") == 0)
{
pData->curElement = ELEMENT;
pData->curDifficultySettings.bUnlimitedPoolOfTroops = (BOOLEAN) atol(pData->szCharData);
}
else if(strcmp(name, "QueensInitialPoolOfTroops") == 0)
{
pData->curElement = ELEMENT;
pData->curDifficultySettings.iQueensInitialPoolOfTroops = (INT32) atol(pData->szCharData);
}
else if(strcmp(name, "QueenPoolIncrementPerDifficultyLevel") == 0)
{
pData->curElement = ELEMENT;
pData->curDifficultySettings.iQueenPoolIncrementPerDifficultyLevel = (UINT32) atol(pData->szCharData);
}
else if(strcmp(name, "EnemyStartingAlertLevel") == 0)
{
pData->curElement = ELEMENT;
pData->curDifficultySettings.iEnemyStartingAlertLevel = (UINT32) atol(pData->szCharData);
}
else if(strcmp(name, "EnemyAlertDecay") == 0)
{
pData->curElement = ELEMENT;
pData->curDifficultySettings.iEnemyAlertDecay = (UINT32) atol(pData->szCharData);
}
else if(strcmp(name, "NumAwareBattles") == 0)
{
pData->curElement = ELEMENT;
pData->curDifficultySettings.iNumAwareBattles = (UINT32) atol(pData->szCharData);
}
else if(strcmp(name, "BaseDelayInMinutesBetweenEvaluations") == 0)
{
pData->curElement = ELEMENT;
pData->curDifficultySettings.iBaseDelayInMinutesBetweenEvaluations = (UINT32) atol(pData->szCharData);
}
else if(strcmp(name, "EvaluationDelayVariance") == 0)
{
pData->curElement = ELEMENT;
pData->curDifficultySettings.iEvaluationDelayVariance = (UINT32) atol(pData->szCharData);
}
else if(strcmp(name, "GracePeriodInHoursAfterSectorLiberation") == 0)
{
pData->curElement = ELEMENT;
pData->curDifficultySettings.iGracePeriodInHoursAfterSectorLiberation = (UINT32) atol(pData->szCharData);
}
else if(strcmp(name, "GracePeriodInDaysAfterPatrolDestroyed") == 0)
{
pData->curElement = ELEMENT;
pData->curDifficultySettings.iGracePeriodInDaysAfterPatrolDestroyed = (UINT32) atol(pData->szCharData);
}
else if(strcmp(name, "AggressiveQueenAi") == 0)
{
pData->curElement = ELEMENT;
pData->curDifficultySettings.bAggressiveQueenAi = (BOOLEAN) atol(pData->szCharData);
}
else if(strcmp(name, "MaxMercDeaths") == 0)
{
pData->curElement = ELEMENT;
pData->curDifficultySettings.iMaxMercDeaths = (INT32) atol(pData->szCharData);
}
//Creatures Settings
else if(strcmp(name, "CreatureSpreadTime") == 0)
{
pData->curElement = ELEMENT;
pData->curDifficultySettings.iCreatureSpreadTime = (UINT16) atol(pData->szCharData);
}
else if(strcmp(name, "QueenReproductionBase") == 0)
{
pData->curElement = ELEMENT;
pData->curDifficultySettings.iQueenReproductionBase = (UINT8) atol(pData->szCharData);
}
else if(strcmp(name, "QueenReproductionBonus") == 0)
{
pData->curElement = ELEMENT;
pData->curDifficultySettings.iQueenReproductionBonus = (UINT8) atol(pData->szCharData);
}
else if(strcmp(name, "QueenInitBonusSpread") == 0)
{
pData->curElement = ELEMENT;
pData->curDifficultySettings.iQueenInitBonusSpread = (UINT8) atol(pData->szCharData);
}
else if(strcmp(name, "CreaturePopulationModifier") == 0)
{
pData->curElement = ELEMENT;
pData->curDifficultySettings.iCreaturePopulationModifier = (INT8) atol(pData->szCharData);
}
else if(strcmp(name, "CreatureTownAggressiveness") == 0)
{
pData->curElement = ELEMENT;
pData->curDifficultySettings.iCreatureTownAggressiveness = (INT8) atol(pData->szCharData);
}
//sectors
else if(strcmp(name, "SectorJ9B1NumTroops") == 0)
{
pData->curElement = ELEMENT;
pData->curDifficultySettings.iJ9B1NumTroops = (UINT8) atol(pData->szCharData);
}
else if(strcmp(name, "SectorJ9B2NumCreatures") == 0)
{
pData->curElement = ELEMENT;
pData->curDifficultySettings.iJ9B2NumCreatures = (UINT8) atol(pData->szCharData);
}
else if(strcmp(name, "SectorK4B1NumTroops") == 0)
{
pData->curElement = ELEMENT;
pData->curDifficultySettings.iK4B1NumTroops = (UINT8) atol(pData->szCharData);
}
else if(strcmp(name, "SectorK4B1NumElites") == 0)
{
pData->curElement = ELEMENT;
pData->curDifficultySettings.iK4B1NumElites = (UINT8) atol(pData->szCharData);
}
else if(strcmp(name, "SectorO3B1NumTroops") == 0)
{
pData->curElement = ELEMENT;
pData->curDifficultySettings.iO3B1NumTroops = (UINT8) atol(pData->szCharData);
}
else if(strcmp(name, "SectorO3B1NumElites") == 0)
{
pData->curElement = ELEMENT;
pData->curDifficultySettings.iO3B1NumElites = (UINT8) atol(pData->szCharData);
}
else if(strcmp(name, "SectorP3B1NumElites") == 0)
{
pData->curElement = ELEMENT;
pData->curDifficultySettings.iP3B1NumElites = (UINT8) atol(pData->szCharData);
}
//Sector
else if(strcmp(name, "StrategicAiActionWakeQueen") == 0)
{
pData->curElement = ELEMENT;
pData->curDifficultySettings.bStrategicAiActionWakeQueen = (BOOLEAN) atol(pData->szCharData);
}
else if(strcmp(name, "UpdateLastDayOfPlayerActivity") == 0)
{
pData->curElement = ELEMENT;
pData->curDifficultySettings.iUpdateLastDayOfPlayerActivity = (UINT16) atol(pData->szCharData);
}
else if(strcmp(name, "ChanceOfEnemyAmbushes") == 0)
{
pData->curElement = ELEMENT;
pData->curDifficultySettings.iChanceOfEnemyAmbushes = (INT32) atol(pData->szCharData);
}
else if(strcmp(name, "AllowReinforcements") == 0)
{
pData->curElement = ELEMENT;
pData->curDifficultySettings.bAllowReinforcements = (BOOLEAN) atol(pData->szCharData);
}
else if(strcmp(name, "AllowReinforcementsOmerta") == 0)
{
pData->curElement = ELEMENT;
pData->curDifficultySettings.bAllowReinforcementsOmerta = (BOOLEAN) atol(pData->szCharData);
}
else if(strcmp(name, "PopulationLevel2") == 0)
{
pData->curElement = ELEMENT;
pData->curDifficultySettings.iDesiredPopulationL2 = (BOOLEAN) atol(pData->szCharData);
}
else if(strcmp(name, "PopulationLevel3") == 0)
{
pData->curElement = ELEMENT;
pData->curDifficultySettings.iDesiredPopulationL3 = (BOOLEAN) atol(pData->szCharData);
}
else if(strcmp(name, "WeaponCacheTroops1") == 0)
{
pData->curElement = ELEMENT;
pData->curDifficultySettings.iWeaponCacheTroops1 = (UINT8) atol(pData->szCharData);
}
else if(strcmp(name, "WeaponCacheTroops2") == 0)
{
pData->curElement = ELEMENT;
pData->curDifficultySettings.iWeaponCacheTroops2 = (UINT8) atol(pData->szCharData);
}
else if(strcmp(name, "WeaponCacheTroops3") == 0)
{
pData->curElement = ELEMENT;
pData->curDifficultySettings.iWeaponCacheTroops3 = (UINT8) atol(pData->szCharData);
}
else if(strcmp(name, "WeaponCacheTroops4") == 0)
{
pData->curElement = ELEMENT;
pData->curDifficultySettings.iWeaponCacheTroops4 = (UINT8) atol(pData->szCharData);
}
else if(strcmp(name, "WeaponCacheTroops5") == 0)
{
pData->curElement = ELEMENT;
pData->curDifficultySettings.iWeaponCacheTroops5 = (UINT8) atol(pData->szCharData);
}
else if(strcmp(name, "UpgradeAdminsToTroops") == 0)
{
pData->curElement = ELEMENT;
pData->curDifficultySettings.bUpgradeAdminsToTroops2 = (BOOLEAN) atol(pData->szCharData);
}
else if(strcmp(name, "UpgradeGarrisonsAdminsToTroops") == 0)
{
pData->curElement = ELEMENT;
pData->curDifficultySettings.bUpgradeAdminsToTroops = (BOOLEAN) atol(pData->szCharData);
}
else if(strcmp(name, "QueenAttackLosingControlOfSector") == 0)
{
pData->curElement = ELEMENT;
pData->curDifficultySettings.bQueenLosingControlOfSector = (BOOLEAN) atol(pData->szCharData);
}
else if(strcmp(name, "BloodcatAmbushSectors") == 0)
{
pData->curElement = ELEMENT;
pData->curDifficultySettings.bBloodcatAmbush = (BOOLEAN) atol(pData->szCharData);
}
else if(strcmp(name, "AirRaidLookForDive") == 0)
{
pData->curElement = ELEMENT;
pData->curDifficultySettings.bAirRaidLookForDive = (BOOLEAN) atol(pData->szCharData);
}
else if(strcmp(name, "NumberOfTurnsPowerGenFanWillBeStoppedFor") == 0)
{
pData->curElement = ELEMENT;
pData->curDifficultySettings.iGetNumberOfTurnsPowerGenFanWillBeStoppedFor = (UINT32) atol(pData->szCharData);
}
else if(strcmp(name, "RadioSightings") == 0)
{
pData->curElement = ELEMENT;
pData->curDifficultySettings.bRadioSightings = (BOOLEAN) atol(pData->szCharData);
}
else if(strcmp(name, "RadioSightings2") == 0)
{
pData->curElement = ELEMENT;
pData->curDifficultySettings.bRadioSightings2 = (BOOLEAN) atol(pData->szCharData);
}
else if(strcmp(name, "EnemyMoraleWorried") == 0)
{
pData->curElement = ELEMENT;
pData->curDifficultySettings.bEnemyMoraleWorried = (BOOLEAN) atol(pData->szCharData);
}
else if(strcmp(name, "CthConstantsAimDifficulty") == 0)
{
pData->curElement = ELEMENT;
pData->curDifficultySettings.NewDifficualtySetingsAIM_DIFFICULTY = (FLOAT) atol(pData->szCharData);
}
else if(strcmp(name, "CthConstantsBaseDifficulty") == 0)
{
pData->curElement = ELEMENT;
pData->curDifficultySettings.NewDifficualtySetingsBASE_DIFFICULTY = (FLOAT) atol(pData->szCharData);
}
pData->maxReadDepth--;
}
pData->currentDepth--;
}
BOOLEAN ReadInDifficultySettings( STR fileName, BOOLEAN localizedVersion)
{
HWFILE hFile;
UINT32 uiBytesRead;
UINT32 uiFSize;
CHAR8 * lpcBuffer;
XML_Parser parser = XML_ParserCreate(NULL);
difficultySettingsParseData pData;
MaxDifficultySettingsValues = 0;
DebugMsg(TOPIC_JA2, DBG_LEVEL_3, "Loading DifficultySettings.xml" );
DifficultySettings_TextOnly = localizedVersion;
// Open file
hFile = FileOpen( fileName, FILE_ACCESS_READ, FALSE );
if ( !hFile )
return( localizedVersion );
uiFSize = FileGetSize(hFile);
lpcBuffer = (CHAR8 *) MemAlloc(uiFSize+1);
//Read in block
if ( !FileRead( hFile, lpcBuffer, uiFSize, &uiBytesRead ) )
{
MemFree(lpcBuffer);
return( FALSE );
}
lpcBuffer[uiFSize] = 0; //add a null terminator
FileClose( hFile );
XML_SetElementHandler(parser, DifficultySettingsParseDataStartElementHandle, difficultySettingsEndElementHandle);
XML_SetCharacterDataHandler(parser, DifficultySettingsDataHandle);
memset(&pData,0,sizeof(pData));
XML_SetUserData(parser, &pData);
if(!XML_Parse(parser, lpcBuffer, uiFSize, TRUE))
{
CHAR8 errorBuf[511];
sprintf(errorBuf, "XML Parser Error in DifficultySettings.xml: %s at line %d", XML_ErrorString(XML_GetErrorCode(parser)), XML_GetCurrentLineNumber(parser));
LiveMessage(errorBuf);
MemFree(lpcBuffer);
return FALSE;
}
MemFree(lpcBuffer);
XML_ParserFree(parser);
MaxDifficultySettingsValues--;
return( TRUE );
}
#endif
+5
View File
@@ -11,6 +11,11 @@
// https://ja2svn.dyndns.org/source/ja2/trunk/Documents/1.13%20Modding/Modding%20Examples
#define ENABLE_BRIEFINGROOM
//----- Externalized difficulty settings to "TableData\DifficultySettings.xml" - by Jazz -----
// Once enabled here, the game reads up to 15 difficulty settings from the xml file
// INFO: Some INI Settings (ja2_options.ini, CTHConstants.ini and Creature_Settings.ini moved to the xml file)
#define DIFFICULTY_SETTING
// -----------------------------
// *****************************
// WANNE: Enable those 2 defines, if you want to build UB-Version!!
+4
View File
@@ -568,6 +568,10 @@
RelativePath=".\ub_config.cpp"
>
</File>
<File
RelativePath=".\XML_DifficultySettings.cpp"
>
</File>
<File
RelativePath=".\XML_IntroFiles.cpp"
>
+4
View File
@@ -786,6 +786,10 @@
RelativePath=".\ub_config.cpp"
>
</File>
<File
RelativePath=".\XML_DifficultySettings.cpp"
>
</File>
<File
RelativePath=".\XML_IntroFiles.cpp"
>
+1
View File
@@ -261,6 +261,7 @@
<ClCompile Include="SCREENS.cpp" />
<ClCompile Include="Sys Globals.cpp" />
<ClCompile Include="ub_config.cpp" />
<ClCompile Include="XML_DifficultySettings.cpp" />
<ClCompile Include="XML_IntroFiles.cpp" />
<ClCompile Include="XML_Layout_MainMenu.cpp" />
</ItemGroup>
+3
View File
@@ -129,6 +129,9 @@
<ClCompile Include="ub_config.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="XML_DifficultySettings.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="builddefines.h">
+1
View File
@@ -276,6 +276,7 @@
<ClCompile Include="SCREENS.cpp" />
<ClCompile Include="Sys Globals.cpp" />
<ClCompile Include="ub_config.cpp" />
<ClCompile Include="XML_DifficultySettings.cpp" />
<ClCompile Include="XML_IntroFiles.cpp" />
<ClCompile Include="XML_Layout_MainMenu.cpp" />
</ItemGroup>
+3
View File
@@ -128,6 +128,9 @@
</ClCompile>
<ClCompile Include="ub_config.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="XML_DifficultySettings.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
+17
View File
@@ -73,6 +73,10 @@
#include "Ja25Update.h"
#endif
#ifdef DIFFICULTY_SETTING
#include "GameInitOptionsScreen.h"
#endif
#include "ub_config.h" //legion2
#include "Campaign Types.h"
#include "Interface.h"
@@ -138,6 +142,12 @@ UINT8 ubNumTanks = 0;
ubNumElites = 6 + Random( 3 );
SetNumberJa25EnemiesInSector( SectorX, SectorY, Level, ubNumAdmins, ubNumTroops, ubNumElites, ubNumTanks );
break;
default:
ubNumAdmins = Random( 0 );
ubNumTroops = 10 + Random( 5 );
ubNumElites = Random( 4 );
SetNumberJa25EnemiesInSector( SectorX, SectorY, Level, ubNumAdmins, ubNumTroops, ubNumElites, ubNumTanks );
break
}
}
}
@@ -172,6 +182,13 @@ UINT8 ubNumTanks = 0;
ubNumElites = 6 + Random( 3 );
SetNumberJa25EnemiesInSector( SectorX, SectorY, Level, ubNumAdmins, ubNumTroops, ubNumElites, ubNumTanks );
break;
default:
ubNumAdmins = Random( 0 );
ubNumTroops = 10 + Random( 5 );
ubNumElites = Random( 4 );
SetNumberJa25EnemiesInSector( SectorX, SectorY, Level, ubNumAdmins, ubNumTroops, ubNumElites, ubNumTanks );
break;
break;
}
}
}