Prev: C83B Up: Map Next: C874
C843: Out through the wall at low U?
Out if the player's far edge -- U plus his half-size -- is below the wall at 128 less the room's half-size. U is then set to 0: not a position but a marker, which ADJUST_PLYR_UVZ_FOR_ROOM_SIZE sees when the next room is built and puts him in the doorway of its wall at high U. The other exits use $FF and 0 the same way.
Input
IY The player's legs
IX The pillar
EXIT_LOW_U C843 POP HL L = the wall
C844 LD A,$80
C846 SUB L
C847 LD L,A
C848 LD A,(IY+$01) Still at or past it: stay
C84B ADD A,(IY+$04)
C84E CP L
C84F RET NC
C850 LD (IY+$01),$00 Arrive at the wall at high U
This entry point is used by the routines at EXIT_HIGH_U, EXIT_HIGH_V and EXIT_LOW_V.
EXIT_SCREEN C854 LD A,(IX+$08) The new room: the one the pillar's doorway leads to
C857 LD (IY+$08),A
C85A LD A,(IY+$0C) The walk into a room: three turns (bits 4-7 of +$0C) of walking straight on
C85D OR $30
C85F LD (IY+$0C),A
C862 PUSH IY Both player records to PLAYER_TEMPLATE, so that a life lost in the new room starts again at this doorway
C864 POP HL
C865 LD DE,PLAYER_TEMPLATE
C868 LD BC,$0040
C86B LDIR
C86D INC SP Drop the returns to FIRST_PILLAR and to the main loop
C86E INC SP
C86F INC SP
C870 INC SP
C871 JP GAME_LOOP Build the new room and carry on from there (START)
Prev: C83B Up: Map Next: C874