fixed some bow related draw bugs and a selected item infinite loop bug

This commit is contained in:
Jared_Brian_
2024-03-16 16:58:26 -06:00
parent 80a037c6be
commit 4c1bd60cf3
8 changed files with 124 additions and 92 deletions

12
.gitignore vendored Normal file
View File

@@ -0,0 +1,12 @@
asar.exe
oos111.sfc
oos111x-1.bst
oos111x-2.bst
oos111x-3.bst
oos111x.bp
oos111x.cht
oos111x.cpu.sym
oos111x.sfc
oos111x.smp.sym
oos111x.srm
oos111x.sym

View File

@@ -14,7 +14,7 @@ pushpc
; update in game hud colors ; update in game hud colors
org $1BD662 : dw hexto555($814f16), hexto555($552903) org $1BD662 : dw hexto555($814f16), hexto555($552903)
org $1BD66A : dw hexto555($d51d00), hexto555($f9f9f9) org $1BD66A : dw hexto555($d51d00), hexto555($f9f9f9)
org $1DB672 : dw hexto555($d1a452), hexto555($f9f9f9) org $1DB672 : dw hexto555($d0a050), hexto555($f9f9f9)
org $1DB67A : dw hexto555($5987e0), hexto555($f9f9f9) org $1DB67A : dw hexto555($5987e0), hexto555($f9f9f9)
org $1DB682 : dw hexto555($7b7b83), hexto555($bbbbbb) org $1DB682 : dw hexto555($7b7b83), hexto555($bbbbbb)
org $1DB68A : dw hexto555($a58100), hexto555($dfb93f) org $1DB68A : dw hexto555($a58100), hexto555($dfb93f)
@@ -158,11 +158,10 @@ Menu_ScrollDown:
INX : INX INX : INX
LDA.w Menu_Scroll, X LDA.w Menu_Scroll, X
STA.b $EA STA.b $EA
CMP.w #$FF12 : BNE .loop CMP.w #$FF12 : BNE .notDoneScrolling
JMP Menu_InitItemScreen JMP Menu_InitItemScreen
.loop .notDoneScrolling
STX.w MenuScrollLevelV STX.w MenuScrollLevelV
RTS RTS
} }

View File

