From 6987892fccaeaf20c6bcf79bad1acbb35707f150 Mon Sep 17 00:00:00 2001 From: sonil Date: Sat, 24 Jun 2023 13:31:23 +0800 Subject: [PATCH] add SFALL_CONFIG_PIPBOY_AVAILABLE_AT_GAMESTART support --- src/pipboy.cc | 8 +++++++- src/sfall_config.cc | 2 ++ src/sfall_config.h | 1 + 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/pipboy.cc b/src/pipboy.cc index 5b58020..2240628 100644 --- a/src/pipboy.cc +++ b/src/pipboy.cc @@ -39,6 +39,7 @@ #include "window_manager.h" #include "word_wrap.h" #include "worldmap.h" +#include "sfall_config.h" namespace fallout { @@ -394,12 +395,14 @@ unsigned char _stat_flag; static int gPipboyPrevTab; +bool PipBoyAvailableAtGameStart = false; + static FrmImage _pipboyFrmImages[PIPBOY_FRM_COUNT]; // 0x497004 int pipboyOpen(int intent) { - if (!wmMapPipboyActive()) { + if (!wmMapPipboyActive() && !PipBoyAvailableAtGameStart) { // You aren't wearing the pipboy! const char* text = getmsg(&gMiscMessageList, &gPipboyMessageListItem, 7000); showDialogBox(text, NULL, 0, 192, 135, _colorTable[32328], NULL, _colorTable[32328], 1); @@ -741,6 +744,9 @@ static void pipboyWindowFree() // 0x497918 static void _pip_init_() { + int configValue = 2; + configGetInt(&gSfallConfig, SFALL_CONFIG_MISC_KEY, SFALL_CONFIG_PIPBOY_AVAILABLE_AT_GAMESTART, &configValue); + PipBoyAvailableAtGameStart = configValue == 1; } // NOTE: Uncollapsed 0x497918. diff --git a/src/sfall_config.cc b/src/sfall_config.cc index 353bb37..753208d 100644 --- a/src/sfall_config.cc +++ b/src/sfall_config.cc @@ -62,6 +62,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, 2); + char path[COMPAT_MAX_PATH]; char* executable = argv[0]; char* ch = strrchr(executable, '\\'); diff --git a/src/sfall_config.h b/src/sfall_config.h index da2c298..08515e8 100644 --- a/src/sfall_config.h +++ b/src/sfall_config.h @@ -72,6 +72,7 @@ namespace fallout { #define SFALL_CONFIG_INI_CONFIG_FOLDER "IniConfigFolder" #define SFALL_CONFIG_GLOBAL_SCRIPT_PATHS "GlobalScriptPaths" #define SFALL_CONFIG_AUTO_QUICK_SAVE "AutoQuickSave" +#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