![]() |
Routines |
| Prev: 9AB8 | Up: Map | Next: 9AE9 |
|
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 34) 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 10-2F).
|
||||
| SpawnFlame | 9ABC | LD A,($9702) | Fetch the sprite ID of the player's actor from ImmortalData. | |
| 9ABF | SUB $10 | Subtract 10 (the first Sabreman sprite ID). | ||
| 9AC1 | CP $20 | Return if the player is not alive. | ||
| 9AC3 | RET NC | |||
|
Return if the start-of-turn delay is still running.
|
||||
| 9AC4 | LD A,($96B5) | Return if the start-of-turn delay in GameDelayTimer is not zero. | ||
| 9AC7 | AND A | |||
| 9AC8 | RET NZ | |||
|
Return if the record is already in use.
|
||||
| 9AC9 | LD DE,$9762 | Point DE at the flame's actor record at ImmortalData_SpareFlame. | ||
| 9ACC | LD A,(DE) | Fetch the sprite ID of the flame's actor. | ||
| 9ACD | AND A | Return if the flame is already in use. | ||
| 9ACE | RET NZ | |||
|
Count down the delay before the next flame appears.
|
||||
| 9ACF | LD HL,$96B4 | Point HL at the flame spawn delay at FlameSpawnDelay. | ||
| 9AD2 | LD A,(HL) | Fetch the flame spawn delay. | ||
| 9AD3 | AND A | Jump to SpawnFlame_Start if the flame spawn delay has run out. | ||
| 9AD4 | JR Z,SpawnFlame_Start | |||
| 9AD6 | DEC (HL) | Decrease the flame spawn delay by one. | ||
| 9AD7 | 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 | 9AD8 | PUSH DE | Point IX at the flame's actor record (using the stack). | |
| 9AD9 | POP IX | |||
| 9ADB | CALL PlaceFlame | Choose a position for the flame. | ||
| 9ADE | RET C | Return if the position is unsuitable. | ||
| 9ADF | LD (IX+$00),$34 | Set the sprite ID of the actor to 34 (flame). | ||
| 9AE3 | LD (IX+$05),$46 | Set the colour of the flame to INK:YELLOW, PAPER:BLACK (BRIGHT). | ||
| 9AE7 | JR StartActor_Reset | Jump to StartActor_Reset to start the flame. | ||
| Prev: 9AB8 | Up: Map | Next: 9AE9 |