From 4d88e82e32ac2ccf876903dd122e85195fdaa0da Mon Sep 17 00:00:00 2001 From: Professor Hastig Date: Thu, 26 Oct 2023 11:41:45 +0200 Subject: [PATCH] added Wads.GetLumpLength. --- src/common/scripting/interface/vmnatives.cpp | 7 +++++++ wadsrc/static/zscript/engine/base.zs | 1 + 2 files changed, 8 insertions(+) diff --git a/src/common/scripting/interface/vmnatives.cpp b/src/common/scripting/interface/vmnatives.cpp index 096722e76d..1df737d165 100644 --- a/src/common/scripting/interface/vmnatives.cpp +++ b/src/common/scripting/interface/vmnatives.cpp @@ -848,6 +848,13 @@ DEFINE_ACTION_FUNCTION(_Wads, ReadLump) ACTION_RETURN_STRING(isLumpValid ? GetStringFromLump(lump, false) : FString()); } +DEFINE_ACTION_FUNCTION(_Wads, GetLumpLength) +{ + PARAM_PROLOGUE; + PARAM_INT(lump); + ACTION_RETURN_INT(fileSystem.FileLength(lump)); +} + //========================================================================== // // CVARs diff --git a/wadsrc/static/zscript/engine/base.zs b/wadsrc/static/zscript/engine/base.zs index c0754f7054..2644dc197d 100644 --- a/wadsrc/static/zscript/engine/base.zs +++ b/wadsrc/static/zscript/engine/base.zs @@ -862,6 +862,7 @@ struct Wads // todo: make FileSystem an alias to 'Wads' native static int FindLump(string name, int startlump = 0, FindLumpNamespace ns = GlobalNamespace); native static int FindLumpFullName(string name, int startlump = 0, bool noext = false); native static string ReadLump(int lump); + native static int GetLumpLength(int lump); native static int GetNumLumps(); native static string GetLumpName(int lump);