From 9ab865ad2adcac61bc638b231f6c4b4c3cd02357 Mon Sep 17 00:00:00 2001 From: Maurice Heumann Date: Tue, 13 Dec 2022 19:11:42 +0100 Subject: [PATCH] Switch mode when necessary --- src/client/component/party.cpp | 22 +++++----------------- src/client/game/symbols.hpp | 3 ++- 2 files changed, 7 insertions(+), 18 deletions(-) diff --git a/src/client/component/party.cpp b/src/client/component/party.cpp index 57afa938..416d3940 100644 --- a/src/client/component/party.cpp +++ b/src/client/component/party.cpp @@ -43,24 +43,12 @@ namespace party void launch_mode(const game::eModes mode) { - const auto* command = ""; - - switch (mode) + scheduler::once([=] { - case game::MODE_CAMPAIGN: - command = "startCampaign;"; - break; - case game::MODE_ZOMBIES: - command = "startZombies;"; - break; - case game::MODE_MULTIPLAYER: - command = "startMultiplayer;"; - break; - default: - return; - } - - game::Cbuf_AddText(0, command); + const auto local_client = *reinterpret_cast(0x14342355C_g); + const auto current_mode = game::Com_SessionMode_GetMode(); + game::Com_SwitchMode(local_client, current_mode, mode, 6); + }, scheduler::main); } void connect_to_lobby_with_mode(const game::netadr_t& addr, const game::eModes mode, const std::string& mapname, diff --git a/src/client/game/symbols.hpp b/src/client/game/symbols.hpp index b8bff85b..8f641499 100644 --- a/src/client/game/symbols.hpp +++ b/src/client/game/symbols.hpp @@ -16,7 +16,8 @@ namespace game // Com WEAK symbol Com_Printf{0x1421499C0}; WEAK symbol Com_Error_{0x1420F8BD0}; - WEAK symbol Com_SessionMode_IsMode{0x1420F7DD0}; + WEAK symbol Com_SessionMode_IsMode{ 0x1420F7DD0 }; + WEAK symbol Com_SwitchMode{0x14214AF30 }; WEAK symbol Cbuf_AddText{0x1420EC8B0}; WEAK symbol Cmd_AddCommandInternal{