From: terencehill Date: Thu, 4 Jan 2024 01:20:27 +0000 (+0100) Subject: Use cvar_set X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=c6e1864a0d1bbe7a5bfe721edb92318216195463;p=xonotic%2Fxonotic-data.pk3dir.git Use cvar_set --- diff --git a/qcsrc/client/main.qc b/qcsrc/client/main.qc index 58d497aab..9e2145510 100644 --- a/qcsrc/client/main.qc +++ b/qcsrc/client/main.qc @@ -1060,13 +1060,25 @@ bool CSQC_Parse_TempEntity() return false; } +bool autocvar_r_drawfog; +bool autocvar_r_fog_exp2; string forcefog; void Fog_Force() { if (autocvar_cl_orthoview && autocvar_cl_orthoview_nofog) - localcmd("\nr_drawfog 0\n"); + { + if (autocvar_r_drawfog) + cvar_set("r_drawfog", "0"); + } else if (forcefog != "") - localcmd(sprintf("\nfog %s\nr_fog_exp2 0\nr_drawfog 1\n", forcefog)); + { + // using cvar_set as it's faster and safer than a command + if (!autocvar_r_drawfog) + cvar_set("r_drawfog", "1"); + if (autocvar_r_fog_exp2) + cvar_set("r_fog_exp2", "0"); + localcmd(sprintf("\nfog %s\n", forcefog)); + } } bool net_handle_ServerWelcome();