Removed TownMapHotkeysFix from ddraw.ini (always enabled)

Also move its code from Worldmap.cpp to BugFixes.cpp.
This commit is contained in:
NovaRain
2020-01-23 23:13:50 +08:00
parent b69640f09a
commit 27233d19a2
3 changed files with 27 additions and 32 deletions
+1 -4
View File
@@ -332,9 +332,6 @@ DamageFormula=0
;Prevents you from using 0 to escape from dialogue at any time. ;Prevents you from using 0 to escape from dialogue at any time.
DialogueFix=1 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 ;Set to 1 to disable the horrigan encounter
DisableHorrigan=0 DisableHorrigan=0
@@ -405,7 +402,7 @@ CorpseDeleteTime=6
;Set a number of milliseconds to idle each input loop ;Set a number of milliseconds to idle each input loop
;Set to -1 to disable ;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 ;Set to 1 (or some higher number if needed, the maximum is 127) to prevent 100% CPU use
ProcessorIdle=-1 ProcessorIdle=-1
+26
View File
@@ -2340,6 +2340,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 const DWORD combat_should_end_break = 0x422D00;
static void __declspec(naked) combat_should_end_hack() { static void __declspec(naked) combat_should_end_hack() {
__asm { // ecx = dude.team_num __asm { // ecx = dude.team_num
@@ -3075,6 +3094,13 @@ void BugFixes::init()
// Fix the position of the target marker for small/medium location circles // Fix the position of the target marker for small/medium location circles
MakeCall(0x4C03AA, wmWorldMap_hack, 2); 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 // Fix for combat not ending automatically when there are no hostile critters
MakeCall(0x422CF3, combat_should_end_hack); MakeCall(0x422CF3, combat_should_end_hack);
SafeWrite16(0x422CEA, 0x0C74); // jz 0x422CF8 (skip party members) SafeWrite16(0x422CEA, 0x0C74); // jz 0x422CF8 (skip party members)
-28
View File
@@ -212,25 +212,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) { static DWORD _stdcall PathfinderCalc(DWORD perkLevel, DWORD ticks) {
double multi = mapMultiMod * scriptMapMulti; double multi = mapMultiMod * scriptMapMulti;
@@ -398,14 +379,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() { void WorldmapFpsPatch() {
bool fpsPatchOK = (*(DWORD*)0x4BFE5E == 0x8D16); bool fpsPatchOK = (*(DWORD*)0x4BFE5E == 0x8D16);
if (GetConfigInt("Misc", "WorldMapFPSPatch", 0)) { if (GetConfigInt("Misc", "WorldMapFPSPatch", 0)) {
@@ -660,7 +633,6 @@ void Worldmap::init() {
PathfinderFixInit(); PathfinderFixInit();
StartingStatePatches(); StartingStatePatches();
TimeLimitPatch(); TimeLimitPatch();
TownMapsHotkeyFix();
WorldLimitsPatches(); WorldLimitsPatches();
WorldmapFpsPatch(); WorldmapFpsPatch();
PipBoyAutomapsPatch(); PipBoyAutomapsPatch();