]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Merge remote branch 'origin/master' into fruitiex/animations
authorSamual <samual@xonotic.org>
Thu, 18 Aug 2011 07:58:57 +0000 (03:58 -0400)
committerSamual <samual@xonotic.org>
Thu, 18 Aug 2011 07:58:57 +0000 (03:58 -0400)
Conflicts:
defaultXonotic.cfg

defaultXonotic.cfg
qcsrc/server/autocvars.qh
qcsrc/server/cl_client.qc
qcsrc/server/cl_physics.qc
qcsrc/server/cl_player.qc
qcsrc/server/cl_weaponsystem.qc
qcsrc/server/defs.qh
qcsrc/server/t_jumppads.qc
qcsrc/server/w_shotgun.qc

index 3dc51da56553df8c0ceb4a05c886bfeec4b16ceb..6da1710d16562ad7e3855c64201b0e199ff8999a 100644 (file)
@@ -386,6 +386,7 @@ set sv_doublejump 0 "allow Quake 2-style double jumps"
 set sv_jumpspeedcap_min "" "lower bound on the baseline velocity of a jump; final velocity will be >= (jumpheight * min + jumpheight)"
 set sv_jumpspeedcap_max "" "upper bound on the baseline velocity of a jump; final velocity will be <= (jumpheight * max + jumpheight)"
 set sv_jumpspeedcap_max_disable_on_ramps 0 "disable upper baseline velocity bound on ramps to preserve the old rampjump style"
+set sv_player_jumpanim_minfall 48 "minimum distance player has to have below their feet before the jump animation will be activated (only when falling, +jump will play anim instantly)"
 
 seta sv_precacheplayermodels 1
 seta sv_precacheweapons 0
index ff99823330df8ac13212d5d79facd93fc7b3f5a3..675af0397a9779e6d8eefc5bace1ecfecc20a8f1 100644 (file)
@@ -1128,6 +1128,7 @@ string autocvar_sv_player_headsize;
 string autocvar_sv_player_maxs;
 string autocvar_sv_player_mins;
 string autocvar_sv_player_viewoffset;
+float autocvar_sv_player_jumpanim_minfall;
 float autocvar_sv_precacheplayermodels;
 float autocvar_sv_precacheweapons;
 float autocvar_sv_q3acompat_machineshotgunswap;
index 0cf0d9ea512224843f2de8f7625cfb64cef2c84e..0513156a03f582f37bd4c4cc673f3815a90fa103 100644 (file)
@@ -2873,7 +2873,7 @@ void PlayerPreThink (void)
 
                self.prevorigin = self.origin;
 
