]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
get rid of the svqc death anim hack against "popping in"; do the same in CSQC by...
authorRudolf Polzer <divverent@xonotic.org>
Fri, 30 Dec 2011 09:01:45 +0000 (10:01 +0100)
committerRudolf Polzer <divverent@xonotic.org>
Fri, 30 Dec 2011 09:01:45 +0000 (10:01 +0100)
qcsrc/client/csqcmodel_hooks.qc
qcsrc/server/cl_client.qc
qcsrc/server/cl_player.qc
qcsrc/server/defs.qh

index 1ce9a96631f73f3468b96e777b5db265f145b814..e196396f0d9fa6bb00d0c42dd1774e63da6fa1ee 100644 (file)
@@ -1,4 +1,4 @@
-
+.float isplayermodel;
 
 // FEATURE: LOD
 .float lodmodelindex0;
@@ -148,12 +148,30 @@ void CSQCPlayer_FallbackFrame_PreUpdate(void)
        self.frame3 = self.csqcmodel_saveframe3;
        self.frame4 = self.csqcmodel_saveframe4;
 }
-void CSQCPlayer_FallbackFrame_PostUpdate(void)
+void CSQCPlayer_FallbackFrame_PostUpdate(float isnew)
 {
        self.csqcmodel_saveframe = self.frame;
        self.csqcmodel_saveframe2 = self.frame2;
        self.csqcmodel_saveframe3 = self.frame3;
        self.csqcmodel_saveframe4 = self.frame4;
+
+       // hack for death animations: set their frametime to zero in case a
+       // player "pops in"
+       if(isnew)
+       {
+#define FIX_FRAMETIME(f,ft) \
+               switch(self.f) \
+               { \
+                       case 0: // anim_die1 \
+                       case 1: // anim_die2 \
+                               self.ft = 0; \
+                               break; \
+               }
+               FIX_FRAMETIME(frame, frame1time);
+               FIX_FRAMETIME(frame2, frame2time);
+               FIX_FRAMETIME(frame3, frame3time);
+               FIX_FRAMETIME(frame4, frame4time);
+       }
 }
 float CSQCPlayer_FallbackFrame(float f)
 {
@@ -366,7 +384,7 @@ void CSQCModel_Hook_PreDraw(float isplayer, float islocalplayer)
        else
                self.drawmask = MASK_NORMAL;
 
-       if(isplayer)
+       if(self.isplayermodel) // this checks if it's a player MODEL!
        {
                CSQCPlayer_GlowMod_Apply();
                CSQCPlayer_ForceModel_Apply(islocalplayer);
@@ -374,30 +392,33 @@ void CSQCModel_Hook_PreDraw(float isplayer, float islocalplayer)
                CSQCPlayer_FallbackFrame_Apply();
        }
 
-       if(!isplayer)
+       if(!isplayer) // this checks if it's a player SLOT!
                CSQCModel_AutoTagIndex_Apply();
 
        CSQCModel_Effects_Apply();
 }
 
-void CSQCModel_Hook_PreUpdate(float isplayer, float islocalplayer)
+void CSQCModel_Hook_PreUpdate(float isnew, float isplayer, float islocalplayer)
 {
+       // revert to values from server
        CSQCModel_Effects_PreUpdate();
-       if(isplayer)
+       if(self.isplayermodel)
        {
-               // revert to values from server
                CSQCPlayer_FallbackFrame_PreUpdate();
                CSQCPlayer_ForceModel_PreUpdate();
        }
 }
 
-void CSQCModel_Hook_PostUpdate(float isplayer, float islocalplayer)
+void CSQCModel_Hook_PostUpdate(float isnew, float isplayer, float islocalplayer)
 {
-       if(isplayer)
+       // is it a player model? (shared state)
+       self.isplayermodel = (substring(self.model, 0, 14) == "models/player/");
+
+       // save values set by server
+       if(self.isplayermodel)
        {
-               // save values set by server
                CSQCPlayer_ForceModel_PostUpdate();
-               CSQCPlayer_FallbackFrame_PostUpdate();
+               CSQCPlayer_FallbackFrame_PostUpdate(isnew);
        }
        CSQCModel_Effects_PostUpdate();
 }
index c409b343a1bc95a2794ee13ed2fffb7a6e1199e8..e8ccc07d73330760e9d856b0ca217c30f8c0df56 100644 (file)
@@ -466,7 +466,6 @@ void PutObserverInServer (void)
        self.pauseregen_finished = 0;
        self.damageforcescale = 0;
        self.death_time = 0;
