Skip to content

Commit

Permalink
game-flow: initialise cutscenes in gameflow
Browse files Browse the repository at this point in the history
  • Loading branch information
rr- committed Feb 1, 2025
1 parent d0aee40 commit 06e67e1
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 11 deletions.
9 changes: 2 additions & 7 deletions src/tr1/game/cutscene.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,9 @@
#include "global/types.h"
#include "global/vars.h"

#include <libtrx/debug.h>
#include <libtrx/memory.h>

#include <stdint.h>

static void M_InitialiseLara(const GF_LEVEL *level);

static void M_InitialiseLara(const GF_LEVEL *const level)
Expand Down Expand Up @@ -60,11 +59,7 @@ static void M_InitialiseLara(const GF_LEVEL *const level)
bool Cutscene_Start(const int32_t level_num)
{
const GF_LEVEL *const level = GF_GetLevel(GFLT_CUTSCENES, level_num);
if (GF_GetCurrentLevel()->num != level_num) {
if (!Level_Initialise(level)) {
return false;
}
}
ASSERT(GF_GetCurrentLevel() == level);

M_InitialiseLara(level);

Expand Down
1 change: 1 addition & 0 deletions src/tr1/game/game_flow/sequencer.c
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,7 @@ static DECLARE_EVENT_HANDLER(M_HandlePlayLevel)
ASSERT(GF_GetCurrentLevel() == level);
gf_cmd = GF_RunDemo(level->num);
} else if (level->type == GFL_CUTSCENE) {
ASSERT(GF_GetCurrentLevel() == level);
gf_cmd = GF_RunCutscene(level->num);
} else {
if (seq_ctx != GFSC_SAVED && level != GF_GetFirstLevel()) {
Expand Down
6 changes: 2 additions & 4 deletions src/tr2/game/cutscene.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#include "global/vars.h"

#include <libtrx/config.h>
#include <libtrx/log.h>
#include <libtrx/debug.h>
#include <libtrx/utils.h>

static void M_FixAudioDrift(void);
Expand All @@ -35,9 +35,7 @@ static void M_FixAudioDrift(void)
bool Cutscene_Start(const int32_t level_num)
{
const GF_LEVEL *const level = GF_GetLevel(GFLT_CUTSCENES, level_num);
if (!Level_Initialise(level, GFSC_NORMAL)) {
return false;
}
ASSERT(GF_GetCurrentLevel() == level);

Room_InitCinematic();
CutscenePlayer1_Initialise(g_Lara.item_num);
Expand Down
3 changes: 3 additions & 0 deletions src/tr2/game/game_flow/sequencer.c
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,9 @@ static DECLARE_EVENT_HANDLER(M_HandlePlayLevel)
}
gf_cmd = GF_RunDemo(level->num);
} else if (level->type == GFL_CUTSCENE) {
if (!Level_Initialise(level, seq_ctx)) {
return (GF_COMMAND) { .action = GF_EXIT_TO_TITLE };
}
gf_cmd = GF_RunCutscene(level->num);
} else {
gf_cmd = GF_RunGame(level, seq_ctx);
Expand Down

0 comments on commit 06e67e1

Please sign in to comment.