tr2/demo: fix demos playing too eagerly

Resolves #2068.
This commit is contained in:
Marcin Kurczewski 2024-12-30 14:11:16 +01:00
parent b532e0982d
commit b8172c4af3
11 changed files with 19 additions and 40 deletions

View file

@ -24,6 +24,7 @@
- fixed the camera getting stuck at the start of Home Sweet Home (#2129, regression from 0.7)
- fixed assault course timer not paused in the inventory (#2153, regression from 0.6)
- fixed Lara spawning air bubbles above water surfaces during the fly cheat (#2115, regression from 0.3)
- fixed demos playing too eagerly (#2068, regression from 0.3)
- improved the animation of Lara's braid (#2094)
## [0.7.1](https://github.com/LostArtefacts/TRX/compare/tr2-0.7...tr2-0.7.1) - 2024-12-17

View file

@ -62,8 +62,6 @@ int16_t TitleSequence(void)
{
GF_N_LoadStrings(-1);
g_NoInputCounter = 0;
if (!Level_Initialise(0, GFL_TITLE)) {
return GFD_EXIT_GAME;
}

View file

@ -53,15 +53,6 @@ GAME_FLOW_DIR Game_Control(const int32_t num_frames, const bool demo_mode)
g_Input = (INPUT_STATE) { 0 };
return g_GameFlow.on_demo_end;
}
} else if (g_GameFlow.no_input_timeout) {
if (g_InputDB.any) {
g_NoInputCounter = 0;
} else {
g_NoInputCounter++;
if (g_NoInputCounter > g_GameFlow.no_input_time) {
return GFD_START_DEMO | 0xFF;
}
}
}
if (g_Lara.death_timer > DEATH_WAIT

View file

@ -248,7 +248,6 @@ bool GF_LoadFromFile(const char *const file_name)
g_GameFlow.demo_version = flags & 0x0001 ? 1 : 0;
g_GameFlow.title_disabled = flags & 0x0002 ? 1 : 0;
g_GameFlow.cheat_mode_check_disabled = flags & 0x0004 ? 1 : 0;
g_GameFlow.no_input_timeout = flags & 0x0008 ? 1 : 0;
g_GameFlow.load_save_disabled = flags & 0x0010 ? 1 : 0;
g_GameFlow.screen_sizing_disabled = flags & 0x0020 ? 1 : 0;
g_GameFlow.lockout_option_ring = flags & 0x0040 ? 1 : 0;

View file

@ -35,6 +35,7 @@ static TEXTSTRING *m_UpArrow2 = NULL;
static TEXTSTRING *m_DownArrow1 = NULL;
static TEXTSTRING *m_DownArrow2 = NULL;
static TEXTSTRING *m_VersionText = NULL;
static int32_t m_NoInputCounter = 0;
static void M_RemoveItemsText(void);
static void M_RemoveAllText(void);
@ -481,7 +482,7 @@ INV_RING *InvRing_Open(const INVENTORY_MODE mode)
ring->mode = mode;
ring->pass_open = false;
ring->demo_needed = false;
g_NoInputCounter = 0;
m_NoInputCounter = 0;
switch (mode) {
case INV_TITLE_MODE:
@ -636,15 +637,11 @@ GAME_FLOW_DIR InvRing_Control(INV_RING *const ring, const int32_t num_frames)
if (!Demo_GetInput()) {
return g_GameFlow.on_demo_end;
}
} else if (g_InputDB.any) {
g_NoInputCounter = 0;
}
if (ring->mode != INV_TITLE_MODE || g_Input.any || g_InputDB.any) {
g_NoInputCounter = 0;
} else if (g_GameFlow.num_demos || g_GameFlow.no_input_timeout) {
g_NoInputCounter++;
if (g_NoInputCounter > g_GameFlow.no_input_time) {
} else if (ring->mode != INV_TITLE_MODE || g_Input.any || g_InputDB.any) {
m_NoInputCounter = 0;
} else if (g_GameFlow.num_demos > 0 && ring->motion.status == RNG_OPEN) {
m_NoInputCounter++;
if (m_NoInputCounter > g_GameFlow.no_input_time) {
ring->demo_needed = true;
}
}

View file

@ -120,7 +120,6 @@ static void M_PrepareGame(void)
g_Inv_DemoMode = true;
g_OverlayStatus = 1;
Camera_Initialise();
g_NoInputCounter = 0;
Stats_StartTimer();
}

View file

@ -53,7 +53,6 @@ static PHASE_CONTROL M_Start(PHASE *const phase)
g_OverlayStatus = 1;
Camera_Initialise();
g_NoInputCounter = 0;
Stats_StartTimer();
return (PHASE_CONTROL) { .action = PHASE_ACTION_CONTINUE };

View file

@ -365,8 +365,6 @@ void Shell_Main(void)
}
int16_t gf_option = g_GameFlow.first_option;
g_NoInputCounter = 0;
bool is_loop_continued = true;
while (is_loop_continued) {
const int16_t gf_dir = gf_option & 0xFF00;

View file

@ -481,18 +481,17 @@ typedef struct __unaligned {
int16_t single_level;
uint16_t reserved2[16];
uint16_t demo_version: 1; // 0x0001
uint16_t title_disabled: 1; // 0x0002
uint16_t cheat_mode_check_disabled: 1; // 0x0004
uint16_t no_input_timeout: 1; // 0x0008
uint16_t load_save_disabled: 1; // 0x0010
uint16_t screen_sizing_disabled: 1; // 0x0020
uint16_t lockout_option_ring: 1; // 0x0040
uint16_t dozy_cheat_enabled: 1; // 0x0080
uint16_t cyphered_strings: 1; // 0x0100
uint16_t gym_enabled: 1; // 0x0200
uint16_t play_any_level: 1; // 0x0400
uint16_t cheat_enable: 1; // 0x0800
uint16_t demo_version: 1;
uint16_t title_disabled: 1;
uint16_t cheat_mode_check_disabled: 1;
uint16_t load_save_disabled: 1;
uint16_t screen_sizing_disabled: 1;
uint16_t lockout_option_ring: 1;
uint16_t dozy_cheat_enabled: 1;
uint16_t cyphered_strings: 1;
uint16_t gym_enabled: 1;
uint16_t play_any_level: 1;
uint16_t cheat_enable: 1;
uint16_t reserved3[3];
uint8_t cypher_code;

View file

@ -75,7 +75,6 @@ bool g_IsWibbleEffect;
bool g_IsWaterEffect;
bool g_IsShadeEffect;
int32_t g_IsChunkyCamera;
int32_t g_NoInputCounter;
int32_t g_FlipTimer;
bool g_IsDemoLoaded;
bool g_IsAssaultTimerDisplay;

View file

@ -73,7 +73,6 @@ extern bool g_IsWibbleEffect;
extern bool g_IsWaterEffect;
extern bool g_IsShadeEffect;
extern int32_t g_IsChunkyCamera;
extern int32_t g_NoInputCounter;
extern int32_t g_FlipTimer;
extern bool g_IsDemoLoaded;
extern bool g_IsAssaultTimerDisplay;