-       self.dead_frame = 0;
        self.alpha = 0;
        self.scale = 0;
        self.fade_time = 0;
@@ -776,7 +775,6 @@ void PutClientInServer (void)
                }
                self.damageforcescale = 2;
                self.death_time = 0;
-               self.dead_frame = 0;
                self.alpha = 0;
                self.scale = 0;
                self.fade_time = 0;
index 5b369c27c5e2eea45e4bccb73c2df778b11c72f4..deb08aa9c618769bdb3bdcc67285e0d7447160fc 100644 (file)
@@ -167,7 +167,6 @@ void CopyBody(float keepvelocity)
        self.animstate_override = oldself.animstate_override;
        self.animstate_looping = oldself.animstate_looping;
        self.frame = oldself.frame;
-       self.dead_frame = oldself.dead_frame;
        self.pain_finished = oldself.pain_finished;
        self.health = oldself.health;
        self.armorvalue = oldself.armorvalue;
@@ -239,8 +238,8 @@ void player_setupanimsformodel()
        self.anim_runbackwards = animfixfps(self, '14 1 1');
        self.anim_strafeleft = animfixfps(self, '15 1 1');
        self.anim_straferight = animfixfps(self, '16 1 1');
-       self.anim_dead1 = animfixfps(self, '17 1 1');
-       self.anim_dead2 = animfixfps(self, '18 1 1');
+       //self.anim_dead1 = animfixfps(self, '17 1 1');
+       //self.anim_dead2 = animfixfps(self, '18 1 1');
        self.anim_forwardright = animfixfps(self, '19 1 1');
        self.anim_forwardleft = animfixfps(self, '20 1 1');
        self.anim_backright = animfixfps(self, '21 1 1');
@@ -265,18 +264,7 @@ void player_anim (void)
                updateanim(self.weaponentity);
 
        if (self.deadflag != DEAD_NO)
-       {
-               if (time > self.animstate_endtime)
-               {
-                       if (self.maxs_z > 5)
-                       {
-                               self.maxs_z = 5;
-                               setsize(self, self.mins, self.maxs);
-                       }
-                       self.frame = self.dead_frame;
-               }
                return;
-       }
 
        if (!self.animstate_override)
        {
@@ -424,7 +412,6 @@ void PlayerCorpseDamage (entity inflictor, entity attacker, float damage, float
        {
                // don't use any animations as a gib
                self.frame = 0;
-               self.dead_frame = 0;
                // view just above the floor
                self.view_ofs = '0 0 4';
 
@@ -778,14 +765,13 @@ void PlayerDamage (entity inflictor, entity attacker, float damage, float deatht
                else
                        self.respawn_countdown = -1; // do not count down
                if (random() < 0.5)
-               {
                        setanim(self, self.anim_die1, FALSE, TRUE, TRUE);
-                       self.dead_frame = self.anim_dead1_x;
-               }
                else
-               {
                        setanim(self, self.anim_die2, FALSE, TRUE, TRUE);
-                       self.dead_frame = self.anim_dead2_x;
+               if (self.maxs_z > 5)
+               {
+                       self.maxs_z = 5;
+                       setsize(self, self.mins, self.maxs);
                }
                // set damage function to corpse damage
                self.event_damage = PlayerCorpseDamage;
index 4b2684c510a730cbaf0ecc9ce6cdab141b9b8779..c2b01a8019c41e50ba593173c1181f42c78a26e7 100644 (file)
@@ -105,7 +105,6 @@ float maxclients;
 
 .float play_time;
 .float death_time;
-.float dead_frame;
 .float fade_time;
 .float fade_rate;
 
@@ -140,8 +139,8 @@ float maxclients;
 .vector anim_runbackwards; // player running backward
 .vector anim_strafeleft; // player shuffling left quickly
 .vector anim_straferight; // player shuffling right quickly
-.vector anim_dead1; // player dead (must be identical to last frame of die1)
-.vector anim_dead2; // player dead (must be identical to last frame of die2)
+//.vector anim_dead1; // player dead (must be identical to last frame of die1)
+//.vector anim_dead2; // player dead (must be identical to last frame of die2)
 .vector anim_forwardright; // player running forward and right
 .vector anim_forwardleft; // player running forward and left
 .vector anim_backright; // player running backward and right