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 .notDoneScrolling
.loop
STX.w MenuScrollLevelV STX.w MenuScrollLevelV
RTS RTS
} }

View File

@@ -1,30 +1,32 @@
; ========================================================= ; =========================================================
; 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
STA.w $1100, X STA.w $1100, X
LDA.w menu_frame+$200, X LDA.w menu_frame+$200, X
STA.w $1200, X STA.w $1200, X
LDA.w menu_frame+$300, X LDA.w menu_frame+$300, X
STA.w $1300, X STA.w $1300, X
LDA.w menu_frame+$400, X LDA.w menu_frame+$400, X
STA.w $1400, X STA.w $1400, X
LDA.w menu_frame+$500, X LDA.w menu_frame+$500, X
STA.w $1500, X STA.w $1500, X
LDA.w menu_frame+$600, X LDA.w menu_frame+$600, X
STA.w $1600, X STA.w $1600, X
LDA.w menu_frame+$700, X LDA.w menu_frame+$700, X
STA.w $1700, X STA.w $1700, X
DEX : DEX DEX : DEX
BPL .loop BPL .loop
RTS RTS

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,77 +216,81 @@ 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
; check how many arrows the player has
LDA $7EF377 : BNE .draw_bow_item_icon
LDX.b #$03
BRA .draw_bow_item_icon
CMP.b #$03 : BCC .no_silver_arrows .no_silver_arrows
; check how many arrows the player has LDX.b #$02
LDA $7EF377 : BNE .draw_bow_item_icon
LDX.b #$03 LDA $7EF377 : BNE .draw_bow_item_icon
BRA .draw_bow_item_icon LDX.b #$01
.no_silver_arrows .draw_bow_item_icon
; values of X correspond to how the icon will end up drawn:
; 0x01 - normal bow with no arrows
; 0x02 - normal bow with arrows
; 0x03 - silver bow with no silver arrows
; 0x04 - silver bow with silver arrows
TXA : STA $7EF340
LDX.b #$02 .no_bow
LDA $7EF377 : BNE .draw_bow_item_icon
LDX.b #$01
.draw_bow_item_icon REP #$30
; values of X correspond to how the icon will end up drawn: LDX $0202 : BEQ .no_equipped_item
; 0x01 - normal bow with no arrows LDA $7EF33F, X : AND.w #$00FF
; 0x02 - normal bow with arrows CPX.w #$0004 : BNE .bombs_not_equipped
; 0x03 - silver bow with no silver arrows LDA.w #$0001
; 0x04 - silver bow with silver arrows
TXA : STA $7EF340
.no_bow .bombs_not_equipped
REP #$30
LDX $0202 : BEQ .no_equipped_item
LDA $7EF33F, X : AND.w #$00FF
CPX.w #$0004 : BNE .bombs_not_equipped
LDA.w #$0001
.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
LDA.w #$0002 : JMP .load_bottle_content
.bottle2_not_equipped CPX.w #$000C : BNE .bottle2_not_equipped
CPX.w #$0012 : BNE .bottle3_not_equipped LDA.w #$0002 : JMP .load_bottle_content
LDA.w #$0003 : JMP .load_bottle_content
.bottle3_not_equipped .bottle2_not_equipped
CPX.w #$0018 : BNE .bottle_not_equipped
LDA.w #$0004
.load_bottle_content CPX.w #$0012 : BNE .bottle3_not_equipped
TXY : TAX : LDA $7EF35B, X : AND.w #$00FF : TYX LDA.w #$0003 : JMP .load_bottle_content
.bottle_not_equipped .bottle3_not_equipped
CPX.w #$000D : BNE .flute_not_equipped
LDA $030F
.flute_not_equipped CPX.w #$0018 : BNE .bottle_not_equipped
CPX.w #$0003 : BNE .hookshot_not_equipped LDA.w #$0004
LDA.w GoldstarOrHookshot : BEQ .hookshot_not_equipped
SEC : SBC.b #$01
.hookshot_not_equipped .load_bottle_content
JSR HUD_DrawItem TXY : TAX : LDA $7EF35B, X : AND.w #$00FF : TYX
.no_equipped_item .bottle_not_equipped
CPX.w #$000D : BNE .flute_not_equipped
LDA $030F
.flute_not_equipped
CPX.w #$0003 : BNE .hookshot_not_equipped
LDA.w GoldstarOrHookshot : BEQ .hookshot_not_equipped
SEC : SBC.b #$01
.hookshot_not_equipped
JSR HUD_DrawItem
.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,24 +167,39 @@ 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
; one of them so we can start with that one selected.
.loop
INY : CPY.b #$25 : BCS .bad
LDX.w Menu_AddressIndex-1, Y
LDA.l $7EF300, X
BEQ .loop
.loop STY.w $0202
INY : CPY.b #$25 : BCS .bad BRA .all_good
.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 $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 LDX.w Menu_AddressIndex-1, Y
LDA.l $7EF300, X LDA.l $7EF300, X
BEQ .loop CMP.b #$01 : BCC .bad
STZ $0207
STY.w $0202 LDA.b #$04
BRA .all_good STA.w $0200
RTS
.bad
STZ.w $0202
.all_good
STZ $0207
LDA.b #$04
STA.w $0200
RTS
} }
; ========================================================= ; =========================================================

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"