animation: Removed animation setup
authorLukas Krickl <lukas@krickl.dev>
Thu, 30 Jan 2025 04:37:45 +0000 (05:37 +0100)
committerLukas Krickl <lukas@krickl.dev>
Thu, 30 Jan 2025 04:37:45 +0000 (05:37 +0100)
The first re-write will be replaced with a simpler approach.

src/animation.s
src/combat.s [new file with mode: 0644]
src/defs.s
src/main.s
src/update.s
src/wram.s

index b573d7381c250f1f86855ca3ee42ff70d6cdc4e6..6e39ae3b800798c2bef71ae325f59e0ce72cdfd3 100644 (file)
 ; 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
-
diff --git a/src/combat.s b/src/combat.s
new file mode 100644 (file)
index 0000000..2632c22
--- /dev/null
@@ -0,0 +1,2 @@
+combat_init:
+  ret
index 3321db468ed549c8b04c6d4541ce8fee3aed8072..fe2b933be189fe78391817df1c12404c538d16b5 100644 (file)
 .de anim_step, 1
 .de anim_flags, 1
 .de anim_p0, 1
-.de anim_p1, 1
-.de anim_p2, 1
-.de anim_p3, 1 
 .de anim_size, 0
index bacf6d5d0760ec42442f0bf5689b157d55285933..21bf3a7bb277fb415d41994c6c9cdea47db0075d 100644 (file)
@@ -65,6 +65,7 @@ main:
 #include "actor.s"
 #include "audio.s"
 #include "animation.s"
+#include "combat.s"
 
 #include "tiles.inc"
 
index b4d7d19a4934e08062675212e2315ae01e0230de..ad4314978bf18e3bf0c4c67b50b5f81a3b0443f8 100644 (file)
@@ -10,8 +10,6 @@ update_game_over:
 update_game:
   ; tick rng every frame
   call rand 
-  
-  call anim_update 
 
   ; update player
   ld hl, player
index 357ad667fd4eb5bc78a5cdb5b5968799e1216916..992f5e14647ce03ad0e3ebb56f93709267c70da7 100644 (file)
@@ -103,7 +103,8 @@ anim_step_x: .adv 1
 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