select menu: added stub for select menu
authorLukas Krickl <lukas@krickl.dev>
Sat, 30 Aug 2025 06:44:45 +0000 (08:44 +0200)
committerLukas Krickl <lukas@krickl.dev>
Sat, 30 Aug 2025 06:44:45 +0000 (08:44 +0200)
src/action_menu.s [new file with mode: 0644]
src/main.s
src/select_menu.s [new file with mode: 0644]
src/unit.s
src/update.s

diff --git a/src/action_menu.s b/src/action_menu.s
new file mode 100644 (file)
index 0000000..4340b34
--- /dev/null
@@ -0,0 +1,26 @@
+       ; game state for action menu selector
+       ; the action menu allows the player to select
+       ; any action the character can perform
+       ; it also allows binding an action to the B button
+       ; by pressing select
+       ; inputs:
+       ;               de: state
+       ;       returns:
+       ;               bc: next state
+update_action_menu:
+       ldnull bc
+       ret
+       
+       ; transitions from the current state
+       ; to action menu
+action_menu_init:
+       ld hl, game_mode
+       ld de, st_next
+       add hl, de
+       ; write st_update_action_menu to st_next
+       ld a, st_update_action_menu LO
+       ld [hl+], a
+       ld a, st_update_action_menu HI
+       ld [hl], a
+
+       ret
index fd065319b51dbd3b6af5b0cc50ef9de54fe656c9..1b45af6683593924b029ace43fe9a6b483b2aba1 100644 (file)
@@ -79,6 +79,8 @@ main:
 #include "objanim.s"
 #include "battle.s"
 #include "action.s"
+#include "action_menu.s"
+#include "select_menu.s"
 
 ; fill bank
 .fill 0xFF, 0x4000 - $
diff --git a/src/select_menu.s b/src/select_menu.s
new file mode 100644 (file)
index 0000000..8ce9184
--- /dev/null
@@ -0,0 +1,13 @@
+       ; a select menu is any menu that allows the player to select
+       ; a range of values
+       ; writes current string to status line and requests an update
+       ; if the direction keys are pressed
+       ; inputs:
+       ;               hl: string ptr table
+       ;                b: table length
+       ;                a: current slection value
+       ;       returns:
+       ;               a: selection value
+       ;               b: button pressed
+select_menu_update:
+       ret
index d1fb5f77fe87b7fc9e37e354cc880f8229b8fd1e..1561458a274fb9e61c4a114904f02a9389befbc6 100644 (file)
@@ -302,6 +302,14 @@ unit_handle_inputs:
                call unit_handle_assigned_action 
                push bc ; bc = next state
 @nota:
+
+       ld b, BTNSELECT
+       input_just
+       jr z, @notselect REL
+               pop bc
+               call action_menu_init
+               push bc ; bc = next state
+@notselect:
   
   ld b, BTNUP
   input_held 
index 37e862f961fa377501fcbb90f8f9c2847a98b1a5..7b4e66e799c481ca73e57468a2a626454ba672ca 100644 (file)
@@ -107,3 +107,6 @@ st_update_pause:
   st_def 0x00, update_pause, st_update_pause
 st_update_game_over:
   st_def 0x00, update_game_over, st_update_game_over
+
+st_update_action_menu:
+       st_def 0x00, update_action_menu, st_update_action_menu