From bffc9b0054c4d61ae392ffa425c9bacf4097b8ae Mon Sep 17 00:00:00 2001 From: walkawayy <81546780+walkawayy@users.noreply.github.com> Date: Thu, 31 Aug 2023 20:46:50 -0400 Subject: [PATCH] config: move enable_game_modes from gameflow to config Resolves #962. --- CHANGELOG.md | 1 + bin/cfg/Tomb1Main_gameflow.json5 | 3 --- bin/cfg/Tomb1Main_gameflow_ub.json5 | 1 - src/config.c | 2 ++ src/config.h | 1 + src/game/gameflow.c | 7 ------- src/game/gameflow.h | 1 - src/game/option/option_passport.c | 2 +- tools/config/Tomb1Main_ConfigTool/Resources/Lang/en.json | 4 ++++ .../Tomb1Main_ConfigTool/Resources/specification.json | 5 +++++ 10 files changed, 14 insertions(+), 13 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 44c78a387..5188fd992 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,6 +22,7 @@ - fixed data portal issues in Atlantean Stronghold that could result in a crash (#227) - fixed the camera in Natla's Mines when pulling the lever in room 67 (#352) - fixed flame emitter saving and loading which caused rare crashing (#947) +- moved the enable_game_modes option from the gameflow to the config tool (#962) - improve spanish localization and added translation for rotated pickups ## [2.15.3](https://github.com/rr-/Tomb1Main/compare/2.15.2...2.15.3) - 2023-08-15 diff --git a/bin/cfg/Tomb1Main_gameflow.json5 b/bin/cfg/Tomb1Main_gameflow.json5 index b4afbcd8c..f63bc5654 100644 --- a/bin/cfg/Tomb1Main_gameflow.json5 +++ b/bin/cfg/Tomb1Main_gameflow.json5 @@ -9,9 +9,6 @@ "savegame_fmt_legacy": "saveati.%d", "savegame_fmt_bson": "save_tr1_%02d.dat", - // whether to allow user to select NG/NG+/etc. modes in the new game dialog - "enable_game_modes": true, - // disables saving except in the locations near the crystals. "enable_save_crystals": false, diff --git a/bin/cfg/Tomb1Main_gameflow_ub.json5 b/bin/cfg/Tomb1Main_gameflow_ub.json5 index 328a2db1b..2572682ae 100644 --- a/bin/cfg/Tomb1Main_gameflow_ub.json5 +++ b/bin/cfg/Tomb1Main_gameflow_ub.json5 @@ -4,7 +4,6 @@ "main_menu_picture": "data/titleh_ub.png", "savegame_fmt_legacy": "saveuba.%d", "savegame_fmt_bson": "save_trub_%02d.dat", - "enable_game_modes": true, "enable_save_crystals": false, "demo_delay": 16, "water_color": [0.45, 1.0, 1.0], diff --git a/src/config.c b/src/config.c index d1ed4de05..bed0eb8b7 100644 --- a/src/config.c +++ b/src/config.c @@ -235,6 +235,7 @@ bool Config_ReadFromJSON(const char *cfg_data) READ_BOOL(load_music_triggers, true); READ_BOOL(fix_item_rots, true); READ_BOOL(restore_ps1_enemies, false); + READ_BOOL(enable_game_modes, true); CLAMP(g_Config.start_lara_hitpoints, 1, LARA_HITPOINTS); CLAMP(g_Config.fov_value, 30, 255); @@ -423,6 +424,7 @@ bool Config_Write(void) WRITE_BOOL(load_music_triggers); WRITE_BOOL(fix_item_rots); WRITE_BOOL(restore_ps1_enemies); + WRITE_BOOL(enable_game_modes); // User settings WRITE_BOOL(rendering.enable_bilinear_filter); diff --git a/src/config.h b/src/config.h index 8224bf2f5..dffd880ed 100644 --- a/src/config.h +++ b/src/config.h @@ -115,6 +115,7 @@ typedef struct { bool load_music_triggers; bool fix_item_rots; bool restore_ps1_enemies; + bool enable_game_modes; struct { int32_t layout; diff --git a/src/game/gameflow.c b/src/game/gameflow.c index 6e51ac28d..94a743b83 100644 --- a/src/game/gameflow.c +++ b/src/game/gameflow.c @@ -228,13 +228,6 @@ static bool GameFlow_LoadScriptMeta(struct json_object_s *obj) } g_GameFlow.demo_delay = tmp_d * FRAMES_PER_SECOND; - tmp_i = json_object_get_bool(obj, "enable_game_modes", JSON_INVALID_BOOL); - if (tmp_i == JSON_INVALID_BOOL) { - LOG_ERROR("'enable_game_modes' must be a boolean"); - return false; - } - g_GameFlow.enable_game_modes = tmp_i; - tmp_i = json_object_get_bool(obj, "enable_save_crystals", JSON_INVALID_BOOL); if (tmp_i == JSON_INVALID_BOOL) { diff --git a/src/game/gameflow.h b/src/game/gameflow.h index 7f5c1ca9c..92b895953 100644 --- a/src/game/gameflow.h +++ b/src/game/gameflow.h @@ -66,7 +66,6 @@ typedef struct GAMEFLOW { char *savegame_fmt_bson; int8_t has_demo; int32_t demo_delay; - int8_t enable_game_modes; int8_t enable_save_crystals; GAMEFLOW_LEVEL *levels; char *strings[GS_NUMBER_OF]; diff --git a/src/game/option/option_passport.c b/src/game/option/option_passport.c index 8217952f4..e9ed57c4c 100644 --- a/src/game/option/option_passport.c +++ b/src/game/option/option_passport.c @@ -473,7 +473,7 @@ void Option_Passport(INVENTORY_ITEM *inv_item) if (g_InvMode == INV_TITLE_MODE || (g_CurrentLevel == g_GameFlow.gym_level_num && g_InvMode != INV_DEATH_MODE)) { - if (g_GameFlow.enable_game_modes) { + if (g_Config.enable_game_modes) { Option_PassportInitNewGameRequester(); m_PassportMode = PASSPORT_MODE_NEW_GAME; g_Input = (INPUT_STATE) { 0 }; diff --git a/tools/config/Tomb1Main_ConfigTool/Resources/Lang/en.json b/tools/config/Tomb1Main_ConfigTool/Resources/Lang/en.json index 289b23fbf..46efda3ef 100644 --- a/tools/config/Tomb1Main_ConfigTool/Resources/Lang/en.json +++ b/tools/config/Tomb1Main_ConfigTool/Resources/Lang/en.json @@ -243,6 +243,10 @@ "Title": "Restore PS1 enemies", "Description": "Adds the mummy that appears in the PlayStation version of City of Khamoon, room 25.\nChanging this option will require restarting the level." }, + "enable_game_modes": { + "Title": "Enable game modes", + "Description": "Allows new game plus options to be selected from the new game passport menu.\n-New Game+: unlocks all weapons with infinite ammo; enemies have double the HP.\n-Japanese NG: weapons do double damage.\n-Japanese NG+: combination of New Game+ and Japanese NG." + }, "enable_timer_in_inventory": { "Title": "Timer counts in inventory", "Description": "Makes the in-game timer work even while the game is showing the inventory." diff --git a/tools/config/Tomb1Main_ConfigTool/Resources/specification.json b/tools/config/Tomb1Main_ConfigTool/Resources/specification.json index 30297e103..81a0287a2 100644 --- a/tools/config/Tomb1Main_ConfigTool/Resources/specification.json +++ b/tools/config/Tomb1Main_ConfigTool/Resources/specification.json @@ -271,6 +271,11 @@ "DataType": "Bool", "DefaultValue": false }, + { + "Field": "enable_game_modes", + "DataType": "Bool", + "DefaultValue": true + }, { "Field": "enable_timer_in_inventory", "DataType": "Bool",