The key is in the previously used SPAWN_SPOT_SPAWN_COUNT. We use the upper 4 bits to contain the wave the spawn spots is part of. This limits us to 15 enemies per spawn spot which we were never even close to.
We add a new counter named NUMBER_DELAYED_SPAWN_SPOTS_ALIVE. This contains the number of spawn spots that are currently not active (future waves). SPAWN_SPOT_LEVEL holds the wave number (in the upper for bits, that's why we add 16)
The ProcessSpawnSpots routine is enhanced thusly:
;undelay them now
;check all spots
Obviously in the spawn spot update loop we need to skip any spawn spots where the upper four bits are set:
Also, during level buildup we need to increment the correct counter depending on the upper four bits again:
;upper 4 bits set? then it's a delayed spawn spot!
Have fun surviving!
Previous Step Next Step