From 64cf7a3d208efa9a8f4e74fb8c1c8198e155b7ee Mon Sep 17 00:00:00 2001 From: Lukas Krickl Date: Thu, 26 Jun 2025 13:00:45 +0200 Subject: [PATCH] unit: wip sub-tile animation --- src/defs.s | 10 ++++++++-- src/macros.inc | 3 +-- src/unit.s | 14 +++++++++++++- 3 files changed, 22 insertions(+), 5 deletions(-) diff --git a/src/defs.s b/src/defs.s index db3c7ca..008a45a 100644 --- a/src/defs.s +++ b/src/defs.s @@ -140,8 +140,14 @@ ; 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 diff --git a/src/macros.inc b/src/macros.inc index 7237c16..2328adb 100644 --- a/src/macros.inc +++ b/src/macros.inc @@ -183,8 +183,7 @@ ; 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) diff --git a/src/unit.s b/src/unit.s index 223ffa5..503fd80 100644 --- a/src/unit.s +++ b/src/unit.s @@ -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 -- 2.30.2