act_stat_def1 1, 1, 1, 1
act_stat_def2 1, 1, 90, 1
act_st_def NULL, NULL, st_unit_player_update, st_unit_idle
- act_def_meta unit_draw, 0x8C, 0, NULL
+ act_def_meta unit_draw, 0x8C, OAM_FPRIO, NULL
st_unit_player_update:
st_def 0x00, unit_player_update, st_unit_player_update
unit_demo_2:
st_def 0x00, unit_demo_1_init, st_unit_idle
- act_def ACT_T_DEMO_1, 0, 8, 8, 0
+ act_def ACT_T_DEMO_1, 0, 3, 3, 0
act_stat_def1 1, 1, 1, 1
act_stat_def2 1, 1, 32, 1
act_st_def NULL, NULL, st_unit_demo_1_cpu_update_idle, st_unit_idle
- act_def_meta unit_draw, 0x88, 0, NULL
+ act_def_meta unit_draw, 0x88, OAM_FPRIO, NULL
unit_demo_warrior:
st_def 0x00, unit_demo_1_init, st_unit_demo_1_cpu_update
act_stat_def1 1, 1, 1, 1
act_stat_def2 1, 1, 32, 1
act_st_def NULL, NULL, st_unit_demo_1_cpu_update, st_unit_idle
- act_def_meta unit_draw, 0x88, 0, NULL
+ act_def_meta unit_draw, 0x88, OAM_FPRIO, NULL
unit_demo_mage:
st_def 0x00, unit_demo_1_init, st_unit_demo_1_cpu_update
act_stat_def1 1, 1, 1, 1
act_stat_def2 1, 1, 32, 1
act_st_def NULL, NULL, st_unit_demo_1_cpu_update, st_unit_idle
- act_def_meta unit_draw, 0x8C, 0, NULL
+ act_def_meta unit_draw, 0x8C, OAM_FPRIO, NULL
unit_demo_thief:
st_def 0x00, unit_demo_1_init, st_unit_demo_1_cpu_update
act_stat_def1 1, 1, 1, 1
act_stat_def2 1, 1, 32, 1
act_st_def NULL, NULL, st_unit_demo_1_cpu_update, st_unit_idle
- act_def_meta unit_draw, 0x90, 0, NULL
+ act_def_meta unit_draw, 0x90, OAM_FPRIO, NULL
unit_demo_priest:
; get inputs
call poll_inputs
-
- ; cycle bg tiles for animations
- ld a, [frame_count]
- and a, BG_CYCLE_FRAMES
- jr nz, @skip_cycle REL
-
- ld a, [RLCD]
- xor a, LCDCF_TILE_BANK
- ld [RLCD], a
-@skip_cycle:
+ call video_swap_tile_bank_player_indoors
ld a, 1
ld [frame_ready], a
ret
+ ; swaps tilebank if the player is currently
+ ; inside a room
+ ; sets LCDC_TILE_BANK if player is inside
+ ; unsets it otherwise
+video_swap_tile_bank_player_indoors:
+ ld a, [player_rt_special_flags]
+ and a, CF_COVERED
+ jr nz, @not_covered REL
+
+ ld a, [RLCD]
+ ; set bit
+ or a, LCDCF_TILE_BANK
+ ld [RLCD], a
+
+ ret
+@not_covered:
+ ld a, [RLCD]
+ ; unset bit
+ and a, (~LCDCF_TILE_BANK) & 0xFF
+ ld [RLCD], a
+
+ ret
+
+ ; swaps the current tilebank by setting/unsetting
+ ; LCDC_TILE_BANK
+video_swap_tile_bank:
+ ; cycle bg tiles for animations
+ ld a, [frame_count]
+ and a, BG_CYCLE_FRAMES
+ jr nz, @skip_cycle REL
+
+ ld a, [RLCD]
+ xor a, LCDCF_TILE_BANK
+ ld [RLCD], a
+@skip_cycle:
+ ret
+
; wait for next vblank
vblank_wait:
; disable interrupts