]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
make crouch handling serverside again, for g_bloodloss
authorRudolf Polzer <divverent@xonotic.org>
Fri, 25 Jan 2013 08:50:39 +0000 (09:50 +0100)
committerRudolf Polzer <divverent@xonotic.org>
Fri, 25 Jan 2013 08:50:39 +0000 (09:50 +0100)
qcsrc/common/csqcmodel_settings.qh
qcsrc/csqcmodellib/cl_player.qc
qcsrc/server/cl_client.qc
qcsrc/server/cl_weaponsystem.qc
qcsrc/server/w_shotgun.qc

index 028ce9b8cbcf9a64e9d14131e6c7f31bef663064..a0076825be402ec5e837a564686def6fe3deef0d 100644 (file)
@@ -4,6 +4,9 @@
 // don't define this ever
 //#define CSQCMODEL_SUPPORT_GETTAGINFO_BEFORE_DRAW
 
+// server decides crouching, this lags, but so be it
+#define CSQCMODEL_SERVERSIDE_CROUCH
+
 // a hack for Xonotic
 #ifdef CSQC
 # define TAG_ENTITY_NAME tag_networkentity
index ac9373989cf1121e92747bfa54413ff8afe2e4a1..f77f9512623e099cea3f7f4fecff98e762e5019c 100644 (file)
@@ -240,6 +240,14 @@ void CSQCPlayer_SetCamera()
                        }
                        CSQCPlayer_PredictTo(clientcommandframe + 1, TRUE);
 
+#ifdef CSQCMODEL_SERVERSIDE_CROUCH
+                       // get crouch state from the server (LAG)
+                       if(getstati(STAT_VIEWHEIGHT) == PL_VIEW_OFS_z)
+                               self.pmove_flags &~= PMF_DUCKED;
+                       else if(getstati(STAT_VIEWHEIGHT) == PL_CROUCH_VIEW_OFS_z)
+                               self.pmove_flags |= PMF_DUCKED;
+#endif
+
                        CSQCPlayer_SetMinsMaxs();
 
                        self.angles_y = input_angles_y;
index 1dcbf0d1f5bb8df19a81d03b76957e3c8a853aaf..02435cc605931a2ffee4ca2ec0032b5bf0a0a65d 100644 (file)
@@ -2785,8 +2785,19 @@ void PlayerPreThink (void)
 
                self.prevorigin = self.origin;
 
-               if (!self.vehicle)
-               if (((self.BUTTON_CROUCH && !self.hook.state) || self.health <= g_bloodloss) && !self.freezetag_frozen) // FIXME-CSAD: prevent crouching if using melee attack
+               float do_crouch = self.BUTTON_CROUCH;
+               if(!self.hook.state)
+                       do_crouch = 0;
+               if(self.health <= g_bloodloss)
+                       do_crouch = 1;
+               if(self.vehicle)
+                       do_crouch = 0;
+               if(self.freezetag_frozen)
+                       do_crouch = 0;
+               if(self.weapon == WEP_SHOTGUN && self.weaponentity.wframe == WFRAME_FIRE2 && time < self.weapon_nextthink)
+                       do_crouch = 0;
+
+               if (do_crouch)
                {
                        if (!self.crouch)
                        {
index a84a8a51bd7b2f0fdae6d2681b4ab2485c404de0..a75e2be5af16fee8e3758a60e0590a28f020ad0f 100644 (file)
@@ -1049,7 +1049,7 @@ void weapon_thinkf(float fr, float t, void() func)
 
        if((fr == WFRAME_FIRE1 || fr == WFRAME_FIRE2) && t)
        {
-               if(self.weapon == WEP_SHOTGUN && self.BUTTON_ATCK2)
+               if(self.weapon == WEP_SHOTGUN && fr == WFRAME_FIRE2)
                        animdecide_setaction(self, ANIMACTION_MELEE, restartanim);
                else
                        animdecide_setaction(self, ANIMACTION_SHOOT, restartanim);
index fcf9a27c27482a25432747d58cc37ee974fae513..fdfa6af382c27a48347689016cc92a161cb9c36d 100644 (file)
@@ -199,7 +199,7 @@ float w_shotgun(float req)
                        }
                }
                if (self.clip_load >= 0) // we are not currently reloading
-               if (!self.crouch) // we are not currently crouching; this fixes an exploit where your melee anim is not visible, and besides wouldn't make much sense
+               if (!self.crouch) // no crouchmelee please
                if (self.BUTTON_ATCK2 && autocvar_g_balance_shotgun_secondary)
                if (weapon_prepareattack(1, autocvar_g_balance_shotgun_secondary_refire))
                {