ld bc, st_update_game
ret
@notb:
+
+ ; update menu
+ ld a, [action_menu_cursor]
+ ld hl, action_menu_str_table
+ ld b, ACTION_MENU_STR_TABLE_LEN
+ call select_menu_update
+
+ ld [action_menu_cursor], a
ldnull bc
; a: selection value
; b: button pressed
select_menu_update:
+ push af
+ ; save table length
+ push bc
+
+ cp a, 0
+ jr z, @notleft REL
+
+ ld b, BTNLEFT
+ input_just
+ jr z, @notleft REL
+ pop bc
+ pop af
+ dec a
+ call select_menu_draw_status
+ ld b, BTNLEFT
+ ret
+@notleft:
+
+ pop bc ; get back table length
+ pop af
+ push af
+ dec b ; length - 1
+ cp a, b
+ jr z, @notright REL ; is a > b
+
+ ld b, BTNRIGHT
+ input_just
+ jr z, @notright REL
+ pop af
+ inc a
+ call select_menu_draw_status
+ ld b, BTNRIGHT
+ ret
+@notright:
+
+
+ ; TODO: A to confirm SELECT to assign to B
+ pop af
ret
; draws a status text for the current selection
; inputs:
; hl: string ptr table
; a: selection
+ ; preserves:
+ ; af
select_menu_draw_status:
+ push af
+
push hl
push af
call ui_clear_status_line
ld de, UI_STATUS_LINE
call puts
call ui_request_redraw
-
-
+
+ pop af
ret