diff --git a/src/gameui/GameScriptFunctions.cpp b/src/gameui/GameScriptFunctions.cpp index c06d9ee..81ffd29 100644 --- a/src/gameui/GameScriptFunctions.cpp +++ b/src/gameui/GameScriptFunctions.cpp @@ -1,5 +1,7 @@ #include "gameui/GameScriptFunctions.hpp" +#include "ui/FrameXML.hpp" #include "ui/FrameScript.hpp" +#include "util/Lua.hpp" #include "util/Unimplemented.hpp" // External from "ui/ScriptFunctions.hpp" @@ -7,7 +9,13 @@ void RegisterSimpleFrameScriptMethods(); static int32_t Script_FrameXML_Debug(lua_State* L) { - WHOA_UNIMPLEMENTED(0); + int32_t level = FrameXML_GetDebugLevel(); + if (lua_isnumber(L, 1)) { + level = static_cast(lua_tonumber(L, 1)); + FrameXML_SetDebugLevel(level); + } + lua_pushnumber(L, 1); + return 1; } static int32_t Script_GetBuildInfo(lua_State* L) { @@ -115,7 +123,12 @@ static int32_t Script_GetDebugStats(lua_State* L) { } static int32_t Script_IsDebugBuild(lua_State* L) { - WHOA_UNIMPLEMENTED(0); +#ifdef WHOA_BUILD_ASSERTIONS + lua_pushboolean(L, 1); +#else + lua_pushboolean(L, 0); +#endif + return 1; } static int32_t Script_RegisterCVar(lua_State* L) { @@ -639,15 +652,30 @@ static int32_t Script_InCinematic(lua_State* L) { } static int32_t Script_IsWindowsClient(lua_State* L) { - WHOA_UNIMPLEMENTED(0); +#ifdef WHOA_SYSTEM_WIN + lua_pushnumber(L, 1.0); +#else + lua_pushnil(L); +#endif + return 1; } static int32_t Script_IsMacClient(lua_State* L) { - WHOA_UNIMPLEMENTED(0); +#ifdef WHOA_SYSTEM_MAC + lua_pushnumber(L, 1.0); +#else + lua_pushnil(L); +#endif + return 1; } static int32_t Script_IsLinuxClient(lua_State* L) { - WHOA_UNIMPLEMENTED(0); +#ifdef WHOA_SYSTEM_LINUX + lua_pushnumber(L, 1.0); +#else + lua_pushnil(L); +#endif + return 1; } static int32_t Script_AcceptXPLoss(lua_State* L) { diff --git a/src/ui/FrameXML.cpp b/src/ui/FrameXML.cpp index 7c3c799..668b22c 100644 --- a/src/ui/FrameXML.cpp +++ b/src/ui/FrameXML.cpp @@ -272,9 +272,10 @@ int32_t FrameXML_CreateFrames(const char* tocPath, const char* a2, MD5_CTX* md5, tocData = tocData + 3; } - CStatus v21; + CStatus frameStatus; char tocLine[1024]; char tocEntryPath[260]; + int32_t v25 = 0; do { SStrTokenize(&tocData, tocLine, 1024, "\r\n", 0); @@ -307,7 +308,7 @@ int32_t FrameXML_CreateFrames(const char* tocPath, const char* a2, MD5_CTX* md5, *v12 = 0; - FrameXML_ProcessFile(tocEntryPath, a2, md5, &v21); + FrameXML_ProcessFile(tocEntryPath, a2, md5, &frameStatus); // TODO // if (s_progressCallback && s_progressFiles < s_progressTotal) { @@ -324,13 +325,11 @@ int32_t FrameXML_CreateFrames(const char* tocPath, const char* a2, MD5_CTX* md5, SFile::Unload(tocBuffer); - // TODO - // if (s_debugLevel > 0 || v25 > 0) { - // v21.Prepend(STATUS_INFO, "** Loading table of contents %s", v5); - // } + if (FrameXML::s_debugLevel > 0 || v25 > 0) { + frameStatus.Prepend(STATUS_INFO, "** Loading table of contents %s", v5); + } - // TODO - // status->Add(v21); + status->Add(frameStatus); return 1; } @@ -417,7 +416,7 @@ int32_t FrameXML_ProcessFile(const char* filePath, const char* a2, MD5_CTX* md5, return 0; } - CStatus unkStatus; + CStatus fileStatus; XMLNode* node = XMLTree_GetRoot(tree)->m_child; @@ -428,6 +427,8 @@ int32_t FrameXML_ProcessFile(const char* filePath, const char* a2, MD5_CTX* md5, // Should come from some kind of Lua headers const char* lua_tainted = nullptr; + int32_t v34 = 0; + while (node) { // if (!SStrCmpI(node->GetName(), "Include", 0x7FFFFFFFu)) { @@ -448,9 +449,9 @@ int32_t FrameXML_ProcessFile(const char* filePath, const char* a2, MD5_CTX* md5, SStrCopy(v27, v14, 260); } - FrameXML_ProcessFile(v27, a2, md5, &unkStatus); + FrameXML_ProcessFile(v27, a2, md5, &fileStatus); } else { - unkStatus.Add(STATUS_ERROR, "Element 'Include' without file attribute"); + fileStatus.Add(STATUS_ERROR, "Element 'Include' without file attribute"); } //