![]() |
Routines |
| Prev: 57154 | Up: Map | Next: 57240 |
|
Used by the routine at Run_Game.
Lets a stalactite fall from the ceiling of a cave room every now and then. Nothing happens in a special room, in a room that has no ceiling, or while the stalactite record at Falling_Stalactite_Record is in use. The stalactite is only made when the low four bits of the tick counter and the frame counter, combined, are zero.
The record is a copy of the record of Sabreman, so the stalactite falls from the same x position, with the type 80 the y position 64 the attribute 70 (yellow) and a y velocity of 16 (see Handle_Falling_Stalactite).
|
||||
| Spawn_Falling_Stalactite | 57176 | LD A,(IX+4) | Fetch the room y of the object. | |
| 57179 | CP 16 | Return if it is a special room. | ||
| 57181 | RET C | |||
| 57182 | LD A,(43692) | Fetch the flags of the room that Sabreman is in. | ||
| 57185 | AND %00000001 | Keep only bit 0 (the ceiling). | ||
| 57187 | RET Z | Return if the room has no ceiling. | ||
| 57188 | LD A,(36666) | Fetch the type of the stalactite record. | ||
| 57191 | AND A | Return if the record is already in use. | ||
| 57192 | RET NZ | |||
| 57193 | LD A,(36566) | Fetch the tick counter and keep it in B. | ||
| 57196 | LD B,A | |||
| 57197 | LD A,(23672) | Fetch the low byte of the frame counter. | ||
| 57200 | OR B | Combine it with the tick counter. | ||
| 57201 | AND %00001111 | Keep only the low four bits. | ||
| 57203 | RET NZ | Return unless they are zero. | ||
| 57204 | LD HL,36634 | Point HL at Sabreman_Record. | ||
| 57207 | LD DE,36666 | Point DE at Falling_Stalactite_Record. | ||
| 57210 | LD BC,16 | Set a counter of 16 bytes. | ||
| 57213 | PUSH DE | Stash the address of the stalactite record. | ||
| 57214 | LDIR | Copy the record of Sabreman to the stalactite record. | ||
| 57216 | POP HL | Restore the address of the stalactite record to HL. | ||
| 57217 | LD (HL),80 | Set the type to 80. | ||
| 57219 | INC HL | Move to the y position. | ||
| 57220 | INC HL | |||
| 57221 | INC HL | |||
| 57222 | LD (HL),64 | Set the y position to 64. | ||
| 57224 | INC HL | Move to the attribute. | ||
| 57225 | INC HL | |||
| 57226 | LD (HL),70 | Set the attribute to 70 (yellow). | ||
| 57228 | INC HL | Move to the y velocity. | ||
| 57229 | INC HL | |||
| 57230 | INC HL | |||
| 57231 | INC HL | |||
| 57232 | LD (HL),16 | Set the y velocity to 16. | ||
| 57234 | LD A,1 | Set the redraw flags of the stalactite to 1 so that it is drawn without being erased first. | ||
| 57236 | LD (36681),A | |||
| 57239 | RET | Return. | ||
| Prev: 57154 | Up: Map | Next: 57240 |