Skip to content

Commit

Permalink
tr2/game-flow: drop seq_ctx argument
Browse files Browse the repository at this point in the history
  • Loading branch information
rr- committed Feb 1, 2025
1 parent a162d31 commit ed6589b
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 17 deletions.
11 changes: 8 additions & 3 deletions src/tr2/game/game_flow/sequencer.c
Original file line number Diff line number Diff line change
Expand Up @@ -70,12 +70,12 @@ static DECLARE_EVENT_HANDLER(M_HandlePlayLevel)
if (seq_ctx == GFSC_STORY) {
return gf_cmd;
} else if (level->type == GFL_DEMO) {
if (!Level_Initialise(level, seq_ctx)) {
if (!Level_Initialise(level)) {
return (GF_COMMAND) { .action = GF_EXIT_TO_TITLE };
}
gf_cmd = GF_RunDemo(level->num);
} else if (level->type == GFL_CUTSCENE) {
if (!Level_Initialise(level, seq_ctx)) {
if (!Level_Initialise(level)) {
return (GF_COMMAND) { .action = GF_EXIT_TO_TITLE };
}
gf_cmd = GF_RunCutscene(level->num);
Expand All @@ -86,11 +86,16 @@ static DECLARE_EVENT_HANDLER(M_HandlePlayLevel)
}
InitialiseLevelFlags();
}
if (!Level_Initialise(level, seq_ctx)) {
if (!Level_Initialise(level)) {
Game_SetCurrentLevel(nullptr);
GF_SetCurrentLevel(nullptr);
return (GF_COMMAND) { .action = GF_EXIT_TO_TITLE };
}
if (seq_ctx == GFSC_SAVED) {
ExtractSaveGameInfo();
} else if (level->type == GFL_NORMAL) {
GF_InventoryModifier_Apply(Game_GetCurrentLevel(), GF_INV_REGULAR);
}
gf_cmd = GF_RunGame(level, seq_ctx);
}
if (gf_cmd.action == GF_LEVEL_COMPLETE) {
Expand Down
2 changes: 1 addition & 1 deletion src/tr2/game/game_flow/sequencer_misc.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ GF_COMMAND GF_RunTitle(void)
Savegame_UnbindSlot();
GameStringTable_Apply(nullptr);
const GF_LEVEL *const title_level = GF_GetTitleLevel();
if (!Level_Initialise(title_level, GFSC_NORMAL)) {
if (!Level_Initialise(title_level)) {
return (GF_COMMAND) { .action = GF_EXIT_GAME };
}
return GF_ShowInventory(INV_TITLE_MODE);
Expand Down
15 changes: 3 additions & 12 deletions src/tr2/game/level.c
Original file line number Diff line number Diff line change
Expand Up @@ -714,10 +714,9 @@ bool Level_Load(const GF_LEVEL *const level)
return true;
}

bool Level_Initialise(
const GF_LEVEL *const level, const GF_SEQUENCE_CONTEXT seq_ctx)
bool Level_Initialise(const GF_LEVEL *const level)
{
LOG_DEBUG("num=%d type=%d seq_ctx=%d", level->num, level->type, seq_ctx);
LOG_DEBUG("num=%d type=%d", level->num, level->type);
if (level->type == GFL_DEMO) {
Random_SeedDraw(0xD371F947);
Random_SeedControl(0xD371F947);
Expand Down Expand Up @@ -747,21 +746,13 @@ bool Level_Initialise(
if (g_Lara.item_num != NO_ITEM) {
Lara_Initialise(level);
}
if (level->type == GFL_NORMAL || level->type == GFL_DEMO
|| seq_ctx == GFSC_SAVED) {
GetCarriedItems();
}
GetCarriedItems();

Effect_InitialiseArray();
LOT_InitialiseArray();
Overlay_Reset();
g_HealthBarTimer = 100;
Sound_StopAll();
if (seq_ctx == GFSC_SAVED) {
ExtractSaveGameInfo();
} else if (level->type == GFL_NORMAL) {
GF_InventoryModifier_Apply(Game_GetCurrentLevel(), GF_INV_REGULAR);
}

if (g_Objects[O_FINAL_LEVEL_COUNTER].loaded) {
InitialiseFinalLevel();
Expand Down
2 changes: 1 addition & 1 deletion src/tr2/game/level.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@

#include <libtrx/game/level/common.h>

bool Level_Initialise(const GF_LEVEL *level, GF_SEQUENCE_CONTEXT seq_ctx);
bool Level_Initialise(const GF_LEVEL *level);
bool Level_Load(const GF_LEVEL *level);
void Level_Unload(void);

0 comments on commit ed6589b

Please sign in to comment.