Add shop shield handling, credits counter, softlock protection
This commit is contained in:
+1
-1
@@ -696,7 +696,7 @@ endmacro
|
||||
%InventoryItem($01, $0081, SwordTime, $0000) ; 01 - Master sword
|
||||
%InventoryItem($02, $0001, SwordTime, $0000) ; 02 - Tempered sword
|
||||
%InventoryItem($03, $0081, SwordTime, $0000) ; 03 - Butter sword
|
||||
%InventoryItem($04, $0081, $0000, $0000) ; 04 - Fighter shield
|
||||
%InventoryItem($04, $0080, $0000, $0000) ; 04 - Fighter shield
|
||||
%InventoryItem($05, $0081, $0000, $0000) ; 05 - Fire shield
|
||||
%InventoryItem($06, $0081, $0000, $0000) ; 06 - Mirror shield
|
||||
%InventoryItem($07, $0085, $0000, $0000) ; 07 - Fire rod
|
||||
|
||||
@@ -89,6 +89,9 @@ GetMultiworldItem:
|
||||
PHP
|
||||
LDA.l !MULTIWORLD_ITEM : BNE +
|
||||
LDA.l !MULTIWORLD_HUD_TIMER : BNE +
|
||||
LDA.l ShieldEquipment : BNE ++
|
||||
LDA.l PikitItem : CMP.b #$04 : BNE +
|
||||
++
|
||||
BRL .return
|
||||
+
|
||||
|
||||
@@ -123,6 +126,34 @@ GetMultiworldItem:
|
||||
BRL .return
|
||||
+
|
||||
|
||||
LDA.l ShieldEquipment : BNE +
|
||||
LDA.l PikitItem : CMP.b #$04 : BEQ +
|
||||
|
||||
LDY.b #$10
|
||||
-
|
||||
DEY
|
||||
BMI .restore_shield
|
||||
LDA.w $0E20, Y
|
||||
CMP.b #$AA
|
||||
BNE - ; go to next sprite if this sprite isn't a pikit
|
||||
LDA.w $0DD0, Y
|
||||
BEQ - ; go to next sprite if this sprite is dead/inactive
|
||||
LDA.w $0ED0, Y
|
||||
CMP.b #$04
|
||||
BNE - ; go to next sprite if this pikit isn't grabbing a shield
|
||||
LDA.w $0E90, Y
|
||||
CMP.b #$04
|
||||
BNE - ; go to next sprite if this pikit isn't grabbing a shield
|
||||
|
||||
BRA + ; active pikit has a shield
|
||||
|
||||
.restore_shield
|
||||
; we have a pikit item, but no shield, and there's no pikit actively
|
||||
; eating a shield, so return the shield to prevent a softlock
|
||||
LDA.b #$01
|
||||
STA.l ShieldEquipment
|
||||
+
|
||||
|
||||
LDA.l !MULTIWORLD_ITEM : BNE +
|
||||
BRL .return
|
||||
+
|
||||
|
||||
@@ -166,6 +166,11 @@ PikitDigest:
|
||||
|
||||
STZ.w $0E90, X
|
||||
|
||||
LDA.b $6C
|
||||
BNE + ; link is in a doorway; giving him an item could be scary :<
|
||||
|
||||
JSL IncrementPikitCounter
|
||||
|
||||
LDA.l PikitItem
|
||||
CMP.b #$04
|
||||
BEQ +
|
||||
|
||||
+14
-4
@@ -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
|
||||
|
||||
@@ -323,7 +323,7 @@ MagicCounter: skip 2 ; Magic used by player (16-bit integer)
|
||||
HighestMail: skip 1 ; Highest mail level
|
||||
SmallKeyCounter: skip 1 ; Total Number of small keys collected (integer)
|
||||
HeartPieceCounter: skip 1 ; Total Number of heartpieces collected (integer)
|
||||
skip 1 ; Unused
|
||||
PikitFed: skip 1 ; Total Number of shields fed to pikit
|
||||
DungeonsCompleted: skip 2 ; Bitfield indicating whether a dungeon's prize has been collected.
|
||||
; This has the same shape as the dungeon item bitfields.
|
||||
MapCountDisplay: skip 2 ;
|
||||
|
||||
@@ -5,6 +5,13 @@
|
||||
;
|
||||
; See sram.asm for adresses and documentation of stat values
|
||||
;--------------------------------------------------------------------------------
|
||||
IncrementPikitCounter:
|
||||
LDA.l StatsLocked : BNE +
|
||||
LDA.l PikitFed : INC A : BEQ + ; overflow
|
||||
STA.l PikitFed
|
||||
+
|
||||
RTL
|
||||
;--------------------------------------------------------------------------------
|
||||
IncrementBonkCounter:
|
||||
LDA.l StatsLocked : BNE +
|
||||
LDA.l BonkCounter : INC : BEQ + ; overflow
|
||||
|
||||
+10
-8
@@ -504,6 +504,15 @@ CreditsLineBlank:
|
||||
%blankline()
|
||||
%blankline()
|
||||
|
||||
%smallcredits("PIKIT FEEDER", "red")
|
||||
|
||||
%blankline()
|
||||
|
||||
%bigcredits("KARAFRUIT")
|
||||
|
||||
%blankline()
|
||||
%blankline()
|
||||
|
||||
%smallcredits("SPRITE DEVELOPMENT", "yellow")
|
||||
|
||||
%blankline()
|
||||
@@ -623,12 +632,6 @@ endif
|
||||
|
||||
%bigcredits("HTTPS://ALTTPR.COM/DISCORD")
|
||||
|
||||
%emptyline()
|
||||
%emptyline()
|
||||
%emptyline()
|
||||
%emptyline()
|
||||
%emptyline()
|
||||
%emptyline()
|
||||
%emptyline()
|
||||
%emptyline()
|
||||
|
||||
@@ -755,10 +758,9 @@ endif
|
||||
%bigcreditsleft("TOTAL LAG TIME")
|
||||
|
||||
%blankline()
|
||||
%blankline()
|
||||
|
||||
%bigcreditsleft("SHIELDS EATEN")
|
||||
|
||||
%blankline()
|
||||
%blankline()
|
||||
|
||||
|
||||
|
||||
@@ -32,6 +32,8 @@
|
||||
!TOTAL_MENU_TIME_Y = 364
|
||||
!TOTAL_LAG_TIME_X = 19
|
||||
!TOTAL_LAG_TIME_Y = 367
|
||||
!PIKIT_FED_X = 26
|
||||
!PIKIT_FED_Y = 370
|
||||
!COLLECTION_RATE_X = 22
|
||||
!COLLECTION_RATE_Y = 380
|
||||
!TOTAL_TIME_X = 19
|
||||
@@ -64,8 +66,9 @@ CreditsStats:
|
||||
%AddStat(FaerieRevivalCounter, 0, 0, 08, 3, !FAERIE_REVIVALS_X, !FAERIE_REVIVALS_Y)
|
||||
%AddStat(MenuFrames, 1, 8, 32, 4, !TOTAL_MENU_TIME_X, !TOTAL_MENU_TIME_Y)
|
||||
%AddStat(LagTime, 1, 0, 32, 4, !TOTAL_LAG_TIME_X, !TOTAL_LAG_TIME_Y)
|
||||
%AddStat(PikitFed, 0, 0, 8, 3, !PIKIT_FED_X, !PIKIT_FED_Y)
|
||||
print "Collection Rate config: ", pc
|
||||
warnpc $A39864
|
||||
; warnpc $A39864
|
||||
%AddStat(TotalItemCounter, 0, 0, 16, 3, !COLLECTION_RATE_X, !COLLECTION_RATE_Y)
|
||||
%AddStat(NMIFrames, 1, 0, 32, 4, !TOTAL_TIME_X, !TOTAL_TIME_Y)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user