]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Clean out some more self uses from vehicle code
authorMario <mario@smbclan.net>
Sat, 26 Mar 2016 12:19:34 +0000 (22:19 +1000)
committerMario <mario@smbclan.net>
Sat, 26 Mar 2016 12:19:34 +0000 (22:19 +1000)
14 files changed:
qcsrc/common/mutators/mutator/overkill/hmg.qc
qcsrc/common/turrets/turret/machinegun_weapon.qc
qcsrc/common/turrets/turret/walker_weapon.qc
qcsrc/common/vehicles/vehicle/bumblebee.qc
qcsrc/common/vehicles/vehicle/racer.qc
qcsrc/common/vehicles/vehicle/raptor.qc
qcsrc/common/vehicles/vehicle/spiderbot.qc
qcsrc/common/vehicles/vehicle/spiderbot_weapons.qc
qcsrc/common/vehicles/vehicle/spiderbot_weapons.qh
qcsrc/common/weapons/weapon/machinegun.qc
qcsrc/common/weapons/weapon/rifle.qc
qcsrc/common/weapons/weapon/shotgun.qc
qcsrc/server/weapons/tracing.qc
qcsrc/server/weapons/tracing.qh

index 1af6e82df83e3b2d4e2aceac616e388231372611..ec8061c3d2f764a5ff2bf0b6c7a3ea90e7ea7193 100644 (file)
@@ -83,7 +83,7 @@ void W_HeavyMachineGun_Attack_Auto(Weapon thiswep, entity actor, .entity weapone
        }
 
        float hmg_spread = bound(WEP_CVAR(hmg, spread_min), WEP_CVAR(hmg, spread_min) + (WEP_CVAR(hmg, spread_add) * actor.misc_bulletcounter), WEP_CVAR(hmg, spread_max));
-       fireBullet(w_shotorg, w_shotdir, hmg_spread, WEP_CVAR(hmg, solidpenetration), WEP_CVAR(hmg, damage), WEP_CVAR(hmg, force), WEP_HMG.m_id, 0);
+       fireBullet(actor, w_shotorg, w_shotdir, hmg_spread, WEP_CVAR(hmg, solidpenetration), WEP_CVAR(hmg, damage), WEP_CVAR(hmg, force), WEP_HMG.m_id, 0);
 
        actor.misc_bulletcounter = actor.misc_bulletcounter + 1;
 
index d5814489fb6936a14d1c4b5a6ab90ff1a9504e8a..853750f6caf7fd839b3a7d4e50d4d38ec0b23440 100644 (file)
@@ -19,7 +19,7 @@ METHOD(MachineGunTurretAttack, wr_think, void(entity thiswep, entity actor, .ent
             actor.tur_head = actor;
             weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, 0, w_ready);
         }
-        fireBullet (actor.tur_shotorg, actor.tur_shotdir_updated, actor.shot_spread, 0, actor.shot_dmg, actor.shot_force, DEATH_TURRET_MACHINEGUN.m_id, 0);
+        fireBullet (actor, actor.tur_shotorg, actor.tur_shotdir_updated, actor.shot_spread, 0, actor.shot_dmg, actor.shot_force, DEATH_TURRET_MACHINEGUN.m_id, 0);
         W_MachineGun_MuzzleFlash();
         setattachment(actor.muzzle_flash, actor.tur_head, "tag_fire");
     }
index 170b2dd30e9f9cde593d3c3a88752f6a2c2c7aaf..91e4345a95b3f6c6c0e58f79dfe8d7b5198c5867 100644 (file)
@@ -18,7 +18,7 @@ METHOD(WalkerTurretAttack, wr_think, void(entity thiswep, entity actor, .entity
             weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(electro, animtime), w_ready);
         }
         sound (actor, CH_WEAPON_A, SND_UZI_FIRE, VOL_BASE, ATTEN_NORM);
-        fireBullet (actor.tur_shotorg, actor.tur_shotdir_updated, actor.shot_spread, 0, actor.shot_dmg, actor.shot_force, DEATH_TURRET_WALK_GUN.m_id, 0);
+        fireBullet (actor, actor.tur_shotorg, actor.tur_shotdir_updated, actor.shot_spread, 0, actor.shot_dmg, actor.shot_force, DEATH_TURRET_WALK_GUN.m_id, 0);
         Send_Effect(EFFECT_BLASTER_MUZZLEFLASH, actor.tur_shotorg, actor.tur_shotdir_updated * 1000, 1);
     }
 }
