Pot substitution for certain ammo and rupee items.

This commit is contained in:
aerinon
2022-06-29 11:32:51 -06:00
parent 6f1eda9296
commit 3e6da34c71
2 changed files with 57 additions and 2 deletions

View File

@@ -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

View File

@@ -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