aboutsummaryrefslogtreecommitdiff
path: root/NorthstarDedicatedTest/scriptmodmenu.cpp
diff options
context:
space:
mode:
authorBobTheBob <32057864+BobTheBob9@users.noreply.github.com>2022-05-09 16:42:33 +0100
committerBobTheBob <32057864+BobTheBob9@users.noreply.github.com>2022-05-09 16:42:33 +0100
commit5a58dd1c05e943d6b440bea5b4a6ae80ce16841e (patch)
tree9ea18142c2e2885b990671c04db4786aa05f86f3 /NorthstarDedicatedTest/scriptmodmenu.cpp
parent77a1195d77034c00959dfd030e2eb7a57d58a88d (diff)
downloadNorthstarLauncher-5a58dd1c05e943d6b440bea5b4a6ae80ce16841e.tar.gz
NorthstarLauncher-5a58dd1c05e943d6b440bea5b4a6ae80ce16841e.zip
refactor some squirrel stuff and ingame compilation error message
Diffstat (limited to 'NorthstarDedicatedTest/scriptmodmenu.cpp')
-rw-r--r--NorthstarDedicatedTest/scriptmodmenu.cpp62
1 files changed, 31 insertions, 31 deletions
diff --git a/NorthstarDedicatedTest/scriptmodmenu.cpp b/NorthstarDedicatedTest/scriptmodmenu.cpp
index c31f24cf..e27634f2 100644
--- a/NorthstarDedicatedTest/scriptmodmenu.cpp
+++ b/NorthstarDedicatedTest/scriptmodmenu.cpp
@@ -7,12 +7,12 @@
// array<string> function NSGetModNames()
SQRESULT SQ_GetModNames(void* sqvm)
{
- g_ClientSquirrelManager->sq_newarray(sqvm, 0);
+ g_pClientSquirrel->sq_newarray(sqvm, 0);
for (Mod& mod : g_ModManager->m_loadedMods)
{
- g_ClientSquirrelManager->sq_pushstring(sqvm, mod.Name.c_str(), -1);
- g_ClientSquirrelManager->sq_arrayappend(sqvm, -2);
+ g_pClientSquirrel->sq_pushstring(sqvm, mod.Name.c_str(), -1);
+ g_pClientSquirrel->sq_arrayappend(sqvm, -2);
}
return SQRESULT_NOTNULL;
@@ -21,14 +21,14 @@ SQRESULT SQ_GetModNames(void* sqvm)
// bool function NSIsModEnabled(string modName)
SQRESULT SQ_IsModEnabled(void* sqvm)
{
- const SQChar* modName = g_ClientSquirrelManager->sq_getstring(sqvm, 1);
+ const SQChar* modName = g_pClientSquirrel->sq_getstring(sqvm, 1);
// manual lookup, not super performant but eh not a big deal
for (Mod& mod : g_ModManager->m_loadedMods)
{
if (!mod.Name.compare(modName))
{
- g_ClientSquirrelManager->sq_pushbool(sqvm, mod.Enabled);
+ g_pClientSquirrel->sq_pushbool(sqvm, mod.Enabled);
return SQRESULT_NOTNULL;
}
}
@@ -39,8 +39,8 @@ SQRESULT SQ_IsModEnabled(void* sqvm)
// void function NSSetModEnabled(string modName, bool enabled)
SQRESULT SQ_SetModEnabled(void* sqvm)
{
- const SQChar* modName = g_ClientSquirrelManager->sq_getstring(sqvm, 1);
- const SQBool enabled = g_ClientSquirrelManager->sq_getbool(sqvm, 2);
+ const SQChar* modName = g_pClientSquirrel->sq_getstring(sqvm, 1);
+ const SQBool enabled = g_pClientSquirrel->sq_getbool(sqvm, 2);
// manual lookup, not super performant but eh not a big deal
for (Mod& mod : g_ModManager->m_loadedMods)
@@ -58,14 +58,14 @@ SQRESULT SQ_SetModEnabled(void* sqvm)
// string function NSGetModDescriptionByModName(string modName)
SQRESULT SQ_GetModDescription(void* sqvm)
{
- const SQChar* modName = g_ClientSquirrelManager->sq_getstring(sqvm, 1);
+ const SQChar* modName = g_pClientSquirrel->sq_getstring(sqvm, 1);
// manual lookup, not super performant but eh not a big deal
for (Mod& mod : g_ModManager->m_loadedMods)
{
if (!mod.Name.compare(modName))
{
- g_ClientSquirrelManager->sq_pushstring(sqvm, mod.Description.c_str(), -1);
+ g_pClientSquirrel->sq_pushstring(sqvm, mod.Description.c_str(), -1);
return SQRESULT_NOTNULL;
}
}
@@ -76,14 +76,14 @@ SQRESULT SQ_GetModDescription(void* sqvm)
// string function NSGetModVersionByModName(string modName)
SQRESULT SQ_GetModVersion(void* sqvm)
{
- const SQChar* modName = g_ClientSquirrelManager->sq_getstring(sqvm, 1);
+ const SQChar* modName = g_pClientSquirrel->sq_getstring(sqvm, 1);
// manual lookup, not super performant but eh not a big deal
for (Mod& mod : g_ModManager->m_loadedMods)
{
if (!mod.Name.compare(modName))
{
- g_ClientSquirrelManager->sq_pushstring(sqvm, mod.Version.c_str(), -1);
+ g_pClientSquirrel->sq_pushstring(sqvm, mod.Version.c_str(), -1);
return SQRESULT_NOTNULL;
}
}
@@ -94,14 +94,14 @@ SQRESULT SQ_GetModVersion(void* sqvm)
// string function NSGetModDownloadLinkByModName(string modName)
SQRESULT SQ_GetModDownloadLink(void* sqvm)
{
- const SQChar* modName = g_ClientSquirrelManager->sq_getstring(sqvm, 1);
+ const SQChar* modName = g_pClientSquirrel->sq_getstring(sqvm, 1);
// manual lookup, not super performant but eh not a big deal
for (Mod& mod : g_ModManager->m_loadedMods)
{
if (!mod.Name.compare(modName))
{
- g_ClientSquirrelManager->sq_pushstring(sqvm, mod.DownloadLink.c_str(), -1);
+ g_pClientSquirrel->sq_pushstring(sqvm, mod.DownloadLink.c_str(), -1);
return SQRESULT_NOTNULL;
}
}
@@ -112,14 +112,14 @@ SQRESULT SQ_GetModDownloadLink(void* sqvm)
// int function NSGetModLoadPriority(string modName)
SQRESULT SQ_GetModLoadPriority(void* sqvm)
{
- const SQChar* modName = g_ClientSquirrelManager->sq_getstring(sqvm, 1);
+ const SQChar* modName = g_pClientSquirrel->sq_getstring(sqvm, 1);
// manual lookup, not super performant but eh not a big deal
for (Mod& mod : g_ModManager->m_loadedMods)
{
if (!mod.Name.compare(modName))
{
- g_ClientSquirrelManager->sq_pushinteger(sqvm, mod.LoadPriority);
+ g_pClientSquirrel->sq_pushinteger(sqvm, mod.LoadPriority);
return SQRESULT_NOTNULL;
}
}
@@ -130,14 +130,14 @@ SQRESULT SQ_GetModLoadPriority(void* sqvm)
// bool function NSIsModRequiredOnClient(string modName)
SQRESULT SQ_IsModRequiredOnClient(void* sqvm)
{
- const SQChar* modName = g_ClientSquirrelManager->sq_getstring(sqvm, 1);
+ const SQChar* modName = g_pClientSquirrel->sq_getstring(sqvm, 1);
// manual lookup, not super performant but eh not a big deal
for (Mod& mod : g_ModManager->m_loadedMods)
{
if (!mod.Name.compare(modName))
{
- g_ClientSquirrelManager->sq_pushbool(sqvm, mod.RequiredOnClient);
+ g_pClientSquirrel->sq_pushbool(sqvm, mod.RequiredOnClient);
return SQRESULT_NOTNULL;
}
}
@@ -148,8 +148,8 @@ SQRESULT SQ_IsModRequiredOnClient(void* sqvm)
// array<string> function NSGetModConvarsByModName(string modName)
SQRESULT SQ_GetModConvars(void* sqvm)
{
- const SQChar* modName = g_ClientSquirrelManager->sq_getstring(sqvm, 1);
- g_ClientSquirrelManager->sq_newarray(sqvm, 0);
+ const SQChar* modName = g_pClientSquirrel->sq_getstring(sqvm, 1);
+ g_pClientSquirrel->sq_newarray(sqvm, 0);
// manual lookup, not super performant but eh not a big deal
for (Mod& mod : g_ModManager->m_loadedMods)
@@ -158,8 +158,8 @@ SQRESULT SQ_GetModConvars(void* sqvm)
{
for (ModConVar* cvar : mod.ConVars)
{
- g_ClientSquirrelManager->sq_pushstring(sqvm, cvar->Name.c_str(), -1);
- g_ClientSquirrelManager->sq_arrayappend(sqvm, -2);
+ g_pClientSquirrel->sq_pushstring(sqvm, cvar->Name.c_str(), -1);
+ g_pClientSquirrel->sq_arrayappend(sqvm, -2);
}
return SQRESULT_NOTNULL;
@@ -178,27 +178,27 @@ SQRESULT SQ_ReloadMods(void* sqvm)
ON_DLL_LOAD_CLIENT_RELIESON("client.dll", ScriptModMenu, ClientSquirrel, (HMODULE baseAddress)
{
- g_UISquirrelManager->AddFuncRegistration("array<string>", "NSGetModNames", "", "Returns the names of all loaded mods", SQ_GetModNames);
- g_UISquirrelManager->AddFuncRegistration(
+ g_pUISquirrel->AddFuncRegistration("array<string>", "NSGetModNames", "", "Returns the names of all loaded mods", SQ_GetModNames);
+ g_pUISquirrel->AddFuncRegistration(
"bool", "NSIsModEnabled", "string modName", "Returns whether a given mod is enabled", SQ_IsModEnabled);
- g_UISquirrelManager->AddFuncRegistration(
+ g_pUISquirrel->AddFuncRegistration(
"void", "NSSetModEnabled", "string modName, bool enabled", "Sets whether a given mod is enabled", SQ_SetModEnabled);
- g_UISquirrelManager->AddFuncRegistration(
+ g_pUISquirrel->AddFuncRegistration(
"string", "NSGetModDescriptionByModName", "string modName", "Returns a given mod's description", SQ_GetModDescription);
- g_UISquirrelManager->AddFuncRegistration(
+ g_pUISquirrel->AddFuncRegistration(
"string", "NSGetModVersionByModName", "string modName", "Returns a given mod's version", SQ_GetModVersion);
- g_UISquirrelManager->AddFuncRegistration(
+ g_pUISquirrel->AddFuncRegistration(
"string", "NSGetModDownloadLinkByModName", "string modName", "Returns a given mod's download link", SQ_GetModDownloadLink);
- g_UISquirrelManager->AddFuncRegistration(
+ g_pUISquirrel->AddFuncRegistration(
"bool",
"NSIsModRequiredOnClient",
"string modName",
"Returns whether a given mod is required on connecting clients",
SQ_IsModRequiredOnClient);
- g_UISquirrelManager->AddFuncRegistration(
+ g_pUISquirrel->AddFuncRegistration(
"int", "NSGetModLoadPriority", "string modName", "Returns a given mod's load priority", SQ_GetModLoadPriority);
- g_UISquirrelManager->AddFuncRegistration(
+ g_pUISquirrel->AddFuncRegistration(
"array<string>", "NSGetModConvarsByModName", "string modName", "Returns the names of all a given mod's cvars", SQ_GetModConvars);
- g_UISquirrelManager->AddFuncRegistration("void", "NSReloadMods", "", "Reloads mods", SQ_ReloadMods);
+ g_pUISquirrel->AddFuncRegistration("void", "NSReloadMods", "", "Reloads mods", SQ_ReloadMods);
}) \ No newline at end of file