index 138f60f82f1e45473ae9560ef36d588425b07865..fd6b19bf30aed777f43aa1844d485e50e8a3e0cf 100644 (file)
@@ -100,8 +100,6 @@ bool bumblebee_gunner_frame(entity this)
        entity gun = this.vehicle;
        return = true;
 
-       setself(vehic);
-
        // this isn't technically a vehicle (yet), let's not do frame functions on it (yet)
        //vehicles_frame(gun, player);
 
@@ -203,8 +201,6 @@ bool bumblebee_gunner_frame(entity this)
        vehic.solid = SOLID_BBOX;
        PHYS_INPUT_BUTTON_ATCK(this) = PHYS_INPUT_BUTTON_ATCK2(this) = PHYS_INPUT_BUTTON_CROUCH(this) = false;
        this.vehicle_energy = (gun.vehicle_energy / autocvar_g_vehicle_bumblebee_cannon_ammo) * 100;
-
-       setself(this);
 }
 
 vector bumblebee_gunner_findgoodexit(vector prefer_spot, entity gunner, entity player)
@@ -433,8 +429,6 @@ bool bumblebee_pilot_frame(entity this)
                return;
        }
 
-       setself(vehic);
-
        bumblebee_regen(vehic);
 
        crosshair_trace(this);
@@ -626,8 +620,6 @@ bool bumblebee_pilot_frame(entity this)
        setorigin(this, vehic.origin + v_up * 48 + v_forward * 160);
 
        PHYS_INPUT_BUTTON_ATCK(this) = PHYS_INPUT_BUTTON_ATCK2(this) = PHYS_INPUT_BUTTON_CROUCH(this) = false;
-
-       setself(this);
 }
 
 void bumblebee_land()
index e57acf95fa44a8937b45af35ae6301bb53fe058b..f3670a839e59b4b6ec5c1e756df3608f204fe483 100644 (file)
@@ -191,8 +191,6 @@ bool racer_frame(entity this)
                return;
        }
 
-       setself(vehic);
-
        racer_align4point(vehic, PHYS_INPUT_TIMELENGTH);
 
        PHYS_INPUT_BUTTON_ZOOM(this) = PHYS_INPUT_BUTTON_CROUCH(this) = false;
@@ -311,6 +309,8 @@ bool racer_frame(entity this)
        this.movement = vehic.velocity += df * PHYS_INPUT_TIMELENGTH;
 
 #ifdef SVQC
+       setself(vehic);
+
        Weapon wep1 = WEP_RACER;
        if (!forbidWeaponUse(this))
        if (PHYS_INPUT_BUTTON_ATCK(this))
@@ -329,6 +329,8 @@ bool racer_frame(entity this)
                wep1.wr_think(wep1, vehic, weaponentity, 1);
        }
 
+       setself(this);
+
        if(autocvar_g_vehicle_racer_rocket_locktarget)
        {
                vehicles_locktarget(vehic, (1 / autocvar_g_vehicle_racer_rocket_locking_time) * frametime,
@@ -394,8 +396,6 @@ bool racer_frame(entity this)
 
        setorigin(this, vehic.origin + '0 0 32');
        this.velocity = vehic.velocity;
-
-       setself(this);
 }
 
 void racer_think()
index 6fee43d4e7b9f384083464223d17557aab1cd875..6bd599423a94c7e7f720136dfdcfcd0a3fd88423 100644 (file)
@@ -170,8 +170,6 @@ bool raptor_frame(entity this)
                return;
        }
 
-       setself(vehic);
-
        vehicles_frame(vehic, this);
 
        float ftmp = 0;
@@ -387,6 +385,9 @@ bool raptor_frame(entity this)
        UpdateAuxiliaryXhair(this, trace_endpos, '0 1 0', 0);
        */
 
+       // TODO: fix wr_checkammo and its use of self!
+       setself(vehic);
+
        Weapon wep1 = WEP_RAPTOR;
        if(!forbidWeaponUse(this))
        if(PHYS_INPUT_BUTTON_ATCK(this))
@@ -431,6 +432,8 @@ bool raptor_frame(entity this)
                }
        }
 
+       setself(this);
+
        vehic.bomb1.alpha = vehic.bomb2.alpha = (time - vehic.lip) / (vehic.delay - vehic.lip);
        this.vehicle_reload2 = bound(0, vehic.bomb1.alpha * 100, 100);
        this.vehicle_ammo2 = (this.vehicle_reload2 == 100) ? 100 : 0;
@@ -462,8 +465,6 @@ bool raptor_frame(entity this)
                VEHICLE_UPDATE_PLAYER(this, vehic, shield, raptor);
 
        PHYS_INPUT_BUTTON_ATCK(this) = PHYS_INPUT_BUTTON_ATCK2(this) = PHYS_INPUT_BUTTON_CROUCH(this) = false;
-
-       setself(this);
 }
 
 bool raptor_takeoff(entity this)
@@ -471,8 +472,6 @@ bool raptor_takeoff(entity this)
        entity vehic = this.vehicle;
        return = true;
 
-       setself(this);
-
        vehic.nextthink = time;
        CSQCMODEL_AUTOUPDATE(vehic);
        vehic.nextthink = 0; // will this work?
@@ -517,8 +516,6 @@ bool raptor_takeoff(entity this)
                VEHICLE_UPDATE_PLAYER(this, vehic, shield, raptor);
 
        PHYS_INPUT_BUTTON_ATCK(this) = PHYS_INPUT_BUTTON_ATCK2(this) = PHYS_INPUT_BUTTON_CROUCH(this) = false;
-
-       setself(vehic);
 }
 
 void raptor_blowup()
index 9d6602b5477b27ec3b2713bae03c9f85ddb18ac0..eba9fee8abbc352dbcf749d6e2af30905a2dba93 100644 (file)
@@ -80,8 +80,6 @@ bool spiderbot_frame(entity this)
                return;
        }
 
-       setself(vehic);
-
        vehicles_frame(vehic, this);
 
        PHYS_INPUT_BUTTON_ZOOM(this) = false;
@@ -286,8 +284,8 @@ bool spiderbot_frame(entity this)
                        v_forward = normalize(v_forward);
                        v += v_forward * 50;
 
-                       WITH(entity, self, this, fireBullet(v, v_forward, autocvar_g_vehicle_spiderbot_minigun_spread, autocvar_g_vehicle_spiderbot_minigun_solidpenetration,
-                               autocvar_g_vehicle_spiderbot_minigun_damage, autocvar_g_vehicle_spiderbot_minigun_force, DEATH_VH_SPID_MINIGUN.m_id, 0));
+                       fireBullet(this, v, v_forward, autocvar_g_vehicle_spiderbot_minigun_spread, autocvar_g_vehicle_spiderbot_minigun_solidpenetration,
+                               autocvar_g_vehicle_spiderbot_minigun_damage, autocvar_g_vehicle_spiderbot_minigun_force, DEATH_VH_SPID_MINIGUN.m_id, 0);
 
                        sound (gun, CH_WEAPON_A, SND_UZI_FIRE, VOL_BASE, ATTEN_NORM);
                        //trailparticles(self, _particleeffectnum("spiderbot_minigun_trail"), v, trace_endpos);
@@ -311,7 +309,7 @@ bool spiderbot_frame(entity this)
                                                                                   autocvar_g_vehicle_spiderbot_minigun_ammo_regen, frametime, false);
 
 
-       WITH(entity, self, vehic, spiderbot_rocket_do());
+       spiderbot_rocket_do(vehic);
 
        if(vehic.vehicle_flags  & VHF_SHIELDREGEN)
                vehicles_regen(vehic, vehic.dmg_time, vehicle_shield, autocvar_g_vehicle_spiderbot_shield, autocvar_g_vehicle_spiderbot_shield_regen_pause, autocvar_g_vehicle_spiderbot_shield_regen, frametime, true);
@@ -335,8 +333,6 @@ bool spiderbot_frame(entity this)
 
        if(vehic.vehicle_flags & VHF_HASSHIELD)
                VEHICLE_UPDATE_PLAYER(this, vehic, shield, spiderbot);
-
-       setself(this);
 }
 
 void spiderbot_exit(float eject)
index 63f366e039d348bcc8e0a541050c1e9d1e5e4c03..afa57de2dad1f0fa328520996595a4892b716b0d 100644 (file)
@@ -46,14 +46,14 @@ void spiderbot_rocket_guided()
         self.use();
 }
 
