player: Added stub for door removal when the player enters it
authorLukas Krickl <lukas@krickl.dev>
Wed, 6 Aug 2025 11:14:03 +0000 (13:14 +0200)
committerLukas Krickl <lukas@krickl.dev>
Wed, 6 Aug 2025 11:14:03 +0000 (13:14 +0200)
src/player.s

index d843ba049d2fd14bf6f439138ba221e20798097f..d37cd0bc1801f96f9d86713e66ae17d912340943 100644 (file)
@@ -28,8 +28,12 @@ unit_player_update:
        ; check if the player is currently
        ; on a convered tile or not
        push de
+
+       ; first read the current tile
        call unit_get_pos
        call map_get_tile
+       push af ; store for later use
+
        ; a = tile flags
        and a, CF_COVERED
        ld b, a
@@ -37,7 +41,13 @@ unit_player_update:
        and a, (~CF_COVERED) & 0xFF
        or a, b
        ld [player_rt_special_flags], a
+       pop af ; get back a for next check
        pop de
+       
+       ; check if player is on a door tile
+       ; if so, remove door and queue a map redraw
+       and a, CF_DOOR
+       call nz, unit_player_remove_door
   
   ; check for exit flags
   push de
@@ -54,6 +64,15 @@ unit_player_update:
  
 
   ret
+       
+       ; removes the door tile the player is currently
+       ; standing on
+       ; inputs:
+       ;               de: actor
+unit_player_remove_door:
+       ; TODO: remove door tile, door flag
+       ; and redraw map
+       ret
 
   ; checks the current tile
   ; and checks for exit flags