![]() |
Routines |
| Prev: 37191 | Up: Map | Next: 37245 |
|
The handler for the doors that are open (sprite IDs 33 and 35 in HandlerTable2) and that close after a time, as made by RandomiseDoors. On every other frame (when bit 0 of CounterLow is reset) the door timer at DoorTimer is counted down. When it has reached zero, and the player is not in a doorway (see CheckDoorway), HandlerDoor_Toggle closes the door. Otherwise the door is just checked for being used as an exit (see HandlerDoorExit).
|
||||||||
| HandlerDoorOpen | 37215 | LD A,(24082) | Fetch the counter from CounterLow. | |||||
| 37218 | AND %00000001 | Keep only bit 0. | ||||||
| 37220 | JP NZ,HandlerDoorExit | Jump to HandlerDoorExit on every other frame. | ||||||
| 37223 | LD A,(24110) | Fetch the door timer from DoorTimer. | ||||||
| 37226 | AND A | Test whether the door timer is zero. | ||||||
| 37227 | JR Z,HandlerDoorOpen_CheckDoorway | Jump to HandlerDoorOpen_CheckDoorway if it is. | ||||||
| 37229 | DEC A | Decrease the door timer by one. | ||||||
| 37230 | LD (24110),A | Update the door timer in DoorTimer. | ||||||
| 37233 | JP HandlerDoorExit | Jump to HandlerDoorExit to handle the exit of the door. | ||||||
| HandlerDoorOpen_CheckDoorway | 37236 | LD A,(24109) | Fetch the doorway flag from InDoorway. | |||||
| 37239 | AND A | Test whether the player is in a doorway. | ||||||
| 37240 | JP NZ,HandlerDoorExit | Jump to HandlerDoorExit if the player is. | ||||||
| 37243 | JR HandlerDoor_Toggle | Jump to HandlerDoor_Toggle to restart the door timer and toggle both halves of the door. | ||||||
| Prev: 37191 | Up: Map | Next: 37245 |