Added Wads.FindLump() to ZScript

https://forum.zdoom.org/viewtopic.php?t=57814
This commit is contained in:
alexey.lysiuk 2017-10-29 10:06:52 +02:00
parent 527cc7ecf1
commit 91fda180de
2 changed files with 17 additions and 0 deletions

View file

@ -1086,6 +1086,16 @@ int FWadCollection::FindLump (const char *name, int *lastlump, bool anyns)
return -1; return -1;
} }
DEFINE_ACTION_FUNCTION(_Wads, FindLump)
{
PARAM_PROLOGUE;
PARAM_STRING(name);
PARAM_INT_DEF(startlump);
PARAM_INT_DEF(ns);
const bool isLumpValid = startlump >= 0 && startlump < Wads.GetNumLumps();
ACTION_RETURN_INT(isLumpValid ? Wads.FindLump(name, &startlump, 0 != ns) : -1);
}
//========================================================================== //==========================================================================
// //
// W_FindLumpMulti // W_FindLumpMulti

View file

@ -631,7 +631,14 @@ struct Wads
ns_firstskin, ns_firstskin,
} }
enum FindLumpNamespace
{
GlobalNamespace = 0,
AnyNamespace = 1,
}
native static int CheckNumForName(string name, int ns, int wadnum = -1, bool exact = false); native static int CheckNumForName(string name, int ns, int wadnum = -1, bool exact = false);
native static int FindLump(string name, int startlump = 0, FindLumpNamespace ns = GlobalNamespace);
} }
struct TerrainDef native struct TerrainDef native