-void spiderbot_guide_release()
-{SELFPARAM();
+void spiderbot_guide_release(entity this)
+{
     entity rkt;
-    rkt = findchainentity(realowner, self.owner);
+    rkt = findchainentity(realowner, this.owner);
     if(!rkt)
         return;
 
-    crosshair_trace(self.owner);
+    crosshair_trace(this.owner);
     while(rkt)
     {
         if(rkt.think == spiderbot_rocket_guided)
@@ -139,74 +139,74 @@ vector spiberbot_calcartillery(vector org, vector tgt, float ht)
     return sdir * vs + '0 0 1' * vz;
 }
 
-void spiderbot_rocket_do()
-{SELFPARAM();
+void spiderbot_rocket_do(entity this)
+{;
     vector v;
     entity rocket = world;
 
-    if (self.wait != -10)
+    if (this.wait != -10)
     {
-        if (PHYS_INPUT_BUTTON_ATCK2(self.owner) && self.vehicle_weapon2mode == SBRM_GUIDE)
+        if (PHYS_INPUT_BUTTON_ATCK2(this.owner) && this.vehicle_weapon2mode == SBRM_GUIDE)
         {
-            if (self.wait == 1)
-            if (self.tur_head.frame == 9 || self.tur_head.frame == 1)
+            if (this.wait == 1)
+            if (this.tur_head.frame == 9 || this.tur_head.frame == 1)
             {
-                if(self.gun2.cnt < time && self.tur_head.frame == 9)
-                    self.tur_head.frame = 1;
+                if(this.gun2.cnt < time && this.tur_head.frame == 9)
+                    this.tur_head.frame = 1;
 
                 return;
             }
-            self.wait = 1;
+            this.wait = 1;
         }
         else
         {
-            if(self.wait)
-                spiderbot_guide_release();
+            if(this.wait)
+                spiderbot_guide_release(this);
 
-            self.wait = 0;
+            this.wait = 0;
         }
     }
 
-    if(self.gun2.cnt > time)
+    if(this.gun2.cnt > time)
         return;
 
-    if (self.tur_head.frame >= 9)
+    if (this.tur_head.frame >= 9)
     {
-        self.tur_head.frame = 1;
-        self.wait = 0;
+        this.tur_head.frame = 1;
+        this.wait = 0;
     }
 
-    if(self.wait != -10)
-    if(!PHYS_INPUT_BUTTON_ATCK2(self.owner))
+    if(this.wait != -10)
+    if(!PHYS_INPUT_BUTTON_ATCK2(this.owner))
         return;
 
-    if(forbidWeaponUse(self.owner))
+    if(forbidWeaponUse(this.owner))
         return;
 
-    v = gettaginfo(self.tur_head,gettagindex(self.tur_head,"tag_fire"));
+    v = gettaginfo(this.tur_head,gettagindex(this.tur_head,"tag_fire"));
 
-    switch(self.vehicle_weapon2mode)
+    switch(this.vehicle_weapon2mode)
     {
         case SBRM_VOLLY:
-            rocket = vehicles_projectile(self, EFFECT_SPIDERBOT_ROCKETLAUNCH.eent_eff_name, SND_ROCKET_FIRE,
+            rocket = vehicles_projectile(this, EFFECT_SPIDERBOT_ROCKETLAUNCH.eent_eff_name, SND_ROCKET_FIRE,
                                    v, normalize(randomvec() * autocvar_g_vehicle_spiderbot_rocket_spread + v_forward) * autocvar_g_vehicle_spiderbot_rocket_speed,
                                    autocvar_g_vehicle_spiderbot_rocket_damage, autocvar_g_vehicle_spiderbot_rocket_radius, autocvar_g_vehicle_spiderbot_rocket_force, 1,
-                                   DEATH_VH_SPID_ROCKET.m_id, PROJECTILE_SPIDERROCKET, autocvar_g_vehicle_spiderbot_rocket_health, false, true, self.owner);
-            crosshair_trace(self.owner);
+                                   DEATH_VH_SPID_ROCKET.m_id, PROJECTILE_SPIDERROCKET, autocvar_g_vehicle_spiderbot_rocket_health, false, true, this.owner);
+            crosshair_trace(this.owner);
             float _dist = (random() * autocvar_g_vehicle_spiderbot_rocket_radius) + vlen(v - trace_endpos);
             _dist -= (random() * autocvar_g_vehicle_spiderbot_rocket_radius) ;
             rocket.nextthink  = time + (_dist / autocvar_g_vehicle_spiderbot_rocket_speed);
             rocket.think        = vehicles_projectile_explode;
 
-            if(PHYS_INPUT_BUTTON_ATCK2(self.owner) && self.tur_head.frame == 1)
-                self.wait = -10;
+            if(PHYS_INPUT_BUTTON_ATCK2(this.owner) && this.tur_head.frame == 1)
+                this.wait = -10;
             break;
         case SBRM_GUIDE:
-            rocket = vehicles_projectile(self, EFFECT_SPIDERBOT_ROCKETLAUNCH.eent_eff_name, SND_ROCKET_FIRE,
+            rocket = vehicles_projectile(this, EFFECT_SPIDERBOT_ROCKETLAUNCH.eent_eff_name, SND_ROCKET_FIRE,
                                    v, normalize(v_forward) * autocvar_g_vehicle_spiderbot_rocket_speed,
                                    autocvar_g_vehicle_spiderbot_rocket_damage, autocvar_g_vehicle_spiderbot_rocket_radius, autocvar_g_vehicle_spiderbot_rocket_force, 1,
-                                   DEATH_VH_SPID_ROCKET.m_id, PROJECTILE_SPIDERROCKET, autocvar_g_vehicle_spiderbot_rocket_health, false, false, self.owner);
-            crosshair_trace(self.owner);
+                                   DEATH_VH_SPID_ROCKET.m_id, PROJECTILE_SPIDERROCKET, autocvar_g_vehicle_spiderbot_rocket_health, false, false, this.owner);
+            crosshair_trace(this.owner);
             rocket.pos1           = trace_endpos;
             rocket.nextthink  = time;
             rocket.think         = spiderbot_rocket_guided;
@@ -214,21 +214,21 @@ void spiderbot_rocket_do()
 
         break;
         case SBRM_ARTILLERY:
-            rocket = vehicles_projectile(self, EFFECT_SPIDERBOT_ROCKETLAUNCH.eent_eff_name, SND_ROCKET_FIRE,
+            rocket = vehicles_projectile(this, EFFECT_SPIDERBOT_ROCKETLAUNCH.eent_eff_name, SND_ROCKET_FIRE,
                                    v, normalize(v_forward) * autocvar_g_vehicle_spiderbot_rocket_speed,
                                    autocvar_g_vehicle_spiderbot_rocket_damage, autocvar_g_vehicle_spiderbot_rocket_radius, autocvar_g_vehicle_spiderbot_rocket_force, 1,
-                                   DEATH_VH_SPID_ROCKET.m_id, PROJECTILE_SPIDERROCKET, autocvar_g_vehicle_spiderbot_rocket_health, false, true, self.owner);
+                                   DEATH_VH_SPID_ROCKET.m_id, PROJECTILE_SPIDERROCKET, autocvar_g_vehicle_spiderbot_rocket_health, false, true, this.owner);
 
-            crosshair_trace(self.owner);
+            crosshair_trace(this.owner);
 
             rocket.pos1           = trace_endpos + randomvec() * (0.75 * autocvar_g_vehicle_spiderbot_rocket_radius);
             rocket.pos1_z         = trace_endpos_z;
 
-            traceline(v, v + '0 0 1' * MAX_SHOT_DISTANCE, MOVE_WORLDONLY, self);
+            traceline(v, v + '0 0 1' * MAX_SHOT_DISTANCE, MOVE_WORLDONLY, this);
             float h1 = 0.75 * vlen(v - trace_endpos);
 
             //v = trace_endpos;
-            traceline(v , rocket.pos1 + '0 0 1' * MAX_SHOT_DISTANCE, MOVE_WORLDONLY, self);
+            traceline(v , rocket.pos1 + '0 0 1' * MAX_SHOT_DISTANCE, MOVE_WORLDONLY, this);
             float h2 = 0.75 * vlen(rocket.pos1 - v);
 
             rocket.velocity  = spiberbot_calcartillery(v, rocket.pos1, ((h1 < h2) ? h1 : h2));
@@ -241,13 +241,13 @@ void spiderbot_rocket_do()
 
     rocket.cnt = time + autocvar_g_vehicle_spiderbot_rocket_lifetime;
 
-    self.tur_head.frame += 1;
-    if (self.tur_head.frame == 9)
-        self.attack_finished_single[0] = autocvar_g_vehicle_spiderbot_rocket_reload;
+    this.tur_head.frame += 1;
+    if (this.tur_head.frame == 9)
+        this.attack_finished_single[0] = autocvar_g_vehicle_spiderbot_rocket_reload;
     else
-        self.attack_finished_single[0] = ((self.vehicle_weapon2mode ==  SBRM_VOLLY) ? autocvar_g_vehicle_spiderbot_rocket_refire2 : autocvar_g_vehicle_spiderbot_rocket_refire);
+        this.attack_finished_single[0] = ((this.vehicle_weapon2mode ==  SBRM_VOLLY) ? autocvar_g_vehicle_spiderbot_rocket_refire2 : autocvar_g_vehicle_spiderbot_rocket_refire);
 
-    self.gun2.cnt = time + self.attack_finished_single[0];
+    this.gun2.cnt = time + this.attack_finished_single[0];
 }
 
 #endif
index f670b6f5a65dc028565f2026fe82a4e8ae87f9cc..61e2b02501fc74e14eb6f064304116dde8415936 100644 (file)
@@ -3,7 +3,7 @@
 #include <common/weapons/all.qh>
 
 #ifdef SVQC
-void spiderbot_rocket_do();
+void spiderbot_rocket_do(entity this);
 #endif
 
 // 400 (x2) DPS
index cb5edb1ad2159b0ed35560a8e89123b99de95934..355eada3c7b9f6c31cddd8675dc745b9c4d669a6 100644 (file)
@@ -119,9 +119,9 @@ void W_MachineGun_Attack(Weapon thiswep, int deathtype, .entity weaponentity)
        ATTACK_FINISHED(self, slot) = time + WEP_CVAR(machinegun, first_refire) * W_WeaponRateFactor();
 
        if(self.misc_bulletcounter == 1)
-               fireBullet(w_shotorg, w_shotdir, WEP_CVAR(machinegun, first_spread), WEP_CVAR(machinegun, solidpenetration), WEP_CVAR(machinegun, first_damage), WEP_CVAR(machinegun, first_force), deathtype, 0);
+               fireBullet(self, w_shotorg, w_shotdir, WEP_CVAR(machinegun, first_spread), WEP_CVAR(machinegun, solidpenetration), WEP_CVAR(machinegun, first_damage), WEP_CVAR(machinegun, first_force), deathtype, 0);
        else
-               fireBullet(w_shotorg, w_shotdir, WEP_CVAR(machinegun, sustained_spread), WEP_CVAR(machinegun, solidpenetration), WEP_CVAR(machinegun, sustained_damage), WEP_CVAR(machinegun, sustained_force), deathtype, 0);
+               fireBullet(self, w_shotorg, w_shotdir, WEP_CVAR(machinegun, sustained_spread), WEP_CVAR(machinegun, solidpenetration), WEP_CVAR(machinegun, sustained_damage), WEP_CVAR(machinegun, sustained_force), deathtype, 0);
 
        Send_Effect(EFFECT_MACHINEGUN_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, 1);
 
@@ -192,7 +192,7 @@ void W_MachineGun_Attack_Auto(Weapon thiswep, entity actor, .entity weaponentity
        }
 
        machinegun_spread = bound(WEP_CVAR(machinegun, spread_min), WEP_CVAR(machinegun, spread_min) + (WEP_CVAR(machinegun, spread_add) * actor.misc_bulletcounter), WEP_CVAR(machinegun, spread_max));
-       fireBullet(w_shotorg, w_shotdir, machinegun_spread, WEP_CVAR(machinegun, solidpenetration), WEP_CVAR(machinegun, sustained_damage), WEP_CVAR(machinegun, sustained_force), WEP_MACHINEGUN.m_id, 0);
+       fireBullet(actor, w_shotorg, w_shotdir, machinegun_spread, WEP_CVAR(machinegun, solidpenetration), WEP_CVAR(machinegun, sustained_damage), WEP_CVAR(machinegun, sustained_force), WEP_MACHINEGUN.m_id, 0);
 
        actor.misc_bulletcounter = actor.misc_bulletcounter + 1;
 
@@ -218,7 +218,7 @@ void W_MachineGun_Attack_Burst(Weapon thiswep, entity actor, .entity weaponentit
                actor.punchangle_y = random() - 0.5;
        }
 
-       fireBullet(w_shotorg, w_shotdir, WEP_CVAR(machinegun, burst_speed), WEP_CVAR(machinegun, solidpenetration), WEP_CVAR(machinegun, sustained_damage), WEP_CVAR(machinegun, sustained_force), WEP_MACHINEGUN.m_id, 0);
+       fireBullet(actor, w_shotorg, w_shotdir, WEP_CVAR(machinegun, burst_speed), WEP_CVAR(machinegun, solidpenetration), WEP_CVAR(machinegun, sustained_damage), WEP_CVAR(machinegun, sustained_force), WEP_MACHINEGUN.m_id, 0);
 
        Send_Effect(EFFECT_MACHINEGUN_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, 1);
 
index 7c0e3173386e137c04003a1f158cfc51ea1a41f9..606770579880aa4f177ec878bc8c30ace0eb53c7 100644 (file)
@@ -73,7 +73,7 @@ void W_Rifle_FireBullet(Weapon thiswep, float pSpread, float pDamage, float pFor
        }
 
        for(i = 0; i < pShots; ++i)
-               fireBullet(w_shotorg, w_shotdir, pSpread, pSolidPenetration, pDamage, pForce, deathtype, (pTracer ? EF_RED : EF_BLUE));
+               fireBullet(self, w_shotorg, w_shotdir, pSpread, pSolidPenetration, pDamage, pForce, deathtype, (pTracer ? EF_RED : EF_BLUE));
 
        if(autocvar_g_casings >= 2)
                SpawnCasing(((random() * 50 + 50) * v_right) - (v_forward * (random() * 25 + 25)) - ((random() * 5 - 70) * v_up), 2, vectoangles(v_forward),'0 250 0', 100, 3, self);
index 72f3d7a772c4012eb2ac8f6b05868a164e5d84d1..1a23189402d8c28f6d52e62b54d39d94b83ec378 100644 (file)
@@ -67,7 +67,7 @@ void W_Shotgun_Attack(Weapon thiswep, float isprimary)
 
        W_SetupShot(self, true, 5, SND_SHOTGUN_FIRE, ((isprimary) ? CH_WEAPON_A : CH_WEAPON_SINGLE), WEP_CVAR_PRI(shotgun, damage) * WEP_CVAR_PRI(shotgun, bullets));
        for(sc = 0;sc < WEP_CVAR_PRI(shotgun, bullets);sc = sc + 1)
-               fireBullet(w_shotorg, w_shotdir, WEP_CVAR_PRI(shotgun, spread), WEP_CVAR_PRI(shotgun, solidpenetration), WEP_CVAR_PRI(shotgun, damage), WEP_CVAR_PRI(shotgun, force), WEP_SHOTGUN.m_id, 0);
+               fireBullet(self, w_shotorg, w_shotdir, WEP_CVAR_PRI(shotgun, spread), WEP_CVAR_PRI(shotgun, solidpenetration), WEP_CVAR_PRI(shotgun, damage), WEP_CVAR_PRI(shotgun, force), WEP_SHOTGUN.m_id, 0);
 
        Send_Effect(EFFECT_SHOTGUN_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, WEP_CVAR_PRI(shotgun, ammo));
 
index 9c8bd6cb588fe9234c083b053c49f921620e9a48..311edd0883586944d3bd5b28e6e61c2afe5d7d8a 100644 (file)
@@ -349,8 +349,8 @@ void fireBullet_trace_callback(vector start, vector hit, vector end)
        fireBullet_last_hit = world;
 }
 
-void fireBullet(vector start, vector dir, float spread, float max_solid_penetration, float damage, float force, float dtype, int tracereffects)
-{SELFPARAM();
+void fireBullet(entity this, vector start, vector dir, float spread, float max_solid_penetration, float damage, float force, float dtype, int tracereffects)
+{
        vector  end;
 
        dir = normalize(dir + randomvec() * spread);
@@ -367,28 +367,28 @@ void fireBullet(vector start, vector dir, float spread, float max_solid_penetrat
        else
                fireBullet_trace_callback_eff = EFFECT_BULLET;
 
-       float lag = ANTILAG_LATENCY(self);
+       float lag = ANTILAG_LATENCY(this);
        if(lag < 0.001)
                lag = 0;
-       if (!IS_REAL_CLIENT(self))
+       if (!IS_REAL_CLIENT(this))
                lag = 0;
-       if(autocvar_g_antilag == 0 || self.cvar_cl_noantilag)
+       if(autocvar_g_antilag == 0 || this.cvar_cl_noantilag)
                lag = 0; // only do hitscan, but no antilag
        if(lag)
        {
-               FOREACH_CLIENT(IS_PLAYER(it) && it != self, antilag_takeback(it, CS(it), time - lag));
+               FOREACH_CLIENT(IS_PLAYER(it) && it != this, antilag_takeback(it, CS(it), time - lag));
                FOREACH_ENTITY_FLAGS(flags, FL_MONSTER, {
-                       if (it != self)
+                       if (it != this)
                                antilag_takeback(it, it, time - lag);
                });
        }
 
        // change shooter to SOLID_BBOX so the shot can hit corpses
-       int oldsolid = self.dphitcontentsmask;
-       if(self)
-               self.dphitcontentsmask = DPCONTENTS_SOLID | DPCONTENTS_BODY | DPCONTENTS_CORPSE;
+       int oldsolid = this.dphitcontentsmask;
+       if(this)
+               this.dphitcontentsmask = DPCONTENTS_SOLID | DPCONTENTS_BODY | DPCONTENTS_CORPSE;
 
-       WarpZone_trace_forent = self;
+       WarpZone_trace_forent = this;
 
        for (;;)
        {
@@ -426,23 +426,23 @@ void fireBullet(vector start, vector dir, float spread, float max_solid_penetrat
                        is_weapclip = true;
 
                if(!hit || hit.solid == SOLID_BSP || hit.solid == SOLID_SLIDEBOX)
-                       Damage_DamageInfo(start, damage * solid_penetration_left, 0, 0, max(1, force) * dir * solid_penetration_left, dtype, hit.species, self);
+                       Damage_DamageInfo(start, damage * solid_penetration_left, 0, 0, max(1, force) * dir * solid_penetration_left, dtype, hit.species, this);
 
                if (hit && hit != WarpZone_trace_forent && hit != fireBullet_last_hit)  // Avoid self-damage (except after going through a warp); avoid hitting the same entity twice (engine bug).
                {
                        fireBullet_last_hit = hit;
                        yoda = 0;
-                       MUTATOR_CALLHOOK(FireBullet_Hit, self, hit, start, end, damage);
+                       MUTATOR_CALLHOOK(FireBullet_Hit, this, hit, start, end, damage);
                        damage = frag_damage;
-                       float g = accuracy_isgooddamage(self, hit);
-                       Damage(hit, self, self, damage * solid_penetration_left, dtype, start, force * dir * solid_penetration_left);
+                       float g = accuracy_isgooddamage(this, hit);
+                       Damage(hit, this, this, damage * solid_penetration_left, dtype, start, force * dir * solid_penetration_left);
                        // calculate hits for ballistic weapons
                        if(g)
                        {
                                // do not exceed 100%
                                float added_damage = min(damage - total_damage, damage * solid_penetration_left);
                                total_damage += damage * solid_penetration_left;
-                               accuracy_add(self, PS(self).m_weapon.m_id, 0, added_damage);
+                               accuracy_add(this, PS(this).m_weapon.m_id, 0, added_damage);
                        }
                }
 
@@ -481,24 +481,24 @@ void fireBullet(vector start, vector dir, float spread, float max_solid_penetrat
                // Only show effect when going through a player (invisible otherwise)
                if (hit && (hit.solid != SOLID_BSP))
                        if(vdist(trace_endpos - start, >, 4))
-                               trailparticles(self, fireBullet_trace_callback_eff, start, trace_endpos);
+                               trailparticles(this, fireBullet_trace_callback_eff, start, trace_endpos);
 
                start = trace_endpos;
 
                if(hit.solid == SOLID_BSP)
-                       Damage_DamageInfo(start, 0, 0, 0, max(1, force) * normalize(dir) * -solid_penetration_left, dtype, 0, self);
+                       Damage_DamageInfo(start, 0, 0, 0, max(1, force) * normalize(dir) * -solid_penetration_left, dtype, 0, this);
        }
 
        if(lag)
        {
-               FOREACH_CLIENT(IS_PLAYER(it) && it != self, antilag_restore(it, CS(it)));
+               FOREACH_CLIENT(IS_PLAYER(it) && it != this, antilag_restore(it, CS(it)));
                FOREACH_ENTITY_FLAGS(flags, FL_MONSTER, {
-                       if (it != self)
+                       if (it != this)
                                antilag_restore(it, it);
                });
        }
 
        // restore shooter solid type
-       if(self)
-               self.dphitcontentsmask = oldsolid;
+       if(this)
+               this.dphitcontentsmask = oldsolid;
 }
index 08b7094c2650eaca235dbb042928cd3c524b0511..fed7364b2556f2435a0a7a8635d5b6977c61e9e5 100644 (file)
@@ -54,4 +54,4 @@ void FireRailgunBullet (vector start, vector end, float bdamage, float bforce, f
 entity fireBullet_trace_callback_eff;
 entity fireBullet_last_hit;
 void fireBullet_trace_callback(vector start, vector hit, vector end);
-void fireBullet(vector start, vector dir, float spread, float max_solid_penetration, float damage, float force, float dtype, int tracereffects);
+void fireBullet(entity this, vector start, vector dir, float spread, float max_solid_penetration, float damage, float force, float dtype, int tracereffects);