From: Lukas Krickl Date: Sat, 30 Aug 2025 16:10:19 +0000 (+0200) Subject: action menu: Added stubs for text drawing X-Git-Url: https://git.krickl.dev/?a=commitdiff_plain;h=3ef84c5e9d031b75e6aafe24f5c515ede9ff08a9;p=gbrg%2F.git action menu: Added stubs for text drawing --- diff --git a/src/action_menu.s b/src/action_menu.s index 4340b34..74fa919 100644 --- a/src/action_menu.s +++ b/src/action_menu.s @@ -1,3 +1,31 @@ +str_am_attack: +.str "attack" +.db 0 + +str_am_eat: +.str "eat" +.db 0 + +str_am_rest: +.str "rest" +.db 0 + + ; label +action_menu_str_table: + dw str_am_attack + dw str_am_eat + dw str_am_rest +action_menu_str_table_end: + + ; map to actions +action_menu_action_table: + dw st_action_attack_init + dw st_action_attack_init + dw st_action_attack_init +action_menu_action_table_end: + +#define ACTION_MENU_STR_TABLE_LEN (action_menu_str_table_end - action_menu_str_table) / 2 + ; game state for action menu selector ; the action menu allows the player to select ; any action the character can perform @@ -8,6 +36,15 @@ ; returns: ; bc: next state update_action_menu: + ; exit menu on b button press + ld b, BTNB + input_just + jr z, @notb REL + ld bc, st_update_game + ret +@notb: + + ldnull bc ret @@ -23,4 +60,9 @@ action_menu_init: ld a, st_update_action_menu HI ld [hl], a + ; draw the initial status line + ld a, [action_menu_cursor] + call select_menu_draw_status + ret + diff --git a/src/select_menu.s b/src/select_menu.s index 8ce9184..70b6ac9 100644 --- a/src/select_menu.s +++ b/src/select_menu.s @@ -11,3 +11,15 @@ ; b: button pressed select_menu_update: ret + + ; draws a status text for the current selection + ; inputs: + ; hl: string ptr table + ; a: selection +select_menu_draw_status: + add a, a ; * 2 for table offset + ld d, 0 + ld e, a + add hl, de ; hl = string ptr + + ret diff --git a/src/wram.s b/src/wram.s index e506ce1..9ca174c 100644 --- a/src/wram.s +++ b/src/wram.s @@ -76,6 +76,8 @@ redraw_shadow: .adv 2 ; remaining redraw steps redraw_steps: .adv 1 +action_menu_cursor: .adv 1 + ; dummy oam ; same memory as empty_unit empty_oam: .adv oamsize