Fix Tablet items

Ensure that standing overworld items will never load the null item.
This commit is contained in:
Kevin Cathcart
2018-07-26 19:00:25 -04:00
parent a3418a2ca6
commit a4a0ef8d04
4 changed files with 19 additions and 1 deletions

View File

@@ -4,12 +4,16 @@
HeartPieceGet: HeartPieceGet:
PHX : PHY PHX : PHY
LDY $0DA0, X ; load item value into Y register LDY $0DA0, X ; load item value into Y register
BNE +
; if for any reason the item value is 0 reload it, just in case
JSL.l LoadHeartPieceRoomValue : TAY
+
JSL.l MaybeMarkDigSpotCollected JSL.l MaybeMarkDigSpotCollected
.skipLoad .skipLoad
STZ $02E9 ; 0 = Receiving item from an NPC or message STZ $02E9 ; 0 = Receiving item from an NPC or message
CPY.b #$26 : BNE .notHeart ; don't add a 1/4 heart if it's not a heart piece CPY.b #$26 : BNE .notHeart ; don't add a 1/4 heart if it's not a heart piece
LDA $7EF36B : INC A : AND.b #$03 : STA $7EF36B : BNE .unfinished_heart ; add up heart quarters LDA $7EF36B : INC A : AND.b #$03 : STA $7EF36B : BNE .unfinished_heart ; add up heart quarters
BRA .giveItem BRA .giveItem
@@ -35,6 +39,10 @@ HeartContainerGet:
PHX : PHY PHX : PHY
JSL.l AddInventory_incrementBossSwordLong JSL.l AddInventory_incrementBossSwordLong
LDY $0DA0, X ; load item value into Y register LDY $0DA0, X ; load item value into Y register
BNE +
; if for any reason the item value is 0 reload it, just in case
JSL.l LoadHeartContainerRoomValue : TAY
+
BRA HeartPieceGet_skipLoad BRA HeartPieceGet_skipLoad
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------

View File

@@ -1018,6 +1018,10 @@ RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
CollectPowder: CollectPowder:
LDY $0DA0, X ; Retrieve stored item type LDY $0DA0, X ; Retrieve stored item type
BNE +
; if for any reason the item value is 0 reload it, just in case
%GetPossiblyEncryptedItem(WitchItem, SpriteItemValues) : TAY
+
STZ $02E9 ; item from NPC STZ $02E9 ; item from NPC
JSL.l Link_ReceiveItem JSL.l Link_ReceiveItem
;JSL.l FullInventoryExternal ;JSL.l FullInventoryExternal

View File

@@ -156,6 +156,10 @@ ItemSet_Mushroom:
PHA PHA
LDA !NPC_FLAGS_2 : ORA.b #$10 : STA !NPC_FLAGS_2 LDA !NPC_FLAGS_2 : ORA.b #$10 : STA !NPC_FLAGS_2
LDY $0DA0, X ; Retrieve stored item type LDY $0DA0, X ; Retrieve stored item type
BNE +
; if for any reason the item value is 0 reload it, just in case
%GetPossiblyEncryptedItem(MushroomItem, SpriteItemValues) : TAY
+
PLA PLA
;LDY.b #$29 ;LDY.b #$29
STZ $02E9 ; thing we wrote over - the mushroom is an npc for item purposes apparently STZ $02E9 ; thing we wrote over - the mushroom is an npc for item purposes apparently

View File

@@ -33,6 +33,7 @@ SpawnTabletItem:
; JSL.l HeartPieceGet ; JSL.l HeartPieceGet
;RTL ;RTL
JSL.l LoadOutdoorValue JSL.l LoadOutdoorValue
PHA
JSL.l PrepDynamicTile JSL.l PrepDynamicTile
LDA.b #$01 : STA !FORCE_HEART_SPAWN : STA !SKIP_HEART_SAVE LDA.b #$01 : STA !FORCE_HEART_SPAWN : STA !SKIP_HEART_SAVE
@@ -42,6 +43,7 @@ SpawnTabletItem:
STA $7FFE00 STA $7FFE00
JSL Sprite_SpawnDynamically JSL Sprite_SpawnDynamically
PLA : STA $0DA0, Y ; Store item type
LDA $22 : STA $0D10, Y LDA $22 : STA $0D10, Y
LDA $23 : STA $0D30, Y LDA $23 : STA $0D30, Y