Prev: EE08 Up: Map Next: EEA6
EE5B: Handler: Doors
Used by the routines at PlayerControls_Kempston and PlayerControls.
Handler_Doors EE5B LD IX,($5BD6) Point IX at *ReferenceDoors.
EE5F LD BC,($F231) BC=*TablePlayerAttributes (player column and row).
Walk the door table looking for one the player is standing in.
Handler_Doors_Loop EE63 LD A,(IX+$00) Return if this door entry is the terminator (FF).
EE66 CP $FF
EE68 RET Z
Simple collision detection.
EE69 SUB C Jump to Handler_Doors_Next if the player is more than two columns from this door.
EE6A CP $02
EE6C JR NC,Handler_Doors_Next
EE6E LD A,(IX+$01) Jump to FoundDoorMatch if the player is on the row below this door.
EE71 DEC A
EE72 CP B
EE73 JR Z,FoundDoorMatch
No match; try the next four-byte door entry.
Handler_Doors_Next EE75 LD DE,$0004 Move IX on to the next door.
EE78 ADD IX,DE
EE7A JR Handler_Doors_Loop Jump to Handler_Doors_Loop.
We found a matching door. Check if it's the "bad door" (the CYAN door in room #10); else change room.
FoundDoorMatch EE7C LD A,(IX+$03) Call Handler_BadDoor if this door's destination room is 15.
EE7F CP $15
EE81 CALL Z,Handler_BadDoor
This entry point is used by the routine at InitialiseGame.
ChangeRoom EE84 LD ($5BD3),A Write the destination room to *CurrentRoom.
EE87 LD A,$00 Write 00 to:
EE89 LD ($F241),A
EE8C LD ($F2DB),A
EE8F LD ($E479),A
EE92 LD ($F31C),A
EE95 LD A,$01 Set *PlayerActionState to emerging from a door.
EE97 LD ($F242),A
Write the front-facing player sprite to be the active frame.
This ensures the player appears to be emerging from the door.
EE9A LD A,$98 Write 98 to *PlayerSpriteID.
EE9C LD ($F237),A
This also draws the new room to the screen.
EE9F CALL PrintStatusBar Call PrintStatusBar.
EEA2 CALL ResetSoundFlags Call ResetSoundFlags.
EEA5 RET Return.
Prev: EE08 Up: Map Next: EEA6