Prev: 25943 Up: Map Next: 26066
25994: Handler: Scenic Events
For each armed scenic event, walk its room list from Table_ScenicEventRooms and move the event to a chosen room unless the player is already there.
Handler_ScenicEvents 25994 LD A,(25122) Fetch the scenic-event flags.
25997 OR A No scenic event is running.
25998 JR Z,Handler_ScenicEvents_Step2
26000 LD C,A Keep the scenic flags and test all eight bits.
26001 LD B,8
Each set bit is a scenic event that can move to a new room.
Handler_ScenicEvents_Loop1 26003 SRL C Take the next scenic-event bit.
26005 JR NC,Handler_ScenicEvents_Step1 This scenic event is not running.
26007 LD DE,0 Index this scenic event's room list.
26010 LD A,8
26012 SUB B
26013 LD E,A
26014 SLA E
26016 PUSH BC Remember which scenic bits are still to be checked.
26017 LD A,(23672) Let the frame counter choose how far to walk the room list.
26020 LD B,A
26021 LD IX,25266 Find the rooms for this scenic event.
26025 ADD IX,DE Point at this event's rooms and prepare the end marker.
26027 LD A,255
Handler_ScenicEvents_Loop2 26029 LD L,(IX+0) Read the address of this event's room list.
26032 LD H,(IX+1)
Handler_ScenicEvents_Loop3 26035 CP (HL) Walk the list for as many frames as have passed.
26036 INC HL
26037 JR Z,Handler_ScenicEvents_Loop2
26039 DJNZ Handler_ScenicEvents_Loop3
26041 DEC HL Step back to the room those frames selected.
26042 SRA E Recover the event number from the list index.
26044 LD IX,25124 Find the room this scenic event belongs to.
26048 ADD IX,DE Point at this event's room.
26050 POP BC Restore the scenic flags still to be checked.
26051 LD A,(25123) Fetch the current room.
26054 CP (IX+0) Leave the event alone when the player is already in its room.
26057 JR Z,Handler_ScenicEvents_Step1
26059 LD A,(HL) Move this scenic event to the chosen room.
26060 LD (IX+0),A
Handler_ScenicEvents_Step1 26063 DJNZ Handler_ScenicEvents_Loop1 Repeat for the remaining scenic events.
Handler_ScenicEvents_Step2 26065 RET Return.
Prev: 25943 Up: Map Next: 26066