Prev: 60936 Up: Map Next: 61094
61019: Handler: Doors
Used by the routines at PlayerControls_Kempston and PlayerControls.
Handler_Doors 61019 LD IX,(23510) Point IX at *ReferenceDoors.
61023 LD BC,(62001) BC=*TablePlayerAttributes (player column and row).
Walk the door table looking for one the player is standing in.
Handler_Doors_Loop 61027 LD A,(IX+0) Return if this door entry is the terminator (255).
61030 CP 255
61032 RET Z
Simple collision detection.
61033 SUB C Jump to Handler_Doors_Next if the player is more than two columns from this door.
61034 CP 2
61036 JR NC,Handler_Doors_Next
61038 LD A,(IX+1) Jump to FoundDoorMatch if the player is on the row below this door.
61041 DEC A
61042 CP B
61043 JR Z,FoundDoorMatch
No match; try the next four-byte door entry.
Handler_Doors_Next 61045 LD DE,4 Move IX on to the next door.
61048 ADD IX,DE
61050 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 61052 LD A,(IX+3) Call Handler_BadDoor if this door's destination room is 21.
61055 CP 21
61057 CALL Z,Handler_BadDoor
This entry point is used by the routine at InitialiseGame.
ChangeRoom 61060 LD (23507),A Write the destination room to *CurrentRoom.
61063 LD A,0 Write 0 to:
61065 LD (62017),A
61068 LD (62171),A
61071 LD (58489),A
61074 LD (62236),A
61077 LD A,1 Set *PlayerActionState to emerging from a door.
61079 LD (62018),A
Write the front-facing player sprite to be the active frame.
This ensures the player appears to be emerging from the door.
61082 LD A,152 Write 152 to *PlayerSpriteID.
61084 LD (62007),A
This also draws the new room to the screen.
61087 CALL PrintStatusBar Call PrintStatusBar.
61090 CALL ResetSoundFlags Call ResetSoundFlags.
61093 RET Return.
Prev: 60936 Up: Map Next: 61094