Skip to content

Something causes animation order bug in explosion AOE attack (presumably reg_anim_clear) #628

@dekrus

Description

@dekrus

After interrupting any animations and then using an AOE explosion attack that kills some targets, 1 or more targets play their death/damage animation before the explosion animation, instead of after.
Video

Environment:
Clean Fallout 2 no mods + sfall 4.5 (also reproduced on sfall 4.4.4+ and 5+)
AllowUnsafeScripting=0 (no unsafe scripting)
Does NOT happen on vanilla Fallout 2 without sfall(in my testes)

Steps to Reproduce:

  1. Load attached save
  2. Spam movement to interrupt the walking animation.
  3. Throw a frag grenade at a group of 2+ critters (the bug occurs on every load, usually on the 1-2 grenade).

Workaround:
Calling empty reg_anim_begin/reg_anim_end cycles in AFTERHITROLL prevents the bug:

    reg_anim_combat_check(0);
    for (i = 0; i < 7; i = i + 1) begin // less than 7 is not enough
        reg_anim_begin();
        reg_anim_end();
    end

My Thoughts:
Since the bug only occurs with sfall (not vanilla) and is fixed by 7+ empty reg_anim_begin/end cycles, the likely cause is LockAnimSlot() setting an 8-frame lock on slots after reg_anim_clear. This blocks animationRegisterPing from finding correct slots for AOE extra targets, causing death anims to fire before the explosion.

Suggested Fix:
In LockAnimSlot, skip locking when the slot is already completed:

  static long __fastcall LockAnimSlot(long slot) {
      if (slot < animationLimit 
          && animSet[slot].currentAnim != -1000  // skip finished slots
          && animSet[slot].counter != animSet[slot].totalAnimCount) 
      {
          lockAnimSet[slot] = 8;
      }
      return slot;
  }

But couldn't compile sfall locally to verify, so maybe I'm totally wrong on the cause! : )

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions