Skip to content

Commit

Permalink
tr1/game-flow: merge GFS_START_CINE to GFS_START_GAME
Browse files Browse the repository at this point in the history
  • Loading branch information
rr- committed Jan 22, 2025
1 parent 07936cd commit 25de8f1
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 31 deletions.
8 changes: 4 additions & 4 deletions data/tr1/ship/cfg/TR1X_gameflow.json5
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,7 @@
"data/injections/font.bin",
],
"sequence": [
{"type": "start_cine"},
{"type": "start_game"},
{"type": "set_cam_angle", "value": -23312},
{"type": "play_synced_audio", "audio_id": 23},
{"type": "loop_cine"},
Expand All @@ -426,7 +426,7 @@
"data/injections/photo.bin",
],
"sequence": [
{"type": "start_cine"},
{"type": "start_game"},
{"type": "set_cam_angle", "value": 16380},
{"type": "play_synced_audio", "audio_id": 25},
{"type": "mesh_swap", "object1_id": 77, "object2_id": 1, "mesh_id": 1},
Expand All @@ -449,7 +449,7 @@
"data/injections/font.bin",
],
"sequence": [
{"type": "start_cine"},
{"type": "start_game"},
{"type": "flip_map"},
{"type": "set_cam_angle", "value": 16384},
{"type": "play_synced_audio", "audio_id": 24},
Expand All @@ -475,7 +475,7 @@
"data/injections/font.bin",
],
"sequence": [
{"type": "start_cine"},
{"type": "start_game"},
{"type": "set_cam_angle", "value": 16384},
{"type": "play_synced_audio", "audio_id": 22},
{"type": "mesh_swap", "object1_id": 77, "object2_id": 1, "mesh_id": 1},
Expand Down
1 change: 0 additions & 1 deletion src/tr1/game/game_flow/common.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ static void M_FreeSequence(GAME_FLOW_SEQUENCE *const sequence)
case GFS_START_GAME:
case GFS_LOOP_GAME:
case GFS_STOP_GAME:
case GFS_START_CINE:
case GFS_LOOP_CINE:
case GFS_LEVEL_STATS:
case GFS_EXIT_TO_TITLE:
Expand Down
3 changes: 1 addition & 2 deletions src/tr1/game/game_flow/enum.h
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
#pragma once

typedef enum {
GFS_DISPLAY_PICTURE,
GFS_START_GAME,
GFS_LOOP_GAME,
GFS_STOP_GAME,
GFS_START_CINE,
GFS_LOOP_CINE,
GFS_PLAY_FMV,
GFS_LEVEL_STATS,
GFS_TOTAL_STATS,
GFS_LOADING_SCREEN,
GFS_DISPLAY_PICTURE,
GFS_EXIT_TO_TITLE,
GFS_EXIT_TO_LEVEL,
GFS_EXIT_TO_CINE,
Expand Down
1 change: 0 additions & 1 deletion src/tr1/game/game_flow/reader.c
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,6 @@ static bool M_LoadLevelSequence(JSON_OBJECT *obj, int32_t level_num)
case GFS_START_GAME:
case GFS_STOP_GAME:
case GFS_LOOP_GAME:
case GFS_START_CINE:
case GFS_LOOP_CINE:
event->data = (void *)(intptr_t)level_num;
break;
Expand Down
41 changes: 19 additions & 22 deletions src/tr1/game/game_flow/sequencer.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,15 +55,20 @@ GF_InterpretSequence(int32_t level_num, GAME_FLOW_LEVEL_TYPE level_type)
}

switch (event->type) {
case GFS_START_GAME:
if (level_type == GFL_DEMO) {
case GFS_START_GAME: {
const int32_t num = (int32_t)(intptr_t)event->data;
if (level_type == GFL_DEMO || level_type == GFL_CUTSCENE) {
break;
} else if (!Game_Start_Legacy(
(int32_t)(intptr_t)event->data, level_type)) {
}
const bool result = level_type == GFL_CUTSCENE
? Cutscene_Start(num)
: Game_Start_Legacy(num, level_type);
if (!result) {
g_CurrentLevel = -1;
return (GAME_FLOW_COMMAND) { .action = GF_EXIT_TO_TITLE };
}
break;
}

case GFS_LOOP_GAME:
if (level_type == GFL_DEMO) {
Expand Down Expand Up @@ -99,14 +104,6 @@ GF_InterpretSequence(int32_t level_num, GAME_FLOW_LEVEL_TYPE level_type)
}
break;

case GFS_START_CINE:
command =
GF_LoadLevel((int32_t)(intptr_t)event->data, GFL_CUTSCENE);
if (command.action != GF_NOOP) {
return command;
}
break;

case GFS_LOOP_CINE:
if (level_type != GFL_SAVED) {
command = GF_PlayCutscene((int32_t)(intptr_t)event->data);
Expand Down Expand Up @@ -306,20 +303,20 @@ GF_StorySoFar(const GAME_FLOW_SEQUENCE *const sequence, int32_t savegame_level)
case GFS_LEGACY:
break;

case GFS_START_GAME:
if ((int32_t)(intptr_t)event->data == savegame_level) {
case GFS_START_GAME: {
const int32_t level_num = (int32_t)(intptr_t)event->data;
if (level_num == savegame_level) {
return (GAME_FLOW_COMMAND) { .action = GF_EXIT_TO_TITLE };
}
break;

case GFS_START_CINE:
command =
GF_LoadLevel((int32_t)(intptr_t)event->data, GFL_CUTSCENE);
if (command.action != GF_NOOP
&& command.action != GF_LEVEL_COMPLETE) {
return command;
if (g_GameFlow.levels[level_num].level_type == GFL_CUTSCENE) {
command = GF_LoadLevel(level_num, GFL_CUTSCENE);
if (command.action != GF_NOOP
&& command.action != GF_LEVEL_COMPLETE) {
return command;
}
}
break;
}

case GFS_LOOP_CINE:
command = GF_PlayCutscene((int32_t)(intptr_t)event->data);
Expand Down
1 change: 0 additions & 1 deletion src/tr1/global/enum_map.def
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ ENUM_MAP_DEFINE(MUSIC_LOAD_CONDITION, MUSIC_LOAD_ALWAYS, "always")
ENUM_MAP_DEFINE(GAME_FLOW_SEQUENCE_EVENT_TYPE, GFS_START_GAME, "start_game")
ENUM_MAP_DEFINE(GAME_FLOW_SEQUENCE_EVENT_TYPE, GFS_STOP_GAME, "stop_game")
ENUM_MAP_DEFINE(GAME_FLOW_SEQUENCE_EVENT_TYPE, GFS_LOOP_GAME, "loop_game")
ENUM_MAP_DEFINE(GAME_FLOW_SEQUENCE_EVENT_TYPE, GFS_START_CINE, "start_cine")
ENUM_MAP_DEFINE(GAME_FLOW_SEQUENCE_EVENT_TYPE, GFS_LOOP_CINE, "loop_cine")
ENUM_MAP_DEFINE(GAME_FLOW_SEQUENCE_EVENT_TYPE, GFS_PLAY_FMV, "play_fmv")
ENUM_MAP_DEFINE(GAME_FLOW_SEQUENCE_EVENT_TYPE, GFS_LOADING_SCREEN, "loading_screen")
Expand Down

0 comments on commit 25de8f1

Please sign in to comment.