Merged in DR v1.5.2

This commit is contained in:
codemann8
2025-12-09 16:44:50 -06:00
5 changed files with 43 additions and 8 deletions

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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)

View File

@@ -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