Prev: AE99 Up: Map Next: AF3F
AF05: Write the valves in the room back to their places
Used by the routines at GAME_ENDED and ENTER_ROOM.
Called before a new room is built, once a turn has been played (PLAYED: ENTER_ROOM), and at the end of a game (GAME_ENDED), so that the summary sees where the valves are. For each of records 2 and 3 holding a valve, loose or seated (graphics 96 to 103), writes its graphic, its U, V and Z and its room back to its place through the address at +10: that is how a valve moved, carried in or seated stays where it was left.
Knight Lore's update_special_objs writes back whatever the records hold; this writes back only the valves. An extra life (graphic 12) never moves, and taking one empties its place (EXTRA_LIFE).
UPDATE_SPECIAL_OBJS AF05 LD IY,VALVES record 2
UPDATE_SPECIAL_OBJS_0 AF09 LD A,(IY+$00) not a valve: skip
AF0C SUB $60
AF0E CP $08
AF10 JR NC,UPDATE_SPECIAL_OBJS_1
AF12 LD E,(IY+$10) the place
AF15 LD D,(IY+$11)
AF18 LD A,(IY+$00) the graphic
AF1B LD (DE),A
AF1C INC DE on to +5
AF1D INC DE
AF1E INC DE
AF1F INC DE
AF20 INC DE
AF21 PUSH IY U, V and Z
AF23 POP HL
AF24 INC HL
AF25 LD BC,$0003
AF28 LDIR
AF2A LD A,(IY+$08) the room
AF2D LD (DE),A
UPDATE_SPECIAL_OBJS_1 AF2E LD BC,$0020 record 3, then stop at record 4, ROOM_OBJECTS
AF31 ADD IY,BC
AF33 PUSH IY
AF35 POP HL
AF36 LD BC,ROOM_OBJECTS
AF39 AND A
AF3A SBC HL,BC
AF3C JR C,UPDATE_SPECIAL_OBJS_0
AF3E RET
Prev: AE99 Up: Map Next: AF3F