mirror of
https://github.com/1dot13/source.git
synced 2026-09-16 14:47: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
|
else
|
||||||
{
|
{
|
||||||
gsCreatureInsertionCode = 0;
|
ResetCreatureAttackVariables();
|
||||||
gsCreatureInsertionGridNo = 0;
|
|
||||||
gubNumCreaturesAttackingTown = 0;
|
|
||||||
gubYoungMalesAttackingTown = 0;
|
|
||||||
gubYoungFemalesAttackingTown = 0;
|
|
||||||
gubAdultMalesAttackingTown = 0;
|
|
||||||
gubAdultFemalesAttackingTown = 0;
|
|
||||||
gubCreatureBattleCode = CREATURE_BATTLE_CODE_NONE;
|
|
||||||
gubSectorIDOfCreatureAttack = 0;
|
|
||||||
AllTeamsLookForAll( FALSE );
|
AllTeamsLookForAll( FALSE );
|
||||||
|
|
||||||
Assert(0);
|
Assert(0);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
pSoldier->ubInsertionDirection = bDesiredDirection;
|
pSoldier->ubInsertionDirection = bDesiredDirection;
|
||||||
//Setup the position
|
//Setup the position
|
||||||
pSoldier->ubStrategicInsertionCode = INSERTION_CODE_GRIDNO;
|
pSoldier->ubStrategicInsertionCode = INSERTION_CODE_GRIDNO;
|
||||||
@@ -769,15 +763,9 @@ void AddCreaturesToBattle( UINT8 ubNumYoungMales, UINT8 ubNumYoungFemales, UINT8
|
|||||||
}
|
}
|
||||||
UpdateMercInSector( pSoldier, gWorldSectorX, gWorldSectorY, 0 );
|
UpdateMercInSector( pSoldier, gWorldSectorX, gWorldSectorY, 0 );
|
||||||
}
|
}
|
||||||
gsCreatureInsertionCode = 0;
|
|
||||||
gsCreatureInsertionGridNo = 0;
|
ResetCreatureAttackVariables();
|
||||||
gubNumCreaturesAttackingTown = 0;
|
|
||||||
gubYoungMalesAttackingTown = 0;
|
|
||||||
gubYoungFemalesAttackingTown = 0;
|
|
||||||
gubAdultMalesAttackingTown = 0;
|
|
||||||
gubAdultFemalesAttackingTown = 0;
|
|
||||||
gubCreatureBattleCode = CREATURE_BATTLE_CODE_NONE;
|
|
||||||
gubSectorIDOfCreatureAttack = 0;
|
|
||||||
AllTeamsLookForAll( FALSE );
|
AllTeamsLookForAll( FALSE );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -863,16 +851,9 @@ void AddCreaturesToBattle_Other( UINT8 ubNum )
|
|||||||
pSoldier->aiData.ubNoiseVolume = MAX_MISC_NOISE_DURATION;
|
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 );
|
AllTeamsLookForAll( FALSE );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1470,9 +1451,10 @@ void CreatureAttackTown_OtherCreatures( UINT8 ubSectorID, UINT8 ubType )
|
|||||||
break;
|
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();
|
InterruptTime();
|
||||||
PauseGame();
|
PauseGame();
|
||||||
LockPauseState( 2 );
|
//LockPauseState( 2 );
|
||||||
}
|
}
|
||||||
|
|
||||||
//Called by campaign init.
|
//Called by campaign init.
|
||||||
@@ -2433,3 +2415,17 @@ BOOLEAN GetWarpOutOfMineCodes( INT16 *psSectorX, INT16 *psSectorY, INT8 *pbSecto
|
|||||||
|
|
||||||
return( FALSE );
|
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 CREATUREPLACEMENT gCreaturePlacements[ MAX_NUMBER_OF_INFECTIBLE_SITES + 1 ];
|
||||||
extern CREATURECOMPOSITION gCreatureComposition[ MAX_NUMBER_OF_CREATURE_COMPOSITIONS ];
|
extern CREATURECOMPOSITION gCreatureComposition[ MAX_NUMBER_OF_CREATURE_COMPOSITIONS ];
|
||||||
|
|
||||||
|
// Flugente: reset code for creature attacks
|
||||||
|
void ResetCreatureAttackVariables();
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
+11
-7
@@ -113,6 +113,7 @@
|
|||||||
#include "CampaignStats.h" // added by Flugente
|
#include "CampaignStats.h" // added by Flugente
|
||||||
#include "DynamicDialogue.h" // added by Flugente for HandleDynamicOpinions()
|
#include "DynamicDialogue.h" // added by Flugente for HandleDynamicOpinions()
|
||||||
#include "DropDown.h" // added by Flugente
|
#include "DropDown.h" // added by Flugente
|
||||||
|
#include "Creature Spreading.h" // added by Flugente forResetCreatureAttackVariables()
|
||||||
#endif
|
#endif
|
||||||
#include "connect.h"
|
#include "connect.h"
|
||||||
|
|
||||||
@@ -7213,18 +7214,20 @@ BOOLEAN CheckForEndOfBattle( BOOLEAN fAnEnemyRetreated )
|
|||||||
//Whenever returning TRUE, make sure you clear gfBlitBattleSectorLocator;
|
//Whenever returning TRUE, make sure you clear gfBlitBattleSectorLocator;
|
||||||
LogBattleResults( LOG_DEFEAT );
|
LogBattleResults( LOG_DEFEAT );
|
||||||
gfBlitBattleSectorLocator = FALSE;
|
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
|
// 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
|
// hence if we get here the game is over for all clients and we should report it
|
||||||
if (is_networked && is_server)
|
if (is_networked && is_server)
|
||||||
game_over();
|
game_over();
|
||||||
return( TRUE );
|
return( TRUE );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// If battle won, do stuff right away!
|
// If battle won, do stuff right away!
|
||||||
if ( fBattleWon )
|
if ( fBattleWon )
|
||||||
{
|
{
|
||||||
|
|
||||||
if ( gTacticalStatus.bBoxingState == NOT_BOXING ) // if boxing don't do any of this stuff
|
if ( gTacticalStatus.bBoxingState == NOT_BOXING ) // if boxing don't do any of this stuff
|
||||||
{
|
{
|
||||||
gTacticalStatus.fLastBattleWon = TRUE;
|
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
|
// Kill all enemies. Sometime even after killing all the enemies, there appeares "in battle" enemies in sector info
|
||||||
RemoveStaticEnemiesFromSectorInfo( gWorldSectorX, gWorldSectorY, gbWorldSectorZ );
|
RemoveStaticEnemiesFromSectorInfo( gWorldSectorX, gWorldSectorY, gbWorldSectorZ );
|
||||||
|
|
||||||
|
|
||||||
// If here, the battle has been won!
|
// If here, the battle has been won!
|
||||||
// hurray! a glorious victory!
|
// hurray! a glorious victory!
|
||||||
|
|
||||||
@@ -7484,13 +7486,15 @@ BOOLEAN CheckForEndOfBattle( BOOLEAN fAnEnemyRetreated )
|
|||||||
|
|
||||||
//Whenever returning TRUE, make sure you clear gfBlitBattleSectorLocator;
|
//Whenever returning TRUE, make sure you clear gfBlitBattleSectorLocator;
|
||||||
gfBlitBattleSectorLocator = FALSE;
|
gfBlitBattleSectorLocator = FALSE;
|
||||||
|
|
||||||
|
|
||||||
// Kaiden: More UB Reveal All Items after combat code.
|
// Kaiden: More UB Reveal All Items after combat code.
|
||||||
//When all the enemy gets killed, reveal the items they dropped
|
//When all the enemy gets killed, reveal the items they dropped
|
||||||
//But only if the option is turned ON.
|
//But only if the option is turned ON.
|
||||||
if(gGameExternalOptions.gfRevealItems)
|
if(gGameExternalOptions.gfRevealItems)
|
||||||
RevealAllDroppedEnemyItems();
|
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
|
// 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
|
// hence if we get here the game is over for all clients and we should report it
|
||||||
|
|||||||
Reference in New Issue
Block a user