; updated
- ; finish the current animation
- ; and transfer control to the next frame
- ; input:
- ; bc: animation ptr
-anim_finish:
- xor a, a ; set type to 0
- ld [bc], a
+anim_walk_north:
ret
- ; animation update calls
- ; inputs for all:
- ; bc: current animation ptr
-animation_table:
- dw anim_nop
- dw anim_walk_simple
-
- ; empty animation used as default value
-anim_nop:
+anim_walk_south:
ret
-
- ; anim walk_simple
- ; inputs:
- ; anim_p0/p1: ptr to y/x position
- ; anim_p2: direction
- ; anim_step: frames of movemnet
-anim_walk_simple:
- ; 1) check direction
-
- ; bc = anim type
- 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]
- ld h, a
- inc bc
- ld a, [bc]
- ld l, a
- ; hl = ptr to y/x
-
- ; bc = p2
- ld a, [bc]
- pop bc ; bc = anim_step ptr
-
- ; jump to direction
- cp a, NORTH
- jr z, @north REL
-
- cp a, SOUTH
- jr z, @south REL
-
- cp a, EAST
- jr z, @east REL
-
- cp a, WEST
- jr z, @west REL
-
- ; invalid direction PANIC
- jp panic
-@west:
-
- ret
-@east:
-
+anim_walk_east:
ret
-@north:
- ret
-@south:
+anim_walk_west:
ret
- ; updates the current animation
- ; an animation is a simple pointer
- ; to an update function
- ; and a range of parameters (4 freely usable bytes)
- ; the animation updte function is expected
- ; to set itself to 0000 when the animation is finisehd
- ; this is how anim_finished performs its check
-anim_update:
- ld bc, curr_anim
- ld a, [bc]
- ld hl, animation_table
- call call_tbl
-
- ret
-
anim_target_y: .adv 1
anim_target_x: .adv 1
-curr_anim: .adv anim_size
+ ; 1 animation buffer for each actor + player
+anim_table: .adv anim_size * (ACTORS_MAX + 1)
; collision tile tmp values
ct_poy: .adv 1