; ; takeable key ; .include "players.inc" .include "objects.inc" .include "graphics.inc" .include "sounds.inc" .include "snesmod.inc" ;============================================================================ ; IMPORTS ;============================================================================ ;============================================================================ ; EXPORTS ;============================================================================ .export OBJR_Key_Init, OBJR_Key_Update, OBJR_Key_Draw .code .a8 .i8 ;============================================================================ .macro TestForPlayer PX, PY, KEY ;============================================================================ lda KEY ; if player doesn't have a key bne :+ ; ;---------------------------------------------------------------------------- lda PX ; and player.x = me.x cmp ObjX, y ; bne :+ ; ;---------------------------------------------------------------------------- lda PY ; and player.y = me.y cmp ObjY, y ; bne :+ ; ;---------------------------------------------------------------------------- lda #1 ; give player key sta KEY ; ;---------------------------------------------------------------------------- lda #0 ; sta ObjType, y ; delete me ; todo: key pickup sound phy rep #10h spcPlaySoundM SND_MENU2 sep #10h ply rts ; ;---------------------------------------------------------------------------- : .endmacro ;============================================================================ OBJR_Key_Init: ;============================================================================ ; nothing to init rts ;============================================================================ OBJR_Key_Update: ;============================================================================ TestForPlayer PL_XH, PL_YH, PL_HasKey ; test for players TestForPlayer PL_XH+1, PL_YH+1, PL_HasKey+1 ; TestForPlayer PL_XH+2, PL_YH+2, PL_HasKey+2 ; ;---------------------------------------------------------------------------- rts ; ;============================================================================ OBJR_Key_Draw: ;============================================================================ mac_Objects_AddSpriteB16 (%00110000 | (DONGLESPAL<<1)), DONGLE_KEY ;---------------------------------------------------------------------------- rts