- added a virtual PostSpawn method to RandomSpawner, this will get called when the actor has been spawned so that the spawner can do some special setup with it.

This commit is contained in:
Christoph Oelckers 2017-01-10 20:14:48 +01:00
parent 06c97d898b
commit 3f94a15cfe
2 changed files with 10 additions and 0 deletions

View file

@ -17,6 +17,7 @@
#include "doomstat.h"
#include "doomdata.h"
#include "g_levellocals.h"
#include "virtual.h"
#define MAX_RANDOMSPAWNERS_RECURSION 32 // Should be largely more than enough, honestly.
static FRandom pr_randomspawn("RandomSpawn");
@ -211,6 +212,12 @@ class ARandomSpawner : public AActor
AActor *rep = GetDefaultByType(GetClass()->GetReplacee());
if (rep && ((rep->flags4 & MF4_BOSSDEATH) || (rep->flags2 & MF2_BOSS)))
boss = true;
IFVIRTUAL(ARandomSpawner, PostSpawn)
{
VMValue params[2] = { (DObject*)this, newmobj };
GlobalVMStack.Call(func, params, 2, nullptr, 0, nullptr);
}
}
if (boss)
this->tracer = newmobj;

View file

@ -189,6 +189,9 @@ class RandomSpawner : Actor native
+NOGRAVITY
+THRUACTORS
}
virtual void PostSpawn(Actor spawned)
{}
}
// Sector flag setter ------------------------------------------------------