Skip to content

Commit 4382d67

Browse files
Add SFALL_CONFIG_PIPBOY_AVAILABLE_AT_GAMESTART (#314)
Co-authored-by: Alexander Batalov <[email protected]>
1 parent e38e706 commit 4382d67

File tree

3 files changed

+19
-1
lines changed

3 files changed

+19
-1
lines changed

src/pipboy.cc

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
#include "random.h"
3535
#include "scripts.h"
3636
#include "settings.h"
37+
#include "sfall_config.h"
3738
#include "stat.h"
3839
#include "svga.h"
3940
#include "text_font.h"
@@ -394,13 +395,14 @@ unsigned char _holo_flag;
394395
unsigned char _stat_flag;
395396

396397
static int gPipboyPrevTab;
398+
static bool pipboy_available_at_game_start = false;
397399

398400
static FrmImage _pipboyFrmImages[PIPBOY_FRM_COUNT];
399401

400402
// 0x497004
401403
int pipboyOpen(int intent)
402404
{
403-
if (!wmMapPipboyActive()) {
405+
if (!wmMapPipboyActive() && !pipboy_available_at_game_start) {
404406
// You aren't wearing the pipboy!
405407
const char* text = getmsg(&gMiscMessageList, &gPipboyMessageListItem, 7000);
406408
showDialogBox(text, nullptr, 0, 192, 135, _colorTable[32328], nullptr, _colorTable[32328], 1);
@@ -742,6 +744,19 @@ static void pipboyWindowFree()
742744
// 0x497918
743745
static void _pip_init_()
744746
{
747+
// SFALL: Make the pipboy available at the start of the game.
748+
// CE: The implementation is slightly different. SFALL has two values for
749+
// making the pipboy available at the start of the game. When the option is
750+
// set to (1), the `MOVIE_VSUIT` is automatically marked as viewed (the suit
751+
// grants the pipboy, see `wmMapPipboyActive`). Doing so exposes that movie
752+
// in the "Video Archives" section of the pipboy, which is likely an
753+
// undesired side effect. When the option is set to (2), the check is simply
754+
// bypassed. CE implements only the latter approach, as it does not have any
755+
// side effects.
756+
int value = 0;
757+
if (configGetInt(&gSfallConfig, SFALL_CONFIG_MISC_KEY, SFALL_CONFIG_PIPBOY_AVAILABLE_AT_GAMESTART, &value)) {
758+
pipboy_available_at_game_start = value == 1 || value == 2;
759+
}
745760
}
746761

747762
// NOTE: Uncollapsed 0x497918.

src/sfall_config.cc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,8 @@ bool sfallConfigInit(int argc, char** argv)
6565
configSetString(&gSfallConfig, SFALL_CONFIG_SCRIPTS_KEY, SFALL_CONFIG_INI_CONFIG_FOLDER, "");
6666
configSetString(&gSfallConfig, SFALL_CONFIG_SCRIPTS_KEY, SFALL_CONFIG_GLOBAL_SCRIPT_PATHS, "");
6767

68+
configSetInt(&gSfallConfig, SFALL_CONFIG_MISC_KEY, SFALL_CONFIG_PIPBOY_AVAILABLE_AT_GAMESTART, 0);
69+
6870
char path[COMPAT_MAX_PATH];
6971
char* executable = argv[0];
7072
char* ch = strrchr(executable, '\\');

src/sfall_config.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ namespace fallout {
7575
#define SFALL_CONFIG_VERSION_STRING "VersionString"
7676
#define SFALL_CONFIG_CONFIG_FILE "ConfigFile"
7777
#define SFALL_CONFIG_PATCH_FILE "PatchFile"
78+
#define SFALL_CONFIG_PIPBOY_AVAILABLE_AT_GAMESTART "PipBoyAvailableAtGameStart"
7879

7980
#define SFALL_CONFIG_BURST_MOD_DEFAULT_CENTER_MULTIPLIER 1
8081
#define SFALL_CONFIG_BURST_MOD_DEFAULT_CENTER_DIVISOR 3

0 commit comments

Comments
 (0)