]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
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 84768690c544296b032a5410d79c1cd89707c917..1ddb70799878118bd88052dbd39dcb14cd21ab1e 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 bcc9f7329072d75d2870a88ff4b128bdc28a9ccb..fd1b610de68811c11c405afdd6eef9f8eed43b58 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 c335e8c5bc8b00fd182d8dc61fbff8d2a697fcb4..13e8ac1129d80feeffec61d507bf799d495475bd 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: