]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
animdecide: don't reload model info every frame, only reload when modelindex changed
authorRudolf Polzer <divverent@xonotic.org>
Wed, 23 Jan 2013 12:10:31 +0000 (13:10 +0100)
committerRudolf Polzer <divverent@xonotic.org>
Wed, 23 Jan 2013 12:10:31 +0000 (13:10 +0100)
qcsrc/client/csqcmodel_hooks.qc
qcsrc/common/animdecide.qc
qcsrc/csqcmodellib/cl_model.qc

index 23facf87f7fcc787348a1d43a406ef8089a5afbb..1d0c36ae9c1236302d77cc354511a88deeb3d31b 100644 (file)
@@ -629,7 +629,7 @@ void CSQCModel_Hook_PreDraw(float isplayer)
                                if(trace_startsolid || trace_fraction < 1)
                                        onground = 1;
                        }
-                       animdecide_init(self); // FIXME only do this on model change
+                       animdecide_init(self);
                        animdecide_setimplicitstate(self, onground);
                        animdecide_setframes(self, doblend, anim_frame, anim_frame1time, anim_frame2, anim_frame2time);
                        float sf = 0;
index 3efdab4a3311882013ba38fe49330a20e21301b7..32ffef248d540ce8b5f9c85101ec8e5ceef0b37b 100644 (file)
 .vector anim_duckwalkforwardleft;
 .vector anim_duckwalkbackright;
 .vector anim_duckwalkbackleft;
+.float animdecide_modelindex;
 
 void animdecide_init(entity e)
 {
+       if(e.modelindex == e.animdecide_modelindex)
+               return;
+       e.animdecide_modelindex = e.modelindex;
+
        vector none = '0 0 0';
        e.anim_die1 = animfixfps(e, '0 1 0.5', none); // 2 seconds
        e.anim_die2 = animfixfps(e, '1 1 0.5', none); // 2 seconds
index 85e2f15ee99ca82f51732b0ff8ca4faaaf09d61b..f5a105f12e09fc4c216b5152f703a6f4baff841b 100644 (file)
@@ -133,6 +133,7 @@ void CSQCModel_InterpolateAnimation_2To4_Do()
                self.lerpfrac  = l24 * l24_13;
                self.lerpfrac4 = (1 - l24) * l24_13;
                self.lerpfrac3 = (1 - l13) * (1 - l24_13);
+               print(sprintf("Xframe=%d frame2=%d frame3=%d frame4=%d lerp=%f lerp3=%f lerp4=%f\n", self.frame, self.frame2, self.frame3, self.frame4, self.lerpfrac, self.lerpfrac3, self.lerpfrac4));
 
                if(l24_13 == 0) // if frames 2/4 are not displayed, clear their frametime
                {