-               if ((self.BUTTON_CROUCH && !self.hook.state) || self.health <= g_bloodloss)
+               if (((self.BUTTON_CROUCH && !self.hook.state) || self.health <= g_bloodloss) && self.animstate_startframe != 23) // prevent crouching if using melee attack
                {
                        if (!self.crouch)
                        {
index 83c438b47600f7b07bd8fbf3fe54e99f2c992d15..e6a8f9999ddb3d8018308c9fb1c0c8db76eeaee4 100644 (file)
@@ -163,7 +163,7 @@ void PlayerJump (void)
 
        if (self.crouch)
                setanim(self, self.anim_duckjump, FALSE, TRUE, TRUE);
-       else
+       else if (self.animstate_startframe != self.anim_melee_x || (self.animstate_startframe == self.anim_melee_x && time - self.animstate_starttime >= 21/20)) // jump animation shouldn't override melee until we have animation blending (or until the anim finished, 21/20 = numframes/fps)
                setanim(self, self.anim_jump, FALSE, TRUE, TRUE);
 
        if(g_jump_grunt)
index cd7c81d0c616d0cb1762a3aef893dff81dde214a..18817bdc6c48283d60eb0113b160f2125ccadcbe 100644 (file)
@@ -196,6 +196,7 @@ void player_setupanimsformodel()
        self.anim_backright = '21 1 1';
        self.anim_backleft  = '22 1 1';
        self.anim_melee = '23 1 1';
+       self.anim_fly = '24 1 1';
        animparseerror = FALSE;
        animfilename = strcat(self.model, ".animinfo");
        animfile = fopen(animfilename, FILE_READ);
@@ -223,6 +224,7 @@ void player_setupanimsformodel()
                self.anim_backright    = animparseline(animfile);
                self.anim_backleft     = animparseline(animfile);
                self.anim_melee        = animparseline(animfile);
+               self.anim_fly          = animparseline(animfile);
                fclose(animfile);
 
                // derived anims
@@ -260,13 +262,39 @@ void player_anim (void)
 
        if (!self.animstate_override)
        {
-               if (!(self.flags & FL_ONGROUND))
+               if (!(self.flags & FL_ONGROUND) || self.BUTTON_JUMP)
                {
                        if (self.crouch)
-                               setanim(self, self.anim_duckjump, FALSE, TRUE, self.restart_jump);
+                       {
+                               if (self.animstate_startframe != self.anim_duckjump_x) // don't perform another trace if already playing the crouch jump anim
+                               {
+                                       traceline(self.origin + '0 0 1' * PL_CROUCH_MIN_z, self.origin + '0 0 1' * (PL_CROUCH_MIN_z - autocvar_sv_player_jumpanim_minfall), TRUE, self);
+                                       if(!trace_startsolid && trace_fraction == 1 || !(self.animstate_startframe == self.anim_duckwalk_x || self.animstate_startframe == self.anim_duckidle_x)) // don't get stuck on non-crouch anims
+                                       {
+                                               setanim(self, self.anim_duckjump, FALSE, TRUE, self.restart_jump);
+                                               self.restart_jump = FALSE;
+                                       }
+                               }
+                       }
                        else
-                               setanim(self, self.anim_jump, FALSE, TRUE, self.restart_jump);
-                       self.restart_jump = FALSE;
+                       {
+                               // 21/25 is the magic number here for how long the jump animation takes to play once (numframes/framerate)
+                               if((self.animstate_startframe == self.anim_jump_x && time - self.animstate_starttime >= 21/25))
+                                       setanim(self, self.anim_fly, TRUE, FALSE, FALSE);
+
+                               if(self.animstate_startframe != self.anim_fly_x) // no tracing if we're in the fly anim
+                               {
+                                       if (self.animstate_startframe != self.anim_jump_x) // don't perform another trace if already playing the jump anim
+                                       {
+                                               traceline(self.origin + '0 0 1' * PL_MIN_z, self.origin + '0 0 1' * (PL_MIN_z - autocvar_sv_player_jumpanim_minfall), TRUE, self);
+                                               if(!trace_startsolid && trace_fraction == 1 || self.animstate_startframe == self.anim_idle_x || (self.animstate_startframe == self.anim_melee_x && time - self.animstate_starttime >= 21/20)) // don't get stuck on idle animation in midair, nor melee after it finished
+                                               {
+                                                       setanim(self, self.anim_jump, FALSE, TRUE, self.restart_jump);
+                                                       self.restart_jump = FALSE;
+                                               }
+                                       }
+                               }
+                       }
                }
                else if (self.crouch)
                {
@@ -489,10 +517,13 @@ void PlayerDamage (entity inflictor, entity attacker, float damage, float deatht
                                if(sv_gentle < 1) {
                                        if(self.classname != "body") // pain anim is BORKED on our ZYMs, FIXME remove this once we have good models
                                        {
-                                               if (random() > 0.5)
-                                                       setanim(self, self.anim_pain1, FALSE, TRUE, TRUE);
-                                               else
-                                                       setanim(self, self.anim_pain2, FALSE, TRUE, TRUE);
+                                               if (!self.animstate_override)
+                                               {
+                                                       if (random() > 0.5)
+                                                               setanim(self, self.anim_pain1, FALSE, TRUE, TRUE);
+                                                       else
+                                                               setanim(self, self.anim_pain2, FALSE, TRUE, TRUE);
+                                               }
                                        }
 
                                        if(sound_allowed(MSG_BROADCAST, attacker))
index 3d7a33278d15201ce89b789f1a03f9441e0d0be8..f6fc12a68e3b4b7409aa4cd9a45a4d40a81882b0 100644 (file)
@@ -1274,6 +1274,12 @@ void weapon_thinkf(float fr, float t, void() func)
                        anim_z = anim_y / (t + sys_frametime);
                        setanim(self, anim, FALSE, TRUE, TRUE);
                }
+               else if (self.animstate_startframe == self.anim_idle_x) // only allow shoot anim to override idle animation until we have animation blending
+               {
+                       anim = self.anim_shoot;
+                       anim_z = anim_y / (t + sys_frametime);
+                       setanim(self, anim, FALSE, TRUE, TRUE);
+               }
        }
 };
 
index 9e6a73b5e3642fe9e9ae952a9b6a318120e32ad7..e42dfe086ce50d67f8082d64867af7992c491cc6 100644 (file)
@@ -149,6 +149,7 @@ float maxclients;
 .vector anim_backright; // player running backward and right
 .vector anim_backleft; // player running back and left
 .vector anim_melee; // player doing the melee action
+.vector anim_fly; // player animation played after jump, if player is still in air. Also if falling from a ledge
 
 // weapon animation vectors:
 .vector anim_fire1;
index 888b94456ff6496223698d7a2bce47054f7276d6..64dc74b9840b52524495488dd4a31685878ad7d3 100644 (file)
@@ -200,6 +200,14 @@ void trigger_push_touch()
                        }
                        else
                                other.lastteleporttime = time;
+
+                       if (!other.animstate_override)
+                       {
+                               if (other.crouch)
+                                       setanim(other, other.anim_duckjump, FALSE, TRUE, TRUE);
+                               else
+                                       setanim(other, other.anim_jump, FALSE, TRUE, TRUE);
+                       }
                }
                else
                        other.jumppadcount = TRUE;
index b77ed92252eb640d7131ac40431caf54dfc9458e..bdd42ea379363c0ccba65784d71ac192e96f7f5b 100644 (file)
@@ -138,6 +138,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.BUTTON_ATCK2 && autocvar_g_balance_shotgun_secondary)
                if (weapon_prepareattack(1, autocvar_g_balance_shotgun_secondary_refire))
                {