]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Merge remote-tracking branch 'origin/master' into fruitiex/animations
authorFruitieX <fruitiex@gmail.com>
Thu, 9 Jun 2011 11:47:22 +0000 (14:47 +0300)
committerFruitieX <fruitiex@gmail.com>
Thu, 9 Jun 2011 11:47:22 +0000 (14:47 +0300)
Conflicts:
defaultXonotic.cfg
qcsrc/server/cl_weaponsystem.qc

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 8cc42a7cae86459df2ec169c05c0e5d6931abc1d..edfa00f4d1a6005ffb51de56c98fbb5e7c145faf 100644 (file)
@@ -319,7 +319,8 @@ set sv_ready_restart_repeatable 0   "allows the players to restart the game as oft
 seta cl_hitsound 1 "play a hit notifier sound when you have hit an enemy"
 set cl_hitsound_antispam_time 0.05 "don't play the hitsound more often than this"
 
-seta cl_eventchase_death 0 "camera goes into 3rd person mode when the player is dead"
+seta cl_eventchase_death 1 "camera goes into 3rd person mode when the player is dead"
+seta cl_eventchase_intermission 1 "camera goes into 3rd person mode when the match ends"
 seta cl_eventchase_distance 140 "final camera distance"
 seta cl_eventchase_speed 1.3 "how fast the camera slides back, 0 is instant"
 
@@ -385,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 36b41896c304f1eaa0ff5006bdf460e2d3d06304..50e46f33776090e078e2f83fff103ba8f29ab990 100644 (file)
@@ -1185,6 +1185,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 51f8cf2c15560a53da75ee365e4f3e42079ea122..d942784caca006f97de76bad6f054b3244cebaf1 100644 (file)
@@ -2818,7 +2818,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 bba558769eb19cb0b7e023d32dd9f0527481e0f7..d2203c241877754ca5b59e021b0ada1957dc3240 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) // jump animation shouldn't override melee until we have animation blending
                setanim(self, self.anim_jump, FALSE, TRUE, TRUE);
 
        if(g_jump_grunt)
index 04ce7c0d35016166119514aaa3c99e80101638dc..382645810b47fec2719cfc1b8f74e56dbb973fd7 100644 (file)
@@ -193,6 +193,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);
@@ -220,6 +221,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
@@ -257,13 +259,32 @@ 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);
-                       else
-                               setanim(self, self.anim_jump, FALSE, TRUE, self.restart_jump);
-                       self.restart_jump = FALSE;
+                       if((self.animstate_startframe == self.anim_jump_x && time - self.animstate_starttime >= 21/25) || (self.animstate_startframe == self.anim_duckjump_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.crouch && 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_idle_x) // don't get stuck on idle animation in midair
+                                       {
+                                               setanim(self, self.anim_duckjump, FALSE, TRUE, self.restart_jump);
+                                               self.restart_jump = FALSE;
+                                       }
+                               }
+                               else 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) // don't get stuck on idle animation in midair
+                                       {
+                                               setanim(self, self.anim_jump, FALSE, TRUE, self.restart_jump);
+                                               self.restart_jump = FALSE;
+                                       }
+                               }
+                       }
                }
                else if (self.crouch)
                {
@@ -486,10 +507,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 15894f6df0bc009f2c727f49b15bd2c252580806..b18e1c847cbe8feef94c0f547c577ccadd3b48a5 100644 (file)
@@ -1273,6 +1273,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 e0a362ebe8dfbc8c5bb2d1ebf1c2f2a6a52e7209..147e88f966f613f0b19f1ccd07a1d499f77b8033 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 1e72b765a0a0b548de052f9d31accdfc8e906b0c..19d0d1cff92cc12963a21897d0811fd418cd4bc8 100644 (file)
@@ -192,6 +192,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 635b1ccf8b959ac753e4f06ef493605e9049b973..f9bcc251f46c8084e454dc52d0bd972149b44158 100644 (file)
@@ -132,6 +132,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))
                {