player: Added special flag that indicates if a player is inside a covered area (e...
authorLukas Krickl <lukas@krickl.dev>
Thu, 31 Jul 2025 12:15:13 +0000 (14:15 +0200)
committerLukas Krickl <lukas@krickl.dev>
Thu, 31 Jul 2025 12:15:13 +0000 (14:15 +0200)
src/defs.s
src/player.s
src/wram.s

index ce51a5f76adb7d8336a48c142a2fd34c4837a198..1bea292a219d8560afbac8ada80b34f406454567 100644 (file)
@@ -64,6 +64,7 @@
   ; when units want to draw
 .de DRAWF_SKIP_UNIT_OBJS, 1
 
+
   ; gameplay flags
 .se 1
 
        ; so that objects are behind the tile
 .de CF_COVERED, 8
 
+       ; player special flags
+       ; set if player is currently on a covered tile.
+       ; this can be used for drawing units that 
+       ; are inside
+.def int PLAYERSF_CF_COVERED = CF_COVERED
+
   ; cells struct
 .se 0
 .de c_tile, 1
index de93ec52a4764fb8d32ba062324f5e31cb68c88f..5a8e8c912afe38bc7c5ab77833c62d79515133d2 100644 (file)
@@ -24,6 +24,20 @@ unit_player_update:
   or a, OAM_FXFLIP 
   ld [hl], a
   pop de
+
+       ; check if the player is currently
+       ; on a convered tile or not
+       push de
+       call unit_get_pos
+       call map_get_tile
+       ; a = tile flags
+       and a, CF_COVERED
+       ld b, a
+       ld a, [player_rt_special_flags]
+       and a, (~CF_COVERED) & 0xFF
+       or a, b
+       ld [player_rt_special_flags], a
+       pop de
   
   ; check for exit flags
   push de
index cd7e7dd5826a7b4bf696ff1df7cdee4328d0f528..795d53f58300041e9c6f519174ab833902d56e15 100644 (file)
@@ -46,6 +46,9 @@ menu_cursor_index: .adv 1
 
 draw_flags: .adv 1
 gameplay_flags: .adv 1
+
+       ; special flags that are set by the player unit
+player_rt_special_flags: .adv 1
   
   ; shadow UI is a buffer for drawing the UI
   ; this UI is then re-drawn on request in vblank
@@ -140,6 +143,7 @@ player_eq_amulet: .adv 2
 player_unit: .adv 0 
 p0_units: .adv act_size * UNITS_MAX 
 
+
   ; list of seeds used 
   ; for the current maps
   ; fill using mapgen_seed