diff --git a/bookofmudora.asm b/bookofmudora.asm index 21f79a3..9dd0c4f 100644 --- a/bookofmudora.asm +++ b/bookofmudora.asm @@ -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