]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Use cvar_set
authorterencehill <piuntn@gmail.com>
Thu, 4 Jan 2024 01:20:27 +0000 (02:20 +0100)
committerterencehill <piuntn@gmail.com>
Thu, 4 Jan 2024 01:20:27 +0000 (02:20 +0100)
qcsrc/client/main.qc

index 58d497aab77b176a9ef60b951762e60d7eecac95..9e214551097dd0dc60e5d3431cbfd4df32b43ecc 100644 (file)
@@ -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();