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 ;Set to 1 to display party member's current level/AC/addict flag on the combat control panel
PartyMemberExtraInfo=0 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 ;Set to 1 to prevent the inventory/loot/automap interfaces from being placed on top of other script-created windows
InterfaceDontMoveOnTop=0 InterfaceDontMoveOnTop=0
+3 -1
View File
@@ -287,6 +287,8 @@
#define _DARK_GREY_Color 0x6A59D8 #define _DARK_GREY_Color 0x6A59D8
#define _DarkGreenColor 0x6A3A90 #define _DarkGreenColor 0x6A3A90
#define _DarkGreenGreyColor 0x6A3DF1 #define _DarkGreenGreyColor 0x6A3DF1
#define _DarkRedColor 0x6AA8D0
#define _DarkYellowColor 0x6AB472
#define _DullPinkColor 0x6AB718 #define _DullPinkColor 0x6AB718
#define _GoodColor 0x6AB4EF #define _GoodColor 0x6AB4EF
#define _GreenColor 0x6A3CB0 #define _GreenColor 0x6A3CB0
@@ -295,7 +297,7 @@
#define _PeanutButter 0x6A82F3 #define _PeanutButter 0x6A82F3
#define _RedColor 0x6AB4D0 #define _RedColor 0x6AB4D0
#define _WhiteColor 0x6AB8CF #define _WhiteColor 0x6AB8CF
#define _YellowColor 0x6AB8BB #define _YellowColor 0x6AB8BB // Light
// variables // variables
// TODO: move to separate namespace // TODO: move to separate namespace
+24
View File
@@ -19,6 +19,8 @@
#include "main.h" #include "main.h"
#include "FalloutEngine.h" #include "FalloutEngine.h"
#include "MiscPatches.h"
static char mapName[65] = {}; static char mapName[65] = {};
static char configName[65] = {}; static char configName[65] = {};
static char patchName[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() { static void InterfaceDontMoveOnTopPatch() {
if (GetConfigInt("Misc", "InterfaceDontMoveOnTop", 0)) { // TODO: remove option? (obsolete) if (GetConfigInt("Misc", "InterfaceDontMoveOnTop", 0)) { // TODO: remove option? (obsolete)
dlog("Applying no MoveOnTop flag for interface patch.", DL_INIT); dlog("Applying no MoveOnTop flag for interface patch.", DL_INIT);
@@ -598,6 +621,7 @@ void MiscPatchesInit() {
DisplaySecondWeaponRangePatch(); DisplaySecondWeaponRangePatch();
SkipLoadingGameSettingsPatch();
InterfaceDontMoveOnTopPatch(); InterfaceDontMoveOnTopPatch();
UseWalkDistancePatch(); UseWalkDistancePatch();
+25 -16
View File
@@ -1,22 +1,31 @@
/* /*
* sfall * sfall
* Copyright (C) 2008-2016 The sfall team * Copyright (C) 2008-2016 The sfall team
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#pragma once #pragma once
void MiscPatchesInit(); void MiscPatchesInit();
void MiscPatchesExit(); void MiscPatchesExit();
#pragma pack(push, 1)
struct CodeData {
DWORD dd;
BYTE db;
CodeData() : dd(0x0024548D), db(0x90) {}
};
#pragma pack(pop)