Prev: 60936 Up: Map Next: 61094
61019: Handler: Doors
Used by the routines at PlayerControls_Kempston and PlayerControls.
Handler_Doors 61019 LD IX,(23510) IX=*ReferenceDoors.
61023 LD BC,(62001) BC=*TablePlayerAttributes.
Are we done?
Handler_Doors_Loop 61027 LD A,(IX+0) Return if the terminator character has been received instead of a co-ordinate (255).
61030 CP 255
61032 RET Z
Simple collision detection.
61033 SUB C Jump to Handler_Doors_Next if subtracting the players horizontal position from the door position is higher than 2.
61034 CP 2
61036 JR NC,Handler_Doors_Next
61038 LD A,(IX+1) Jump to FoundDoorMatch if the door vertical position minus one is equal to the players vertical position.
61041 DEC A
61042 CP B
61043 JR Z,FoundDoorMatch
The door was not found to match the players position, so move onto the next one.
Handler_Doors_Next 61045 LD DE,4 IX+=0004.
61048 ADD IX,DE
61050 JR Handler_Doors_Loop Jump to Handler_Doors_Loop.
We found a matching door! But check if it's the "bad door" (the CYAN door in room #10) else, change the current room.
FoundDoorMatch 61052 LD A,(IX+3) Call Handler_BadDoor if *IX+3 is equal to 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 A 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 Write 1 to *62018.
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