Skip to content

Commit

Permalink
allow disabling game mode selection (closes #79)
Browse files Browse the repository at this point in the history
  • Loading branch information
rr- committed Mar 17, 2021
1 parent 0c8cd17 commit 3e75842
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 4 deletions.
1 change: 1 addition & 0 deletions Tomb1Main_gameflow.json5
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// NOTE: bad changes to this file may result in crashes.

"savegame_fmt": "saveati.%d",
"enable_game_modes": true,

"levels": [
// level 0
Expand Down
1 change: 1 addition & 0 deletions Tomb1Main_gameflow_ub.json5
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// NOTE: bad changes to this file may result in crashes.

"savegame_fmt": "saveuba.%d",
"enable_game_modes": true,

"levels": [
// level 0
Expand Down
7 changes: 7 additions & 0 deletions src/game/gameflow.c
Original file line number Diff line number Diff line change
Expand Up @@ -145,13 +145,20 @@ static GAME_STRING_ID StringToGameStringID(const char *str)
static int8_t S_LoadScriptMeta(struct json_value_s *json)
{
const char *tmp;

if (!JSONGetStringValue(json, "savegame_fmt", &tmp)) {
TRACE("'savegame_fmt' must be a string");
return 0;
} else {
GF.save_game_fmt = strdup(tmp);
}

if (!JSONGetBooleanValue(
json, "enable_game_modes", &GF.enable_game_modes)) {
TRACE("'enable_game_modes' must be a boolean");
return 0;
}

return 1;
}

Expand Down
13 changes: 9 additions & 4 deletions src/game/option.c
Original file line number Diff line number Diff line change
Expand Up @@ -249,10 +249,15 @@ void DoPassportOption(INVENTORY_ITEM *inv_item)
InvRingText = NULL;
T_RemovePrint(InvItemText[IT_NAME]);
InvItemText[IT_NAME] = NULL;
InitRequester(&NewGameRequester);
PassportMode = 2;
Input = 0;
InputDB = 0;

if (GF.enable_game_modes) {
InitRequester(&NewGameRequester);
PassportMode = 2;
Input = 0;
InputDB = 0;
} else {
InventoryExtraData[1] = SaveGame.bonus_flag;
}
} else {
T_RemovePrint(InvRingText);
InvRingText = NULL;
Expand Down
1 change: 1 addition & 0 deletions src/game/types.h
Original file line number Diff line number Diff line change
Expand Up @@ -1854,6 +1854,7 @@ typedef struct GAMEFLOW {
int32_t level_count;
const char *save_game_fmt;
int8_t has_demo;
int8_t enable_game_modes;
GAMEFLOW_LEVEL *levels;
char *strings[GS_NUMBER_OF];
} GAMEFLOW;
Expand Down

0 comments on commit 3e75842

Please sign in to comment.