upgrade submenus with hints, indicators, journal with X and rings with Y in menu
This commit is contained in:
100
Menu/menu.asm
100
Menu/menu.asm
@@ -159,7 +159,7 @@ Menu_UploadLeft:
|
||||
JSR Menu_DrawBackground
|
||||
JSR DrawYItems
|
||||
JSR Menu_DrawSelect
|
||||
JSR Menu_DrawRingPrompt
|
||||
JSR Menu_DrawButtonPrompt
|
||||
JSR Menu_DrawItemName
|
||||
; INSERT PALETTE -------
|
||||
|
||||
@@ -240,13 +240,25 @@ Menu_CheckForSpecialMenus:
|
||||
SEC : RTS ; Return Carry Set
|
||||
++
|
||||
|
||||
LDA.b $F6 : BIT.b #$40 : BEQ +++
|
||||
; X Button: Open Journal from anywhere
|
||||
LDA.b $F6 : BIT.b #$40 : BEQ .no_x_journal
|
||||
LDA.b #!MENU_STATE_JOURNAL : STA.w $0200
|
||||
JSR Menu_DeleteCursor
|
||||
REP #$20
|
||||
LDA.w #$0000 : STA.l JournalState ; Reset to first page
|
||||
JSL Menu_DrawJournal
|
||||
SEP #$30
|
||||
SEC : RTS ; Return Carry Set
|
||||
.no_x_journal
|
||||
|
||||
; Y Button: Open Ring Box from anywhere
|
||||
LDA.b $F4 : BIT.b #$40 : BEQ .no_y_rings
|
||||
JSR Menu_DeleteCursor
|
||||
JSR Menu_DrawRingBox
|
||||
STZ.w $020B
|
||||
LDA.b #!MENU_STATE_RING_BOX : STA.w $0200 ; Ring Box
|
||||
SEC : RTS ; Return Carry Set
|
||||
+++
|
||||
.no_y_rings
|
||||
|
||||
CLC : RTS ; Return Carry Clear
|
||||
}
|
||||
@@ -330,7 +342,7 @@ Menu_StatsScreen:
|
||||
{
|
||||
JSR Menu_CheckHScroll
|
||||
|
||||
; Check X button to open Journal
|
||||
; X Button: Open Journal
|
||||
LDA.b $F6 : BIT.b #$40 : BEQ .no_journal
|
||||
LDA.b #!MENU_STATE_JOURNAL : STA.w $0200
|
||||
REP #$20
|
||||
@@ -342,8 +354,22 @@ Menu_StatsScreen:
|
||||
LDA.b #$01 : STA.b $17
|
||||
; Play menu open sound
|
||||
LDA.b #$11 : STA.w $012F
|
||||
RTS
|
||||
.no_journal
|
||||
|
||||
; Y Button: Open Ring Box
|
||||
LDA.b $F4 : BIT.b #$40 : BEQ .no_rings
|
||||
JSR Menu_DrawRingBox
|
||||
STZ.w $020B
|
||||
LDA.b #!MENU_STATE_RING_BOX : STA.w $0200 ; Ring Box
|
||||
; Set VRAM upload for right side (quest screen)
|
||||
LDA.b #$23 : STA.w $0116
|
||||
LDA.b #$01 : STA.b $17
|
||||
; Play menu open sound
|
||||
LDA.b #$11 : STA.w $012F
|
||||
RTS
|
||||
.no_rings
|
||||
|
||||
; JSR Menu_StatsScreen_Input ; Selection disabled per user request
|
||||
RTS
|
||||
}
|
||||
@@ -477,7 +503,7 @@ Menu_RefreshInventoryScreen:
|
||||
JSR Menu_DrawBackground
|
||||
JSR DrawYItems
|
||||
JSR Menu_DrawSelect
|
||||
JSR Menu_DrawRingPrompt
|
||||
JSR Menu_DrawButtonPrompt
|
||||
JSR Menu_DrawItemName
|
||||
|
||||
; Palette restore if needed (mimicking Menu_UploadLeft)
|
||||
@@ -570,43 +596,48 @@ Menu_InitiateScrollDown:
|
||||
|
||||
Menu_HandleGridNavigation:
|
||||
{
|
||||
STX $00 ; Save Table Pointer
|
||||
STX $00 ; Save Table Pointer (16-bit, callers set REP #$10)
|
||||
SEP #$30 ; 8-bit A and X/Y for navigation
|
||||
|
||||
TYA ; Max Index to A
|
||||
PHA ; Save Max
|
||||
TYA ; Max Index to A (low byte of Y)
|
||||
PHA ; Save Max
|
||||
|
||||
LDA.b $F4
|
||||
LSR : BCS .move_right
|
||||
LSR : BCS .move_left
|
||||
LSR : BCS .move_down
|
||||
LSR : BCS .move_up
|
||||
PLA ; Clean stack
|
||||
PLA ; Clean stack
|
||||
CLC : RTS
|
||||
|
||||
.move_up
|
||||
.move_right
|
||||
JSR .delete_cursor
|
||||
PLA ; Get Max
|
||||
STA $02 ; Store Max
|
||||
PLA ; Get Max
|
||||
STA $02 ; Store Max
|
||||
INC.w $020B
|
||||
LDA.w $020B : CMP $02 : BCC .done
|
||||
STZ.w $020B
|
||||
STZ.w $020B ; Wrap to 0
|
||||
BRA .done
|
||||
|
||||
.move_down
|
||||
.move_left
|
||||
JSR .delete_cursor
|
||||
PLA ; Clean stack
|
||||
LDA.w $020B : BEQ .done
|
||||
PLA ; Get Max
|
||||
STA $02 ; Store Max
|
||||
LDA.w $020B : BEQ .wrap_to_max
|
||||
DEC.w $020B
|
||||
BRA .done
|
||||
.wrap_to_max
|
||||
; Wrap from 0 to max-1
|
||||
LDA $02 : DEC : STA.w $020B
|
||||
BRA .done
|
||||
|
||||
.delete_cursor
|
||||
REP #$30
|
||||
LDA.w $020B : ASL : TAY
|
||||
LDA ($00), Y : TAX
|
||||
JSR Menu_DeleteCursor_AltEntry
|
||||
SEP #$20
|
||||
JSR Menu_DeleteCursor_AltEntry ; This does SEP #$30 internally
|
||||
RTS
|
||||
|
||||
.done
|
||||
@@ -620,10 +651,11 @@ Menu_MagicBag:
|
||||
{
|
||||
JSR Menu_DrawMagicBag
|
||||
JSR Menu_DrawMagicItems
|
||||
SEP #$30
|
||||
SEP #$20 ; 8-bit A
|
||||
|
||||
INC $0207
|
||||
|
||||
REP #$10 ; 16-bit X/Y for pointer load
|
||||
LDX.w #Menu_MagicBagCursorPositions
|
||||
LDY.w #$0006
|
||||
JSR Menu_HandleGridNavigation
|
||||
@@ -800,8 +832,11 @@ Menu_RingBox:
|
||||
{
|
||||
JSR Menu_DrawRingBox
|
||||
JSR Menu_DrawMagicRingsInBox
|
||||
JSR Menu_DrawRingBoxPrompt
|
||||
SEP #$20 ; 8-bit A
|
||||
INC $0207
|
||||
|
||||
REP #$10 ; 16-bit X/Y for pointer load
|
||||
LDX.w #Menu_RingIconCursorPositions
|
||||
LDY.w #$0006
|
||||
JSR Menu_HandleGridNavigation
|
||||
@@ -871,24 +906,37 @@ RingMenu_Controls:
|
||||
SEP #$30
|
||||
; Set the current ring to the cursor position
|
||||
TAY ; Transfer A to Y for indexing
|
||||
LDA.b $F6 : BIT.b #$80 : BEQ + ; Check if the confirm button is pressed
|
||||
LDA.b $F6 : BIT.b #$80 : BEQ .no_a ; A button: Select ring
|
||||
LDA .rings, Y ; Load the ring bitmask
|
||||
AND.l MAGICRINGS ; Check if the ring is owned
|
||||
BEQ + ; If not, skip setting the ring
|
||||
BEQ .no_a ; If not, skip setting the ring
|
||||
INY #2
|
||||
TYA ; Transfer Y to A
|
||||
JSR RingMenu_StoreRingToSlotStack
|
||||
+
|
||||
LDA.b #$22 : STA.w $012F ; Play equip sound
|
||||
.no_a
|
||||
|
||||
; Return to item menu if player presses X
|
||||
LDA.b $F6 : BIT.b #$40 : BEQ +
|
||||
; Y button: Close ring menu, return to previous screen
|
||||
LDA.b $F4 : BIT.b #$40 : BEQ .no_y
|
||||
LDA.b #$12 : STA.w $012F ; Play close sound
|
||||
LDA.b #!MENU_STATE_SUBMENU_RETURN : STA.w $0200
|
||||
+
|
||||
RTS
|
||||
.no_y
|
||||
|
||||
; Close the menu if the player presses start
|
||||
LDA.b $F4 : BIT.b #$10 : BEQ +
|
||||
; X button: Open Journal from ring menu
|
||||
LDA.b $F6 : BIT.b #$40 : BEQ .no_x
|
||||
LDA.b #!MENU_STATE_JOURNAL : STA.w $0200
|
||||
REP #$20
|
||||
LDA.w #$0000 : STA.l JournalState
|
||||
JSL Menu_DrawJournal
|
||||
SEP #$30
|
||||
RTS
|
||||
.no_x
|
||||
|
||||
; Start button: Close the entire menu
|
||||
LDA.b $F4 : BIT.b #$10 : BEQ .no_start
|
||||
LDA.b #!MENU_STATE_SCROLL_UP : STA.w $0200
|
||||
+
|
||||
.no_start
|
||||
RTS
|
||||
|
||||
.rings
|
||||
|
||||
@@ -901,20 +901,51 @@ Menu_DrawCursor:
|
||||
BRA .done
|
||||
|
||||
.no_delete
|
||||
; Check if current item has submenu behavior
|
||||
SEP #$20
|
||||
JSR Menu_CheckItemHasSubmenu
|
||||
REP #$20
|
||||
BCS .submenu_cursor
|
||||
|
||||
; Normal cursor (palette 1 - default blue/white)
|
||||
LDA.w #$3060 : STA.w $1108, X ; corner
|
||||
LDA.w #$3070 : STA.w $1148, X
|
||||
|
||||
LDA.w #$7060 : STA.w $110E, X ; corner
|
||||
LDA.w #$7070 : STA.w $114E, X
|
||||
|
||||
LDA.w #$3070 : STA.w $1188, X
|
||||
LDA.w #$B060 : STA.w $11C8, X ; corner
|
||||
|
||||
LDA.w #$7070 : STA.w $118E, X
|
||||
LDA.w #$F060 : STA.w $11CE, X ; corner
|
||||
BRA .done
|
||||
|
||||
.submenu_cursor
|
||||
; Gold/yellow cursor (palette 2) for items with submenus
|
||||
LDA.w #$2460 : STA.w $1108, X ; corner
|
||||
LDA.w #$2470 : STA.w $1148, X
|
||||
LDA.w #$6460 : STA.w $110E, X ; corner
|
||||
LDA.w #$6470 : STA.w $114E, X
|
||||
LDA.w #$2470 : STA.w $1188, X
|
||||
LDA.w #$A460 : STA.w $11C8, X ; corner
|
||||
LDA.w #$6470 : STA.w $118E, X
|
||||
LDA.w #$E460 : STA.w $11CE, X ; corner
|
||||
|
||||
.done
|
||||
SEP #$20
|
||||
RTS
|
||||
}
|
||||
|
||||
; Check if current item has submenu behavior
|
||||
; Returns: Carry set if item has submenu, clear otherwise
|
||||
Menu_CheckItemHasSubmenu:
|
||||
{
|
||||
LDA.w $0202 ; Current cursor position/item index
|
||||
CMP.b #$05 : BEQ .has_submenu ; Magic Powder (mushroom/powder)
|
||||
CMP.b #$0D : BEQ .has_submenu ; Ocarina (song selection)
|
||||
CMP.b #$0E : BEQ .has_submenu ; Book (Journal)
|
||||
CLC
|
||||
RTS
|
||||
.has_submenu
|
||||
SEC
|
||||
RTS
|
||||
}
|
||||
|
||||
|
||||
@@ -211,6 +211,16 @@ AreaNameTXT:
|
||||
dw $2430, $2430, $2430, $2430
|
||||
dw $2430, $2430, $2430, $2430
|
||||
|
||||
RingPromptTXT:
|
||||
dw $2567, $256B, $2417, $2561
|
||||
dw $2558, $255D, $2556, $2562
|
||||
; Button prompts: "X:LOG Y:RINGS "
|
||||
ButtonPromptTXT:
|
||||
dw $2567, $256B, $255B, $255E ; X:LO
|
||||
dw $2556, $2417, $2417, $2417 ; G (spaces)
|
||||
dw $2568, $256B, $2561, $2558 ; Y:RI
|
||||
dw $255D, $2556, $2562, $2417 ; NGS (space)
|
||||
|
||||
; Ring box prompts: "A:EQUIP Y:BACK "
|
||||
RingBoxPromptTXT:
|
||||
dw $2550, $256B, $2554, $2560 ; A:EQ
|
||||
dw $2564, $2558, $255F, $2417 ; UIP (space)
|
||||
dw $2568, $256B, $2551, $2550 ; Y:BA
|
||||
dw $2552, $255A, $2417, $2417 ; CK (spaces)
|
||||
|
||||
@@ -529,15 +529,28 @@ Menu_DrawCharacterName:
|
||||
}
|
||||
|
||||
|
||||
Menu_DrawRingPrompt:
|
||||
Menu_DrawButtonPrompt:
|
||||
{
|
||||
REP #$30
|
||||
LDX.w #$0E
|
||||
LDX.w #$1E ; 16 tiles (32 bytes - 2 = $1E)
|
||||
|
||||
.loop
|
||||
LDA.w RingPromptTXT, X : STA.w $1254, X
|
||||
LDA.w ButtonPromptTXT, X : STA.w $1254, X
|
||||
DEX : DEX : BPL .loop
|
||||
|
||||
SEP #$30 ; Restore 8-bit mode before return
|
||||
RTS
|
||||
}
|
||||
|
||||
Menu_DrawRingBoxPrompt:
|
||||
{
|
||||
REP #$30
|
||||
LDX.w #$1E ; 16 tiles (32 bytes - 2 = $1E)
|
||||
|
||||
.loop
|
||||
LDA.w RingBoxPromptTXT, X : STA.w $1294, X ; One row below button prompt ($1254 + $40)
|
||||
DEX : DEX : BPL .loop
|
||||
|
||||
SEP #$30
|
||||
RTS
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user