From 6f1eda92967396b7ab15d2bdfcbe4fa846c889a8 Mon Sep 17 00:00:00 2001 From: aerinon Date: Wed, 15 Jun 2022 16:53:49 -0600 Subject: [PATCH 1/3] Fix for pottery/shopsanity conflict --- inventory.asm | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/inventory.asm b/inventory.asm index 0efa872..1b6b953 100644 --- a/inventory.asm +++ b/inventory.asm @@ -275,7 +275,7 @@ AddInventory: + CPY.b #$3B : BNE + : JMP .dungeonCounts : + ; Silver Arrow Bow - Skip Shop/Fairy Check for Silver Arrow Bow - LDA $1B : BEQ ++ ; skip shop check if outdoors + LDA $1B : BNE + : JMP .dungeonCounts : + ; skip shop check if outdoors LDA $02E9 : CMP.b #$01 : BEQ ++ ; skip shop check for chests PHP : REP #$20 ; set 16-bit accumulator LDA $048E @@ -284,9 +284,12 @@ AddInventory: CMP.w #272 : BNE + : JMP .shop : + ; red shield shop CMP.w #284 : BNE + : JMP .shop : + ; bomb shop CMP.w #265 : BNE + : JMP .shop : + ; potion shop - commented this out because it's easier to just block potion refills because this one interferes with the powder item being counted - CMP.w #287 : BNE + : JMP .shop : + ; kakariko shop - CMP.w #255 : BNE + : JMP .shop : + ; light world death mountain shop - CMP.w #276 : BNE + : JMP .shop : + ; waterfall fairy + CMP.w #287 : BNE + : LDA.b $A9 : CMP.w #$0201 : BNE + ; kakariko shop + JMP .shop : + LDA.b $A0 + CMP.w #255 : BNE + : LDA.b $A9 : BNE + ; light world death mountain shop + JMP .shop : + LDA.b $A0 + CMP.w #276 : BNE + : LDA.b $A9 : CMP.w #$0200 : BNE + ; waterfall fairy + JMP .shop : + LDA.b $A0 CMP.w #277 : BNE + : JMP .shop : + ; upgrade fairy (shop) CMP.w #278 : BNE + : JMP .shop : + ; pyramid fairy PLP : BRA ++ From 3e6da34c7107078164684aa02debfca0efaecbd2 Mon Sep 17 00:00:00 2001 From: aerinon Date: Wed, 29 Jun 2022 11:32:51 -0600 Subject: [PATCH 2/3] Pot substitution for certain ammo and rupee items. --- doorrando/drhooks.asm | 2 +- keydrop/standing_items.asm | 57 +++++++++++++++++++++++++++++++++++++- 2 files changed, 57 insertions(+), 2 deletions(-) diff --git a/doorrando/drhooks.asm b/doorrando/drhooks.asm index e8c48b9..708bd11 100644 --- a/doorrando/drhooks.asm +++ b/doorrando/drhooks.asm @@ -210,7 +210,7 @@ dw $8AD9 ; address of Bank02.asm:2085 ;.done ;Enable south facing bk graphic -;org $4e24 +;org $00CE24 ;dw $2ac8 org $01b714 ; PC: b714 diff --git a/keydrop/standing_items.asm b/keydrop/standing_items.asm index d8a2e8e..93b2036 100644 --- a/keydrop/standing_items.asm +++ b/keydrop/standing_items.asm @@ -48,6 +48,12 @@ org $07B169 org $07B17D JSL PreventPotSpawn2 +org $068283 + JSL SubstituteSpriteId : NOP + +org $0681F4 + Sprite_SpawnSecret_pool_ID: + org $00A9DC dw $1928, $1938, $5928, $5938 ; change weird ugly black diagonal pot to blue-ish pot @@ -224,7 +230,16 @@ SaveMajorItemDrop: STA.w SpawnedItemID STX.w SpawnedItemIndex INC.w SpawnedItemFlag - LDA.w #$0008 : STA $0B9C ; indicates we should use the key routines + TAY : LDA.w #$0008 + CPY.w #$0036 : BNE + ; Red Rupee + LDA.w #$0016 : BRA .done + + CPY.w #$0044 : BNE + ; 10 pack arrows + LDA.w #$0017 : BRA .done + + CPY.w #$0028 : BNE + ; 3 pack bombs + LDA.w #$0018 : BRA .done + + CPY.w #$0031 : BNE .done ; 10 pack bombs + LDA.w #$0019 + .done STA $0B9C ; indicates we should use the key routines or a substitute RTL ShouldCountNormalPot: @@ -238,6 +253,46 @@ RTS CLC RTS +IncrementCountsForSubstitute: + PHX : REP #$30 + LDA.w SpawnedItemIndex : ASL : TAX : LDA.l BitFieldMasks, X : STA $0A + LDA.b $A0 : ASL : TAX + LDA.l RoomPotData, X : BIT $0A : BNE .obtained + ORA $0A : STA RoomPotData, X + SEP #$30 + LDA $040C : CMP #$FF : BEQ + + BNE ++ + INC #2 ; treat sewers as HC + ++ LSR : TAX : LDA DungeonLocationsChecked, X : INC : STA DungeonLocationsChecked, X + ; Could increment GT Tower Pre Big Key but we aren't showing that stat right now + + REP #$30 + LDA TotalItemCounter : INC : STA TotalItemCounter ; Increment Item Total + .obtained + SEP #$30 : PLX +RTS + +SubstitionTable: + db $DB ; RED RUPEE - 0x16 + db $E2 ; ARROW REFILL 10 - 0x17 + db $DD ; BOMB REFILL 4 - 0x18 + db $DE ; BOMB REFILL 8 - 0x19 + + +SubstituteSpriteId: + CPY.b #$16 : BCS + + STY.b $0D + LDA.w Sprite_SpawnSecret_pool_ID-1,Y + RTL + LDA.b #$01 + + CPY.b #$18 : BCC + + LDA.b #$05 + + STA.b $0D + JSR IncrementCountsForSubstitute + PHB : PHK : PLB + LDA.w SubstitionTable-$16, Y ; Do substitute + PLB +RTL + ClearSpriteData: STZ.b $02 : STZ.b $03 ; what we overrode PHX From 3b5ccc7dfae12508d7166e42dc774a2caec49709 Mon Sep 17 00:00:00 2001 From: aerinon Date: Thu, 30 Jun 2022 11:52:02 -0600 Subject: [PATCH 3/3] Enemizer fix for pot substitution. --- keydrop/standing_items.asm | 66 ++++++++++++++++++++++---------------- 1 file changed, 39 insertions(+), 27 deletions(-) diff --git a/keydrop/standing_items.asm b/keydrop/standing_items.asm index 93b2036..59c2adf 100644 --- a/keydrop/standing_items.asm +++ b/keydrop/standing_items.asm @@ -48,11 +48,8 @@ org $07B169 org $07B17D JSL PreventPotSpawn2 -org $068283 - JSL SubstituteSpriteId : NOP - -org $0681F4 - Sprite_SpawnSecret_pool_ID: +org $068275 + JSL SubstitionFlow org $00A9DC dw $1928, $1938, $5928, $5938 ; change weird ugly black diagonal pot to blue-ish pot @@ -65,6 +62,12 @@ JSL CheckIfPotIsSpecial ; refs to other functions +org $0681F4 +Sprite_SpawnSecret_pool_ID: +org $068283 +Sprite_SpawnSecret_NotRandomBush: +org $06828A +Sprite_SpawnSecret_SpriteSpawnDynamically: org $06d23a Sprite_DrawAbsorbable: org $1eff81 @@ -271,28 +274,6 @@ IncrementCountsForSubstitute: SEP #$30 : PLX RTS -SubstitionTable: - db $DB ; RED RUPEE - 0x16 - db $E2 ; ARROW REFILL 10 - 0x17 - db $DD ; BOMB REFILL 4 - 0x18 - db $DE ; BOMB REFILL 8 - 0x19 - - -SubstituteSpriteId: - CPY.b #$16 : BCS + - STY.b $0D - LDA.w Sprite_SpawnSecret_pool_ID-1,Y - RTL - LDA.b #$01 - + CPY.b #$18 : BCC + - LDA.b #$05 - + STA.b $0D - JSR IncrementCountsForSubstitute - PHB : PHK : PLB - LDA.w SubstitionTable-$16, Y ; Do substitute - PLB -RTL - ClearSpriteData: STZ.b $02 : STZ.b $03 ; what we overrode PHX @@ -518,7 +499,38 @@ LoadProperties_PreserveCertainProps: PLA : STA $0F50, X RTL +SubstitionFlow: + CPY.b #$04 : BNE + + RTL ; let enemizer/vanilla take care of it + + PLA : PLA ; remove JSL stuff + CPY.b #$16 : BCS + + PEA.w Sprite_SpawnSecret_NotRandomBush-1 : RTL ; jump to not_random_bush spot + ; jump directly to new code + + PEA.w Sprite_SpawnSecret_SpriteSpawnDynamically-1 +RTL + +SubstitionTable: + db $DB ; RED RUPEE - 0x16 + db $E2 ; ARROW REFILL 10 - 0x17 + db $DD ; BOMB REFILL 4 - 0x18 + db $DE ; BOMB REFILL 8 - 0x19 + + +SubstituteSpriteId: + CPY.b #$16 : BCS + + RTS + + LDA.b #$01 + CPY.b #$18 : BCC + + LDA.b #$05 + + STA.b $0D + JSR IncrementCountsForSubstitute + PHB : PHK : PLB + LDA.w SubstitionTable-$16, Y ; Do substitute + PLB +RTS + CheckSprite_Spawn: + JSR SubstituteSpriteId JSL Sprite_SpawnDynamically BMI .check RTL