Prev: CA9E Up: Map Next: CAD2
CAA2: Build the room he is in
Used by the routine at AFTER_GAME.
Called from the main loop (AFTER_GAME) at the start of every life and after every walk through a doorway (EXIT_LOW_U), with IX on the legs. Puts the valves of the room being left back into their places (UPDATE_SPECIAL_OBJS) -- unless no turn has been played since the game began (PLAYED) -- builds the room's records (BUILD_ROOM), clears the screen buffer (CLEAR_SCRN_BUFFER), fills the two valve records from the places (FIND_SPECIAL_OBJS_HERE), and puts the robot in the doorway he came in by if he came through one (ADJUST_PLYR_UVZ_FOR_ROOM_SIZE).
Then the room's state: nothing dropping from the ceiling (DROPPING), no orders for the remote-controlled robots (REMOTE_ORDERS), LEAPING cleared, and DROP_LATCH set in an even-numbered room, so that nothing drops there until something is picked up. NEW_ROOM tells the main loop to redraw the whole screen, and the room is marked seen (MARK_ROOM_SEEN).
Input
IX the legs' record
ENTER_ROOM CAA2 LD A,(PLAYED) A turn has been played: the valves in the room being left back into their places
CAA5 AND A
CAA6 JR Z,ENTER_ROOM_0
CAA8 CALL UPDATE_SPECIAL_OBJS
ENTER_ROOM_0 CAAB CALL BUILD_ROOM Build the room
CAAE CALL CLEAR_SCRN_BUFFER Clear the screen buffer
CAB1 CALL FIND_SPECIAL_OBJS_HERE The valves in this room into their records
CAB4 CALL ADJUST_PLYR_UVZ_FOR_ROOM_SIZE In by a doorway: stand him in it
CAB7 XOR A Nothing dropping, no orders for the remote-controlled robots, LEAPING cleared
CAB8 LD (DROPPING),A
CABB LD (REMOTE_ORDERS),A
CABE LD (LEAPING),A
CAC1 LD A,(PLAYER_ROOM) DROP_LATCH: 1 in an even-numbered room
CAC4 CPL
CAC5 AND $01
CAC7 LD (DROP_LATCH),A
CACA LD A,$01 NEW_ROOM
CACC LD (NEW_ROOM),A
CACF JP MARK_ROOM_SEEN Mark the room seen
Prev: CA9E Up: Map Next: CAD2