Skip to content

Commit

Permalink
demo: fix hidden ammo counter while demo plays in NG+
Browse files Browse the repository at this point in the history
  • Loading branch information
walkawayy authored and rr- committed Oct 30, 2024
1 parent f8efbc9 commit 393ffcb
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 0 deletions.
1 change: 1 addition & 0 deletions docs/tr2/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
- fixed Lara reloading the harpoon gun after every shot in NG+ (#1575)
- 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)

## [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 @@ -31,6 +31,7 @@ decompilation process. We recognize that there is much work to be done.
- fixed Lara reloading the harpoon gun after every shot in NG+
- 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+

#### Visuals

Expand Down
22 changes: 22 additions & 0 deletions src/tr2/game/demo.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,28 @@
#include "global/funcs.h"
#include "global/vars.h"

static struct {
bool bonus_flag;
} m_OldConfig;

static int32_t m_DemoLevel = 0;
static int32_t m_DemoLevel2 = 0;
static int32_t m_OldDemoInputDB = 0;

static void M_PrepareConfig(void);
static void M_RestoreConfig(void);

static void M_PrepareConfig(void)
{
m_OldConfig.bonus_flag = g_SaveGame.bonus_flag;
g_SaveGame.bonus_flag = false;
}

static void M_RestoreConfig(void)
{
g_SaveGame.bonus_flag = m_OldConfig.bonus_flag;
}

int32_t __cdecl Demo_Control(int32_t level_num)
{
if (level_num < 0 && !g_GameFlow.num_demos) {
Expand All @@ -41,6 +59,8 @@ int32_t __cdecl Demo_Start(int32_t level_num)
return GFD_EXIT_TO_TITLE;
}

M_PrepareConfig();

if (level_num >= 0) {
m_DemoLevel2 = level_num;
} else {
Expand Down Expand Up @@ -91,6 +111,8 @@ int32_t __cdecl Demo_Start(int32_t level_num)

Text_Remove(text);

M_RestoreConfig();

*s = start;
S_FadeToBlack();
if (dir == GFD_OVERRIDE) {
Expand Down

0 comments on commit 393ffcb

Please sign in to comment.