; inputs:
; anim_p0/p1: ptr to y/x position
; anim_p2: direction
- ; anim_p3: frames of movemnet
+ ; anim_step: frames of movemnet
anim_walk_simple:
; 1) check direction
; bc = anim type
inc bc
- inc bc
+ ; bc = anim step
+ push bc ; we need the step ptr again
+ ld a, [bc] ; a = anim_step
+ ld d, a ; d = step counter
+ cp a, 0
+ dec bc ; bc = anim type
+ ; finish animation if step counter is 0
+ jp z, anim_finish
+
+ ; go to p0
+ inc bc
+ inc bc
+ inc bc
; bc = p0
+
; load ptr to y/x
inc bc
ld a, [bc]
; bc = p2
ld a, [bc]
-
+ pop bc ; bc = anim_step ptr
+
; jump to direction
cp a, NORTH
jr z, @north REL