- added a GetRenderStyle function to Actor, so that the internal render style can be retrieved in a format suitable for scripting.

This commit is contained in:
Christoph Oelckers 2017-03-15 10:36:41 +01:00
parent fea2361815
commit d0c77d7264
2 changed files with 14 additions and 1 deletions

View file

@ -6796,4 +6796,16 @@ DEFINE_ACTION_FUNCTION(AActor, A_SetMugshotState)
if (self->CheckLocalView(consoleplayer))
StatusBar->SetMugShotState(name);
return 0;
}
}
// 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;i<STYLE_Count;i++)
{
if (self->RenderStyle == LegacyRenderStyles[i]) ACTION_RETURN_INT(i);
}
ACTION_RETURN_INT(-1); // no symbolic constant exists to handle this style.
}

View file

@ -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 = "");