unit: wip sub-tile animation
authorLukas Krickl <lukas@krickl.dev>
Thu, 26 Jun 2025 11:00:45 +0000 (13:00 +0200)
committerLukas Krickl <lukas@krickl.dev>
Thu, 26 Jun 2025 11:00:45 +0000 (13:00 +0200)
src/defs.s
src/macros.inc
src/unit.s

index db3c7cac1c80ed950b5442c0d9a0d3a7765a43d4..008a45a8a1b0ccf3017b951953fbe3da0eb16496 100644 (file)
   ; last collision with actor
   ; set during unit_collision_woth_any_other
 .de act_rt_collided_with, 2
-.de act_rt_subtile_y, 1
-.de act_rt_subtile_x, 1
+
+  ; sub-tile drawing vars
+  ; during this animation the actor is already technically in its new 
+  ; location.
+  ; ab000000: direction bits (a == 0/1 -> up/down; b == 0/1 -> left/right)
+  ; 00nnn000: current tile offset y position
+  ; 00000nnn: currnet tile offset x position
+.de act_rt_sub_tile, 1
 
   ; stats1
 .de act_level, 1
index 7237c164b98dca26592b76fd49e40afad20c6f39..2328adbfb89c081fdc0a3752ff5e8f342627fb95 100644 (file)
 
   ; act_rt_collided_with
   dw 0 
-  .db 0  ; y-subtile
-  .db 0  ; x-subtile
+  .db 0  ; act_rt_sub_tile 
 #endmacro
   
   ; defines an actor's stats (1/2)
index 223ffa5cef35dac2f6356788c886ad4fc3ae0325..503fd80c0eb891f6835dcbf6b31650b646aa5c70 100644 (file)
@@ -310,8 +310,12 @@ unit_collides_with_any_other:
   ; to a movement animation
   ; the animation time is dependant on movement
   ; speed (100-stat_calc_speed)
+  ; the end-state of the move_animation should
+  ; clear rt_sub_tile to 0 
   ; inputs:
   ;   de: actor
+  ;    a: mask for rt_sub_tile
+  ;       rt_subtile |= a
 unit_transition_to_move_animation:
   ret
 
@@ -341,7 +345,9 @@ unit_try_move_up:
 
   dec a 
   ld [hl], a
-
+  
+  ; not bits set
+  ld a, 0b00000000
   call unit_transition_to_move_animation
 
   ret
@@ -360,6 +366,8 @@ unit_try_move_down:
   inc a
   ld [hl], a
 
+  ; set down bit
+  ld a, 0b10000000
   call unit_transition_to_move_animation
   
   ret
@@ -378,6 +386,8 @@ unit_try_move_left:
   dec a
   ld [hl], a
   
+  ; no bits set
+  ld a, 0b00000000
   call unit_transition_to_move_animation
   
   ret
@@ -397,6 +407,8 @@ unit_try_move_right:
   inc a
   ld [hl], a
 
+  ; set right bit
+  ld a, 0b01000000
   call unit_transition_to_move_animation
 
   ret