diff --git a/artifacts/ddraw.ini b/artifacts/ddraw.ini index e6db8f37..1322d02c 100644 --- a/artifacts/ddraw.ini +++ b/artifacts/ddraw.ini @@ -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 diff --git a/sfall/FalloutEngine.h b/sfall/FalloutEngine.h index d45cb7e0..62397b13 100644 --- a/sfall/FalloutEngine.h +++ b/sfall/FalloutEngine.h @@ -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 diff --git a/sfall/MiscPatches.cpp b/sfall/MiscPatches.cpp index 01788bd8..8d95fd4b 100644 --- a/sfall/MiscPatches.cpp +++ b/sfall/MiscPatches.cpp @@ -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(PatchData, difficultyAddr); + } + const DWORD settingsAddr[] = { + 0x493450, 0x493465, 0x49347A, 0x49348F, 0x4934A4, 0x4934B9, 0x4934CE, + 0x4934E3, 0x4934F8, 0x49350D, 0x493522, 0x493547, 0x493558, 0x493569, + 0x49357A + }; + SafeWriteBatch(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(); diff --git a/sfall/MiscPatches.h b/sfall/MiscPatches.h index 7e68c08c..0bbb199a 100644 --- a/sfall/MiscPatches.h +++ b/sfall/MiscPatches.h @@ -1,22 +1,31 @@ /* -* sfall -* Copyright (C) 2008-2016 The sfall team -* -* 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 -* the Free Software Foundation, either version 3 of the License, or -* (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ + * sfall + * Copyright (C) 2008-2016 The sfall team + * + * 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 + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ #pragma once void MiscPatchesInit(); void MiscPatchesExit(); + +#pragma pack(push, 1) +struct CodeData { + DWORD dd; + BYTE db; + + CodeData() : dd(0x0024548D), db(0x90) {} +}; +#pragma pack(pop)