Fixed determine_to_hit_func_ engine function taking distance into account when called from determine_to_hit_no_range_ (from Mr.Stalin)

This commit is contained in:
NovaRain
2018-11-12 13:14:07 +08:00
parent dcca405b89
commit 627fe11c29
4 changed files with 19 additions and 1 deletions
+16
View File
@@ -1517,6 +1517,17 @@ skip:
}
}
static void __declspec(naked) determine_to_hit_func_hook() {
__asm {
test [esp + 0x38 + 0x8 + 4], 1; // isRange
jz noRange;
jmp obj_dist_with_tile_;
noRange:
mov eax, 1; // set distance
retn;
}
}
void BugsInit()
{
@@ -1930,5 +1941,10 @@ void BugsInit()
}
// Fix for Heave Ho! perk increasing Strength stat above 10 when determining the maximum range of thrown weapons
dlog("Applying Heave Ho! perk fix.", DL_INIT);
HookCall(0x478AD9, item_w_range_hook);
dlogr(" Done", DL_INIT);
// Fix for determine_to_hit_func_ engine function taking distance into account when called from determine_to_hit_no_range_
HookCall(0x4244C3, determine_to_hit_func_hook);
}
+1
View File
@@ -490,6 +490,7 @@ const DWORD obj_change_fid_ = 0x48AA3C;
const DWORD obj_connect_ = 0x489EC4;
const DWORD obj_destroy_ = 0x49B9A0;
const DWORD obj_dist_ = 0x48BBD4;
const DWORD obj_dist_with_tile_ = 0x48BC08;
const DWORD obj_erase_object_ = 0x48B0FC;
const DWORD obj_find_first_at_ = 0x48B48C;
const DWORD obj_find_first_at_tile_ = 0x48B5A8;
+1
View File
@@ -689,6 +689,7 @@ extern const DWORD obj_change_fid_;
extern const DWORD obj_connect_;
extern const DWORD obj_destroy_;
extern const DWORD obj_dist_;
extern const DWORD obj_dist_with_tile_;
extern const DWORD obj_erase_object_;
extern const DWORD obj_find_first_at_;
extern const DWORD obj_find_first_at_tile_; // <eax>(int elevation<eax>, int tile<edx>)
+1 -1
View File
@@ -139,7 +139,7 @@ static int _stdcall GetStatBonusHook2(const SkillInfo* info, int skill, int poin
for (int i = STAT_st; i <= STAT_lu; i++) {
result += StatLevel(critter, i) * multipliers[skill * 7 + i];
}
result += points*info->skillPointMulti;
result += points * info->skillPointMulti;
result += info->base;
return (int)result;
}