fix arrow upgrades being overwritten incorrectly

This commit is contained in:
sporchia
2017-12-20 22:56:26 -05:00
parent 767df00a3d
commit d6195f4e4a

View File

@@ -79,7 +79,7 @@ RTL
LDA !INVENTORY_SWAP : BIT #$04 : BEQ .error ; make sure we have shovel LDA !INVENTORY_SWAP : BIT #$04 : BEQ .error ; make sure we have shovel
AND #$03 : BEQ .error ; make sure we have one of the flutes AND #$03 : BEQ .error ; make sure we have one of the flutes
LDA $7EF34C : CMP #01 : BNE .toShovel ; not shovel LDA $7EF34C : CMP #01 : BNE .toShovel ; not shovel
LDA !INVENTORY_SWAP : AND #$01 : BEQ .toFakeFlute ; check for real flute LDA !INVENTORY_SWAP : AND #$01 : BEQ .toFakeFlute ; check for real flute
LDA #$03 ; set real flute LDA #$03 ; set real flute
BRA .fluteSuccess BRA .fluteSuccess
@@ -144,13 +144,13 @@ RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
CloseBottleMenu: CloseBottleMenu:
LDA $F6 : AND #$40 : BEQ .x_not_pressed ; skip if X is not down LDA $F6 : AND #$40 : BEQ .x_not_pressed ; skip if X is not down
LDA.b #$10 : STA $0207 ; set 16 frame cool off LDA.b #$10 : STA $0207 ; set 16 frame cool off
LDA.b #$20 : STA $012F ; make menu sound LDA.b #$20 : STA $012F ; make menu sound
INC $0200 ; return to normal menu INC $0200 ; return to normal menu
STZ $0205 STZ $0205
LDA #$00 LDA #$00
RTL RTL
.x_not_pressed .x_not_pressed
@@ -219,10 +219,10 @@ AddInventory:
+ CPY.b #$58 : BNE + ; Upgrade-Only Silver Arrows + CPY.b #$58 : BNE + ; Upgrade-Only Silver Arrows
LDA !INVENTORY_SWAP_2 : ORA #$40 : STA !INVENTORY_SWAP_2 LDA !INVENTORY_SWAP_2 : ORA #$40 : STA !INVENTORY_SWAP_2
+ +
.incrementCounts .incrementCounts
LDA !LOCK_STATS : BEQ + : BRL .done : + LDA !LOCK_STATS : BEQ + : BRL .done : +
; don't count any of this stuff ; don't count any of this stuff
CPY.b #$20 : BNE + : BRL .itemCounts : + ; Crystal CPY.b #$20 : BNE + : BRL .itemCounts : + ; Crystal
CPY.b #$26 : BNE + : BRL .itemCounts : + ; Heart Piece Completion Heart CPY.b #$26 : BNE + : BRL .itemCounts : + ; Heart Piece Completion Heart
@@ -233,7 +233,7 @@ AddInventory:
CPY.b #$38 : BNE + : BRL .itemCounts : + ; Pendant CPY.b #$38 : BNE + : BRL .itemCounts : + ; Pendant
CPY.b #$39 : BNE + : BRL .itemCounts : + ; Pendant CPY.b #$39 : BNE + : BRL .itemCounts : + ; Pendant
CPY.b #$00 : BNE + : BRL .itemCounts : + ; Uncle Sword & Shield CPY.b #$00 : BNE + : BRL .itemCounts : + ; Uncle Sword & Shield
CPY.b #$04 : !BLT .isSword ; Swords - Skip Shop/Fairy Check for Swords CPY.b #$04 : !BLT .isSword ; Swords - Skip Shop/Fairy Check for Swords
CPY.b #$50 : BEQ .isSword CPY.b #$50 : BEQ .isSword
BRA + BRA +
@@ -241,7 +241,7 @@ AddInventory:
BRL .dungeonCounts BRL .dungeonCounts
+ +
CPY.b #$3B : BNE + : BRL .dungeonCounts : + ; Silver Arrow Bow - Skip Shop/Fairy Check for Silver Arrow Bow CPY.b #$3B : BNE + : BRL .dungeonCounts : + ; Silver Arrow Bow - Skip Shop/Fairy Check for Silver Arrow Bow
LDA $1B : BEQ ++ ; skip shop check if outdoors LDA $1B : BEQ ++ ; skip shop check if outdoors
LDA $02E9 : CMP.b #$01 : BEQ ++ ; skip shop check for chests LDA $02E9 : CMP.b #$01 : BEQ ++ ; skip shop check for chests
PHP : REP #$20 ; set 16-bit accumulator PHP : REP #$20 ; set 16-bit accumulator
@@ -260,11 +260,11 @@ AddInventory:
.shop .shop
PLP : BRL .done PLP : BRL .done
++ ++
.dungeonCounts .dungeonCounts
LDA $1B : BNE + : BRL .fullItemCounts : + LDA $1B : BNE + : BRL .fullItemCounts : +
; ==BEGIN INDOOR-ONLY SECTION ; ==BEGIN INDOOR-ONLY SECTION
;REP #$20 ; Set 16-bit Accumulator ;REP #$20 ; Set 16-bit Accumulator
;LDA $A0 ; load room ID ;LDA $A0 ; load room ID
;CMP.w #$0010 : BNE + ; Ganon Fall Room - I think this got taken out ;CMP.w #$0010 : BNE + ; Ganon Fall Room - I think this got taken out
@@ -272,9 +272,9 @@ AddInventory:
;LDA !SHAME_CHEST : ORA.w #$0010 : STA !SHAME_CHEST ;LDA !SHAME_CHEST : ORA.w #$0010 : STA !SHAME_CHEST
;+ ;+
SEP #$20 ; Set 8-bit Accumulator SEP #$20 ; Set 8-bit Accumulator
LDA $040C ; get dungeon id LDA $040C ; get dungeon id
CMP.b #$00 : BNE + ; Sewers (Escape) CMP.b #$00 : BNE + ; Sewers (Escape)
BRA ++ BRA ++
+ CMP.b #$02 : BNE + ; Hyrule Castle (Escape) + CMP.b #$02 : BNE + ; Hyrule Castle (Escape)
@@ -328,26 +328,26 @@ AddInventory:
++ ++
;BRL .fullItemCounts ;BRL .fullItemCounts
+ +
; == END INDOOR-ONLY SECTION ; == END INDOOR-ONLY SECTION
.fullItemCounts .fullItemCounts
CPY.b #$3B : BNE + ; Skip Total Counts for Repeat Silver Arrows CPY.b #$3B : BNE + ; Skip Total Counts for Repeat Silver Arrows
LDA $7EF42A : BIT #$20 : BEQ + : BRA .itemCounts LDA $7EF42A : BIT #$20 : BEQ + : BRA .itemCounts
+ +
LDA $7EF355 : BNE + ; Check for Boots LDA $7EF355 : BNE + ; Check for Boots
LDA $7EF432 : INC : STA $7EF432 ; Increment Pre Boots Counter LDA $7EF432 : INC : STA $7EF432 ; Increment Pre Boots Counter
+ +
LDA $7EF353 : BNE + ; Check for Mirror LDA $7EF353 : BNE + ; Check for Mirror
LDA $7EF433 : INC : STA $7EF433 ; Increment Pre Mirror Counter LDA $7EF433 : INC : STA $7EF433 ; Increment Pre Mirror Counter
+ +
LDA $7EF423 : INC : STA $7EF423 ; Increment Item Total LDA $7EF423 : INC : STA $7EF423 ; Increment Item Total
.itemCounts .itemCounts
CPY.b #$00 : BNE + ; Fighter's Sword & Fighter's Shield CPY.b #$00 : BNE + ; Fighter's Sword & Fighter's Shield
JSR .incrementSword JSR .incrementSword
JSR .incrementShield JSR .incrementShield
@@ -526,7 +526,7 @@ RTL
LDA !HIGHEST_SWORD_LEVEL : AND #$F8 : ORA 1,s : STA !HIGHEST_SWORD_LEVEL LDA !HIGHEST_SWORD_LEVEL : AND #$F8 : ORA 1,s : STA !HIGHEST_SWORD_LEVEL
PLA PLA
+ +
LDA $7EF422 : !ADD #$20 : STA $7EF422 ; increment sword counter LDA $7EF422 : !ADD #$20 : STA $7EF422 ; increment sword counter
RTS RTS
@@ -651,7 +651,7 @@ Link_ReceiveItem_HUDRefresh:
DEC : STA $7EF375 ; decrease bomb fill count DEC : STA $7EF375 ; decrease bomb fill count
LDA.b #$01 : STA $7EF343 ; increase actual bomb count LDA.b #$01 : STA $7EF343 ; increase actual bomb count
+ +
JSL.l HUD_RefreshIconLong ; thing we wrote over JSL.l HUD_RefreshIconLong ; thing we wrote over
JSL.l PostItemGet JSL.l PostItemGet
RTL RTL
@@ -687,23 +687,23 @@ AddYMarker:
AND.w #$03 : BNE .drawYBubble ; make sure we have one of the flutes AND.w #$03 : BNE .drawYBubble ; make sure we have one of the flutes
BRA .drawNormal BRA .drawNormal
+ CMP.w #$10 : BEQ .drawJarMarker + CMP.w #$10 : BEQ .drawJarMarker
.drawNormal .drawNormal
LDA.w #$7C60 LDA.w #$7C60
BRA .drawTile BRA .drawTile
.drawJarMarker .drawJarMarker
;SEP #$20 : LDA !JAR_STATUS : INC : AND.b #$01 : STA !JAR_STATUS : REP #$20 : BEQ .drawXBubble ;SEP #$20 : LDA !JAR_STATUS : INC : AND.b #$01 : STA !JAR_STATUS : REP #$20 : BEQ .drawXBubble
LDA $0207 : AND.w #$0020 : BNE .drawXBubble LDA $0207 : AND.w #$0020 : BNE .drawXBubble
.drawYBubble .drawYBubble
LDA.w #$3D4F LDA.w #$3D4F
BRA .drawTile BRA .drawTile
.drawXBubble .drawXBubble
JSR MakeCircleBlue JSR MakeCircleBlue
LDA.w #$2D3E LDA.w #$2D3E
.drawTile .drawTile
STA $FFC4, Y STA $FFC4, Y
RTL RTL
@@ -716,16 +716,16 @@ RTL
MakeCircleBlue: MakeCircleBlue:
LDA $FFC0, Y : AND.w #$EFFF : STA $FFC0, Y LDA $FFC0, Y : AND.w #$EFFF : STA $FFC0, Y
LDA $FFC2, Y : AND.w #$EFFF : STA $FFC2, Y LDA $FFC2, Y : AND.w #$EFFF : STA $FFC2, Y
LDA $FFFE, Y : AND.w #$EFFF : STA $FFFE, Y LDA $FFFE, Y : AND.w #$EFFF : STA $FFFE, Y
LDA $0004, Y : AND.w #$EFFF : STA $0004, Y LDA $0004, Y : AND.w #$EFFF : STA $0004, Y
LDA $003E, Y : AND.w #$EFFF : STA $003E, Y LDA $003E, Y : AND.w #$EFFF : STA $003E, Y
LDA $0044, Y : AND.w #$EFFF : STA $0044, Y LDA $0044, Y : AND.w #$EFFF : STA $0044, Y
LDA $0080, Y : AND.w #$EFFF : STA $0080, Y LDA $0080, Y : AND.w #$EFFF : STA $0080, Y
LDA $0082, Y : AND.w #$EFFF : STA $0082, Y LDA $0082, Y : AND.w #$EFFF : STA $0082, Y
LDA $FFBE, Y : AND.w #$EFFF : STA $FFBE, Y LDA $FFBE, Y : AND.w #$EFFF : STA $FFBE, Y
LDA $FFC4, Y : AND.w #$EFFF : STA $FFC4, Y LDA $FFC4, Y : AND.w #$EFFF : STA $FFC4, Y
LDA $0084, Y : AND.w #$EFFF : STA $0084, Y LDA $0084, Y : AND.w #$EFFF : STA $0084, Y
@@ -776,7 +776,7 @@ ClearOWKeys:
PLA : LDA $7EF38B : STA $7EF36F PLA : LDA $7EF38B : STA $7EF36F
RTL RTL
+ +
PLA : STA $7EF36F, X PLA : STA $7EF36F
RTL RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
@@ -874,16 +874,16 @@ LoadMushroom:
.justGFX .justGFX
;LDA MushroomItem ;LDA MushroomItem
;JSL.l PrepDynamicTile ;JSL.l PrepDynamicTile
PHA PHA
LDA #$01 : STA !REDRAW LDA #$01 : STA !REDRAW
LDA $5D : CMP #$14 : BEQ .skip ; skip if we're mid-mirror LDA $5D : CMP #$14 : BEQ .skip ; skip if we're mid-mirror
LDA #$00 : STA !REDRAW LDA #$00 : STA !REDRAW
LDA MushroomItem LDA MushroomItem
JSL.l PrepDynamicTile JSL.l PrepDynamicTile
.skip .skip
PLA PLA
RTL RTL
@@ -899,11 +899,11 @@ DrawMushroom:
LDA !REDRAW : BEQ .skipInit ; skip init if already ready LDA !REDRAW : BEQ .skipInit ; skip init if already ready
JSL.l LoadMushroom_justGFX JSL.l LoadMushroom_justGFX
BRA .done ; don't draw on the init frame BRA .done ; don't draw on the init frame
.skipInit .skipInit
LDA MushroomItem LDA MushroomItem
JSL.l DrawDynamicTile JSL.l DrawDynamicTile
.done .done
PLY : PLA PLY : PLA
RTL RTL
@@ -990,31 +990,31 @@ RTL
!REDRAW = "$7F5000" !REDRAW = "$7F5000"
SpawnShovelItem: SpawnShovelItem:
LDA.b #$01 : STA !REDRAW LDA.b #$01 : STA !REDRAW
LDA $03FC : BEQ + LDA $03FC : BEQ +
JSL DiggingGameGuy_AttemptPrizeSpawn JSL DiggingGameGuy_AttemptPrizeSpawn
BRL .skip BRL .skip
+ +
LDA $035B : AND.b #$01 : BNE + : BRL .skip : + ; corner dig fix LDA $035B : AND.b #$01 : BNE + : BRL .skip : + ; corner dig fix
PHY : PHP PHY : PHP
PHB : PHK : PLB PHB : PHK : PLB
SEP #$30 ; set 8-bit accumulator and index registers SEP #$30 ; set 8-bit accumulator and index registers
LDA $1B : BEQ + : JMP .no_drop : + ; skip if indoors LDA $1B : BEQ + : JMP .no_drop : + ; skip if indoors
LDA $8A : CMP #$2A : BEQ .no_drop ; don't drop in the haunted grove LDA $8A : CMP #$2A : BEQ .no_drop ; don't drop in the haunted grove
CMP #$68 : BEQ .no_drop ; don't drop in the digging game area CMP #$68 : BEQ .no_drop ; don't drop in the digging game area
JSL GetRandomInt : BIT #$03 : BNE .no_drop ; drop with 1/4 chance JSL GetRandomInt : BIT #$03 : BNE .no_drop ; drop with 1/4 chance
LSR #2 : TAX ; clobber lower 2 bis - we have 64 slots now LSR #2 : TAX ; clobber lower 2 bis - we have 64 slots now
LDA.l ShovelSpawnTable, X ; look up the drop on the table LDA.l ShovelSpawnTable, X ; look up the drop on the table
;most of this part below is copied from the digging game ;most of this part below is copied from the digging game
STA $7FFE00 STA $7FFE00
JSL Sprite_SpawnDynamically JSL Sprite_SpawnDynamically
@@ -1031,15 +1031,15 @@ SpawnShovelItem:
LDA $22 : !ADD .x_offsets, X LDA $22 : !ADD .x_offsets, X
AND.b #$F0 : STA $0D10, Y AND.b #$F0 : STA $0D10, Y
LDA $23 : ADC.b #$00 : STA $0D30, Y LDA $23 : ADC.b #$00 : STA $0D30, Y
LDA $20 : !ADD.b #$16 : AND.b #$F0 : STA $0D00, Y LDA $20 : !ADD.b #$16 : AND.b #$F0 : STA $0D00, Y
LDA $21 : ADC.b #$00 : STA $0D20, Y LDA $21 : ADC.b #$00 : STA $0D20, Y
LDA.b #$00 : STA $0F20, Y LDA.b #$00 : STA $0F20, Y
TYX TYX
LDA.b #$30 : JSL Sound_SetSfx3PanLong LDA.b #$30 : JSL Sound_SetSfx3PanLong
.no_drop .no_drop
PLB PLB
PLP : PLY PLP : PLY
@@ -1056,6 +1056,6 @@ RTL
.x_offsets .x_offsets
db $00 db $00
db $13 db $13
} }
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------