Fixed anim_move_to_tile_ ignoring the distance argument.

* this also fixes the broken "reserve movement" feature.
This commit is contained in:
NovaRain
2019-06-08 09:45:01 +08:00
parent 137644aa72
commit 02a3bbd536
2 changed files with 21 additions and 2 deletions
+19
View File
@@ -2093,6 +2093,22 @@ dude:
} }
} }
static void __declspec(naked) anim_move_to_tile_hook() {
__asm {
push ebx;
mov ebx, dword ptr [esp + 0x18 - 0x10 + 8]; // distance
test ebx, ebx;
jl skip; // dist < 0
cmp ebx, [eax + movePoints];
jge skip; // dist >= source.curr_mp
pop ebx;
retn;
skip:
pop ebx;
jmp fo::funcoffs::obj_blocking_at_;
}
}
void BugFixes::init() void BugFixes::init()
{ {
#ifndef NDEBUG #ifndef NDEBUG
@@ -2652,6 +2668,9 @@ void BugFixes::init()
// up an item due to not enough space in the inventory // up an item due to not enough space in the inventory
HookCall(0x49B6E7, obj_pickup_hook); HookCall(0x49B6E7, obj_pickup_hook);
HookCall(0x49B71C, obj_pickup_hook_message); HookCall(0x49B71C, obj_pickup_hook_message);
// Fix for anim_move_to_tile_ engine function ignoring the distance argument
HookCall(0x416D44, anim_move_to_tile_hook);
} }
} }
+2 -2
View File
@@ -47,7 +47,7 @@ static bool restMode;
static bool restTime; static bool restTime;
static int mapSlotsScrollMax = 27 * (17 - 7); static int mapSlotsScrollMax = 27 * (17 - 7);
static int mapSlotsScrollLimit; static int mapSlotsScrollLimit = 0;
static DWORD worldMapDelay; static DWORD worldMapDelay;
static DWORD worldMapTicks; static DWORD worldMapTicks;
@@ -387,7 +387,7 @@ void WorldLimitsPatches() {
if (wmSlots && wmSlots < 128) { if (wmSlots && wmSlots < 128) {
dlog("Applying world map slots patch.", DL_INIT); dlog("Applying world map slots patch.", DL_INIT);
if (wmSlots < 7) wmSlots = 7; if (wmSlots < 7) wmSlots = 7;
mapSlotsScrollMax = (wmSlots - 7) * 27; // value of the height after which scrolling is not possible mapSlotsScrollMax = (wmSlots - 7) * 27; // height value after which scrolling is not possible
mapSlotsScrollLimit = wmSlots * 27; mapSlotsScrollLimit = wmSlots * 27;
SafeWrite32(0x4C21FD, 189); // 27 * 7 SafeWrite32(0x4C21FD, 189); // 27 * 7
SafeWrite32(0x4C21F1, (DWORD)&mapSlotsScrollLimit); SafeWrite32(0x4C21F1, (DWORD)&mapSlotsScrollLimit);