Fixed the interrupted player's movement in combat.

* it happens when the player try to use objects with Bonus Move APs
available. The distance has to be greater than remaining normal APs.

Replaced calling db_dir_entry_ with db_access_ in HeroAppearance.cpp.
This commit is contained in:
NovaRain
2019-06-10 09:45:52 +08:00
parent e9f3fd5039
commit 0f7a8592a9
2 changed files with 20 additions and 12 deletions
+12 -1
View File
@@ -2082,6 +2082,14 @@ skip:
}
}
static void __declspec(naked) action_use_an_item_on_object_hack() {
__asm {
add ebx, ds:[_combat_free_move];
mov eax, 2; // RB_RESERVED
retn;
}
}
void BugFixesInit()
{
#ifndef NDEBUG
@@ -2631,6 +2639,9 @@ void BugFixesInit()
HookCall(0x49B6E7, obj_pickup_hook);
HookCall(0x49B71C, obj_pickup_hook_message);
// Fix for anim_move_to_tile_ engine function ignoring the distance argument
// Fix for anim_move_to_tile_ engine function ignoring the distance argument (when moving critters)
HookCall(0x416D44, anim_move_to_tile_hook);
// Fix for the player's movement in combat being interrupted when trying to use objects with Bonus Move APs available
MakeCall(0x411FD6, action_use_an_item_on_object_hack);
}
+8 -11
View File
@@ -769,8 +769,8 @@ void _stdcall RefreshHeroBaseArt() {
}
/*
// Check fallout paths for file
long __stdcall db_file_exist(const char *fileName, DWORD *sizeOut) {
// Check fallout file and get file size (result 0 - file exists)
long __stdcall db_dir_entry(const char *fileName, DWORD *sizeOut) {
__asm {
mov edx, sizeOut;
mov eax, fileName;
@@ -864,19 +864,16 @@ setPath:
static void __declspec(naked) CheckHeroExist() {
__asm {
cmp esi, critterArraySize; // check if loading hero art
cmp esi, critterArraySize; // check if loading hero art
jle endFunc;
sub esp, 4;
lea edx, [esp]; // size out
mov eax, _art_name; // critter art file name address
call db_dir_entry_; // check art file exists
add esp, 4;
cmp eax, -1;
jne endFunc;
mov eax, _art_name; // critter art file name address (file name)
call db_access_; // check art file exists
test eax, eax;
jnz endFunc;
// if file not found load regular critter art instead
sub esi, critterArraySize;
add esp, 4; // drop func ret address
add esp, 4; // drop func ret address
mov eax, 0x4194E2;
jmp eax;
endFunc: