[UI]: Fix bug (#625)

This commit is contained in:
Edo 2022-12-05 19:34:24 +00:00 committed by GitHub
parent 210873499c
commit b8b9391332
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 10 additions and 14 deletions

View File

@ -402,6 +402,11 @@ namespace Components
// remove write protection from fs_game
Utils::Hook::Xor<std::uint32_t>(0x6431EA, Game::DVAR_INIT);
// cheat protect g_hardcore
Utils::Hook::Xor<std::uint32_t>(0x5E374F, Game::DVAR_CHEAT);
Utils::Hook::Xor<std::uint32_t>(0x4D3689, Game::DVAR_CHEAT);
Utils::Hook::Xor<std::uint32_t>(0x4197C3, Game::DVAR_CHEAT);
// set cg_fov max to 160.0
// because that's the max on SP
static float cg_Fov = 160.0f;

View File

@ -6,9 +6,9 @@ namespace Components
bool Flags::HasFlag(const std::string& flag)
{
Flags::ParseFlags();
ParseFlags();
for (const auto& entry : Flags::EnabledFlags)
for (const auto& entry : EnabledFlags)
{
if (Utils::String::ToLower(entry) == Utils::String::ToLower(flag))
{
@ -40,7 +40,7 @@ namespace Components
if (wFlag[0] == L'-')
{
wFlag.erase(wFlag.begin());
Flags::EnabledFlags.emplace_back(Utils::String::Convert(wFlag));
EnabledFlags.emplace_back(Utils::String::Convert(wFlag));
}
}
@ -48,9 +48,9 @@ namespace Components
}
// Workaround for wine
if (Utils::IsWineEnvironment() && Dedicated::IsEnabled() && !Flags::HasFlag("console") && !Flags::HasFlag("stdout"))
if (Utils::IsWineEnvironment() && Dedicated::IsEnabled() && !HasFlag("console") && !HasFlag("stdout"))
{
Flags::EnabledFlags.emplace_back("stdout");
EnabledFlags.emplace_back("stdout");
}
}
}

View File

@ -116,11 +116,6 @@ namespace Components
}
}
bool UIScript::CL_IsUIActive_Hk(const int localClientNum)
{
return Game::Key_IsCatcherActive(localClientNum, Game::KEYCATCH_UI) || Game::cgsArray->hardcore;
}
UIScript::UIScript()
{
AssertSize(Game::uiInfo_s, 0x22FC);
@ -132,8 +127,6 @@ namespace Components
// Install ownerdraw handler
Utils::Hook(0x63D233, OwnerDrawHandleKeyStub, HOOK_CALL).install()->quick();
Utils::Hook(0x62B397, CL_IsUIActive_Hk, HOOK_CALL).install()->quick();
}
UIScript::~UIScript()

View File

@ -36,8 +36,6 @@ namespace Components
static bool RunMenuScript(const char* name, const char** args);
static void RunMenuScriptStub();
static bool CL_IsUIActive_Hk(int localClientNum);
static std::unordered_map<std::string, UIScriptHandler> UIScripts;
static std::unordered_map<int, std::function<void()>> UIOwnerDraws;
};