From 303bdeff4f5624a5e806f3f52ca62f4cb6e6404d Mon Sep 17 00:00:00 2001 From: Mario Date: Sun, 3 Jan 2016 23:57:20 +1000 Subject: [PATCH] Purge most cases of self from the client folder --- qcsrc/client/commands/cl_cmd.qc | 8 +- qcsrc/client/csqcmodel_hooks.qc | 534 +++++++++--------- qcsrc/client/hud/panel/weapons.qc | 30 +- qcsrc/client/main.qc | 16 +- qcsrc/client/main.qh | 2 +- qcsrc/client/mapvoting.qc | 2 +- qcsrc/client/player_skeleton.qc | 6 +- qcsrc/client/teamradar.qc | 22 +- qcsrc/client/view.qc | 14 +- qcsrc/client/wall.qc | 178 +++--- qcsrc/client/wall.qh | 2 +- qcsrc/client/weapons/projectile.qc | 413 +++++++------- qcsrc/client/weapons/projectile.qh | 4 +- qcsrc/common/csqcmodel_settings.qh | 6 +- qcsrc/common/ent_cs.qc | 3 +- qcsrc/common/minigames/cl_minigames.qc | 16 +- qcsrc/common/mutators/base.qh | 3 +- .../mutator/waypoints/waypointsprites.qc | 10 +- .../mutator/waypoints/waypointsprites.qh | 2 +- qcsrc/common/t_items.qc | 8 +- qcsrc/common/triggers/func/ladder.qc | 6 +- qcsrc/common/triggers/func/pointparticles.qc | 16 +- qcsrc/common/triggers/misc/corner.qc | 28 +- qcsrc/common/triggers/misc/teleport_dest.qc | 10 +- qcsrc/common/triggers/trigger/jumppads.qc | 16 +- qcsrc/common/triggers/trigger/keylock.qc | 28 +- qcsrc/common/triggers/triggers.qc | 28 +- qcsrc/common/triggers/triggers.qh | 2 +- qcsrc/common/turrets/cl_turrets.qc | 10 +- qcsrc/common/weapons/weapon/arc.qc | 8 +- qcsrc/common/weapons/weapon/hook.qc | 6 +- qcsrc/common/weapons/weapon/tuba.qc | 10 +- qcsrc/lib/csqcmodel/cl_model.qc | 3 +- qcsrc/lib/csqcmodel/cl_player.qc | 2 +- 34 files changed, 724 insertions(+), 728 deletions(-) diff --git a/qcsrc/client/commands/cl_cmd.qc b/qcsrc/client/commands/cl_cmd.qc index 6481d6b1d..873cef258 100644 --- a/qcsrc/client/commands/cl_cmd.qc +++ b/qcsrc/client/commands/cl_cmd.qc @@ -23,13 +23,13 @@ void DrawDebugModel(entity this) { if (time - floor(time) > 0.5) { - PolyDrawModel(self); - self.drawmask = 0; + PolyDrawModel(this); + this.drawmask = 0; } else { - self.renderflags = 0; - self.drawmask = MASK_NORMAL; + this.renderflags = 0; + this.drawmask = MASK_NORMAL; } } diff --git a/qcsrc/client/csqcmodel_hooks.qc b/qcsrc/client/csqcmodel_hooks.qc index 64e0eca58..4abf49186 100644 --- a/qcsrc/client/csqcmodel_hooks.qc +++ b/qcsrc/client/csqcmodel_hooks.qc @@ -11,7 +11,7 @@ .float death_time; .int modelflags; -void CSQCModel_Hook_PreDraw(bool isplayer); +void CSQCModel_Hook_PreDraw(entity this, bool isplayer); .bool isplayermodel; @@ -19,66 +19,66 @@ void CSQCModel_Hook_PreDraw(bool isplayer); .int lodmodelindex0; .int lodmodelindex1; .int lodmodelindex2; -void CSQCPlayer_LOD_Apply() -{SELFPARAM(); +void CSQCPlayer_LOD_Apply(entity this) +{ // LOD model loading - if(self.lodmodelindex0 != self.modelindex) + if(this.lodmodelindex0 != this.modelindex) { - string modelname = self.model; + string modelname = this.model; string s; - vector mi = self.mins; - vector ma = self.maxs; + vector mi = this.mins; + vector ma = this.maxs; // set modelindex - self.lodmodelindex0 = self.modelindex; - self.lodmodelindex1 = self.modelindex; - self.lodmodelindex2 = self.modelindex; + this.lodmodelindex0 = this.modelindex; + this.lodmodelindex1 = this.modelindex; + this.lodmodelindex2 = this.modelindex; // FIXME: this only supports 3-letter extensions s = strcat(substring(modelname, 0, strlen(modelname)-4), "_lod1", substring(modelname, -4, 4)); if(fexists(s)) { precache_model(s); - _setmodel(self, s); - if(self.modelindex) - self.lodmodelindex1 = self.modelindex; + _setmodel(this, s); + if(this.modelindex) + this.lodmodelindex1 = this.modelindex; } s = strcat(substring(modelname, 0, strlen(modelname)-4), "_lod2", substring(modelname, -4, 4)); if(fexists(s)) { precache_model(s); - _setmodel(self, s); - if(self.modelindex) - self.lodmodelindex2 = self.modelindex; + _setmodel(this, s); + if(this.modelindex) + this.lodmodelindex2 = this.modelindex; } - _setmodel(self, modelname); // make everything normal again - setsize(self, mi, ma); + _setmodel(this, modelname); // make everything normal again + setsize(this, mi, ma); } // apply LOD if(autocvar_cl_playerdetailreduction <= 0) { if(autocvar_cl_playerdetailreduction <= -2) - self.modelindex = self.lodmodelindex2; + this.modelindex = this.lodmodelindex2; else if(autocvar_cl_playerdetailreduction <= -1) - self.modelindex = self.lodmodelindex1; + this.modelindex = this.lodmodelindex1; else - self.modelindex = self.lodmodelindex0; + this.modelindex = this.lodmodelindex0; } else { - float distance = vlen(self.origin - view_origin); + float distance = vlen(this.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; + this.modelindex = this.lodmodelindex2; else if(f > autocvar_cl_loddistance1) - self.modelindex = self.lodmodelindex1; + this.modelindex = this.lodmodelindex1; else - self.modelindex = self.lodmodelindex0; + this.modelindex = this.lodmodelindex0; } } @@ -108,30 +108,30 @@ int forceplayermodels_goodmodelindex; .vector glowmod; .vector old_glowmod; -void CSQCPlayer_ModelAppearance_PreUpdate() -{SELFPARAM(); - self.model = self.forceplayermodels_savemodel; - self.modelindex = self.forceplayermodels_savemodelindex; - self.skin = self.forceplayermodels_saveskin; - self.colormap = self.forceplayermodels_savecolormap; +void CSQCPlayer_ModelAppearance_PreUpdate(entity this) +{ + this.model = this.forceplayermodels_savemodel; + this.modelindex = this.forceplayermodels_savemodelindex; + this.skin = this.forceplayermodels_saveskin; + this.colormap = this.forceplayermodels_savecolormap; } -void CSQCPlayer_ModelAppearance_PostUpdate() -{SELFPARAM(); - self.forceplayermodels_savemodel = self.model; - self.forceplayermodels_savemodelindex = self.modelindex; - self.forceplayermodels_saveskin = self.skin; - self.forceplayermodels_savecolormap = self.colormap; - - if(self.forceplayermodels_savemodel != self.forceplayermodels_isgoodmodel_mdl) +void CSQCPlayer_ModelAppearance_PostUpdate(entity this) +{ + this.forceplayermodels_savemodel = this.model; + this.forceplayermodels_savemodelindex = this.modelindex; + this.forceplayermodels_saveskin = this.skin; + this.forceplayermodels_savecolormap = this.colormap; + + if(this.forceplayermodels_savemodel != this.forceplayermodels_isgoodmodel_mdl) { - self.forceplayermodels_isgoodmodel = fexists(self.forceplayermodels_savemodel); - self.forceplayermodels_isgoodmodel_mdl = self.forceplayermodels_savemodel; - if(!self.forceplayermodels_isgoodmodel) - LOG_INFOF("Warning: missing model %s has been used\n", self.forceplayermodels_savemodel); + this.forceplayermodels_isgoodmodel = fexists(this.forceplayermodels_savemodel); + this.forceplayermodels_isgoodmodel_mdl = this.forceplayermodels_savemodel; + if(!this.forceplayermodels_isgoodmodel) + LOG_INFOF("Warning: missing model %s has been used\n", this.forceplayermodels_savemodel); } } -void CSQCPlayer_ModelAppearance_Apply(bool islocalplayer) -{SELFPARAM(); +void CSQCPlayer_ModelAppearance_Apply(entity this, bool islocalplayer) +{ // FORCEMODEL // which one is ALWAYS good? if (!forceplayermodels_goodmodel) @@ -145,17 +145,17 @@ void CSQCPlayer_ModelAppearance_Apply(bool islocalplayer) } // first, try finding it from the server - if(self.forceplayermodels_savemodelindex && self.forceplayermodels_savemodel != "null") + if(this.forceplayermodels_savemodelindex && this.forceplayermodels_savemodel != "null") { if(islocalplayer) { if(!isdemo()) // this is mainly cheat protection; not needed for demos { // trust server's idea of "own player model" - forceplayermodels_modelisgoodmodel = self.forceplayermodels_isgoodmodel; - forceplayermodels_model = self.forceplayermodels_savemodel; - forceplayermodels_modelindex = self.forceplayermodels_savemodelindex; - forceplayermodels_skin = self.forceplayermodels_saveskin; + forceplayermodels_modelisgoodmodel = this.forceplayermodels_isgoodmodel; + forceplayermodels_model = this.forceplayermodels_savemodel; + forceplayermodels_modelindex = this.forceplayermodels_savemodelindex; + forceplayermodels_skin = this.forceplayermodels_saveskin; forceplayermodels_attempted = 1; } } @@ -190,7 +190,7 @@ void CSQCPlayer_ModelAppearance_Apply(bool islocalplayer) // apply it bool isfriend; int cm; - cm = self.forceplayermodels_savecolormap; + cm = this.forceplayermodels_savecolormap; cm = (cm >= 1024) ? cm : (stof(getplayerkeyvalue(cm - 1, "colors")) + 1024); if(teamplay) @@ -200,27 +200,27 @@ void CSQCPlayer_ModelAppearance_Apply(bool islocalplayer) if(autocvar_cl_forcemyplayermodel != "" && forceplayermodels_myisgoodmodel && isfriend) { - self.model = forceplayermodels_mymodel; - self.modelindex = forceplayermodels_mymodelindex; - self.skin = autocvar_cl_forcemyplayerskin; + this.model = forceplayermodels_mymodel; + this.modelindex = forceplayermodels_mymodelindex; + this.skin = autocvar_cl_forcemyplayerskin; } else if(autocvar_cl_forceplayermodels && forceplayermodels_modelisgoodmodel) { - self.model = forceplayermodels_model; - self.modelindex = forceplayermodels_modelindex; - self.skin = forceplayermodels_skin; + this.model = forceplayermodels_model; + this.modelindex = forceplayermodels_modelindex; + this.skin = forceplayermodels_skin; } - else if(self.forceplayermodels_isgoodmodel) + else if(this.forceplayermodels_isgoodmodel) { - self.model = self.forceplayermodels_savemodel; - self.modelindex = self.forceplayermodels_savemodelindex; - self.skin = self.forceplayermodels_saveskin; + this.model = this.forceplayermodels_savemodel; + this.modelindex = this.forceplayermodels_savemodelindex; + this.skin = this.forceplayermodels_saveskin; } else { - self.model = forceplayermodels_goodmodel; - self.modelindex = forceplayermodels_goodmodelindex; - self.skin = self.forceplayermodels_saveskin; + this.model = forceplayermodels_goodmodel; + this.modelindex = forceplayermodels_goodmodelindex; + this.skin = this.forceplayermodels_saveskin; } // forceplayercolors too @@ -260,45 +260,45 @@ void CSQCPlayer_ModelAppearance_Apply(bool islocalplayer) if(cm == 1024 + 17 * myteam) { if(forcecolor_friend) - self.colormap = forcecolor_friend; + this.colormap = forcecolor_friend; } else { if(forcecolor_enemy) - self.colormap = forcecolor_enemy; + this.colormap = forcecolor_enemy; } } else { if(autocvar_cl_forcemyplayercolors && islocalplayer) - self.colormap = 1024 + autocvar_cl_forcemyplayercolors; + this.colormap = 1024 + autocvar_cl_forcemyplayercolors; else if(autocvar_cl_forceplayercolors) - self.colormap = player_localnum + 1; + this.colormap = player_localnum + 1; } // GLOWMOD AND DEATH FADING - if(self.colormap > 0) - self.glowmod = colormapPaletteColor(((self.colormap >= 1024) ? self.colormap : stof(getplayerkeyvalue(self.colormap - 1, "colors"))) & 0x0F, true) * 2; + if(this.colormap > 0) + this.glowmod = colormapPaletteColor(((this.colormap >= 1024) ? this.colormap : stof(getplayerkeyvalue(this.colormap - 1, "colors"))) & 0x0F, true) * 2; else - self.glowmod = '1 1 1'; + this.glowmod = '1 1 1'; if(autocvar_cl_deathglow > 0) { - if(self.csqcmodel_isdead) + if(this.csqcmodel_isdead) { // Fade out to black now... - if(self.old_glowmod == '0 0 0') { self.old_glowmod = self.glowmod; } - self.colormap = 0; + if(this.old_glowmod == '0 0 0') { this.old_glowmod = this.glowmod; } + this.colormap = 0; - self.glowmod = self.old_glowmod * bound(0, 1 - (time - self.death_time) / autocvar_cl_deathglow, 1); - self.glowmod_x = max(self.glowmod.x, 0.0001); - self.glowmod_y = max(self.glowmod.y, 0.0001); - self.glowmod_z = max(self.glowmod.z, 0.0001); + this.glowmod = this.old_glowmod * bound(0, 1 - (time - this.death_time) / autocvar_cl_deathglow, 1); + this.glowmod_x = max(this.glowmod.x, 0.0001); + this.glowmod_y = max(this.glowmod.y, 0.0001); + this.glowmod_z = max(this.glowmod.z, 0.0001); } - else if(self.old_glowmod != '0 0 0') { self.old_glowmod = '0 0 0'; } + else if(this.old_glowmod != '0 0 0') { this.old_glowmod = '0 0 0'; } } - //printf("CSQCPlayer_ModelAppearance_Apply(): state = %s, colormap = %f, glowmod = %s\n", (self.csqcmodel_isdead ? "DEAD" : "ALIVE"), self.colormap, vtos(self.glowmod)); + //printf("CSQCPlayer_ModelAppearance_Apply(): state = %s, colormap = %f, glowmod = %s\n", (this.csqcmodel_isdead ? "DEAD" : "ALIVE"), this.colormap, vtos(this.glowmod)); } // FEATURE: fallback frames @@ -311,22 +311,22 @@ void CSQCPlayer_ModelAppearance_Apply(bool islocalplayer) .int csqcmodel_framecount; #define IS_DEAD_FRAME(f) ((f) == 0 || (f) == 1) -void CSQCPlayer_FallbackFrame_PreUpdate() -{SELFPARAM(); - self.frame = self.csqcmodel_saveframe; - self.frame2 = self.csqcmodel_saveframe2; +void CSQCPlayer_FallbackFrame_PreUpdate(entity this) +{ + this.frame = this.csqcmodel_saveframe; + this.frame2 = this.csqcmodel_saveframe2; #ifdef CSQCMODEL_HAVE_TWO_FRAMES - self.frame3 = self.csqcmodel_saveframe3; - self.frame4 = self.csqcmodel_saveframe4; + this.frame3 = this.csqcmodel_saveframe3; + this.frame4 = this.csqcmodel_saveframe4; #endif } -void CSQCPlayer_FallbackFrame_PostUpdate(bool isnew) -{SELFPARAM(); - self.csqcmodel_saveframe = self.frame; - self.csqcmodel_saveframe2 = self.frame2; +void CSQCPlayer_FallbackFrame_PostUpdate(entity this, bool isnew) +{ + this.csqcmodel_saveframe = this.frame; + this.csqcmodel_saveframe2 = this.frame2; #ifdef CSQCMODEL_HAVE_TWO_FRAMES - self.csqcmodel_saveframe3 = self.frame3; - self.csqcmodel_saveframe4 = self.frame4; + this.csqcmodel_saveframe3 = this.frame3; + this.csqcmodel_saveframe4 = this.frame4; #endif // hack for death animations: set their frametime to zero in case a @@ -334,8 +334,8 @@ void CSQCPlayer_FallbackFrame_PostUpdate(bool isnew) if(isnew) { #define FIX_FRAMETIME(f,ft) MACRO_BEGIN { \ - if(IS_DEAD_FRAME(self.f) && self.ft != 0 && self.death_time != 0) \ - self.ft = self.death_time; \ + if(IS_DEAD_FRAME(this.f) && this.ft != 0 && this.death_time != 0) \ + this.ft = this.death_time; \ } MACRO_END FIX_FRAMETIME(frame, frame1time); FIX_FRAMETIME(frame2, frame2time); @@ -344,17 +344,17 @@ void CSQCPlayer_FallbackFrame_PostUpdate(bool isnew) FIX_FRAMETIME(frame4, frame4time); #endif } - self.csqcmodel_isdead = IS_DEAD_FRAME(self.frame); + this.csqcmodel_isdead = IS_DEAD_FRAME(this.frame); } -void CSQCPlayer_AnimDecide_PostUpdate(bool isnew) -{SELFPARAM(); - self.csqcmodel_isdead = boolean(self.anim_state & (ANIMSTATE_DEAD1 | ANIMSTATE_DEAD2)); +void CSQCPlayer_AnimDecide_PostUpdate(entity this, bool isnew) +{ + this.csqcmodel_isdead = boolean(this.anim_state & (ANIMSTATE_DEAD1 | ANIMSTATE_DEAD2)); } -int CSQCPlayer_FallbackFrame(int f) -{SELFPARAM(); - if(frameduration(self.modelindex, f) > 0) +int CSQCPlayer_FallbackFrame(entity this, int f) +{ + if(frameduration(this.modelindex, f) > 0) return f; // goooooood - if(frameduration(self.modelindex, 1) <= 0) + if(frameduration(this.modelindex, 1) <= 0) return f; // this is a static model. We can't fix it if we wanted to switch(f) { @@ -367,16 +367,16 @@ int CSQCPlayer_FallbackFrame(int f) case 29: return 4; // anim_duckwalkbackright -> anim_duckwalk case 30: return 4; // anim_duckwalkbackleft -> anim_duckwalk } - LOG_INFOF("Frame %d missing in model %s, and we have no fallback - FAIL!\n", f, self.model); + LOG_INFOF("Frame %d missing in model %s, and we have no fallback - FAIL!\n", f, this.model); return f; } -void CSQCPlayer_FallbackFrame_Apply() -{SELFPARAM(); - self.frame = CSQCPlayer_FallbackFrame(self.frame); - self.frame2 = CSQCPlayer_FallbackFrame(self.frame2); +void CSQCPlayer_FallbackFrame_Apply(entity this) +{ + this.frame = CSQCPlayer_FallbackFrame(this, this.frame); + this.frame2 = CSQCPlayer_FallbackFrame(this, this.frame2); #ifdef CSQCMODEL_HAVE_TWO_FRAMES - self.frame3 = CSQCPlayer_FallbackFrame(self.frame3); - self.frame4 = CSQCPlayer_FallbackFrame(self.frame4); + this.frame3 = CSQCPlayer_FallbackFrame(this, this.frame3); + this.frame4 = CSQCPlayer_FallbackFrame(this, this.frame4); #endif } @@ -384,76 +384,76 @@ void CSQCPlayer_FallbackFrame_Apply() .entity tag_entity; .int tag_entity_lastmodelindex; .int tag_index; -void CSQCModel_AutoTagIndex_Apply() -{SELFPARAM(); - if(self.tag_entity && wasfreed(self.tag_entity)) - self.tag_entity = world; +void CSQCModel_AutoTagIndex_Apply(entity this) +{ + if(this.tag_entity && wasfreed(this.tag_entity)) + this.tag_entity = world; - viewloc_SetTags(); + WITH(entity, self, this, viewloc_SetTags()); - MUTATOR_CALLHOOK(TagIndex_Update, self); + MUTATOR_CALLHOOK(TagIndex_Update, this); - if(self.tag_networkentity) + if(this.tag_networkentity) { // we are ATTACHED! bool changed = 0; - if(self.tag_entity.entnum != self.tag_networkentity) + if(this.tag_entity.entnum != this.tag_networkentity) { - self.tag_entity = findfloat(world, entnum, self.tag_networkentity); + this.tag_entity = findfloat(world, entnum, this.tag_networkentity); changed = 1; } // recursive predraw call to fix issues with forcemodels and LOD if bone indexes mismatch - if(self.tag_entity.classname == "csqcmodel") + if(this.tag_entity.classname == "csqcmodel") { - WITH(entity, self, self.tag_entity, CSQCModel_Hook_PreDraw((self.entnum >= 1 && self.entnum <= maxclients))); + WITH(entity, this, this.tag_entity, CSQCModel_Hook_PreDraw(this, (this.entnum >= 1 && this.entnum <= maxclients))); } - if(self.tag_entity.modelindex != self.tag_entity_lastmodelindex) + if(this.tag_entity.modelindex != this.tag_entity_lastmodelindex) { - self.tag_entity_lastmodelindex = self.tag_entity.modelindex; + this.tag_entity_lastmodelindex = this.tag_entity.modelindex; changed = 1; } if(changed) { - if(self.tag_entity) + if(this.tag_entity) { // the best part is: IT EXISTS - if(substring(self.model, 0, 14) == "models/weapons") + if(substring(this.model, 0, 14) == "models/weapons") { - if(substring(self.tag_entity.model, 0, 14) == "models/weapons") + if(substring(this.tag_entity.model, 0, 14) == "models/weapons") { - self.tag_index = gettagindex(self.tag_entity, "weapon"); - if(!self.tag_index) - self.tag_index = gettagindex(self.tag_entity, "tag_weapon"); - if(!self.tag_index) + this.tag_index = gettagindex(this.tag_entity, "weapon"); + if(!this.tag_index) + this.tag_index = gettagindex(this.tag_entity, "tag_weapon"); + if(!this.tag_index) { // we need to prevent this from 'appening - self.tag_entity = world; - self.drawmask = 0; + this.tag_entity = world; + this.drawmask = 0; LOG_TRACE("h_ model lacks weapon attachment, but v_ model is attached to it\n"); } } - else if(self.tag_entity.isplayermodel) + else if(this.tag_entity.isplayermodel) { - skeleton_loadinfo(self.tag_entity); - self.tag_index = self.tag_entity.bone_weapon; + skeleton_loadinfo(this.tag_entity); + this.tag_index = this.tag_entity.bone_weapon; } } - if(substring(self.tag_entity.model, 0, 14) == "models/weapons") + if(substring(this.tag_entity.model, 0, 14) == "models/weapons") { - self.tag_index = gettagindex(self.tag_entity, "shot"); - if(!self.tag_index) - self.tag_index = gettagindex(self.tag_entity, "tag_shot"); + this.tag_index = gettagindex(this.tag_entity, "shot"); + if(!this.tag_index) + this.tag_index = gettagindex(this.tag_entity, "tag_shot"); } - MUTATOR_CALLHOOK(TagIndex_Apply, self); + MUTATOR_CALLHOOK(TagIndex_Apply, this); } else { // damn, see you next frame - self.drawmask = 0; + this.drawmask = 0; } } } @@ -479,117 +479,117 @@ const int MF_TRACER3 = BIT(7); // purple trail .int csqcmodel_effects; .int csqcmodel_modelflags; .int csqcmodel_traileffect; -void CSQCModel_Effects_PreUpdate() -{SELFPARAM(); - self.effects = self.csqcmodel_effects; - self.modelflags = self.csqcmodel_modelflags; - self.traileffect = self.csqcmodel_traileffect; +void CSQCModel_Effects_PreUpdate(entity this) +{ + this.effects = this.csqcmodel_effects; + this.modelflags = this.csqcmodel_modelflags; + this.traileffect = this.csqcmodel_traileffect; } void Reset_ArcBeam(); -void CSQCModel_Effects_PostUpdate() -{SELFPARAM(); - if (self == csqcplayer) { - if (self.csqcmodel_teleported) { - Reset_ArcBeam(); +void CSQCModel_Effects_PostUpdate(entity this) +{ + if (this == csqcplayer) { + if (this.csqcmodel_teleported) { + WITH(entity, self, this, Reset_ArcBeam()); } } - self.csqcmodel_effects = self.effects; - self.csqcmodel_modelflags = self.modelflags; - self.csqcmodel_traileffect = self.traileffect; - self.effects = 0; - self.modelflags = 0; - if(self.csqcmodel_teleported) - Projectile_ResetTrail(self, self.origin); + this.csqcmodel_effects = this.effects; + this.csqcmodel_modelflags = this.modelflags; + this.csqcmodel_traileffect = this.traileffect; + this.effects = 0; + this.modelflags = 0; + if(this.csqcmodel_teleported) + Projectile_ResetTrail(this, this.origin); } .int snd_looping; -void CSQCModel_Effects_Apply() -{SELFPARAM(); - int eff = self.csqcmodel_effects & ~CSQCMODEL_EF_RESPAWNGHOST; - int tref = self.csqcmodel_traileffect; +void CSQCModel_Effects_Apply(entity this) +{ + int eff = this.csqcmodel_effects & ~CSQCMODEL_EF_RESPAWNGHOST; + int tref = this.csqcmodel_traileffect; - self.renderflags &= ~(RF_DEPTHHACK | RF_ADDITIVE | RF_FULLBRIGHT | EF_NOSHADOW | RF_USEAXIS); - self.effects = 0; - self.traileffect = 0; + this.renderflags &= ~(RF_DEPTHHACK | RF_ADDITIVE | RF_FULLBRIGHT | EF_NOSHADOW | RF_USEAXIS); + this.effects = 0; + this.traileffect = 0; if(eff & EF_BRIGHTFIELD) tref = EFFECT_TR_NEXUIZPLASMA.m_id; // ignoring EF_MUZZLEFLASH if(eff & EF_BRIGHTLIGHT) - adddynamiclight(self.origin, 400, '3 3 3'); + adddynamiclight(this.origin, 400, '3 3 3'); if(eff & EF_DIMLIGHT) - adddynamiclight(self.origin, 200, '1.5 1.5 1.5'); - if((eff & EF_NODRAW) || (self.alpha < 0)) - self.drawmask = 0; + adddynamiclight(this.origin, 200, '1.5 1.5 1.5'); + if((eff & EF_NODRAW) || (this.alpha < 0)) + this.drawmask = 0; if(eff & EF_ADDITIVE) - self.renderflags |= RF_ADDITIVE; + this.renderflags |= RF_ADDITIVE; if(eff & EF_BLUE) - adddynamiclight(self.origin, 200, '0.15 0.15 1.5'); + adddynamiclight(this.origin, 200, '0.15 0.15 1.5'); if(eff & EF_RED) - adddynamiclight(self.origin, 200, '1.5 0.15 0.15'); + adddynamiclight(this.origin, 200, '1.5 0.15 0.15'); // ignoring EF_NOGUNBOB if(eff & EF_FULLBRIGHT) - self.renderflags |= RF_FULLBRIGHT; + this.renderflags |= RF_FULLBRIGHT; if(eff & EF_FLAME) - pointparticles(EFFECT_EF_FLAME, self.origin, '0 0 0', bound(0, frametime, 0.1)); + pointparticles(EFFECT_EF_FLAME, this.origin, '0 0 0', bound(0, frametime, 0.1)); if(eff & EF_STARDUST) - pointparticles(EFFECT_EF_STARDUST, self.origin, '0 0 0', bound(0, frametime, 0.1)); + pointparticles(EFFECT_EF_STARDUST, this.origin, '0 0 0', bound(0, frametime, 0.1)); if(eff & EF_NOSHADOW) - self.renderflags |= RF_NOSHADOW; + this.renderflags |= RF_NOSHADOW; if(eff & EF_NODEPTHTEST) - self.renderflags |= RF_DEPTHHACK; + this.renderflags |= RF_DEPTHHACK; // ignoring EF_SELECTABLE if(eff & EF_DOUBLESIDED) - self.effects |= EF_DOUBLESIDED; + this.effects |= EF_DOUBLESIDED; if(eff & EF_NOSELFSHADOW) - self.effects |= EF_NOSELFSHADOW; + this.effects |= EF_NOSELFSHADOW; if(eff & EF_DYNAMICMODELLIGHT) - self.renderflags |= RF_DYNAMICMODELLIGHT; + this.renderflags |= RF_DYNAMICMODELLIGHT; // ignoring EF_UNUSED18, EF_UNUSED19, EF_RESTARTANIM_BIT, EF_TELEPORT_BIT, EF_LOWPRECISION - if(self.csqcmodel_modelflags & MF_ROCKET) + if(this.csqcmodel_modelflags & MF_ROCKET) tref = EFFECT_TR_ROCKET.m_id; - if(self.csqcmodel_modelflags & MF_GRENADE) + if(this.csqcmodel_modelflags & MF_GRENADE) tref = EFFECT_TR_GRENADE.m_id; - if(self.csqcmodel_modelflags & MF_GIB) + if(this.csqcmodel_modelflags & MF_GIB) tref = EFFECT_TR_BLOOD.m_id; - if(self.csqcmodel_modelflags & MF_ROTATE) + if(this.csqcmodel_modelflags & MF_ROTATE) { - self.renderflags |= RF_USEAXIS; - makevectors(self.angles + '0 100 0' * fmod(time, 3.6)); + this.renderflags |= RF_USEAXIS; + makevectors(this.angles + '0 100 0' * fmod(time, 3.6)); } - if(self.csqcmodel_modelflags & MF_TRACER) + if(this.csqcmodel_modelflags & MF_TRACER) tref = EFFECT_TR_WIZSPIKE.m_id; - if(self.csqcmodel_modelflags & MF_ZOMGIB) + if(this.csqcmodel_modelflags & MF_ZOMGIB) tref = EFFECT_TR_SLIGHTBLOOD.m_id; - if(self.csqcmodel_modelflags & MF_TRACER2) + if(this.csqcmodel_modelflags & MF_TRACER2) tref = EFFECT_TR_KNIGHTSPIKE.m_id; - if(self.csqcmodel_modelflags & MF_TRACER3) + if(this.csqcmodel_modelflags & MF_TRACER3) tref = EFFECT_TR_VORESPIKE.m_id; - self.traileffect = tref; + this.traileffect = tref; - if(self.drawmask) - Projectile_DrawTrail(self, self.origin); + if(this.drawmask) + Projectile_DrawTrail(this, this.origin); else - Projectile_ResetTrail(self, self.origin); + Projectile_ResetTrail(this, this.origin); - if(self.csqcmodel_effects & CSQCMODEL_EF_RESPAWNGHOST) - self.renderflags |= RF_ADDITIVE; + if(this.csqcmodel_effects & CSQCMODEL_EF_RESPAWNGHOST) + this.renderflags |= RF_ADDITIVE; // also special in CSQCPlayer_GlowMod_Apply - if(self.csqcmodel_modelflags & MF_ROCKET) + if(this.csqcmodel_modelflags & MF_ROCKET) { - if(!self.snd_looping) + if(!this.snd_looping) { - sound(self, CH_TRIGGER_SINGLE, SND_JETPACK_FLY, VOL_BASE, autocvar_g_jetpack_attenuation); - self.snd_looping = CH_TRIGGER_SINGLE; + sound(this, CH_TRIGGER_SINGLE, SND_JETPACK_FLY, VOL_BASE, autocvar_g_jetpack_attenuation); + this.snd_looping = CH_TRIGGER_SINGLE; } } else { - if(self.snd_looping) + if(this.snd_looping) { - sound(self, self.snd_looping, SND_Null, VOL_BASE, autocvar_g_jetpack_attenuation); - self.snd_looping = 0; + sound(this, this.snd_looping, SND_Null, VOL_BASE, autocvar_g_jetpack_attenuation); + this.snd_looping = 0; } } } @@ -605,132 +605,132 @@ void CSQCModel_Effects_Apply() .int anim_saveframe2; .int anim_saveframe2time; .int anim_prev_pmove_flags; -void CSQCModel_Hook_PreDraw(bool isplayer) -{SELFPARAM(); - if(self.csqcmodel_predraw_run == framecount) +void CSQCModel_Hook_PreDraw(entity this, bool isplayer) +{ + if(this.csqcmodel_predraw_run == framecount) return; - self.csqcmodel_predraw_run = framecount; + this.csqcmodel_predraw_run = framecount; - if(!self.modelindex || self.model == "null") + if(!this.modelindex || this.model == "null") { - self.drawmask = 0; + this.drawmask = 0; return; } else - self.drawmask = MASK_NORMAL; + this.drawmask = MASK_NORMAL; - if(self.isplayermodel) // this checks if it's a player MODEL! + if(this.isplayermodel) // this checks if it's a player MODEL! { - CSQCPlayer_ModelAppearance_Apply(self.entnum == player_localnum + 1); - CSQCPlayer_LOD_Apply(); + CSQCPlayer_ModelAppearance_Apply(this, this.entnum == player_localnum + 1); + CSQCPlayer_LOD_Apply(this); if(!isplayer) { - skeleton_loadinfo(self); - bool doblend = (self.bone_upperbody >= 0); - CSQCPlayer_FallbackFrame_Apply(); + skeleton_loadinfo(this); + bool doblend = (this.bone_upperbody >= 0); + CSQCPlayer_FallbackFrame_Apply(this); if(doblend) { - skeleton_from_frames(self, self.csqcmodel_isdead); + skeleton_from_frames(this, this.csqcmodel_isdead); } else { - free_skeleton_from_frames(self); + free_skeleton_from_frames(this); // just in case, clear these (we're animating in frame and frame3) - self.lerpfrac = 0; - self.lerpfrac4 = 0; + this.lerpfrac = 0; + this.lerpfrac4 = 0; } } else { // we know that frame3 and frame4 fields, used by InterpolateAnimation, are left alone - but that is all we know! - skeleton_loadinfo(self); - bool doblend = (self.bone_upperbody >= 0); + skeleton_loadinfo(this); + bool doblend = (this.bone_upperbody >= 0); bool onground = 0; - if(self == csqcplayer) + if(this == csqcplayer) { - if(IS_ONGROUND(self)) + if(IS_ONGROUND(this)) onground = 1; - self.anim_prev_pmove_flags = self.flags; - if(self.flags & FL_DUCKED) - animdecide_setstate(self, self.anim_state | ANIMSTATE_DUCK, false); - else if(self.anim_state & ANIMSTATE_DUCK) - animdecide_setstate(self, self.anim_state - ANIMSTATE_DUCK, false); + this.anim_prev_pmove_flags = this.flags; + if(this.flags & FL_DUCKED) + animdecide_setstate(this, this.anim_state | ANIMSTATE_DUCK, false); + else if(this.anim_state & ANIMSTATE_DUCK) + animdecide_setstate(this, this.anim_state - ANIMSTATE_DUCK, false); } else { - tracebox(self.origin + '0 0 1', self.mins, self.maxs, self.origin - '0 0 4', MOVE_NORMAL, self); + tracebox(this.origin + '0 0 1', this.mins, this.maxs, this.origin - '0 0 4', MOVE_NORMAL, this); if(trace_startsolid || trace_fraction < 1) onground = 1; } - animdecide_load_if_needed(self); - animdecide_setimplicitstate(self, onground); - animdecide_setframes(self, doblend, anim_frame, anim_frame1time, anim_frame2, anim_frame2time); + animdecide_load_if_needed(this); + animdecide_setimplicitstate(this, onground); + animdecide_setframes(this, doblend, anim_frame, anim_frame1time, anim_frame2, anim_frame2time); int sf = 0; - if(self.anim_saveframe != self.anim_frame || self.anim_saveframe1time != self.anim_frame1time) + if(this.anim_saveframe != this.anim_frame || this.anim_saveframe1time != this.anim_frame1time) sf |= CSQCMODEL_PROPERTY_FRAME; - if(self.anim_saveframe2 != self.anim_frame2 || self.anim_saveframe2time != self.anim_frame2time) + if(this.anim_saveframe2 != this.anim_frame2 || this.anim_saveframe2time != this.anim_frame2time) sf |= CSQCMODEL_PROPERTY_FRAME2; - self.anim_saveframe = self.anim_frame; - self.anim_saveframe1time = self.anim_frame1time; - self.anim_saveframe2 = self.anim_frame2; - self.anim_saveframe2time = self.anim_frame2time; + this.anim_saveframe = this.anim_frame; + this.anim_saveframe1time = this.anim_frame1time; + this.anim_saveframe2 = this.anim_frame2; + 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. - CSQCModel_InterpolateAnimation_2To4_PreNote(sf | CSQCMODEL_PROPERTY_LERPFRAC); - self.lerpfrac = (doblend ? 0.5 : 0); - self.frame = self.anim_frame; - self.frame1time = self.anim_frame1time; - self.frame2 = self.anim_frame2; - self.frame2time = self.anim_frame2time; - CSQCModel_InterpolateAnimation_2To4_Note(sf | CSQCMODEL_PROPERTY_LERPFRAC, false); - CSQCModel_InterpolateAnimation_2To4_Do(); + WITH(entity, self, this, CSQCModel_InterpolateAnimation_2To4_PreNote(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()); if(doblend) { - skeleton_from_frames(self, self.csqcmodel_isdead); + skeleton_from_frames(this, this.csqcmodel_isdead); } else { - free_skeleton_from_frames(self); + free_skeleton_from_frames(this); // just in case, clear these (we're animating in frame and frame3) - self.lerpfrac = 0; - self.lerpfrac4 = 0; + this.lerpfrac = 0; + this.lerpfrac4 = 0; } } } - CSQCModel_AutoTagIndex_Apply(); + CSQCModel_AutoTagIndex_Apply(this); - CSQCModel_Effects_Apply(); + CSQCModel_Effects_Apply(this); } -void CSQCModel_Hook_PreUpdate(bool isnew, bool isplayer, bool islocalplayer) -{SELFPARAM(); +void CSQCModel_Hook_PreUpdate(entity this, bool isnew, bool isplayer, bool islocalplayer) +{ // interpolate v_angle - self.iflags |= IFLAG_V_ANGLE_X; + this.iflags |= IFLAG_V_ANGLE_X; // revert to values from server - CSQCModel_Effects_PreUpdate(); - if(self.isplayermodel) + CSQCModel_Effects_PreUpdate(this); + if(this.isplayermodel) { if(!isplayer) - CSQCPlayer_FallbackFrame_PreUpdate(); - CSQCPlayer_ModelAppearance_PreUpdate(); + CSQCPlayer_FallbackFrame_PreUpdate(this); + CSQCPlayer_ModelAppearance_PreUpdate(this); } } -void CSQCModel_Hook_PostUpdate(bool isnew, bool isplayer, bool islocalplayer) -{SELFPARAM(); +void CSQCModel_Hook_PostUpdate(entity this, bool isnew, bool isplayer, bool islocalplayer) +{ // is it a player model? (shared state) - self.isplayermodel = (substring(self.model, 0, 14) == "models/player/" || substring(self.model, 0, 17) == "models/ok_player/" || (substring(self.model, 0, 16) == "models/monsters/" && (self.entnum >= 1 && self.entnum <= maxclients))); + this.isplayermodel = (substring(this.model, 0, 14) == "models/player/" || substring(this.model, 0, 17) == "models/ok_player/" || (substring(this.model, 0, 16) == "models/monsters/" && (this.entnum >= 1 && this.entnum <= maxclients))); // save values set by server - if(self.isplayermodel) + if(this.isplayermodel) { - CSQCPlayer_ModelAppearance_PostUpdate(); + CSQCPlayer_ModelAppearance_PostUpdate(this); if(isplayer) - CSQCPlayer_AnimDecide_PostUpdate(isnew); + CSQCPlayer_AnimDecide_PostUpdate(this, isnew); else - CSQCPlayer_FallbackFrame_PostUpdate(isnew); + CSQCPlayer_FallbackFrame_PostUpdate(this, isnew); } - CSQCModel_Effects_PostUpdate(); + CSQCModel_Effects_PostUpdate(this); } diff --git a/qcsrc/client/hud/panel/weapons.qc b/qcsrc/client/hud/panel/weapons.qc index 9cfebb81e..19cfb551c 100644 --- a/qcsrc/client/hud/panel/weapons.qc +++ b/qcsrc/client/hud/panel/weapons.qc @@ -336,16 +336,16 @@ void HUD_Weapons() for(i = 0; i <= WEP_LAST-WEP_FIRST; ++i) { // retrieve information about the current weapon to be drawn - setself(weaponorder[i]); - weapon_id = self.impulse; - isCurrent = (self == switchweapon); + entity it = weaponorder[i]; + weapon_id = it.impulse; + isCurrent = (it == switchweapon); // skip if this weapon doesn't exist - if(!self || weapon_id < 0) { continue; } + if(!it || weapon_id < 0) { continue; } // skip this weapon if we don't own it (and onlyowned is enabled)-- or if weapons_complainbubble is showing for this weapon if(autocvar_hud_panel_weapons_onlyowned) - if (!((weapons_stat & WepSet_FromWeapon(self)) || (self.m_id == complain_weapon))) + if (!((weapons_stat & WepSet_FromWeapon(it)) || (it.m_id == complain_weapon))) continue; // figure out the drawing position of weapon @@ -360,7 +360,7 @@ void HUD_Weapons() // draw the weapon accuracy if(autocvar_hud_panel_weapons_accuracy) { - float panel_weapon_accuracy = weapon_accuracy[self.m_id-WEP_FIRST]; + float panel_weapon_accuracy = weapon_accuracy[it.m_id-WEP_FIRST]; if(panel_weapon_accuracy >= 0) { color = Accuracy_GetColor(panel_weapon_accuracy); @@ -369,13 +369,13 @@ void HUD_Weapons() } // drawing all the weapon items - if(weapons_stat & WepSet_FromWeapon(self)) + if(weapons_stat & WepSet_FromWeapon(it)) { // draw the weapon image if(isCurrent) - drawpic_aspect_skin(weapon_pos, self.model2, weapon_size, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL); + drawpic_aspect_skin(weapon_pos, it.model2, weapon_size, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL); else - drawpic_aspect_skin(noncurrent_pos, self.model2, noncurrent_size, '1 1 1', noncurrent_alpha, DRAWFLAG_NORMAL); + drawpic_aspect_skin(noncurrent_pos, it.model2, noncurrent_size, '1 1 1', noncurrent_alpha, DRAWFLAG_NORMAL); // draw weapon label string switch(autocvar_hud_panel_weapons_label) @@ -389,7 +389,7 @@ void HUD_Weapons() break; case 3: // weapon name - drawstring(weapon_pos, strtolower(self.m_name), label_size, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL); + drawstring(weapon_pos, strtolower(it.m_name), label_size, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL); break; default: // nothing @@ -397,14 +397,14 @@ void HUD_Weapons() } // draw ammo status bar - if(autocvar_hud_panel_weapons_ammo && (self.ammo_field != ammo_none)) + if(autocvar_hud_panel_weapons_ammo && (it.ammo_field != ammo_none)) { float ammo_full; - a = getstati(GetAmmoStat(self.ammo_field)); // how much ammo do we have? + a = getstati(GetAmmoStat(it.ammo_field)); // how much ammo do we have? if(a > 0) { - switch(self.ammo_field) + switch(it.ammo_field) { case ammo_shells: ammo_full = autocvar_hud_panel_weapons_ammo_full_shells; break; case ammo_nails: ammo_full = autocvar_hud_panel_weapons_ammo_full_nails; break; @@ -437,11 +437,11 @@ void HUD_Weapons() } else // draw a "ghost weapon icon" if you don't have the weapon { - drawpic_aspect_skin(noncurrent_pos, self.model2, noncurrent_size, '0.2 0.2 0.2', panel_fg_alpha * 0.5, DRAWFLAG_NORMAL); + drawpic_aspect_skin(noncurrent_pos, it.model2, noncurrent_size, '0.2 0.2 0.2', panel_fg_alpha * 0.5, DRAWFLAG_NORMAL); } // draw the complain message - if(self.m_id == complain_weapon) + if(it.m_id == complain_weapon) { if(fadetime) a = ((complain_weapon_time + when > time) ? 1 : bound(0, (complain_weapon_time + when + fadetime - time) / fadetime, 1)); diff --git a/qcsrc/client/main.qc b/qcsrc/client/main.qc index a1cb0c3ee..304fc642a 100644 --- a/qcsrc/client/main.qc +++ b/qcsrc/client/main.qc @@ -327,11 +327,10 @@ float CSQC_InputEvent(float bInputType, float nPrimary, float nSecondary) // -------------------------------------------------------------------------- // BEGIN OPTIONAL CSQC FUNCTIONS -void Ent_Remove(); +void Ent_Remove(entity this); -void Ent_RemovePlayerScore() +void Ent_RemovePlayerScore(entity this) { - SELFPARAM(); if(this.owner) { SetTeam(this.owner, -1); this.owner.gotscores = 0; @@ -359,7 +358,7 @@ NET_HANDLE(ENT_CLIENT_SCORES, bool isnew) //print("A CSQC entity changed its owner!\n"); LOG_INFOF("A CSQC entity changed its owner! (edict: %d, classname: %s)\n", etof(this), this.classname); isNew = true; - Ent_Remove(); + Ent_Remove(this); } #endif @@ -736,7 +735,7 @@ void CSQC_Ent_Update(bool isnew) if (t != this.enttype || isnew) { LOG_INFOF("A CSQC entity changed its type! (edict: %d, server: %d, type: %d -> %d)\n", etof(this), this.entnum, this.enttype, t); - Ent_Remove(); + Ent_Remove(this); clearentity(this); isnew = true; } @@ -769,10 +768,9 @@ void CSQC_Ent_Update(bool isnew) // Destructor, but does NOT deallocate the entity by calling remove(). Also // used when an entity changes its type. For an entity that someone interacts // with others, make sure it can no longer do so. -void Ent_Remove() +void Ent_Remove(entity this) { - SELFPARAM(); - if(this.entremove) this.entremove(); + if(this.entremove) this.entremove(this); if(this.skeletonindex) { @@ -802,7 +800,7 @@ void CSQC_Ent_Remove() LOG_WARNING("CSQC_Ent_Remove called for already removed entity. Packet loss?\n"); return; } - if (this.enttype) Ent_Remove(); + if (this.enttype) Ent_Remove(this); remove(this); } diff --git a/qcsrc/client/main.qh b/qcsrc/client/main.qh index 6a0285d5f..835acb9ca 100644 --- a/qcsrc/client/main.qh +++ b/qcsrc/client/main.qh @@ -87,7 +87,7 @@ entity teamslots[17]; // 17 teams (including "spectator team") .void(entity) draw; .void(entity) draw2d; -.void() entremove; +.void(entity) entremove; float drawframetime; vector view_origin, view_forward, view_right, view_up; diff --git a/qcsrc/client/mapvoting.qc b/qcsrc/client/mapvoting.qc index 48d0843b0..30c938aa3 100644 --- a/qcsrc/client/mapvoting.qc +++ b/qcsrc/client/mapvoting.qc @@ -853,7 +853,7 @@ void MapVote_UpdateVotes() NET_HANDLE(ENT_CLIENT_MAPVOTE, bool isnew) { - make_pure(self); + make_pure(this); int sf = ReadByte(); return = true; diff --git a/qcsrc/client/player_skeleton.qc b/qcsrc/client/player_skeleton.qc index d6b2b0d44..7fa065ca4 100644 --- a/qcsrc/client/player_skeleton.qc +++ b/qcsrc/client/player_skeleton.qc @@ -176,14 +176,14 @@ void skeleton_from_frames(entity e, float is_dead) if(!is_dead) { - if(self == csqcplayer) - self.v_angle_x = input_angles_x; + if(e == csqcplayer) + e.v_angle_x = input_angles_x; int i; for(i = 0; i < MAX_AIM_BONES; ++i) { if(e.(bone_aim[i])) { - vector aim = '1 0 0' * bound(-90, self.v_angle.x, 90) * e.(bone_aimweight[i]); + vector aim = '1 0 0' * bound(-90, e.v_angle.x, 90) * e.(bone_aimweight[i]); vector org = skel_get_boneabs(s, e.(bone_aim[i])); vector ang_cur = fixedvectoangles2(v_forward, v_up); vector ang = AnglesTransform_Multiply(aim, ang_cur); diff --git a/qcsrc/client/teamradar.qc b/qcsrc/client/teamradar.qc index a745bcd31..96fd5ee97 100644 --- a/qcsrc/client/teamradar.qc +++ b/qcsrc/client/teamradar.qc @@ -198,29 +198,29 @@ NET_HANDLE(ENT_CLIENT_RADARLINK, bool isnew) { int sendflags = ReadByte(); - InterpolateOrigin_Undo(self); + InterpolateOrigin_Undo(this); - self.iflags = IFLAG_VELOCITY | IFLAG_ORIGIN; - self.classname = "radarlink"; + this.iflags = IFLAG_VELOCITY | IFLAG_ORIGIN; + this.classname = "radarlink"; if(sendflags & 1) { - self.origin_x = ReadCoord(); - self.origin_y = ReadCoord(); - self.origin_z = ReadCoord(); - setorigin(self, self.origin); + this.origin_x = ReadCoord(); + this.origin_y = ReadCoord(); + this.origin_z = ReadCoord(); + setorigin(this, this.origin); } if(sendflags & 2) { - self.velocity_x = ReadCoord(); - self.velocity_y = ReadCoord(); - self.velocity_z = ReadCoord(); + this.velocity_x = ReadCoord(); + this.velocity_y = ReadCoord(); + this.velocity_z = ReadCoord(); } if(sendflags & 4) { - self.team = ReadByte(); + this.team = ReadByte(); } return = true; diff --git a/qcsrc/client/view.qc b/qcsrc/client/view.qc index 0995bc2f7..8c4aade90 100644 --- a/qcsrc/client/view.qc +++ b/qcsrc/client/view.qc @@ -293,7 +293,7 @@ void viewmodel_draw(entity this) e.colormap = 256 + c; // colormap == 0 is black, c == 0 is white e.glowmod = g; e.csqcmodel_effects = fx; - WITH(entity, self, e, CSQCModel_Effects_Apply()); + CSQCModel_Effects_Apply(e); } { static string name_last; @@ -745,19 +745,19 @@ vector liquidcolor_prev; float eventchase_current_distance; float eventchase_running; -bool WantEventchase() -{SELFPARAM(); +bool WantEventchase(entity this) +{ if(autocvar_cl_orthoview) return false; if(intermission) return true; - if(self.viewloc) + if(this.viewloc) return true; if(spectatee_status >= 0) { if(hud != HUD_NORMAL && (autocvar_cl_eventchase_vehicle || spectatee_status > 0)) return true; - if(MUTATOR_CALLHOOK(WantEventchase, self)) + if(MUTATOR_CALLHOOK(WantEventchase, this)) return true; if(autocvar_cl_eventchase_nexball && gametype == MAPINFO_TYPE_NEXBALL && !(WepSet_GetFromStat() & WEPSET(NEXBALL))) return true; @@ -766,7 +766,7 @@ bool WantEventchase() if(autocvar_cl_eventchase_death == 2) { // don't stop eventchase once it's started (even if velocity changes afterwards) - if(self.velocity == '0 0 0' || eventchase_running) + if(this.velocity == '0 0 0' || eventchase_running) return true; } else return true; @@ -1481,7 +1481,7 @@ void CSQC_UpdateView(float w, float h) if(!gen) ons_roundlost = false; // don't enforce the 3rd person camera if there is no dead generator to show } - if(WantEventchase() || (!autocvar_cl_orthoview && ons_roundlost)) + if(WantEventchase(self) || (!autocvar_cl_orthoview && ons_roundlost)) { eventchase_running = true; diff --git a/qcsrc/client/wall.qc b/qcsrc/client/wall.qc index f83c70c22..34174073b 100644 --- a/qcsrc/client/wall.qc +++ b/qcsrc/client/wall.qc @@ -54,64 +54,64 @@ void Ent_Wall_Draw(entity this) float f; var .vector fld; - if(self.bgmscriptangular) + if(this.bgmscriptangular) fld = angles; else fld = origin; - self.(fld) = self.saved; + this.(fld) = this.saved; - if(self.lodmodelindex1) + if(this.lodmodelindex1) { if(autocvar_cl_modeldetailreduction <= 0) { - if(self.lodmodelindex2 && autocvar_cl_modeldetailreduction <= -2) - self.modelindex = self.lodmodelindex2; + if(this.lodmodelindex2 && autocvar_cl_modeldetailreduction <= -2) + this.modelindex = this.lodmodelindex2; else if(autocvar_cl_modeldetailreduction <= -1) - self.modelindex = self.lodmodelindex1; + this.modelindex = this.lodmodelindex1; else - self.modelindex = self.lodmodelindex0; + this.modelindex = this.lodmodelindex0; } else { - float distance = vlen(NearestPointOnBox(self, view_origin) - view_origin); + float distance = vlen(NearestPointOnBox(this, view_origin) - view_origin); f = (distance * current_viewzoom + 100.0) * autocvar_cl_modeldetailreduction; f *= 1.0 / bound(0.01, view_quality, 1); - if(self.lodmodelindex2 && f > self.loddistance2) - self.modelindex = self.lodmodelindex2; - else if(f > self.loddistance1) - self.modelindex = self.lodmodelindex1; + if(this.lodmodelindex2 && f > this.loddistance2) + this.modelindex = this.lodmodelindex2; + else if(f > this.loddistance1) + this.modelindex = this.lodmodelindex1; else - self.modelindex = self.lodmodelindex0; + this.modelindex = this.lodmodelindex0; } } - InterpolateOrigin_Do(self); + InterpolateOrigin_Do(this); - self.saved = self.(fld); + this.saved = this.(fld); - f = doBGMScript(self); + f = doBGMScript(this); if(f >= 0) { - if(self.lip < 0) // < 0: alpha goes from 1 to 1-|lip| when toggled (toggling subtracts lip) - self.alpha = 1 + self.lip * f; + if(this.lip < 0) // < 0: alpha goes from 1 to 1-|lip| when toggled (toggling subtracts lip) + this.alpha = 1 + this.lip * f; else // > 0: alpha goes from 1-|lip| to 1 when toggled (toggling adds lip) - self.alpha = 1 - self.lip * (1 - f); - self.(fld) = self.(fld) + self.movedir * f; + this.alpha = 1 - this.lip * (1 - f); + this.(fld) = this.(fld) + this.movedir * f; } else - self.alpha = 1; + this.alpha = 1; - if(self.alpha >= ALPHA_MIN_VISIBLE) - self.drawmask = MASK_NORMAL; + if(this.alpha >= ALPHA_MIN_VISIBLE) + this.drawmask = MASK_NORMAL; else - self.drawmask = 0; + this.drawmask = 0; } -void Ent_Wall_Remove() -{SELFPARAM(); - if(self.bgmscript) - strunzone(self.bgmscript); - self.bgmscript = string_null; +void Ent_Wall_Remove(entity this) +{ + if(this.bgmscript) + strunzone(this.bgmscript); + this.bgmscript = string_null; } NET_HANDLE(ENT_CLIENT_WALL, bool isnew) @@ -119,116 +119,116 @@ NET_HANDLE(ENT_CLIENT_WALL, bool isnew) int f; var .vector fld; - InterpolateOrigin_Undo(self); - self.iflags = IFLAG_ANGLES | IFLAG_ORIGIN; + InterpolateOrigin_Undo(this); + this.iflags = IFLAG_ANGLES | IFLAG_ORIGIN; - if(self.bgmscriptangular) + if(this.bgmscriptangular) fld = angles; else fld = origin; - self.(fld) = self.saved; + this.(fld) = this.saved; f = ReadByte(); if(f & 1) { if(f & 0x40) - self.colormap = ReadShort(); + this.colormap = ReadShort(); else - self.colormap = 0; + this.colormap = 0; } if(f & 2) { - self.origin_x = ReadCoord(); - self.origin_y = ReadCoord(); - self.origin_z = ReadCoord(); - setorigin(self, self.origin); + this.origin_x = ReadCoord(); + this.origin_y = ReadCoord(); + this.origin_z = ReadCoord(); + setorigin(this, this.origin); } if(f & 4) { if(f & 0x10) { - self.angles_x = ReadAngle(); - self.angles_y = ReadAngle(); - self.angles_z = ReadAngle(); + this.angles_x = ReadAngle(); + this.angles_y = ReadAngle(); + this.angles_z = ReadAngle(); } else - self.angles = '0 0 0'; + this.angles = '0 0 0'; } if(f & 8) { if(f & 0x80) { - self.lodmodelindex0 = ReadShort(); - self.loddistance1 = ReadShort(); - self.lodmodelindex1 = ReadShort(); - self.loddistance2 = ReadShort(); - self.lodmodelindex2 = ReadShort(); + this.lodmodelindex0 = ReadShort(); + this.loddistance1 = ReadShort(); + this.lodmodelindex1 = ReadShort(); + this.loddistance2 = ReadShort(); + this.lodmodelindex2 = ReadShort(); } else { - self.modelindex = ReadShort(); - self.loddistance1 = 0; - self.loddistance2 = 0; + this.modelindex = ReadShort(); + this.loddistance1 = 0; + this.loddistance2 = 0; } - self.solid = ReadByte(); - self.scale = ReadShort() / 256.0; + this.solid = ReadByte(); + this.scale = ReadShort() / 256.0; if(f & 0x20) { - self.mins_x = ReadCoord(); - self.mins_y = ReadCoord(); - self.mins_z = ReadCoord(); - self.maxs_x = ReadCoord(); - self.maxs_y = ReadCoord(); - self.maxs_z = ReadCoord(); + this.mins_x = ReadCoord(); + this.mins_y = ReadCoord(); + this.mins_z = ReadCoord(); + this.maxs_x = ReadCoord(); + this.maxs_y = ReadCoord(); + this.maxs_z = ReadCoord(); } else - self.mins = self.maxs = '0 0 0'; - setsize(self, self.mins, self.maxs); + this.mins = this.maxs = '0 0 0'; + setsize(this, this.mins, this.maxs); - if(self.bgmscript) - strunzone(self.bgmscript); - self.bgmscript = ReadString(); - if(substring(self.bgmscript, 0, 1) == "<") + if(this.bgmscript) + strunzone(this.bgmscript); + this.bgmscript = ReadString(); + if(substring(this.bgmscript, 0, 1) == "<") { - self.bgmscript = strzone(substring(self.bgmscript, 1, -1)); - self.bgmscriptangular = 1; + this.bgmscript = strzone(substring(this.bgmscript, 1, -1)); + this.bgmscriptangular = 1; } else { - self.bgmscript = strzone(self.bgmscript); - self.bgmscriptangular = 0; + this.bgmscript = strzone(this.bgmscript); + this.bgmscriptangular = 0; } - if(self.bgmscript != "") + if(this.bgmscript != "") { - self.bgmscriptattack = ReadByte() / 64.0; - self.bgmscriptdecay = ReadByte() / 64.0; - self.bgmscriptsustain = ReadByte() / 255.0; - self.bgmscriptrelease = ReadByte() / 64.0; - self.movedir_x = ReadCoord(); - self.movedir_y = ReadCoord(); - self.movedir_z = ReadCoord(); - self.lip = ReadByte() / 255.0; + this.bgmscriptattack = ReadByte() / 64.0; + this.bgmscriptdecay = ReadByte() / 64.0; + this.bgmscriptsustain = ReadByte() / 255.0; + this.bgmscriptrelease = ReadByte() / 64.0; + this.movedir_x = ReadCoord(); + this.movedir_y = ReadCoord(); + this.movedir_z = ReadCoord(); + this.lip = ReadByte() / 255.0; } - self.fade_start = ReadShort(); - self.fade_end = ReadShort(); - self.alpha_max = ReadShort(); - self.alpha_min = ReadShort(); - self.inactive = ReadShort(); - self.fade_vertical_offset = ReadShort(); - BGMScript_InitEntity(self); + this.fade_start = ReadShort(); + this.fade_end = ReadShort(); + this.alpha_max = ReadShort(); + this.alpha_min = ReadShort(); + this.inactive = ReadShort(); + this.fade_vertical_offset = ReadShort(); + BGMScript_InitEntity(this); } return = true; InterpolateOrigin_Note(this); - self.saved = self.(fld); + this.saved = this.(fld); - self.entremove = Ent_Wall_Remove; - self.draw = Ent_Wall_Draw; - self.predraw = Ent_Wall_PreDraw; + this.entremove = Ent_Wall_Remove; + this.draw = Ent_Wall_Draw; + this.predraw = Ent_Wall_PreDraw; } diff --git a/qcsrc/client/wall.qh b/qcsrc/client/wall.qh index 16f87fdd9..f93eb3ae1 100644 --- a/qcsrc/client/wall.qh +++ b/qcsrc/client/wall.qh @@ -18,6 +18,6 @@ class(Wall) .vector saved; void Ent_Wall_Draw(entity this); -void Ent_Wall_Remove(); +void Ent_Wall_Remove(entity this); #endif diff --git a/qcsrc/client/weapons/projectile.qc b/qcsrc/client/weapons/projectile.qc index 4ebe4afcf..c57a5aeaf 100644 --- a/qcsrc/client/weapons/projectile.qc +++ b/qcsrc/client/weapons/projectile.qc @@ -16,13 +16,14 @@ .float scale; .vector colormod; -void SUB_Stop() +void SUB_Stop(entity this) { - SELFPARAM(); - self.move_velocity = self.move_avelocity = '0 0 0'; - self.move_movetype = MOVETYPE_NONE; + this.move_velocity = this.move_avelocity = '0 0 0'; + this.move_movetype = MOVETYPE_NONE; } +void SUB_Stop_self() { SUB_Stop(self); } + void Projectile_ResetTrail(entity this, vector to) { this.trail_oldorigin = to; @@ -59,44 +60,44 @@ void Projectile_Draw(entity this) float t; float a; - f = self.move_flags; + f = this.move_flags; - if (self.count & 0x80) + if (this.count & 0x80) { - // self.move_flags &= ~FL_ONGROUND; - if (self.move_movetype == MOVETYPE_NONE || self.move_movetype == MOVETYPE_FLY) - Movetype_Physics_NoMatchServer(self); + // this.move_flags &= ~FL_ONGROUND; + if (this.move_movetype == MOVETYPE_NONE || this.move_movetype == MOVETYPE_FLY) + Movetype_Physics_NoMatchServer(this); // the trivial movetypes do not have to match the // server's ticrate as they are ticrate independent // NOTE: this assumption is only true if MOVETYPE_FLY // projectiles detonate on impact. If they continue // moving, we might still be ticrate dependent. else - Movetype_Physics_MatchServer(self, autocvar_cl_projectiles_sloppy); - if (!(self.move_flags & FL_ONGROUND)) - if (self.velocity != '0 0 0') - self.move_angles = self.angles = vectoangles(self.velocity); + Movetype_Physics_MatchServer(this, autocvar_cl_projectiles_sloppy); + if (!(this.move_flags & FL_ONGROUND)) + if (this.velocity != '0 0 0') + this.move_angles = this.angles = vectoangles(this.velocity); } else { - InterpolateOrigin_Do(self); + InterpolateOrigin_Do(this); } - if (self.count & 0x80) + if (this.count & 0x80) { - drawn = (time >= self.spawntime - 0.02); - t = max(time, self.spawntime); + drawn = (time >= this.spawntime - 0.02); + t = max(time, this.spawntime); } else { - drawn = (self.iflags & IFLAG_VALID); + drawn = (this.iflags & IFLAG_VALID); t = time; } if (!(f & FL_ONGROUND)) { rot = '0 0 0'; - switch (self.cnt) + switch (this.cnt) { /* case PROJECTILE_GRENADE: @@ -113,25 +114,25 @@ void Projectile_Draw(entity this) break; } - if (Projectile_isnade(self.cnt)) - rot = self.avelocity; + if (Projectile_isnade(this.cnt)) + rot = this.avelocity; - self.angles = AnglesTransform_ToAngles(AnglesTransform_Multiply(AnglesTransform_FromAngles(self.angles), rot * (t - self.spawntime))); + this.angles = AnglesTransform_ToAngles(AnglesTransform_Multiply(AnglesTransform_FromAngles(this.angles), rot * (t - this.spawntime))); } vector ang; - ang = self.angles; + ang = this.angles; ang.x = -ang.x; makevectors(ang); - a = 1 - (time - self.fade_time) * self.fade_rate; - self.alpha = bound(0, self.alphamod * a, 1); - if (self.alpha <= 0) + a = 1 - (time - this.fade_time) * this.fade_rate; + this.alpha = bound(0, this.alphamod * a, 1); + if (this.alpha <= 0) drawn = 0; - self.renderflags = 0; + this.renderflags = 0; - trailorigin = self.origin; - switch (self.cnt) + trailorigin = this.origin; + switch (this.cnt) { case PROJECTILE_GRENADE: case PROJECTILE_GRENADE_BOUNCING: @@ -141,46 +142,44 @@ void Projectile_Draw(entity this) break; } - if (Projectile_isnade(self.cnt)) + if (Projectile_isnade(this.cnt)) trailorigin += v_up * 4; if (drawn) - Projectile_DrawTrail(self, trailorigin); + Projectile_DrawTrail(this, trailorigin); else - Projectile_ResetTrail(self, trailorigin); + Projectile_ResetTrail(this, trailorigin); - self.drawmask = 0; + this.drawmask = 0; if (!drawn) return; - switch (self.cnt) + switch (this.cnt) { // Possibly add dlights here. default: break; } - self.drawmask = MASK_NORMAL; + this.drawmask = MASK_NORMAL; } void loopsound(entity e, int ch, string samp, float vol, float attn) { - SELFPARAM(); - if (self.silent) + if (e.silent) return; _sound(e, ch, samp, vol, attn); e.snd_looping = ch; } -void Ent_RemoveProjectile() +void Ent_RemoveProjectile(entity this) { - SELFPARAM(); - if (self.count & 0x80) + if (this.count & 0x80) { - tracebox(self.origin, self.mins, self.maxs, self.origin + self.velocity * 0.05, MOVE_NORMAL, self); - Projectile_DrawTrail(self, trace_endpos); + tracebox(this.origin, this.mins, this.maxs, this.origin + this.velocity * 0.05, MOVE_NORMAL, this); + Projectile_DrawTrail(this, trace_endpos); } } @@ -201,286 +200,286 @@ NET_HANDLE(ENT_CLIENT_PROJECTILE, bool isnew) // projectiles don't send angles, because they always follow the velocity int f = ReadByte(); - self.count = (f & 0x80); - self.flags |= FL_PROJECTILE; - self.iflags = (self.iflags & IFLAG_INTERNALMASK) | IFLAG_AUTOANGLES | IFLAG_ANGLES | IFLAG_ORIGIN; - self.solid = SOLID_TRIGGER; - // self.effects = EF_NOMODELFLAGS; + this.count = (f & 0x80); + this.flags |= FL_PROJECTILE; + this.iflags = (this.iflags & IFLAG_INTERNALMASK) | IFLAG_AUTOANGLES | IFLAG_ANGLES | IFLAG_ORIGIN; + this.solid = SOLID_TRIGGER; + // this.effects = EF_NOMODELFLAGS; // this should make collisions with bmodels more exact, but it leads to // projectiles no longer being able to lie on a bmodel - self.move_nomonsters = MOVE_WORLDONLY; + this.move_nomonsters = MOVE_WORLDONLY; if (f & 0x40) - self.move_flags |= FL_ONGROUND; + this.move_flags |= FL_ONGROUND; else - self.move_flags &= ~FL_ONGROUND; + this.move_flags &= ~FL_ONGROUND; - if (!self.move_time) + if (!this.move_time) { // for some unknown reason, we don't need to care for // sv_gameplayfix_delayprojectiles here. - self.move_time = time; - self.spawntime = time; + this.move_time = time; + this.spawntime = time; } else { - self.move_time = max(self.move_time, time); + this.move_time = max(this.move_time, time); } - if (!(self.count & 0x80)) - InterpolateOrigin_Undo(self); + if (!(this.count & 0x80)) + InterpolateOrigin_Undo(this); if (f & 1) { - self.origin_x = ReadCoord(); - self.origin_y = ReadCoord(); - self.origin_z = ReadCoord(); - setorigin(self, self.origin); - if (self.count & 0x80) + this.origin_x = ReadCoord(); + this.origin_y = ReadCoord(); + this.origin_z = ReadCoord(); + setorigin(this, this.origin); + if (this.count & 0x80) { - self.velocity_x = ReadCoord(); - self.velocity_y = ReadCoord(); - self.velocity_z = ReadCoord(); + this.velocity_x = ReadCoord(); + this.velocity_y = ReadCoord(); + this.velocity_z = ReadCoord(); if (f & 0x10) - self.gravity = ReadCoord(); + this.gravity = ReadCoord(); else - self.gravity = 0; // none - self.move_origin = self.origin; - self.move_velocity = self.velocity; + this.gravity = 0; // none + this.move_origin = this.origin; + this.move_velocity = this.velocity; } - if (time == self.spawntime || (self.count & 0x80) || (f & 0x08)) + if (time == this.spawntime || (this.count & 0x80) || (f & 0x08)) { - self.trail_oldorigin = self.origin; - if (!(self.count & 0x80)) - InterpolateOrigin_Reset(); + this.trail_oldorigin = this.origin; + if (!(this.count & 0x80)) + WITH(entity, self, this, InterpolateOrigin_Reset()); } if (f & 0x20) { - self.fade_time = time + ReadByte() * ticrate; - self.fade_rate = 1 / (ReadByte() * ticrate); + this.fade_time = time + ReadByte() * ticrate; + this.fade_rate = 1 / (ReadByte() * ticrate); } else { - self.fade_time = 0; - self.fade_rate = 0; + this.fade_time = 0; + this.fade_rate = 0; } - self.team = ReadByte() - 1; + this.team = ReadByte() - 1; } if (f & 2) { - self.cnt = ReadByte(); + this.cnt = ReadByte(); - self.silent = (self.cnt & 0x80); - self.cnt = (self.cnt & 0x7F); + this.silent = (this.cnt & 0x80); + this.cnt = (this.cnt & 0x7F); - self.scale = 1; - self.traileffect = 0; - switch (self.cnt) + this.scale = 1; + this.traileffect = 0; + switch (this.cnt) { - #define HANDLE(id) case PROJECTILE_##id: setmodel(self, MDL_PROJECTILE_##id); - HANDLE(ELECTRO) self.traileffect = EFFECT_TR_NEXUIZPLASMA.m_id; break; - HANDLE(ROCKET) self.traileffect = EFFECT_TR_ROCKET.m_id; self.scale = 2; break; - HANDLE(CRYLINK) self.traileffect = EFFECT_TR_CRYLINKPLASMA.m_id; break; - HANDLE(CRYLINK_BOUNCING) self.traileffect = EFFECT_TR_CRYLINKPLASMA.m_id; break; - HANDLE(ELECTRO_BEAM) self.traileffect = EFFECT_TR_NEXUIZPLASMA.m_id; break; - HANDLE(GRENADE) self.traileffect = EFFECT_TR_GRENADE.m_id; break; - HANDLE(GRENADE_BOUNCING) self.traileffect = EFFECT_TR_GRENADE.m_id; break; - HANDLE(MINE) self.traileffect = EFFECT_TR_GRENADE.m_id; break; - HANDLE(BLASTER) self.traileffect = EFFECT_Null.m_id; break; - HANDLE(HLAC) self.traileffect = EFFECT_Null.m_id; break; - HANDLE(PORTO_RED) self.traileffect = EFFECT_TR_WIZSPIKE.m_id; self.scale = 4; break; - HANDLE(PORTO_BLUE) self.traileffect = EFFECT_TR_WIZSPIKE.m_id; self.scale = 4; break; - HANDLE(HOOKBOMB) self.traileffect = EFFECT_TR_KNIGHTSPIKE.m_id; break; - HANDLE(HAGAR) self.traileffect = EFFECT_HAGAR_ROCKET.m_id; self.scale = 0.75; break; - HANDLE(HAGAR_BOUNCING) self.traileffect = EFFECT_HAGAR_ROCKET.m_id; self.scale = 0.75; break; - HANDLE(FIREBALL) self.modelindex = 0; self.traileffect = EFFECT_FIREBALL.m_id; break; // particle effect is good enough - HANDLE(FIREMINE) self.modelindex = 0; self.traileffect = EFFECT_FIREMINE.m_id; break; // particle effect is good enough - HANDLE(TAG) self.traileffect = EFFECT_TR_ROCKET.m_id; break; - HANDLE(FLAC) self.scale = 0.4; self.traileffect = EFFECT_FLAC_TRAIL.m_id; break; - HANDLE(SEEKER) self.traileffect = EFFECT_SEEKER_TRAIL.m_id; break; - - HANDLE(MAGE_SPIKE) self.traileffect = EFFECT_TR_VORESPIKE.m_id; break; - HANDLE(SHAMBLER_LIGHTNING) self.traileffect = EFFECT_TR_NEXUIZPLASMA.m_id; break; - - HANDLE(RAPTORBOMB) self.gravity = 1; self.avelocity = '0 0 180'; self.traileffect = EFFECT_Null.m_id; break; - HANDLE(RAPTORBOMBLET) self.gravity = 1; self.avelocity = '0 0 180'; self.traileffect = EFFECT_Null.m_id; break; - HANDLE(RAPTORCANNON) self.traileffect = EFFECT_TR_CRYLINKPLASMA.m_id; break; - - HANDLE(SPIDERROCKET) self.traileffect = EFFECT_SPIDERBOT_ROCKET_TRAIL.m_id; break; - HANDLE(WAKIROCKET) self.traileffect = EFFECT_RACER_ROCKET_TRAIL.m_id; break; - HANDLE(WAKICANNON) self.traileffect = EFFECT_Null.m_id; break; - - HANDLE(BUMBLE_GUN) self.traileffect = EFFECT_TR_NEXUIZPLASMA.m_id; break; - HANDLE(BUMBLE_BEAM) self.traileffect = EFFECT_TR_NEXUIZPLASMA.m_id; break; - - HANDLE(RPC) self.traileffect = EFFECT_TR_ROCKET.m_id; break; - - HANDLE(ROCKETMINSTA_LASER) self.traileffect = EFFECT_ROCKETMINSTA_LASER(self.team).m_id; break; +#define HANDLE(id) case PROJECTILE_##id: setmodel(this, MDL_PROJECTILE_##id); + HANDLE(ELECTRO) this.traileffect = EFFECT_TR_NEXUIZPLASMA.m_id; break; + HANDLE(ROCKET) this.traileffect = EFFECT_TR_ROCKET.m_id; this.scale = 2; break; + HANDLE(CRYLINK) this.traileffect = EFFECT_TR_CRYLINKPLASMA.m_id; break; + HANDLE(CRYLINK_BOUNCING) this.traileffect = EFFECT_TR_CRYLINKPLASMA.m_id; break; + HANDLE(ELECTRO_BEAM) this.traileffect = EFFECT_TR_NEXUIZPLASMA.m_id; break; + HANDLE(GRENADE) this.traileffect = EFFECT_TR_GRENADE.m_id; break; + HANDLE(GRENADE_BOUNCING) this.traileffect = EFFECT_TR_GRENADE.m_id; break; + HANDLE(MINE) this.traileffect = EFFECT_TR_GRENADE.m_id; break; + HANDLE(BLASTER) this.traileffect = EFFECT_Null.m_id; break; + HANDLE(HLAC) this.traileffect = EFFECT_Null.m_id; break; + HANDLE(PORTO_RED) this.traileffect = EFFECT_TR_WIZSPIKE.m_id; this.scale = 4; break; + HANDLE(PORTO_BLUE) this.traileffect = EFFECT_TR_WIZSPIKE.m_id; this.scale = 4; break; + HANDLE(HOOKBOMB) this.traileffect = EFFECT_TR_KNIGHTSPIKE.m_id; break; + HANDLE(HAGAR) this.traileffect = EFFECT_HAGAR_ROCKET.m_id; this.scale = 0.75; break; + HANDLE(HAGAR_BOUNCING) this.traileffect = EFFECT_HAGAR_ROCKET.m_id; this.scale = 0.75; break; + HANDLE(FIREBALL) this.modelindex = 0; this.traileffect = EFFECT_FIREBALL.m_id; break; // particle effect is good enough + HANDLE(FIREMINE) this.modelindex = 0; this.traileffect = EFFECT_FIREMINE.m_id; break; // particle effect is good enough + HANDLE(TAG) this.traileffect = EFFECT_TR_ROCKET.m_id; break; + HANDLE(FLAC) this.scale = 0.4; this.traileffect = EFFECT_FLAC_TRAIL.m_id; break; + HANDLE(SEEKER) this.traileffect = EFFECT_SEEKER_TRAIL.m_id; break; + + HANDLE(MAGE_SPIKE) this.traileffect = EFFECT_TR_VORESPIKE.m_id; break; + HANDLE(SHAMBLER_LIGHTNING) this.traileffect = EFFECT_TR_NEXUIZPLASMA.m_id; break; + + HANDLE(RAPTORBOMB) this.gravity = 1; this.avelocity = '0 0 180'; this.traileffect = EFFECT_Null.m_id; break; + HANDLE(RAPTORBOMBLET) this.gravity = 1; this.avelocity = '0 0 180'; this.traileffect = EFFECT_Null.m_id; break; + HANDLE(RAPTORCANNON) this.traileffect = EFFECT_TR_CRYLINKPLASMA.m_id; break; + + HANDLE(SPIDERROCKET) this.traileffect = EFFECT_SPIDERBOT_ROCKET_TRAIL.m_id; break; + HANDLE(WAKIROCKET) this.traileffect = EFFECT_RACER_ROCKET_TRAIL.m_id; break; + HANDLE(WAKICANNON) this.traileffect = EFFECT_Null.m_id; break; + + HANDLE(BUMBLE_GUN) this.traileffect = EFFECT_TR_NEXUIZPLASMA.m_id; break; + HANDLE(BUMBLE_BEAM) this.traileffect = EFFECT_TR_NEXUIZPLASMA.m_id; break; + + HANDLE(RPC) this.traileffect = EFFECT_TR_ROCKET.m_id; break; + + HANDLE(ROCKETMINSTA_LASER) this.traileffect = EFFECT_ROCKETMINSTA_LASER(this.team).m_id; break; #undef HANDLE default: - if (MUTATOR_CALLHOOK(Ent_Projectile, self)) + if (MUTATOR_CALLHOOK(Ent_Projectile, this)) break; error("Received invalid CSQC projectile, can't work with this!"); break; } - self.mins = '0 0 0'; - self.maxs = '0 0 0'; - self.colormod = '0 0 0'; - self.move_touch = SUB_Stop; - self.move_movetype = MOVETYPE_TOSS; - self.alphamod = 1; + this.mins = '0 0 0'; + this.maxs = '0 0 0'; + this.colormod = '0 0 0'; + this.move_touch = SUB_Stop_self; + this.move_movetype = MOVETYPE_TOSS; + this.alphamod = 1; - switch (self.cnt) + switch (this.cnt) { case PROJECTILE_ELECTRO: // only new engines support sound moving with object - loopsound(self, CH_SHOTS_SINGLE, SND(ELECTRO_FLY), VOL_BASE, ATTEN_NORM); - self.mins = '0 0 -4'; - self.maxs = '0 0 -4'; - self.move_movetype = MOVETYPE_BOUNCE; - self.move_touch = func_null; - self.move_bounce_factor = WEP_CVAR_SEC(electro, bouncefactor); - self.move_bounce_stopspeed = WEP_CVAR_SEC(electro, bouncestop); + loopsound(this, CH_SHOTS_SINGLE, SND(ELECTRO_FLY), VOL_BASE, ATTEN_NORM); + this.mins = '0 0 -4'; + this.maxs = '0 0 -4'; + this.move_movetype = MOVETYPE_BOUNCE; + this.move_touch = func_null; + this.move_bounce_factor = WEP_CVAR_SEC(electro, bouncefactor); + this.move_bounce_stopspeed = WEP_CVAR_SEC(electro, bouncestop); break; case PROJECTILE_RPC: case PROJECTILE_ROCKET: - loopsound(self, CH_SHOTS_SINGLE, SND(ROCKET_FLY), VOL_BASE, ATTEN_NORM); - self.mins = '-3 -3 -3'; - self.maxs = '3 3 3'; + loopsound(this, CH_SHOTS_SINGLE, SND(ROCKET_FLY), VOL_BASE, ATTEN_NORM); + this.mins = '-3 -3 -3'; + this.maxs = '3 3 3'; break; case PROJECTILE_GRENADE: - self.mins = '-3 -3 -3'; - self.maxs = '3 3 3'; + this.mins = '-3 -3 -3'; + this.maxs = '3 3 3'; break; case PROJECTILE_GRENADE_BOUNCING: - self.mins = '-3 -3 -3'; - self.maxs = '3 3 3'; - self.move_movetype = MOVETYPE_BOUNCE; - self.move_touch = func_null; - self.move_bounce_factor = WEP_CVAR(mortar, bouncefactor); - self.move_bounce_stopspeed = WEP_CVAR(mortar, bouncestop); + this.mins = '-3 -3 -3'; + this.maxs = '3 3 3'; + this.move_movetype = MOVETYPE_BOUNCE; + this.move_touch = func_null; + this.move_bounce_factor = WEP_CVAR(mortar, bouncefactor); + this.move_bounce_stopspeed = WEP_CVAR(mortar, bouncestop); break; case PROJECTILE_SHAMBLER_LIGHTNING: - self.mins = '-8 -8 -8'; - self.maxs = '8 8 8'; - self.scale = 2.5; - self.avelocity = randomvec() * 720; + this.mins = '-8 -8 -8'; + this.maxs = '8 8 8'; + this.scale = 2.5; + this.avelocity = randomvec() * 720; break; case PROJECTILE_MINE: - self.mins = '-4 -4 -4'; - self.maxs = '4 4 4'; + this.mins = '-4 -4 -4'; + this.maxs = '4 4 4'; break; case PROJECTILE_PORTO_RED: - self.colormod = '2 1 1'; - self.alphamod = 0.5; - self.move_movetype = MOVETYPE_BOUNCE; - self.move_touch = func_null; + this.colormod = '2 1 1'; + this.alphamod = 0.5; + this.move_movetype = MOVETYPE_BOUNCE; + this.move_touch = func_null; break; case PROJECTILE_PORTO_BLUE: - self.colormod = '1 1 2'; - self.alphamod = 0.5; - self.move_movetype = MOVETYPE_BOUNCE; - self.move_touch = func_null; + this.colormod = '1 1 2'; + this.alphamod = 0.5; + this.move_movetype = MOVETYPE_BOUNCE; + this.move_touch = func_null; break; case PROJECTILE_HAGAR_BOUNCING: - self.move_movetype = MOVETYPE_BOUNCE; - self.move_touch = func_null; + this.move_movetype = MOVETYPE_BOUNCE; + this.move_touch = func_null; break; case PROJECTILE_CRYLINK_BOUNCING: - self.move_movetype = MOVETYPE_BOUNCE; - self.move_touch = func_null; + this.move_movetype = MOVETYPE_BOUNCE; + this.move_touch = func_null; break; case PROJECTILE_FIREBALL: - loopsound(self, CH_SHOTS_SINGLE, SND(FIREBALL_FLY2), VOL_BASE, ATTEN_NORM); - self.mins = '-16 -16 -16'; - self.maxs = '16 16 16'; + loopsound(this, CH_SHOTS_SINGLE, SND(FIREBALL_FLY2), VOL_BASE, ATTEN_NORM); + this.mins = '-16 -16 -16'; + this.maxs = '16 16 16'; break; case PROJECTILE_FIREMINE: - loopsound(self, CH_SHOTS_SINGLE, SND(FIREBALL_FLY), VOL_BASE, ATTEN_NORM); - self.move_movetype = MOVETYPE_BOUNCE; - self.move_touch = func_null; - self.mins = '-4 -4 -4'; - self.maxs = '4 4 4'; + loopsound(this, CH_SHOTS_SINGLE, SND(FIREBALL_FLY), VOL_BASE, ATTEN_NORM); + this.move_movetype = MOVETYPE_BOUNCE; + this.move_touch = func_null; + this.mins = '-4 -4 -4'; + this.maxs = '4 4 4'; break; case PROJECTILE_TAG: - self.mins = '-2 -2 -2'; - self.maxs = '2 2 2'; + this.mins = '-2 -2 -2'; + this.maxs = '2 2 2'; break; case PROJECTILE_FLAC: - self.mins = '-2 -2 -2'; - self.maxs = '2 2 2'; + this.mins = '-2 -2 -2'; + this.maxs = '2 2 2'; break; case PROJECTILE_SEEKER: - loopsound(self, CH_SHOTS_SINGLE, SND(TAG_ROCKET_FLY), VOL_BASE, ATTEN_NORM); - self.mins = '-4 -4 -4'; - self.maxs = '4 4 4'; + loopsound(this, CH_SHOTS_SINGLE, SND(TAG_ROCKET_FLY), VOL_BASE, ATTEN_NORM); + this.mins = '-4 -4 -4'; + this.maxs = '4 4 4'; break; case PROJECTILE_RAPTORBOMB: - self.mins = '-3 -3 -3'; - self.maxs = '3 3 3'; + this.mins = '-3 -3 -3'; + this.maxs = '3 3 3'; break; case PROJECTILE_RAPTORBOMBLET: break; case PROJECTILE_RAPTORCANNON: break; case PROJECTILE_SPIDERROCKET: - loopsound(self, CH_SHOTS_SINGLE, SND(TAG_ROCKET_FLY), VOL_BASE, ATTEN_NORM); + loopsound(this, CH_SHOTS_SINGLE, SND(TAG_ROCKET_FLY), VOL_BASE, ATTEN_NORM); break; case PROJECTILE_WAKIROCKET: - loopsound(self, CH_SHOTS_SINGLE, SND(TAG_ROCKET_FLY), VOL_BASE, ATTEN_NORM); + loopsound(this, CH_SHOTS_SINGLE, SND(TAG_ROCKET_FLY), VOL_BASE, ATTEN_NORM); break; /* case PROJECTILE_WAKICANNON: break; case PROJECTILE_BUMBLE_GUN: // only new engines support sound moving with object - loopsound(self, CH_SHOTS_SINGLE, SND(ELECTRO_FLY), VOL_BASE, ATTEN_NORM); - self.mins = '0 0 -4'; - self.maxs = '0 0 -4'; - self.move_movetype = MOVETYPE_BOUNCE; - self.move_touch = func_null; - self.move_bounce_factor = WEP_CVAR_SEC(electro, bouncefactor); - self.move_bounce_stopspeed = WEP_CVAR_SEC(electro, bouncestop); + loopsound(this, CH_SHOTS_SINGLE, SND(ELECTRO_FLY), VOL_BASE, ATTEN_NORM); + this.mins = '0 0 -4'; + this.maxs = '0 0 -4'; + this.move_movetype = MOVETYPE_BOUNCE; + this.move_touch = func_null; + this.move_bounce_factor = WEP_CVAR_SEC(electro, bouncefactor); + this.move_bounce_stopspeed = WEP_CVAR_SEC(electro, bouncestop); break; */ default: break; } - MUTATOR_CALLHOOK(EditProjectile, self); + MUTATOR_CALLHOOK(EditProjectile, this); - setsize(self, self.mins, self.maxs); + setsize(this, this.mins, this.maxs); } return = true; - if (self.gravity) + if (this.gravity) { - if (self.move_movetype == MOVETYPE_FLY) - self.move_movetype = MOVETYPE_TOSS; - if (self.move_movetype == MOVETYPE_BOUNCEMISSILE) - self.move_movetype = MOVETYPE_BOUNCE; + if (this.move_movetype == MOVETYPE_FLY) + this.move_movetype = MOVETYPE_TOSS; + if (this.move_movetype == MOVETYPE_BOUNCEMISSILE) + this.move_movetype = MOVETYPE_BOUNCE; } else { - if (self.move_movetype == MOVETYPE_TOSS) - self.move_movetype = MOVETYPE_FLY; - if (self.move_movetype == MOVETYPE_BOUNCE) - self.move_movetype = MOVETYPE_BOUNCEMISSILE; + if (this.move_movetype == MOVETYPE_TOSS) + this.move_movetype = MOVETYPE_FLY; + if (this.move_movetype == MOVETYPE_BOUNCE) + this.move_movetype = MOVETYPE_BOUNCEMISSILE; } - if (!(self.count & 0x80)) + if (!(this.count & 0x80)) InterpolateOrigin_Note(this); - self.classname = "csqcprojectile"; - self.draw = Projectile_Draw; - self.entremove = Ent_RemoveProjectile; + this.classname = "csqcprojectile"; + this.draw = Projectile_Draw; + this.entremove = Ent_RemoveProjectile; } PRECACHE(Projectiles) diff --git a/qcsrc/client/weapons/projectile.qh b/qcsrc/client/weapons/projectile.qh index a925f34c6..1b0d313aa 100644 --- a/qcsrc/client/weapons/projectile.qh +++ b/qcsrc/client/weapons/projectile.qh @@ -17,7 +17,7 @@ class(Projectile).float gravity; class(Projectile).int snd_looping; class(Projectile).bool silent; -void SUB_Stop(); +void SUB_Stop(entity this); void Projectile_ResetTrail(entity this, vector to); @@ -27,7 +27,7 @@ void Projectile_Draw(entity this); void loopsound(entity e, int ch, string samp, float vol, float attn); -void Ent_RemoveProjectile(); +void Ent_RemoveProjectile(entity this); const int FL_PROJECTILE = BIT(15); diff --git a/qcsrc/common/csqcmodel_settings.qh b/qcsrc/common/csqcmodel_settings.qh index c4b88cc95..916fd88bc 100644 --- a/qcsrc/common/csqcmodel_settings.qh +++ b/qcsrc/common/csqcmodel_settings.qh @@ -73,11 +73,11 @@ // add hook function calls here #define CSQCMODEL_HOOK_PREUPDATE \ - CSQCModel_Hook_PreUpdate(isnew, isplayer, islocalplayer); + CSQCModel_Hook_PreUpdate(this, isnew, isplayer, islocalplayer); #define CSQCMODEL_HOOK_POSTUPDATE \ - CSQCModel_Hook_PostUpdate(isnew, isplayer, islocalplayer); + CSQCModel_Hook_PostUpdate(this, isnew, isplayer, islocalplayer); #define CSQCMODEL_HOOK_PREDRAW \ - CSQCModel_Hook_PreDraw(isplayer); + CSQCModel_Hook_PreDraw(this, isplayer); #define CSQCPLAYER_HOOK_POSTCAMERASETUP() \ CSQCPlayer_SetViewLocation() diff --git a/qcsrc/common/ent_cs.qc b/qcsrc/common/ent_cs.qc index 6367f4068..ff67a72cd 100644 --- a/qcsrc/common/ent_cs.qc +++ b/qcsrc/common/ent_cs.qc @@ -126,9 +126,8 @@ #ifdef CSQC - void Ent_RemoveEntCS() + void Ent_RemoveEntCS(entity this) { - SELFPARAM(); int n = this.sv_entnum; entity e = entcs_receiver(n); entcs_receiver(n, NULL); diff --git a/qcsrc/common/minigames/cl_minigames.qc b/qcsrc/common/minigames/cl_minigames.qc index 93147d404..6f7e7c3ae 100644 --- a/qcsrc/common/minigames/cl_minigames.qc +++ b/qcsrc/common/minigames/cl_minigames.qc @@ -54,7 +54,7 @@ string minigame_texture(string name) return path; } -#define FIELD(Flags, Type, Name) MSLE_CLEAN_##Type(self.Name) +#define FIELD(Flags, Type, Name) MSLE_CLEAN_##Type(this.Name) #define MSLE_CLEAN_String(x) strunzone(x); #define MSLE_CLEAN_Byte(x) #define MSLE_CLEAN_Char(x) @@ -67,7 +67,7 @@ string minigame_texture(string name) #define MSLE_CLEAN_Vector2D(x) #define MSLE(Name,Fields) \ - void msle_entremove_##Name() { SELFPARAM(); strunzone(self.netname); Fields } + void msle_entremove_##Name(entity this) { strunzone(this.netname); Fields } MINIGAME_SIMPLELINKED_ENTITIES #undef MSLE #undef FIELD @@ -105,9 +105,9 @@ void deactivate_minigame() HUD_MinigameMenu_CurrentButton(); } -void minigame_entremove() -{SELFPARAM(); - if ( self == active_minigame ) +void minigame_entremove(entity this) +{ + if ( this == active_minigame ) deactivate_minigame(); } @@ -147,9 +147,9 @@ void activate_minigame(entity minigame) } } -void minigame_player_entremove() -{SELFPARAM(); - if ( self.owner == active_minigame && self.minigame_playerslot == player_localentnum ) +void minigame_player_entremove(entity this) +{ + if ( this.owner == active_minigame && this.minigame_playerslot == player_localentnum ) deactivate_minigame(); } diff --git a/qcsrc/common/mutators/base.qh b/qcsrc/common/mutators/base.qh index 98c5dadac..62df8dcbc 100644 --- a/qcsrc/common/mutators/base.qh +++ b/qcsrc/common/mutators/base.qh @@ -179,9 +179,8 @@ bool Mutator_SendEntity(entity this, entity to, int sf) #endif #ifdef CSQC -void NET_Mutator_Remove() +void NET_Mutator_Remove(entity this) { - SELFPARAM(); string s = this.netname; WITH(bool, mutator_log, true, LAMBDA( FOREACH(Mutators, it.registered_id == s, LAMBDA(Mutator_Remove(it))); diff --git a/qcsrc/common/mutators/mutator/waypoints/waypointsprites.qc b/qcsrc/common/mutators/mutator/waypoints/waypointsprites.qc index f4b82ef12..3c3cf7f56 100644 --- a/qcsrc/common/mutators/mutator/waypoints/waypointsprites.qc +++ b/qcsrc/common/mutators/mutator/waypoints/waypointsprites.qc @@ -104,11 +104,11 @@ NET_HANDLE(waypointsprites, bool isnew) { return true; } -void Ent_RemoveWaypointSprite() -{SELFPARAM(); - if (self.netname) strunzone(self.netname); - if (self.netname2) strunzone(self.netname2); - if (self.netname3) strunzone(self.netname3); +void Ent_RemoveWaypointSprite(entity this) +{ + if (this.netname) strunzone(this.netname); + if (this.netname2) strunzone(this.netname2); + if (this.netname3) strunzone(this.netname3); } /** flags origin [team displayrule] [spritename] [spritename2] [spritename3] [lifetime maxdistance hideable] */ diff --git a/qcsrc/common/mutators/mutator/waypoints/waypointsprites.qh b/qcsrc/common/mutators/mutator/waypoints/waypointsprites.qh index b299f7fbe..c3f8378b1 100644 --- a/qcsrc/common/mutators/mutator/waypoints/waypointsprites.qh +++ b/qcsrc/common/mutators/mutator/waypoints/waypointsprites.qh @@ -106,7 +106,7 @@ vector fixrgbexcess(vector rgb); // they are drawn using a .draw function -void Ent_RemoveWaypointSprite(); +void Ent_RemoveWaypointSprite(entity this); void Ent_WaypointSprite(); diff --git a/qcsrc/common/t_items.qc b/qcsrc/common/t_items.qc index 4d601d4e1..ce3bf352a 100644 --- a/qcsrc/common/t_items.qc +++ b/qcsrc/common/t_items.qc @@ -140,10 +140,10 @@ void Item_PreDraw() self.drawmask = MASK_NORMAL; } -void ItemRemove() -{SELFPARAM(); - if (self.mdl) - strunzone(self.mdl); +void ItemRemove(entity this) +{ + if(this.mdl) + strunzone(this.mdl); } NET_HANDLE(ENT_CLIENT_ITEM, bool isnew) diff --git a/qcsrc/common/triggers/func/ladder.qc b/qcsrc/common/triggers/func/ladder.qc index 4e90eb9aa..44687de4a 100644 --- a/qcsrc/common/triggers/func/ladder.qc +++ b/qcsrc/common/triggers/func/ladder.qc @@ -60,10 +60,10 @@ spawnfunc(func_water) #elif defined(CSQC) .float speed; -void func_ladder_remove() +void func_ladder_remove(entity this) { - if(self.classname) { strunzone(self.classname); } - self.classname = string_null; + if(this.classname) { strunzone(this.classname); } + this.classname = string_null; } NET_HANDLE(ENT_CLIENT_LADDER, bool isnew) diff --git a/qcsrc/common/triggers/func/pointparticles.qc b/qcsrc/common/triggers/func/pointparticles.qc index c3a059aa2..28f6812c2 100644 --- a/qcsrc/common/triggers/func/pointparticles.qc +++ b/qcsrc/common/triggers/func/pointparticles.qc @@ -246,14 +246,14 @@ void Draw_PointParticles(entity this) setorigin(self, o); } -void Ent_PointParticles_Remove() -{SELFPARAM(); - if(self.noise) - strunzone(self.noise); - self.noise = string_null; - if(self.bgmscript) - strunzone(self.bgmscript); - self.bgmscript = string_null; +void Ent_PointParticles_Remove(entity this) +{ + if(this.noise) + strunzone(this.noise); + this.noise = string_null; + if(this.bgmscript) + strunzone(this.bgmscript); + this.bgmscript = string_null; } NET_HANDLE(ENT_CLIENT_POINTPARTICLES, bool isnew) diff --git a/qcsrc/common/triggers/misc/corner.qc b/qcsrc/common/triggers/misc/corner.qc index d1bfe00de..d081807bc 100644 --- a/qcsrc/common/triggers/misc/corner.qc +++ b/qcsrc/common/triggers/misc/corner.qc @@ -38,25 +38,25 @@ spawnfunc(path_corner) } #elif defined(CSQC) -void corner_remove() -{SELFPARAM(); - if(self.target) { strunzone(self.target); } - self.target = string_null; +void corner_remove(entity this) +{ + if(this.target) { strunzone(this.target); } + this.target = string_null; - if(self.target2) { strunzone(self.target2); } - self.target2 = string_null; + if(this.target2) { strunzone(this.target2); } + this.target2 = string_null; - if(self.target3) { strunzone(self.target3); } - self.target3 = string_null; + if(this.target3) { strunzone(this.target3); } + this.target3 = string_null; - if(self.target4) { strunzone(self.target4); } - self.target4 = string_null; + if(this.target4) { strunzone(this.target4); } + this.target4 = string_null; - if(self.targetname) { strunzone(self.targetname); } - self.targetname = string_null; + if(this.targetname) { strunzone(this.targetname); } + this.targetname = string_null; - if(self.platmovetype) { strunzone(self.platmovetype); } - self.platmovetype = string_null; + if(this.platmovetype) { strunzone(this.platmovetype); } + this.platmovetype = string_null; } NET_HANDLE(ENT_CLIENT_CORNER, bool isnew) diff --git a/qcsrc/common/triggers/misc/teleport_dest.qc b/qcsrc/common/triggers/misc/teleport_dest.qc index 5a367308e..161e6796b 100644 --- a/qcsrc/common/triggers/misc/teleport_dest.qc +++ b/qcsrc/common/triggers/misc/teleport_dest.qc @@ -61,15 +61,15 @@ spawnfunc(target_teleporter) #elif defined(CSQC) -void teleport_dest_remove() -{SELFPARAM(); +void teleport_dest_remove(entity this) +{ //if(self.classname) //strunzone(self.classname); //self.classname = string_null; - if(self.targetname) - strunzone(self.targetname); - self.targetname = string_null; + if(this.targetname) + strunzone(this.targetname); + this.targetname = string_null; } NET_HANDLE(ENT_CLIENT_TELEPORT_DEST, bool isnew) diff --git a/qcsrc/common/triggers/trigger/jumppads.qc b/qcsrc/common/triggers/trigger/jumppads.qc index c83ea06fa..3c1534c97 100644 --- a/qcsrc/common/triggers/trigger/jumppads.qc +++ b/qcsrc/common/triggers/trigger/jumppads.qc @@ -453,15 +453,15 @@ NET_HANDLE(ENT_CLIENT_TRIGGER_PUSH, bool isnew) return true; } -void target_push_remove() -{SELFPARAM(); - if(self.classname) - strunzone(self.classname); - self.classname = string_null; +void target_push_remove(entity this) +{ + if(this.classname) + strunzone(this.classname); + this.classname = string_null; - if(self.targetname) - strunzone(self.targetname); - self.targetname = string_null; + if(this.targetname) + strunzone(this.targetname); + this.targetname = string_null; } NET_HANDLE(ENT_CLIENT_TARGET_PUSH, bool isnew) diff --git a/qcsrc/common/triggers/trigger/keylock.qc b/qcsrc/common/triggers/trigger/keylock.qc index b628eaf82..182650ed5 100644 --- a/qcsrc/common/triggers/trigger/keylock.qc +++ b/qcsrc/common/triggers/trigger/keylock.qc @@ -176,25 +176,25 @@ spawnfunc(trigger_keylock) trigger_keylock_link(); } #elif defined(CSQC) -void keylock_remove() -{SELFPARAM(); - if(self.target) { strunzone(self.target); } - self.target = string_null; +void keylock_remove(entity this) +{ + if(this.target) { strunzone(this.target); } + this.target = string_null; - if(self.target2) { strunzone(self.target2); } - self.target2 = string_null; + if(this.target2) { strunzone(this.target2); } + this.target2 = string_null; - if(self.target3) { strunzone(self.target3); } - self.target3 = string_null; + if(this.target3) { strunzone(this.target3); } + this.target3 = string_null; - if(self.target4) { strunzone(self.target4); } - self.target4 = string_null; + if(this.target4) { strunzone(this.target4); } + this.target4 = string_null; - if(self.killtarget) { strunzone(self.killtarget); } - self.killtarget = string_null; + if(this.killtarget) { strunzone(this.killtarget); } + this.killtarget = string_null; - if(self.targetname) { strunzone(self.targetname); } - self.targetname = string_null; + if(this.targetname) { strunzone(this.targetname); } + this.targetname = string_null; } NET_HANDLE(ENT_CLIENT_KEYLOCK, bool isnew) diff --git a/qcsrc/common/triggers/triggers.qc b/qcsrc/common/triggers/triggers.qc index cd1d0260c..d78216000 100644 --- a/qcsrc/common/triggers/triggers.qc +++ b/qcsrc/common/triggers/triggers.qc @@ -143,25 +143,25 @@ void trigger_common_read(bool withtarget) self.angles_z = ReadCoord(); } -void trigger_remove_generic() -{SELFPARAM(); - if(self.target) { strunzone(self.target); } - self.target = string_null; +void trigger_remove_generic(entity this) +{ + if(this.target) { strunzone(this.target); } + this.target = string_null; - if(self.target2) { strunzone(self.target2); } - self.target2 = string_null; + if(this.target2) { strunzone(this.target2); } + this.target2 = string_null; - if(self.target3) { strunzone(self.target3); } - self.target3 = string_null; + if(this.target3) { strunzone(this.target3); } + this.target3 = string_null; - if(self.target4) { strunzone(self.target4); } - self.target4 = string_null; + if(this.target4) { strunzone(this.target4); } + this.target4 = string_null; - if(self.targetname) { strunzone(self.targetname); } - self.target = string_null; + if(this.targetname) { strunzone(this.targetname); } + this.target = string_null; - if(self.killtarget) { strunzone(self.killtarget); } - self.killtarget = string_null; + if(this.killtarget) { strunzone(this.killtarget); } + this.killtarget = string_null; } #endif diff --git a/qcsrc/common/triggers/triggers.qh b/qcsrc/common/triggers/triggers.qh index 5c000cff1..69d53fba4 100644 --- a/qcsrc/common/triggers/triggers.qh +++ b/qcsrc/common/triggers/triggers.qh @@ -40,7 +40,7 @@ void FixSize(entity e); #ifdef CSQC void trigger_common_read(bool withtarget); -void trigger_remove_generic(); +void trigger_remove_generic(entity this); .float active; .string target; diff --git a/qcsrc/common/turrets/cl_turrets.qc b/qcsrc/common/turrets/cl_turrets.qc index dbf1e9e33..31c22480f 100644 --- a/qcsrc/common/turrets/cl_turrets.qc +++ b/qcsrc/common/turrets/cl_turrets.qc @@ -1,8 +1,8 @@ -void turret_remove() -{SELFPARAM(); - remove(self.tur_head); - //remove(self.enemy); - self.tur_head = world; +void turret_remove(entity this) +{ + remove(this.tur_head); + //remove(this.enemy); + this.tur_head = world; } .vector glowmod; diff --git a/qcsrc/common/weapons/weapon/arc.qc b/qcsrc/common/weapons/weapon/arc.qc index e21df3699..e7f31dd6f 100644 --- a/qcsrc/common/weapons/weapon/arc.qc +++ b/qcsrc/common/weapons/weapon/arc.qc @@ -1143,10 +1143,10 @@ void Draw_ArcBeam(entity this) Draw_ArcBeam_callback_last_bottom = '0 0 0'; } -void Remove_ArcBeam() -{SELFPARAM(); - remove(self.beam_muzzleentity); - sound(self, CH_SHOTS_SINGLE, SND_Null, VOL_BASE, ATTEN_NORM); +void Remove_ArcBeam(entity this) +{ + remove(this.beam_muzzleentity); + sound(this, CH_SHOTS_SINGLE, SND_Null, VOL_BASE, ATTEN_NORM); } NET_HANDLE(ENT_CLIENT_ARC_BEAM, bool isnew) diff --git a/qcsrc/common/weapons/weapon/hook.qc b/qcsrc/common/weapons/weapon/hook.qc index 8fc13f9e1..f0ae19e0f 100644 --- a/qcsrc/common/weapons/weapon/hook.qc +++ b/qcsrc/common/weapons/weapon/hook.qc @@ -478,9 +478,9 @@ void Draw_GrapplingHook(entity this) } } -void Remove_GrapplingHook() -{SELFPARAM(); - sound (self, CH_SHOTS_SINGLE, SND_Null, VOL_BASE, ATTEN_NORM); +void Remove_GrapplingHook(entity this) +{ + sound (this, CH_SHOTS_SINGLE, SND_Null, VOL_BASE, ATTEN_NORM); } NET_HANDLE(ENT_CLIENT_HOOK, bool bIsNew) diff --git a/qcsrc/common/weapons/weapon/tuba.qc b/qcsrc/common/weapons/weapon/tuba.qc index ebf4881df..0e429acb2 100644 --- a/qcsrc/common/weapons/weapon/tuba.qc +++ b/qcsrc/common/weapons/weapon/tuba.qc @@ -582,12 +582,14 @@ void Ent_TubaNote_UpdateSound(entity this) tubasound(this.enemy, 1); } -void Ent_TubaNote_StopSound() -{SELFPARAM(); +void Ent_TubaNote_StopSound(entity this) +{ this.enemy.nextthink = time; this.enemy = NULL; } +void Ent_TubaNote_StopSound_self() { Ent_TubaNote_StopSound(self); } + NET_HANDLE(ENT_CLIENT_TUBANOTE, bool isNew) { bool upd = false; @@ -600,7 +602,7 @@ NET_HANDLE(ENT_CLIENT_TUBANOTE, bool isNew) if (this.enemy) { if (n != this.note || i != this.tuba_instrument || isNew) { - Ent_TubaNote_StopSound(); + Ent_TubaNote_StopSound(this); } } else { this.enemy = new(tuba_note); @@ -629,7 +631,7 @@ NET_HANDLE(ENT_CLIENT_TUBANOTE, bool isNew) } } - this.think = Ent_TubaNote_StopSound; + this.think = Ent_TubaNote_StopSound_self; this.entremove = Ent_TubaNote_StopSound; this.enemy.think = Ent_TubaNote_Think; this.enemy.nextthink = time + 10; diff --git a/qcsrc/lib/csqcmodel/cl_model.qc b/qcsrc/lib/csqcmodel/cl_model.qc index 6903ce07d..f3497febe 100644 --- a/qcsrc/lib/csqcmodel/cl_model.qc +++ b/qcsrc/lib/csqcmodel/cl_model.qc @@ -210,9 +210,8 @@ void CSQCModel_Draw() entity CSQCModel_players[255]; // 255 is engine limit on maxclients -void CSQCModel_remove() +void CSQCModel_remove(entity this) { - SELFPARAM(); CSQCModel_players[this.entnum - 1] = NULL; } diff --git a/qcsrc/lib/csqcmodel/cl_player.qc b/qcsrc/lib/csqcmodel/cl_player.qc index 88b2f2ec8..4e308ee56 100644 --- a/qcsrc/lib/csqcmodel/cl_player.qc +++ b/qcsrc/lib/csqcmodel/cl_player.qc @@ -339,7 +339,7 @@ void CSQCPlayer_SetCamera() CSQCPLAYER_HOOK_POSTCAMERASETUP(); } -void CSQCPlayer_Remove() +void CSQCPlayer_Remove(entity this) { csqcplayer = NULL; cvar_settemp("cl_movement_replay", "1"); -- 2.39.2