aboutsummaryrefslogtreecommitdiff
path: root/NorthstarDLL/shared/gamepresence.cpp
diff options
context:
space:
mode:
authorcat_or_not <41955154+catornot@users.noreply.github.com>2023-11-05 20:21:50 -0500
committerGitHub <noreply@github.com>2023-11-06 02:21:50 +0100
commitbb822b7638d5ae9bc4499ff76edc74f3741e6518 (patch)
tree558886bd28dc53d1004e235be1c1543c5ec2fd9f /NorthstarDLL/shared/gamepresence.cpp
parent583bae6e1a7e35eec2c5cb4383bc0089f6ee6781 (diff)
downloadNorthstarLauncher-bb822b7638d5ae9bc4499ff76edc74f3741e6518.tar.gz
NorthstarLauncher-bb822b7638d5ae9bc4499ff76edc74f3741e6518.zip
- nuked presence logic ( moved to the discord rpc plugin ) - more exposed sq functions - exposed dll addresses - `g_pCVar` is exposed - added "userdata" to plugin's async call - added runframe to plugins
Diffstat (limited to 'NorthstarDLL/shared/gamepresence.cpp')
-rw-r--r--NorthstarDLL/shared/gamepresence.cpp79
1 files changed, 0 insertions, 79 deletions
diff --git a/NorthstarDLL/shared/gamepresence.cpp b/NorthstarDLL/shared/gamepresence.cpp
deleted file mode 100644
index 11cb7ade..00000000
--- a/NorthstarDLL/shared/gamepresence.cpp
+++ /dev/null
@@ -1,79 +0,0 @@
-#include "gamepresence.h"
-#include "plugins/pluginbackend.h"
-#include "plugins/plugins.h"
-#include "dedicated/dedicated.h"
-#include "server/serverpresence.h"
-#include "masterserver/masterserver.h"
-#include "squirrel/squirrel.h"
-
-GameStatePresence* g_pGameStatePresence;
-
-GameStatePresence::GameStatePresence()
-{
- g_pServerPresence->AddPresenceReporter(&m_GameStateServerPresenceReporter);
-}
-
-void GameStateServerPresenceReporter::RunFrame(double flCurrentTime, const ServerPresence* pServerPresence)
-{
- g_pGameStatePresence->id = pServerPresence->m_sServerId;
- g_pGameStatePresence->name = pServerPresence->m_sServerName;
- g_pGameStatePresence->description = pServerPresence->m_sServerDesc;
- g_pGameStatePresence->password = pServerPresence->m_Password;
-
- g_pGameStatePresence->map = pServerPresence->m_MapName;
- g_pGameStatePresence->playlist = pServerPresence->m_PlaylistName;
- g_pGameStatePresence->currentPlayers = pServerPresence->m_iPlayerCount;
- g_pGameStatePresence->maxPlayers = pServerPresence->m_iMaxPlayers;
-
- g_pGameStatePresence->isLocal = !IsDedicatedServer();
-}
-
-void GameStatePresence::RunFrame()
-{
- if (g_pSquirrel<ScriptContext::UI>->m_pSQVM != nullptr && g_pSquirrel<ScriptContext::UI>->m_pSQVM->sqvm != nullptr)
- g_pSquirrel<ScriptContext::UI>->Call("NorthstarCodeCallback_GenerateUIPresence");
-
- if (g_pSquirrel<ScriptContext::CLIENT>->m_pSQVM != nullptr && g_pSquirrel<ScriptContext::CLIENT>->m_pSQVM->sqvm != nullptr)
- {
- auto test = g_pSquirrel<ScriptContext::CLIENT>->Call("NorthstarCodeCallback_GenerateGameState");
- }
- g_pPluginCommunicationhandler->GeneratePresenceObjects();
-}
-
-ADD_SQFUNC("void", NSPushGameStateData, "GameStateStruct gamestate", "", ScriptContext::CLIENT)
-{
- SQStructInstance* structInst = g_pSquirrel<ScriptContext::CLIENT>->m_pSQVM->sqvm->_stackOfCurrentFunction[1]._VAL.asStructInstance;
- g_pGameStatePresence->map = structInst->data[0]._VAL.asString->_val;
- g_pGameStatePresence->mapDisplayname = structInst->data[1]._VAL.asString->_val;
- g_pGameStatePresence->playlist = structInst->data[2]._VAL.asString->_val;
- g_pGameStatePresence->playlistDisplayname = structInst->data[3]._VAL.asString->_val;
-
- g_pGameStatePresence->currentPlayers = structInst->data[4]._VAL.asInteger;
- g_pGameStatePresence->maxPlayers = structInst->data[5]._VAL.asInteger;
- g_pGameStatePresence->ownScore = structInst->data[6]._VAL.asInteger;
- g_pGameStatePresence->otherHighestScore = structInst->data[7]._VAL.asInteger;
- g_pGameStatePresence->maxScore = structInst->data[8]._VAL.asInteger;
- g_pGameStatePresence->timestampEnd = ceil(structInst->data[9]._VAL.asFloat);
-
- if (g_pMasterServerManager->m_currentServer)
- {
- g_pGameStatePresence->id = g_pMasterServerManager->m_currentServer->id;
- g_pGameStatePresence->name = g_pMasterServerManager->m_currentServer->name;
- g_pGameStatePresence->description = g_pMasterServerManager->m_currentServer->description;
- g_pGameStatePresence->password = g_pMasterServerManager->m_sCurrentServerPassword;
- }
-
- return SQRESULT_NOTNULL;
-}
-
-ADD_SQFUNC("void", NSPushUIPresence, "UIPresenceStruct presence", "", ScriptContext::UI)
-{
- SQStructInstance* structInst = g_pSquirrel<ScriptContext::UI>->m_pSQVM->sqvm->_stackOfCurrentFunction[1]._VAL.asStructInstance;
-
- g_pGameStatePresence->isLoading = structInst->data[0]._VAL.asInteger;
- g_pGameStatePresence->isLobby = structInst->data[1]._VAL.asInteger;
- g_pGameStatePresence->loadingLevel = structInst->data[2]._VAL.asString->_val;
- g_pGameStatePresence->uiMap = structInst->data[3]._VAL.asString->_val;
-
- return SQRESULT_NOTNULL;
-}