; keys:
; up + select: cycle to next debug rectangle
dbg_rect_draw:
- ; TODO: add rectangle cycles
+ ld b, BTNUP | BTNSELECT
+ input_held
+ cp a, BTNUP | BTNSELECT
+ jp z, @rect_draw_cycle
; draw each corner of the rectangle if it is not 0
ld a, [dbg_rect]
ret
@rect_not_alloced:
ret
+@rect_draw_cycle:
+ ld a, [dbg_rect]
+ ld l, a
+ ld a, [dbg_rect+1]
+ ld h, a
+ ld de, r_size
+ add hl, de
+
+ ; next rectangle
+ ld a, l
+ ld [dbg_rect], a
+ ld a, h
+ ld [dbg_rect+1], a
+
+ ld a, 16
+ ld [dbg_delay], a
+ ret
mapdef 0, pat_empty, l1_objs, bank8000, bank8800, bank8C00, bank9000
l1_objs:
- modef MOT_SET_PAT, 0, 3, pat_center_empty_wall
- ; rectangle at y/x 0/0 with height 16 width 64
- modef MOT_RECT, 0, 3, 0x0802
- modef MOT_SET_PAT, 0, 8, pat_center_grass
- modef MOT_SET_PAT, 0, 10, pat_center_empty_wall
+ modef MOT_SET_PAT, 0, 8, pat_center_empty_wall
+ ; rectangle at y/x 0/0 with height 32 width 64
+ modef MOT_RECT, 0, 9, 0x0804
+
+ ; rectangle at y/x 0/0 with height 32 width 48
+ modef MOT_RECT, 0, 9, 0xE604
+
+ modef MOT_SET_PAT, 0, 10, pat_center_grass
+ modef MOT_SET_PAT, 0, 18, pat_center_empty_wall
modef MOT_SET_PAT, 0, 0x1E, pat_empty
modef MOT_DISABLE_SCROLL, 0, 0x20, 0
modef MOT_NOP, 0, 0xFF, 0
ld [hl+], a ; hl = page y pos hi
; check if off-screen
+ ; do not despawn if -16
+ cp a, -16 & 0xFF
+ jr nc, @no_act_despawn REL
+
pop de
push de
push af
cp a, 0x70
call nc, actor_despawn
pop af
-
+
+@no_act_despawn:
pop hl
push hl
ld [hl], a
; check if off-screen
+ cp a, -16 & 0xFF ; do not despawn if -16
+ jr nc, @no_rect_despawn REL
+
pop de
push de
cp a, 0xB0
call nc, rect_despawn
+
+@no_rect_despawn:
pop hl
dec b