[QuickPatch] Disable several unneeded features when running as a dedicated server
This commit is contained in:
parent
151bb04a26
commit
6ab4dd7f9a
@ -66,6 +66,8 @@ namespace Components
|
||||
|
||||
void QuickPatch::UnlockStats()
|
||||
{
|
||||
if (Dedicated::Dedicated::IsEnabled()) return;
|
||||
|
||||
if (Game::CL_IsCgameInitialized())
|
||||
{
|
||||
Toast::Show("cardicon_locked", "^1Error", "Not allowed while ingame.", 3000);
|
||||
@ -243,17 +245,20 @@ namespace Components
|
||||
// version string
|
||||
Utils::Hook::Set<char*>(0x60BD56, "IW4x (" VERSION ")");
|
||||
|
||||
// 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([] ()
|
||||
if (!Dedicated::Dedicated::IsEnabled())
|
||||
{
|
||||
*reinterpret_cast<Game::dvar_t**>(0x62E4B64) = Game::Dvar_RegisterVec2("ui_buildLocation", -60.0f, 474.0f, -10000.0, 10000.0, Game::DVAR_FLAG_READONLY, "Where to draw the build number");
|
||||
});
|
||||
// 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<Game::dvar_t**>(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())
|
||||
@ -364,12 +369,15 @@ namespace Components
|
||||
Utils::Hook::Nop(0x5DF4F2, 5); // 'sending splash open' lines
|
||||
}
|
||||
|
||||
// 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<char*>(0x60BED2, "unskippablecinematic IW_logo\n");
|
||||
Utils::Hook::Set<char*>(0x51C2A4, "%s\\" BASEGAME "\\video\\%s.bik");
|
||||
Utils::Hook::Set<DWORD>(0x51C2C2, 0x78A0AC);
|
||||
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<char*>(0x60BED2, "unskippablecinematic IW_logo\n");
|
||||
Utils::Hook::Set<char*>(0x51C2A4, "%s\\" BASEGAME "\\video\\%s.bik");
|
||||
Utils::Hook::Set<DWORD>(0x51C2C2, 0x78A0AC);
|
||||
}
|
||||
|
||||
// Redirect logs
|
||||
Utils::Hook::Set<char*>(0x5E44D8, "logs/games_mp.log");
|
||||
@ -420,19 +428,22 @@ namespace Components
|
||||
// Patch SV_IsClientUsingOnlineStatsOffline
|
||||
Utils::Hook::Set<DWORD>(0x46B710, 0x90C3C033);
|
||||
|
||||
// Fix mouse pitch adjustments
|
||||
Dvar::Register<bool>("ui_mousePitch", false, Game::DVAR_FLAG_SAVED, "");
|
||||
UIScript::Add("updateui_mousePitch", [] (UIScript::Token)
|
||||
if (!Dedicated::Dedicated::IsEnabled())
|
||||
{
|
||||
if (Dvar::Var("ui_mousePitch").get<bool>())
|
||||
// Fix mouse pitch adjustments
|
||||
Dvar::Register<bool>("ui_mousePitch", false, Game::DVAR_FLAG_SAVED, "");
|
||||
UIScript::Add("updateui_mousePitch", [](UIScript::Token)
|
||||
{
|
||||
Dvar::Var("m_pitch").set(-0.022f);
|
||||
}
|
||||
else
|
||||
{
|
||||
Dvar::Var("m_pitch").set(0.022f);
|
||||
}
|
||||
});
|
||||
if (Dvar::Var("ui_mousePitch").get<bool>())
|
||||
{
|
||||
Dvar::Var("m_pitch").set(-0.022f);
|
||||
}
|
||||
else
|
||||
{
|
||||
Dvar::Var("m_pitch").set(0.022f);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Rename stat file
|
||||
Utils::Hook::SetString(0x71C048, "iw4x.stat");
|
||||
|
Loading…
Reference in New Issue
Block a user