From: Mario Date: Sun, 3 Jan 2016 14:53:52 +0000 (+1000) Subject: Fix even more cases of self X-Git-Tag: xonotic-v0.8.2~1305 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=d0a609ae172c4ba48cff7cbc642a8b2b3966efbf;p=xonotic%2Fxonotic-data.pk3dir.git Fix even more cases of self --- diff --git a/qcsrc/client/csqcmodel_hooks.qc b/qcsrc/client/csqcmodel_hooks.qc index 4abf49186..4a04eb5e0 100644 --- a/qcsrc/client/csqcmodel_hooks.qc +++ b/qcsrc/client/csqcmodel_hooks.qc @@ -389,7 +389,7 @@ void CSQCModel_AutoTagIndex_Apply(entity this) if(this.tag_entity && wasfreed(this.tag_entity)) this.tag_entity = world; - WITH(entity, self, this, viewloc_SetTags()); + viewloc_SetTags(this); MUTATOR_CALLHOOK(TagIndex_Update, this); @@ -406,7 +406,7 @@ void CSQCModel_AutoTagIndex_Apply(entity this) // recursive predraw call to fix issues with forcemodels and LOD if bone indexes mismatch if(this.tag_entity.classname == "csqcmodel") { - WITH(entity, this, this.tag_entity, CSQCModel_Hook_PreDraw(this, (this.entnum >= 1 && this.entnum <= maxclients))); + CSQCModel_Hook_PreDraw(this.tag_entity, (this.entnum >= 1 && this.entnum <= maxclients)); } if(this.tag_entity.modelindex != this.tag_entity_lastmodelindex) @@ -490,7 +490,7 @@ void CSQCModel_Effects_PostUpdate(entity this) { if (this == csqcplayer) { if (this.csqcmodel_teleported) { - WITH(entity, self, this, Reset_ArcBeam()); + Reset_ArcBeam(); } } this.csqcmodel_effects = this.effects; @@ -677,14 +677,14 @@ void CSQCModel_Hook_PreDraw(entity this, bool isplayer) this.anim_saveframe2time = this.anim_frame2time; // Note: we always consider lerpfrac "changed", as it uses fixed values every time anyway. // This ensures that .frame etc. are always written. - WITH(entity, self, this, CSQCModel_InterpolateAnimation_2To4_PreNote(sf | CSQCMODEL_PROPERTY_LERPFRAC)); + CSQCModel_InterpolateAnimation_2To4_PreNote(this, sf | CSQCMODEL_PROPERTY_LERPFRAC); this.lerpfrac = (doblend ? 0.5 : 0); this.frame = this.anim_frame; this.frame1time = this.anim_frame1time; this.frame2 = this.anim_frame2; this.frame2time = this.anim_frame2time; - WITH(entity, self, this, CSQCModel_InterpolateAnimation_2To4_Note(sf | CSQCMODEL_PROPERTY_LERPFRAC, false)); - WITH(entity, self, this, CSQCModel_InterpolateAnimation_2To4_Do()); + CSQCModel_InterpolateAnimation_2To4_Note(this, sf | CSQCMODEL_PROPERTY_LERPFRAC, false); + CSQCModel_InterpolateAnimation_2To4_Do(this); if(doblend) { skeleton_from_frames(this, this.csqcmodel_isdead); diff --git a/qcsrc/common/viewloc.qc b/qcsrc/common/viewloc.qc index 61c5149f3..f67bbc887 100644 --- a/qcsrc/common/viewloc.qc +++ b/qcsrc/common/viewloc.qc @@ -61,16 +61,16 @@ void viewloc_PlayerPhysics(entity this) #ifdef CSQC -void viewloc_SetTags() -{SELFPARAM(); - if(self.viewloc && wasfreed(self.viewloc)) - self.viewloc = world; - - if(self.viewloc.entnum != self.tag_networkviewloc) - if(self.tag_networkviewloc == 0) - self.viewloc = world; +void viewloc_SetTags(entity this) +{ + if(this.viewloc && wasfreed(this.viewloc)) + this.viewloc = world; + + if(this.viewloc.entnum != this.tag_networkviewloc) + if(this.tag_networkviewloc == 0) + this.viewloc = world; else - self.viewloc = findfloat(world, entnum, self.tag_networkviewloc); + this.viewloc = findfloat(world, entnum, this.tag_networkviewloc); } vector old_camera_angle = '0 0 0'; diff --git a/qcsrc/common/viewloc.qh b/qcsrc/common/viewloc.qh index ceebe9c02..4c4d05f92 100644 --- a/qcsrc/common/viewloc.qh +++ b/qcsrc/common/viewloc.qh @@ -8,7 +8,7 @@ void viewloc_PlayerPhysics(entity this); #ifdef CSQC void viewloc_SetViewLocation(); -void viewloc_SetTags(); +void viewloc_SetTags(entity this); #endif diff --git a/qcsrc/lib/csqcmodel/cl_model.qc b/qcsrc/lib/csqcmodel/cl_model.qc index c07f94954..53b58e629 100644 --- a/qcsrc/lib/csqcmodel/cl_model.qc +++ b/qcsrc/lib/csqcmodel/cl_model.qc @@ -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 diff --git a/qcsrc/lib/csqcmodel/cl_model.qh b/qcsrc/lib/csqcmodel/cl_model.qh index 1f9d23b4d..3b20972e2 100644 --- a/qcsrc/lib/csqcmodel/cl_model.qh +++ b/qcsrc/lib/csqcmodel/cl_model.qh @@ -40,14 +40,14 @@ entity CSQCModel_server2csqc(int i); // this is exported for custom frame animation code. Use with care. // to update frames, first call this: -void CSQCModel_InterpolateAnimation_2To4_PreNote(int sf); -void CSQCModel_InterpolateAnimation_1To2_PreNote(int sf); +void CSQCModel_InterpolateAnimation_2To4_PreNote(entity this, int sf); +void CSQCModel_InterpolateAnimation_1To2_PreNote(entity this, int sf); // then update frame, frame1time (and possibly frame2, frame2time, lerpfrac) // if set_times is not set, caller is responsible for frame1time, frame2time, csqcmodel_lerpfractime! -void CSQCModel_InterpolateAnimation_2To4_Note(int sf, float set_times); -void CSQCModel_InterpolateAnimation_1To2_Note(int sf, float set_times); +void CSQCModel_InterpolateAnimation_2To4_Note(entity this, int sf, float set_times); +void CSQCModel_InterpolateAnimation_1To2_Note(entity this, int sf, float set_times); // to retrieve animation state, call this -void CSQCModel_InterpolateAnimation_2To4_Do(); -void CSQCModel_InterpolateAnimation_1To2_Do(); +void CSQCModel_InterpolateAnimation_2To4_Do(entity this); +void CSQCModel_InterpolateAnimation_1To2_Do(entity this); // will overwrite lerpfrac, lerpfrac3, lerpfrac4, and possibly clear frame*time if they are undisplayed according to lerpfracs #endif