From 4c1bd60cf393bb9af5b14558923ba10427999052 Mon Sep 17 00:00:00 2001 From: Jared_Brian_ Date: Sat, 16 Mar 2024 16:58:26 -0600 Subject: [PATCH] fixed some bow related draw bugs and a selected item infinite loop bug --- .gitignore | 12 +++++ Menu/menu.asm | 9 ++-- Menu/menu_draw.asm | 38 +++++++------- Menu/menu_gfx_table.asm | 2 +- Menu/menu_hud.asm | 106 ++++++++++++++++++++------------------ Menu/menu_palette.asm | 2 +- Menu/menu_select_item.asm | 45 ++++++++++------ Oracle_main.asm | 2 +- 8 files changed, 124 insertions(+), 92 deletions(-) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..2636fd6 --- /dev/null +++ b/.gitignore @@ -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 diff --git a/Menu/menu.asm b/Menu/menu.asm index a79bd47..b2d6f66 100644 --- a/Menu/menu.asm +++ b/Menu/menu.asm @@ -14,7 +14,7 @@ pushpc ; update in game hud colors org $1BD662 : dw hexto555($814f16), hexto555($552903) 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 $1DB682 : dw hexto555($7b7b83), hexto555($bbbbbb) org $1DB68A : dw hexto555($a58100), hexto555($dfb93f) @@ -158,11 +158,10 @@ Menu_ScrollDown: INX : INX LDA.w Menu_Scroll, X STA.b $EA - CMP.w #$FF12 : BNE .loop + CMP.w #$FF12 : BNE .notDoneScrolling + JMP Menu_InitItemScreen - JMP Menu_InitItemScreen - -.loop + .notDoneScrolling STX.w MenuScrollLevelV RTS } diff --git a/Menu/menu_draw.asm b/Menu/menu_draw.asm index 7872a50..66f5e05 100644 --- a/Menu/menu_draw.asm +++ b/Menu/menu_draw.asm @@ -1,30 +1,32 @@ ; ========================================================= ; Tilemap Menu background +; This function is bled into via the previous menu.asm function. + Menu_DrawBackground: { REP #$30 LDX.w #$FE ; $1700-17FF -.loop - LDA.w menu_frame, X - STA.w $1000, X - LDA.w menu_frame+$100, X - STA.w $1100, X - LDA.w menu_frame+$200, X - STA.w $1200, X - LDA.w menu_frame+$300, X - STA.w $1300, X - LDA.w menu_frame+$400, X - STA.w $1400, X - LDA.w menu_frame+$500, X - STA.w $1500, X - LDA.w menu_frame+$600, X - STA.w $1600, X - LDA.w menu_frame+$700, X - STA.w $1700, X + .loop + LDA.w menu_frame, X + STA.w $1000, X + LDA.w menu_frame+$100, X + STA.w $1100, X + LDA.w menu_frame+$200, X + STA.w $1200, X + LDA.w menu_frame+$300, X + STA.w $1300, X + LDA.w menu_frame+$400, X + STA.w $1400, X + LDA.w menu_frame+$500, X + STA.w $1500, X + LDA.w menu_frame+$600, X + STA.w $1600, X + LDA.w menu_frame+$700, X + STA.w $1700, X - DEX : DEX + DEX : DEX BPL .loop RTS diff --git a/Menu/menu_gfx_table.asm b/Menu/menu_gfx_table.asm index cf0697f..2c329a5 100644 --- a/Menu/menu_gfx_table.asm +++ b/Menu/menu_gfx_table.asm @@ -12,7 +12,7 @@ NothingGFX: BowsGFX: 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, $28BB, $24CA, $28CB ; Silver bow and arrows diff --git a/Menu/menu_hud.asm b/Menu/menu_hud.asm index 5760c38..f895f2b 100644 --- a/Menu/menu_hud.asm +++ b/Menu/menu_hud.asm @@ -216,77 +216,81 @@ MagicTilemap: dw MostlyFull, Full, Full, Full ; ========================================================= -; *$6FAFD-$6FB90 LOCAL - +; $06FAFD-$06FB90 LOCAL HUD_UpdateItemBox: { SEP #$30 ; Dost thou haveth the the 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 - LDA $7EF377 : BNE .draw_bow_item_icon - LDX.b #$03 - BRA .draw_bow_item_icon + LDX.b #$02 + + LDA $7EF377 : BNE .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 - - LDA $7EF377 : BNE .draw_bow_item_icon - - LDX.b #$01 + .no_bow -.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 + REP #$30 + LDX $0202 : BEQ .no_equipped_item + LDA $7EF33F, X : AND.w #$00FF + CPX.w #$0004 : BNE .bombs_not_equipped + LDA.w #$0001 -.no_bow - 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 -.bombs_not_equipped - CPX.w #$0006 : BNE .bottle1_not_equipped - JMP .load_bottle_content + CPX.w #$0006 : BNE .bottle1_not_equipped + JMP .load_bottle_content -.bottle1_not_equipped - CPX.w #$000C : BNE .bottle2_not_equipped - LDA.w #$0002 : JMP .load_bottle_content + .bottle1_not_equipped -.bottle2_not_equipped - CPX.w #$0012 : BNE .bottle3_not_equipped - LDA.w #$0003 : JMP .load_bottle_content + CPX.w #$000C : BNE .bottle2_not_equipped + LDA.w #$0002 : JMP .load_bottle_content -.bottle3_not_equipped - CPX.w #$0018 : BNE .bottle_not_equipped - LDA.w #$0004 + .bottle2_not_equipped -.load_bottle_content - TXY : TAX : LDA $7EF35B, X : AND.w #$00FF : TYX + CPX.w #$0012 : BNE .bottle3_not_equipped + LDA.w #$0003 : JMP .load_bottle_content -.bottle_not_equipped - CPX.w #$000D : BNE .flute_not_equipped - LDA $030F + .bottle3_not_equipped -.flute_not_equipped - CPX.w #$0003 : BNE .hookshot_not_equipped - LDA.w GoldstarOrHookshot : BEQ .hookshot_not_equipped - SEC : SBC.b #$01 + CPX.w #$0018 : BNE .bottle_not_equipped + LDA.w #$0004 -.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 } @@ -401,7 +405,7 @@ HudItems: org $0DF629 dw $20F5, $20F5, $20F5, $20F5 ; No 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, $28BB, $24CA, $28CB ; Silver bow and arrows diff --git a/Menu/menu_palette.asm b/Menu/menu_palette.asm index f0ad386..f9d346b 100644 --- a/Menu/menu_palette.asm +++ b/Menu/menu_palette.asm @@ -7,7 +7,7 @@ Menu_Palette: dw hexto555($f9f9f9) dw hexto555($000000) dw hexto555($000000) ; transparent - dw hexto555($d1a452) + dw hexto555($d0a050) dw hexto555($f9f9f9) dw hexto555($000000) dw hexto555($000000) ; transparent diff --git a/Menu/menu_select_item.asm b/Menu/menu_select_item.asm index 0cdce49..20764df 100644 --- a/Menu/menu_select_item.asm +++ b/Menu/menu_select_item.asm @@ -167,24 +167,39 @@ Menu_InitItemScreen: { SEP #$30 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 - INY : CPY.b #$25 : BCS .bad + STY.w $0202 + 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 LDA.l $7EF300, X - BEQ .loop - - STY.w $0202 - BRA .all_good - -.bad - STZ.w $0202 - -.all_good - STZ $0207 - LDA.b #$04 - STA.w $0200 - RTS + CMP.b #$01 : BCC .bad + STZ $0207 + LDA.b #$04 + STA.w $0200 + RTS } ; ========================================================= diff --git a/Oracle_main.asm b/Oracle_main.asm index 3e88695..ddac8c9 100644 --- a/Oracle_main.asm +++ b/Oracle_main.asm @@ -128,7 +128,7 @@ namespace Oracle ; ------------------------------------------------------- incsrc "Util/all_items.asm" - incsrc "Dungeons/house_walls.asm" + ;incsrc "Dungeons/house_walls.asm" print "" print "Finished applying patches"