]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/client/csqcmodel_hooks.qc
player model LOD: fix origin, actually work
[xonotic/xonotic-data.pk3dir.git] / qcsrc / client / csqcmodel_hooks.qc
index 6010cf0a521e1421a8bfdaecb11bafe230652c21..27fb70d86461ea1cee14ad79ac5fd8ee8a51afe1 100644 (file)
@@ -53,8 +53,8 @@ void CSQCPlayer_LOD_Apply(void)
        }
        else
        {
-               float distance = vlen(self.origin - other.origin);
-               float f = (distance + 100.0) * autocvar_cl_playerdetailreduction;
+               float distance = vlen(self.origin - view_origin);
+               float f = (distance * current_viewzoom + 100.0) * autocvar_cl_playerdetailreduction;
                f *= 1.0 / bound(0.01, view_quality, 1);
                if(f > autocvar_cl_loddistance2)
                        self.modelindex = self.lodmodelindex2;
@@ -228,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; \
                }
@@ -243,6 +243,8 @@ float CSQCPlayer_FallbackFrame(float f)
 {
        if(frameduration(self.modelindex, f) > 0)
                return f; // goooooood
+       if(frameduration(self.modelindex, 1) <= 0)
+               return f; // this is a static model. We can't fix it if we wanted to
        switch(f)
        {
                case 23: return 11; // anim_melee -> anim_shoot