player: skipping input on the frame a door animation is triggered
authorLukas Krickl <lukas@krickl.dev>
Sun, 10 Aug 2025 07:33:09 +0000 (09:33 +0200)
committerLukas Krickl <lukas@krickl.dev>
Sun, 10 Aug 2025 07:33:09 +0000 (09:33 +0200)
src/player.s
src/unit.s

index 101244f6f21857b7c2b5ee1bc4cf072cab5cb573..00e4e44a0b4ff89ac29fe863a711244cc582b18a 100644 (file)
@@ -50,6 +50,9 @@ unit_player_update:
        ; check if player is on a door tile
        ; if so, remove door and queue a map redraw
        and a, CF_DOOR
+       ; save CF_DOOR flag value to
+       ; return before input handling later
+       push af
        push de
        call nz, unit_player_remove_door
        pop de
@@ -63,6 +66,13 @@ unit_player_update:
   call unit_scroll_center
   pop de
 
+       ; return if CF_DOOR was handeled earlier
+       ; and skip inputs
+       ; load next state in case this ret is hit
+       pop af
+       ldnull bc 
+       ret nz
+
   push de
   call unit_handle_inputs
   pop de
index 39337c39a36d807f9c34b7cb5b43e27169f82bfa..81480116814f0009e2db8b188057f2d6da4774b3 100644 (file)
@@ -268,6 +268,8 @@ unit_generic_draw:
   ;   de: actor
   ;   hl: action table 
   ;    a: remaining moves
+       ; returns: 
+       ;               bc: next state
 unit_handle_inputs:
   ; push next state to the stack for now
   ld bc, NULL