From ab8d297b854d8fc618d47e640c1c7dfb44970f67 Mon Sep 17 00:00:00 2001 From: Gustavo Rehermann Date: Wed, 21 Aug 2024 16:36:36 -0300 Subject: [PATCH] Get rid of redundant MyOriginSpawner method and related state --- .../zscript/actors/shared/randomspawner.zs | 20 +++++-------------- 1 file changed, 5 insertions(+), 15 deletions(-) diff --git a/wadsrc/static/zscript/actors/shared/randomspawner.zs b/wadsrc/static/zscript/actors/shared/randomspawner.zs index daa8ddf59c1..f4c20ec9187 100644 --- a/wadsrc/static/zscript/actors/shared/randomspawner.zs +++ b/wadsrc/static/zscript/actors/shared/randomspawner.zs @@ -12,17 +12,7 @@ extend class Actor { class RandomSpawner : Actor { - const MAX_RANDOMSPAWNERS_RECURSION = 32; // Should be largely more than enough, honestly. - Class origin; // Keep track of original RandomSpawner. - - private Class MyOriginSpawner() { - if (origin == null) { - return GetClass(); - } - - return origin; - } Default { @@ -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;