From 94429ed35f32b23172e55da72d664dd284d6773d Mon Sep 17 00:00:00 2001 From: sr0 Date: Tue, 21 Feb 2017 21:49:42 +0100 Subject: [PATCH] Revert "[QuickPatch] Disable several unneeded features when running as a dedicated server" --- src/Components/Modules/ConnectProtocol.cpp | 2 +- src/Components/Modules/ModList.cpp | 2 +- src/Components/Modules/QuickPatch.cpp | 65 ++++++++++------------ 3 files changed, 30 insertions(+), 39 deletions(-) diff --git a/src/Components/Modules/ConnectProtocol.cpp b/src/Components/Modules/ConnectProtocol.cpp index 5ec53639..a570a6fd 100644 --- a/src/Components/Modules/ConnectProtocol.cpp +++ b/src/Components/Modules/ConnectProtocol.cpp @@ -204,7 +204,7 @@ namespace Components ConnectProtocol::ConnectProtocol() { - if (Dedicated::Dedicated::IsEnabled()) return; + if (Dedicated::IsEnabled()) return; // IPC handler IPCPipe::On("connect", [] (std::string data) diff --git a/src/Components/Modules/ModList.cpp b/src/Components/Modules/ModList.cpp index 3bd99b07..d090b679 100644 --- a/src/Components/Modules/ModList.cpp +++ b/src/Components/Modules/ModList.cpp @@ -90,7 +90,7 @@ namespace Components ModList::ModList() { - if (Dedicated::Dedicated::IsEnabled()) return; + if (Dedicated::IsEnabled()) return; ModList::CurrentMod = 0; Dvar::Register("cl_modVidRestart", true, Game::dvar_flag::DVAR_FLAG_SAVED, "Perform a vid_restart when loading a mod."); diff --git a/src/Components/Modules/QuickPatch.cpp b/src/Components/Modules/QuickPatch.cpp index 56b87fa3..6691067b 100644 --- a/src/Components/Modules/QuickPatch.cpp +++ b/src/Components/Modules/QuickPatch.cpp @@ -66,7 +66,7 @@ namespace Components void QuickPatch::UnlockStats() { - if (Dedicated::Dedicated::IsEnabled()) return; + if (Dedicated::IsEnabled()) return; if (Game::CL_IsCgameInitialized()) { @@ -245,20 +245,17 @@ namespace Components // version string Utils::Hook::Set(0x60BD56, "IW4x (" VERSION ")"); - if (!Dedicated::Dedicated::IsEnabled()) - { - // version string color - static float buildLocColor[] = { 1.0f, 1.0f, 1.0f, 0.8f }; - Utils::Hook::Set(0x43F710, buildLocColor); + // version string color + static float buildLocColor[] = { 1.0f, 1.0f, 1.0f, 0.8f }; + Utils::Hook::Set(0x43F710, buildLocColor); - // Shift ui version string to the left (ui_buildlocation) - Utils::Hook::Nop(0x6310A0, 5); // Don't register the initial dvar - Utils::Hook::Nop(0x6310B8, 5); // Don't write the result - Dvar::OnInit([]() - { - *reinterpret_cast(0x62E4B64) = Game::Dvar_RegisterVec2("ui_buildLocation", -60.0f, 474.0f, -10000.0, 10000.0, Game::DVAR_FLAG_READONLY, "Where to draw the build number"); - }); - } + // Shift ui version string to the left (ui_buildlocation) + Utils::Hook::Nop(0x6310A0, 5); // Don't register the initial dvar + Utils::Hook::Nop(0x6310B8, 5); // Don't write the result + Dvar::OnInit([] () + { + *reinterpret_cast(0x62E4B64) = Game::Dvar_RegisterVec2("ui_buildLocation", -60.0f, 474.0f, -10000.0, 10000.0, Game::DVAR_FLAG_READONLY, "Where to draw the build number"); + }); // console title if (ZoneBuilder::IsEnabled()) @@ -369,15 +366,12 @@ namespace Components Utils::Hook::Nop(0x5DF4F2, 5); // 'sending splash open' lines } - if (!Dedicated::Dedicated::IsEnabled()) - { - // intro stuff - Utils::Hook::Nop(0x60BEE9, 5); // Don't show legals - Utils::Hook::Nop(0x60BEF6, 5); // Don't reset the intro dvar - Utils::Hook::Set(0x60BED2, "unskippablecinematic IW_logo\n"); - Utils::Hook::Set(0x51C2A4, "%s\\" BASEGAME "\\video\\%s.bik"); - Utils::Hook::Set(0x51C2C2, 0x78A0AC); - } + // intro stuff + Utils::Hook::Nop(0x60BEE9, 5); // Don't show legals + Utils::Hook::Nop(0x60BEF6, 5); // Don't reset the intro dvar + Utils::Hook::Set(0x60BED2, "unskippablecinematic IW_logo\n"); + Utils::Hook::Set(0x51C2A4, "%s\\" BASEGAME "\\video\\%s.bik"); + Utils::Hook::Set(0x51C2C2, 0x78A0AC); // Redirect logs Utils::Hook::Set(0x5E44D8, "logs/games_mp.log"); @@ -428,22 +422,19 @@ namespace Components // Patch SV_IsClientUsingOnlineStatsOffline Utils::Hook::Set(0x46B710, 0x90C3C033); - if (!Dedicated::Dedicated::IsEnabled()) + // Fix mouse pitch adjustments + Dvar::Register("ui_mousePitch", false, Game::DVAR_FLAG_SAVED, ""); + UIScript::Add("updateui_mousePitch", [] (UIScript::Token) { - // Fix mouse pitch adjustments - Dvar::Register("ui_mousePitch", false, Game::DVAR_FLAG_SAVED, ""); - UIScript::Add("updateui_mousePitch", [](UIScript::Token) + if (Dvar::Var("ui_mousePitch").get()) { - if (Dvar::Var("ui_mousePitch").get()) - { - Dvar::Var("m_pitch").set(-0.022f); - } - else - { - Dvar::Var("m_pitch").set(0.022f); - } - }); - } + Dvar::Var("m_pitch").set(-0.022f); + } + else + { + Dvar::Var("m_pitch").set(0.022f); + } + }); // Rename stat file Utils::Hook::SetString(0x71C048, "iw4x.stat");