Added DisableSpecialMapIDs option (from Mr.Stalin)

Fixed the overflow of the automap tables when the number of maps in maps.txt is more than 160.
This commit is contained in:
NovaRain
2019-03-30 11:07:16 +08:00
parent da3fd5c671
commit dd87a83025
5 changed files with 46 additions and 2 deletions
+5 -1
View File
@@ -1,5 +1,5 @@
;sfall configuration settings
;v4.1.6
;v4.1.7
[Main]
;Change to 1 if you want to use command line args to tell sfall to use another ini file.
@@ -680,6 +680,10 @@ InterfaceDontMoveOnTop=0
;Set to -1 to disable the special death message when the global variable is set
SpecialDeathGVAR=491
;Set to 1 to disable the special handling of map IDs 19 and 37 in the engine when entering the maps
;Don't set this to anything other than 0 unless another mod you're using explicitly tells you to!
DisableSpecialMapIDs=0
;Set to 1 to display sfall built-in credits at the bottom of credits.txt contents instead of at the top
CreditsAtBottom=0
+2 -1
View File
@@ -651,9 +651,10 @@ enum BodyType : long
#define CRITTER_BROKEN_LARM (0x20)
#define CRITTER_EYEDAMAGE (0x40)
#define WEAPON_TWO_HANDED (0x200)
#define AUTOMAP_MAX (160)
enum TicksTime : unsigned long
{
ONE_GAME_YEAR = 315360000
+3
View File
@@ -46,6 +46,7 @@
#define FO_VAR_dialogue_switch_mode 0x518718
#define FO_VAR_dialog_target 0x518848
#define FO_VAR_dialog_target_is_party 0x51884C
#define FO_VAR_displayMapList 0x41B560
#define FO_VAR_dropped_explosive 0x5190E0
#define FO_VAR_drugInfoList 0x5191CC
#define FO_VAR_editor_message_file 0x56FCA8
@@ -217,8 +218,10 @@
#define FO_VAR_wd_obj 0x59E98C
#define FO_VAR_wmAreaInfoList 0x51DDF8
#define FO_VAR_wmLastRndTime 0x51DEA0
#define FO_VAR_wmMaxMapNum 0x51DE10
#define FO_VAR_wmWorldOffsetX 0x51DE2C
#define FO_VAR_wmWorldOffsetY 0x51DE30
#define FO_VAR_wmYesNoStrs 0x51DD90
#define FO_VAR_world_xpos 0x672E0C
#define FO_VAR_world_ypos 0x672E10
#define FO_VAR_WorldMapCurrArea 0x672E08
+29
View File
@@ -1995,6 +1995,28 @@ noDrop:
}
}
static void __declspec(naked) PrintAutoMapList() {
__asm {
mov eax, ds:[FO_VAR_wmMaxMapNum];
cmp eax, AUTOMAP_MAX;
jb skip;
mov eax, AUTOMAP_MAX;
skip:
retn;
}
}
static void __declspec(naked) automap_pip_save_hook() {
__asm {
mov eax, ds:[FO_VAR_map_number];
cmp eax, AUTOMAP_MAX;
jb skip;
xor eax, eax;
skip:
retn;
}
}
void BugFixes::init()
{
#ifndef NDEBUG
@@ -2524,6 +2546,13 @@ void BugFixes::init()
// Fix for unexplored areas being revealed on the automap when entering a map
MakeCall(0x48A76B, obj_move_to_tile_hack_seen, 1);
// Fix for the overflow of the automap tables when the number of maps in maps.txt is more than 160
HookCall(0x41C0FC, automap_pip_save_hook);
HookCalls(PrintAutoMapList, {
0x499212, // PrintAMList_
0x499013 // PrintAMelevList_
});
}
}
+7
View File
@@ -927,6 +927,13 @@ void MiscPatches::init() {
int gvar = GetConfigInt("Misc", "SpecialDeathGVAR", fo::GVAR_MODOC_SHITTY_DEATH);
if (gvar != fo::GVAR_MODOC_SHITTY_DEATH) SafeWrite32(0x440C2A, gvar);
// Remove hardcoding for maps with IDs 19 and 37
if (GetConfigInt("Misc", "DisableSpecialMapIDs", 0)) {
dlog("Applying disable special map IDs patch.", DL_INIT);
SafeWriteBatch<BYTE>(0, {0x4836D6, 0x4836DB});
dlogr(" Done", DL_INIT);
}
LoadGameHook::OnBeforeGameStart() += BodypartHitChances; // set on start & load
CombatProcFix();