From f396ef451414972e05c4be3e6636e68bc4508199 Mon Sep 17 00:00:00 2001 From: lahm86 <33758420+lahm86@users.noreply.github.com> Date: Sun, 23 Mar 2025 12:47:53 +0000 Subject: [PATCH] tr2: add support for The Golden Mask This implements support for the Golden Mask by providing relevant game flow files, command line handling, and object alias setup on launch. Resolves #1554. Resolves #1604. Resolves #1621. Resolves #2667. --- data/tr2/ship/cfg/TR2X_gameflow_gm.json5 | 137 ++++++++++++++++++ data/tr2/ship/cfg/TR2X_strings.json5 | 2 +- data/tr2/ship/cfg/TR2X_strings_gm.json5 | 61 ++++++++ docs/tr2/CHANGELOG.md | 1 + docs/tr2/README.md | 1 + src/tr2/game/shell/common.c | 23 +++ .../TR2X_ConfigTool/Resources/const.json | 2 +- 7 files changed, 225 insertions(+), 2 deletions(-) create mode 100644 data/tr2/ship/cfg/TR2X_gameflow_gm.json5 create mode 100644 data/tr2/ship/cfg/TR2X_strings_gm.json5 diff --git a/data/tr2/ship/cfg/TR2X_gameflow_gm.json5 b/data/tr2/ship/cfg/TR2X_gameflow_gm.json5 new file mode 100644 index 000000000..e66e5cada --- /dev/null +++ b/data/tr2/ship/cfg/TR2X_gameflow_gm.json5 @@ -0,0 +1,137 @@ +{ + // NOTE: bad changes to this file may result in crashes. + // Lines starting with double slashes are comments and are ignored. + + "main_menu_picture": "data/title_eu_gm.pcx", + "savegame_fmt_legacy": "savegame_gm.%d", + + "cmd_init": {"action": "exit_to_title"}, + "cmd_title": {"action": "noop"}, + "cmd_death_in_demo": {"action": "exit_to_title"}, + "cmd_death_in_game": {"action": "noop"}, + "cmd_demo_interrupt": {"action": "exit_to_title"}, + "cmd_demo_end": {"action": "exit_to_title"}, + + "cheat_keys": true, + "load_save_disabled": false, + "play_any_level": false, + "lockout_option_ring": false, + "gym_enabled": false, + "demo_version": false, + "single_level": -1, + + "demo_delay": 30, + "secret_track": 47, + + "title": { + "path": "data/title_gm.tr2", + "music_track": 64, + "sequence": [ + {"type": "display_picture", "path": "data/legal.pcx"}, + {"type": "exit_to_title"}, + ], + }, + + "sfx_path": "data/main_gm.sfx", + "injections": [ + "data/injections/font.bin", + ], + + "levels": [ + // 0. Lara's Home + { + "type": "gym", + "path": "data/assault.tr2", + "music_track": -1, + "sequence": [ + {"type": "loop_game"}, + {"type": "level_stats"}, + ], + }, + + // 1. The Cold War + { + "path": "data/level1.tr2", + "music_track": 33, + "sequence": [ + {"type": "loop_game"}, + {"type": "play_music", "music_track": 41}, + {"type": "level_stats"}, + {"type": "level_complete"}, + ], + }, + + // 2. Fool's Gold + { + "path": "data/level2.tr2", + "music_track": 58, + "sequence": [ + {"type": "loop_game"}, + {"type": "play_music", "music_track": 41}, + {"type": "level_stats"}, + {"type": "level_complete"}, + ], + }, + + // 3. Furnace of the Gods + { + "path": "data/level3.tr2", + "music_track": 59, + "sequence": [ + {"type": "loop_game"}, + {"type": "play_music", "music_track": 41}, + {"type": "level_stats"}, + {"type": "level_complete"}, + ], + }, + + // 4. Kingdom + { + "path": "data/level4.tr2", + "music_track": 31, + "sequence": [ + {"type": "give_item", "object_id": "puzzle_1"}, + {"type": "loop_game"}, + {"type": "play_music", "music_track": 52}, + {"type": "display_picture", "path": "data/credit00_gm.pcx", "display_time": 15, "fade_in_time": 0.5, "fade_out_time": 0.5}, + {"type": "display_picture", "path": "data/credit01.pcx", "display_time": 15, "fade_in_time": 0.5, "fade_out_time": 0.5}, + {"type": "display_picture", "path": "data/credit02.pcx", "display_time": 15, "fade_in_time": 0.5, "fade_out_time": 0.5}, + {"type": "display_picture", "path": "data/credit03.pcx", "display_time": 15, "fade_in_time": 0.5, "fade_out_time": 0.5}, + {"type": "display_picture", "path": "data/credit04.pcx", "display_time": 15, "fade_in_time": 0.5, "fade_out_time": 0.5}, + {"type": "display_picture", "path": "data/credit05.pcx", "display_time": 15, "fade_in_time": 0.5, "fade_out_time": 0.5}, + {"type": "display_picture", "path": "data/credit06.pcx", "display_time": 15, "fade_in_time": 0.5, "fade_out_time": 0.5}, + {"type": "display_picture", "path": "data/credit07_gm.pcx", "display_time": 15, "fade_in_time": 0.5, "fade_out_time": 0.5}, + {"type": "display_picture", "path": "data/credit08.pcx", "display_time": 15, "fade_in_time": 0.5, "fade_out_time": 0.5}, + {"type": "total_stats", "background_path": "data/end.pcx"}, + {"type": "level_complete"}, + ], + }, + + // 5. Nightmare in Vegas + { + "path": "data/level5.tr2", + "type": "bonus", + "music_track": 34, + "sequence": [ + {"type": "remove_weapons"}, + {"type": "remove_ammo"}, + {"type": "remove_flares"}, + {"type": "remove_medipacks"}, + {"type": "give_item", "object_id": "pistols"}, + {"type": "loop_game"}, + {"type": "play_music", "music_track": 41}, + {"type": "level_stats"}, + {"type": "level_complete"}, + ], + }, + ], + + "demos": [ + ], + + "cutscenes": [ + ], + + "fmvs": [ + ], +} diff --git a/data/tr2/ship/cfg/TR2X_strings.json5 b/data/tr2/ship/cfg/TR2X_strings.json5 index 102c1d15b..65078e21f 100644 --- a/data/tr2/ship/cfg/TR2X_strings.json5 +++ b/data/tr2/ship/cfg/TR2X_strings.json5 @@ -141,7 +141,7 @@ { "title": "Ice Palace", "objects": { - "tiger": {"name": "Snow Leopard"}, + "tiger": {"name": "White Tiger"}, "key_2": {"name": "Gong Hammer"}, "pickup_2": {"name": "Talion"}, "puzzle_1": {"name": "Tibetan Mask"}, diff --git a/data/tr2/ship/cfg/TR2X_strings_gm.json5 b/data/tr2/ship/cfg/TR2X_strings_gm.json5 new file mode 100644 index 000000000..255fb1a46 --- /dev/null +++ b/data/tr2/ship/cfg/TR2X_strings_gm.json5 @@ -0,0 +1,61 @@ +{ + // For usage, refer to the documentation here: + // https://github.com/LostArtefacts/TRX/blob/stable/docs/GAME_STRINGS.md + + "levels": [ + // 0. Lara's Home + { + "title": "Lara's Home", + }, + + // 1. The Cold War + { + "title": "The Cold War", + "objects": { + "tiger": {"name": "Snow Leopard"}, + "key_1": {"name": "Guardroom Key"}, + "key_2": {"name": "Shaft 'B' Key"}, + }, + }, + + // 2. Fool's Gold + { + "title": "Fool's Gold", + "objects": { + "key_1": {"name": "CardKey 1"}, + "key_4": {"name": "CardKey 2"}, + "puzzle_1": {"name": "Circuit Board"}, + }, + }, + + // 3. Furnace of the Gods + { + "title": "Furnace of the Gods", + "objects": { + "big_spider": {"name": "Polar Bear"}, + "spider": {"name": "Wolf"}, + "puzzle_1": {"name": "Mask of Tornarsuk"}, + "puzzle_2": {"name": "Gold Nugget"}, + }, + }, + + // 4. Kingdom + { + "title": "Kingdom", + "objects": { + "tiger": {"name": "Snow Leopard"}, + "puzzle_1": {"name": "Mask of Tornarsuk"}, + }, + }, + + // 5. Nightmare in Vegas + { + "title": "Nightmare in Vegas", + "objects": { + "key_1": {"name": "Hotel Key"}, + "puzzle_1": {"name": "Elevator Junction"}, + "puzzle_2": {"name": "Door Circuit"}, + }, + }, + ], +} diff --git a/docs/tr2/CHANGELOG.md b/docs/tr2/CHANGELOG.md index 8114827b7..fdb35240c 100644 --- a/docs/tr2/CHANGELOG.md +++ b/docs/tr2/CHANGELOG.md @@ -1,4 +1,5 @@ ## [Unreleased](https://github.com/LostArtefacts/TRX/compare/tr2-0.10...develop) - ××××-××-×× +- added support for The Golden Mask (#1621) - added the bonus level game flow type, which allows for levels to be unlocked if all main game secrets are found (#2668) - added the ability for custom levels to have up to two of each secret type per level (#2674) - fixed the final two levels not allowing for secrets to be counted in the statistics (#1582) diff --git a/docs/tr2/README.md b/docs/tr2/README.md index 64868b39a..8d35dea81 100644 --- a/docs/tr2/README.md +++ b/docs/tr2/README.md @@ -48,6 +48,7 @@ game with new enhancements and features. - added support for 60 FPS rendering - added a pause screen - added a photo mode feature +- added combined support for The Golden Mask - changed inventory to pause the music rather than muting it - fixed killing the T-Rex with a grenade launcher crashing the game - fixed secret rewards not displaying shotgun ammo diff --git a/src/tr2/game/shell/common.c b/src/tr2/game/shell/common.c index b8124eabb..89d22a7db 100644 --- a/src/tr2/game/shell/common.c +++ b/src/tr2/game/shell/common.c @@ -12,6 +12,9 @@ #include "game/input.h" #include "game/level.h" #include "game/music.h" +#include "game/objects/creatures/big_spider.h" +#include "game/objects/creatures/monk.h" +#include "game/objects/creatures/spider.h" #include "game/output.h" #include "game/phase.h" #include "game/random.h" @@ -26,6 +29,8 @@ #include #include #include +#include +#include #include #include #include @@ -38,6 +43,7 @@ typedef enum { M_MOD_UNKNOWN, M_MOD_OG, + M_MOD_GM, M_MOD_CUSTOM_LEVEL, } M_MOD; @@ -55,6 +61,10 @@ static struct { .game_flow_path = "cfg/TR2X_gameflow.json5", .game_strings_path = "cfg/TR2X_strings.json5", }, + [M_MOD_GM] = { + .game_flow_path = "cfg/TR2X_gameflow_gm.json5", + .game_strings_path = "cfg/TR2X_strings_gm.json5", + }, [M_MOD_CUSTOM_LEVEL] = { .game_flow_path = "cfg/TR2X_gameflow_level.json5", .game_strings_path = "cfg/TR2X_strings_level.json5", @@ -308,6 +318,9 @@ static void M_ParseArgs(SHELL_ARGS *const out_args) out_args->mod = M_MOD_OG; for (int32_t i = 0; i < arg_count; i++) { + if (!strcmp(args[i], "-gold")) { + out_args->mod = M_MOD_GM; + } if ((!strcmp(args[i], "-l") || !strcmp(args[i], "--level")) && i + 1 < arg_count) { out_args->level_to_play = args[i + 1]; @@ -378,6 +391,16 @@ void Shell_Main(void) { M_ParseArgs(&m_Args); + if (m_Args.mod == M_MOD_GM) { + Object_Get(O_MONK_3)->setup_func = Monk3_Setup; + Object_Get(O_BEAR)->setup_func = Bear_Setup; + Object_Get(O_WOLF)->setup_func = Wolf_Setup; + } else { + Object_Get(O_MONK_1)->setup_func = Monk1_Setup; + Object_Get(O_SPIDER)->setup_func = Spider_Setup; + Object_Get(O_BIG_SPIDER)->setup_func = BigSpider_Setup; + } + GameString_Init(); EnumMap_Init(); Config_Init(); diff --git a/tools/tr2/config/TR2X_ConfigTool/Resources/const.json b/tools/tr2/config/TR2X_ConfigTool/Resources/const.json index 5ba5c9b3a..b6d50e8ca 100644 --- a/tools/tr2/config/TR2X_ConfigTool/Resources/const.json +++ b/tools/tr2/config/TR2X_ConfigTool/Resources/const.json @@ -3,6 +3,6 @@ "ConfigPath": "cfg\\TR2X.json5", "GameFlowName": "TR2X_gameflow.json5", "ExecutableName": "TR2X.exe", - "GoldSupported": false, + "GoldSupported": true, "GitHubURL": "https://github.com/LostArtefacts/TRX" }