fixed a bug that cased item text to draw even when no items were available

This commit is contained in:
Jared_Brian_
2024-03-16 20:41:47 -06:00
parent 4c1bd60cf3
commit b13c5e5d28
2 changed files with 47 additions and 37 deletions

View File

@@ -1,8 +1,7 @@
; ========================================================= ; =========================================================
; Tilemap Menu background ; Tilemap Menu background
; This function is bled into via the previous menu.asm function. ; This function is bled into via the previous menu.asm file.
Menu_DrawBackground: Menu_DrawBackground:
{ {
REP #$30 REP #$30

View File

@@ -119,6 +119,17 @@ Menu_SongNames:
Menu_DrawItemName: Menu_DrawItemName:
{ {
SEP #$30 SEP #$30
; Double check that we have the item.
LDY.w $0202
LDX.w Menu_AddressIndex-1, Y
LDA.l $7EF300, X
CMP.b #$01 : BCS .haveItem
REP #$30
RTS
.haveItem
LDA.w $0202 : CMP.b #$03 : BEQ .goldstar LDA.w $0202 : CMP.b #$03 : BEQ .goldstar
LDA.w $0202 : CMP.b #$0D : BEQ .ocarina LDA.w $0202 : CMP.b #$0D : BEQ .ocarina
; Check if it's a bottle ; Check if it's a bottle
@@ -127,52 +138,52 @@ Menu_DrawItemName:
LDA.w $0202 : CMP.b #$12 : BEQ .bottle_3 LDA.w $0202 : CMP.b #$12 : BEQ .bottle_3
LDA.w $0202 : CMP.b #$18 : BEQ .bottle_4 LDA.w $0202 : CMP.b #$18 : BEQ .bottle_4
.draw_item .draw_item
REP #$30 REP #$30
LDA.w $0202 : BEQ .no_items LDA.w $0202 : BEQ .no_items
DEC : ASL #5 : TAX DEC : ASL #5 : TAX
LDY.w #$000 LDY.w #$000
.loop .loop
LDA.w Menu_ItemNames, X ; Load your text character LDA.w Menu_ItemNames, X ; Load your text character
STA.w $1692, Y ; <- into the buffer STA.w $1692, Y ; <- into the buffer
INX : INX INX : INX
INY : INY : CPY #$001C : BCC .loop INY : INY : CPY #$001C : BCC .loop
.no_items .no_items
RTS RTS
; Draw Bottle Description ; Draw Bottle Description
.bottle_1 .bottle_1
REP #$30 : LDX #$0000 : JMP .draw_bottle REP #$30 : LDX #$0000 : JMP .draw_bottle
.bottle_2 .bottle_2
REP #$30 : LDX #$0001 : JMP .draw_bottle REP #$30 : LDX #$0001 : JMP .draw_bottle
.bottle_3 .bottle_3
REP #$30 : LDX #$0002 : JMP .draw_bottle REP #$30 : LDX #$0002 : JMP .draw_bottle
.bottle_4 .bottle_4
REP #$30 : LDX #$0003 REP #$30 : LDX #$0003
.draw_bottle
JSR DrawBottleNames
RTS
.goldstar .draw_bottle
LDA GoldstarOrHookshot : CMP.b #$02 : BNE .draw_item JSR DrawBottleNames
JSR MaybeDrawGoldstarName RTS
RTS
.ocarina .goldstar
REP #$30 LDA GoldstarOrHookshot : CMP.b #$02 : BNE .draw_item
JSR MaybeDrawGoldstarName
RTS
; Check the timer and see if we should draw the item name .ocarina
LDA $1A : AND.w #$00FF : CMP #$0080 : BCC .draw_item REP #$30
; Check the timer and see if we should draw the item name
LDA $1A : AND.w #$00FF : CMP #$0080 : BCC .draw_item
LDA $030F : BEQ .draw_item LDA $030F : BEQ .draw_item
LDA $030F : AND.w #$00FF : DEC : ASL #5 : TAX LDA $030F : AND.w #$00FF : DEC : ASL #5 : TAX
LDY.w #$0000 LDY.w #$0000
.draw_ocarina_loop
LDA.w Menu_SongNames, X : STA.w $1692, Y .draw_ocarina_loop
LDA.w Menu_SongNames, X : STA.w $1692, Y
INX #2 : INY #2 : CPY #$001C : BCC .draw_ocarina_loop INX #2 : INY #2 : CPY #$001C : BCC .draw_ocarina_loop
RTS RTS
} }
DrawBottleNames: DrawBottleNames: