Skip to content

Commit

Permalink
Added ability to get texture name from script
Browse files Browse the repository at this point in the history
Use TexMan.GetName(TextureID tex) member function
  • Loading branch information
alexey-lysiuk committed Oct 24, 2017
1 parent 714259d commit f40a314
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/textures/texturemanager.cpp
Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions wadsrc/static/zscript/base.txt
Expand Up @@ -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);
Expand Down

0 comments on commit f40a314

Please sign in to comment.