Backported SkipLoadingGameSettings option from 4.x

This commit is contained in:
NovaRain
2020-05-08 10:38:32 +08:00
parent c293a826bc
commit 48ce358451
4 changed files with 56 additions and 17 deletions
+4
View File
@@ -694,6 +694,10 @@ DisplaySwiftLearnerExp=1
;Set to 1 to display party member's current level/AC/addict flag on the combat control panel
PartyMemberExtraInfo=0
;Set to 1 to skip loading all game settings except the game/combat difficulty from saved games
;Set to 2 to also skip loading the game/combat difficulty settings
SkipLoadingGameSettings=0
;Set to 1 to prevent the inventory/loot/automap interfaces from being placed on top of other script-created windows
InterfaceDontMoveOnTop=0
+3 -1
View File
@@ -287,6 +287,8 @@
#define _DARK_GREY_Color 0x6A59D8
#define _DarkGreenColor 0x6A3A90
#define _DarkGreenGreyColor 0x6A3DF1
#define _DarkRedColor 0x6AA8D0
#define _DarkYellowColor 0x6AB472
#define _DullPinkColor 0x6AB718
#define _GoodColor 0x6AB4EF
#define _GreenColor 0x6A3CB0
@@ -295,7 +297,7 @@
#define _PeanutButter 0x6A82F3
#define _RedColor 0x6AB4D0
#define _WhiteColor 0x6AB8CF
#define _YellowColor 0x6AB8BB
#define _YellowColor 0x6AB8BB // Light
// variables
// TODO: move to separate namespace
+24
View File
@@ -19,6 +19,8 @@
#include "main.h"
#include "FalloutEngine.h"
#include "MiscPatches.h"
static char mapName[65] = {};
static char configName[65] = {};
static char patchName[65] = {};
@@ -433,6 +435,27 @@ static void DisplaySecondWeaponRangePatch() {
//}
}
static void SkipLoadingGameSettingsPatch() {
if (int skipLoading = GetConfigInt("Misc", "SkipLoadingGameSettings", 0)) {
dlog("Applying skip loading game settings from saved games patch.", DL_INIT);
BlockCall(0x493421);
SafeWrite8(0x4935A8, 0x1F);
SafeWrite32(0x4935AB, 0x90901B75);
CodeData PatchData;
if (skipLoading == 2) {
const DWORD difficultyAddr[] = {0x49341C, 0x49343B};
SafeWriteBatch<CodeData>(PatchData, difficultyAddr);
}
const DWORD settingsAddr[] = {
0x493450, 0x493465, 0x49347A, 0x49348F, 0x4934A4, 0x4934B9, 0x4934CE,
0x4934E3, 0x4934F8, 0x49350D, 0x493522, 0x493547, 0x493558, 0x493569,
0x49357A
};
SafeWriteBatch<CodeData>(PatchData, settingsAddr);
dlogr(" Done", DL_INIT);
}
}
static void InterfaceDontMoveOnTopPatch() {
if (GetConfigInt("Misc", "InterfaceDontMoveOnTop", 0)) { // TODO: remove option? (obsolete)
dlog("Applying no MoveOnTop flag for interface patch.", DL_INIT);
@@ -598,6 +621,7 @@ void MiscPatchesInit() {
DisplaySecondWeaponRangePatch();
SkipLoadingGameSettingsPatch();
InterfaceDontMoveOnTopPatch();
UseWalkDistancePatch();
+9
View File
@@ -20,3 +20,12 @@
void MiscPatchesInit();
void MiscPatchesExit();
#pragma pack(push, 1)
struct CodeData {
DWORD dd;
BYTE db;
CodeData() : dd(0x0024548D), db(0x90) {}
};
#pragma pack(pop)