or a, GPF_PAUSE_UPDATE
ld [gameplay_flags], a
+ ; prevent player from drawing
+ ld de, player_unit
+ ld bc, unit_nop_draw
+ call unit_set_draw
+
ret
; state function for door opening animation
ldnull bc
ret
@timer_done:
- ld bc, st_null
; unset pause object update
ld a, [gameplay_flags]
and a, ~GPF_PAUSE_UPDATE & 0xFF
ld [gameplay_flags], a
+
+ ; restore player draw call
+ ld de, player_unit
+ ld bc, player_draw
+ call unit_set_draw
+
+ ld bc, st_null
ret
#undefine TMP_X
#undefine TMP_Y
; and skip inputs
; load next state in case this ret is hit
pop af
- ldnull bc
- ret nz
+ jr nz, @early_ret REL
push de
call unit_handle_inputs
pop de
-
ret
+@early_ret:
+ ldnull bc
+ ret
; removes the door tile the player is currently
; standing on
pop_all
ret
+#define player_draw unit_draw
unit_player:
st_def 0x00, unit_player_init, st_unit_idle
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, OAM_FPRIO, NULL
+ act_def_meta player_draw, 0x8C, OAM_FPRIO, NULL
st_unit_player_update:
st_def 0x00, unit_player_update, st_unit_player_update
pop hl ; hl = obj
ld b, a ; b = rt_sub_tile value
cp a, 0
- ; if this value is 0 we are not movin
+ ; if this value is 0 we are not moving
jp z, @done
ld a, [de] ; load timer
add a, $1
sub a, $2
#endmacro
+
+ ; performs no drawing
+unit_nop_draw:
+ ldnull bc
+ ret
; draws any unit
; inputs:
; a: equipment length
unit_get_equipment:
ret
+
+ ; sets a draw routine for a unit
+ ; inputs:
+ ; de: unit
+ ; bc: draw routine
+unit_set_draw:
+ ld hl, act_draw
+ add hl, de
+ ; hl = draw ptr
+ ld a, c
+ ld [hl+], a
+ ld a, b
+ ld [hl], a
+ ret
st_unit_idle:
st_def 0x00, unit_idle, st_unit_idle