Fix zombie intro skipping during map rotation

This commit is contained in:
BrentVL-1952840 2023-02-23 19:37:38 +01:00
parent 7e22eb87b1
commit 6aadfd04c7
2 changed files with 33 additions and 24 deletions

View File

@ -12,6 +12,37 @@ namespace client_patches
{ {
namespace namespace
{ {
utils::hook::detour preload_map_hook;
void stop_zombies_intro_if_needed()
{
if (game::Com_SessionMode_GetMode() != game::MODE_ZOMBIES)
{
return;
}
scheduler::once([]
{
scheduler::schedule([]
{
if (!game::Sys_IsDatabaseReady())
{
return scheduler::cond_continue;
}
game::Cinematic_StopPlayback(0, true);
return scheduler::cond_end;
}, scheduler::main);
}, scheduler::main, 15s);
}
void preload_map_stub(int localClientNum, const char* mapname, const char* gametype)
{
stop_zombies_intro_if_needed();
preload_map_hook.invoke(localClientNum, mapname, gametype);
}
void reduce_process_affinity() void reduce_process_affinity()
{ {
const DWORD_PTR affinity = (1ULL << (std::min(std::thread::hardware_concurrency(), 4U))) - 1; const DWORD_PTR affinity = (1ULL << (std::min(std::thread::hardware_concurrency(), 4U))) - 1;
@ -49,6 +80,8 @@ namespace client_patches
// Kill microphones for now // Kill microphones for now
utils::hook::set(0x15AAEB254_g, mixer_open_stub); utils::hook::set(0x15AAEB254_g, mixer_open_stub);
preload_map_hook.create(0x14135A1E0_g, preload_map_stub);
} }
}; };
} }

View File

@ -34,34 +34,10 @@ namespace party
return server_queries; return server_queries;
} }
void stop_zombies_intro_if_needed()
{
if (game::Com_SessionMode_GetMode() != game::MODE_ZOMBIES)
{
return;
}
scheduler::once([]
{
scheduler::schedule([]
{
if (!game::Sys_IsDatabaseReady())
{
return scheduler::cond_continue;
}
game::Cinematic_StopPlayback(0, true);
return scheduler::cond_end;
}, scheduler::main);
}, scheduler::main, 15s);
}
void connect_to_lobby(const game::netadr_t& addr, const std::string& mapname, const std::string& gamemode) void connect_to_lobby(const game::netadr_t& addr, const std::string& mapname, const std::string& gamemode)
{ {
game::XSESSION_INFO info{}; game::XSESSION_INFO info{};
game::CL_ConnectFromLobby(0, &info, &addr, 1, 0, mapname.data(), gamemode.data(), nullptr); game::CL_ConnectFromLobby(0, &info, &addr, 1, 0, mapname.data(), gamemode.data(), nullptr);
stop_zombies_intro_if_needed();
} }
void launch_mode(const game::eModes mode) void launch_mode(const game::eModes mode)