Skip to content

Commit

Permalink
rename option, move gameflow and config check, tweak behavior
Browse files Browse the repository at this point in the history
  • Loading branch information
walkawayy committed Sep 5, 2023
1 parent a9d3cc1 commit de1a50a
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 11 deletions.
2 changes: 1 addition & 1 deletion bin/cfg/Tomb1Main_gameflow.json5
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

// forces whether save crystals are enabled or not
// overrides the config option enable_save_crystals
"enable_save_crystals_option": true,
"force_enable_save_crystals": false,

// seconds to pass in the main menu before playing the demo
"demo_delay": 16,
Expand Down
2 changes: 1 addition & 1 deletion bin/cfg/Tomb1Main_gameflow_ub.json5
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"savegame_fmt_legacy": "saveuba.%d",
"savegame_fmt_bson": "save_trub_%02d.dat",
"disable_game_modes ": false,
"enable_save_crystals_option": true,
"force_enable_save_crystals": false,
"demo_delay": 16,
"water_color": [0.45, 1.0, 1.0],
"draw_distance_fade": 22,
Expand Down
14 changes: 6 additions & 8 deletions src/game/gameflow.c
Original file line number Diff line number Diff line change
Expand Up @@ -231,14 +231,8 @@ static bool GameFlow_LoadScriptMeta(struct json_object_s *obj)
g_GameFlow.disable_game_modes =
json_object_get_bool(obj, "disable_game_modes ", false);

g_GameFlow.enable_save_crystals_option =
json_object_get_bool(obj, "enable_save_crystals_option", false);
g_Config.enable_save_crystals &= g_GameFlow.enable_save_crystals_option;
LOG_DEBUG(
"g_GameFlow.enable_save_crystals_option: %d",
g_GameFlow.enable_save_crystals_option);
LOG_DEBUG(
"g_Config.enable_save_crystals: %d", g_Config.enable_save_crystals);
g_GameFlow.force_enable_save_crystals =
json_object_get_bool(obj, "force_enable_save_crystals", false);

tmp_arr = json_object_get_array(obj, "water_color");
g_GameFlow.water_color.r = 0.6;
Expand Down Expand Up @@ -1117,6 +1111,10 @@ bool GameFlow_LoadFromFile(const char *file_name)
g_InvItemControls.string = g_GameFlow.strings[GS_INV_ITEM_CONTROLS];
g_InvItemLarasHome.string = g_GameFlow.strings[GS_INV_ITEM_LARAS_HOME];

if (g_GameFlow.force_enable_save_crystals) {
g_Config.enable_save_crystals = true;
}

return result;
}

Expand Down
2 changes: 1 addition & 1 deletion src/game/gameflow.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ typedef struct GAMEFLOW {
int8_t has_demo;
int32_t demo_delay;
bool disable_game_modes;
bool enable_save_crystals_option;
bool force_enable_save_crystals;
GAMEFLOW_LEVEL *levels;
char *strings[GS_NUMBER_OF];
RGBF water_color;
Expand Down

0 comments on commit de1a50a

Please sign in to comment.