Hack to fix crouch prediction and hook/melee/frozen
authorMario <mario@smbclan.net>
Thu, 24 Mar 2016 19:00:07 +0000 (05:00 +1000)
committerMario <mario@smbclan.net>
Thu, 24 Mar 2016 19:00:07 +0000 (05:00 +1000)
qcsrc/common/physics/player.qc
qcsrc/common/physics/player.qh
qcsrc/common/weapons/weapon/hook.qc

index 8476869..1ddb707 100644 (file)
@@ -128,7 +128,17 @@ void PM_ClientMovement_UpdateStatus(entity this, bool ground)
                PM_ClientMovement_Unstick(this);
 
        // set crouched
-       if (PHYS_INPUT_BUTTON_CROUCH(this))
+       bool do_crouch = PHYS_INPUT_BUTTON_CROUCH(this);
+       if(this.hook && !wasfreed(this.hook))
+               do_crouch = false;
+       if(hud != HUD_NORMAL)
+               do_crouch = false;
+       if(STAT(FROZEN, this))
+               do_crouch = false;
+       if((activeweapon == WEP_SHOCKWAVE || activeweapon == WEP_SHOTGUN) && viewmodel.animstate_startframe == viewmodel.anim_fire2_x && time < viewmodel.weapon_nextthink)
+               do_crouch = false;
+
+       if (do_crouch)
        {
                // wants to crouch, this always works
                if (!IS_DUCKED(this)) SET_DUCKED(this);
index bcc9f73..fd1b610 100644 (file)
@@ -174,6 +174,8 @@ STATIC_INIT(PHYS_INPUT_BUTTON_JETPACK)
        .vector movement;
        .vector v_angle;
 
+       .entity hook;
+
 // TODO
        #define IS_CLIENT(s)                        ((s).isplayermodel)
        #define IS_PLAYER(s)                        ((s).isplayermodel)
index c335e8c..13e8ac1 100644 (file)
@@ -484,6 +484,9 @@ void Draw_GrapplingHook(entity this)
 void Remove_GrapplingHook(entity this)
 {
        sound (this, CH_SHOTS_SINGLE, SND_Null, VOL_BASE, ATTEN_NORM);
+
+       if(csqcplayer && csqcplayer.hook == this)
+               csqcplayer.hook = NULL;
 }
 
 NET_HANDLE(ENT_CLIENT_HOOK, bool bIsNew)
@@ -502,6 +505,8 @@ NET_HANDLE(ENT_CLIENT_HOOK, bool bIsNew)
                int myowner = ReadByte();
                self.owner = playerslots[myowner - 1];
                self.sv_entnum = myowner;
+               if(csqcplayer && myowner == player_localentnum)
+                       csqcplayer.hook = self;
                switch(self.HookType)
                {
                        default: