From c5549915009d020e549e54a0facf1e92af74e770 Mon Sep 17 00:00:00 2001 From: scawful Date: Wed, 10 Jul 2024 22:03:04 -0400 Subject: [PATCH] update current ring selection logic and draw --- Menu/menu.asm | 36 +++++++++++++++++++++++++++++++++++- Menu/menu_draw.asm | 6 +++--- 2 files changed, 38 insertions(+), 4 deletions(-) diff --git a/Menu/menu.asm b/Menu/menu.asm index b10c23a..b6bf36f 100644 --- a/Menu/menu.asm +++ b/Menu/menu.asm @@ -652,7 +652,7 @@ Menu_RingBox: REP #$10 LDX.w Menu_RingIconCursorPositions, Y JSR Menu_DrawCursor - JSR Submenu_Return + JSR RingMenu_Controls SEP #$20 LDA.b #$22 : STA.w $0116 @@ -669,6 +669,40 @@ Menu_RingIconCursorPositions: dw menu_offset(12,10) dw menu_offset(12,14) +RingMenu_Controls: +{ + ; Load the current ring selected (0-5) into A + REP #$30 + LDA.w $020B + AND.w #$00FF + 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 + print pc + LDA .rings, Y ; Load the ring bitmask + AND.l MAGICRINGS ; Check if the ring is owned + BEQ + ; If not, skip setting the ring + INY #2 + TYA ; Transfer Y to A + STA.l RingSlot1 ; Set RingSlot1 to the selected ring bitmask + + + + ; Return to item menu if player presses X + LDA.b $F6 : BIT.b #$40 : BEQ + + LDA.b #$01 : STA.w $0200 + + + + ; Close the menu if the player presses start + LDA.b $F4 : BIT.b #$10 : BEQ + + LDA.b #$08 : STA.w $0200 + + + RTS + + .rings + db $20, $10, $08, $04, $02, $01 +} + Submenu_Return: { ; Return to the item menu if they press A diff --git a/Menu/menu_draw.asm b/Menu/menu_draw.asm index 5f81532..cf4e370 100644 --- a/Menu/menu_draw.asm +++ b/Menu/menu_draw.asm @@ -764,7 +764,7 @@ Menu_DrawRingBox: Menu_DrawMagicRings: { LDA.l RingSlot1 : AND.w #$00FF : CMP.w #$0001 : BCC .no_attack - LDA.w #$0002 : BRA .draw_storms + BRA .draw_storms .no_attack LDA.w #$0001 .draw_storms @@ -774,7 +774,7 @@ Menu_DrawMagicRings: JSR DrawMenuItem LDA.l RingSlot2 : AND.w #$00FF : CMP.w #$0001 : BCC .no_defense - LDA.w #$0003 : BRA .draw_defense + BRA .draw_defense .no_defense LDA.w #$0001 .draw_defense @@ -784,7 +784,7 @@ Menu_DrawMagicRings: JSR DrawMenuItem LDA.l RingSlot3 : AND.w #$00FF : CMP.w #$0001 : BCC .no_luck - LDA.w #$0004 : BRA .draw_luck + BRA .draw_luck .no_luck LDA.w #$0001 .draw_luck