aboutsummaryrefslogtreecommitdiff
path: root/NorthstarDedicatedTest
diff options
context:
space:
mode:
Diffstat (limited to 'NorthstarDedicatedTest')
-rw-r--r--NorthstarDedicatedTest/NorthstarDedicatedTest.vcxproj2
-rw-r--r--NorthstarDedicatedTest/NorthstarDedicatedTest.vcxproj.filters6
-rw-r--r--NorthstarDedicatedTest/concommand.cpp3
-rw-r--r--NorthstarDedicatedTest/misccommands.cpp28
-rw-r--r--NorthstarDedicatedTest/misccommands.h3
5 files changed, 42 insertions, 0 deletions
diff --git a/NorthstarDedicatedTest/NorthstarDedicatedTest.vcxproj b/NorthstarDedicatedTest/NorthstarDedicatedTest.vcxproj
index 10f6cef4..43eda97a 100644
--- a/NorthstarDedicatedTest/NorthstarDedicatedTest.vcxproj
+++ b/NorthstarDedicatedTest/NorthstarDedicatedTest.vcxproj
@@ -311,6 +311,7 @@
<ClInclude Include="logging.h" />
<ClInclude Include="main.h" />
<ClInclude Include="masterserver.h" />
+ <ClInclude Include="misccommands.h" />
<ClInclude Include="modlocalisation.h" />
<ClInclude Include="modmanager.h" />
<ClInclude Include="pch.h" />
@@ -339,6 +340,7 @@
<ClCompile Include="hooks.cpp" />
<ClCompile Include="hookutils.cpp" />
<ClCompile Include="keyvalues.cpp" />
+ <ClCompile Include="misccommands.cpp" />
<ClCompile Include="modlocalisation.cpp" />
<ClCompile Include="logging.cpp" />
<ClCompile Include="masterserver.cpp" />
diff --git a/NorthstarDedicatedTest/NorthstarDedicatedTest.vcxproj.filters b/NorthstarDedicatedTest/NorthstarDedicatedTest.vcxproj.filters
index 524fa2e7..8908df5f 100644
--- a/NorthstarDedicatedTest/NorthstarDedicatedTest.vcxproj.filters
+++ b/NorthstarDedicatedTest/NorthstarDedicatedTest.vcxproj.filters
@@ -573,6 +573,9 @@
<ClInclude Include="dedicatedmaterialsystem.h">
<Filter>Header Files\Dedicated</Filter>
</ClInclude>
+ <ClInclude Include="misccommands.h">
+ <Filter>Header Files\Shared\Convar</Filter>
+ </ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="dllmain.cpp">
@@ -659,6 +662,9 @@
<ClCompile Include="dedicatedmaterialsystem.cpp">
<Filter>Source Files\Dedicated</Filter>
</ClCompile>
+ <ClCompile Include="misccommands.cpp">
+ <Filter>Source Files\Shared\Convar</Filter>
+ </ClCompile>
</ItemGroup>
<ItemGroup>
<None Include="include\spdlog\fmt\bundled\LICENSE.rst">
diff --git a/NorthstarDedicatedTest/concommand.cpp b/NorthstarDedicatedTest/concommand.cpp
index 5e0fab42..dff0f964 100644
--- a/NorthstarDedicatedTest/concommand.cpp
+++ b/NorthstarDedicatedTest/concommand.cpp
@@ -1,6 +1,7 @@
#include "pch.h"
#include "concommand.h"
#include "gameutils.h"
+#include "misccommands.h"
#include <iostream>
typedef void(*ConCommandConstructorType)(ConCommand* newCommand, const char* name, void(*callback)(const CCommand&), const char* helpString, int flags, void* parent);
@@ -18,4 +19,6 @@ void RegisterConCommand(const char* name, void(*callback)(const CCommand&), cons
void InitialiseConCommands(HMODULE baseAddress)
{
conCommandConstructor = (ConCommandConstructorType)((char*)baseAddress + 0x415F60);
+
+ AddMiscConCommands();
} \ No newline at end of file
diff --git a/NorthstarDedicatedTest/misccommands.cpp b/NorthstarDedicatedTest/misccommands.cpp
new file mode 100644
index 00000000..c03ba713
--- /dev/null
+++ b/NorthstarDedicatedTest/misccommands.cpp
@@ -0,0 +1,28 @@
+#include "pch.h"
+#include "misccommands.h"
+#include "concommand.h"
+#include "gameutils.h"
+
+void ForceLoadMapCommand(const CCommand& arg)
+{
+ if (arg.ArgC() < 2)
+ return;
+
+ g_pHostState->m_iNextState = HS_NEW_GAME;
+ strncpy(g_pHostState->m_levelName, arg.Arg(1), sizeof(g_pHostState->m_levelName));
+}
+
+void LeaveToLobbyCommand(const CCommand& arg)
+{
+ SetCurrentPlaylist("tdm");
+
+ // note: for host, this will kick all clients, since it hits HS_GAME_SHUTDOWN
+ g_pHostState->m_iNextState = HS_NEW_GAME;
+ strcpy(g_pHostState->m_levelName, "mp_lobby");
+}
+
+void AddMiscConCommands()
+{
+ RegisterConCommand("force_newgame", ForceLoadMapCommand, "forces a map load through directly setting g_pHostState->m_iNextState to HS_NEW_GAME", FCVAR_NONE);
+ RegisterConCommand("ns_leave_to_lobby", LeaveToLobbyCommand, "called by the server, used to return the player to lobby when leaving a game", FCVAR_SERVER_CAN_EXECUTE);
+} \ No newline at end of file
diff --git a/NorthstarDedicatedTest/misccommands.h b/NorthstarDedicatedTest/misccommands.h
new file mode 100644
index 00000000..c8de8ad2
--- /dev/null
+++ b/NorthstarDedicatedTest/misccommands.h
@@ -0,0 +1,3 @@
+#pragma once
+
+void AddMiscConCommands(); \ No newline at end of file