; each frame the latest animation is
; updated
+
+ ; animation update calls
+ ; inputs for all:
+ ; bc: current animation ptr
animation_table:
dw anim_nop
-
+ dw anim_walk_up
+ dw anim_walk_down
+ dw anim_walk_left
+ dw anim_walk_right
+
+ ; empty animation used as default value
anim_nop:
ret
+ ; anim walk_<direction>
+ ; inputs:
+ ; anim_p0/p1: ptr to y/x position
+
+anim_walk_up:
+ ret
+
+anim_walk_right:
+ ret
+
+anim_walk_left:
+ ret
+
+anim_walk_down:
+ ret
+
+
; updates the current animation
; an animation is a simple pointer
; to an update function
; to set itself to 0000 when the animation is finisehd
; this is how anim_finished performs its check
anim_update:
- ld a, [curr_anim_flags]
+ ld hl, curr_anim ; hl = anim_flags
+ ld a, [hl+] ; a = flag
and a, ANIM_FREADY
ret z
+ ld a, [hl]
ld hl, animation_table
- ld a, [curr_anim_type]
+ ld bc, curr_anim
call call_tbl
ret
anim_target_y: .adv 1
anim_target_x: .adv 1
- ; animation flags
- ; ANIM_READY is set if the animation can play
-curr_anim_flags: .adv 1
- ; animation table index
-curr_anim_type: .adv 2
-
+curr_anim: .adv anim_size
; collision tile tmp values
ct_poy: .adv 1