diff --git a/src/playsim/p_effect.cpp b/src/playsim/p_effect.cpp index af8514698..c16d4a982 100644 --- a/src/playsim/p_effect.cpp +++ b/src/playsim/p_effect.cpp @@ -1052,6 +1052,16 @@ DVisualThinker* DVisualThinker::NewVisualThinker(FLevelLocals* Level, PClass* ty auto zs = static_cast(Level->CreateThinker(type, DVisualThinker::DEFAULT_STAT)); zs->Construct(); + + IFOVERRIDENVIRTUALPTRNAME(zs, NAME_VisualThinker, BeginPlay) + { + VMValue params[] = { zs }; + VMCall(func, params, 1, nullptr, 0); + + if (zs->ObjectFlags & OF_EuthanizeMe) + return nullptr; + } + return zs; } @@ -1269,11 +1279,22 @@ DEFINE_ACTION_FUNCTION_NATIVE(DVisualThinker, SetRenderStyle, SetRenderStyle) return 0; } -int DVisualThinker::GetRenderStyle() +int DVisualThinker::GetRenderStyle() const { return PT.style; } +static int GetRenderStyle(DVisualThinker* self) +{ + return self->GetRenderStyle(); +} + +DEFINE_ACTION_FUNCTION_NATIVE(DVisualThinker, GetRenderStyle, GetRenderStyle) +{ + PARAM_SELF_PROLOGUE(DVisualThinker); + ACTION_RETURN_INT(self->GetRenderStyle()); +} + float DVisualThinker::GetOffset(bool y) const // Needed for the renderer. { if (y) diff --git a/src/playsim/p_visualthinker.h b/src/playsim/p_visualthinker.h index 9fb5eae65..16043effd 100644 --- a/src/playsim/p_visualthinker.h +++ b/src/playsim/p_visualthinker.h @@ -51,7 +51,7 @@ public: static DVisualThinker* NewVisualThinker(FLevelLocals* Level, PClass* type); void SetTranslation(FName trname); - int GetRenderStyle(); + int GetRenderStyle() const; bool isFrozen(); int GetLightLevel(sector_t *rendersector) const; FVector3 InterpolatedPosition(double ticFrac) const; diff --git a/wadsrc/static/zscript/visualthinker.zs b/wadsrc/static/zscript/visualthinker.zs index 2b6d9a842..d5dc2253a 100644 --- a/wadsrc/static/zscript/visualthinker.zs +++ b/wadsrc/static/zscript/visualthinker.zs @@ -26,7 +26,10 @@ Class VisualThinker : Thinker native native Sector CurSector; // can be null! + virtual void BeginPlay() {} + native void SetTranslation(Name trans); + native clearscope ERenderStyle GetRenderStyle() const; native void SetRenderStyle(int mode); // see ERenderStyle native bool IsFrozen();