aboutsummaryrefslogtreecommitdiff
path: root/NorthstarDLL/shared
diff options
context:
space:
mode:
Diffstat (limited to 'NorthstarDLL/shared')
-rw-r--r--NorthstarDLL/shared/gamepresence.cpp79
-rw-r--r--NorthstarDLL/shared/gamepresence.h47
2 files changed, 0 insertions, 126 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;
-}
diff --git a/NorthstarDLL/shared/gamepresence.h b/NorthstarDLL/shared/gamepresence.h
deleted file mode 100644
index 439ec65c..00000000
--- a/NorthstarDLL/shared/gamepresence.h
+++ /dev/null
@@ -1,47 +0,0 @@
-#pragma once
-
-#include "server/serverpresence.h"
-
-class GameStateServerPresenceReporter : public ServerPresenceReporter
-{
- void RunFrame(double flCurrentTime, const ServerPresence* pServerPresence);
-};
-
-class GameStatePresence
-{
- public:
- std::string id;
- std::string name;
- std::string description;
- std::string password; // NOTE: May be empty
-
- bool isServer;
- bool isLocal = false;
- bool isLoading;
- bool isLobby;
- std::string loadingLevel;
-
- std::string uiMap;
-
- std::string map;
- std::string mapDisplayname;
- std::string playlist;
- std::string playlistDisplayname;
-
- int currentPlayers;
- int maxPlayers;
-
- int ownScore;
- int otherHighestScore; // NOTE: The highest score OR the second highest score if we have the highest
- int maxScore;
-
- int timestampEnd;
-
- GameStatePresence();
- void RunFrame();
-
- protected:
- GameStateServerPresenceReporter m_GameStateServerPresenceReporter;
-};
-
-extern GameStatePresence* g_pGameStatePresence;