.def int CURSOR_TILE = 0x04
+ ; loads the default player unit
+ ; and hands over control
+unit_load_default_player:
+ ld de, unit_player
+ ld hl, p0_units
+ ld bc, act_size
+ call memcpy
+
+ ld de, p_empty_unit
+ call unit_next_request
+ ret
+
+unit_player_init:
+ ldnull bc
+ ret
+
+ ; inputs
+ ; de: actor
+unit_player_update:
+ push de
+ ld hl, act_oam_flags
+ add hl, de
+ ld a, [hl]
+ or a, OAM_FXFLIP
+ ld [hl], a
+ pop de
+
+
+ push de
+ call unit_handle_inputs
+ pop de
+
+ push de
+ call unit_scroll_center
+ pop de
+
+ ret
+
+
+unit_player:
+ st_def 0x00, unit_player_init, st_unit_idle
+ act_def ACT_T_DEMO_1, 0, 2, 2, 0
+ act_stat_def1 1, 1, 1, 1, 1, 1
+ act_stat_def2 1, 1, 1, 1, 1, 1, 1, 1
+ act_attr_def_empty
+ act_inventory_empty
+ act_equipment_empty
+ 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
call_hl
ret
-unit_player_init:
- ldnull bc
- ret
-
-unit_demo_1_init:
- ldnull bc
- ret
-
- ; inputs
- ; de: actor
-unit_player_update:
- push de
- ld hl, act_oam_flags
- add hl, de
- ld a, [hl]
- or a, OAM_FXFLIP
- ld [hl], a
- pop de
-
-
- push de
- call unit_handle_inputs
- pop de
-
- push de
- call unit_scroll_center
- pop de
-
- ret
-
- ; cpu controllerd unit update
-unit_demo_1_cpu_update:
- push de
- call unit_handle_cpu_inputs
- pop de
-
- ret
-
unit_handle_cpu_inputs:
; pick where to go
call roll_d16
unit_get_equipment:
ret
- ; loads the default player unit
- ; and hands over control
-unit_load_default_player:
- ld de, unit_player
- ld hl, p0_units
- ld bc, act_size
- call memcpy
-
- ld de, p_empty_unit
- call unit_next_request
- ret
-
-unit_player:
- st_def 0x00, unit_player_init, st_unit_idle
- act_def ACT_T_DEMO_1, 0, 2, 2, 0
- act_stat_def1 1, 1, 1, 1, 1, 1
- act_stat_def2 1, 1, 1, 1, 1, 1, 1, 1
- act_attr_def_empty
- act_inventory_empty
- act_equipment_empty
- 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
-
-unit_demo_2:
- st_def 0x00, unit_demo_1_init, st_unit_idle
- act_def ACT_T_DEMO_1, 0, 3, 3, 0
- act_stat_def1 1, 1, 1, 1, 1, 1
- act_stat_def2 1, 1, 1, 1, 1, 1, 1, 1
- act_attr_def_empty
- act_inventory_empty
- act_equipment_empty
- 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
-
-unit_demo_3:
- st_def 0x00, unit_demo_1_init, st_unit_idle
- act_def ACT_T_DEMO_1, 0, 4, 4, 0
- act_stat_def1 1, 1, 1, 1, 1, 1
- act_stat_def2 1, 1, 1, 1, 1, 1, 1, 1
- act_attr_def_empty
- act_inventory_empty
- act_equipment_empty
- 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_player_update:
- st_def 0x00, unit_player_update, st_unit_player_update
-
-st_unit_demo_1_cpu_update:
- st_def 0x00, unit_demo_1_cpu_update, st_unit_demo_1_cpu_update
-
st_unit_idle:
st_def 0x00, unit_idle, st_unit_idle
--- /dev/null
+
+unit_demo_1_init:
+ ldnull bc
+ ret
+
+ ; cpu controllerd unit update
+unit_demo_1_cpu_update:
+ push de
+ call unit_handle_cpu_inputs
+ pop de
+
+ ret
+
+unit_demo_2:
+ st_def 0x00, unit_demo_1_init, st_unit_idle
+ act_def ACT_T_DEMO_1, 0, 3, 3, 0
+ act_stat_def1 1, 1, 1, 1, 1, 1
+ act_stat_def2 1, 1, 1, 1, 1, 1, 1, 1
+ act_attr_def_empty
+ act_inventory_empty
+ act_equipment_empty
+ 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
+
+unit_demo_3:
+ st_def 0x00, unit_demo_1_init, st_unit_idle
+ act_def ACT_T_DEMO_1, 0, 4, 4, 0
+ act_stat_def1 1, 1, 1, 1, 1, 1
+ act_stat_def2 1, 1, 1, 1, 1, 1, 1, 1
+ act_attr_def_empty
+ act_inventory_empty
+ act_equipment_empty
+ 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:
+ st_def 0x00, unit_demo_1_cpu_update, st_unit_demo_1_cpu_update
+