]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/client/csqcmodel_hooks.qc
don't do this if death_time is zero
[xonotic/xonotic-data.pk3dir.git] / qcsrc / client / csqcmodel_hooks.qc
index 7204981bd4f3ee8d83806688af7c04fe97b3c74c..d7eddbcd8edd340b70a8b4bcf0df4912bb5cb062 100644 (file)
@@ -117,6 +117,7 @@ void CSQCPlayer_ForceModel_Apply(float islocalplayer)
        {
                entity e;
                e = spawn();
+               precache_model(cvar_defstring("_cl_playermodel"));
                setmodel(e, cvar_defstring("_cl_playermodel"));
                forceplayermodels_goodmodel = e.model;
                forceplayermodels_goodmodelindex = e.modelindex;
@@ -207,8 +208,6 @@ void CSQCPlayer_ForceModel_Apply(float islocalplayer)
 .float csqcmodel_saveframe4;
 .float csqcmodel_framecount;
 
-.float csqcmodel_isdead; // for utility code
-
 #define IS_DEAD_FRAME(f) ((f) == 0 || (f) == 1)
 void CSQCPlayer_FallbackFrame_PreUpdate(void)
 {
@@ -229,7 +228,7 @@ void CSQCPlayer_FallbackFrame_PostUpdate(float isnew)
        if(isnew)
        {
 #define FIX_FRAMETIME(f,ft) \
-               if(IS_DEAD_FRAME(self.f)) \
+               if(IS_DEAD_FRAME(self.f) && self.ft != 0 && self.death_time != 0) \
                { \
                        self.ft = self.death_time; \
                }
@@ -465,8 +464,9 @@ void CSQCPlayer_GlowMod_Apply(void)
                {
                        self.glowmod = self.glowmod * bound(0, 1 - (time - self.death_time) / autocvar_cl_deathglow, 1);
                        // prevent the zero vector
-                       if(self.glowmod_x == 0)
-                               self.glowmod_x = -1;
+                       self.glowmod_x = max(self.glowmod_x, 0.0001);
+                       self.glowmod_y = max(self.glowmod_y, 0.0001);
+                       self.glowmod_z = max(self.glowmod_z, 0.0001);
                }
 }