Switch mode when necessary

This commit is contained in:
Maurice Heumann 2022-12-13 19:11:42 +01:00
parent 6d51d491a7
commit 9ab865ad2a
2 changed files with 7 additions and 18 deletions

View File

@ -43,24 +43,12 @@ namespace party
void launch_mode(const game::eModes mode) void launch_mode(const game::eModes mode)
{ {
const auto* command = ""; scheduler::once([=]
switch (mode)
{ {
case game::MODE_CAMPAIGN: const auto local_client = *reinterpret_cast<DWORD*>(0x14342355C_g);
command = "startCampaign;"; const auto current_mode = game::Com_SessionMode_GetMode();
break; game::Com_SwitchMode(local_client, current_mode, mode, 6);
case game::MODE_ZOMBIES: }, scheduler::main);
command = "startZombies;";
break;
case game::MODE_MULTIPLAYER:
command = "startMultiplayer;";
break;
default:
return;
}
game::Cbuf_AddText(0, command);
} }
void connect_to_lobby_with_mode(const game::netadr_t& addr, const game::eModes mode, const std::string& mapname, void connect_to_lobby_with_mode(const game::netadr_t& addr, const game::eModes mode, const std::string& mapname,

View File

@ -16,7 +16,8 @@ namespace game
// Com // Com
WEAK symbol<void(int channel, unsigned int label, const char* fmt, ...)> Com_Printf{0x1421499C0}; WEAK symbol<void(int channel, unsigned int label, const char* fmt, ...)> Com_Printf{0x1421499C0};
WEAK symbol<void(const char* file, int line, int code, const char* fmt, ...)> Com_Error_{0x1420F8BD0}; WEAK symbol<void(const char* file, int line, int code, const char* fmt, ...)> Com_Error_{0x1420F8BD0};
WEAK symbol<bool(eModes mode)> Com_SessionMode_IsMode{0x1420F7DD0}; WEAK symbol<bool(eModes mode)> Com_SessionMode_IsMode{ 0x1420F7DD0 };
WEAK symbol<void(uint32_t localClientNum, eModes fromMode, eModes toMode, uint32_t flags)> Com_SwitchMode{0x14214AF30 };
WEAK symbol<void(int localClientNum, const char* text)> Cbuf_AddText{0x1420EC8B0}; WEAK symbol<void(int localClientNum, const char* text)> Cbuf_AddText{0x1420EC8B0};
WEAK symbol<void(const char* cmdName, xcommand_t function, cmd_function_s* allocedCmd)> Cmd_AddCommandInternal{ WEAK symbol<void(const char* cmdName, xcommand_t function, cmd_function_s* allocedCmd)> Cmd_AddCommandInternal{