mirror of
https://github.com/sfall-team/sfall.git
synced 2026-07-27 16:52:34 -07:00
Added a fix to limit the maximum distance for knockback animation
* 20 hexes at max. This does not affect the knockback value in Combat Damage hook, only the animation part.
This commit is contained in:
@@ -2795,7 +2795,6 @@ isDeath:
|
||||
static void __declspec(naked) obj_move_to_tile_hack_ondeath() {
|
||||
static const DWORD obj_move_to_tile_Ret = 0x48A759;
|
||||
__asm {
|
||||
test esi, esi;
|
||||
jz skip;
|
||||
cmp dudeIsAnimDeath, 0;
|
||||
jnz skip;
|
||||
@@ -2806,6 +2805,16 @@ skip:
|
||||
}
|
||||
}
|
||||
|
||||
static void __declspec(naked) action_knockback_hack() {
|
||||
__asm {
|
||||
mov ecx, 20; // cap knockback distance
|
||||
cmp ebp, ecx;
|
||||
cmovg ebp, ecx;
|
||||
mov ecx, 1;
|
||||
retn;
|
||||
}
|
||||
}
|
||||
|
||||
void BugFixes::init()
|
||||
{
|
||||
#ifndef NDEBUG
|
||||
@@ -3538,6 +3547,9 @@ void BugFixes::init()
|
||||
// (e.g. fire dance or knockback animation)
|
||||
MakeCall(0x41094B, show_damage_to_object_hack, 1);
|
||||
MakeCall(0x48A6CB, obj_move_to_tile_hack_ondeath, 1);
|
||||
|
||||
// Fix to limit the maximum distance for knockback animation
|
||||
MakeCall(0x4104D5, action_knockback_hack);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -666,7 +666,7 @@ static DWORD HandleTimedEventScripts() {
|
||||
fo::func::dev_printf("\n[TimedEventScripts] Event: %d", it->time);
|
||||
}
|
||||
|
||||
bool eventsWereRunning = false;
|
||||
bool eventWasRunning = false;
|
||||
for (auto timerIt = timerEventScripts.cbegin(); timerIt != timerEventScripts.cend(); ++timerIt) {
|
||||
if (timerIt->isActive == false) continue;
|
||||
if (currentTime >= timerIt->time) {
|
||||
@@ -684,14 +684,14 @@ static DWORD HandleTimedEventScripts() {
|
||||
timedEvent = executeTimedEvents.top(); // restore a pointer to a previously running event
|
||||
executeTimedEvents.pop();
|
||||
}
|
||||
eventsWereRunning = true;
|
||||
eventWasRunning = true;
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
executeTimedEventDepth--;
|
||||
|
||||
if (eventsWereRunning && executeTimedEventDepth == 0) {
|
||||
if (eventWasRunning && executeTimedEventDepth == 0) {
|
||||
timedEvent = nullptr;
|
||||
// delete all previously executed events
|
||||
for (auto it = timerEventScripts.cbegin(); it != timerEventScripts.cend();) {
|
||||
|
||||
Reference in New Issue
Block a user