diff --git a/src/client/component/client_patches.cpp b/src/client/component/client_patches.cpp index 47bd2e1f..5fb92afd 100644 --- a/src/client/component/client_patches.cpp +++ b/src/client/component/client_patches.cpp @@ -12,6 +12,37 @@ namespace client_patches { 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() { const DWORD_PTR affinity = (1ULL << (std::min(std::thread::hardware_concurrency(), 4U))) - 1; @@ -49,6 +80,8 @@ namespace client_patches // Kill microphones for now utils::hook::set(0x15AAEB254_g, mixer_open_stub); + + preload_map_hook.create(0x14135A1E0_g, preload_map_stub); } }; } diff --git a/src/client/component/party.cpp b/src/client/component/party.cpp index 7d673c07..32957179 100644 --- a/src/client/component/party.cpp +++ b/src/client/component/party.cpp @@ -34,34 +34,10 @@ namespace party 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) { game::XSESSION_INFO info{}; 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)