Prev: 59343 Up: Map Next: 59521
59491: Evaluate and Spawn Tracked Enemies
Used by the routine at Stage_Next_Wave.
Entry point called from Stage_Next_Wave. Reads the tracked enemy active count at 50220; if non-zero, jumps immediately to the spawn step at Evaluate_And_Spawn_Tracked_Enemies_Go. Otherwise checks 50221; if zero, also jumps to Evaluate_And_Spawn_Tracked_Enemies_Go. If 50221 is non-zero, halves it twice: if the result is still non-zero, jumps to Evaluate_And_Spawn_Tracked_Enemies_Go; otherwise increments A to 1 and falls through to store the spawn count and call Spawn_Tracked_Enemy_Entities.
Evaluate_And_Spawn_Tracked_Enemies 59491 LD A,(50220) If the tracked enemy active count at 50220 is non-zero, skip to Evaluate_And_Spawn_Tracked_Enemies_Go.
59494 AND A
59495 JP NZ,Evaluate_And_Spawn_Tracked_Enemies_Go
59498 LD A,(50221)
59501 AND A If the set count at 50221 is also zero, skip to Evaluate_And_Spawn_Tracked_Enemies_Go.
59502 JP Z,Evaluate_And_Spawn_Tracked_Enemies_Go
59505 SRL A Halve 50221 twice; if the result is still non-zero, skip to Evaluate_And_Spawn_Tracked_Enemies_Go.
59507 SRL A
59509 JP NZ,Evaluate_And_Spawn_Tracked_Enemies_Go
59512 INC A Set spawn count to 1.
Evaluate_And_Spawn_Tracked_Enemies_Go 59513 LD (50220),A Store the spawn count at 50220.
59516 CALL Spawn_Tracked_Enemy_Entities Call Spawn_Tracked_Enemy_Entities to spawn the tracked enemy wave and advance.
59519 INC HL
59520 RET
Prev: 59343 Up: Map Next: 59521