diff --git a/Strategic/Creature Spreading.cpp b/Strategic/Creature Spreading.cpp index 18ffe2d10..432d01d76 100644 --- a/Strategic/Creature Spreading.cpp +++ b/Strategic/Creature Spreading.cpp @@ -734,20 +734,14 @@ void AddCreaturesToBattle( UINT8 ubNumYoungMales, UINT8 ubNumYoungFemales, UINT8 } else { - gsCreatureInsertionCode = 0; - gsCreatureInsertionGridNo = 0; - gubNumCreaturesAttackingTown = 0; - gubYoungMalesAttackingTown = 0; - gubYoungFemalesAttackingTown = 0; - gubAdultMalesAttackingTown = 0; - gubAdultFemalesAttackingTown = 0; - gubCreatureBattleCode = CREATURE_BATTLE_CODE_NONE; - gubSectorIDOfCreatureAttack = 0; + ResetCreatureAttackVariables(); + AllTeamsLookForAll( FALSE ); Assert(0); return; } + pSoldier->ubInsertionDirection = bDesiredDirection; //Setup the position pSoldier->ubStrategicInsertionCode = INSERTION_CODE_GRIDNO; @@ -769,15 +763,9 @@ void AddCreaturesToBattle( UINT8 ubNumYoungMales, UINT8 ubNumYoungFemales, UINT8 } UpdateMercInSector( pSoldier, gWorldSectorX, gWorldSectorY, 0 ); } - gsCreatureInsertionCode = 0; - gsCreatureInsertionGridNo = 0; - gubNumCreaturesAttackingTown = 0; - gubYoungMalesAttackingTown = 0; - gubYoungFemalesAttackingTown = 0; - gubAdultMalesAttackingTown = 0; - gubAdultFemalesAttackingTown = 0; - gubCreatureBattleCode = CREATURE_BATTLE_CODE_NONE; - gubSectorIDOfCreatureAttack = 0; + + ResetCreatureAttackVariables(); + AllTeamsLookForAll( FALSE ); } @@ -863,16 +851,9 @@ void AddCreaturesToBattle_Other( UINT8 ubNum ) pSoldier->aiData.ubNoiseVolume = MAX_MISC_NOISE_DURATION; } } + + ResetCreatureAttackVariables(); - gsCreatureInsertionCode = 0; - gsCreatureInsertionGridNo = 0; - gubNumCreaturesAttackingTown = 0; - gubYoungMalesAttackingTown = 0; - gubYoungFemalesAttackingTown = 0; - gubAdultMalesAttackingTown = 0; - gubAdultFemalesAttackingTown = 0; - gubCreatureBattleCode = CREATURE_BATTLE_CODE_NONE; - gubSectorIDOfCreatureAttack = 0; AllTeamsLookForAll( FALSE ); } @@ -1470,9 +1451,10 @@ void CreatureAttackTown_OtherCreatures( UINT8 ubSectorID, UINT8 ubType ) break; } + // Flugente: the pause state isn't always removed properly. It seems we can also do without it... let's see whether this has unintentional consequences InterruptTime(); PauseGame(); - LockPauseState( 2 ); + //LockPauseState( 2 ); } //Called by campaign init. @@ -2433,3 +2415,17 @@ BOOLEAN GetWarpOutOfMineCodes( INT16 *psSectorX, INT16 *psSectorY, INT8 *pbSecto return( FALSE ); } + +// Flugente: reset code for creature attacks +void ResetCreatureAttackVariables() +{ + gsCreatureInsertionCode = 0; + gsCreatureInsertionGridNo = 0; + gubNumCreaturesAttackingTown = 0; + gubYoungMalesAttackingTown = 0; + gubYoungFemalesAttackingTown = 0; + gubAdultMalesAttackingTown = 0; + gubAdultFemalesAttackingTown = 0; + gubCreatureBattleCode = CREATURE_BATTLE_CODE_NONE; + gubSectorIDOfCreatureAttack = 0; +} \ No newline at end of file diff --git a/Strategic/Creature Spreading.h b/Strategic/Creature Spreading.h index fed460c95..e7e812c67 100644 --- a/Strategic/Creature Spreading.h +++ b/Strategic/Creature Spreading.h @@ -111,4 +111,7 @@ typedef struct CREATURECOMPOSITION extern CREATUREPLACEMENT gCreaturePlacements[ MAX_NUMBER_OF_INFECTIBLE_SITES + 1 ]; extern CREATURECOMPOSITION gCreatureComposition[ MAX_NUMBER_OF_CREATURE_COMPOSITIONS ]; +// Flugente: reset code for creature attacks +void ResetCreatureAttackVariables(); + #endif \ No newline at end of file diff --git a/Tactical/Overhead.cpp b/Tactical/Overhead.cpp index 979e723fd..b919fe123 100644 --- a/Tactical/Overhead.cpp +++ b/Tactical/Overhead.cpp @@ -113,6 +113,7 @@ #include "CampaignStats.h" // added by Flugente #include "DynamicDialogue.h" // added by Flugente for HandleDynamicOpinions() #include "DropDown.h" // added by Flugente +#include "Creature Spreading.h" // added by Flugente forResetCreatureAttackVariables() #endif #include "connect.h" @@ -7213,18 +7214,20 @@ BOOLEAN CheckForEndOfBattle( BOOLEAN fAnEnemyRetreated ) //Whenever returning TRUE, make sure you clear gfBlitBattleSectorLocator; LogBattleResults( LOG_DEFEAT ); gfBlitBattleSectorLocator = FALSE; + + // Flugente: in any case, reset creature attack variables + ResetCreatureAttackVariables(); + // If we are the server, we escape this function at the top if we think the game should still be running // hence if we get here the game is over for all clients and we should report it if (is_networked && is_server) game_over(); return( TRUE ); } - - + // If battle won, do stuff right away! if ( fBattleWon ) { - if ( gTacticalStatus.bBoxingState == NOT_BOXING ) // if boxing don't do any of this stuff { gTacticalStatus.fLastBattleWon = TRUE; @@ -7242,8 +7245,7 @@ BOOLEAN CheckForEndOfBattle( BOOLEAN fAnEnemyRetreated ) // Kill all enemies. Sometime even after killing all the enemies, there appeares "in battle" enemies in sector info RemoveStaticEnemiesFromSectorInfo( gWorldSectorX, gWorldSectorY, gbWorldSectorZ ); - - + // If here, the battle has been won! // hurray! a glorious victory! @@ -7484,13 +7486,15 @@ BOOLEAN CheckForEndOfBattle( BOOLEAN fAnEnemyRetreated ) //Whenever returning TRUE, make sure you clear gfBlitBattleSectorLocator; gfBlitBattleSectorLocator = FALSE; - - + // Kaiden: More UB Reveal All Items after combat code. //When all the enemy gets killed, reveal the items they dropped //But only if the option is turned ON. if(gGameExternalOptions.gfRevealItems) RevealAllDroppedEnemyItems(); + + // Flugente: in any case, reset creature attack variables + ResetCreatureAttackVariables(); // If we are the server, we escape this function at the top if we think the game should still be running // hence if we get here the game is over for all clients and we should report it