Prev: 9A1D Up: Map Next: 9A68
9A3C: Spawn Nastie
Used by the routine at UpdateCounters.
Called once every time all of the actors have been processed. If the start-of-turn delay is over, the nastie spawn delay has run out and the player is alive, this looks for an empty record in the nastie table at NastieData and, if one is found, tries to start a new nastie in it with StartNastie.
Return if the start-of-turn delay is still running.
SpawnNastie 9A3C LD A,($96B5) Return if the start-of-turn delay in GameDelayTimer is not zero.
9A3F AND A
9A40 RET NZ
Count down the delay between nasties appearing.
9A41 LD A,($96B1) Jump to SpawnNastie_Ready if the nastie spawn delay in NastieSpawnDelay is zero.
9A44 AND A
9A45 JR Z,SpawnNastie_Ready
9A47 DEC A Decrease the nastie spawn delay by one.
9A48 LD ($96B1),A Store the nastie spawn delay in NastieSpawnDelay.
9A4B RET Return.
Return unless the player is alive (the sprite ID of the player's actor is in the range 10-2F).
SpawnNastie_Ready 9A4C LD A,($9702) Fetch the sprite ID of the player's actor from ImmortalData.
9A4F SUB $10 Subtract 10 (the first Sabreman sprite ID).
9A51 CP $20 Return if the player is not alive.
9A53 RET NC
Look for an empty record in the nastie table.
9A54 LD IX,$9792 Point IX at the first nastie record at NastieData.
9A58 LD DE,$000C Set the size of an actor record in DE to 0C.
9A5B LD B,$06 Set the nastie record counter in B to 06.
SpawnNastie_Loop 9A5D LD A,(IX+$00) Fetch the sprite ID of the nastie.
9A60 AND A Jump to StartNastie if the record is empty.
9A61 JR Z,StartNastie
9A63 ADD IX,DE Move onto the next nastie record.
9A65 DJNZ SpawnNastie_Loop Decrease the nastie record counter by one and loop back to SpawnNastie_Loop until all six records have been checked.
9A67 RET Return.
Prev: 9A1D Up: Map Next: 9A68