From 8c10ac6f381cba2d5f56493beccaab923a4e737d Mon Sep 17 00:00:00 2001 From: Boondorl Date: Sat, 17 Aug 2024 11:29:23 -0400 Subject: [PATCH] Added GetDecalName() --- src/gamedata/decallib.cpp | 5 +++++ src/gamedata/decallib.h | 1 + src/playsim/a_decals.cpp | 17 +++++++++++++++++ wadsrc/static/zscript/actors/actor.zs | 1 + 4 files changed, 24 insertions(+) diff --git a/src/gamedata/decallib.cpp b/src/gamedata/decallib.cpp index 8dee4e7fd4..6243502f84 100644 --- a/src/gamedata/decallib.cpp +++ b/src/gamedata/decallib.cpp @@ -205,6 +205,11 @@ const FDecalTemplate *FDecalBase::GetDecal () const return NULL; } +FName FDecalBase::GetDecalName() const +{ + return Name; +} + void FDecalTemplate::ReplaceDecalRef(FDecalBase *from, FDecalBase *to) { if (LowerDecal == from) diff --git a/src/gamedata/decallib.h b/src/gamedata/decallib.h index d077c6c460..ac07b252f1 100644 --- a/src/gamedata/decallib.h +++ b/src/gamedata/decallib.h @@ -53,6 +53,7 @@ class FDecalBase public: virtual const FDecalTemplate *GetDecal () const; virtual void ReplaceDecalRef (FDecalBase *from, FDecalBase *to) = 0; + FName GetDecalName() const; protected: FDecalBase (); diff --git a/src/playsim/a_decals.cpp b/src/playsim/a_decals.cpp index 1d9aa9b266..1c0fd47124 100644 --- a/src/playsim/a_decals.cpp +++ b/src/playsim/a_decals.cpp @@ -934,3 +934,20 @@ DEFINE_ACTION_FUNCTION_NATIVE(ADecal, SpawnDecal, SpawnDecal) SpawnDecal(self); return 0; } + +//---------------------------------------------------------------------------- +// +// +// +//---------------------------------------------------------------------------- + +static int GetDecalName(AActor* self) +{ + return self->DecalGenerator != nullptr ? self->DecalGenerator->GetDecalName().GetIndex() : NAME_None; +} + +DEFINE_ACTION_FUNCTION_NATIVE(AActor, GetDecalName, GetDecalName) +{ + PARAM_SELF_PROLOGUE(AActor); + ACTION_RETURN_INT(GetDecalName(self)); +} diff --git a/wadsrc/static/zscript/actors/actor.zs b/wadsrc/static/zscript/actors/actor.zs index 584b466aff..31dc080526 100644 --- a/wadsrc/static/zscript/actors/actor.zs +++ b/wadsrc/static/zscript/actors/actor.zs @@ -715,6 +715,7 @@ class Actor : Thinker native native void ClearFOVInterpolation(); native clearscope Vector3 PosRelative(sector sec) const; native void RailAttack(FRailParams p); + native clearscope Name GetDecalName() const; native void HandleSpawnFlags(); native void ExplodeMissile(line lin = null, Actor target = null, bool onsky = false);