diff --git a/doorrando/hudadditions.asm b/doorrando/hudadditions.asm index 9fa293a..1c0bc1f 100644 --- a/doorrando/hudadditions.asm +++ b/doorrando/hudadditions.asm @@ -80,10 +80,10 @@ DRHUD_DrawKeyCounter: .dungeon_id TAX LDA.l GenericKeys : LSR : BCS .total_only - LDA.w DungeonAllCollectedKeys-1, X : JSR ConvertToDisplay : STA.w HUDKeysObtained + LDA.w DungeonCollectedKeys, X : JSR ConvertToDisplay : STA.w HUDKeysObtained LDA.w #!SlashTile : STA.w HUDKeysSlash .total_only - LDA.l TotalKeys, x : JSR ConvertToDisplay : STA.w HUDKeysTotal + LDA.l ChestKeys, x : JSR ConvertToDisplay : STA.w HUDKeysTotal JMP DRHUD_Finished OWRHUD_DrawWorldIndicator: @@ -264,9 +264,13 @@ ConvertToDisplay2: ++ lda.w #$2827 : rts ; 0/O for 0 or placeholder digit ;2483 CountAbsorbedKeys: + JML IncrementSmallKeysNoPrimary + +; This function apporach doesn't currently work +CountAbsorbedKeysViaCountAllKey: PHA : PHX LDA.l StandingItemsOn : BEQ .count_it - LDA.w SpawnedItemKeyCounted : BNE .done +; LDA.w SpawnedItemKeyCounted : BNE .done ; this was added because pot keys were being double counted when they weren't shuffled CPY.b #$24 : BEQ .count_it ; small key for this dungeon LDA.w DungeonID : LSR : TAX TYA : CMP.l KeyTable, X : BNE .done @@ -276,7 +280,7 @@ CountAbsorbedKeys: REP #$10 : JSL CountAllKey : SEP #$10 LDY.b Scrap02 .done - STZ.w SpawnedItemKeyCounted ; reset to zero for next time +; STZ.w SpawnedItemKeyCounted ; reset to zero for next time PLX : PLA JML IncrementSmallKeysNoPrimary diff --git a/inventory.asm b/inventory.asm index 8167fe7..97de1a5 100644 --- a/inventory.asm +++ b/inventory.asm @@ -220,7 +220,7 @@ DungeonIncrement: REP #$10 PHX LDA.w InventoryTable_properties,X : BIT.b #$40 : BEQ + - JSL CountAllKey + JSL CountChestKeyLong + LDA.l !MULTIWORLD_RECEIVING_ITEM : BNE .done SEP #$10 diff --git a/keydrop/standing_items.asm b/keydrop/standing_items.asm index c087e29..915b233 100644 --- a/keydrop/standing_items.asm +++ b/keydrop/standing_items.asm @@ -697,7 +697,6 @@ KeyGet: LDA.b Scrap00 : CMP.l KeyTable, X : BNE + .countIt LDA.l StandingItemCounterMask : AND SpawnedItemFlag : BEQ ++ - STA.w SpawnedItemKeyCounted JSL AddInventory ++ PLX : PLA : RTL + CMP.b #$AF : beq .countIt ; universal key diff --git a/ram.asm b/ram.asm index 4ad5b70..cc98bdc 100644 --- a/ram.asm +++ b/ram.asm @@ -330,7 +330,6 @@ SpawnedItemFlag = $7E0726 ; 0x02 - one for pot, 2 for sprite drop SpawnedItemMWPlayer = $7E0728 ; Player Id for spawned item if Multiworld item 0x02 ; EnemyDropIndicator = $7E072A ; Used by HUD to indicate enemy drops remaining -SpawnedItemKeyCounted = $7E072C ; If set, the spawned item has been counted towards dungeon key total SkipBeeTrapDisguise = $7E072D ; Flag to skip bee trap disguise during draw routine SprDropsItem = $7E0730 ; Array for whether a sprite drops an item 0x16 @@ -915,7 +914,6 @@ endmacro %assertRAM(SpawnedItemFlag, $7E0726) %assertRAM(SpawnedItemMWPlayer, $7E0728) %assertRAM(EnemyDropIndicator, $7E072A) -%assertRAM(SpawnedItemKeyCounted, $7E072C) %assertRAM(SkipBeeTrapDisguise, $7E072D) %assertRAM(SprDropsItem, $7E0730) %assertRAM(SprItemReceipt, $7E0740) diff --git a/stats.asm b/stats.asm index 6adca40..492b6de 100644 --- a/stats.asm +++ b/stats.asm @@ -118,7 +118,41 @@ RTL ;-------------------------------------------------------------------------------- +CountChestKeyLong: + PHX : PHP + SEP #$30 + JSR CountChestKey + PLP : PLX + RTL +;-------------------------------------------------------------------------------- + +CountChestKey: + PHA : PHX + LDA.l !MULTIWORLD_ITEM_PLAYER_ID : BNE .done + LDA.l StatsLocked : BNE .done + CPY.b #$24 : BEQ .this_dungeon + TYA + AND.b #$0F : CMP.b #$02 : BCC .hc_sewers + TAX + LDA.l DungeonCollectedKeys,X : INC : STA.l DungeonCollectedKeys,X + BRA .done + +.this_dungeon + LDA.w DungeonID : CMP.b #$03 : BCC .hc_sewers + LSR : TAX + LDA.l DungeonCollectedKeys,X : INC : STA.l DungeonCollectedKeys,X + BRA .done + +.hc_sewers + LDA.l SewerCollectedKeys : INC + STA.l SewerCollectedKeys : STA.l HCCollectedKeys + +.done + PLX : PLA + RTS + ; Expects 16 bit index mode upon entering. 8-bit Acumulator +; This approach doesn't currently work - potentially dead code CountAllKey: PHP : PHA : PHX SEP #$10