action menu: Added stubs for text drawing
authorLukas Krickl <lukas@krickl.dev>
Sat, 30 Aug 2025 16:10:19 +0000 (18:10 +0200)
committerLukas Krickl <lukas@krickl.dev>
Sat, 30 Aug 2025 16:10:19 +0000 (18:10 +0200)
src/action_menu.s
src/select_menu.s
src/wram.s

index 4340b34ae66b2cda1ff6f83b000b871d0b302074..74fa9199d2779a57403d3e5129e670d0adb0b731 100644 (file)
@@ -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
+       
index 8ce9184c6e13eded9ff8b7fdd34adb023a7cfb0c..70b6ac9fc992c47a325cca9b359f37ccfc440b5f 100644 (file)
        ;               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
index e506ce1c77b4a139caa1d42097417712f32b0de4..9ca174c196e0978c6771701f146d83b1bce6ff82 100644 (file)
@@ -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