diff options
author | Emma Miler <emma.pi@protonmail.com> | 2022-12-19 19:32:16 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-12-19 19:32:16 +0100 |
commit | e04f3b36accccb590a2d51b4829256b9964ac3fd (patch) | |
tree | 20ee30c82e6f53e6e772be2e1b9613eebca12bf3 /NorthstarDLL/clientchathooks.cpp | |
parent | 33f18a735986dcd136bf8ba70ad8331306c28227 (diff) | |
download | NorthstarLauncher-e04f3b36accccb590a2d51b4829256b9964ac3fd.tar.gz NorthstarLauncher-e04f3b36accccb590a2d51b4829256b9964ac3fd.zip |
Restructuring (#365)
* Remove launcher proxy
* Restructuring
* More restructuring
* Fix include dirs
* Fix merge
* Remove clang thing
* Filters
* Oops
Diffstat (limited to 'NorthstarDLL/clientchathooks.cpp')
-rw-r--r-- | NorthstarDLL/clientchathooks.cpp | 70 |
1 files changed, 0 insertions, 70 deletions
diff --git a/NorthstarDLL/clientchathooks.cpp b/NorthstarDLL/clientchathooks.cpp deleted file mode 100644 index 847b5eb1..00000000 --- a/NorthstarDLL/clientchathooks.cpp +++ /dev/null @@ -1,70 +0,0 @@ -#include "pch.h" -#include "squirrel.h" - -#include "serverchathooks.h" -#include "localchatwriter.h" - -#include <rapidjson/document.h> - -AUTOHOOK_INIT() - -// clang-format off -AUTOHOOK(CHudChat__AddGameLine, client.dll + 0x22E580, -void, __fastcall, (void* self, const char* message, int inboxId, bool isTeam, bool isDead)) -// clang-format on -{ - // This hook is called for each HUD, but we only want our logic to run once. - if (self != *CHudChat::allHuds) - return; - - int senderId = inboxId & CUSTOM_MESSAGE_INDEX_MASK; - bool isAnonymous = senderId == 0; - bool isCustom = isAnonymous || (inboxId & CUSTOM_MESSAGE_INDEX_BIT); - - // Type is set to 0 for non-custom messages, custom messages have a type encoded as the first byte - int type = 0; - const char* payload = message; - if (isCustom) - { - type = message[0]; - payload = message + 1; - } - - SQRESULT result = g_pSquirrel<ScriptContext::CLIENT>->Call( - "CHudChat_ProcessMessageStartThread", static_cast<int>(senderId) - 1, payload, isTeam, isDead, type); - if (result == SQRESULT_ERROR) - for (CHudChat* hud = *CHudChat::allHuds; hud != NULL; hud = hud->next) - CHudChat__AddGameLine(hud, message, inboxId, isTeam, isDead); -} - -ADD_SQFUNC("void", NSChatWrite, "int context, string text", "", ScriptContext::CLIENT) -{ - int chatContext = g_pSquirrel<ScriptContext::CLIENT>->getinteger(sqvm, 1); - const char* str = g_pSquirrel<ScriptContext::CLIENT>->getstring(sqvm, 2); - - LocalChatWriter((LocalChatWriter::Context)chatContext).Write(str); - return SQRESULT_NULL; -} - -ADD_SQFUNC("void", NSChatWriteRaw, "int context, string text", "", ScriptContext::CLIENT) -{ - int chatContext = g_pSquirrel<ScriptContext::CLIENT>->getinteger(sqvm, 1); - const char* str = g_pSquirrel<ScriptContext::CLIENT>->getstring(sqvm, 2); - - LocalChatWriter((LocalChatWriter::Context)chatContext).InsertText(str); - return SQRESULT_NULL; -} - -ADD_SQFUNC("void", NSChatWriteLine, "int context, string text", "", ScriptContext::CLIENT) -{ - int chatContext = g_pSquirrel<ScriptContext::CLIENT>->getinteger(sqvm, 1); - const char* str = g_pSquirrel<ScriptContext::CLIENT>->getstring(sqvm, 2); - - LocalChatWriter((LocalChatWriter::Context)chatContext).WriteLine(str); - return SQRESULT_NULL; -} - -ON_DLL_LOAD_CLIENT("client.dll", ClientChatHooks, (CModule module)) -{ - AUTOHOOK_DISPATCH() -} |