diff --git a/Editor/Editor Taskbar Utils.cpp b/Editor/Editor Taskbar Utils.cpp index 8dfdfb8d..65c5070e 100644 --- a/Editor/Editor Taskbar Utils.cpp +++ b/Editor/Editor Taskbar Utils.cpp @@ -679,6 +679,14 @@ void RenderMapEntryPointsAndLights() { if( LightSprites[ i ].uiFlags & LIGHT_SPR_ACTIVE ) { + // Check for light out of bounds. This actually happens in Drassen. + if (LightSprites[ i ].iY < 0 || LightSprites[ i ].iY > WORLD_ROWS || + LightSprites[ i ].iX < 0 || LightSprites[ i ].iX > WORLD_COLS) + { + LightSprites[ i ].uiFlags &= (~LIGHT_SPR_ACTIVE); + continue; + } + sGridNo = LightSprites[ i ].iY * WORLD_COLS + LightSprites[ i ].iX; GetGridNoScreenPos( sGridNo, 0, &sScreenX, &sScreenY ); if( sScreenY >= (- 50) && sScreenY < (2 * iScreenHeightOffset + 300) && sScreenX >= (- 40) && sScreenX < SCREEN_WIDTH ) diff --git a/Editor/Editor Undo.cpp b/Editor/Editor Undo.cpp index 1ee763f8..5bc9af1f 100644 --- a/Editor/Editor Undo.cpp +++ b/Editor/Editor Undo.cpp @@ -591,6 +591,8 @@ BOOLEAN ExecuteUndoList( void ) { iUndoMapIndex = gpTileUndoStack->pData->iMapIndex; + fExitGrid = ExitGridAtGridNo( (UINT16)iUndoMapIndex ); + // Find which map tile we are to "undo" if( gpTileUndoStack->pData->fLightSaved ) { //We saved a light, so delete that light @@ -609,7 +611,6 @@ BOOLEAN ExecuteUndoList( void ) else { // We execute the undo command node by simply swapping the contents // of the undo's MAP_ELEMENT with the world's element. - fExitGrid = ExitGridAtGridNo( (UINT16)iUndoMapIndex ); SwapMapElementWithWorld( iUndoMapIndex, gpTileUndoStack->pData->pMapTile ); // copy the room number information back diff --git a/Editor/editscreen.cpp b/Editor/editscreen.cpp index 6e9780eb..15fbba2d 100644 --- a/Editor/editscreen.cpp +++ b/Editor/editscreen.cpp @@ -803,7 +803,7 @@ void ShowCurrentDrawingMode( void ) NewRect.iLeft = iScreenWidthOffset + 0; NewRect.iTop = 2 * iScreenHeightOffset + 400; NewRect.iRight = iScreenWidthOffset + 100; - NewRect.iBottom = 2 * iScreenWidthOffset + 458; + NewRect.iBottom = 2 * iScreenHeightOffset + 458; GetClippingRect(&ClipRect); SetClippingRect(&NewRect); diff --git a/GameSettings.cpp b/GameSettings.cpp index 8ef80618..d840ac3e 100644 --- a/GameSettings.cpp +++ b/GameSettings.cpp @@ -433,11 +433,11 @@ void LoadGameExternalOptions() gGameExternalOptions.fAllowTacticalMilitiaCommand = iniReader.ReadBoolean("JA2 Tactical Settings","ALLOW_TACTICAL_MILITIA_COMMAND",0); // Enemy AP settings - gGameExternalOptions.iEasyAPBonus = iniReader.ReadInteger("JA2 Gameplay Settings","NOVICE_AP_BONUS",0); - gGameExternalOptions.iExperiencedAPBonus = iniReader.ReadInteger("JA2 Gameplay Settings","EXPERIENCED_AP_BONUS",0); - gGameExternalOptions.iExpertAPBonus = iniReader.ReadInteger("JA2 Gameplay Settings","EXPERT_AP_BONUS",0); - gGameExternalOptions.iInsaneAPBonus = iniReader.ReadInteger("JA2 Gameplay Settings","INSANE_AP_BONUS",0); - gGameExternalOptions.iPlayerAPBonus = iniReader.ReadInteger("JA2 Gameplay Settings","PLAYER_AP_BONUS",0); + gGameExternalOptions.iEasyAPBonus = iniReader.ReadInteger("JA2 Tactical Settings","NOVICE_AP_BONUS",0); + gGameExternalOptions.iExperiencedAPBonus = iniReader.ReadInteger("JA2 Tactical Settings","EXPERIENCED_AP_BONUS",0); + gGameExternalOptions.iExpertAPBonus = iniReader.ReadInteger("JA2 Tactical Settings","EXPERT_AP_BONUS",0); + gGameExternalOptions.iInsaneAPBonus = iniReader.ReadInteger("JA2 Tactical Settings","INSANE_AP_BONUS",0); + gGameExternalOptions.iPlayerAPBonus = iniReader.ReadInteger("JA2 Tactical Settings","PLAYER_AP_BONUS",0); // Sight range gGameExternalOptions.ubStraightSightRange = iniReader.ReadInteger("JA2 Tactical Settings","BASE_SIGHT_RANGE",13); @@ -450,10 +450,37 @@ void LoadGameExternalOptions() // Soldier tool tips gGameExternalOptions.gfAllowSoldierToolTips = iniReader.ReadBoolean("JA2 Tactical Settings","ALLOW_SOLDIER_TOOL_TIPS",0); + // ShadoWarrior: Tooltip changes (start) + gGameExternalOptions.ubSoldierTooltipDetailLevel = iniReader.ReadInteger("JA2 Tactical Settings", "SOLDIER_TOOLTIP_DETAIL_LEVEL", 1); + + gGameExternalOptions.fEnableDynamicSoldierTooltips = iniReader.ReadBoolean("JA2 Tactical Settings", "DYNAMIC_SOLDIER_TOOLTIPS", TRUE); + gGameExternalOptions.fEnableSoldierTooltipLocation = iniReader.ReadBoolean("JA2 Tactical Settings", "SOLDIER_TOOLTIP_DISPLAY_LOCATION", TRUE); + gGameExternalOptions.fEnableSoldierTooltipBrightness = iniReader.ReadBoolean("JA2 Tactical Settings", "SOLDIER_TOOLTIP_DISPLAY_BRIGHTNESS", TRUE); + gGameExternalOptions.fEnableSoldierTooltipRangeToTarget = iniReader.ReadBoolean("JA2 Tactical Settings", "SOLDIER_TOOLTIP_DISPLAY_RANGE_TO_TARGET", TRUE); + gGameExternalOptions.fEnableSoldierTooltipID = iniReader.ReadBoolean("JA2 Tactical Settings", "SOLDIER_TOOLTIP_DISPLAY_ID", TRUE); + gGameExternalOptions.fEnableSoldierTooltipOrders = iniReader.ReadBoolean("JA2 Tactical Settings", "SOLDIER_TOOLTIP_DISPLAY_ORDERS", TRUE); + gGameExternalOptions.fEnableSoldierTooltipAttitude = iniReader.ReadBoolean("JA2 Tactical Settings", "SOLDIER_TOOLTIP_DISPLAY_ATTITUDE", TRUE); + gGameExternalOptions.fEnableSoldierTooltipActionPoints = iniReader.ReadBoolean("JA2 Tactical Settings", "SOLDIER_TOOLTIP_DISPLAY_ACTIONPOINTS", TRUE); + gGameExternalOptions.fEnableSoldierTooltipHealth = iniReader.ReadBoolean("JA2 Tactical Settings", "SOLDIER_TOOLTIP_DISPLAY_HEALTH", TRUE); + gGameExternalOptions.fEnableSoldierTooltipHelmet = iniReader.ReadBoolean("JA2 Tactical Settings", "SOLDIER_TOOLTIP_DISPLAY_HELMET", TRUE); + gGameExternalOptions.fEnableSoldierTooltipVest = iniReader.ReadBoolean("JA2 Tactical Settings", "SOLDIER_TOOLTIP_DISPLAY_VEST", TRUE); + gGameExternalOptions.fEnableSoldierTooltipLeggings = iniReader.ReadBoolean("JA2 Tactical Settings", "SOLDIER_TOOLTIP_DISPLAY_LEGGINGS", TRUE); + gGameExternalOptions.fEnableSoldierTooltipHeadItem1 = iniReader.ReadBoolean("JA2 Tactical Settings", "SOLDIER_TOOLTIP_DISPLAY_HEAD_SLOT_1", TRUE); + gGameExternalOptions.fEnableSoldierTooltipHeadItem2 = iniReader.ReadBoolean("JA2 Tactical Settings", "SOLDIER_TOOLTIP_DISPLAY_HEAD_SLOT_2", TRUE); + gGameExternalOptions.fEnableSoldierTooltipWeapon = iniReader.ReadBoolean("JA2 Tactical Settings", "SOLDIER_TOOLTIP_DISPLAY_WEAPON", TRUE); + gGameExternalOptions.fEnableSoldierTooltipSecondHand = iniReader.ReadBoolean("JA2 Tactical Settings", "SOLDIER_TOOLTIP_DISPLAY_OFF_HAND", TRUE); + gGameExternalOptions.fEnableSoldierTooltipBigSlot1 = iniReader.ReadBoolean("JA2 Tactical Settings", "SOLDIER_TOOLTIP_DISPLAY_BIG_SLOT_1", TRUE); + gGameExternalOptions.fEnableSoldierTooltipBigSlot2 = iniReader.ReadBoolean("JA2 Tactical Settings", "SOLDIER_TOOLTIP_DISPLAY_BIG_SLOT_2", TRUE); + gGameExternalOptions.fEnableSoldierTooltipBigSlot3 = iniReader.ReadBoolean("JA2 Tactical Settings", "SOLDIER_TOOLTIP_DISPLAY_BIG_SLOT_3", TRUE); + gGameExternalOptions.fEnableSoldierTooltipBigSlot4 = iniReader.ReadBoolean("JA2 Tactical Settings", "SOLDIER_TOOLTIP_DISPLAY_BIG_SLOT_4", TRUE); + // ShadoWarrior: Tooltip changes (end) + // Unload weapons & remove attachments gGameExternalOptions.gfShiftFUnloadWeapons = iniReader.ReadBoolean("JA2 Tactical Settings","SHIFT_F_UNLOAD_WEAPONS",1); gGameExternalOptions.gfShiftFRemoveAttachments = iniReader.ReadBoolean("JA2 Tactical Settings","SHIFT_F_REMOVE_ATTACHMENTS",1); + gGameExternalOptions.fEnableArmorCoverage = iniReader.ReadBoolean("JA2 Tactical Settings", "ENABLE_ARMOR_COVERAGE", FALSE); // ShadoWarrior for Captain J's armor coverage + //################# Rain Settings ################## // Rain settings @@ -553,31 +580,31 @@ void LoadGameExternalOptions() gGameExternalOptions.iPercentElitesBonusExperienced = iniReader.ReadInteger("JA2 Gameplay Settings","EXPERIENCED_ELITE_BONUS",0); gGameExternalOptions.iPercentElitesBonusExpert = iniReader.ReadInteger("JA2 Gameplay Settings","EXPERT_ELITE_BONUS",25); - gGameExternalOptions.iPercentElitesBonusInsane = iniReader.ReadInteger("JA2 Gameplay Settings","INSANE_ELITE_BONUS",25); + gGameExternalOptions.iPercentElitesBonusInsane = iniReader.ReadInteger("JA2 Gameplay Settings","INSANE_ELITE_BONUS",50); gGameExternalOptions.ubMinEnemyGroupSizeNovice = iniReader.ReadInteger("JA2 Gameplay Settings","NOVICE_MIN_ENEMY_GROUP_SIZE",3); gGameExternalOptions.ubMinEnemyGroupSizeExperienced = iniReader.ReadInteger("JA2 Gameplay Settings","EXPERIENCED_MIN_ENEMY_GROUP_SIZE",4); gGameExternalOptions.ubMinEnemyGroupSizeExpert = iniReader.ReadInteger("JA2 Gameplay Settings","EXPERT_MIN_ENEMY_GROUP_SIZE",6); gGameExternalOptions.ubMinEnemyGroupSizeInsane = iniReader.ReadInteger("JA2 Gameplay Settings","INSANE_MIN_ENEMY_GROUP_SIZE",12); - gGameExternalOptions.ubEasyEnemyStartingAlertLevel = iniReader.ReadInteger("JA2 Gameplay Settings","EASY_ENEMY_STARTING_ALERT_LEVEL", 5); + gGameExternalOptions.ubEasyEnemyStartingAlertLevel = iniReader.ReadInteger("JA2 Gameplay Settings","NOVICE_ENEMY_STARTING_ALERT_LEVEL", 5); gGameExternalOptions.ubNormalEnemyStartingAlertLevel = iniReader.ReadInteger("JA2 Gameplay Settings","NORMAL_ENEMY_STARTING_ALERT_LEVEL", 20); gGameExternalOptions.ubHardEnemyStartingAlertLevel = iniReader.ReadInteger("JA2 Gameplay Settings","HARD_ENEMY_STARTING_ALERT_LEVEL", 60); gGameExternalOptions.ubInsaneEnemyStartingAlertLevel = iniReader.ReadInteger("JA2 Gameplay Settings","INSANE_ENEMY_STARTING_ALERT_LEVEL", 80); - gGameExternalOptions.ubEasyEnemyStartingAlertDecay = iniReader.ReadInteger("JA2 Gameplay Settings","EASY_ENEMY_STARTING_ALERT_DECAY", 75); - gGameExternalOptions.ubNormalEnemyStartingAlertDecay = iniReader.ReadInteger("JA2 Gameplay Settings","NORMAL_ENEMY_STARTING_ALERT_DECAY", 50); - gGameExternalOptions.ubHardEnemyStartingAlertDecay = iniReader.ReadInteger("JA2 Gameplay Settings","HARD_ENEMY_STARTING_ALERT_DECAY", 25); + gGameExternalOptions.ubEasyEnemyStartingAlertDecay = iniReader.ReadInteger("JA2 Gameplay Settings","NOVICE_ENEMY_STARTING_ALERT_DECAY", 75); + gGameExternalOptions.ubNormalEnemyStartingAlertDecay = iniReader.ReadInteger("JA2 Gameplay Settings","EXPERIENCED_ENEMY_STARTING_ALERT_DECAY", 50); + gGameExternalOptions.ubHardEnemyStartingAlertDecay = iniReader.ReadInteger("JA2 Gameplay Settings","EXPERT_ENEMY_STARTING_ALERT_DECAY", 25); gGameExternalOptions.ubInsaneEnemyStartingAlertDecay = iniReader.ReadInteger("JA2 Gameplay Settings","INSANE_ENEMY_STARTING_ALERT_DECAY", 10); - gGameExternalOptions.ubEasyTimeEvaluateInMinutes = iniReader.ReadInteger("JA2 Gameplay Settings","EASY_TIME_EVALUATE_IN_MINUTES", 480); - gGameExternalOptions.ubNormalTimeEvaluateInMinutes = iniReader.ReadInteger("JA2 Gameplay Settings","NORMAL_TIME_EVALUATE_IN_MINUTES", 360); - gGameExternalOptions.ubHardTimeEvaluateInMinutes = iniReader.ReadInteger("JA2 Gameplay Settings","HARD_TIME_EVALUATE_IN_MINUTES", 180); + gGameExternalOptions.ubEasyTimeEvaluateInMinutes = iniReader.ReadInteger("JA2 Gameplay Settings","NOVICE_TIME_EVALUATE_IN_MINUTES", 480); + gGameExternalOptions.ubNormalTimeEvaluateInMinutes = iniReader.ReadInteger("JA2 Gameplay Settings","EXPERIENCED_TIME_EVALUATE_IN_MINUTES", 360); + gGameExternalOptions.ubHardTimeEvaluateInMinutes = iniReader.ReadInteger("JA2 Gameplay Settings","EXPERT_TIME_EVALUATE_IN_MINUTES", 180); gGameExternalOptions.ubInsaneTimeEvaluateInMinutes = iniReader.ReadInteger("JA2 Gameplay Settings","INSANE_TIME_EVALUATE_IN_MINUTES", 90); - gGameExternalOptions.ubEasyTimeEvaluateVariance = iniReader.ReadInteger("JA2 Gameplay Settings","EASY_TIME_EVALUATE_VARIANCE", 240); - gGameExternalOptions.ubNormalTimeEvaluateVariance = iniReader.ReadInteger("JA2 Gameplay Settings","NORMAL_TIME_EVALUATE_VARIANCE", 180); - gGameExternalOptions.ubHardTimeEvaluateVariance = iniReader.ReadInteger("JA2 Gameplay Settings","HARD_TIME_EVALUATE_VARIANCE", 120); + gGameExternalOptions.ubEasyTimeEvaluateVariance = iniReader.ReadInteger("JA2 Gameplay Settings","NOVICE_TIME_EVALUATE_VARIANCE", 240); + gGameExternalOptions.ubNormalTimeEvaluateVariance = iniReader.ReadInteger("JA2 Gameplay Settings","EXPERIENCED_TIME_EVALUATE_VARIANCE", 180); + gGameExternalOptions.ubHardTimeEvaluateVariance = iniReader.ReadInteger("JA2 Gameplay Settings","EXPERT_TIME_EVALUATE_VARIANCE", 120); gGameExternalOptions.ubInsaneTimeEvaluateVariance = iniReader.ReadInteger("JA2 Gameplay Settings","INSANE_TIME_EVALUATE_VARIANCE", 60); gGameExternalOptions.ubEasyGracePeriodInHours = iniReader.ReadInteger("JA2 Gameplay Settings","EASY_GRACE_PERIOD_IN_HOURS", 144); @@ -585,14 +612,14 @@ void LoadGameExternalOptions() gGameExternalOptions.ubHardGracePeriodInHours = iniReader.ReadInteger("JA2 Gameplay Settings","HARD_GRACE_PERIOD_IN_HOURS", 48); gGameExternalOptions.ubInsaneGracePeriodInHours = iniReader.ReadInteger("JA2 Gameplay Settings","INSANE_GRACE_PERIOD_IN_HOURS", 6); - gGameExternalOptions.ubEasyPatrolGracePeriodInDays = iniReader.ReadInteger("JA2 Gameplay Settings","EASY_PATROL_GRACE_PERIOD_IN_DAYS", 16); - gGameExternalOptions.ubNormalPatrolGracePeriodInDays = iniReader.ReadInteger("JA2 Gameplay Settings","NORMAL_PATROL_GRACE_PERIOD_IN_DAYS", 12); - gGameExternalOptions.ubHardPatrolGracePeriodInDays = iniReader.ReadInteger("JA2 Gameplay Settings","HARD_PATROL_GRACE_PERIOD_IN_DAYS", 8); + gGameExternalOptions.ubEasyPatrolGracePeriodInDays = iniReader.ReadInteger("JA2 Gameplay Settings","NOVICE_PATROL_GRACE_PERIOD_IN_DAYS", 16); + gGameExternalOptions.ubNormalPatrolGracePeriodInDays = iniReader.ReadInteger("JA2 Gameplay Settings","EXPERIENCED_PATROL_GRACE_PERIOD_IN_DAYS", 12); + gGameExternalOptions.ubHardPatrolGracePeriodInDays = iniReader.ReadInteger("JA2 Gameplay Settings","EXPERT_PATROL_GRACE_PERIOD_IN_DAYS", 8); gGameExternalOptions.ubInsanePatrolGracePeriodInDays = iniReader.ReadInteger("JA2 Gameplay Settings","INSANE_PATROL_GRACE_PERIOD_IN_DAYS", 2); - gGameExternalOptions.ubEasyNumAwareBattles = iniReader.ReadInteger("JA2 Gameplay Settings","EASY_NUM_AWARE_BATTLES", 1); - gGameExternalOptions.ubNormalNumAwareBattles = iniReader.ReadInteger("JA2 Gameplay Settings","NORMAL_NUM_AWARE_BATTLES", 2); - gGameExternalOptions.ubHardNumAwareBattles = iniReader.ReadInteger("JA2 Gameplay Settings","HARD_NUM_AWARE_BATTLES", 3); + gGameExternalOptions.ubEasyNumAwareBattles = iniReader.ReadInteger("JA2 Gameplay Settings","NOVICE_NUM_AWARE_BATTLES", 1); + gGameExternalOptions.ubNormalNumAwareBattles = iniReader.ReadInteger("JA2 Gameplay Settings","EXPERIENCED_NUM_AWARE_BATTLES", 2); + gGameExternalOptions.ubHardNumAwareBattles = iniReader.ReadInteger("JA2 Gameplay Settings","EXPERT_NUM_AWARE_BATTLES", 3); gGameExternalOptions.ubInsaneNumAwareBattles = iniReader.ReadInteger("JA2 Gameplay Settings","INSANE_NUM_AWARE_BATTLES", 4); //New v1.13 settings @@ -681,33 +708,6 @@ void LoadGameExternalOptions() // Kaiden: Vehicle Inventory change - Added INI file Option VEHICLE_INVENTORY gGameExternalOptions.fVehicleInventory = iniReader.ReadBoolean("JA2 Gameplay Settings", "VEHICLE_INVENTORY", TRUE); - gGameExternalOptions.fEnableArmorCoverage = iniReader.ReadBoolean("JA2 Tactical Settings", "ENABLE_ARMOR_COVERAGE", FALSE); // ShadoWarrior for Captain J's armor coverage - - // ShadoWarrior: Tooltip changes (start) - gGameExternalOptions.ubSoldierTooltipDetailLevel = iniReader.ReadInteger("JA2 Tactical Settings", "SOLDIER_TOOLTIP_DETAIL_LEVEL", 1); - - gGameExternalOptions.fEnableDynamicSoldierTooltips = iniReader.ReadBoolean("JA2 Tactical Settings", "DYNAMIC_SOLDIER_TOOLTIPS", TRUE); - gGameExternalOptions.fEnableSoldierTooltipLocation = iniReader.ReadBoolean("JA2 Tactical Settings", "SOLDIER_TOOLTIP_DISPLAY_LOCATION", TRUE); - gGameExternalOptions.fEnableSoldierTooltipBrightness = iniReader.ReadBoolean("JA2 Tactical Settings", "SOLDIER_TOOLTIP_DISPLAY_BRIGHTNESS", TRUE); - gGameExternalOptions.fEnableSoldierTooltipRangeToTarget = iniReader.ReadBoolean("JA2 Tactical Settings", "SOLDIER_TOOLTIP_DISPLAY_RANGE_TO_TARGET", TRUE); - gGameExternalOptions.fEnableSoldierTooltipID = iniReader.ReadBoolean("JA2 Tactical Settings", "SOLDIER_TOOLTIP_DISPLAY_ID", TRUE); - gGameExternalOptions.fEnableSoldierTooltipOrders = iniReader.ReadBoolean("JA2 Tactical Settings", "SOLDIER_TOOLTIP_DISPLAY_ORDERS", TRUE); - gGameExternalOptions.fEnableSoldierTooltipAttitude = iniReader.ReadBoolean("JA2 Tactical Settings", "SOLDIER_TOOLTIP_DISPLAY_ATTITUDE", TRUE); - gGameExternalOptions.fEnableSoldierTooltipActionPoints = iniReader.ReadBoolean("JA2 Tactical Settings", "SOLDIER_TOOLTIP_DISPLAY_ACTIONPOINTS", TRUE); - gGameExternalOptions.fEnableSoldierTooltipHealth = iniReader.ReadBoolean("JA2 Tactical Settings", "SOLDIER_TOOLTIP_DISPLAY_HEALTH", TRUE); - gGameExternalOptions.fEnableSoldierTooltipHelmet = iniReader.ReadBoolean("JA2 Tactical Settings", "SOLDIER_TOOLTIP_DISPLAY_HELMET", TRUE); - gGameExternalOptions.fEnableSoldierTooltipVest = iniReader.ReadBoolean("JA2 Tactical Settings", "SOLDIER_TOOLTIP_DISPLAY_VEST", TRUE); - gGameExternalOptions.fEnableSoldierTooltipLeggings = iniReader.ReadBoolean("JA2 Tactical Settings", "SOLDIER_TOOLTIP_DISPLAY_LEGGINGS", TRUE); - gGameExternalOptions.fEnableSoldierTooltipHeadItem1 = iniReader.ReadBoolean("JA2 Tactical Settings", "SOLDIER_TOOLTIP_DISPLAY_HEAD_SLOT_1", TRUE); - gGameExternalOptions.fEnableSoldierTooltipHeadItem2 = iniReader.ReadBoolean("JA2 Tactical Settings", "SOLDIER_TOOLTIP_DISPLAY_HEAD_SLOT_2", TRUE); - gGameExternalOptions.fEnableSoldierTooltipWeapon = iniReader.ReadBoolean("JA2 Tactical Settings", "SOLDIER_TOOLTIP_DISPLAY_WEAPON", TRUE); - gGameExternalOptions.fEnableSoldierTooltipSecondHand = iniReader.ReadBoolean("JA2 Tactical Settings", "SOLDIER_TOOLTIP_DISPLAY_OFF_HAND", TRUE); - gGameExternalOptions.fEnableSoldierTooltipBigSlot1 = iniReader.ReadBoolean("JA2 Tactical Settings", "SOLDIER_TOOLTIP_DISPLAY_BIG_SLOT_1", TRUE); - gGameExternalOptions.fEnableSoldierTooltipBigSlot2 = iniReader.ReadBoolean("JA2 Tactical Settings", "SOLDIER_TOOLTIP_DISPLAY_BIG_SLOT_2", TRUE); - gGameExternalOptions.fEnableSoldierTooltipBigSlot3 = iniReader.ReadBoolean("JA2 Tactical Settings", "SOLDIER_TOOLTIP_DISPLAY_BIG_SLOT_3", TRUE); - gGameExternalOptions.fEnableSoldierTooltipBigSlot4 = iniReader.ReadBoolean("JA2 Tactical Settings", "SOLDIER_TOOLTIP_DISPLAY_BIG_SLOT_4", TRUE); - // ShadoWarrior: Tooltip changes (end) - } diff --git a/Strategic/Creature Spreading.cpp b/Strategic/Creature Spreading.cpp index b639d2f5..cb528178 100644 --- a/Strategic/Creature Spreading.cpp +++ b/Strategic/Creature Spreading.cpp @@ -325,26 +325,26 @@ void InitCreatureQuest() //Default them all to infectible memset( fMineInfectible, 1, sizeof( BOOLEAN ) * 4 ); - if( gMineStatus[ DRASSEN_MINE ].fAttackedHeadMiner || - gMineStatus[ DRASSEN_MINE ].uiOreRunningOutPoint || + if( gMineStatus[ MINE_DRASSEN ].fAttackedHeadMiner || + gMineStatus[ MINE_DRASSEN ].uiOreRunningOutPoint || StrategicMap[ SECTOR_INFO_TO_STRATEGIC_INDEX( SEC_D13 ) ].fEnemyControlled ) { //If head miner was attacked, ore will/has run out, or enemy controlled fMineInfectible[ 0 ] = FALSE; } - if( gMineStatus[ CAMBRIA_MINE ].fAttackedHeadMiner || - gMineStatus[ CAMBRIA_MINE ].uiOreRunningOutPoint || + if( gMineStatus[ MINE_CAMBRIA ].fAttackedHeadMiner || + gMineStatus[ MINE_CAMBRIA ].uiOreRunningOutPoint || StrategicMap[ SECTOR_INFO_TO_STRATEGIC_INDEX( SEC_H8 ) ].fEnemyControlled ) { //If head miner was attacked, ore will/has run out, or enemy controlled fMineInfectible[ 1 ] = FALSE; } - if( gMineStatus[ ALMA_MINE ].fAttackedHeadMiner || - gMineStatus[ ALMA_MINE ].uiOreRunningOutPoint || + if( gMineStatus[ MINE_ALMA ].fAttackedHeadMiner || + gMineStatus[ MINE_ALMA ].uiOreRunningOutPoint || StrategicMap[ SECTOR_INFO_TO_STRATEGIC_INDEX( SEC_I14 ) ].fEnemyControlled ) { //If head miner was attacked, ore will/has run out, or enemy controlled fMineInfectible[ 2 ] = FALSE; } - if( gMineStatus[ GRUMM_MINE ].fAttackedHeadMiner || - gMineStatus[ GRUMM_MINE ].uiOreRunningOutPoint || + if( gMineStatus[ MINE_GRUMM ].fAttackedHeadMiner || + gMineStatus[ MINE_GRUMM ].uiOreRunningOutPoint || StrategicMap[ SECTOR_INFO_TO_STRATEGIC_INDEX( SEC_H3 ) ].fEnemyControlled ) { //If head miner was attacked, ore will/has run out, or enemy controlled fMineInfectible[ 3 ] = FALSE; diff --git a/Strategic/MilitiaSquads.cpp b/Strategic/MilitiaSquads.cpp index 29816329..c40b46e1 100644 --- a/Strategic/MilitiaSquads.cpp +++ b/Strategic/MilitiaSquads.cpp @@ -25,7 +25,6 @@ #include "math.h" #include "Auto Resolve.h" #include "Vehicles.h" - #include "Soldier Init List.h" #endif #include "MilitiaSquads.h" @@ -691,7 +690,7 @@ void DoMilitiaHelpFromAdjacentSectors( INT16 sMapX, INT16 sMapY ) SECTORINFO *pSectorInfo = &( SectorInfo[ SECTOR( sMapX, sMapY ) ] ); BOOLEAN fMoreTroopsLeft[4] = {FALSE,FALSE,FALSE,FALSE}; BOOLEAN fFirstLoop = TRUE; - BOOLEAN fMilitiaAlreadyBeen = CountMilitia(pSectorInfo )>0 && gWorldSectorX == sMapX && gWorldSectorY == sMapY && gbWorldSectorZ == 0; + BOOLEAN fMilitiaMoved = FALSE; guiDirNumber = 0; @@ -715,7 +714,7 @@ void DoMilitiaHelpFromAdjacentSectors( INT16 sMapX, INT16 sMapY ) if( fMoreTroopsLeft[ x ] ) { - if( fMilitiaAlreadyBeen )gfMSResetMilitia = TRUE; + fMilitiaMoved = TRUE; gpAttackDirs[ x + 1 ][0] += pSectorInfo->ubNumberOfCivsAtLevel[GREEN_MILITIA] - uiNumGreen; gpAttackDirs[ x + 1 ][1] += pSectorInfo->ubNumberOfCivsAtLevel[REGULAR_MILITIA] - uiNumReg; @@ -735,50 +734,18 @@ void DoMilitiaHelpFromAdjacentSectors( INT16 sMapX, INT16 sMapY ) } } - if (gfStrategicMilitiaChangesMade) - { - RemoveMilitiaFromTactical(); - //PrepareMilitiaForTactical(); - - for( x = 0 ; x < guiDirNumber ; ++x ) - { -#if 0 - // ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"%ld,%ld,%ld,%ld", gpAttackDirs[ x ][ 0 ], gpAttackDirs[ x ][1], gpAttackDirs[ x ][2], gpAttackDirs[ x ][3] ); - if( gfMSResetMilitia ) - { - if( gpAttackDirs[ x ][ 3 ] != INSERTION_CODE_CENTER ) - { - AddSoldierInitListMilitiaOnEdge( gpAttackDirs[ x ][ 3 ], gpAttackDirs[ x ][0], gpAttackDirs[ x ][1], gpAttackDirs[ x ][2] ); - ubGreen -= gpAttackDirs[ x ][0]; - ubRegs -= gpAttackDirs[ x ][1]; - ubElites -= gpAttackDirs[ x ][2]; - } - } - else - { -#endif - if( gpAttackDirs[ x ][ 3 ] == INSERTION_CODE_CENTER ) - { - AddSoldierInitListMilitia( gpAttackDirs[ x ][0], gpAttackDirs[ x ][1], gpAttackDirs[ x ][2] ); - } - else - { - AddSoldierInitListMilitiaOnEdge( gpAttackDirs[ x ][ 3 ], gpAttackDirs[ x ][0], gpAttackDirs[ x ][1], gpAttackDirs[ x ][2] ); - } -// } - } - - gfStrategicMilitiaChangesMade = FALSE; - } - - guiDirNumber = 0; - memset( gpAttackDirs, 0, sizeof( gpAttackDirs)); + // If militia have been moved here, no reason to reset--just add them. If militia have not moved, then no strategic + // changes were made. Either case, this flag should be false. + gfStrategicMilitiaChangesMade = FALSE; } void MSCallBack( UINT8 ubResult ) { if( ubResult == MSG_BOX_RETURN_YES ) + { + gTacticalStatus.uiFlags |= WANT_MILITIA_REINFORCEMENTS; DoMilitiaHelpFromAdjacentSectors( sMSMapX, sMSMapY ); + } } BOOLEAN IsThereMilitiaInAdjacentSector( INT16 sMapX, INT16 sMapY ) @@ -802,13 +769,20 @@ void MilitiaHelpFromAdjacentSectors( INT16 sMapX, INT16 sMapY ) { sMSMapX = sMapX; sMSMapY = sMapY; + SECTORINFO *pSectorInfo = &( SectorInfo[ SECTOR( sMapX, sMapY ) ] ); if( !gGameExternalOptions.gfAllowMilitiaGroups ) return; - if( CountAllMilitiaInSector( sMapX, sMapY ) ) MSCallBack( MSG_BOX_RETURN_YES ); + gTacticalStatus.uiFlags &= (~WANT_MILITIA_REINFORCEMENTS); - if( IsThereMilitiaInAdjacentSector( sMapX, sMapY ) && CountAllMilitiaInSector( sMapX, sMapY ) < gGameExternalOptions.guiMaxMilitiaSquadSizeBattle ) + guiDirNumber = 0; + +// if( CountAllMilitiaInSector( sMapX, sMapY ) ) MSCallBack( MSG_BOX_RETURN_YES ); + + // This is no longer a question of simply whether to have a full militia count, but also whether we want + // reinforcements. So if there are any available, always ask. + if( IsThereMilitiaInAdjacentSector( sMapX, sMapY ) ) // && CountAllMilitiaInSector( sMapX, sMapY ) < gGameExternalOptions.guiMaxMilitiaSquadSizeBattle ) DoScreenIndependantMessageBox( gzCWStrings[0], MSG_BOX_FLAG_YESNO, MSCallBack ); } diff --git a/Strategic/Strategic Movement.cpp b/Strategic/Strategic Movement.cpp index c6d8c81d..950d2c1d 100644 --- a/Strategic/Strategic Movement.cpp +++ b/Strategic/Strategic Movement.cpp @@ -3216,7 +3216,7 @@ void HandleArrivalOfReinforcements( GROUP *pGroup ) if( pGroup->fPlayer ) { //We don't have to worry about filling up the player slots, because it is impossible - //to have more player's in the game then the number of slots available for the player. + //to have more players in the game than the number of slots available for the player. PLAYERGROUP *pPlayer; UINT8 ubStrategicInsertionCode; //First, determine which entrypoint to use, based on the travel direction of the group. diff --git a/Strategic/strategicmap.cpp b/Strategic/strategicmap.cpp index 850a3444..ff1430aa 100644 --- a/Strategic/strategicmap.cpp +++ b/Strategic/strategicmap.cpp @@ -1730,15 +1730,18 @@ BOOLEAN SetCurrentWorldSector( INT16 sMapX, INT16 sMapY, INT8 bMapZ ) // is the sector already loaded? if( ( gWorldSectorX == sMapX ) && ( sMapY == gWorldSectorY) && ( bMapZ == gbWorldSectorZ) ) { - //Inserts the enemies into the newly loaded map based on the strategic information. + //Inserts the enemies into the already loaded map based on the strategic information. //Note, the flag will return TRUE only if enemies were added. The game may wish to //do something else in a case where no enemies are present. + PrepareMilitiaForTactical( FALSE); + SetPendingNewScreen(GAME_SCREEN); if( !NumEnemyInSector( ) ) { PrepareEnemyForSectorBattle(); } + if( gubNumCreaturesAttackingTown && !gbWorldSectorZ && gubSectorIDOfCreatureAttack == SECTOR( gWorldSectorX, gWorldSectorY ) ) { @@ -2072,7 +2075,7 @@ void PrepareLoadedSector() PrepareCreaturesForBattle(); - PrepareMilitiaForTactical(); + PrepareMilitiaForTactical(TRUE); // OK, set varibles for entring this new sector... gTacticalStatus.fVirginSector = TRUE; diff --git a/Tactical/DisplayCover.cpp b/Tactical/DisplayCover.cpp index 4950de45..6ce14d46 100644 --- a/Tactical/DisplayCover.cpp +++ b/Tactical/DisplayCover.cpp @@ -35,8 +35,8 @@ //******* Local Defines ************************************************** -#define DC_MAX_COVER_RANGE 42 //31 -#define DC__SOLDIER_VISIBLE_RANGE 42 //31 +#define DC_MAX_COVER_RANGE 43 //31 +#define DC__SOLDIER_VISIBLE_RANGE 43 //31 #define DC__MIN_SIZE 4 #define DC__MAX_SIZE 21 //11 @@ -338,15 +338,15 @@ void CalculateCoverInRadiusAroundGridno( INT16 sTargetGridNo, INT8 bSearchRange pSoldier = GetCurrentMercForDisplayCover(); - sCounterX = sCounterY = 0; +// sCounterX = sCounterY = 0; //Determine the stance to use bStance = GetCurrentMercForDisplayCoverStance(); //loop through all the gridnos that we are interested in - for (sYOffset = -sMaxUp; sYOffset <= sMaxDown; sYOffset++) + for (sCounterY = 0, sCounterX = 0, sYOffset = -sMaxUp; sYOffset <= sMaxDown; sYOffset++, sCounterY++, sCounterX = 0) { - for (sXOffset = -sMaxLeft; sXOffset <= sMaxRight; sXOffset++) + for (sXOffset = -sMaxLeft; sXOffset <= sMaxRight; sXOffset++, sCounterX++) { sGridNo = sTargetGridNo + sXOffset + (MAXCOL * sYOffset); @@ -381,7 +381,7 @@ void CalculateCoverInRadiusAroundGridno( INT16 sTargetGridNo, INT8 bSearchRange if ( !(gpWorldLevelData[sGridNo].uiFlags & MAPELEMENT_REACHABLE) ) { //skip to the next gridno - sCounterX++; +// sCounterX++; continue; } @@ -403,10 +403,10 @@ void CalculateCoverInRadiusAroundGridno( INT16 sTargetGridNo, INT8 bSearchRange // gCoverRadius[ sCounterX ][ sCounterY ].fRoof = fRoof; - sCounterX++; +// sCounterX++; } - sCounterY++; - sCounterX = 0; +// sCounterY++; +// sCounterX = 0; } } diff --git a/Tactical/Militia Control.cpp b/Tactical/Militia Control.cpp index 61e934f6..0a4e7436 100644 --- a/Tactical/Militia Control.cpp +++ b/Tactical/Militia Control.cpp @@ -210,7 +210,7 @@ void RemoveMilitiaFromTactical() } } -void PrepareMilitiaForTactical() +void PrepareMilitiaForTactical( BOOLEAN fPrepareAll) { SECTORINFO *pSector; INT32 x; @@ -227,10 +227,14 @@ void PrepareMilitiaForTactical() ubRegs = pSector->ubNumberOfCivsAtLevel[ REGULAR_MILITIA ]; ubElites = pSector->ubNumberOfCivsAtLevel[ ELITE_MILITIA ]; -#if 0 if(guiDirNumber) { - for( x = 0 ; x < guiDirNumber ; ++x ) + if (fPrepareAll) + { + AddSoldierInitListMilitia( gpAttackDirs[ 0 ][0], gpAttackDirs[ 0 ][1], gpAttackDirs[ 0 ][2] ); + } + // If the sector is already loaded, don't add the existing militia + for( x = 1; x < guiDirNumber ; ++x ) { #if 0 // ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"%ld,%ld,%ld,%ld", gpAttackDirs[ x ][ 0 ], gpAttackDirs[ x ][1], gpAttackDirs[ x ][2], gpAttackDirs[ x ][3] ); @@ -247,19 +251,12 @@ void PrepareMilitiaForTactical() else { #endif - if( gpAttackDirs[ x ][ 3 ] == INSERTION_CODE_CENTER ) - { - AddSoldierInitListMilitia( gpAttackDirs[ x ][0], gpAttackDirs[ x ][1], gpAttackDirs[ x ][2] ); - } - else - { - AddSoldierInitListMilitiaOnEdge( gpAttackDirs[ x ][ 3 ], gpAttackDirs[ x ][0], gpAttackDirs[ x ][1], gpAttackDirs[ x ][2] ); - } -// } + AddSoldierInitListMilitiaOnEdge( gpAttackDirs[ x ][ 3 ], gpAttackDirs[ x ][0], gpAttackDirs[ x ][1], gpAttackDirs[ x ][2] ); } + + guiDirNumber = 0; } - else -#endif + else if (fPrepareAll) { AddSoldierInitListMilitia( ubGreen, ubRegs, ubElites ); } diff --git a/Tactical/Militia Control.h b/Tactical/Militia Control.h index 0165ecdf..68113765 100644 --- a/Tactical/Militia Control.h +++ b/Tactical/Militia Control.h @@ -6,7 +6,7 @@ #include "mousesystem.h" #include "Strategic Movement.h" -void PrepareMilitiaForTactical(); +void PrepareMilitiaForTactical(BOOLEAN fPrepareAll); void RemoveMilitiaFromTactical(); void ResetMilitia(); void HandleMilitiaPromotions(); diff --git a/Tactical/Overhead Types.h b/Tactical/Overhead Types.h index a38135d6..afbd328e 100644 --- a/Tactical/Overhead Types.h +++ b/Tactical/Overhead Types.h @@ -52,6 +52,7 @@ #define NOHIDE_REDUNDENCY 0x000010000 #define DEBUGCLIFFS 0x000020000 #define INCOMBAT 0x000040000 +#define WANT_MILITIA_REINFORCEMENTS 0x000080000 #define ACTIVE 0x000100000 #define SHOW_Z_BUFFER 0x000200000 #define SLOW_ANIMATION 0x000400000 diff --git a/Tactical/Overhead.cpp b/Tactical/Overhead.cpp index 86e35083..bb35436f 100644 --- a/Tactical/Overhead.cpp +++ b/Tactical/Overhead.cpp @@ -6255,7 +6255,7 @@ BOOLEAN CheckForEndOfBattle( BOOLEAN fAnEnemyRetreated ) } HandleMilitiaStatusInCurrentMapBeforeLoadingNewMap(); - gfStrategicMilitiaChangesMade = TRUE; + //gfStrategicMilitiaChangesMade = TRUE; // Loop through all militia and restore them to peaceful status @@ -7677,8 +7677,6 @@ SOLDIERTYPE *InternalReduceAttackBusyCount( ) DequeueAllDemandGameEvents( TRUE ); - CheckForEndOfBattle( FALSE ); - // if we're in realtime, turn off the attacker's muzzle flash at this point if ( !(gTacticalStatus.uiFlags & INCOMBAT) && pSoldier ) { @@ -7738,6 +7736,8 @@ SOLDIERTYPE *InternalReduceAttackBusyCount( ) } } + CheckForEndOfBattle( FALSE ); + return( pTarget ); } diff --git a/Tactical/Turn Based Input.cpp b/Tactical/Turn Based Input.cpp index 05476c99..56d0b37a 100644 --- a/Tactical/Turn Based Input.cpp +++ b/Tactical/Turn Based Input.cpp @@ -1534,7 +1534,11 @@ void GetKeyboardInput( UINT32 *puiNewEvent ) { if ( !( gTacticalStatus.uiFlags & ENGAGED_IN_CONV ) ) { - LeaveTacticalScreen( GAME_SCREEN ); + gfSaveGame = FALSE; + gfCameDirectlyFromGame = TRUE; + + guiPreviousOptionScreen = GAME_SCREEN; + LeaveTacticalScreen( SAVE_LOAD_SCREEN ); DoQuickLoad(); } } diff --git a/Tactical/opplist.cpp b/Tactical/opplist.cpp index fe0701b6..cd4682bc 100644 --- a/Tactical/opplist.cpp +++ b/Tactical/opplist.cpp @@ -1196,6 +1196,8 @@ INT16 DistanceVisible( SOLDIERTYPE *pSoldier, INT8 bFacingDir, INT8 bSubjectDir, DebugMsg(TOPIC_JA2, DBG_LEVEL_3, String("113/UC Warning! Tried to detect the light level when character %ls[%d] looks at a location outside of the valid map (gridno %d). Assigning default %d", pSoldier->name, pSoldier->ubID, pSoldier->sGridNo, ubAmbientLightLevel)); } + + bLightLevel = ubAmbientLightLevel; } else {