mirror of
https://github.com/1dot13/source.git
synced 2026-07-29 13:52:17 +02:00
- Fix: creature attack variables are not always cleaned up properly
- Fix: game remains in pause state after using cheat to avoid creature attack in strategic git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8559 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
@@ -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;
|
||||
}
|
||||
@@ -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
|
||||
+11
-7
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user