;================================================================================ ; Randomize Book of Mudora ;-------------------------------------------------------------------------------- LoadLibraryItemGFX: LDA.l LibraryItem_Player : STA !MULTIWORLD_SPRITEITEM_PLAYER_ID %GetPossiblyEncryptedItem(LibraryItem, SpriteItemValues) STA $0E80, X ; Store item type JML RequestSlottedTile ;-------------------------------------------------------------------------------- DrawLibraryItemGFX: PHA LDA $0E80, X ; Retrieve stored item type JSL.l DrawSlottedTile PLA RTL ;-------------------------------------------------------------------------------- SetLibraryItem: LDY $0E80, X ; Retrieve stored item type JSL.l ItemSet_Library ; contains thing we wrote over RTL ;-------------------------------------------------------------------------------- ;0x0087 - Hera Room w/key ;================================================================================ ; Randomize Bonk Keys ;-------------------------------------------------------------------------------- LoadBonkItemGFX: LDA.b #$08 : STA $0F50, X ; thing we wrote over LoadBonkItemGFX_inner: JSR LoadBonkItem_Player : STA !MULTIWORLD_SPRITEITEM_PLAYER_ID JSR LoadBonkItem JML RequestSlottedTile ;-------------------------------------------------------------------------------- DrawBonkItemGFX: PHA LDA.w !SPRITE_REDRAW, X : BEQ .skipInit ; skip init if already ready JSL.l LoadBonkItemGFX_inner LDA.w !SPRITE_REDRAW, X : CMP.b #$02 : BEQ .skipInit BRA .done ; don't draw on the init frame .skipInit JSR LoadBonkItem JSL DrawSlottedTile .done PLA RTL ;-------------------------------------------------------------------------------- GiveBonkItem: JSR LoadBonkItem_Player : STA !MULTIWORLD_ITEM_PLAYER_ID JSR LoadBonkItem CMP #$24 : BNE .notKey .key PHY : LDY.b #$24 : JSL.l AddInventory : PLY ; do inventory processing for a small key LDA CurrentSmallKeys : INC A : STA CurrentSmallKeys LDA.b #$2F : JSL.l Sound_SetSfx3PanLong JSL CountBonkItem RTL .notKey PHY : TAY : JSL.l Link_ReceiveItem : PLY JSL CountBonkItem RTL ;-------------------------------------------------------------------------------- LoadBonkItem: LDA $A0 ; check room ID - only bonk keys in 2 rooms so we're just checking the lower byte CMP #115 : BNE + ; Desert Bonk Key LDA.l BonkKey_Desert BRA ++ + : CMP #140 : BNE + ; GTower Bonk Key LDA.l BonkKey_GTower BRA ++ + LDA.b #$24 ; default to small key ++ RTS ;-------------------------------------------------------------------------------- LoadBonkItem_Player: LDA $A0 ; check room ID - only bonk keys in 2 rooms so we're just checking the lower byte CMP #115 : BNE + ; Desert Bonk Key LDA.l BonkKey_Desert_Player BRA ++ + : CMP #140 : BNE + ; GTower Bonk Key LDA.l BonkKey_GTower_Player BRA ++ + LDA.b #$00 ++ RTS