#define DEBUG_MENU_STR_TABLE_LEN (debug_menu_str_table_end - debug_menu_str_table) / 2
+; debug routines:
+; get jumped to directly
+; return:
+; bc: new game state
debug_menu_action_table:
+ dw debug_fn_new_game
+ dw debug_fn_clear_actors
debug_menu_action_table_end:
; updates the debug menu
ld b, DEBUG_MENU_STR_TABLE_LEN
call select_menu_update
ld [debug_menu_cursor], a
+
+ ; did the player select an action?
+ ld a, b
+ cp a, BTNA
+ jr nz, @no_action_selected REL
+
+ ; load ptr from action table
+ ; into hl and call it
+ ld a, [debug_menu_cursor]
+ add a, a ; * 2 for offset
+ ld hl, debug_menu_action_table
+ ld d, 0
+ ld e, a
+ add hl, de
+
+ ld a, [hl+]
+ ld d, a
+ ld a, [hl]
+ ld h, a
+ ld l, d
+
+ ; jp to selected routine
+ jp hl
+@no_action_selected:
ldnull bc
ret
ld hl, debug_menu_str_table
call select_menu_draw_status
ret
+
+ ; debug new game routine
+ ; returns:
+ ; bc: new state
+debug_fn_new_game:
+ ld bc, st_update_game
+ ret
+
+debug_fn_clear_actors:
+ ld bc, st_update_game
+ ret