Skip to content

Commit

Permalink
tr1/game-flow: merge GFS_LOOP_CINE to GFS_LOOP_GAME
Browse files Browse the repository at this point in the history
  • Loading branch information
rr- committed Jan 23, 2025
1 parent 0a9bc1d commit ed37453
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 27 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 @@ -390,7 +390,7 @@
{"type": "start_game"},
{"type": "set_cam_angle", "value": -23312},
{"type": "play_synced_audio", "audio_id": 23},
{"type": "loop_cine"},
{"type": "loop_game"},
{"type": "level_stats", "level_id": 4},
{"type": "exit_to_level", "level_id": 5},
],
Expand All @@ -415,7 +415,7 @@
{"type": "play_synced_audio", "audio_id": 25},
{"type": "mesh_swap", "object1_id": 77, "object2_id": 1, "mesh_id": 1},
{"type": "mesh_swap", "object1_id": 77, "object2_id": 1, "mesh_id": 4},
{"type": "loop_cine"},
{"type": "loop_game"},
{"type": "level_stats", "level_id": 9},
{"type": "exit_to_level", "level_id": 10},
],
Expand All @@ -437,7 +437,7 @@
{"type": "flip_map"},
{"type": "set_cam_angle", "value": 16384},
{"type": "play_synced_audio", "audio_id": 24},
{"type": "loop_cine"},
{"type": "loop_game"},
{"type": "exit_to_level", "level_id": 14},
],
},
Expand All @@ -464,7 +464,7 @@
{"type": "play_synced_audio", "audio_id": 22},
{"type": "mesh_swap", "object1_id": 77, "object2_id": 1, "mesh_id": 1},
{"type": "mesh_swap", "object1_id": 77, "object2_id": 1, "mesh_id": 4},
{"type": "loop_cine"},
{"type": "loop_game"},
{"type": "level_stats", "level_id": 14},
{"type": "exit_to_level", "level_id": 15},
],
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 @@ -27,7 +27,6 @@ static void M_FreeSequence(GAME_FLOW_SEQUENCE *const sequence)
break;
case GFS_START_GAME:
case GFS_LOOP_GAME:
case GFS_LOOP_CINE:
case GFS_LEVEL_STATS:
case GFS_EXIT_TO_TITLE:
case GFS_EXIT_TO_LEVEL:
Expand Down
1 change: 0 additions & 1 deletion src/tr1/game/game_flow/enum.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ typedef enum {
GFS_DISPLAY_PICTURE,
GFS_START_GAME,
GFS_LOOP_GAME,
GFS_LOOP_CINE,
GFS_PLAY_FMV,
GFS_LEVEL_STATS,
GFS_TOTAL_STATS,
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 @@ -162,7 +162,6 @@ static bool M_LoadLevelSequence(JSON_OBJECT *obj, int32_t level_num)
switch (event->type) {
case GFS_START_GAME:
case GFS_LOOP_GAME:
case GFS_LOOP_CINE:
event->data = (void *)(intptr_t)level_num;
break;

Expand Down
39 changes: 20 additions & 19 deletions src/tr1/game/game_flow/sequencer.c
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,15 @@ GF_InterpretSequence(int32_t level_num, GAME_FLOW_LEVEL_TYPE level_type)
}

case GFS_LOOP_GAME:
if (level_type == GFL_DEMO) {
if (g_GameFlow.levels[level_num].level_type == GFL_CUTSCENE) {
if (level_type != GFL_SAVED) {
command = GF_PlayCutscene((int32_t)(intptr_t)event->data);
if (command.action != GF_NOOP
&& command.action != GF_LEVEL_COMPLETE) {
return command;
}
}
} else if (level_type == GFL_DEMO) {
PHASE *const phase = Phase_Demo_Create(level_num);
const GAME_FLOW_COMMAND gf_cmd = PhaseExecutor_Run(phase);
Phase_Demo_Destroy(phase);
Expand All @@ -95,16 +103,6 @@ GF_InterpretSequence(int32_t level_num, GAME_FLOW_LEVEL_TYPE level_type)
}
break;

case GFS_LOOP_CINE:
if (level_type != GFL_SAVED) {
command = GF_PlayCutscene((int32_t)(intptr_t)event->data);
if (command.action != GF_NOOP
&& command.action != GF_LEVEL_COMPLETE) {
return command;
}
}
break;

case GFS_PLAY_FMV:
if (level_type != GFL_SAVED) {
FMV_Play((char *)event->data);
Expand Down Expand Up @@ -279,7 +277,6 @@ GF_StorySoFar(const GAME_FLOW_SEQUENCE *const sequence, int32_t savegame_level)
LOG_INFO("event %d %d", event->type, event->data);

switch (event->type) {
case GFS_LOOP_GAME:
case GFS_LEVEL_STATS:
case GFS_TOTAL_STATS:
case GFS_LOADING_SCREEN:
Expand All @@ -297,8 +294,8 @@ GF_StorySoFar(const GAME_FLOW_SEQUENCE *const sequence, int32_t savegame_level)
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 };
}
if (g_GameFlow.levels[level_num].level_type == GFL_CUTSCENE) {
} else 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) {
Expand All @@ -308,13 +305,17 @@ GF_StorySoFar(const GAME_FLOW_SEQUENCE *const sequence, int32_t savegame_level)
break;
}

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

case GFS_PLAY_FMV:
FMV_Play((char *)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 @@ -36,7 +36,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_LOOP_GAME, "loop_game")
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")
ENUM_MAP_DEFINE(GAME_FLOW_SEQUENCE_EVENT_TYPE, GFS_DISPLAY_PICTURE, "display_picture")
Expand Down

0 comments on commit ed37453

Please sign in to comment.