![]() |
Routines |
| Prev: 25943 | Up: Map | Next: 26066 |
|
Walk the scenic-event bits and fire a handler when the player is in its room.
|
||||
| HandlerScenicEvents | 25994 | LD A,(25122) | Fetch the scenic-event flags. | |
| 25997 | OR A | No scenic event is running. | ||
| 25998 | JR Z,HandlerScenicEvents_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 plant a message.
|
||||
| HandlerScenicEvents_Loop1 | 26003 | SRL C | Take the next scenic-event bit. | |
| 26005 | JR NC,HandlerScenicEvents_Step1 | This scenic event is not running. | ||
| 26007 | LD DE,0 | Index this scenic event's message 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 message list. | ||
| 26020 | LD B,A | |||
| 26021 | LD IX,25266 | Find the messages for this scenic event. | ||
| 26025 | ADD IX,DE | Point at this event's messages and prepare the end marker. | ||
| 26027 | LD A,255 | |||
| HandlerScenicEvents_Loop2 | 26029 | LD L,(IX+0) | Read the address of this event's message list. | |
| 26032 | LD H,(IX+1) | |||
| HandlerScenicEvents_Loop3 | 26035 | CP (HL) | Walk the list for as many frames as have passed. | |
| 26036 | INC HL | |||
| 26037 | JR Z,HandlerScenicEvents_Loop2 | |||
| 26039 | DJNZ HandlerScenicEvents_Loop3 | |||
| 26041 | DEC HL | Step back to the message 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,HandlerScenicEvents_Step1 | |||
| 26059 | LD A,(HL) | Plant the chosen message in this event's room. | ||
| 26060 | LD (IX+0),A | |||
| HandlerScenicEvents_Step1 | 26063 | DJNZ HandlerScenicEvents_Loop1 | Repeat for the remaining scenic events. | |
| HandlerScenicEvents_Step2 | 26065 | RET | Return. | |
| Prev: 25943 | Up: Map | Next: 26066 |