Skip to content

Commit

Permalink
Minor edits to combat_begin_anim_stop_hook
Browse files Browse the repository at this point in the history
  • Loading branch information
NovaRain committed Jun 9, 2024
1 parent 24058c5 commit a35bc88
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions sfall/Modules/Animations.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -514,22 +514,21 @@ static __declspec(naked) void obj_use_container_hook() {

static void __fastcall StopAnimationAtCombatStart() {
fo::var::anim_in_anim_stop = true;
fo::var::curr_anim_set = -1;
fo::var::curr_anim_set = -1;

for (int i = 0; i < animationLimit; i++) {
for (int i = 0; i < animationLimit; i++) {
const fo::AnimationSet& set = animSet[i];
if (set.currentAnim >= 1 && set.animations[set.currentAnim - 1].animType == fo::ANIM_TYPE_ANIMATE_FOREVER) continue;
fo::func::anim_set_end(i);
}
fo::func::anim_set_end(i);
}

fo::var::anim_in_anim_stop = false;
fo::var::anim_in_anim_stop = false;
fo::func::object_anim_compact();
}

static __declspec(naked) void combat_begin_anim_stop_hook() {
__asm {
call StopAnimationAtCombatStart;
retn;
jmp StopAnimationAtCombatStart;
}
}

Expand Down Expand Up @@ -643,6 +642,7 @@ void Animations::init() {
SafeWrite16(0x4122D9, 0x9090); // action_get_an_object_
}

// Prevent the "forever" type of animation on objects from stopping when entering combat
HookCall(0x421A48, combat_begin_anim_stop_hook);
}

Expand Down

0 comments on commit a35bc88

Please sign in to comment.