![]() |
Routines |
| Prev: 39608 | Up: Map | Next: 39657 |
|
Used by the routine at UpdateCounters.
Called once every time all of the actors have been processed, after SpawnNastie. If the start-of-turn delay is over, the player is alive and the actor record at ImmortalData_SpareFlame is empty then a counter (FlameSpawnDelay) is counted down; when it reaches zero a flame (sprite ID 52) is started at a position chosen by PlaceFlame, unless that position is unsuitable.
|
||||
|
Return unless the player is alive (the sprite ID of the player's actor is in the range 16-47).
|
||||
| SpawnFlame | 39612 | LD A,(38658) | Fetch the sprite ID of the player's actor from ImmortalData. | |
| 39615 | SUB 16 | Subtract 16 (the first Sabreman sprite ID). | ||
| 39617 | CP 32 | Return if the player is not alive. | ||
| 39619 | RET NC | |||
|
Return if the start-of-turn delay is still running.
|
||||
| 39620 | LD A,(38581) | Return if the start-of-turn delay in GameDelayTimer is not zero. | ||
| 39623 | AND A | |||
| 39624 | RET NZ | |||
|
Return if the record is already in use.
|
||||
| 39625 | LD DE,38754 | Point DE at the flame's actor record at ImmortalData_SpareFlame. | ||
| 39628 | LD A,(DE) | Fetch the sprite ID of the flame's actor. | ||
| 39629 | AND A | Return if the flame is already in use. | ||
| 39630 | RET NZ | |||
|
Count down the delay before the next flame appears.
|
||||
| 39631 | LD HL,38580 | Point HL at the flame spawn delay at FlameSpawnDelay. | ||
| 39634 | LD A,(HL) | Fetch the flame spawn delay. | ||
| 39635 | AND A | Jump to SpawnFlame_Start if the flame spawn delay has run out. | ||
| 39636 | JR Z,SpawnFlame_Start | |||
| 39638 | DEC (HL) | Decrease the flame spawn delay by one. | ||
| 39639 | RET NZ | Return if the flame spawn delay is not zero yet. | ||
|
The delay has run out so try to start a flame.
|
||||
| SpawnFlame_Start | 39640 | PUSH DE | Point IX at the flame's actor record (using the stack). | |
| 39641 | POP IX | |||
| 39643 | CALL PlaceFlame | Choose a position for the flame. | ||
| 39646 | RET C | Return if the position is unsuitable. | ||
| 39647 | LD (IX+0),52 | Set the sprite ID of the actor to 52 (flame). | ||
| 39651 | LD (IX+5),70 | Set the colour of the flame to INK:YELLOW, PAPER:BLACK (BRIGHT). | ||
| 39655 | JR StartActor_Reset | Jump to StartActor_Reset to start the flame. | ||
| Prev: 39608 | Up: Map | Next: 39657 |