Skip to content

Commit

Permalink
config: move enable_game_modes and add gameflow override
Browse files Browse the repository at this point in the history
  • Loading branch information
walkawayy committed Sep 1, 2023
1 parent 9f16340 commit 6690983
Show file tree
Hide file tree
Showing 11 changed files with 26 additions and 7 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
- 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)
- fixed new game plus not working if enable_game_modes was set to false (#960, regression from 2.8)
- moved the enable_game_modes option from the gameflow to the config tool and added a gameflow option to override (#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
Expand Down
3 changes: 2 additions & 1 deletion bin/cfg/Tomb1Main_gameflow.json5
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
"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,
// overrides the config file option enable_game_modes
"override_game_modes": false,

// disables saving except in the locations near the crystals.
"enable_save_crystals": false,
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 @@ -4,7 +4,7 @@
"main_menu_picture": "data/titleh_ub.png",
"savegame_fmt_legacy": "saveuba.%d",
"savegame_fmt_bson": "save_trub_%02d.dat",
"enable_game_modes": true,
"override_game_modes": false,
"enable_save_crystals": false,
"demo_delay": 16,
"water_color": [0.45, 1.0, 1.0],
Expand Down
2 changes: 2 additions & 0 deletions src/config.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down
1 change: 1 addition & 0 deletions src/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
6 changes: 3 additions & 3 deletions src/game/gameflow.c
Original file line number Diff line number Diff line change
Expand Up @@ -228,12 +228,12 @@ 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);
tmp_i = json_object_get_bool(obj, "override_game_modes", JSON_INVALID_BOOL);
if (tmp_i == JSON_INVALID_BOOL) {
LOG_ERROR("'enable_game_modes' must be a boolean");
LOG_ERROR("'override_game_modes' must be a boolean");
return false;
}
g_GameFlow.enable_game_modes = tmp_i;
g_GameFlow.override_game_modes = tmp_i;

tmp_i =
json_object_get_bool(obj, "enable_save_crystals", JSON_INVALID_BOOL);
Expand Down
2 changes: 1 addition & 1 deletion src/game/gameflow.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ typedef struct GAMEFLOW {
char *savegame_fmt_bson;
int8_t has_demo;
int32_t demo_delay;
int8_t enable_game_modes;
bool override_game_modes;
int8_t enable_save_crystals;
GAMEFLOW_LEVEL *levels;
char *strings[GS_NUMBER_OF];
Expand Down
3 changes: 2 additions & 1 deletion src/game/option/option_passport.c
Original file line number Diff line number Diff line change
Expand Up @@ -473,7 +473,8 @@ 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
&& !g_GameFlow.override_game_modes) {
Option_PassportInitNewGameRequester();
m_PassportMode = PASSPORT_MODE_NEW_GAME;
g_Input = (INPUT_STATE) { 0 };
Expand Down
4 changes: 4 additions & 0 deletions tools/config/Tomb1Main_ConfigTool/Resources/Lang/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -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."
Expand Down
4 changes: 4 additions & 0 deletions tools/config/Tomb1Main_ConfigTool/Resources/Lang/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,10 @@
"Title": "Restaure les ennemis PlayStation",
"Description": "Remet la momie absente sur la version PC mais présente dans la version PlayStation (room 25).\nAttention, changer cette option sur une partie en cours nécessite de redémarrer le niveau, pour être prise en charge."
},
"enable_game_modes": {
"Title": "Activer les différents modes de jeu",
"Description": "Permet de sélectionner de nouveaux modes de jeu dans le menu nouvelle partie du passeport au menu principal.\n- Nouvelle partie + : Déverrouille toutes les armes avec munitions infinies ; les ennemis ont le double de points de vie.\n- Version Japonaise : Les armes font le double de dégâts.\n- Version Japonaise + : Combine le mode Version Japonaise et le mode Nouvelle partie +."
},
"enable_timer_in_inventory": {
"Title": "Compteur de temps de jeu dans l'inventaire",
"Description": "Fait fonctionner le conteur du jeu même en étant dans les menus de l'inventaire."
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,11 @@
"DataType": "Bool",
"DefaultValue": false
},
{
"Field": "enable_game_modes",
"DataType": "Bool",
"DefaultValue": true
},
{
"Field": "enable_timer_in_inventory",
"DataType": "Bool",
Expand Down

0 comments on commit 6690983

Please sign in to comment.