Draw: purge SELFPARAM
authorTimePath <andrew.hardaker1995@gmail.com>
Wed, 7 Oct 2015 02:51:02 +0000 (13:51 +1100)
committerTimePath <andrew.hardaker1995@gmail.com>
Wed, 7 Oct 2015 02:51:02 +0000 (13:51 +1100)
44 files changed:
qcsrc/client/announcer.qc
qcsrc/client/command/cl_cmd.qc
qcsrc/client/controlpoint.qc
qcsrc/client/controlpoint.qh
qcsrc/client/csqcmodel_hooks.qc
qcsrc/client/generator.qc
qcsrc/client/gibs.qc
qcsrc/client/gibs.qh
qcsrc/client/hook.qc
qcsrc/client/laser.qc
qcsrc/client/main.qc
qcsrc/client/main.qh
qcsrc/client/modeleffects.qc
qcsrc/client/modeleffects.qh
qcsrc/client/particles.qh
qcsrc/client/view.qc
qcsrc/client/wall.qc
qcsrc/client/wall.qh
qcsrc/client/weapons/projectile.qc
qcsrc/client/weapons/projectile.qh
qcsrc/common/mutators/mutator/casings.qc
qcsrc/common/mutators/mutator/damagetext.qc
qcsrc/common/mutators/mutator/waypoints/waypointsprites.qc
qcsrc/common/mutators/mutator/waypoints/waypointsprites.qh
qcsrc/common/nades/all.qc
qcsrc/common/triggers/func/conveyor.qc
qcsrc/common/triggers/func/door.qc
qcsrc/common/triggers/func/plat.qc
qcsrc/common/triggers/func/pointparticles.qc
qcsrc/common/triggers/func/rainsnow.qc
qcsrc/common/triggers/func/train.qc
qcsrc/common/triggers/misc/laser.qc
qcsrc/common/triggers/triggers.qc
qcsrc/common/turrets/cl_turrets.qc
qcsrc/common/turrets/turret/ewheel.qc
qcsrc/common/turrets/turret/walker.qc
qcsrc/common/vehicles/cl_vehicles.qc
qcsrc/common/vehicles/cl_vehicles.qh
qcsrc/common/vehicles/vehicle/bumblebee_weapons.qc
qcsrc/common/vehicles/vehicle/raptor_weapons.qc
qcsrc/common/weapons/weapon/arc.qc
qcsrc/common/weapons/weapon/shockwave.qc
qcsrc/server/t_items.qc
qcsrc/server/t_items.qh

index 8f47717..b7b7bb5 100644 (file)
@@ -8,13 +8,14 @@
 bool announcer_1min;
 bool announcer_5min;
 void Announcer_Countdown()
-{SELFPARAM();
+{
+       SELFPARAM();
        float starttime = getstatf(STAT_GAMESTARTTIME);
        float roundstarttime = getstatf(STAT_ROUNDSTARTTIME);
        if(roundstarttime == -1)
        {
                Local_Notification(MSG_CENTER, CENTER_COUNTDOWN_ROUNDSTOP);
-               remove(self);
+               remove(this);
                return;
        }
        if(roundstarttime >= starttime)
@@ -29,7 +30,7 @@ void Announcer_Countdown()
        {
                Local_Notification(MSG_CENTER, CENTER_COUNTDOWN_BEGIN);
                Local_Notification(MSG_MULTI, MULTI_COUNTDOWN_BEGIN);
-               remove(self);
+               remove(this);
                return;
        }
        else // countdown is still going
@@ -46,7 +47,7 @@ void Announcer_Countdown()
                        Local_Notification(MSG_ANNCE, Announcer_PickNumber(CNT_GAMESTART, countdown_rounded));
                }
 
-               self.nextthink = (starttime - (countdown - 1));
+               this.nextthink = (starttime - (countdown - 1));
        }
 }
 
index 72fa244..88cd246 100644 (file)
@@ -20,8 +20,8 @@
 
 #include "../../common/command/generic.qh"
 
