Skip to content

Commit

Permalink
Get rid of redundant MyOriginSpawner method and related state
Browse files Browse the repository at this point in the history
  • Loading branch information
wallabra committed Aug 21, 2024
1 parent 347debd commit ab8d297
Showing 1 changed file with 5 additions and 15 deletions.
20 changes: 5 additions & 15 deletions wadsrc/static/zscript/actors/shared/randomspawner.zs
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,7 @@ extend class Actor {

class RandomSpawner : Actor
{

const MAX_RANDOMSPAWNERS_RECURSION = 32; // Should be largely more than enough, honestly.
Class<Actor> origin; // Keep track of original RandomSpawner.

private Class<Actor> MyOriginSpawner() {
if (origin == null) {
return GetClass();
}

return origin;
}

Default
{
Expand Down Expand Up @@ -248,12 +238,12 @@ class RandomSpawner : Actor
if (newmobj.bMissile)
newmobj.CheckMissileSpawn(0);
// Bouncecount is used to count how many recursions we're in.
if (newmobj is 'RandomSpawner') {
if (newmobj is 'RandomSpawner')
newmobj.bouncecount = ++bouncecount;
RandomSpawner(newmobj).origin = origin != null ? origin : GetClass();
} else {
newmobj.originSpawner = MyOriginSpawner();
}

// Keep track of this spawner (or a previous one) in the spawned actor.
newmobj.originSpawner = GetOriginSpawner();

// If the spawned actor has either of those flags, it's a boss.
if (newmobj.bBossDeath || newmobj.bBoss)
boss = true;
Expand Down

0 comments on commit ab8d297

Please sign in to comment.