Skip to content

Commit

Permalink
Add SFALL_CONFIG_PIPBOY_AVAILABLE_AT_GAMESTART (#314)
Browse files Browse the repository at this point in the history
Co-authored-by: Alexander Batalov <[email protected]>
  • Loading branch information
sonilyan and alexbatalov authored Feb 12, 2025
1 parent e38e706 commit 4382d67
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 1 deletion.
17 changes: 16 additions & 1 deletion src/pipboy.cc
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
#include "random.h"
#include "scripts.h"
#include "settings.h"
#include "sfall_config.h"
#include "stat.h"
#include "svga.h"
#include "text_font.h"
Expand Down Expand Up @@ -394,13 +395,14 @@ unsigned char _holo_flag;
unsigned char _stat_flag;

static int gPipboyPrevTab;
static bool pipboy_available_at_game_start = false;

static FrmImage _pipboyFrmImages[PIPBOY_FRM_COUNT];

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

// NOTE: Uncollapsed 0x497918.
Expand Down
2 changes: 2 additions & 0 deletions src/sfall_config.cc
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ bool sfallConfigInit(int argc, char** argv)
configSetString(&gSfallConfig, SFALL_CONFIG_SCRIPTS_KEY, SFALL_CONFIG_INI_CONFIG_FOLDER, "");
configSetString(&gSfallConfig, SFALL_CONFIG_SCRIPTS_KEY, SFALL_CONFIG_GLOBAL_SCRIPT_PATHS, "");

configSetInt(&gSfallConfig, SFALL_CONFIG_MISC_KEY, SFALL_CONFIG_PIPBOY_AVAILABLE_AT_GAMESTART, 0);

char path[COMPAT_MAX_PATH];
char* executable = argv[0];
char* ch = strrchr(executable, '\\');
Expand Down
1 change: 1 addition & 0 deletions src/sfall_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ namespace fallout {
#define SFALL_CONFIG_VERSION_STRING "VersionString"
#define SFALL_CONFIG_CONFIG_FILE "ConfigFile"
#define SFALL_CONFIG_PATCH_FILE "PatchFile"
#define SFALL_CONFIG_PIPBOY_AVAILABLE_AT_GAMESTART "PipBoyAvailableAtGameStart"

#define SFALL_CONFIG_BURST_MOD_DEFAULT_CENTER_MULTIPLIER 1
#define SFALL_CONFIG_BURST_MOD_DEFAULT_CENTER_DIVISOR 3
Expand Down

0 comments on commit 4382d67

Please sign in to comment.