From: Rudolf Polzer Date: Wed, 23 Jan 2013 12:10:31 +0000 (+0100) Subject: animdecide: don't reload model info every frame, only reload when modelindex changed X-Git-Tag: xonotic-v0.7.0~99^2~5 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=6547046dab466d096d9b69b4861a0bfd8456ec66;p=xonotic%2Fxonotic-data.pk3dir.git animdecide: don't reload model info every frame, only reload when modelindex changed --- diff --git a/qcsrc/client/csqcmodel_hooks.qc b/qcsrc/client/csqcmodel_hooks.qc index 23facf87f..1d0c36ae9 100644 --- a/qcsrc/client/csqcmodel_hooks.qc +++ b/qcsrc/client/csqcmodel_hooks.qc @@ -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; diff --git a/qcsrc/common/animdecide.qc b/qcsrc/common/animdecide.qc index 3efdab4a3..32ffef248 100644 --- a/qcsrc/common/animdecide.qc +++ b/qcsrc/common/animdecide.qc @@ -32,9 +32,14 @@ .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 diff --git a/qcsrc/csqcmodellib/cl_model.qc b/qcsrc/csqcmodellib/cl_model.qc index 85e2f15ee..f5a105f12 100644 --- a/qcsrc/csqcmodellib/cl_model.qc +++ b/qcsrc/csqcmodellib/cl_model.qc @@ -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 {