mirror of
https://github.com/LostArtefacts/TRX.git
synced 2025-04-28 20:58:07 +03:00
tr2/game-flow: split level_stats & level_complete
This commit is contained in:
parent
f520fc452f
commit
1ca1df7041
6 changed files with 62 additions and 35 deletions
|
@ -53,6 +53,7 @@
|
|||
{"type": "add_secret_reward", "object_id": "small_medipack"},
|
||||
{"type": "play_level"},
|
||||
{"type": "play_cutscene", "cutscene_id": 0},
|
||||
{"type": "level_stats"},
|
||||
{"type": "level_complete"},
|
||||
],
|
||||
"injections": [
|
||||
|
@ -67,6 +68,7 @@
|
|||
"sequence": [
|
||||
{"type": "add_secret_reward", "object_id": "magnums_ammo", "quantity": 4},
|
||||
{"type": "play_level"},
|
||||
{"type": "level_stats"},
|
||||
{"type": "level_complete"},
|
||||
],
|
||||
},
|
||||
|
@ -79,6 +81,7 @@
|
|||
{"type": "enable_sunset"},
|
||||
{"type": "add_secret_reward", "object_id": "shotgun_ammo", "quantity": 4},
|
||||
{"type": "play_level"},
|
||||
{"type": "level_stats"},
|
||||
{"type": "level_complete"},
|
||||
],
|
||||
},
|
||||
|
@ -92,6 +95,7 @@
|
|||
{"type": "add_secret_reward", "object_id": "uzis_ammo", "quantity": 4},
|
||||
{"type": "play_level"},
|
||||
{"type": "play_cutscene", "cutscene_id": 1},
|
||||
{"type": "level_stats"},
|
||||
{"type": "level_complete"},
|
||||
],
|
||||
"injections": [
|
||||
|
@ -111,6 +115,7 @@
|
|||
{"type": "add_secret_reward", "object_id": "uzis"},
|
||||
{"type": "add_secret_reward", "object_id": "uzis_ammo", "quantity": 2},
|
||||
{"type": "play_level"},
|
||||
{"type": "level_stats"},
|
||||
{"type": "level_complete"},
|
||||
],
|
||||
"injections": [
|
||||
|
@ -126,6 +131,7 @@
|
|||
{"type": "add_secret_reward", "object_id": "uzis_ammo", "quantity": 4},
|
||||
{"type": "play_level"},
|
||||
{"type": "play_cutscene", "cutscene_id": 2},
|
||||
{"type": "level_stats"},
|
||||
{"type": "level_complete"},
|
||||
],
|
||||
"injections": [
|
||||
|
@ -141,6 +147,7 @@
|
|||
{"type": "play_fmv", "fmv_id": 4},
|
||||
{"type": "add_secret_reward", "object_id": "harpoon_gun_ammo", "quantity": 4},
|
||||
{"type": "play_level"},
|
||||
{"type": "level_stats"},
|
||||
{"type": "level_complete"},
|
||||
],
|
||||
},
|
||||
|
@ -153,6 +160,7 @@
|
|||
{"type": "add_secret_reward", "object_id": "grenade_launcher"},
|
||||
{"type": "add_secret_reward", "object_id": "grenade_launcher_ammo", "quantity": 2},
|
||||
{"type": "play_level"},
|
||||
{"type": "level_stats"},
|
||||
{"type": "level_complete"},
|
||||
],
|
||||
"injections": [
|
||||
|
@ -168,6 +176,7 @@
|
|||
"sequence": [
|
||||
{"type": "add_secret_reward", "object_id": "m16_ammo", "quantity": 4},
|
||||
{"type": "play_level"},
|
||||
{"type": "level_stats"},
|
||||
{"type": "level_complete"},
|
||||
],
|
||||
},
|
||||
|
@ -179,6 +188,7 @@
|
|||
"sequence": [
|
||||
{"type": "add_secret_reward", "object_id": "grenade_launcher_ammo", "quantity": 4},
|
||||
{"type": "play_level"},
|
||||
{"type": "level_stats"},
|
||||
{"type": "level_complete"},
|
||||
],
|
||||
"injections": [
|
||||
|
@ -195,6 +205,7 @@
|
|||
{"type": "give_item", "object_id": "puzzle_4"},
|
||||
{"type": "add_secret_reward", "object_id": "uzis_ammo", "quantity": 4},
|
||||
{"type": "play_level"},
|
||||
{"type": "level_stats"},
|
||||
{"type": "level_complete"},
|
||||
],
|
||||
"injections": [
|
||||
|
@ -211,6 +222,7 @@
|
|||
{"type": "give_item", "object_id": "puzzle_4"},
|
||||
{"type": "add_secret_reward", "object_id": "m16_ammo", "quantity": 4},
|
||||
{"type": "play_level"},
|
||||
{"type": "level_stats"},
|
||||
{"type": "level_complete"},
|
||||
],
|
||||
"injections": [
|
||||
|
@ -226,6 +238,7 @@
|
|||
{"type": "add_secret_reward", "object_id": "grenade_launcher_ammo", "quantity": 2},
|
||||
{"type": "add_secret_reward", "object_id": "m16_ammo", "quantity": 2},
|
||||
{"type": "play_level"},
|
||||
{"type": "level_stats"},
|
||||
{"type": "level_complete"},
|
||||
],
|
||||
"injections": [
|
||||
|
@ -241,6 +254,7 @@
|
|||
"sequence": [
|
||||
{"type": "add_secret_reward", "object_id": "grenade_launcher_ammo", "quantity": 4},
|
||||
{"type": "play_level"},
|
||||
{"type": "level_stats"},
|
||||
{"type": "level_complete"},
|
||||
],
|
||||
"injections": [
|
||||
|
@ -258,6 +272,7 @@
|
|||
{"type": "add_secret_reward", "object_id": "uzis_ammo", "quantity": 8},
|
||||
{"type": "play_level"},
|
||||
{"type": "play_cutscene", "cutscene_id": 3},
|
||||
{"type": "level_stats"},
|
||||
{"type": "level_complete"},
|
||||
],
|
||||
"injections": [
|
||||
|
@ -274,6 +289,7 @@
|
|||
{"type": "disable_floor", "height": 9728},
|
||||
{"type": "add_secret_reward", "object_id": "grenade_launcher_ammo", "quantity": 8},
|
||||
{"type": "play_level"},
|
||||
{"type": "level_stats"},
|
||||
{"type": "level_complete"},
|
||||
],
|
||||
"injections": [
|
||||
|
@ -289,6 +305,7 @@
|
|||
"sequence": [
|
||||
{"type": "set_secret_count", "count": 0},
|
||||
{"type": "play_level"},
|
||||
{"type": "level_stats"},
|
||||
{"type": "level_complete"},
|
||||
{"type": "play_fmv", "fmv_id": 7},
|
||||
],
|
||||
|
|
|
@ -59,9 +59,9 @@ typedef enum {
|
|||
GFS_PLAY_FMV,
|
||||
GFS_PLAY_MUSIC,
|
||||
GFS_EXIT_TO_TITLE,
|
||||
GFS_LEVEL_STATS,
|
||||
GFS_TOTAL_STATS,
|
||||
#if TR_VERSION == 1
|
||||
GFS_LEVEL_STATS,
|
||||
GFS_LOADING_SCREEN,
|
||||
GFS_LOAD_LEVEL,
|
||||
GFS_EXIT_TO_LEVEL,
|
||||
|
|
|
@ -72,6 +72,7 @@ static M_SEQUENCE_EVENT_HANDLER m_SequenceEventHandlers[] = {
|
|||
{ GFS_REMOVE_WEAPONS, NULL, NULL },
|
||||
{ GFS_REMOVE_AMMO, NULL, NULL },
|
||||
{ GFS_LEVEL_COMPLETE, NULL, NULL },
|
||||
{ GFS_LEVEL_STATS, NULL, NULL },
|
||||
{ GFS_TOTAL_STATS, NULL, NULL },
|
||||
{ GFS_EXIT_TO_TITLE, NULL, NULL },
|
||||
|
||||
|
|
|
@ -170,42 +170,49 @@ GAME_FLOW_COMMAND GF_InterpretSequence(
|
|||
break;
|
||||
}
|
||||
|
||||
case GFS_LEVEL_COMPLETE:
|
||||
if (type == GFL_NORMAL) {
|
||||
const GAME_FLOW_LEVEL *const current_level =
|
||||
Game_GetCurrentLevel();
|
||||
START_INFO *const start = GF_GetResumeInfo(current_level);
|
||||
start->stats = g_SaveGame.current_stats;
|
||||
|
||||
if (g_GameFlow.level_complete_track != MX_INACTIVE) {
|
||||
Music_Play(g_GameFlow.level_complete_track, MPM_ALWAYS);
|
||||
}
|
||||
PHASE *const stats_phase =
|
||||
Phase_Stats_Create((PHASE_STATS_ARGS) {
|
||||
.background_type = BK_OBJECT,
|
||||
.show_final_stats = false,
|
||||
.level_num = current_level->num,
|
||||
.use_bare_style = false,
|
||||
});
|
||||
gf_cmd = PhaseExecutor_Run(stats_phase);
|
||||
Phase_Stats_Destroy(stats_phase);
|
||||
|
||||
start->available = 0;
|
||||
GAME_FLOW_LEVEL *const next_level =
|
||||
GF_GetLevel(current_level->num + 1, current_level->type);
|
||||
if (next_level != NULL) {
|
||||
CreateStartInfo(next_level);
|
||||
g_SaveGame.current_level = next_level->num;
|
||||
}
|
||||
if (next_level == NULL || gf_cmd.action != GF_NOOP) {
|
||||
return gf_cmd;
|
||||
}
|
||||
gf_cmd = (GAME_FLOW_COMMAND) {
|
||||
.action = GF_START_GAME,
|
||||
.param = next_level->num,
|
||||
};
|
||||
case GFS_LEVEL_STATS: {
|
||||
if (type != GFL_NORMAL) {
|
||||
break;
|
||||
}
|
||||
const GAME_FLOW_LEVEL *const current_level = Game_GetCurrentLevel();
|
||||
|
||||
if (g_GameFlow.level_complete_track != MX_INACTIVE) {
|
||||
Music_Play(g_GameFlow.level_complete_track, MPM_ALWAYS);
|
||||
}
|
||||
PHASE *const stats_phase = Phase_Stats_Create((PHASE_STATS_ARGS) {
|
||||
.background_type = BK_OBJECT,
|
||||
.show_final_stats = false,
|
||||
.level_num = current_level->num,
|
||||
.use_bare_style = false,
|
||||
});
|
||||
gf_cmd = PhaseExecutor_Run(stats_phase);
|
||||
Phase_Stats_Destroy(stats_phase);
|
||||
break;
|
||||
}
|
||||
|
||||
case GFS_LEVEL_COMPLETE: {
|
||||
if (type != GFL_NORMAL) {
|
||||
break;
|
||||
}
|
||||
const GAME_FLOW_LEVEL *const current_level = Game_GetCurrentLevel();
|
||||
START_INFO *const start = GF_GetResumeInfo(current_level);
|
||||
start->stats = g_SaveGame.current_stats;
|
||||
start->available = 0;
|
||||
GAME_FLOW_LEVEL *const next_level =
|
||||
GF_GetLevel(current_level->num + 1, current_level->type);
|
||||
if (next_level != NULL) {
|
||||
CreateStartInfo(next_level);
|
||||
g_SaveGame.current_level = next_level->num;
|
||||
}
|
||||
if (next_level == NULL || gf_cmd.action != GF_NOOP) {
|
||||
return gf_cmd;
|
||||
}
|
||||
gf_cmd = (GAME_FLOW_COMMAND) {
|
||||
.action = GF_START_GAME,
|
||||
.param = next_level->num,
|
||||
};
|
||||
break;
|
||||
}
|
||||
|
||||
case GFS_ENABLE_SUNSET:
|
||||
if (type != GFL_STORY && type != GFL_MID_STORY) {
|
||||
|
|
|
@ -19,6 +19,7 @@ ENUM_MAP_DEFINE(GAME_FLOW_SEQUENCE_EVENT_TYPE, GFS_ENABLE_SUNSET, "enable_su
|
|||
ENUM_MAP_DEFINE(GAME_FLOW_SEQUENCE_EVENT_TYPE, GFS_REMOVE_WEAPONS, "remove_weapons")
|
||||
ENUM_MAP_DEFINE(GAME_FLOW_SEQUENCE_EVENT_TYPE, GFS_REMOVE_AMMO, "remove_ammo")
|
||||
ENUM_MAP_DEFINE(GAME_FLOW_SEQUENCE_EVENT_TYPE, GFS_LEVEL_COMPLETE, "level_complete")
|
||||
ENUM_MAP_DEFINE(GAME_FLOW_SEQUENCE_EVENT_TYPE, GFS_LEVEL_STATS, "level_stats")
|
||||
ENUM_MAP_DEFINE(GAME_FLOW_SEQUENCE_EVENT_TYPE, GFS_TOTAL_STATS, "total_stats")
|
||||
ENUM_MAP_DEFINE(GAME_FLOW_SEQUENCE_EVENT_TYPE, GFS_SET_NUM_SECRETS, "set_secret_count")
|
||||
ENUM_MAP_DEFINE(GAME_FLOW_SEQUENCE_EVENT_TYPE, GFS_SET_CAMERA_ANGLE, "set_cutscene_angle")
|
||||
|
|
|
@ -231,6 +231,7 @@ def transform_script(script: list[int]):
|
|||
yield {"type": "play_level", "cutscene_id": cutscene_id}
|
||||
|
||||
case GameFlowEvent.LEVEL_COMPLETE:
|
||||
yield {"type": "level_stats"}
|
||||
yield {"type": "level_complete"}
|
||||
|
||||
case GameFlowEvent.DEMO_PLAY:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue