Prev: EE08 Up: Map Next: EEA6
EE5B: Handler: Doors
Used by the routines at PlayerControls_Kempston and PlayerControls.
Handler_Doors EE5B LD IX,($5BD6) IX=*ReferenceDoors.
EE5F LD BC,($F231) BC=*TablePlayerAttributes.
Are we done?
Handler_Doors_Loop EE63 LD A,(IX+$00) Return if the terminator character has been received instead of a co-ordinate (FF).
EE66 CP $FF
EE68 RET Z
Simple collision detection.
EE69 SUB C Jump to Handler_Doors_Next if subtracting the players horizontal position from the door position is higher than 02.
EE6A CP $02
EE6C JR NC,Handler_Doors_Next
EE6E LD A,(IX+$01) Jump to FoundDoorMatch if the door vertical position minus one is equal to the players vertical position.
EE71 DEC A
EE72 CP B
EE73 JR Z,FoundDoorMatch
The door was not found to match the players position, so move onto the next one.
Handler_Doors_Next EE75 LD DE,$0004 IX+=0004.
EE78 ADD IX,DE
EE7A 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 EE7C LD A,(IX+$03) Call Handler_BadDoor if *IX+03 is equal to 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 A 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 Write 01 to *F242.
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