Add shop shield handling, credits counter, softlock protection

This commit is contained in:
2026-06-05 01:07:17 -05:00
parent 0f36eca4ab
commit 0264a85511
8 changed files with 73 additions and 15 deletions
+14 -4
View File
@@ -436,7 +436,7 @@ Shopkeeper_BuyItem:
BRA +
.refill
JSL Sprite_GetEmptyBottleIndex : BMI .full_bottles
LDA.b #$1 : STA.l ShopkeeperRefill ; If this is on, don't toggle bit to remove from shop
LDA.b #$01 : STA.l ShopkeeperRefill ; If this is on, don't toggle bit to remove from shop
+
LDA.l ShopType : AND.b #$80 : BNE .buy ; don't charge if this is a take-any
@@ -453,6 +453,16 @@ Shopkeeper_BuyItem:
LDA.b #$3C : STA.w SFX2 ; error sound
JMP .done
.buy
LDA.l ShopInventory, X
TAY
JSL ShieldCheck
BCS +
JMP .done
+
; Y now has the (possibly-substituted) item ID
LDA.l ShopType : AND.b #$80 : BNE ++ ; don't charge if this is a take-any
REP #$20 : LDA.l CurrentRupees : !SUB.l ShopInventory+1, X : STA.l CurrentRupees : SEP #$20 ; Take price away
++
@@ -464,9 +474,9 @@ Shopkeeper_BuyItem:
LDA.l EnableShopItemCount, X : STA.l ShopEnableCount ; If so, store the permission to count the item here.
+++
PLX
LDA.l ShopInventory, X
JSL AttemptItemSubstitution
TAY : JSL Link_ReceiveItem
; Y still has item ID
JSL Link_ReceiveItem
LDA.l ShopInventory+3, X : INC : STA.l ShopInventory+3, X
LDA.b #$00 : STA.l ShopEnableCount
TXA : LSR #2 : TAX