Skip to content

Commit

Permalink
Don't repeatedly reset fight anim when near target
Browse files Browse the repository at this point in the history
This caused the animation to "stall" when the player moved directly in
front of NPCs because a new animation was started on each update.

Fixes: bug #270
  • Loading branch information
dscharrer committed Nov 21, 2013
1 parent df5adf2 commit ada5e7c
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/game/NPC.cpp
Expand Up @@ -2911,18 +2911,17 @@ static void ManageNPCMovement(Entity * io)
if((io->_npcdata->behavior & (BEHAVIOUR_FIGHT | BEHAVIOUR_MAGIC | BEHAVIOUR_DISTANT))
&& io->anims[ANIM_FIGHT_WAIT])
{
// TODO what is supposed to happen here ?
if((ause0->cur_anim != alist[ANIM_FIGHT_WAIT])
&& (ause0->cur_anim != alist[ANIM_FIGHT_STRAFE_LEFT])
&& (ause0->cur_anim != alist[ANIM_FIGHT_STRAFE_RIGHT])
&& (ause0->cur_anim != alist[ANIM_FIGHT_WALK_BACKWARD])
&& (ause0->cur_anim != alist[ANIM_FIGHT_WALK_FORWARD])
)

) {
AcquireLastAnim(io);
FinishAnim(io, ause0->cur_anim);
ANIM_Set(ause0, alist[ANIM_FIGHT_WAIT]);
ause0->flags |= EA_LOOP;
}

} else { // Stop it and put it in Wait anim after finishing his walk anim...
if(ause0->cur_anim == alist[ANIM_FIGHT_WALK_FORWARD]) {
Expand Down

0 comments on commit ada5e7c

Please sign in to comment.