From df1d147a4fbb950962ceb0f0362c6c2574c0e045 Mon Sep 17 00:00:00 2001 From: NovaRain Date: Thu, 23 Jan 2020 23:34:21 +0800 Subject: [PATCH] Removed TownMapHotkeysFix from ddraw.ini (always enabled) Also move its code from Worldmap.cpp to BugFixes.cpp. --- artifacts/ddraw.ini | 5 +---- sfall/BugFixes.cpp | 26 ++++++++++++++++++++++++++ sfall/Worldmap.cpp | 28 ---------------------------- 3 files changed, 27 insertions(+), 32 deletions(-) diff --git a/artifacts/ddraw.ini b/artifacts/ddraw.ini index 92414ff0..5153c395 100644 --- a/artifacts/ddraw.ini +++ b/artifacts/ddraw.ini @@ -301,9 +301,6 @@ DamageFormula=0 ;Prevents you from using 0 to escape from dialogue at any time. DialogueFix=1 -;Prevents you from using number keys to enter unvisited areas on a town map -TownMapHotkeysFix=1 - ;Set to 1 to disable the horrigan encounter DisableHorrigan=0 @@ -374,7 +371,7 @@ CorpseDeleteTime=6 ;Set a number of milliseconds to idle each input loop ;Set to -1 to disable -;Set to 0 to idle only if other processes of equal priority are waiting for processor time +;Set to 0 to idle only if other processes are waiting for processor time (WinXP/2000: if processes have equal priority) ;Set to 1 (or some higher number if needed, the maximum is 127) to prevent 100% CPU use ProcessorIdle=-1 diff --git a/sfall/BugFixes.cpp b/sfall/BugFixes.cpp index dcb0b5f7..4fccf24c 100644 --- a/sfall/BugFixes.cpp +++ b/sfall/BugFixes.cpp @@ -2327,6 +2327,25 @@ largeLoc: } } +static void __declspec(naked) wmTownMapFunc_hack() { + __asm { + cmp dword ptr [edi][eax * 4 + 0], 0; // Visited + je end; + cmp dword ptr [edi][eax * 4 + 4], -1; // Xpos + je end; + cmp dword ptr [edi][eax * 4 + 8], -1; // Ypos + je end; + // engine code + mov edx, [edi][eax * 4 + 0xC]; + mov [esi], edx + retn; +end: + add esp, 4; // destroy the return address + mov eax, 0x4C4976; + jmp eax; + } +} + static const DWORD combat_should_end_break = 0x422D00; static void __declspec(naked) combat_should_end_hack() { __asm { // ecx = dude.team_num @@ -3056,6 +3075,13 @@ void BugFixesInit() // Fix the position of the target marker for small/medium location circles MakeCall(0x4C03AA, wmWorldMap_hack, 2); + // Fix to prevent using number keys to enter unvisited areas on a town map + //if (GetConfigInt("Misc", "TownMapHotkeysFix", 1)) { + dlog("Applying town map hotkeys patch.", DL_INIT); + MakeCall(0x4C495A, wmTownMapFunc_hack, 1); + dlogr(" Done", DL_INIT); + //} + // Fix for combat not ending automatically when there are no hostile critters MakeCall(0x422CF3, combat_should_end_hack); SafeWrite16(0x422CEA, 0x0C74); // jz 0x422CF8 (skip party members) diff --git a/sfall/Worldmap.cpp b/sfall/Worldmap.cpp index 0b77afdd..2ed374fd 100644 --- a/sfall/Worldmap.cpp +++ b/sfall/Worldmap.cpp @@ -187,25 +187,6 @@ static void __declspec(naked) ViewportHook() { } } -static void __declspec(naked) wmTownMapFunc_hack() { - __asm { - cmp dword ptr [edi][eax * 4 + 0], 0; // Visited - je end; - cmp dword ptr [edi][eax * 4 + 4], -1; // Xpos - je end; - cmp dword ptr [edi][eax * 4 + 8], -1; // Ypos - je end; - // engine code - mov edx, [edi][eax * 4 + 0xC]; - mov [esi], edx - retn; -end: - add esp, 4; // destroy the return address - mov eax, 0x4C4976; - jmp eax; - } -} - static DWORD _stdcall PathfinderCalc(DWORD perkLevel, DWORD ticks) { double multi = mapMultiMod * scriptMapMulti; @@ -340,14 +321,6 @@ void TimeLimitPatch() { } } -void TownMapsHotkeyFix() { - if (GetConfigInt("Misc", "TownMapHotkeysFix", 1)) { - dlog("Applying town map hotkeys patch.", DL_INIT); - MakeCall(0x4C495A, wmTownMapFunc_hack, 1); - dlogr(" Done", DL_INIT); - } -} - void WorldmapFpsPatch() { bool fpsPatchOK = (*(DWORD*)0x4BFE5E == 0x8D16); if (GetConfigInt("Misc", "WorldMapFPSPatch", 0)) { @@ -473,7 +446,6 @@ void WorldmapInit() { PathfinderFixInit(); StartingStatePatches(); TimeLimitPatch(); - TownMapsHotkeyFix(); WorldLimitsPatches(); WorldmapFpsPatch(); PipBoyAutomapsPatch();