Prev: EB49 Up: Map Next: EBD8
EB8D: Handler: Unlock Door
Used by the routine at Handler_Player.
Opens the door at HL, plays the unlock sound, and blanks the locked-door graphic.
Handler_UnlockDoor EB8D LD A,$05 Queue the unlocked-door sound at SoundFlag_General.
EB8F LD ($FFFE),A
EB92 PUSH IX Stash the player slot on the stack.
EB94 PUSH HL Point IX at the matching door entry.
EB95 POP IX
EB97 PUSH BC Stash BC and DE on the stack.
EB98 PUSH DE
EB99 LD C,(IX+$00) C=the door horizontal co-ordinate.
EB9C LD B,(IX+$01) B=the door vertical co-ordinate.
EB9F DEC B Move one row up to the top of the door.
EBA0 LD (IX+$05),$00 Mark this door as open.
EBA4 PUSH BC Stash the door co-ordinates on the stack.
EBA5 PUSH IX Stash the door entry on the stack.
EBA7 LD DE,$0032 DE=0032 (beeper pitch).
EBAA LD HL,$00C8 HL=00C8 (beeper duration).
EBAD CALL $03B5 Call BEEPER.
EBB0 POP IX Restore the door entry from the stack.
EBB2 POP BC Restore the door co-ordinates from the stack.
EBB3 LD HL,($5C36) HL=*CHARS.
EBB6 PUSH HL Stash the current character set pointer on the stack.
Blank the locked-door graphic with empty mask tiles.
EBB7 LD HL,$9F6C Write 9F6C to *CHARS.
EBBA LD ($5C36),HL
EBBD LD D,$04 Set the blank width/ height to 01/ 04.
EBBF LD E,$01
EBC1 LD A,$00 A=00 (first mask tile).
EBC3 CALL WriteGameSpriteBuffer Erase the door from the room buffer.
EBC6 LD A,$20 A=20 (space).
EBC8 CALL PrintSprite Print the blank door space.
EBCB POP HL Restore the previous character set pointer from the stack.
EBCC LD ($5C36),HL Write it back to *CHARS.
EBCF POP DE Restore DE, BC and the player slot from the stack.
EBD0 POP BC
EBD1 POP IX
EBD3 LD (IX+$10),$00 Clear the key the player was holding.
EBD7 RET Return.
Prev: EB49 Up: Map Next: EBD8