-void DrawDebugModel()
-{SELFPARAM();
+void DrawDebugModel(entity this)
+{
        if(time - floor(time) > 0.5)
        {
                PolyDrawModel(self);
index a83260b..34301d8 100644 (file)
 
 .entity icon_realmodel;
 
-void cpicon_draw()
-{SELFPARAM();
-       if(time < self.move_time) { return; }
+void cpicon_draw(entity this)
+{
+       if(time < this.move_time) { return; }
 
-       if(self.cp_bob_dmg_z > 0)
-               self.cp_bob_dmg_z = self.cp_bob_dmg_z - 3 * frametime;
+       if(this.cp_bob_dmg_z > 0)
+               this.cp_bob_dmg_z = this.cp_bob_dmg_z - 3 * frametime;
        else
-               self.cp_bob_dmg_z = 0;
-       self.cp_bob_origin_z = 4 * PI * (1 - cos(self.cp_bob_spd));
-       self.cp_bob_spd = self.cp_bob_spd + 1.875 * frametime;
-       self.colormod = '1 1 1' * (2 - bound(0, (self.pain_finished - time) / 10, 1));
+               this.cp_bob_dmg_z = 0;
+       this.cp_bob_origin_z = 4 * PI * (1 - cos(this.cp_bob_spd));
+       this.cp_bob_spd = this.cp_bob_spd + 1.875 * frametime;
+       this.colormod = '1 1 1' * (2 - bound(0, (this.pain_finished - time) / 10, 1));
 
-       if(!self.iscaptured) self.alpha = self.health / self.max_health;
+       if(!this.iscaptured) this.alpha = this.health / this.max_health;
 
-       if(self.iscaptured)
+       if(this.iscaptured)
        {
-               if (self.punchangle_x > 0)
+               if (this.punchangle_x > 0)
                {
-                       self.punchangle_x = self.punchangle_x - 60 * frametime;
-                       if (self.punchangle_x < 0)
-                               self.punchangle_x = 0;
+                       this.punchangle_x = this.punchangle_x - 60 * frametime;
+                       if (this.punchangle_x < 0)
+                               this.punchangle_x = 0;
                }
-               else if (self.punchangle_x < 0)
+               else if (this.punchangle_x < 0)
                {
-                       self.punchangle_x = self.punchangle_x + 60 * frametime;
-                       if (self.punchangle_x > 0)
-                               self.punchangle_x = 0;
+                       this.punchangle_x = this.punchangle_x + 60 * frametime;
+                       if (this.punchangle_x > 0)
+                               this.punchangle_x = 0;
                }
 
-               if (self.punchangle_y > 0)
+               if (this.punchangle_y > 0)
                {
-                       self.punchangle_y = self.punchangle_y - 60 * frametime;
-                       if (self.punchangle_y < 0)
-                               self.punchangle_y = 0;
+                       this.punchangle_y = this.punchangle_y - 60 * frametime;
+                       if (this.punchangle_y < 0)
+                               this.punchangle_y = 0;
                }
-               else if (self.punchangle_y < 0)
+               else if (this.punchangle_y < 0)
                {
-                       self.punchangle_y = self.punchangle_y + 60 * frametime;
-                       if (self.punchangle_y > 0)
-                               self.punchangle_y = 0;
+                       this.punchangle_y = this.punchangle_y + 60 * frametime;
+                       if (this.punchangle_y > 0)
+                               this.punchangle_y = 0;
                }
 
-               if (self.punchangle_z > 0)
+               if (this.punchangle_z > 0)
                {
-                       self.punchangle_z = self.punchangle_z - 60 * frametime;
-                       if (self.punchangle_z < 0)
-                               self.punchangle_z = 0;
+                       this.punchangle_z = this.punchangle_z - 60 * frametime;
+                       if (this.punchangle_z < 0)
+                               this.punchangle_z = 0;
                }
-               else if (self.punchangle_z < 0)
+               else if (this.punchangle_z < 0)
                {
-                       self.punchangle_z = self.punchangle_z + 60 * frametime;
-                       if (self.punchangle_z > 0)
-                               self.punchangle_z = 0;
+                       this.punchangle_z = this.punchangle_z + 60 * frametime;
+                       if (this.punchangle_z > 0)
+                               this.punchangle_z = 0;
                }
 
-               self.angles_x = self.punchangle_x;
-               self.angles_y = self.punchangle_y + self.move_angles_y;
-               self.angles_z = self.punchangle_z;
-               self.move_angles_y = self.move_angles_y + 45 * frametime;
+               this.angles_x = this.punchangle_x;
+               this.angles_y = this.punchangle_y + this.move_angles_y;
+               this.angles_z = this.punchangle_z;
+               this.move_angles_y = this.move_angles_y + 45 * frametime;
        }
 
-       setorigin(self, self.cp_origin + self.cp_bob_origin + self.cp_bob_dmg);
+       setorigin(this, this.cp_origin + this.cp_bob_origin + this.cp_bob_dmg);
 }
 
-void cpicon_damage(float hp)
-{SELFPARAM();
-       if(!self.iscaptured) { return; }
+void cpicon_damage(entity this, float hp)
+{
+       if(!this.iscaptured) { return; }
 
-       if(hp < self.max_health * 0.25)
-               setmodel(self, MDL_ONS_CP3);
-       else if(hp < self.max_health * 0.50)
-               setmodel(self, MDL_ONS_CP2);
-       else if(hp < self.max_health * 0.75)
-               setmodel(self, MDL_ONS_CP1);
-       else if(hp <= self.max_health || hp >= self.max_health)
-               setmodel(self, MDL_ONS_CP);
+       if(hp < this.max_health * 0.25)
+               setmodel(this, MDL_ONS_CP3);
+       else if(hp < this.max_health * 0.50)
+               setmodel(this, MDL_ONS_CP2);
+       else if(hp < this.max_health * 0.75)
+               setmodel(this, MDL_ONS_CP1);
+       else if(hp <= this.max_health || hp >= this.max_health)
+               setmodel(this, MDL_ONS_CP);
 
-       self.punchangle = (2 * randomvec() - '1 1 1') * 45;
+       this.punchangle = (2 * randomvec() - '1 1 1') * 45;
 
-       self.cp_bob_dmg_z = (2 * random() - 1) * 15;
-       self.pain_finished = time + 1;
-       self.colormod = '2 2 2';
+       this.cp_bob_dmg_z = (2 * random() - 1) * 15;
+       this.pain_finished = time + 1;
+       this.colormod = '2 2 2';
 
-       setsize(self, CPICON_MIN, CPICON_MAX);
+       setsize(this, CPICON_MIN, CPICON_MAX);
 }
 
-void cpicon_construct()
-{SELFPARAM();
-       self.netname = "Control Point Icon";
+void cpicon_construct(entity this)
+{
+       this.netname = "Control Point Icon";
 
-       setmodel(self, MDL_ONS_CP);
-       setsize(self, CPICON_MIN, CPICON_MAX);
+       setmodel(this, MDL_ONS_CP);
+       setsize(this, CPICON_MIN, CPICON_MAX);
 
-       if(self.icon_realmodel == world)
+       if(this.icon_realmodel == world)
        {
-               self.icon_realmodel = spawn();
-               setmodel(self.icon_realmodel, MDL_Null);
-               setorigin(self.icon_realmodel, self.origin);
-               setsize(self.icon_realmodel, CPICON_MIN, CPICON_MAX);
-               self.icon_realmodel.movetype = MOVETYPE_NOCLIP;
-               self.icon_realmodel.solid = SOLID_NOT;
-               self.icon_realmodel.move_origin = self.icon_realmodel.origin;
+               this.icon_realmodel = spawn();
+               setmodel(this.icon_realmodel, MDL_Null);
+               setorigin(this.icon_realmodel, this.origin);
+               setsize(this.icon_realmodel, CPICON_MIN, CPICON_MAX);
+               this.icon_realmodel.movetype = MOVETYPE_NOCLIP;
+               this.icon_realmodel.solid = SOLID_NOT;
+               this.icon_realmodel.move_origin = this.icon_realmodel.origin;
        }
 
-       if(self.iscaptured) { self.icon_realmodel.solid = SOLID_BBOX; }
-
-       self.move_movetype      = MOVETYPE_NOCLIP;
-       self.solid                      = SOLID_NOT;
-       self.movetype           = MOVETYPE_NOCLIP;
-       self.move_origin        = self.origin;
-       self.move_time          = time;
-       self.drawmask           = MASK_NORMAL;
-       self.alpha                      = 1;
-       self.draw                       = cpicon_draw;
-       self.cp_origin          = self.origin;
-       self.cp_bob_origin      = '0 0 0.1';
-       self.cp_bob_spd         = 0;
+       if(this.iscaptured) { this.icon_realmodel.solid = SOLID_BBOX; }
+
+       this.move_movetype      = MOVETYPE_NOCLIP;
+       this.solid                      = SOLID_NOT;
+       this.movetype           = MOVETYPE_NOCLIP;
+       this.move_origin        = this.origin;
+       this.move_time          = time;
+       this.drawmask           = MASK_NORMAL;
+       this.alpha                      = 1;
+       this.draw                       = cpicon_draw;
+       this.cp_origin          = this.origin;
+       this.cp_bob_origin      = '0 0 0.1';
+       this.cp_bob_spd         = 0;
 }
 
 .vector glowmod;
-void cpicon_changeteam()
-{SELFPARAM();
-       if(self.team)
+void cpicon_changeteam(entity this)
+{
+       if(this.team)
        {
-               self.glowmod = Team_ColorRGB(self.team - 1);
-               self.teamradar_color = Team_ColorRGB(self.team - 1);
-               self.colormap = 1024 + (self.team - 1) * 17;
+               this.glowmod = Team_ColorRGB(this.team - 1);
+               this.teamradar_color = Team_ColorRGB(this.team - 1);
+               this.colormap = 1024 + (this.team - 1) * 17;
        }
        else
        {
-               self.colormap = 1024;
-               self.glowmod = '1 1 0';
-               self.teamradar_color = '1 1 0';
+               this.colormap = 1024;
+               this.glowmod = '1 1 0';
+               this.teamradar_color = '1 1 0';
        }
 }
 
-void ent_cpicon()
-{SELFPARAM();
+void ent_cpicon(entity this)
+{
        int sf = ReadByte();
 
        if(sf & CPSF_SETUP)
        {
-               self.origin_x = ReadCoord();
-               self.origin_y = ReadCoord();
-               self.origin_z = ReadCoord();
-               setorigin(self, self.origin);
-
-               self.health = ReadByte();
-               self.max_health = ReadByte();
-               self.count = ReadByte();
-               self.team = ReadByte();
-               self.iscaptured = ReadByte();
-
-               if(!self.count)
-                       self.count = (self.health - self.max_health) * frametime;
-
-               cpicon_changeteam();
-               cpicon_construct();
+               this.origin_x = ReadCoord();
+               this.origin_y = ReadCoord();
+               this.origin_z = ReadCoord();
+               setorigin(this, this.origin);
+
+               this.health = ReadByte();
+               this.max_health = ReadByte();
+               this.count = ReadByte();
+               this.team = ReadByte();
+               this.iscaptured = ReadByte();
+
+               if(!this.count)
+                       this.count = (this.health - this.max_health) * frametime;
+
+               cpicon_changeteam(this);
+               cpicon_construct(this);
        }
 
        if(sf & CPSF_STATUS)
        {
                int _tmp = ReadByte();
-               if(_tmp != self.team)
+               if(_tmp != this.team)
                {
-                       self.team = _tmp;
-                       cpicon_changeteam();
+                       this.team = _tmp;
+                       cpicon_changeteam(this);
                }
 
                _tmp = ReadByte();
 
-               if(_tmp != self.health)
-                       cpicon_damage(_tmp);
+               if(_tmp != this.health)
+                       cpicon_damage(this, _tmp);
 
-               self.health = _tmp;
+               this.health = _tmp;
        }
 }
index a2ce395..3148551 100644 (file)
@@ -7,6 +7,6 @@ const vector CPICON_MAX = '32 32 25';
 const int CPSF_STATUS = 4;
 const int CPSF_SETUP = 8;
 
-void ent_cpicon();
+void ent_cpicon(entity this);
 
 #endif
index 488289f..d795e63 100644 (file)
@@ -515,7 +515,7 @@ void CSQCModel_Effects_PostUpdate(void)
        self.effects = 0;
        self.modelflags = 0;
        if(self.csqcmodel_teleported)
-               Projectile_ResetTrail(self.origin);
+               Projectile_ResetTrail(self, self.origin);
 }
 .int snd_looping;
 void CSQCModel_Effects_Apply(void)
@@ -584,9 +584,9 @@ void CSQCModel_Effects_Apply(void)
        self.traileffect = tref;
 
        if(self.drawmask)
-               Projectile_DrawTrail(self.origin);
+               Projectile_DrawTrail(self, self.origin);
        else
-               Projectile_ResetTrail(self.origin);
+               Projectile_ResetTrail(self, self.origin);
 
        if(self.csqcmodel_effects & CSQCMODEL_EF_RESPAWNGHOST)
                self.renderflags |= RF_ADDITIVE;
index 148a8f5..eed6827 100644 (file)
@@ -3,8 +3,8 @@
 .int count;
 .float max_health;
 
-void ons_generator_ray_draw()
-{SELFPARAM();
+void ons_generator_ray_draw(entity this)
+{
        if(time < self.move_time)
                return;
 
@@ -42,8 +42,8 @@ void ons_generator_ray_spawn(vector org)
        e.draw = ons_generator_ray_draw;
 }
 
-void generator_draw()
-{SELFPARAM();
+void generator_draw(entity this)
+{
        if(time < self.move_time)
                return;
 
index 5c4c338..360f7b5 100644 (file)
@@ -91,8 +91,8 @@ void Gib_Touch()
        Gib_Delete();
 }
 
-void Gib_Draw()
-{SELFPARAM();
+void Gib_Draw(entity this)
+{
        vector oldorg;
        oldorg = self.origin;
 
index 5b8b16b..f4b6094 100644 (file)
@@ -17,7 +17,7 @@ void SUB_RemoveOnNoImpact();
 
 void Gib_Touch();
 
-void Gib_Draw();
+void Gib_Draw(entity this);
 
 void TossGib (string mdlname, vector safeorg, vector org, vector vconst, vector vrand, int specnum, bool destroyontouch, bool issilent);
 
index dd70c76..07123f0 100644 (file)
@@ -31,8 +31,8 @@ void Draw_GrapplingHook_trace_callback(vector start, vector hit, vector end)
 }
 
 class(Hook) .float teleport_time;
-void Draw_GrapplingHook()
-{SELFPARAM();
+void Draw_GrapplingHook(entity this)
+{
        vector a, b, atrans;
        string tex;
        vector rgb;
index d023ea9..93c4103 100644 (file)
@@ -21,7 +21,7 @@ class(Laser) .float alpha;
 class(Laser) .float scale; // scaling factor of the thickness
 class(Laser) .float modelscale; // scaling factor of the dlight
 
-void Draw_Laser()
+void Draw_Laser(entity this)
 {
        if(!self.state)
                return;
index d494050..bc3fb43 100644 (file)
@@ -81,6 +81,8 @@ void menu_sub_null()
 {
 }
 
+void draw_null(entity this) { }
+
 string forcefog;
 void ConsoleCommand_macro_init();
 void CSQC_Init(void)
@@ -686,9 +688,9 @@ void Ent_ReadAccuracy(void)
        }
 }
 
-void Spawn_Draw(void)
-{SELFPARAM();
-       pointparticles(self.cnt, self.origin + '0 0 28', '0 0 2', bound(0, frametime, 0.1));
+void Spawn_Draw(entity this)
+{
+       pointparticles(this.cnt, this.origin + '0 0 28', '0 0 2', bound(0, frametime, 0.1));
 }
 
 void Ent_ReadSpawnPoint(float is_new) // entity for spawnpoint
@@ -880,7 +882,7 @@ void CSQC_Ent_Update(float bIsNewEntity)
                case ENT_CLIENT_AUXILIARYXHAIR: Net_AuXair2(bIsNewEntity); break;
                case ENT_CLIENT_TURRET: ent_turret(); break;
                case ENT_CLIENT_GENERATOR: ent_generator(); break;
-               case ENT_CLIENT_CONTROLPOINT_ICON: ent_cpicon(); break;
+               case ENT_CLIENT_CONTROLPOINT_ICON: ent_cpicon(this); break;
                case ENT_CLIENT_MODEL: CSQCModel_Read(bIsNewEntity); break;
                case ENT_CLIENT_ITEM: ItemRead(bIsNewEntity); break;
                case ENT_CLIENT_BUMBLE_RAYGUN: bumble_raygun_read(bIsNewEntity); break;
@@ -933,7 +935,7 @@ void Ent_Remove()
 
        self.enttype = 0;
        self.classname = "";
-       self.draw = menu_sub_null;
+       self.draw = draw_null;
        self.entremove = menu_sub_null;
        // TODO possibly set more stuff to defaults
 }
index c8de3af..d403984 100644 (file)
@@ -91,8 +91,8 @@ entity teamslots[17];    // 17 teams (including "spectator team")
 .float ready;
 .float eliminated;
 
-.void(void) draw;
-.void(void) draw2d;
+.void(entity) draw;
+.void(entity) draw2d;
 .void(void) entremove;
 float drawframetime;
 vector view_origin, view_forward, view_right, view_up;
index fa7044f..a10062a 100644 (file)
@@ -5,8 +5,8 @@
 .float scale;
 .float alpha;
 
-void ModelEffect_Draw()
-{SELFPARAM();
+void ModelEffect_Draw(entity this)
+{
        self.angles = self.angles + frametime * self.avelocity;
        setorigin(self, self.origin + frametime * self.velocity);
        self.scale = self.scale1 + (self.scale2 - self.scale1) * (time - self.teleport_time) / (self.lifetime + self.fadetime - self.teleport_time);
index 22998f0..d4b98e0 100644 (file)
@@ -7,7 +7,7 @@ class(ModelEffect) .float lifetime, fadetime;
 class(ModelEffect) .float teleport_time;
 class(ModelEffect) .float scale1, scale2;
 
-void ModelEffect_Draw();
+void ModelEffect_Draw(entity this);
 
 void Ent_ModelEffect(bool isNew);
 #endif
index 791313f..06cd725 100644 (file)
@@ -14,7 +14,7 @@ class(PointParticles) .float volume;
 class(PointParticles) .float absolute; // 1 = count per second is absolute, 2 = only spawn at toggle
 class(PointParticles) .vector movedir; // trace direction
 
-void Draw_PointParticles();
+void Draw_PointParticles(entity this);
 
 void Ent_PointParticles_Remove();
 
index 9c20747..381ead7 100644 (file)
@@ -27,7 +27,7 @@
 
 entity porto;
 vector polyline[16];
-void Porto_Draw()
+void Porto_Draw(entity this)
 {
        vector p, dir, ang, q, nextdir;
        float portal_number, portal1_idx;
@@ -1468,7 +1468,7 @@ void CSQC_UpdateView(float w, float h)
         */
 
        for(entity e = NULL; (e = nextent(e)); ) if (e.draw) {
-               WITH(entity, self, e, e.draw());
+               WITH(entity, self, e, e.draw(e));
        }
 
        addentities(MASK_NORMAL | MASK_ENGINE | MASK_ENGINEVIEWMODELS);
@@ -1806,7 +1806,7 @@ void CSQC_UpdateView(float w, float h)
 
        // draw 2D entities
        for (entity e = NULL; (e = nextent(e)); ) if (e.draw2d) {
-               WITH(entity, self, e, e.draw2d());
+               WITH(entity, self, e, e.draw2d(e));
        }
        Draw_ShowNames_All();
 
index 7d79f77..f17b54a 100644 (file)
@@ -51,8 +51,8 @@ void Ent_Wall_PreDraw()
                self.drawmask = MASK_NORMAL;
 }
 
-void Ent_Wall_Draw()
-{SELFPARAM();
+void Ent_Wall_Draw(entity this)
+{
        float f;
        var .vector fld;
 
index 04c0dce..f44355f 100644 (file)
@@ -16,7 +16,7 @@ class(Wall) .vector saved;
 .float fade_start, fade_end, fade_vertical_offset;
 .float default_solid;
 
-void Ent_Wall_Draw();
+void Ent_Wall_Draw(entity this);
 
 void Ent_Wall_Remove();
 
index 9d23e3c..2244304 100644 (file)
@@ -23,36 +23,33 @@ void SUB_Stop()
        self.move_movetype = MOVETYPE_NONE;
 }
 
-void Projectile_ResetTrail(vector to)
-{SELFPARAM();
-       self.trail_oldorigin = to;
-       self.trail_oldtime = time;
+void Projectile_ResetTrail(entity this, vector to)
+{
+       this.trail_oldorigin = to;
+       this.trail_oldtime = time;
 }
 
-void Projectile_DrawTrail(vector to)
-{SELFPARAM();
-       vector from;
-       float t0;
-
-       from = self.trail_oldorigin;
-       t0 = self.trail_oldtime;
-       self.trail_oldorigin = to;
-       self.trail_oldtime = time;
+void Projectile_DrawTrail(entity this, vector to)
+{
+       vector from = this.trail_oldorigin;
+       // float t0 = this.trail_oldtime;
+       this.trail_oldorigin = to;
+       this.trail_oldtime = time;
 
        // force the effect even for stationary firemine
-       if(self.cnt == PROJECTILE_FIREMINE)
+       if(this.cnt == PROJECTILE_FIREMINE)
                if(from == to)
                        from.z += 1;
 
-       if (self.traileffect)
+       if (this.traileffect)
        {
-               particles_alphamin = particles_alphamax = particles_fade = sqrt(self.alpha);
-               boxparticles(particleeffectnum(Effects[self.traileffect]), self, from, to, self.velocity, self.velocity, 1, PARTICLES_USEALPHA | PARTICLES_USEFADE | PARTICLES_DRAWASTRAIL);
+               particles_alphamin = particles_alphamax = particles_fade = sqrt(this.alpha);
+               boxparticles(particleeffectnum(Effects[this.traileffect]), this, from, to, this.velocity, this.velocity, 1, PARTICLES_USEALPHA | PARTICLES_USEFADE | PARTICLES_DRAWASTRAIL);
        }
 }
 
-void Projectile_Draw()
-{SELFPARAM();
+void Projectile_Draw(entity this)
+{
        vector rot;
        vector trailorigin;
        int f;
@@ -146,9 +143,9 @@ void Projectile_Draw()
                trailorigin += v_up * 4;
 
        if(drawn)
-               Projectile_DrawTrail(trailorigin);
+               Projectile_DrawTrail(self, trailorigin);
        else
-               Projectile_ResetTrail(trailorigin);
+               Projectile_ResetTrail(self, trailorigin);
 
        self.drawmask = 0;
 
@@ -179,7 +176,7 @@ void Ent_RemoveProjectile()
        if(self.count & 0x80)
        {
                tracebox(self.origin, self.mins, self.maxs, self.origin + self.velocity * 0.05, MOVE_NORMAL, self);
-               Projectile_DrawTrail(trace_endpos);
+               Projectile_DrawTrail(self, trace_endpos);
        }
 }
 
index 67e08c2..dd28981 100644 (file)
@@ -19,11 +19,11 @@ class(Projectile) .bool silent;
 
 void SUB_Stop();
 
-void Projectile_ResetTrail(vector to);
+void Projectile_ResetTrail(entity this, vector to);
 
-void Projectile_DrawTrail(vector to);
+void Projectile_DrawTrail(entity this, vector to);
 
-void Projectile_Draw();
+void Projectile_Draw(entity this);
 
 void loopsound(entity e, int ch, string samp, float vol, float attn);
 
index d60854e..9ed5fef 100644 (file)
@@ -40,8 +40,8 @@ void Casing_Delete()
     remove(self);
 }
 
-void Casing_Draw()
-{SELFPARAM();
+void Casing_Draw(entity this)
+{
     if (self.move_flags & FL_ONGROUND)
     {
         self.move_angles_x = 0;
index 8d21f17..e4e4be5 100644 (file)
@@ -24,8 +24,7 @@ CLASS(DamageText, Object)
     ATTRIB(DamageText, m_armordamage, int, 0)
     ATTRIB(DamageText, time_prev, float, time)
 
-    void DamageText_draw() {
-        SELFPARAM();
+    void DamageText_draw2d(DamageText this) {
         float dt = time - this.time_prev;
         this.time_prev = time;
         setorigin(this, this.origin + dt * this.velocity);
@@ -38,7 +37,7 @@ CLASS(DamageText, Object)
             drawcolorcodedstring2(pos, s, this.m_size * '1 1 0', this.m_color, this.alpha, DRAWFLAG_NORMAL);
         }
     }
-    ATTRIB(DamageText, draw2d, void(), DamageText_draw)
+    ATTRIB(DamageText, draw2d, void(DamageText), DamageText_draw2d)
 
     void DamageText_update(DamageText this, vector _origin, int _health, int _armor) {
         this.m_damage = _health;
index 89f9a0f..9adf1a9 100644 (file)
@@ -455,8 +455,8 @@ vector fixrgbexcess(vector rgb)
     return rgb;
 }
 
-void Draw_WaypointSprite()
-{SELFPARAM();
+void Draw_WaypointSprite(entity this)
+{
     if (self.lifetime)
         self.alpha = pow(bound(0, (self.fadetime - time) / self.lifetime, 1), waypointsprite_timealphaexponent);
     else
index e4ed397..2be4ff8 100644 (file)
@@ -114,7 +114,7 @@ void WaypointSprite_Load_Frames(string ext);
 
 void WaypointSprite_Load();
 .float alpha;
-void Draw_WaypointSprite();
+void Draw_WaypointSprite(entity this);
 #endif
 
 #ifdef SVQC
index 3a4f632..90d7ca3 100644 (file)
@@ -17,8 +17,8 @@
 
 #ifdef CSQC
 .float ltime;
-void healer_draw()
-{SELFPARAM();
+void healer_draw(entity this)
+{
        float dt = time - self.move_time;
        self.move_time = time;
        if(dt <= 0)
index 587dec8..b8c1310 100644 (file)
@@ -146,9 +146,11 @@ spawnfunc(func_conveyor)
 
 #elif defined(CSQC)
 
+void conveyor_draw(entity this) { WITH(entity, self, this, conveyor_think()); }
+
 void conveyor_init()
 {SELFPARAM();
-       self.draw = conveyor_think;
+       self.draw = conveyor_draw;
        self.drawmask = MASK_NORMAL;
 
        self.movetype = MOVETYPE_NONE;
index fed8e9f..c55754b 100644 (file)
@@ -795,11 +795,11 @@ spawnfunc(func_door)
 
 #elif defined(CSQC)
 
-void door_draw()
+void door_draw(entity this)
 {
        Movetype_Physics_NoMatchServer();
 
-       trigger_draw_generic();
+       trigger_draw_generic(this);
 }
 
 void ent_door()
index de4c53c..fc62341 100644 (file)
@@ -127,7 +127,7 @@ spawnfunc(func_plat)
        InitializeEntity(self, plat_delayedinit, INITPRIO_FINDTARGET);
 }
 #elif defined(CSQC)
-void plat_draw()
+void plat_draw(entity this)
 {
        Movetype_Physics_NoMatchServer();
        //Movetype_Physics_MatchServer(autocvar_cl_projectiles_sloppy);
index c9e8ba9..a4f31b2 100644 (file)
@@ -183,8 +183,8 @@ spawnfunc(func_sparks)
 }
 #elif defined(CSQC)
 
-void Draw_PointParticles()
-{SELFPARAM();
+void Draw_PointParticles(entity this)
+{
        float n, i, fail;
        vector p;
        vector sz;
index 05f555a..18c2c0a 100644 (file)
@@ -90,13 +90,13 @@ spawnfunc(func_snow)
        Net_LinkEntity(self, false, 0, rainsnow_SendEntity);
 }
 #elif defined(CSQC)
-void Draw_Rain()
-{SELFPARAM();
+void Draw_Rain(entity this)
+{
     te_particlerain(self.origin + self.mins, self.origin + self.maxs, self.velocity, floor(self.count * drawframetime + random()), self.glow_color);
 }
 
-void Draw_Snow()
-{SELFPARAM();
+void Draw_Snow(entity this)
+{
     te_particlesnow(self.origin + self.mins, self.origin + self.maxs, self.velocity, floor(self.count * drawframetime + random()), self.glow_color);
 }
 
index 4284d24..a75ac41 100644 (file)
@@ -225,7 +225,7 @@ spawnfunc(func_train)
        // TODO make a reset function for this one
 }
 #elif defined(CSQC)
-void train_draw()
+void train_draw(entity this)
 {
        //Movetype_Physics_NoMatchServer();
        Movetype_Physics_MatchServer(autocvar_cl_projectiles_sloppy);
index f0babbc..3b9996d 100644 (file)
@@ -272,8 +272,8 @@ class(Laser) .float alpha;
 class(Laser) .float scale; // scaling factor of the thickness
 class(Laser) .float modelscale; // scaling factor of the dlight
 
-void Draw_Laser()
-{SELFPARAM();
+void Draw_Laser(entity this)
+{
        if(!self.state)
                return;
        InterpolateOrigin_Do();
index 73c5c49..b97d2b1 100644 (file)
@@ -265,8 +265,8 @@ void trigger_touch_generic(void() touchfunc)
                }
        }
 }
-void trigger_draw_generic()
-{SELFPARAM();
+void trigger_draw_generic(entity this)
+{
        float dt = time - self.move_time;
        self.move_time = time;
        if(dt <= 0) { return; }
index 03cb16b..e62a4cc 100644 (file)
@@ -24,8 +24,8 @@ void turret_head_draw()
        self.drawmask = MASK_NORMAL;
 }
 
-void turret_draw()
-{SELFPARAM();
+void turret_draw(entity this)
+{
        float dt;
 
        dt = time - self.move_time;
@@ -53,8 +53,8 @@ void turret_draw()
 
 }
 
-void turret_draw2d()
-{SELFPARAM();
+void turret_draw2d(entity this)
+{
        if(self.netname == "")
                return;
 
@@ -246,8 +246,8 @@ void turret_construct()
 
 entity turret_gibtoss(string _model, vector _from, vector _to, vector _cmod, float _explode);
 void turret_gibboom();
-void turret_gib_draw()
-{SELFPARAM();
+void turret_gib_draw(entity this)
+{
        Movetype_Physics_MatchTicrate(autocvar_cl_gibs_ticrate, autocvar_cl_gibs_sloppy);
 
        self.drawmask = MASK_NORMAL;
index cdb9a60..3875f1b 100644 (file)
@@ -237,8 +237,8 @@ spawnfunc(turret_ewheel) { if(!turret_initialize(TUR_EWHEEL)) remove(self); }
 #endif // SVQC
 #ifdef CSQC
 
-void ewheel_draw()
-{SELFPARAM();
+void ewheel_draw(entity this)
+{
     float dt;
 
     dt = time - self.move_time;
index 1feace4..e629ada 100644 (file)
@@ -633,8 +633,8 @@ spawnfunc(turret_walker) { if(!turret_initialize(TUR_WALKER)) remove(self); }
 
 #include "../../../client/movelib.qh"
 
-void walker_draw()
-{SELFPARAM();
+void walker_draw(entity this)
+{
     float dt;
 
     dt = time - self.move_time;
index 338b015..3472a7f 100644 (file)
@@ -26,8 +26,8 @@ void vehicle_alarm(entity e, int ch, string s0und)
        _sound(e, ch, s0und, VOL_BASEVOICE, ATTEN_NONE);
 }
 
-void AuxiliaryXhair_Draw2D()
-{SELFPARAM();
+void AuxiliaryXhair_Draw2D(entity this)
+{
        if (scoreboard_showscores)
                return;
 
index a495f03..bf96d95 100644 (file)
@@ -5,7 +5,7 @@ void Net_AuXair2(float bIsNew);
 
 void Net_VehicleSetup();
 
-void RaptorCBShellfragDraw();
+void RaptorCBShellfragDraw(entity this);
 void RaptorCBShellfragToss(vector _org, vector _vel, vector _ang);
 
 #define weapon2mode getstati(STAT_VEHICLESTAT_W2MODE)
index 0966ddf..79252e1 100644 (file)
@@ -61,7 +61,7 @@ bool bumble_raygun_send(entity this, entity to, float sf)
 
 #ifdef CSQC
 
-void bumble_raygun_draw();
+void bumble_raygun_draw(entity this);
 
 void bumble_raygun_read(bool bIsNew)
 {SELFPARAM();
@@ -101,8 +101,8 @@ void bumble_raygun_read(bool bIsNew)
     }
 }
 
-void bumble_raygun_draw()
-{SELFPARAM();
+void bumble_raygun_draw(entity this)
+{
     float _len;
     vector _dir;
     vector _vtmp1, _vtmp2;
index ebc7378..9c2fd0e 100644 (file)
@@ -263,8 +263,8 @@ void raptor_flare_think()
 
 #ifdef CSQC
 
-void RaptorCBShellfragDraw()
-{SELFPARAM();
+void RaptorCBShellfragDraw(entity this)
+{
     if(wasfreed(self))
         return;
 
index d9ad712..99eb17d 100644 (file)
@@ -850,8 +850,8 @@ void Reset_ArcBeam(void)
        }
 }
 
-void Draw_ArcBeam(void)
-{SELFPARAM();
+void Draw_ArcBeam(entity this)
+{
        float dt = time - self.move_time;
        self.move_time = time;
        if(dt <= 0) { return; }
index 30ffaca..4965ba6 100644 (file)
@@ -735,8 +735,8 @@ void W_Shockwave_Attack(void)
 const float SW_MAXALPHA = 0.5;
 const float SW_FADETIME = 0.4;
 const float SW_DISTTOMIN = 200;
-void Draw_Shockwave()
-{SELFPARAM();
+void Draw_Shockwave(entity this)
+{
        // fading/removal control
        float a = bound(0, (SW_MAXALPHA - ((time - self.sw_time) / SW_FADETIME)), SW_MAXALPHA);
        if(a < ALPHA_MIN_VISIBLE) { remove(self); }
index 603522d..e93ee2d 100644 (file)
@@ -28,8 +28,8 @@
 #endif
 
 #ifdef CSQC
-void ItemDraw()
-{SELFPARAM();
+void ItemDraw(entity self)
+{
     if(self.gravity)
     {
         Movetype_Physics_MatchServer(autocvar_cl_projectiles_sloppy);
@@ -64,8 +64,8 @@ void ItemDraw()
     }
 }
 
-void ItemDrawSimple()
-{SELFPARAM();
+void ItemDrawSimple(entity this)
+{
     if(self.gravity)
     {
         Movetype_Physics_MatchServer(autocvar_cl_projectiles_sloppy);
index 991e2d6..dd79b17 100644 (file)
@@ -78,9 +78,9 @@ string autocvar_cl_simpleitems_postfix = "_simple";
 .float  spawntime;
 .float  gravity;
 .vector colormod;
-void ItemDraw();
 
-void ItemDrawSimple();
+void ItemDraw(entity this);
+void ItemDrawSimple(entity this);
 
 void ItemRead(float _IsNew);