ld hl, action_menu_str_table
ld b, ACTION_MENU_STR_TABLE_LEN
call select_menu_update
-
ld [action_menu_cursor], a
+
+ ; did the player select an action?
+ ld a, b
+ cp a, BTNA
+ jr nz, @no_action_selected REL
+ ; if selection was made
+ ; return to game state
+ ; and run action for player
+
+ ; load action into player
+ ld a, [action_menu_cursor]
+ add a, a
+ ld d, 0
+ ld e, a
+ ld hl, action_menu_action_table
+ add hl, de ; hl = action selected
+
+ ld a, [hl+]
+ ld e, a
+ ld a, [hl]
+ ld d, a
+
+ ; de = action state ptr
+ ld hl, player_unit
+ ld bc, st_size
+ call memcpy
+
+ ld bc, st_update_game
+ ret
+@no_action_selected:
ldnull bc
@notright:
@no_select:
- ; TODO: A to confirm SELECT to assign to B
- pop af
+
+ ; A button to select action
+ ld b, BTNA
+ input_just
+ jr z, @nota REL
+ pop af
+ ld b, BTNA
+ ret
+@nota:
+
+ ; TODO: SELECT to assign to B
+ pop af ; pop original input for a
+ ld b, 0 ; clear b return value
ret
; draws a status text for the current selection