this saves a macro call.
units now move in sub-tiles in all directions.
Drawing still will need to take this into account.
; act_effects_def or act_effects_empty
; act_st_def
; act_def_draw
- ; act_rt_def
.se 0
; copy of current state
.de act_state, st_size
.de act_pos_y, 1 ; y/x tile position
.de act_pos_x, 1
+
; custom parameter
.de act_p0, 1
+ ; actor runtime values
+
+ ; last collision with actor
+ ; set during unit_collision_woth_any_other
+.de act_rt_collided_with, 2
+.de act_rt_subtile_y, 1
+.de act_rt_subtile_x, 1
; stats1
.de act_level, 1
.de act_oam_tile, 1
.de act_oam_flags, 1
- ; actor runtime values
-
- ; last collision with actor
- ; set during unit_collision_woth_any_other
-.de act_rt_collided_with, 2
-
- ; sub-tile position
- ; : y subtile
- ; : x subtile
- ; if the subtile position overflows/underflows
- ; the actor may move on to the next tile
-.de act_rt_subtile_y, 1
-.de act_rt_subtile_x, 1
.de act_size, 0
; max bge queue size
.db $3 ; y pos
.db $4 ; x pos
.db $5 ; p0
+
+ ; act_rt_collided_with
+ dw 0
+ .db 0 ; y-subtile
+ .db 0 ; x-subtile
#endmacro
; defines an actor's stats (1/2)
dw $4
#endmacro
- ; defines default values for actor runtime values
- ; these can generally not be set at build time
-#macro act_rt_def
- ; act_rt_collided_woth
- dw 0
- ; subtile_pos
- .db 0
-#endmacro
; defines an actors attributes
; such as weapon skills
act_effects_empty
act_st_def NULL, NULL, st_unit_player_update, st_unit_idle
act_def_draw unit_draw, 0x84, 0
- act_rt_def
st_unit_player_update:
st_def 0x00, unit_player_update, st_unit_player_update
pop hl
; now apply carry to real position
ld a, [hl]
- sbc a, 0
+ $3 a, 0
ld [hl], a
#endmacro
ret z
unit_sub_tile_move act_rt_subtile_y, sub, sbc
-
ret
unit_try_move_down:
cp a, MAP_H - 1 ; lower bound
ret z
- inc a
- ld [hl], a
+ unit_sub_tile_move act_rt_subtile_y, add, adc
ret
unit_try_move_left:
cp a, 0 ; left bound
ret z
- dec a
- ld [hl], a
+ unit_sub_tile_move act_rt_subtile_x, sub, sbc
ret
unit_try_move_right:
cp a, MAP_W - 1 ; right bound
ret z
- inc a
- ld [hl], a
+ unit_sub_tile_move act_rt_subtile_x, add, adc
ret
act_effects_empty
act_st_def NULL, NULL, st_unit_demo_1_cpu_update_idle, st_unit_idle
act_def_draw unit_draw, 0x84, 0
- act_rt_def
unit_demo_3:
st_def 0x00, unit_demo_1_init, st_unit_demo_1_cpu_update
act_effects_empty
act_st_def NULL, NULL, st_unit_demo_1_cpu_update, st_unit_idle
act_def_draw unit_draw, 0x84, 0
- act_rt_def
st_unit_demo_1_cpu_update: