From: Mario Date: Sat, 26 Mar 2016 12:19:34 +0000 (+1000) Subject: Clean out some more self uses from vehicle code X-Git-Tag: xonotic-v0.8.2~1012 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=3525ea6680ae54755122430b2e618d60079b575c;p=xonotic%2Fxonotic-data.pk3dir.git Clean out some more self uses from vehicle code --- diff --git a/qcsrc/common/mutators/mutator/overkill/hmg.qc b/qcsrc/common/mutators/mutator/overkill/hmg.qc index 1af6e82df..ec8061c3d 100644 --- a/qcsrc/common/mutators/mutator/overkill/hmg.qc +++ b/qcsrc/common/mutators/mutator/overkill/hmg.qc @@ -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; diff --git a/qcsrc/common/turrets/turret/machinegun_weapon.qc b/qcsrc/common/turrets/turret/machinegun_weapon.qc index d5814489f..853750f6c 100644 --- a/qcsrc/common/turrets/turret/machinegun_weapon.qc +++ b/qcsrc/common/turrets/turret/machinegun_weapon.qc @@ -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"); } diff --git a/qcsrc/common/turrets/turret/walker_weapon.qc b/qcsrc/common/turrets/turret/walker_weapon.qc index 170b2dd30..91e4345a9 100644 --- a/qcsrc/common/turrets/turret/walker_weapon.qc +++ b/qcsrc/common/turrets/turret/walker_weapon.qc @@ -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); } } diff --git a/qcsrc/common/vehicles/vehicle/bumblebee.qc b/qcsrc/common/vehicles/vehicle/bumblebee.qc index 138f60f82..fd6b19bf3 100644 --- a/qcsrc/common/vehicles/vehicle/bumblebee.qc +++ b/qcsrc/common/vehicles/vehicle/bumblebee.qc @@ -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() diff --git a/qcsrc/common/vehicles/vehicle/racer.qc b/qcsrc/common/vehicles/vehicle/racer.qc index e57acf95f..f3670a839 100644 --- a/qcsrc/common/vehicles/vehicle/racer.qc +++ b/qcsrc/common/vehicles/vehicle/racer.qc @@ -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() diff --git a/qcsrc/common/vehicles/vehicle/raptor.qc b/qcsrc/common/vehicles/vehicle/raptor.qc index 6fee43d4e..6bd599423 100644 --- a/qcsrc/common/vehicles/vehicle/raptor.qc +++ b/qcsrc/common/vehicles/vehicle/raptor.qc @@ -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() diff --git a/qcsrc/common/vehicles/vehicle/spiderbot.qc b/qcsrc/common/vehicles/vehicle/spiderbot.qc index 9d6602b54..eba9fee8a 100644 --- a/qcsrc/common/vehicles/vehicle/spiderbot.qc +++ b/qcsrc/common/vehicles/vehicle/spiderbot.qc @@ -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) diff --git a/qcsrc/common/vehicles/vehicle/spiderbot_weapons.qc b/qcsrc/common/vehicles/vehicle/spiderbot_weapons.qc index 63f366e03..afa57de2d 100644 --- a/qcsrc/common/vehicles/vehicle/spiderbot_weapons.qc +++ b/qcsrc/common/vehicles/vehicle/spiderbot_weapons.qc @@ -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 diff --git a/qcsrc/common/vehicles/vehicle/spiderbot_weapons.qh b/qcsrc/common/vehicles/vehicle/spiderbot_weapons.qh index f670b6f5a..61e2b0250 100644 --- a/qcsrc/common/vehicles/vehicle/spiderbot_weapons.qh +++ b/qcsrc/common/vehicles/vehicle/spiderbot_weapons.qh @@ -3,7 +3,7 @@ #include #ifdef SVQC -void spiderbot_rocket_do(); +void spiderbot_rocket_do(entity this); #endif // 400 (x2) DPS diff --git a/qcsrc/common/weapons/weapon/machinegun.qc b/qcsrc/common/weapons/weapon/machinegun.qc index cb5edb1ad..355eada3c 100644 --- a/qcsrc/common/weapons/weapon/machinegun.qc +++ b/qcsrc/common/weapons/weapon/machinegun.qc @@ -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); diff --git a/qcsrc/common/weapons/weapon/rifle.qc b/qcsrc/common/weapons/weapon/rifle.qc index 7c0e31733..606770579 100644 --- a/qcsrc/common/weapons/weapon/rifle.qc +++ b/qcsrc/common/weapons/weapon/rifle.qc @@ -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); diff --git a/qcsrc/common/weapons/weapon/shotgun.qc b/qcsrc/common/weapons/weapon/shotgun.qc index 72f3d7a77..1a2318940 100644 --- a/qcsrc/common/weapons/weapon/shotgun.qc +++ b/qcsrc/common/weapons/weapon/shotgun.qc @@ -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)); diff --git a/qcsrc/server/weapons/tracing.qc b/qcsrc/server/weapons/tracing.qc index 9c8bd6cb5..311edd088 100644 --- a/qcsrc/server/weapons/tracing.qc +++ b/qcsrc/server/weapons/tracing.qc @@ -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; } diff --git a/qcsrc/server/weapons/tracing.qh b/qcsrc/server/weapons/tracing.qh index 08b7094c2..fed7364b2 100644 --- a/qcsrc/server/weapons/tracing.qh +++ b/qcsrc/server/weapons/tracing.qh @@ -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);