mirror of
https://github.com/ZDoom/gzdoom.git
synced 2025-03-13 22:42:07 +00:00
Improvements for VisualThinkers
Added BeginPlay virtual that's called after construction. Added getter for render style in ZScript.
This commit is contained in:
parent
98b5d8b1d2
commit
3db1ee9a1e
3 changed files with 26 additions and 2 deletions
|
@ -1052,6 +1052,16 @@ DVisualThinker* DVisualThinker::NewVisualThinker(FLevelLocals* Level, PClass* ty
|
|||
|
||||
auto zs = static_cast<DVisualThinker*>(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)
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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();
|
||||
|
||||
|
|
Loading…
Reference in a new issue