From f40a31409d54074b77ec3815231d7d6edce3a9ea Mon Sep 17 00:00:00 2001 From: "alexey.lysiuk" Date: Tue, 24 Oct 2017 11:11:33 +0300 Subject: [PATCH] Added ability to get texture name from script Use TexMan.GetName(TextureID tex) member function --- src/textures/texturemanager.cpp | 14 ++++++++++++++ wadsrc/static/zscript/base.txt | 1 + 2 files changed, 15 insertions(+) diff --git a/src/textures/texturemanager.cpp b/src/textures/texturemanager.cpp index f7d9a539b29..f7aa4926de1 100644 --- a/src/textures/texturemanager.cpp +++ b/src/textures/texturemanager.cpp @@ -1202,6 +1202,20 @@ int FTextureManager::CountLumpTextures (int lumpnum) // //========================================================================== +DEFINE_ACTION_FUNCTION(_TexMan, GetName) +{ + PARAM_PROLOGUE; + PARAM_INT(texid); + const FTexture* const tex = TexMan.ByIndex(texid); + ACTION_RETURN_STRING(nullptr == tex ? FString() : tex->Name); +} + +//========================================================================== +// +// +// +//========================================================================== + DEFINE_ACTION_FUNCTION(_TexMan, GetSize) { PARAM_PROLOGUE; diff --git a/wadsrc/static/zscript/base.txt b/wadsrc/static/zscript/base.txt index 898265995e3..5575f3d0cd6 100644 --- a/wadsrc/static/zscript/base.txt +++ b/wadsrc/static/zscript/base.txt @@ -90,6 +90,7 @@ struct TexMan native static TextureID CheckForTexture(String name, int usetype, int flags = TryAny); native static void ReplaceTextures(String from, String to, int flags); + native static String GetName(TextureID tex); native static int, int GetSize(TextureID tex); native static Vector2 GetScaledSize(TextureID tex); native static Vector2 GetScaledOffset(TextureID tex);