Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

stats: fix the game hanging if exited during the level stats, credits, or final stats #1777

Merged
merged 1 commit into from
Oct 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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