@@ -1,12 +1,14 @@
; ========================================================= ; =========================================================
; Tilemap Menu background ; Tilemap Menu background
; This function is bled into via the previous menu.asm function.
Menu_DrawBackground: Menu_DrawBackground:
{ {
REP #$30 REP #$30
LDX.w #$FE ; $1700-17FF LDX.w #$FE ; $1700-17FF
.loop .loop
LDA.w menu_frame, X LDA.w menu_frame, X
STA.w $1000, X STA.w $1000, X
LDA.w menu_frame+$100, X LDA.w menu_frame+$100, X

View File

@@ -12,7 +12,7 @@ NothingGFX:
BowsGFX: BowsGFX:
dw $28BA, $28E9, $28E8, $28CB ; Empty bow dw $28BA, $28E9, $28E8, $28CB ; Empty bow
dw $28BA, $28BB, $24CA, $28CB ; Bow and arrows dw $28BA, $28BB, $28CA, $28CB ; Bow and arrows
dw $28BA, $28E9, $28E8, $28CB ; Empty silvers bow dw $28BA, $28E9, $28E8, $28CB ; Empty silvers bow
dw $28BA, $28BB, $24CA, $28CB ; Silver bow and arrows dw $28BA, $28BB, $24CA, $28CB ; Silver bow and arrows

View File

@@ -216,30 +216,26 @@ MagicTilemap:
dw MostlyFull, Full, Full, Full dw MostlyFull, Full, Full, Full
; ========================================================= ; =========================================================
; *$6FAFD-$6FB90 LOCAL ; $06FAFD-$06FB90 LOCAL
HUD_UpdateItemBox: HUD_UpdateItemBox:
{ {
SEP #$30 SEP #$30
; Dost thou haveth the the bow? ; Dost thou haveth the the bow?
LDA $7EF340 : BEQ .no_bow LDA $7EF340 : BEQ .no_bow
CMP.b #$03 : BCC .no_silver_arrows CMP.b #$03 : BCC .no_silver_arrows
; check how many arrows the player has ; check how many arrows the player has
LDA $7EF377 : BNE .draw_bow_item_icon LDA $7EF377 : BNE .draw_bow_item_icon
LDX.b #$03 LDX.b #$03
BRA .draw_bow_item_icon BRA .draw_bow_item_icon
.no_silver_arrows .no_silver_arrows
LDX.b #$02 LDX.b #$02
LDA $7EF377 : BNE .draw_bow_item_icon LDA $7EF377 : BNE .draw_bow_item_icon
LDX.b #$01 LDX.b #$01
.draw_bow_item_icon .draw_bow_item_icon
; values of X correspond to how the icon will end up drawn: ; values of X correspond to how the icon will end up drawn:
; 0x01 - normal bow with no arrows ; 0x01 - normal bow with no arrows
; 0x02 - normal bow with arrows ; 0x02 - normal bow with arrows
@@ -247,46 +243,54 @@ HUD_UpdateItemBox:
; 0x04 - silver bow with silver arrows ; 0x04 - silver bow with silver arrows
TXA : STA $7EF340 TXA : STA $7EF340
.no_bow .no_bow
REP #$30 REP #$30
LDX $0202 : BEQ .no_equipped_item LDX $0202 : BEQ .no_equipped_item
LDA $7EF33F, X : AND.w #$00FF LDA $7EF33F, X : AND.w #$00FF
CPX.w #$0004 : BNE .bombs_not_equipped CPX.w #$0004 : BNE .bombs_not_equipped
LDA.w #$0001 LDA.w #$0001
.bombs_not_equipped .bombs_not_equipped
CPX.w #$0006 : BNE .bottle1_not_equipped CPX.w #$0006 : BNE .bottle1_not_equipped
JMP .load_bottle_content JMP .load_bottle_content
.bottle1_not_equipped .bottle1_not_equipped
CPX.w #$000C : BNE .bottle2_not_equipped CPX.w #$000C : BNE .bottle2_not_equipped
LDA.w #$0002 : JMP .load_bottle_content LDA.w #$0002 : JMP .load_bottle_content
.bottle2_not_equipped .bottle2_not_equipped
CPX.w #$0012 : BNE .bottle3_not_equipped CPX.w #$0012 : BNE .bottle3_not_equipped
LDA.w #$0003 : JMP .load_bottle_content LDA.w #$0003 : JMP .load_bottle_content
.bottle3_not_equipped .bottle3_not_equipped
CPX.w #$0018 : BNE .bottle_not_equipped CPX.w #$0018 : BNE .bottle_not_equipped
LDA.w #$0004 LDA.w #$0004
.load_bottle_content .load_bottle_content
TXY : TAX : LDA $7EF35B, X : AND.w #$00FF : TYX TXY : TAX : LDA $7EF35B, X : AND.w #$00FF : TYX
.bottle_not_equipped .bottle_not_equipped
CPX.w #$000D : BNE .flute_not_equipped CPX.w #$000D : BNE .flute_not_equipped
LDA $030F LDA $030F
.flute_not_equipped .flute_not_equipped
CPX.w #$0003 : BNE .hookshot_not_equipped CPX.w #$0003 : BNE .hookshot_not_equipped
LDA.w GoldstarOrHookshot : BEQ .hookshot_not_equipped LDA.w GoldstarOrHookshot : BEQ .hookshot_not_equipped
SEC : SBC.b #$01 SEC : SBC.b #$01
.hookshot_not_equipped .hookshot_not_equipped
JSR HUD_DrawItem JSR HUD_DrawItem
.no_equipped_item .no_equipped_item
RTS RTS
} }
@@ -401,7 +405,7 @@ HudItems:
org $0DF629 org $0DF629
dw $20F5, $20F5, $20F5, $20F5 ; No bow dw $20F5, $20F5, $20F5, $20F5 ; No bow
dw $28BA, $28E9, $28E8, $28CB ; Empty bow dw $28BA, $28E9, $28E8, $28CB ; Empty bow
dw $28BA, $28BB, $24CA, $28CB ; Bow and arrows dw $28BA, $28BB, $28CA, $28CB ; Bow and arrows
dw $28BA, $28E9, $28E8, $28CB ; Empty silvers bow dw $28BA, $28E9, $28E8, $28CB ; Empty silvers bow
dw $28BA, $28BB, $24CA, $28CB ; Silver bow and arrows dw $28BA, $28BB, $24CA, $28CB ; Silver bow and arrows

View File

@@ -7,7 +7,7 @@ Menu_Palette:
dw hexto555($f9f9f9) dw hexto555($f9f9f9)
dw hexto555($000000) dw hexto555($000000)
dw hexto555($000000) ; transparent dw hexto555($000000) ; transparent
dw hexto555($d1a452) dw hexto555($d0a050)
dw hexto555($f9f9f9) dw hexto555($f9f9f9)
dw hexto555($000000) dw hexto555($000000)
dw hexto555($000000) ; transparent dw hexto555($000000) ; transparent

View File

@@ -167,8 +167,9 @@ Menu_InitItemScreen:
{ {
SEP #$30 SEP #$30
LDY.w $0202 : BNE .all_good LDY.w $0202 : BNE .all_good
; Loop through the SRM of each item to see if we have
.loop ; one of them so we can start with that one selected.
.loop
INY : CPY.b #$25 : BCS .bad INY : CPY.b #$25 : BCS .bad
LDX.w Menu_AddressIndex-1, Y LDX.w Menu_AddressIndex-1, Y
LDA.l $7EF300, X LDA.l $7EF300, X
@@ -177,10 +178,24 @@ Menu_InitItemScreen:
STY.w $0202 STY.w $0202
BRA .all_good BRA .all_good
.bad .bad
; If we made it here that means there are no items
; available but one was still selected.
; This should never happen.
STZ.w $0202 STZ.w $0202
.all_good STZ $0207
LDA.b #$04
STA.w $0200
RTS
.all_good
; Double check we still have the item that was selected.
; This is to prevent a bug where we can get stuck in an
; infinite loop later on.
LDX.w Menu_AddressIndex-1, Y
LDA.l $7EF300, X
CMP.b #$01 : BCC .bad
STZ $0207 STZ $0207
LDA.b #$04 LDA.b #$04
STA.w $0200 STA.w $0200

View File

@@ -128,7 +128,7 @@ namespace Oracle
; ------------------------------------------------------- ; -------------------------------------------------------
incsrc "Util/all_items.asm" incsrc "Util/all_items.asm"
incsrc "Dungeons/house_walls.asm" ;incsrc "Dungeons/house_walls.asm"
print "" print ""
print "Finished applying patches" print "Finished applying patches"