]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/lib/csqcmodel/cl_model.qc
Fix even more cases of self
[xonotic/xonotic-data.pk3dir.git] / qcsrc / lib / csqcmodel / cl_model.qc
index c07f94954bc97a4682f7e458e8947d31edddb853..53b58e6297be9dc07e6d6cfd72c8e2cbd5799d45 100644 (file)
@@ -37,145 +37,145 @@ float autocvar_cl_nolerp = 0;
 .float csqcmodel_lerpfractime;
 .float csqcmodel_lerpfrac2time;
 
-void CSQCModel_InterpolateAnimation_2To4_PreNote(int sf)
-{SELFPARAM();
+void CSQCModel_InterpolateAnimation_2To4_PreNote(entity this, int sf)
+{
        if(sf & CSQCMODEL_PROPERTY_FRAME)
        {
-               self.frame3 = self.frame;
-               self.frame3time = self.frame1time;
+               this.frame3 = this.frame;
+               this.frame3time = this.frame1time;
        }
        if(sf & CSQCMODEL_PROPERTY_FRAME2)
        {
-               self.frame4 = self.frame2;
-               self.frame4time = self.frame2time;
+               this.frame4 = this.frame2;
+               this.frame4time = this.frame2time;
        }
        if(sf & CSQCMODEL_PROPERTY_LERPFRAC)
        {
-               self.csqcmodel_lerpfrac2 = self.csqcmodel_lerpfrac;
-               self.csqcmodel_lerpfrac2time = self.csqcmodel_lerpfractime;
-               self.lerpfrac = self.csqcmodel_lerpfrac;
+               this.csqcmodel_lerpfrac2 = this.csqcmodel_lerpfrac;
+               this.csqcmodel_lerpfrac2time = this.csqcmodel_lerpfractime;
+               this.lerpfrac = this.csqcmodel_lerpfrac;
        }
 }
-void CSQCModel_InterpolateAnimation_1To2_PreNote(int sf)
-{SELFPARAM();
+void CSQCModel_InterpolateAnimation_1To2_PreNote(entity this, int sf)
+{
        if(sf & CSQCMODEL_PROPERTY_FRAME)
        {
-               self.frame2 = self.frame;
-               self.frame2time = self.frame1time;
+               this.frame2 = this.frame;
+               this.frame2time = this.frame1time;
        }
 }
-void CSQCModel_InterpolateAnimation_PreNote(int sf)
+void CSQCModel_InterpolateAnimation_PreNote(entity this, int sf)
 {
 #ifdef CSQCMODEL_HAVE_TWO_FRAMES
-       CSQCModel_InterpolateAnimation_2To4_PreNote(sf);
+       CSQCModel_InterpolateAnimation_2To4_PreNote(this, sf);
 #else
-       CSQCModel_InterpolateAnimation_1To2_PreNote(sf);
+       CSQCModel_InterpolateAnimation_1To2_PreNote(this, sf);
 #endif
 }
 
-void CSQCModel_InterpolateAnimation_2To4_Note(int sf, float set_times)
-{SELFPARAM();
+void CSQCModel_InterpolateAnimation_2To4_Note(entity this, int sf, bool set_times)
+{
        if(sf & CSQCMODEL_PROPERTY_FRAME)
        {
                if(set_times)
-                       self.frame1time = time;
+                       this.frame1time = time;
        }
        if(sf & CSQCMODEL_PROPERTY_FRAME2)
        {
                if(set_times)
-                       self.frame2time = time;
+                       this.frame2time = time;
        }
        if(sf & CSQCMODEL_PROPERTY_LERPFRAC)
        {
-               self.csqcmodel_lerpfrac = self.lerpfrac;
+               this.csqcmodel_lerpfrac = this.lerpfrac;
                if(set_times)
-                       self.csqcmodel_lerpfractime = time;
+                       this.csqcmodel_lerpfractime = time;
        }
 }
-void CSQCModel_InterpolateAnimation_1To2_Note(int sf, float set_times)
-{SELFPARAM();
+void CSQCModel_InterpolateAnimation_1To2_Note(entity this, int sf, bool set_times)
+{
        if(sf & CSQCMODEL_PROPERTY_FRAME)
        {
                if(set_times)
-                       self.frame1time = time;
+                       this.frame1time = time;
        }
 }
-void CSQCModel_InterpolateAnimation_Note(int sf)
+void CSQCModel_InterpolateAnimation_Note(entity this, int sf)
 {
 #ifdef CSQCMODEL_HAVE_TWO_FRAMES
-       CSQCModel_InterpolateAnimation_2To4_Note(sf, true);
+       CSQCModel_InterpolateAnimation_2To4_Note(this, sf, true);
 #else
-       CSQCModel_InterpolateAnimation_1To2_Note(sf, true);
+       CSQCModel_InterpolateAnimation_1To2_Note(this, sf, true);
 #endif
 }
 
-void CSQCModel_InterpolateAnimation_2To4_Do()
-{SELFPARAM();
+void CSQCModel_InterpolateAnimation_2To4_Do(entity this)
+{
        if(autocvar_cl_nolerp || (autocvar_cl_lerpanim_maxdelta_framegroups == 0))
        {
-               self.lerpfrac = self.csqcmodel_lerpfrac;
-               self.lerpfrac3 = 0;
-               self.lerpfrac4 = 0;
+               this.lerpfrac = this.csqcmodel_lerpfrac;
+               this.lerpfrac3 = 0;
+               this.lerpfrac4 = 0;
        }
        else
        {
                float l13, l24, llf;
                float l24_13;
 
-               if(self.frame3time == 0) // if frame1/3 were not previously displayed, only frame1 can make sense
+               if(this.frame3time == 0) // if frame1/3 were not previously displayed, only frame1 can make sense
                        l13 = 1;
                else
-                       l13 = bound(0, (time - self.frame1time) / autocvar_cl_lerpanim_maxdelta_framegroups, 1);
+                       l13 = bound(0, (time - this.frame1time) / autocvar_cl_lerpanim_maxdelta_framegroups, 1);
 
-               if(self.frame4time == 0) // if frame2/4 were not previously displayed, only frame2 can make sense
+               if(this.frame4time == 0) // if frame2/4 were not previously displayed, only frame2 can make sense
                        l24 = 1;
                else
-                       l24 = bound(0, (time - self.frame2time) / autocvar_cl_lerpanim_maxdelta_framegroups, 1);
+                       l24 = bound(0, (time - this.frame2time) / autocvar_cl_lerpanim_maxdelta_framegroups, 1);
 
-               if(self.csqcmodel_lerpfrac2time == 0) // if there is no old lerpfrac (newly displayed model), only lerpfrac makes sense
+               if(this.csqcmodel_lerpfrac2time == 0) // if there is no old lerpfrac (newly displayed model), only lerpfrac makes sense
                        llf = 1;
                else
-                       llf = bound(0, (time - self.csqcmodel_lerpfractime) / autocvar_cl_lerpanim_maxdelta_framegroups, 1);
+                       llf = bound(0, (time - this.csqcmodel_lerpfractime) / autocvar_cl_lerpanim_maxdelta_framegroups, 1);
 
-               l24_13 = self.csqcmodel_lerpfrac * llf + self.csqcmodel_lerpfrac2 * (1 - llf);
+               l24_13 = this.csqcmodel_lerpfrac * llf + this.csqcmodel_lerpfrac2 * (1 - llf);
 
-               self.lerpfrac  = l24 * l24_13;
-               self.lerpfrac4 = (1 - l24) * l24_13;
-               self.lerpfrac3 = (1 - l13) * (1 - l24_13);
+               this.lerpfrac  = l24 * l24_13;
+               this.lerpfrac4 = (1 - l24) * l24_13;
+               this.lerpfrac3 = (1 - l13) * (1 - l24_13);
 
                if(l24_13 == 0) // if frames 2/4 are not displayed, clear their frametime
                {
-                       self.frame2time = 0;
-                       self.frame4time = 0;
+                       this.frame2time = 0;
+                       this.frame4time = 0;
                }
 
                if(l24_13 == 1) // if frames 1/3 are not displayed, clear their frametime
                {
-                       self.frame1time = 0;
-                       self.frame3time = 0;
+                       this.frame1time = 0;
+                       this.frame3time = 0;
                }
        }
 }
-void CSQCModel_InterpolateAnimation_1To2_Do()
-{SELFPARAM();
+void CSQCModel_InterpolateAnimation_1To2_Do(entity this)
+{
        if(autocvar_cl_nolerp || (autocvar_cl_lerpanim_maxdelta_framegroups == 0))
        {
-               self.lerpfrac = 0;
+               this.lerpfrac = 0;
        }
        else
        {
-               if(self.frame2time == 0) // if frame2 was not previously displayed, only frame1 can make sense
-                       self.lerpfrac = 0;
+               if(this.frame2time == 0) // if frame2 was not previously displayed, only frame1 can make sense
+                       this.lerpfrac = 0;
                else
-                       self.lerpfrac = 1 - bound(0, (time - self.frame1time) / autocvar_cl_lerpanim_maxdelta_framegroups, 1);
+                       this.lerpfrac = 1 - bound(0, (time - this.frame1time) / autocvar_cl_lerpanim_maxdelta_framegroups, 1);
        }
 }
-void CSQCModel_InterpolateAnimation_Do()
+void CSQCModel_InterpolateAnimation_Do(entity this)
 {
 #ifdef CSQCMODEL_HAVE_TWO_FRAMES
-       CSQCModel_InterpolateAnimation_2To4_Do();
+       CSQCModel_InterpolateAnimation_2To4_Do(this);
 #else
-       CSQCModel_InterpolateAnimation_1To2_Do();
+       CSQCModel_InterpolateAnimation_1To2_Do(this);
 #endif
 }
 
@@ -190,7 +190,7 @@ void CSQCModel_Draw(entity this)
        // by CSQCPlayer_SetCamera()
        if (!CSQCPlayer_IsLocalPlayer(this)) InterpolateOrigin_Do(this);
 
-       WITH(entity, self, this, CSQCModel_InterpolateAnimation_Do());
+       CSQCModel_InterpolateAnimation_Do(this);
 
        { CSQCMODEL_HOOK_PREDRAW }
 
@@ -238,7 +238,7 @@ NET_HANDLE(ENT_CLIENT_MODEL, bool isnew)
 
        CSQCPlayer_PreUpdate(this);
        InterpolateOrigin_Undo(this);
-       CSQCModel_InterpolateAnimation_PreNote(sf);
+       CSQCModel_InterpolateAnimation_PreNote(this, sf);
 
 #define CSQCMODEL_IF(cond) if(cond) {
 #define CSQCMODEL_ENDIF }
@@ -267,7 +267,7 @@ NET_HANDLE(ENT_CLIENT_MODEL, bool isnew)
                this.csqcmodel_teleported = 1;
        }
 
-       CSQCModel_InterpolateAnimation_Note(sf);
+       CSQCModel_InterpolateAnimation_Note(this, sf);
        InterpolateOrigin_Note(this);
        CSQCPlayer_PostUpdate(this);
 
@@ -275,7 +275,7 @@ NET_HANDLE(ENT_CLIENT_MODEL, bool isnew)
 
 #ifdef CSQCMODEL_SUPPORT_GETTAGINFO_BEFORE_DRAW
        InterpolateOrigin_Do(this);
-       CSQCModel_InterpolateAnimation_Do();
+       CSQCModel_InterpolateAnimation_Do(this);
 #endif
 
        // relink