From 30710d52289b2019c8ca351b27a5a14cf002d723 Mon Sep 17 00:00:00 2001 From: lalien Date: Sun, 21 May 2006 00:07:05 +0000 Subject: [PATCH] Little Alien - Externalized settings for Madlab quest, Mike and Iggy - Externalized visibility decrease for rain Madd Mugsy - Bug fix - "Auto" mode was turning off on Full Auto only weapons when you equipped a second gun - Fixed - 10 Tons of Guns code now affects EnemyGunChoices and EnemyItemChoices - Enemy reinforcements restricted from appearing in Omerta git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@75 3b4a5df2-a311-0410-b5c6-a8a6f20db521 --- GameSettings.cpp | 6 ++++++ GameSettings.h | 19 ++++++++++++----- GameVersion.cpp | 2 +- JA2.vcproj | 4 ++-- Laptop/BobbyRGuns.cpp | 3 +++ Strategic/Reinforcement.cpp | 6 ++++++ Tactical/Campaign.cpp | 6 +++--- Tactical/Inventory Choosing.cpp | 38 ++++++++++++++++++++++++++------- Tactical/Soldier Control.cpp | 2 +- Tactical/opplist.cpp | 4 ++-- 10 files changed, 68 insertions(+), 22 deletions(-) diff --git a/GameSettings.cpp b/GameSettings.cpp index c527eabfd..e04f6708a 100644 --- a/GameSettings.cpp +++ b/GameSettings.cpp @@ -360,6 +360,7 @@ void LoadGameExternalOptions() //Sight range gGameExternalOptions.ubStraightSightRange = iniReader.ReadInteger("JA2 Tactical Settings","BaseSightRange",13); + gGameExternalOptions.ubVisDistDecreasePerRainIntensity = iniReader.ReadInteger("JA2 Tactical Settings","VISUAL_DISTANCE_DECREASE_PER_RAIN_INTENSITY",20); // Maximal search distance for grenades //gGameExternalOptions.guiMaxTossSearchDist = iniReader.ReadInteger("JA2 Tactical Settings","MaxTossSearchDist",3); @@ -379,6 +380,11 @@ void LoadGameExternalOptions() gGameExternalOptions.guiMaxDLInterval = iniReader.ReadInteger("JA2 Thunder Settings","MAX_INTERVAL_BETWEEN_LIGHTNING_AND_THUNDERCLAPS_IN_SECONDS",5); gGameExternalOptions.guiProlongLightningIfSeenSomeone = iniReader.ReadInteger("JA2 Thunder Settings","PROLOGNE_DELAY_IF_SEEN_SOMEONE_DURING_LIGHTNING_IN_TURNBASED_IN_SECONDS",5); gGameExternalOptions.guiChanceToDoLightningBetweenTurns = iniReader.ReadInteger("JA2 Thunder Settings","CHANCE_TO_DO_LIGHTNING_BETWEEN_TURNS",35); + + //Gameplay settings + gGameExternalOptions.ubGameProgressStartMadlabQuest = iniReader.ReadInteger("JA2 Gameplay Settings","GAME_PROGRESS_START_MADLAB_QUEST",35); + gGameExternalOptions.ubGameProgressMikeAvailable = iniReader.ReadInteger("JA2 Gameplay Settings","GAME_PROGRESS_MIKE_AVALIABLE",50); + gGameExternalOptions.ubGameProgressIggyAvaliable = iniReader.ReadInteger("JA2 Gameplay Settings","GAME_PROGRESS_IGGY_AVALIABLE",70); } diff --git a/GameSettings.h b/GameSettings.h index 90e393442..39ab0c363 100644 --- a/GameSettings.h +++ b/GameSettings.h @@ -180,14 +180,14 @@ typedef struct // Moved from NewGameSettings.cpp - //Video settings - UINT8 gubDeadLockDelay; - UINT8 ubStraightSightRange; - // System settings - BOOLEAN gfVSync; + UINT8 gubDeadLockDelay; BOOLEAN gfEnableEmergencyButton_SkipStrategicEvents; + + //Video settings + BOOLEAN gfVSync; + //Animation settings UINT8 gubPlayerTurnSpeedUpFactor; UINT8 gubEnemyTurnSpeedUpFactor; @@ -205,6 +205,10 @@ typedef struct BOOLEAN gfAllowReinforcments; BOOLEAN gfAllowReinforcmentsOnlyInCity; UINT32 guiBaseQueenPoolIncrement; + + //Sight range + UINT8 ubStraightSightRange; + UINT32 ubVisDistDecreasePerRainIntensity; // Rain settings BOOLEAN gfAllowRain; @@ -221,6 +225,11 @@ typedef struct UINT32 guiProlongLightningIfSeenSomeone; UINT32 guiChanceToDoLightningBetweenTurns; + //Gameplay settings + UINT8 ubGameProgressStartMadlabQuest; + UINT8 ubGameProgressMikeAvailable; + UINT8 ubGameProgressIggyAvaliable; + } GAME_EXTERNAL_OPTIONS; //This structure will contain general Ja2 settings NOT individual game settings. diff --git a/GameVersion.cpp b/GameVersion.cpp index 705c3707b..d60ceecf7 100644 --- a/GameVersion.cpp +++ b/GameVersion.cpp @@ -28,7 +28,7 @@ INT16 zVersionLabel[256] = { L"Beta v. 0.98" }; #endif -INT8 czVersionNumber[16] = { "Build 06.05.18" }; +INT8 czVersionNumber[16] = { "Build 06.05.20" }; INT16 zTrackingNumber[16] = { L"Z" }; diff --git a/JA2.vcproj b/JA2.vcproj index fc5231757..792ffbf0e 100644 --- a/JA2.vcproj +++ b/JA2.vcproj @@ -43,7 +43,7 @@ = 35 && gStrategicStatus.ubHighestProgress < 35 ) + if ( ubCurrentProgress >= gGameExternalOptions.ubGameProgressStartMadlabQuest && gStrategicStatus.ubHighestProgress < gGameExternalOptions.ubGameProgressStartMadlabQuest ) { HandleScientistAWOLMeanwhileScene(); } // at 50% make Mike available to the strategic AI - if ( ubCurrentProgress >= 50 && gStrategicStatus.ubHighestProgress < 50 ) + if ( ubCurrentProgress >= gGameExternalOptions.ubGameProgressMikeAvailable && gStrategicStatus.ubHighestProgress < gGameExternalOptions.ubGameProgressMikeAvailable ) { SetFactTrue( FACT_MIKE_AVAILABLE_TO_ARMY ); } // at 70% add Iggy to the world - if ( ubCurrentProgress >= 70 && gStrategicStatus.ubHighestProgress < 70 ) + if ( ubCurrentProgress >= gGameExternalOptions.ubGameProgressIggyAvaliable && gStrategicStatus.ubHighestProgress < gGameExternalOptions.ubGameProgressIggyAvaliable ) { gMercProfiles[ IGGY ].sSectorX = 5; gMercProfiles[ IGGY ].sSectorY = MAP_ROW_C; diff --git a/Tactical/Inventory Choosing.cpp b/Tactical/Inventory Choosing.cpp index e0ab091e6..75ae8293d 100644 --- a/Tactical/Inventory Choosing.cpp +++ b/Tactical/Inventory Choosing.cpp @@ -2533,8 +2533,8 @@ void ReplaceExtendedGuns( SOLDIERCREATE_STRUCT *pp, INT8 bSoldierClass ) UINT16 SelectStandardArmyGun( UINT8 uiGunLevel ) { ARMY_GUN_CHOICE_TYPE *pGunChoiceTable; - UINT32 uiChoice; - UINT16 usGunIndex; + int uiChoice; + int usGunIndex; // pick the standard army gun for this weapon class from table // usGunIndex = gStrategicStatus.ubStandardArmyGunIndex[uiGunLevel]; @@ -2554,10 +2554,28 @@ UINT16 SelectStandardArmyGun( UINT8 uiGunLevel ) //} // choose one the of the possible gun choices - uiChoice = Random(pGunChoiceTable[ uiGunLevel ].ubChoices); - usGunIndex = pGunChoiceTable[ uiGunLevel ].bItemNo[ uiChoice ]; + usGunIndex = -1; - Assert(usGunIndex); + while (usGunIndex == -1) + { + uiChoice = Random(pGunChoiceTable[ uiGunLevel ].ubChoices); + usGunIndex = pGunChoiceTable[ uiGunLevel ].bItemNo[ uiChoice ]; + + if (!ItemIsLegal(usGunIndex)) //Madd: check for 10 tons of guns + usGunIndex = -1; + + if (usGunIndex == -1) + { + //Madd: there better be something from the original JA2 guns here somewhere (biggunlist=0) or else this will probably cause an endless loop + if ( uiGunLevel < ARMY_GUN_LEVELS ) + uiGunLevel++; + else + uiGunLevel--; + } + + } + + //Assert(usGunIndex); return(usGunIndex); } @@ -2638,7 +2656,7 @@ UINT16 PickARandomItem(UINT8 typeIndex, UINT8 maxCoolness, BOOLEAN getMatchingCo } usItem = gArmyItemChoices[ typeIndex ].bItemNo[ uiChoice ]; - if ( usItem >= 0 && Item[usItem].ubCoolness <= maxCoolness ) + if ( usItem >= 0 && Item[usItem].ubCoolness <= maxCoolness && ItemIsLegal(usItem) ) { // pick a default item in case we don't find anything with a matching coolness, but pick the coolest item we can find if ( defaultItem == 0 || Item[usItem].ubCoolness > Item[defaultItem].ubCoolness ) @@ -2685,12 +2703,16 @@ UINT16 PickARandomAttachment(UINT8 typeIndex, UINT16 usBaseItem, UINT8 maxCoolne if ( Item[usItem].ubCoolness == maxCoolness || !getMatchingCoolness ) { // DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("PickARandomAttachment: baseItem = %d, usItem = %d",usBaseItem, usItem)); - return usItem; + if (ItemIsLegal(usItem)) + return usItem; } } } // couldn't find anything with the exact matching coolness, so return the best item we did find // DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("PickARandomAttachment: baseItem = %d, defaultItem = %d",usBaseItem, defaultItem)); - return defaultItem; + if (ItemIsLegal(usItem)) + return defaultItem; + else + return 0; } diff --git a/Tactical/Soldier Control.cpp b/Tactical/Soldier Control.cpp index a3c716ad9..31d14f47b 100644 --- a/Tactical/Soldier Control.cpp +++ b/Tactical/Soldier Control.cpp @@ -9352,7 +9352,7 @@ void ReLoadSoldierAnimationDueToHandItemChange( SOLDIERTYPE *pSoldier, UINT16 us // Shutoff burst.... // ( we could be on, then change gun that does not have burst ) - if ( Weapon[ usNewItem ].ubShotsPerBurst == 0 && !Weapon[usNewItem].NoSemiAuto ) + if ( Weapon[ usNewItem ].ubShotsPerBurst == 0 && !Weapon[pSoldier->inv[HANDPOS].usItem ].NoSemiAuto ) { pSoldier->bDoBurst = FALSE; pSoldier->bWeaponMode = WM_NORMAL; diff --git a/Tactical/opplist.cpp b/Tactical/opplist.cpp index 2aa5ab5c4..a26718f45 100644 --- a/Tactical/opplist.cpp +++ b/Tactical/opplist.cpp @@ -45,7 +45,7 @@ #endif //rain -#define VIS_DIST_DECREASE_PER_RAIN_INTENSITY 20 +//#define VIS_DIST_DECREASE_PER_RAIN_INTENSITY 20 //end rain #define WE_SEE_WHAT_MILITIA_SEES_AND_VICE_VERSA @@ -312,7 +312,7 @@ INT16 AdjustMaxSightRangeForEnvEffects( SOLDIERTYPE *pSoldier, INT8 bLightLevel, { //sNewDist = sNewDist * 70 / 100; //rain - sNewDist = sNewDist * ( 100 - VIS_DIST_DECREASE_PER_RAIN_INTENSITY * gbCurrentRainIntensity ) / 100; + sNewDist = sNewDist * ( 100 - gGameExternalOptions.ubVisDistDecreasePerRainIntensity * gbCurrentRainIntensity ) / 100; //end rain }