Skip to content

Commit

Permalink
stats: fix game hanging if exited during stats or credits
Browse files Browse the repository at this point in the history
Resolves #1585.
  • Loading branch information
walkawayy authored and rr- committed Oct 31, 2024
1 parent 393ffcb commit 11a7bad
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 1 deletion.
1 change: 1 addition & 0 deletions docs/tr2/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
- fixed the dragon reviving itself after Lara removes the dagger in rare circumstances (#1572)
- fixed grenades counting as double kills in the game statistics (#1560)
- fixed the ammo counter being hidden while a demo plays in NG+ (#1559)
- fixed the game hanging if exited during the level stats, credits, or final stats (#1585)

## [0.5](https://github.com/LostArtefacts/TRX/compare/afaf12a...tr2-0.5) - 2024-10-08
- added `/sfx` command
Expand Down
1 change: 1 addition & 0 deletions docs/tr2/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ decompilation process. We recognize that there is much work to be done.
- fixed the dragon reviving itself after Lara removes the dagger in rare circumstances
- fixed grenades counting as double kills in the game statistics
- fixed the ammo counter being hidden while a demo plays in NG+
- fixed the game hanging if exited during the level stats, credits, or final stats

#### Visuals

Expand Down
8 changes: 8 additions & 0 deletions src/tr2/decomp/decomp.c
Original file line number Diff line number Diff line change
Expand Up @@ -2816,6 +2816,10 @@ void __cdecl S_Wait(int32_t frames, const BOOL input_check)
passed = Sync();
} while (!passed);
frames -= passed;

if (g_IsGameToExit) {
break;
}
}
}

Expand All @@ -2830,6 +2834,10 @@ void __cdecl S_Wait(int32_t frames, const BOOL input_check)
passed = Sync();
} while (!passed);
frames -= passed;

if (g_IsGameToExit) {
break;
}
}
}

Expand Down
8 changes: 8 additions & 0 deletions src/tr2/decomp/stats.c
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,10 @@ int32_t __cdecl LevelStats(const int32_t level_num)

Input_Update();

if (g_IsGameToExit) {
break;
}

if (g_GF_OverrideDir != (GAME_FLOW_DIR)-1) {
break;
}
Expand Down Expand Up @@ -369,6 +373,10 @@ int32_t __cdecl GameStats(const int32_t level_num)

Input_Update();

if (g_IsGameToExit) {
break;
}

if (g_GF_OverrideDir != (GAME_FLOW_DIR)-1) {
break;
}
Expand Down
4 changes: 3 additions & 1 deletion src/tr2/game/shell.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

#include "config.h"
#include "decomp/decomp.h"
#include "game/background.h"
#include "game/console/common.h"
#include "game/demo.h"
#include "game/game_string.h"
Expand Down Expand Up @@ -169,7 +170,8 @@ void __cdecl Shell_Shutdown(void)
GameString_Shutdown();
Console_Shutdown();
WinInFinish();
RenderFinish(true);
BGND_Free();
RenderFinish(false);
WinVidFinish();
WinVidHideGameWindow();
Text_Shutdown();
Expand Down

0 comments on commit 11a7bad

Please sign in to comment.