Absorb torch keys if they belong to the dungeon they're in.

This commit is contained in:
cassidoxa
2023-08-30 20:47:06 -04:00
parent 90c8e95f9b
commit 29176fa194

View File

@@ -60,7 +60,7 @@ RTL
;--------------------------------------------------------------------------------
GiveBonkItem:
JSR LoadBonkItem
CMP.b #$24 : BNE .notKey
JSR.w AbsorbKeyCheck : BCC .notKey
.key
PHY : LDY.b #$24 : JSL.l AddInventory : PLY ; do inventory processing for a small key
LDA.l CurrentSmallKeys : INC A : STA.l CurrentSmallKeys
@@ -84,3 +84,19 @@ LoadBonkItem:
LDA.b #$24 ; default to small key
++
RTS
;--------------------------------------------------------------------------------
AbsorbKeyCheck:
PHA
CMP.b #$24 : BEQ .key
CMP.b #$A0 : BCC .not_key
CMP.b #$B0 : BCS .not_key
AND.b #$0F : ASL
CMP.w DungeonID : BNE .not_key
.key
PLA
SEC
RTS
.not_key
PLA
CLC
RTS