Add 'bhit_enable' ConVar and only run bhit callback if set

This commit is contained in:
Kawe Mazidjatari 2022-08-03 18:27:25 +02:00
parent 5bd6432862
commit 19d057fc5e
4 changed files with 18 additions and 11 deletions

View File

@ -113,17 +113,19 @@ void ConVar::Init(void) const
cl_conoverlay_script_client_clr = new ConVar("cl_conoverlay_script_client_clr", "117 116 139 255", FCVAR_DEVELOPMENTONLY, "Script CLIENT VM RUI console overlay log color.", false, 1.f, false, 50.f, nullptr, nullptr); cl_conoverlay_script_client_clr = new ConVar("cl_conoverlay_script_client_clr", "117 116 139 255", FCVAR_DEVELOPMENTONLY, "Script CLIENT VM RUI console overlay log color.", false, 1.f, false, 50.f, nullptr, nullptr);
cl_conoverlay_script_ui_clr = new ConVar("cl_conoverlay_script_ui_clr" , "200 110 110 255", FCVAR_DEVELOPMENTONLY, "Script UI VM RUI console overlay log color.", false, 1.f, false, 50.f, nullptr, nullptr); cl_conoverlay_script_ui_clr = new ConVar("cl_conoverlay_script_ui_clr" , "200 110 110 255", FCVAR_DEVELOPMENTONLY, "Script UI VM RUI console overlay log color.", false, 1.f, false, 50.f, nullptr, nullptr);
cl_conoverlay_native_server_clr = new ConVar("cl_conoverlay_native_server_clr", "020 050 248 255", FCVAR_DEVELOPMENTONLY, "Native SERVER RUI console overlay log color.", false, 1.f, false, 50.f, nullptr, nullptr); cl_conoverlay_native_server_clr = new ConVar("cl_conoverlay_native_server_clr", "20 50 248 255", FCVAR_DEVELOPMENTONLY, "Native SERVER RUI console overlay log color.", false, 1.f, false, 50.f, nullptr, nullptr);
cl_conoverlay_native_client_clr = new ConVar("cl_conoverlay_native_client_clr", "070 070 070 255", FCVAR_DEVELOPMENTONLY, "Native CLIENT RUI console overlay log color.", false, 1.f, false, 50.f, nullptr, nullptr); cl_conoverlay_native_client_clr = new ConVar("cl_conoverlay_native_client_clr", "70 70 70 255", FCVAR_DEVELOPMENTONLY, "Native CLIENT RUI console overlay log color.", false, 1.f, false, 50.f, nullptr, nullptr);
cl_conoverlay_native_ui_clr = new ConVar("cl_conoverlay_native_ui_clr" , "200 060 060 255", FCVAR_DEVELOPMENTONLY, "Native UI RUI console overlay log color.", false, 1.f, false, 50.f, nullptr, nullptr); cl_conoverlay_native_ui_clr = new ConVar("cl_conoverlay_native_ui_clr" , "200 60 60 255", FCVAR_DEVELOPMENTONLY, "Native UI RUI console overlay log color.", false, 1.f, false, 50.f, nullptr, nullptr);
cl_conoverlay_native_engine_clr = new ConVar("cl_conoverlay_native_engine_clr", "255 255 255 255", FCVAR_DEVELOPMENTONLY, "Native engine RUI console overlay log color.", false, 1.f, false, 50.f, nullptr, nullptr); cl_conoverlay_native_engine_clr = new ConVar("cl_conoverlay_native_engine_clr", "255 255 255 255", FCVAR_DEVELOPMENTONLY, "Native engine RUI console overlay log color.", false, 1.f, false, 50.f, nullptr, nullptr);
cl_conoverlay_native_fs_clr = new ConVar("cl_conoverlay_native_fs_clr" , "000 100 225 255", FCVAR_DEVELOPMENTONLY, "Native filesystem RUI console overlay log color.", false, 1.f, false, 50.f, nullptr, nullptr); cl_conoverlay_native_fs_clr = new ConVar("cl_conoverlay_native_fs_clr" , "0 100 225 255", FCVAR_DEVELOPMENTONLY, "Native filesystem RUI console overlay log color.", false, 1.f, false, 50.f, nullptr, nullptr);
cl_conoverlay_native_rtech_clr = new ConVar("cl_conoverlay_native_rtech_clr" , "025 100 100 255", FCVAR_DEVELOPMENTONLY, "Native rtech RUI console overlay log color.", false, 1.f, false, 50.f, nullptr, nullptr); cl_conoverlay_native_rtech_clr = new ConVar("cl_conoverlay_native_rtech_clr" , "25 100 100 255", FCVAR_DEVELOPMENTONLY, "Native rtech RUI console overlay log color.", false, 1.f, false, 50.f, nullptr, nullptr);
cl_conoverlay_native_ms_clr = new ConVar("cl_conoverlay_native_ms_clr" , "200 020 180 255", FCVAR_DEVELOPMENTONLY, "Native materialsystem RUI console overlay log color.", false, 1.f, false, 50.f, nullptr, nullptr); cl_conoverlay_native_ms_clr = new ConVar("cl_conoverlay_native_ms_clr" , "200 20 180 255", FCVAR_DEVELOPMENTONLY, "Native materialsystem RUI console overlay log color.", false, 1.f, false, 50.f, nullptr, nullptr);
cl_conoverlay_netcon_clr = new ConVar("cl_conoverlay_netcon_clr" , "255 255 255 255", FCVAR_DEVELOPMENTONLY, "Net console RUI console overlay log color.", false, 1.f, false, 50.f, nullptr, nullptr); cl_conoverlay_netcon_clr = new ConVar("cl_conoverlay_netcon_clr" , "255 255 255 255", FCVAR_DEVELOPMENTONLY, "Net console RUI console overlay log color.", false, 1.f, false, 50.f, nullptr, nullptr);
cl_conoverlay_warning_clr = new ConVar("cl_conoverlay_warning_clr", "180 180 020 255", FCVAR_DEVELOPMENTONLY, "Warning RUI console overlay log color.", false, 1.f, false, 50.f, nullptr, nullptr); cl_conoverlay_common_clr = new ConVar("cl_conoverlay_common_clr" , "255 140 80 255" , FCVAR_DEVELOPMENTONLY, "Common RUI console overlay log color.", false, 1.f, false, 50.f, nullptr, nullptr);
cl_conoverlay_error_clr = new ConVar("cl_conoverlay_error_clr" , "225 030 030 255", FCVAR_DEVELOPMENTONLY, "Error RUI console overlay log color.", false, 1.f, false, 50.f, nullptr, nullptr);
cl_conoverlay_warning_clr = new ConVar("cl_conoverlay_warning_clr", "180 180 20 255", FCVAR_DEVELOPMENTONLY, "Warning RUI console overlay log color.", false, 1.f, false, 50.f, nullptr, nullptr);
cl_conoverlay_error_clr = new ConVar("cl_conoverlay_error_clr" , "225 20 20 255" , FCVAR_DEVELOPMENTONLY, "Error RUI console overlay log color.", false, 1.f, false, 50.f, nullptr, nullptr);
cl_showhoststats = new ConVar("cl_showhoststats" , "0", FCVAR_DEVELOPMENTONLY, "Host speeds debug overlay.", false, 0.f, false, 0.f, nullptr, nullptr); cl_showhoststats = new ConVar("cl_showhoststats" , "0", FCVAR_DEVELOPMENTONLY, "Host speeds debug overlay.", false, 0.f, false, 0.f, nullptr, nullptr);
cl_hoststats_invert_rect_x = new ConVar("cl_hoststats_invert_rect_x", "0", FCVAR_DEVELOPMENTONLY, "Inverts the X rect for host speeds debug overlay.", false, 0.f, false, 0.f, nullptr, nullptr); cl_hoststats_invert_rect_x = new ConVar("cl_hoststats_invert_rect_x", "0", FCVAR_DEVELOPMENTONLY, "Inverts the X rect for host speeds debug overlay.", false, 0.f, false, 0.f, nullptr, nullptr);
@ -196,6 +198,7 @@ void ConVar::InitShipped(void) const
{ {
#ifndef CLIENT_DLL #ifndef CLIENT_DLL
ai_script_nodes_draw = g_pCVar->FindVar("ai_script_nodes_draw"); ai_script_nodes_draw = g_pCVar->FindVar("ai_script_nodes_draw");
bhit_enable = g_pCVar->FindVar("bhit_enable");
#endif // !CLIENT_DLL #endif // !CLIENT_DLL
single_frame_shutdown_for_reload = g_pCVar->FindVar("single_frame_shutdown_for_reload"); single_frame_shutdown_for_reload = g_pCVar->FindVar("single_frame_shutdown_for_reload");
enable_debug_overlays = g_pCVar->FindVar("enable_debug_overlays"); enable_debug_overlays = g_pCVar->FindVar("enable_debug_overlays");

View File

@ -67,6 +67,7 @@ ConVar* sv_banlistRefreshInterval = nullptr;
ConVar* sv_statusRefreshInterval = nullptr; ConVar* sv_statusRefreshInterval = nullptr;
ConVar* sv_visualizetraces = nullptr; ConVar* sv_visualizetraces = nullptr;
ConVar* bhit_enable = nullptr;
ConVar* bhit_abs_origin = nullptr; ConVar* bhit_abs_origin = nullptr;
#ifdef DEDICATED #ifdef DEDICATED
@ -98,6 +99,7 @@ ConVar* cl_conoverlay_native_fs_clr = nullptr;
ConVar* cl_conoverlay_native_rtech_clr = nullptr; ConVar* cl_conoverlay_native_rtech_clr = nullptr;
ConVar* cl_conoverlay_native_ms_clr = nullptr; ConVar* cl_conoverlay_native_ms_clr = nullptr;
ConVar* cl_conoverlay_netcon_clr = nullptr; ConVar* cl_conoverlay_netcon_clr = nullptr;
ConVar* cl_conoverlay_common_clr = nullptr;
ConVar* cl_conoverlay_warning_clr = nullptr; ConVar* cl_conoverlay_warning_clr = nullptr;
ConVar* cl_conoverlay_error_clr = nullptr; ConVar* cl_conoverlay_error_clr = nullptr;

View File

@ -66,6 +66,7 @@ extern ConVar* sv_banlistRefreshInterval;
extern ConVar* sv_statusRefreshInterval; extern ConVar* sv_statusRefreshInterval;
extern ConVar* sv_visualizetraces; extern ConVar* sv_visualizetraces;
extern ConVar* bhit_enable;
extern ConVar* bhit_abs_origin; extern ConVar* bhit_abs_origin;
#ifdef DEDICATED #ifdef DEDICATED
extern ConVar* sv_rcon_debug; extern ConVar* sv_rcon_debug;
@ -97,6 +98,7 @@ extern ConVar* cl_conoverlay_native_fs_clr;
extern ConVar* cl_conoverlay_native_rtech_clr; extern ConVar* cl_conoverlay_native_rtech_clr;
extern ConVar* cl_conoverlay_native_ms_clr; extern ConVar* cl_conoverlay_native_ms_clr;
extern ConVar* cl_conoverlay_netcon_clr; extern ConVar* cl_conoverlay_netcon_clr;
extern ConVar* cl_conoverlay_common_clr;
extern ConVar* cl_conoverlay_warning_clr; extern ConVar* cl_conoverlay_warning_clr;
extern ConVar* cl_conoverlay_error_clr; extern ConVar* cl_conoverlay_error_clr;

View File

@ -1025,11 +1025,11 @@ BHit_f
*/ */
void BHit_f(const CCommand& args) void BHit_f(const CCommand& args)
{ {
#if !defined (DEDICATED) && !defined (CLIENT_DLL)
if (args.ArgC() != 9) if (args.ArgC() != 9)
return; return;
#ifndef DEDICATED if (bhit_enable->GetBool() && sv_visualizetraces->GetBool())
if (sv_visualizetraces->GetBool())
{ {
Vector3D vecAbsStart; Vector3D vecAbsStart;
Vector3D vecAbsEnd; Vector3D vecAbsEnd;
@ -1065,5 +1065,5 @@ void BHit_f(const CCommand& args)
Cbuf_AddText(Cbuf_GetCurrentPlayer(), szBuf, cmd_source_t::kCommandSrcCode); Cbuf_AddText(Cbuf_GetCurrentPlayer(), szBuf, cmd_source_t::kCommandSrcCode);
Cbuf_Execute(); Cbuf_Execute();
} }
#endif // !DEDICATED #endif // !DEDICATED && !CLIENT_DLL
} }