- exported several Wads.GetLump...() methods to ZScript

* GetLumpName() returns 8-characters lump name
* GetLumpFullName() returns full name with path and extension
* GetLumpNamespace() returns lump's namespace
* GetNumLumps() returns total number of lumps

https://forum.zdoom.org/viewtopic.php?t=66285
This commit is contained in:
alexey.lysiuk 2019-11-25 17:37:56 +02:00 committed by drfrag
parent b47e331c15
commit 7160219b63
2 changed files with 34 additions and 0 deletions

View file

@ -375,6 +375,12 @@ int FWadCollection::GetNumLumps () const
return NumLumps; return NumLumps;
} }
DEFINE_ACTION_FUNCTION(_Wads, GetNumLumps)
{
PARAM_PROLOGUE;
ACTION_RETURN_INT(Wads.GetNumLumps());
}
//========================================================================== //==========================================================================
// //
// GetNumFiles // GetNumFiles
@ -1199,6 +1205,15 @@ void FWadCollection::GetLumpName(FString &to, int lump) const
} }
} }
DEFINE_ACTION_FUNCTION(_Wads, GetLumpName)
{
PARAM_PROLOGUE;
PARAM_INT(lump);
FString lumpname;
Wads.GetLumpName(lumpname, lump);
ACTION_RETURN_STRING(lumpname);
}
//========================================================================== //==========================================================================
// //
// FWadCollection :: GetLumpFullName // FWadCollection :: GetLumpFullName
@ -1217,6 +1232,13 @@ const char *FWadCollection::GetLumpFullName (int lump) const
return LumpInfo[lump].lump->Name; return LumpInfo[lump].lump->Name;
} }
DEFINE_ACTION_FUNCTION(_Wads, GetLumpFullName)
{
PARAM_PROLOGUE;
PARAM_INT(lump);
ACTION_RETURN_STRING(Wads.GetLumpFullName(lump));
}
//========================================================================== //==========================================================================
// //
// FWadCollection :: GetLumpFullPath // FWadCollection :: GetLumpFullPath
@ -1250,6 +1272,13 @@ int FWadCollection::GetLumpNamespace (int lump) const
return LumpInfo[lump].lump->Namespace; return LumpInfo[lump].lump->Namespace;
} }
DEFINE_ACTION_FUNCTION(_Wads, GetLumpNamespace)
{
PARAM_PROLOGUE;
PARAM_INT(lump);
ACTION_RETURN_INT(Wads.GetLumpNamespace(lump));
}
//========================================================================== //==========================================================================
// //
// FWadCollection :: GetLumpIndexNum // FWadCollection :: GetLumpIndexNum

View file

@ -852,6 +852,11 @@ struct Wads
native static int CheckNumForFullName(string name); native static int CheckNumForFullName(string name);
native static int FindLump(string name, int startlump = 0, FindLumpNamespace ns = GlobalNamespace); native static int FindLump(string name, int startlump = 0, FindLumpNamespace ns = GlobalNamespace);
native static string ReadLump(int lump); native static string ReadLump(int lump);
native static int GetNumLumps();
native static string GetLumpName(int lump);
native static string GetLumpFullName(int lump);
native static int GetLumpNamespace(int lump);
} }
struct TerrainDef native struct TerrainDef native