Refactor inventory.asm

Refactor extended save data to use MVN
Free small keys can be place in their own dungeon
This commit is contained in:
cassidoxa
2023-07-29 00:48:34 -04:00
parent 0a073df728
commit d3ed95d639
10 changed files with 772 additions and 751 deletions

View File

@@ -5,30 +5,16 @@ HeartPieceGet:
PHX : PHY
LDY.w SpriteItemType, 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
.skipLoad
CPY.b #$26 : BNE .notHeart ; don't add a 1/4 heart if it's not a heart piece
LDA.l HeartPieceQuarter : INC A : AND.b #$03 : STA.l HeartPieceQuarter : BNE .unfinished_heart ; add up heart quarters
BRA .giveItem
.notHeart
.giveItem
CPY.b #$26 : BNE .not_heart ; don't add a 1/4 heart if it's not a heart piece
LDA.l HeartPieceQuarter : INC A : AND.b #$03 : STA.l HeartPieceQuarter
.not_heart
JSL.l $8791B3 ; Player_HaltDashAttackLong
STZ.w ItemReceiptMethod ; 0 = Receiving item from an NPC or message
JSL.l Link_ReceiveItem
CLC ; return false
JMP .done ; finished
.unfinished_heart
SEC ; return true
.done
JSL MaybeUnlockTabletAnimation
PLY : PLX
@@ -36,10 +22,8 @@ RTL
;--------------------------------------------------------------------------------
HeartContainerGet:
PHX : PHY
JSL.l AddInventory_incrementBossSwordLong
LDY.w SpriteItemType, X ; load item value into Y register
BNE +
; if for any reason the item value is 0 reload it, just in case
JSL.l IncrementBossSword
LDY.w SpriteItemType, X : BNE +
JSL.l LoadHeartContainerRoomValue : TAY
+
BRA HeartPieceGet_skipLoad