.def int OBJSIZE = 4
.def int OAMRAM_SIZE = OBJSMAX * OBJSIZE
+#define OAM_FPRIO 0b10000000
#define OAM_FYFLIP 0b01000000
#define OAM_FXFLIP 0b00100000
#define OAM_DMG_PAL 0b00010000
; in top row for each move remaining
#define UI_TILE_MOVE 0xC0
#define UI_TILE_MOVE_USED 0xC1
+#define UI_WINDOW_BACKGROUND 0xC2
; inits UI
ui_init:
; b: tile
; c: flags
unit_generic_draw:
+#define TMP_OAMFLAG_PRIO scratch
+ xor a, a
+ ld [TMP_OAMFLAG_PRIO], a
+
push bc
ld hl, act_pos_y
add a, OBJ_OFF_Y
sub a, b
ld [hl+], a
-
+
+ ; if the position is inside the window set PRIO bit
+ cp a, 136 ; window start position in pixels
+ jr c, @not_on_window REL
+ ld a, OAM_FPRIO
+ ld [TMP_OAMFLAG_PRIO], a
+
+@not_on_window:
; set x pos
inc de
ld a, [de]
; set flags
- ld a, c
+ ld a, [TMP_OAMFLAG_PRIO]
+ or a, c
ld [hl+], a
ldnull bc
ret
+#undefine TMP_OAMFLAG_PRIO
; generic unit input handler
; inputs:
; inputs:
; de: unit
unit_delay_to_active:
- call unit_resume_objs
ldnull bc
ret