]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/client/csqcmodel_hooks.qc
Revert "Merge branch 'Mario/despawn_effects'"
[xonotic/xonotic-data.pk3dir.git] / qcsrc / client / csqcmodel_hooks.qc
index 848c632773404b03f3e2b2f5cdea611483e78a17..120b6658df8792443433fc40d7192bc89c4e809b 100644 (file)
@@ -114,7 +114,7 @@ void CSQCPlayer_ModelAppearance_PostUpdate(void)
                self.forceplayermodels_isgoodmodel = fexists(self.forceplayermodels_savemodel);
                self.forceplayermodels_isgoodmodel_mdl = self.forceplayermodels_savemodel;
                if(!self.forceplayermodels_isgoodmodel)
-                       print(sprintf("Warning: missing model %s has been used\n", self.forceplayermodels_savemodel));
+                       printf("Warning: missing model %s has been used\n", self.forceplayermodels_savemodel);
        }
 }
 void CSQCPlayer_ModelAppearance_Apply(float islocalplayer)
@@ -218,16 +218,11 @@ void CSQCPlayer_ModelAppearance_Apply(float islocalplayer)
                // own team's color is never forced
                float forcecolor_friend = 0;
                float forcecolor_enemy = 0;
-               float teams_count = 0;
                entity tm;
 
-               for(tm = teams.sort_next; tm; tm = tm.sort_next)
-                       if(tm.team != NUM_SPECTATOR)
-                               ++teams_count;
-
                if(autocvar_cl_forcemyplayercolors)
                        forcecolor_friend = 1024 + autocvar_cl_forcemyplayercolors;
-               if(autocvar_cl_forceplayercolors && teams_count == 2)
+               if(autocvar_cl_forceplayercolors && team_count == 2)
                        forcecolor_enemy = 1024 + autocvar__cl_color;
 
                if(forcecolor_enemy && !forcecolor_friend)
@@ -292,7 +287,7 @@ void CSQCPlayer_ModelAppearance_Apply(float islocalplayer)
                else if(self.old_glowmod != '0 0 0') { self.old_glowmod = '0 0 0'; }
        }
 
-       //print(sprintf("CSQCPlayer_ModelAppearance_Apply(): state = %s, colormap = %f, glowmod = %s\n", (self.csqcmodel_isdead ? "DEAD" : "ALIVE"), self.colormap, vtos(self.glowmod)));
+       //printf("CSQCPlayer_ModelAppearance_Apply(): state = %s, colormap = %f, glowmod = %s\n", (self.csqcmodel_isdead ? "DEAD" : "ALIVE"), self.colormap, vtos(self.glowmod));
 }
 
 // FEATURE: fallback frames
@@ -362,7 +357,7 @@ float CSQCPlayer_FallbackFrame(float f)
                case 29: return 4; // anim_duckwalkbackright -> anim_duckwalk
                case 30: return 4; // anim_duckwalkbackleft -> anim_duckwalk
        }
-       print(sprintf("Frame %d missing in model %s, and we have no fallback - FAIL!\n", f, self.model));
+       printf("Frame %d missing in model %s, and we have no fallback - FAIL!\n", f, self.model);
        return f;
 }
 void CSQCPlayer_FallbackFrame_Apply(void)
@@ -610,7 +605,22 @@ void CSQCModel_Hook_PreDraw(float isplayer)
                CSQCPlayer_ModelAppearance_Apply(self.entnum == player_localnum + 1);
                CSQCPlayer_LOD_Apply();
                if(!isplayer)
+               {
+                       skeleton_loadinfo(self);
+                       float doblend = (self.bone_upperbody >= 0);
                        CSQCPlayer_FallbackFrame_Apply();
+                       if(doblend)
+                       {
+                               skeleton_from_frames(self, self.csqcmodel_isdead);
+                       }
+                       else
+                       {
+                               free_skeleton_from_frames(self);
+                               // just in case, clear these (we're animating in frame and frame3)
+                               self.lerpfrac = 0;
+                               self.lerpfrac4 = 0;
+                       }
+               }
                else
                {
                        // we know that frame3 and frame4 fields, used by InterpolateAnimation, are left alone - but that is all we know!