]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Throw casings if chase_active is on and r_drawviewmodel is off
authorterencehill <piuntn@gmail.com>
Wed, 18 Nov 2020 22:52:51 +0000 (23:52 +0100)
committerterencehill <piuntn@gmail.com>
Wed, 18 Nov 2020 22:52:51 +0000 (23:52 +0100)
qcsrc/client/main.qc
qcsrc/client/view.qc
qcsrc/common/effects/qc/casings.qc

index 16600f7433eb17b1af72c33ded08c7db7183d9ec..1be1f5fd413a7ee3479038aea13fc124c047fcce 100644 (file)
@@ -167,6 +167,9 @@ void Shutdown()
        if(autocvar_chase_active < 0)
                cvar_set("chase_active", "0");
 
+       if (autocvar_r_drawviewmodel < 0)
+               cvar_set("r_drawviewmodel", "0");
+
        cvar_set("slowmo", cvar_defstring("slowmo")); // reset it back to 'default'
 
        if (!isdemo())
index 51fbe195ec72eb7dd4bf379abf730c5665beae14..f39dbbefc5dc77b1f716016b60bbfeca8c4aaf32 100644 (file)
@@ -1633,6 +1633,21 @@ void CSQC_UpdateView(entity this, float w, float h)
 
        ticrate = STAT(MOVEVARS_TICRATE) * STAT(MOVEVARS_TIMESCALE);
 
+       if (autocvar_chase_active)
+       {
+               // in first person view if r_drawviewmodel is off weapon isn't visible
+               // and server doesn't throw any casing
+               // switching to 3rd person view r_drawviewmodel is set to -1 to let know the server casings
+               // can be thrown for self since own weapon model is visible
+               if (autocvar_r_drawviewmodel == 0 && STAT(HEALTH) > 0)
+                       cvar_set("r_drawviewmodel", "-1");
+       }
+       else
+       {
+               if (autocvar_r_drawviewmodel < 0)
+                       cvar_set("r_drawviewmodel", "0");
+       }
+
        WaypointSprite_Load();
 
        CSQCPlayer_SetCamera();
index 0e04984d61666a0f4d3607fce011a170a4410f73..3a6b386429b0cb5e1859991b02d7398cf338631e 100644 (file)
@@ -12,13 +12,13 @@ REGISTER_NET_TEMP(casings)
 
 #if defined(SVQC)
 .bool cvar_cl_casings;
-.bool cvar_r_drawviewmodel;
+.int cvar_r_drawviewmodel;
 #elif defined(CSQC)
 bool cvar_cl_casings;
-bool cvar_r_drawviewmodel;
+int cvar_r_drawviewmodel;
 #endif
 REPLICATE(cvar_cl_casings, bool, "cl_casings");
-REPLICATE(cvar_r_drawviewmodel, bool, "r_drawviewmodel");
+REPLICATE(cvar_r_drawviewmodel, int, "r_drawviewmodel");
 
 #ifdef SVQC
 void SpawnCasing(vector vel, float randomvel, vector ang, vector avel, float randomavel, int casingtype, entity casingowner, .entity weaponentity)