hide h1-mod branding via dvar

This commit is contained in:
Skull 2022-06-26 20:43:07 +03:00
parent 8bc31f26ff
commit d63a9a6d75

View File

@ -7,7 +7,7 @@
#include "version.hpp"
#include "game/game.hpp"
#include "dvars.hpp"
#include "game/dvars.hpp"
#include <utils/hook.hpp>
#include <utils/string.hpp>
@ -18,6 +18,7 @@ namespace branding
{
namespace
{
game::dvar_t* cg_showversion;
utils::hook::detour ui_get_formatted_build_number_hook;
float color[4] = {0.666f, 0.666f, 0.666f, 0.666f};
@ -31,7 +32,7 @@ namespace branding
void draw_branding()
{
const auto font = game::R_RegisterFont("fonts/fira_mono_bold.ttf", 20);
if (font)
if (font && cg_showversion->current.enabled)
{
#ifdef DEBUG
game::R_AddCmdDrawText("H1-Mod: " VERSION " (" __DATE__ " " __TIME__ ")", 0x7FFFFFFF, font, 10.f,
@ -65,6 +66,8 @@ namespace branding
localized_strings::override("MENU_MULTIPLAYER_CAPS", "H1-MOD: MULTIPLAYER");
}
cg_showversion = dvars::register_bool("cg_showversion", true, game::DvarFlags::DVAR_FLAG_SAVED, "Show/Hide H1-Mod Branding");
ui_get_formatted_build_number_hook.create(
SELECT_VALUE(0x406EC0_b, 0x1DF300_b), ui_get_formatted_build_number_stub);
}