aboutsummaryrefslogtreecommitdiff
path: root/NorthstarDLL/clientchathooks.cpp
diff options
context:
space:
mode:
authorMaya <malte.hoermeyer@web.de>2022-11-13 04:01:14 +0100
committerGitHub <noreply@github.com>2022-11-13 03:01:14 +0000
commit23fda0b842560d2f3cf64ecf9a57d5ad2861e488 (patch)
tree9527c91bd744fb0562963e43e212c1bc5536847d /NorthstarDLL/clientchathooks.cpp
parentd237401bb97c1fa2d6ee87220d49e4b3343e7201 (diff)
downloadNorthstarLauncher-23fda0b842560d2f3cf64ecf9a57d5ad2861e488.tar.gz
NorthstarLauncher-23fda0b842560d2f3cf64ecf9a57d5ad2861e488.zip
Squirrel functions auto bind (#299)
* Add defines to auto add squirrel funcs it brokey * Make it Work changed all squirrel function definitions to this system * Add defines to auto add squirrel funcs it brokey Co-authored-by: Emma-Miler <27428383+emma-miler@users.noreply.github.com> * Make it Work changed all squirrel function definitions to this system Co-authored-by: Emma-Miler <27428383+emma-miler@users.noreply.github.com> * Formatting * Good old Formatting commit * HelloGecko * Formatting Finalv2ForRealThisTime * idk anymore * i hate formatting * Rename some * Rename macro * Change function names to more human-readable * Revert to using old ScriptContext definition * Formatting Co-authored-by: RoyalBlue1 <realEmail@veryRealURL.com> Co-authored-by: Emma-Miler <27428383+emma-miler@users.noreply.github.com> Co-authored-by: Emma Miler <emma.pi@protonmail.com> Co-authored-by: BobTheBob <32057864+BobTheBob9@users.noreply.github.com>
Diffstat (limited to 'NorthstarDLL/clientchathooks.cpp')
-rw-r--r--NorthstarDLL/clientchathooks.cpp31
1 files changed, 10 insertions, 21 deletions
diff --git a/NorthstarDLL/clientchathooks.cpp b/NorthstarDLL/clientchathooks.cpp
index a7a42689..3346ea2e 100644
--- a/NorthstarDLL/clientchathooks.cpp
+++ b/NorthstarDLL/clientchathooks.cpp
@@ -1,5 +1,6 @@
#include "pch.h"
#include "squirrel.h"
+
#include "serverchathooks.h"
#include "localchatwriter.h"
@@ -43,41 +44,29 @@ void, __fastcall, (void* self, const char* message, int inboxId, bool isTeam, bo
CHudChat__AddGameLine(hud, message, inboxId, isTeam, isDead);
}
-// void NSChatWrite( int context, string str )
-SQRESULT SQ_ChatWrite(HSquirrelVM* sqvm)
+ADD_SQFUNC("void", NSChatWrite, "int context, string text", "", ScriptContext::CLIENT)
{
- int context = g_pSquirrel<ScriptContext::CLIENT>->getinteger(sqvm, 1);
+ int chatContext = g_pSquirrel<ScriptContext::CLIENT>->getinteger(sqvm, 1);
const char* str = g_pSquirrel<ScriptContext::CLIENT>->getstring(sqvm, 2);
- LocalChatWriter((LocalChatWriter::Context)context).Write(str);
+ LocalChatWriter((LocalChatWriter::Context)chatContext).Write(str);
return SQRESULT_NULL;
}
-// void NSChatWriteRaw( int context, string str )
-SQRESULT SQ_ChatWriteRaw(HSquirrelVM* sqvm)
+ADD_SQFUNC("void", NSChatWriteRaw, "int context, string text", "", ScriptContext::CLIENT)
{
- int context = g_pSquirrel<ScriptContext::CLIENT>->getinteger(sqvm, 1);
+ int chatContext = g_pSquirrel<ScriptContext::CLIENT>->getinteger(sqvm, 1);
const char* str = g_pSquirrel<ScriptContext::CLIENT>->getstring(sqvm, 2);
- LocalChatWriter((LocalChatWriter::Context)context).InsertText(str);
+ LocalChatWriter((LocalChatWriter::Context)chatContext).InsertText(str);
return SQRESULT_NULL;
}
-// void NSChatWriteLine( int context, string str )
-SQRESULT SQ_ChatWriteLine(HSquirrelVM* sqvm)
+ADD_SQFUNC("void", NSChatWriteLine, "int context, string text", "", ScriptContext::CLIENT)
{
- int context = g_pSquirrel<ScriptContext::CLIENT>->getinteger(sqvm, 1);
+ int chatContext = g_pSquirrel<ScriptContext::CLIENT>->getinteger(sqvm, 1);
const char* str = g_pSquirrel<ScriptContext::CLIENT>->getstring(sqvm, 2);
- LocalChatWriter((LocalChatWriter::Context)context).WriteLine(str);
+ LocalChatWriter((LocalChatWriter::Context)chatContext).WriteLine(str);
return SQRESULT_NULL;
}
-
-ON_DLL_LOAD_CLIENT_RELIESON("client.dll", ClientChatHooks, ClientSquirrel, (CModule module))
-{
- AUTOHOOK_DISPATCH()
-
- g_pSquirrel<ScriptContext::CLIENT>->AddFuncRegistration("void", "NSChatWrite", "int context, string text", "", SQ_ChatWrite);
- g_pSquirrel<ScriptContext::CLIENT>->AddFuncRegistration("void", "NSChatWriteRaw", "int context, string text", "", SQ_ChatWriteRaw);
- g_pSquirrel<ScriptContext::CLIENT>->AddFuncRegistration("void", "NSChatWriteLine", "int context, string text", "", SQ_ChatWriteLine);
-}