add cg_draw2d
This commit is contained in:
parent
3c6e4de5c8
commit
e8be93a37e
47
src/client/component/ui.cpp
Normal file
47
src/client/component/ui.cpp
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
#include <std_include.hpp>
|
||||||
|
#include "loader/component_loader.hpp"
|
||||||
|
|
||||||
|
#include "game/game.hpp"
|
||||||
|
#include "game/dvars.hpp"
|
||||||
|
|
||||||
|
#include "scheduler.hpp"
|
||||||
|
|
||||||
|
#include <utils/hook.hpp>
|
||||||
|
|
||||||
|
namespace ui
|
||||||
|
{
|
||||||
|
namespace
|
||||||
|
{
|
||||||
|
utils::hook::detour cg_draw2d_hook;
|
||||||
|
void cg_draw2d_stub(__int64 a1)
|
||||||
|
{
|
||||||
|
if (dvars::cg_draw2D && !dvars::cg_draw2D->current.enabled)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
cg_draw2d_hook.invoke<void>(a1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class component final : public component_interface
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
void post_unpack() override
|
||||||
|
{
|
||||||
|
if (game::environment::is_dedi())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
scheduler::once([]()
|
||||||
|
{
|
||||||
|
dvars::cg_draw2D = game::Dvar_RegisterBool("cg_draw2D", true, game::DVAR_FLAG_NONE, "Draw 2D screen elements");
|
||||||
|
}, scheduler::main);
|
||||||
|
|
||||||
|
cg_draw2d_hook.create(0x781D90_b, cg_draw2d_stub);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
REGISTER_COMPONENT(ui::component)
|
@ -23,6 +23,8 @@ namespace dvars
|
|||||||
|
|
||||||
game::dvar_t* lui_debug = nullptr;
|
game::dvar_t* lui_debug = nullptr;
|
||||||
|
|
||||||
|
game::dvar_t* cg_draw2D = nullptr;
|
||||||
|
|
||||||
game::dvar_t* r_fullbright = nullptr;
|
game::dvar_t* r_fullbright = nullptr;
|
||||||
|
|
||||||
game::dvar_t* bg_bounces = nullptr;
|
game::dvar_t* bg_bounces = nullptr;
|
||||||
|
@ -19,6 +19,8 @@ namespace dvars
|
|||||||
|
|
||||||
extern game::dvar_t* lui_debug;
|
extern game::dvar_t* lui_debug;
|
||||||
|
|
||||||
|
extern game::dvar_t* cg_draw2D;
|
||||||
|
|
||||||
extern game::dvar_t* r_fullbright;
|
extern game::dvar_t* r_fullbright;
|
||||||
|
|
||||||
extern game::dvar_t* bg_bounces;
|
extern game::dvar_t* bg_bounces;
|
||||||
|
Loading…
Reference in New Issue
Block a user