mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-24 21:11:39 +00:00
Implemented WorldThingSpawned hook. Also changed Console.Printf to automatically add \n. Also fixed vararg calls with names.
This commit is contained in:
parent
0598c18ad8
commit
83f868a049
6 changed files with 19 additions and 4 deletions
|
@ -627,6 +627,9 @@ public:
|
||||||
virtual void BeginPlay(); // Called immediately after the actor is created
|
virtual void BeginPlay(); // Called immediately after the actor is created
|
||||||
void CallBeginPlay();
|
void CallBeginPlay();
|
||||||
|
|
||||||
|
// [ZZ] custom postbeginplay (calls E_WorldThingSpawned)
|
||||||
|
void CallPostBeginPlay() override;
|
||||||
|
|
||||||
void LevelSpawned(); // Called after BeginPlay if this actor was spawned by the world
|
void LevelSpawned(); // Called after BeginPlay if this actor was spawned by the world
|
||||||
void HandleSpawnFlags(); // Translates SpawnFlags into in-game flags.
|
void HandleSpawnFlags(); // Translates SpawnFlags into in-game flags.
|
||||||
|
|
||||||
|
|
|
@ -1338,7 +1338,7 @@ DEFINE_ACTION_FUNCTION(_Console, Printf)
|
||||||
{
|
{
|
||||||
PARAM_PROLOGUE;
|
PARAM_PROLOGUE;
|
||||||
FString s = FStringFormat(param, defaultparam, numparam, ret, numret);
|
FString s = FStringFormat(param, defaultparam, numparam, ret, numret);
|
||||||
Printf("%s", s);
|
Printf("%s\n", s);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -71,7 +71,7 @@ public:
|
||||||
virtual void Tick ();
|
virtual void Tick ();
|
||||||
void CallTick();
|
void CallTick();
|
||||||
virtual void PostBeginPlay (); // Called just before the first tick
|
virtual void PostBeginPlay (); // Called just before the first tick
|
||||||
void CallPostBeginPlay();
|
virtual void CallPostBeginPlay(); // different in actor.
|
||||||
virtual void PostSerialize();
|
virtual void PostSerialize();
|
||||||
size_t PropagateMark();
|
size_t PropagateMark();
|
||||||
|
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
#include "g_levellocals.h"
|
#include "g_levellocals.h"
|
||||||
#include "gi.h"
|
#include "gi.h"
|
||||||
#include "v_text.h"
|
#include "v_text.h"
|
||||||
|
#include "actor.h"
|
||||||
|
|
||||||
DStaticEventHandler* E_FirstEventHandler = nullptr;
|
DStaticEventHandler* E_FirstEventHandler = nullptr;
|
||||||
|
|
||||||
|
@ -232,6 +233,9 @@ void E_WorldUnloadedUnsafe()
|
||||||
|
|
||||||
void E_WorldThingSpawned(AActor* actor)
|
void E_WorldThingSpawned(AActor* actor)
|
||||||
{
|
{
|
||||||
|
// don't call anything if actor was destroyed on PostBeginPlay/BeginPlay/whatever.
|
||||||
|
if (actor->ObjectFlags & OF_EuthanizeMe)
|
||||||
|
return;
|
||||||
for (DStaticEventHandler* handler = E_FirstEventHandler; handler; handler = handler->next)
|
for (DStaticEventHandler* handler = E_FirstEventHandler; handler; handler = handler->next)
|
||||||
handler->WorldThingSpawned(actor);
|
handler->WorldThingSpawned(actor);
|
||||||
}
|
}
|
||||||
|
|
|
@ -71,6 +71,7 @@
|
||||||
#include "virtual.h"
|
#include "virtual.h"
|
||||||
#include "g_levellocals.h"
|
#include "g_levellocals.h"
|
||||||
#include "a_morph.h"
|
#include "a_morph.h"
|
||||||
|
#include "events.h"
|
||||||
|
|
||||||
// MACROS ------------------------------------------------------------------
|
// MACROS ------------------------------------------------------------------
|
||||||
|
|
||||||
|
@ -4970,6 +4971,12 @@ void AActor::PostBeginPlay ()
|
||||||
flags7 |= MF7_HANDLENODELAY;
|
flags7 |= MF7_HANDLENODELAY;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AActor::CallPostBeginPlay()
|
||||||
|
{
|
||||||
|
Super::CallPostBeginPlay();
|
||||||
|
E_WorldThingSpawned(this);
|
||||||
|
}
|
||||||
|
|
||||||
void AActor::MarkPrecacheSounds() const
|
void AActor::MarkPrecacheSounds() const
|
||||||
{
|
{
|
||||||
SeeSound.MarkUsed();
|
SeeSound.MarkUsed();
|
||||||
|
|
|
@ -8206,9 +8206,10 @@ FxExpression *FxVMFunctionCall::Resolve(FCompileContext& ctx)
|
||||||
if (x)
|
if (x)
|
||||||
{
|
{
|
||||||
if (x->ValueType == TypeName ||
|
if (x->ValueType == TypeName ||
|
||||||
x->ValueType == TypeSound)
|
x->ValueType == TypeSound ||
|
||||||
|
x->ValueType == TypeSpriteID) // spriteID can be a string too.
|
||||||
{
|
{
|
||||||
x = new FxStringCast(ArgList[i]);
|
x = new FxStringCast(x);
|
||||||
x = x->Resolve(ctx);
|
x = x->Resolve(ctx);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue