]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Don't spawn casings from the 1st person weapon model if it's invisible; it fixes...
authorterencehill <piuntn@gmail.com>
Mon, 16 Nov 2020 09:34:09 +0000 (10:34 +0100)
committerterencehill <piuntn@gmail.com>
Mon, 16 Nov 2020 09:34:09 +0000 (10:34 +0100)
qcsrc/common/effects/qc/casings.qc
qcsrc/server/client.qh

index 5b0b6d8e355aab48e85319c92164b8acff6628b3..0e04984d61666a0f4d3607fce011a170a4410f73 100644 (file)
@@ -12,20 +12,25 @@ REGISTER_NET_TEMP(casings)
 
 #if defined(SVQC)
 .bool cvar_cl_casings;
+.bool cvar_r_drawviewmodel;
 #elif defined(CSQC)
 bool cvar_cl_casings;
+bool cvar_r_drawviewmodel;
 #endif
 REPLICATE(cvar_cl_casings, bool, "cl_casings");
+REPLICATE(cvar_r_drawviewmodel, bool, "r_drawviewmodel");
 
 #ifdef SVQC
 void SpawnCasing(vector vel, float randomvel, vector ang, vector avel, float randomavel, int casingtype, entity casingowner, .entity weaponentity)
 {
-       entity wep = casingowner.(weaponentity);
-       vector org = casingowner.origin + casingowner.view_ofs + wep.spawnorigin.x * v_forward - wep.spawnorigin.y * v_right + wep.spawnorigin.z * v_up;
+       vector org = casingowner.(weaponentity).spawnorigin;
+       org = casingowner.origin + casingowner.view_ofs + org.x * v_forward - org.y * v_right + org.z * v_up;
 
        FOREACH_CLIENT(true, {
                if (!(CS(it).cvar_cl_casings))
                        continue;
+               if (it == casingowner && !(CS(it).cvar_r_drawviewmodel))
+                       continue;
 
                msg_entity = it;
                if (!sound_allowed(MSG_ONE, it))
index 563fdba1b0028350e12d7300207ed7826f4ec841..efe336d1f6913d81102492b484daf51601c2908e 100644 (file)
@@ -214,6 +214,7 @@ CLASS(Client, Object)
     ATTRIB(Client, cvar_g_xonoticversion, string, this.cvar_g_xonoticversion);
     ATTRIB(Client, autoswitch, bool, this.autoswitch);
     ATTRIB(Client, cvar_cl_casings, bool, this.cvar_cl_casings);
+    ATTRIB(Client, cvar_r_drawviewmodel, bool, this.cvar_r_drawviewmodel);
     ATTRIB(Client, cvar_cl_dodging_timeout, float, this.cvar_cl_dodging_timeout);
     ATTRIB(Client, cvar_cl_dodging, float, this.cvar_cl_dodging);
     ATTRIB(Client, cvar_cl_multijump, bool, this.cvar_cl_multijump);