From d0c77d72647e62e68686bf8c2a7181a1cb8009ff Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Wed, 15 Mar 2017 10:36:41 +0100 Subject: [PATCH] - added a GetRenderStyle function to Actor, so that the internal render style can be retrieved in a format suitable for scripting. --- src/p_actionfunctions.cpp | 14 +++++++++++++- wadsrc/static/zscript/actor.txt | 1 + 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/p_actionfunctions.cpp b/src/p_actionfunctions.cpp index 38736e033..a0794f1d6 100644 --- a/src/p_actionfunctions.cpp +++ b/src/p_actionfunctions.cpp @@ -6796,4 +6796,16 @@ DEFINE_ACTION_FUNCTION(AActor, A_SetMugshotState) if (self->CheckLocalView(consoleplayer)) StatusBar->SetMugShotState(name); return 0; -} \ No newline at end of file +} + +// This needs to account for the fact that internally renderstyles are stored as a series of operations, +// but the script side only cares about symbolic constants. +DEFINE_ACTION_FUNCTION(AActor, GetRenderStyle) +{ + PARAM_SELF_PROLOGUE(AActor); + for(unsigned i=0;iRenderStyle == LegacyRenderStyles[i]) ACTION_RETURN_INT(i); + } + ACTION_RETURN_INT(-1); // no symbolic constant exists to handle this style. +} diff --git a/wadsrc/static/zscript/actor.txt b/wadsrc/static/zscript/actor.txt index db0a804b9..a2ef3a8b2 100644 --- a/wadsrc/static/zscript/actor.txt +++ b/wadsrc/static/zscript/actor.txt @@ -449,6 +449,7 @@ class Actor : Thinker native native void ChangeTid(int newtid); native static int FindUniqueTid(int start = 0, int limit = 0); native void SetShade(color col); + native clearscope int GetRenderStyle() const; native clearscope string GetTag(string defstr = "") const; native void SetTag(string defstr = "");