From 8c094d930e9ef51767384452f80a3bccdc6fd38d Mon Sep 17 00:00:00 2001 From: Mario Date: Fri, 16 Feb 2018 19:42:41 +1000 Subject: [PATCH] Give Damage a weaponentity parameter (fixes some dual wielding related issues) --- .../gamemode/onslaught/sv_onslaught.qc | 10 ++--- qcsrc/common/monsters/monster/mage.qc | 6 ++- qcsrc/common/monsters/monster/shambler.qc | 8 ++-- qcsrc/common/monsters/monster/spider.qc | 2 +- qcsrc/common/monsters/monster/wyvern.qc | 3 +- qcsrc/common/monsters/monster/zombie.qc | 2 +- qcsrc/common/monsters/sv_monsters.qc | 12 +++--- .../mutator/bloodloss/sv_bloodloss.qc | 2 +- .../mutator/breakablehook/sv_breakablehook.qc | 2 +- .../common/mutators/mutator/buffs/sv_buffs.qc | 2 +- .../mutator/campcheck/sv_campcheck.qc | 4 +- .../mutators/mutator/instagib/sv_instagib.qc | 22 +++++------ qcsrc/common/mutators/mutator/nades/nades.qc | 8 ++-- qcsrc/common/mutators/mutator/overkill/rpc.qc | 7 ++-- .../physical_items/sv_physical_items.qc | 2 +- .../mutator/touchexplode/sv_touchexplode.qc | 2 +- .../mutator/vampirehook/sv_vampirehook.qc | 2 +- qcsrc/common/t_items.qc | 2 +- qcsrc/common/triggers/func/breakable.qc | 6 +-- qcsrc/common/triggers/func/button.qc | 2 +- qcsrc/common/triggers/func/door.qc | 14 +++---- qcsrc/common/triggers/func/door_secret.qc | 2 +- qcsrc/common/triggers/misc/laser.qc | 2 +- qcsrc/common/triggers/platforms.qc | 10 ++--- qcsrc/common/triggers/target/kill.qc | 2 +- qcsrc/common/triggers/teleporters.qc | 4 +- qcsrc/common/triggers/trigger/hurt.qc | 4 +- qcsrc/common/triggers/trigger/multi.qc | 2 +- qcsrc/common/triggers/trigger/swamp.qc | 2 +- qcsrc/common/turrets/sv_turrets.qc | 8 ++-- qcsrc/common/turrets/turret/flac_weapon.qc | 4 +- qcsrc/common/turrets/turret/tesla_weapon.qc | 2 +- qcsrc/common/turrets/turret/walker.qc | 6 +-- qcsrc/common/turrets/util.qc | 2 +- qcsrc/common/vehicles/sv_vehicles.qc | 10 ++--- qcsrc/common/vehicles/vehicle/bumblebee.qc | 4 +- qcsrc/common/vehicles/vehicle/racer.qc | 2 +- qcsrc/common/vehicles/vehicle/raptor.qc | 2 +- .../common/vehicles/vehicle/raptor_weapons.qc | 6 +-- qcsrc/common/vehicles/vehicle/spiderbot.qc | 2 +- qcsrc/common/weapons/weapon/arc.qc | 6 ++- qcsrc/common/weapons/weapon/blaster.qc | 2 + qcsrc/common/weapons/weapon/crylink.qc | 6 ++- qcsrc/common/weapons/weapon/devastator.qc | 5 ++- qcsrc/common/weapons/weapon/electro.qc | 8 +++- qcsrc/common/weapons/weapon/fireball.qc | 8 ++-- qcsrc/common/weapons/weapon/hagar.qc | 8 ++-- qcsrc/common/weapons/weapon/hlac.qc | 5 ++- qcsrc/common/weapons/weapon/hook.qc | 5 ++- qcsrc/common/weapons/weapon/minelayer.qc | 8 ++-- qcsrc/common/weapons/weapon/mortar.qc | 8 ++-- qcsrc/common/weapons/weapon/seeker.qc | 10 +++-- qcsrc/common/weapons/weapon/shockwave.qc | 4 ++ qcsrc/common/weapons/weapon/shotgun.qc | 3 +- qcsrc/common/weapons/weapon/tuba.qc | 2 +- qcsrc/common/weapons/weapon/vaporizer.qc | 12 +++--- qcsrc/server/cheats.qc | 2 +- qcsrc/server/client.qc | 10 ++--- qcsrc/server/command/common.qc | 2 +- qcsrc/server/defs.qh | 4 +- qcsrc/server/g_damage.qc | 39 +++++++++---------- qcsrc/server/g_damage.qh | 13 ++++--- qcsrc/server/g_hook.qc | 2 +- qcsrc/server/mutators/mutator/gamemode_ctf.qc | 6 +-- .../mutators/mutator/gamemode_keyhunt.qc | 2 +- qcsrc/server/player.qc | 17 ++++---- qcsrc/server/player.qh | 4 +- qcsrc/server/portals.qc | 2 +- qcsrc/server/race.qc | 2 +- qcsrc/server/sv_main.qc | 12 +++--- qcsrc/server/teamplay.qc | 2 +- qcsrc/server/weapons/tracing.qc | 4 +- 72 files changed, 230 insertions(+), 189 deletions(-) diff --git a/qcsrc/common/gamemodes/gamemode/onslaught/sv_onslaught.qc b/qcsrc/common/gamemodes/gamemode/onslaught/sv_onslaught.qc index 5a0e0975e..0a2aeb11c 100644 --- a/qcsrc/common/gamemodes/gamemode/onslaught/sv_onslaught.qc +++ b/qcsrc/common/gamemodes/gamemode/onslaught/sv_onslaught.qc @@ -68,7 +68,7 @@ void ons_CaptureShield_Touch(entity this, entity toucher) vector mymid = (this.absmin + this.absmax) * 0.5; vector theirmid = (toucher.absmin + toucher.absmax) * 0.5; - Damage(toucher, this, this, 0, DEATH_HURTTRIGGER.m_id, mymid, normalize(theirmid - mymid) * ons_captureshield_force); + Damage(toucher, this, this, 0, DEATH_HURTTRIGGER.m_id, DMG_NOWEP, mymid, normalize(theirmid - mymid) * ons_captureshield_force); if(IS_REAL_CLIENT(toucher)) { @@ -381,7 +381,7 @@ int ons_ControlPoint_Attackable(entity cp, int teamnumber) return 0; } -void ons_ControlPoint_Icon_Damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force) +void ons_ControlPoint_Icon_Damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, .entity weaponentity, vector hitloc, vector force) { if(damage <= 0) { return; } @@ -479,7 +479,7 @@ void ons_ControlPoint_Icon_Think(entity this) this.SendFlags |= CPSF_STATUS; if(this.health <= 0) { - ons_ControlPoint_Icon_Damage(this, this, this, 1, 0, this.origin, '0 0 0'); + ons_ControlPoint_Icon_Damage(this, this, this, 1, 0, DMG_NOWEP, this.origin, '0 0 0'); return; } } @@ -868,7 +868,7 @@ void ons_camSetup(entity this) WriteAngle(MSG_ALL, cam.angles_z); } -void ons_GeneratorDamage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force) +void ons_GeneratorDamage(entity this, entity inflictor, entity attacker, float damage, int deathtype, .entity weaponentity, vector hitloc, vector force) { if(damage <= 0) return; if(warmup_stage || game_stopped) return; @@ -1155,7 +1155,7 @@ bool Onslaught_CheckWinner() else d = d * tmp_entity.max_health / max(30, 60 * autocvar_timelimit_suddendeath); - Damage(tmp_entity, tmp_entity, tmp_entity, d, DEATH_HURTTRIGGER.m_id, tmp_entity.origin, '0 0 0'); + Damage(tmp_entity, tmp_entity, tmp_entity, d, DEATH_HURTTRIGGER.m_id, DMG_NOWEP, tmp_entity.origin, '0 0 0'); tmp_entity.sprite.SendFlags |= 16; diff --git a/qcsrc/common/monsters/monster/mage.qc b/qcsrc/common/monsters/monster/mage.qc index 32383af57..8f328c8f8 100644 --- a/qcsrc/common/monsters/monster/mage.qc +++ b/qcsrc/common/monsters/monster/mage.qc @@ -118,7 +118,8 @@ void M_Mage_Attack_Spike_Explode(entity this, entity directhitentity) this.realowner.mage_spike = NULL; Send_Effect(EFFECT_EXPLOSION_SMALL, this.origin, '0 0 0', 1); - RadiusDamage (this, this.realowner, (autocvar_g_monster_mage_attack_spike_damage), (autocvar_g_monster_mage_attack_spike_damage) * 0.5, (autocvar_g_monster_mage_attack_spike_radius), NULL, NULL, 0, DEATH_MONSTER_MAGE.m_id, directhitentity); + RadiusDamage (this, this.realowner, (autocvar_g_monster_mage_attack_spike_damage), (autocvar_g_monster_mage_attack_spike_damage) * 0.5, (autocvar_g_monster_mage_attack_spike_radius), + NULL, NULL, 0, DEATH_MONSTER_MAGE.m_id, DMG_NOWEP, directhitentity); delete(this); } @@ -271,7 +272,8 @@ void M_Mage_Defend_Heal(entity this) void M_Mage_Attack_Push(entity this) { sound(this, CH_SHOTS, SND_TAGEXP1, 1, ATTEN_NORM); - RadiusDamage (this, this, (autocvar_g_monster_mage_attack_push_damage), (autocvar_g_monster_mage_attack_push_damage), (autocvar_g_monster_mage_attack_push_radius), NULL, NULL, (autocvar_g_monster_mage_attack_push_force), DEATH_MONSTER_MAGE.m_id, this.enemy); + RadiusDamage (this, this, (autocvar_g_monster_mage_attack_push_damage), (autocvar_g_monster_mage_attack_push_damage), (autocvar_g_monster_mage_attack_push_radius), + NULL, NULL, (autocvar_g_monster_mage_attack_push_force), DEATH_MONSTER_MAGE.m_id, DMG_NOWEP, this.enemy); Send_Effect(EFFECT_TE_EXPLOSION, this.origin, '0 0 0', 1); setanim(this, this.anim_shoot, true, true, true); diff --git a/qcsrc/common/monsters/monster/shambler.qc b/qcsrc/common/monsters/monster/shambler.qc index 338acacd6..eeefeae8c 100644 --- a/qcsrc/common/monsters/monster/shambler.qc +++ b/qcsrc/common/monsters/monster/shambler.qc @@ -42,7 +42,7 @@ void M_Shambler_Attack_Smash(entity this) tracebox(this.origin + v_forward * 50, this.mins * 0.5, this.maxs * 0.5, this.origin + v_forward * autocvar_g_monster_shambler_attack_smash_range, MOVE_NORMAL, this); if(trace_ent.takedamage) - Damage(trace_ent, this, this, (autocvar_g_monster_shambler_attack_smash_damage) * MONSTER_SKILLMOD(this), DEATH_MONSTER_SHAMBLER_SMASH.m_id, trace_ent.origin, normalize(trace_ent.origin - this.origin)); + Damage(trace_ent, this, this, (autocvar_g_monster_shambler_attack_smash_damage) * MONSTER_SKILLMOD(this), DEATH_MONSTER_SHAMBLER_SMASH.m_id, DMG_NOWEP, trace_ent.origin, normalize(trace_ent.origin - this.origin)); } void M_Shambler_Attack_Swing(entity this) @@ -66,12 +66,12 @@ void M_Shambler_Attack_Lightning_Explode(entity this, entity directhitentity) this.velocity = this.oldvelocity; RadiusDamage (this, this.realowner, (autocvar_g_monster_shambler_attack_lightning_damage), (autocvar_g_monster_shambler_attack_lightning_damage), (autocvar_g_monster_shambler_attack_lightning_radius), - NULL, NULL, (autocvar_g_monster_shambler_attack_lightning_force), this.projectiledeathtype, directhitentity); + NULL, NULL, (autocvar_g_monster_shambler_attack_lightning_force), this.projectiledeathtype, DMG_NOWEP, directhitentity); FOREACH_ENTITY_RADIUS(this.origin, autocvar_g_monster_shambler_attack_lightning_radius_zap, it != this.realowner && it.takedamage, { te_csqc_lightningarc(this.origin, it.origin); - Damage(it, this, this.realowner, (autocvar_g_monster_shambler_attack_lightning_damage_zap) * MONSTER_SKILLMOD(this), DEATH_MONSTER_SHAMBLER_ZAP.m_id, it.origin, '0 0 0'); + Damage(it, this, this.realowner, (autocvar_g_monster_shambler_attack_lightning_damage_zap) * MONSTER_SKILLMOD(this), DEATH_MONSTER_SHAMBLER_ZAP.m_id, DMG_NOWEP, it.origin, '0 0 0'); }); setthink(this, SUB_Remove); @@ -83,7 +83,7 @@ void M_Shambler_Attack_Lightning_Explode_use(entity this, entity actor, entity t M_Shambler_Attack_Lightning_Explode(this, trigger); } -void M_Shambler_Attack_Lightning_Damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force) +void M_Shambler_Attack_Lightning_Damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, .entity weaponentity, vector hitloc, vector force) { if (this.health <= 0) return; diff --git a/qcsrc/common/monsters/monster/spider.qc b/qcsrc/common/monsters/monster/spider.qc index a65513920..cd79ac40e 100644 --- a/qcsrc/common/monsters/monster/spider.qc +++ b/qcsrc/common/monsters/monster/spider.qc @@ -101,7 +101,7 @@ void M_Spider_Attack_Web_Explode(entity this) if(this) { Send_Effect(EFFECT_ELECTRO_IMPACT, this.origin, '0 0 0', 1); - RadiusDamage(this, this.realowner, 0, 0, 25, NULL, NULL, 25, this.projectiledeathtype, NULL); + RadiusDamage(this, this.realowner, 0, 0, 25, NULL, NULL, 25, this.projectiledeathtype, DMG_NOWEP, NULL); FOREACH_ENTITY_RADIUS(this.origin, 25, it != this && it.takedamage && !IS_DEAD(it) && it.health > 0 && it.monsterid != MON_SPIDER.monsterid, { diff --git a/qcsrc/common/monsters/monster/wyvern.qc b/qcsrc/common/monsters/monster/wyvern.qc index 38df673dd..e38d8ffdb 100644 --- a/qcsrc/common/monsters/monster/wyvern.qc +++ b/qcsrc/common/monsters/monster/wyvern.qc @@ -71,7 +71,8 @@ void M_Wyvern_Attack_Fireball_Explode(entity this) entity own = this.realowner; - RadiusDamage(this, own, autocvar_g_monster_wyvern_attack_fireball_damage, autocvar_g_monster_wyvern_attack_fireball_edgedamage, autocvar_g_monster_wyvern_attack_fireball_force, NULL, NULL, autocvar_g_monster_wyvern_attack_fireball_radius, this.projectiledeathtype, NULL); + RadiusDamage(this, own, autocvar_g_monster_wyvern_attack_fireball_damage, autocvar_g_monster_wyvern_attack_fireball_edgedamage, autocvar_g_monster_wyvern_attack_fireball_force, + NULL, NULL, autocvar_g_monster_wyvern_attack_fireball_radius, this.projectiledeathtype, DMG_NOWEP, NULL); FOREACH_ENTITY_RADIUS(this.origin, autocvar_g_monster_wyvern_attack_fireball_radius, it.takedamage == DAMAGE_AIM, { diff --git a/qcsrc/common/monsters/monster/zombie.qc b/qcsrc/common/monsters/monster/zombie.qc index d5011c7f3..297bab87d 100644 --- a/qcsrc/common/monsters/monster/zombie.qc +++ b/qcsrc/common/monsters/monster/zombie.qc @@ -60,7 +60,7 @@ void M_Zombie_Attack_Leap_Touch(entity this, entity toucher) { angles_face = vectoangles(this.moveto - this.origin); angles_face = normalize(angles_face) * (autocvar_g_monster_zombie_attack_leap_force); - Damage(toucher, this, this, (autocvar_g_monster_zombie_attack_leap_damage) * MONSTER_SKILLMOD(this), DEATH_MONSTER_ZOMBIE_JUMP.m_id, toucher.origin, angles_face); + Damage(toucher, this, this, (autocvar_g_monster_zombie_attack_leap_damage) * MONSTER_SKILLMOD(this), DEATH_MONSTER_ZOMBIE_JUMP.m_id, DMG_NOWEP, toucher.origin, angles_face); settouch(this, Monster_Touch); // instantly turn it off to stop damage spam this.state = 0; } diff --git a/qcsrc/common/monsters/sv_monsters.qc b/qcsrc/common/monsters/sv_monsters.qc index 9dffeb73e..695d11019 100644 --- a/qcsrc/common/monsters/sv_monsters.qc +++ b/qcsrc/common/monsters/sv_monsters.qc @@ -366,7 +366,7 @@ bool Monster_Attack_Melee(entity this, entity targ, float damg, vector anim, flo traceline(this.origin + this.view_ofs, this.origin + v_forward * er, 0, this); if(trace_ent.takedamage) - Damage(trace_ent, this, this, damg * MONSTER_SKILLMOD(this), deathtype, trace_ent.origin, normalize(trace_ent.origin - this.origin)); + Damage(trace_ent, this, this, damg * MONSTER_SKILLMOD(this), deathtype, DMG_NOWEP, trace_ent.origin, normalize(trace_ent.origin - this.origin)); return true; } @@ -719,7 +719,7 @@ void Monster_Move(entity this, float runspeed, float walkspeed, float stpspeed) { this.last_trace = time + 0.4; - Damage (this, NULL, NULL, 2, DEATH_DROWN.m_id, this.origin, '0 0 0'); + Damage (this, NULL, NULL, 2, DEATH_DROWN.m_id, DMG_NOWEP, this.origin, '0 0 0'); this.angles = '90 90 0'; if(random() < 0.5) { @@ -906,7 +906,7 @@ void Monster_Reset(entity this) this.moveto = this.origin; } -void Monster_Dead_Damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force) +void Monster_Dead_Damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, .entity weaponentity, vector hitloc, vector force) { this.health -= damage; @@ -985,7 +985,7 @@ void Monster_Dead(entity this, entity attacker, float gibbed) } } -void Monster_Damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force) +void Monster_Damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, .entity weaponentity, vector hitloc, vector force) { if((this.spawnflags & MONSTERFLAG_INVINCIBLE) && deathtype != DEATH_KILL.m_id && !ITEM_DAMAGE_NEEDKILL(deathtype)) return; @@ -1174,7 +1174,7 @@ void Monster_Frozen_Think(entity this) Unfreeze(this); this.health = 0; if(this.event_damage) - this.event_damage(this, this, this.frozen_by, 1, DEATH_NADE_ICE_FREEZE.m_id, this.origin, '0 0 0'); + this.event_damage(this, this, this.frozen_by, 1, DEATH_NADE_ICE_FREEZE.m_id, DMG_NOWEP, this.origin, '0 0 0'); } else if ( this.revive_progress <= 0 ) @@ -1212,7 +1212,7 @@ void Monster_Think(entity this) if(this.monster_lifetime && time >= this.monster_lifetime) { - Damage(this, this, this, this.health + this.max_health, DEATH_KILL.m_id, this.origin, this.origin); + Damage(this, this, this, this.health + this.max_health, DEATH_KILL.m_id, DMG_NOWEP, this.origin, this.origin); return; } diff --git a/qcsrc/common/mutators/mutator/bloodloss/sv_bloodloss.qc b/qcsrc/common/mutators/mutator/bloodloss/sv_bloodloss.qc index 1164e0ade..99093d16b 100644 --- a/qcsrc/common/mutators/mutator/bloodloss/sv_bloodloss.qc +++ b/qcsrc/common/mutators/mutator/bloodloss/sv_bloodloss.qc @@ -19,7 +19,7 @@ MUTATOR_HOOKFUNCTION(bloodloss, PlayerPreThink) if(player.vehicle) vehicles_exit(player.vehicle, VHEF_RELEASE); if(player.event_damage) - player.event_damage(player, player, player, 1, DEATH_ROT.m_id, player.origin, '0 0 0'); + player.event_damage(player, player, player, 1, DEATH_ROT.m_id, DMG_NOWEP, player.origin, '0 0 0'); player.bloodloss_timer = time + 0.5 + random() * 0.5; } } diff --git a/qcsrc/common/mutators/mutator/breakablehook/sv_breakablehook.qc b/qcsrc/common/mutators/mutator/breakablehook/sv_breakablehook.qc index ee1ca94b5..dc1bfefc2 100644 --- a/qcsrc/common/mutators/mutator/breakablehook/sv_breakablehook.qc +++ b/qcsrc/common/mutators/mutator/breakablehook/sv_breakablehook.qc @@ -22,7 +22,7 @@ MUTATOR_HOOKFUNCTION(breakablehook, Damage_Calculate) // hurt the owner of the hook if(DIFF_TEAM(frag_attacker, frag_target.realowner)) { - Damage (frag_target.realowner, frag_attacker, frag_attacker, 5, WEP_HOOK.m_id | HITTYPE_SPLASH, frag_target.realowner.origin, '0 0 0'); + Damage (frag_target.realowner, frag_attacker, frag_attacker, 5, WEP_HOOK.m_id | HITTYPE_SPLASH, DMG_NOWEP, frag_target.realowner.origin, '0 0 0'); // TODO: should get weapon entity from mutator hook RemoveHook(frag_target); return; // dead } diff --git a/qcsrc/common/mutators/mutator/buffs/sv_buffs.qc b/qcsrc/common/mutators/mutator/buffs/sv_buffs.qc index d2755f10f..0122502f4 100644 --- a/qcsrc/common/mutators/mutator/buffs/sv_buffs.qc +++ b/qcsrc/common/mutators/mutator/buffs/sv_buffs.qc @@ -413,7 +413,7 @@ void buff_SpawnReplacement(entity ent, entity old) void buff_Vengeance_DelayedDamage(entity this) { if(this.enemy) - Damage(this.enemy, this.owner, this.owner, this.dmg, DEATH_BUFF.m_id, this.enemy.origin, '0 0 0'); + Damage(this.enemy, this.owner, this.owner, this.dmg, DEATH_BUFF.m_id, DMG_NOWEP, this.enemy.origin, '0 0 0'); delete(this); return; diff --git a/qcsrc/common/mutators/mutator/campcheck/sv_campcheck.qc b/qcsrc/common/mutators/mutator/campcheck/sv_campcheck.qc index 987645aaa..8fbfa533d 100644 --- a/qcsrc/common/mutators/mutator/campcheck/sv_campcheck.qc +++ b/qcsrc/common/mutators/mutator/campcheck/sv_campcheck.qc @@ -63,9 +63,9 @@ MUTATOR_HOOKFUNCTION(campcheck, PlayerPreThink) { Send_Notification(NOTIF_ONE, player, MSG_CENTER, CENTER_CAMPCHECK); if(player.vehicle) - Damage(player.vehicle, NULL, NULL, autocvar_g_campcheck_damage * 2, DEATH_CAMP.m_id, player.vehicle.origin, '0 0 0'); + Damage(player.vehicle, NULL, NULL, autocvar_g_campcheck_damage * 2, DEATH_CAMP.m_id, DMG_NOWEP, player.vehicle.origin, '0 0 0'); else - Damage(player, NULL, NULL, bound(0, autocvar_g_campcheck_damage, GetResourceAmount(player, RESOURCE_HEALTH) + GetResourceAmount(player, RESOURCE_ARMOR) * autocvar_g_balance_armor_blockpercent + 5), DEATH_CAMP.m_id, player.origin, '0 0 0'); + Damage(player, NULL, NULL, bound(0, autocvar_g_campcheck_damage, GetResourceAmount(player, RESOURCE_HEALTH) + GetResourceAmount(player, RESOURCE_ARMOR) * autocvar_g_balance_armor_blockpercent + 5), DEATH_CAMP.m_id, DMG_NOWEP, player.origin, '0 0 0'); } player.campcheck_nextcheck = time + autocvar_g_campcheck_interval; player.campcheck_traveled_distance = 0; diff --git a/qcsrc/common/mutators/mutator/instagib/sv_instagib.qc b/qcsrc/common/mutators/mutator/instagib/sv_instagib.qc index 85bef1d49..a3ddf4474 100644 --- a/qcsrc/common/mutators/mutator/instagib/sv_instagib.qc +++ b/qcsrc/common/mutators/mutator/instagib/sv_instagib.qc @@ -84,59 +84,59 @@ void instagib_ammocheck(entity this) this.instagib_needammo = true; if (hp <= 5) { - Damage(this, this, this, 5, DEATH_NOAMMO.m_id, this.origin, '0 0 0'); + Damage(this, this, this, 5, DEATH_NOAMMO.m_id, DMG_NOWEP, this.origin, '0 0 0'); Send_Notification(NOTIF_ONE, this, MSG_ANNCE, ANNCE_INSTAGIB_TERMINATED); } else if (hp <= 10) { - Damage(this, this, this, 5, DEATH_NOAMMO.m_id, this.origin, '0 0 0'); + Damage(this, this, this, 5, DEATH_NOAMMO.m_id, DMG_NOWEP, this.origin, '0 0 0'); Send_Notification(NOTIF_ONE, this, MSG_ANNCE, ANNCE_NUM_1); } else if (hp <= 20) { - Damage(this, this, this, 10, DEATH_NOAMMO.m_id, this.origin, '0 0 0'); + Damage(this, this, this, 10, DEATH_NOAMMO.m_id, DMG_NOWEP, this.origin, '0 0 0'); Send_Notification(NOTIF_ONE, this, MSG_ANNCE, ANNCE_NUM_2); } else if (hp <= 30) { - Damage(this, this, this, 10, DEATH_NOAMMO.m_id, this.origin, '0 0 0'); + Damage(this, this, this, 10, DEATH_NOAMMO.m_id, DMG_NOWEP, this.origin, '0 0 0'); Send_Notification(NOTIF_ONE, this, MSG_ANNCE, ANNCE_NUM_3); } else if (hp <= 40) { - Damage(this, this, this, 10, DEATH_NOAMMO.m_id, this.origin, '0 0 0'); + Damage(this, this, this, 10, DEATH_NOAMMO.m_id, DMG_NOWEP, this.origin, '0 0 0'); Send_Notification(NOTIF_ONE, this, MSG_ANNCE, ANNCE_NUM_4); } else if (hp <= 50) { - Damage(this, this, this, 10, DEATH_NOAMMO.m_id, this.origin, '0 0 0'); + Damage(this, this, this, 10, DEATH_NOAMMO.m_id, DMG_NOWEP, this.origin, '0 0 0'); Send_Notification(NOTIF_ONE, this, MSG_ANNCE, ANNCE_NUM_5); } else if (hp <= 60) { - Damage(this, this, this, 10, DEATH_NOAMMO.m_id, this.origin, '0 0 0'); + Damage(this, this, this, 10, DEATH_NOAMMO.m_id, DMG_NOWEP, this.origin, '0 0 0'); Send_Notification(NOTIF_ONE, this, MSG_ANNCE, ANNCE_NUM_6); } else if (hp <= 70) { - Damage(this, this, this, 10, DEATH_NOAMMO.m_id, this.origin, '0 0 0'); + Damage(this, this, this, 10, DEATH_NOAMMO.m_id, DMG_NOWEP, this.origin, '0 0 0'); Send_Notification(NOTIF_ONE, this, MSG_ANNCE, ANNCE_NUM_7); } else if (hp <= 80) { - Damage(this, this, this, 10, DEATH_NOAMMO.m_id, this.origin, '0 0 0'); + Damage(this, this, this, 10, DEATH_NOAMMO.m_id, DMG_NOWEP, this.origin, '0 0 0'); Send_Notification(NOTIF_ONE, this, MSG_ANNCE, ANNCE_NUM_8); } else if (hp <= 90) { Send_Notification(NOTIF_ONE_ONLY, this, MSG_CENTER, CENTER_INSTAGIB_FINDAMMO); - Damage(this, this, this, 10, DEATH_NOAMMO.m_id, this.origin, '0 0 0'); + Damage(this, this, this, 10, DEATH_NOAMMO.m_id, DMG_NOWEP, this.origin, '0 0 0'); Send_Notification(NOTIF_ONE, this, MSG_ANNCE, ANNCE_NUM_9); } else { Send_Notification(NOTIF_ONE_ONLY, this, MSG_MULTI, MULTI_INSTAGIB_FINDAMMO); - Damage(this, this, this, 10, DEATH_NOAMMO.m_id, this.origin, '0 0 0'); + Damage(this, this, this, 10, DEATH_NOAMMO.m_id, DMG_NOWEP, this.origin, '0 0 0'); } } this.instagib_nextthink = time + 1; diff --git a/qcsrc/common/mutators/mutator/nades/nades.qc b/qcsrc/common/mutators/mutator/nades/nades.qc index 3dc7e4e0e..14b34512d 100644 --- a/qcsrc/common/mutators/mutator/nades/nades.qc +++ b/qcsrc/common/mutators/mutator/nades/nades.qc @@ -397,7 +397,7 @@ void nade_ice_think(entity this) sound(this, CH_SHOTS, SND_ROCKET_IMPACT, VOL_BASE, ATTEN_NORM); RadiusDamage(this, this.realowner, autocvar_g_nades_nade_damage, autocvar_g_nades_nade_edgedamage, - autocvar_g_nades_nade_radius, this, NULL, autocvar_g_nades_nade_force, this.projectiledeathtype, this.enemy); + autocvar_g_nades_nade_radius, this, NULL, autocvar_g_nades_nade_force, this.projectiledeathtype, DMG_NOWEP, this.enemy); Damage_DamageInfo(this.origin, autocvar_g_nades_nade_damage, autocvar_g_nades_nade_edgedamage, autocvar_g_nades_nade_radius, '1 1 1' * autocvar_g_nades_nade_force, this.projectiledeathtype, 0, this); } @@ -635,7 +635,7 @@ void nade_heal_touch(entity this, entity toucher) } else if ( health_factor < 0 ) { - Damage(toucher,this,this.realowner,-health_factor,DEATH_NADE_HEAL.m_id,toucher.origin,'0 0 0'); + Damage(toucher,this,this.realowner,-health_factor,DEATH_NADE_HEAL.m_id,DMG_NOWEP,toucher.origin,'0 0 0'); } } @@ -722,7 +722,7 @@ void nade_boom(entity this) if(nade_blast) { RadiusDamage(this, this.realowner, autocvar_g_nades_nade_damage, autocvar_g_nades_nade_edgedamage, - autocvar_g_nades_nade_radius, this, NULL, autocvar_g_nades_nade_force, this.projectiledeathtype, this.enemy); + autocvar_g_nades_nade_radius, this, NULL, autocvar_g_nades_nade_force, this.projectiledeathtype, DMG_NOWEP, this.enemy); Damage_DamageInfo(this.origin, autocvar_g_nades_nade_damage, autocvar_g_nades_nade_edgedamage, autocvar_g_nades_nade_radius, '1 1 1' * autocvar_g_nades_nade_force, this.projectiledeathtype, 0, this); } @@ -815,7 +815,7 @@ void nade_beep(entity this) this.nextthink = max(this.wait, time); } -void nade_damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force) +void nade_damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, .entity weaponentity, vector hitloc, vector force) { if(ITEM_DAMAGE_NEEDKILL(deathtype)) { diff --git a/qcsrc/common/mutators/mutator/overkill/rpc.qc b/qcsrc/common/mutators/mutator/overkill/rpc.qc index fc83febf1..76f7197e6 100644 --- a/qcsrc/common/mutators/mutator/overkill/rpc.qc +++ b/qcsrc/common/mutators/mutator/overkill/rpc.qc @@ -7,7 +7,7 @@ void W_RocketPropelledChainsaw_Explode(entity this, entity directhitentity) this.event_damage = func_null; this.takedamage = DAMAGE_NO; - RadiusDamage (this, this.realowner, WEP_CVAR(rpc, damage), WEP_CVAR(rpc, edgedamage), WEP_CVAR(rpc, radius), NULL, NULL, WEP_CVAR(rpc, force), this.projectiledeathtype, directhitentity); + RadiusDamage (this, this.realowner, WEP_CVAR(rpc, damage), WEP_CVAR(rpc, edgedamage), WEP_CVAR(rpc, radius), NULL, NULL, WEP_CVAR(rpc, force), this.projectiledeathtype, this.weaponentity_fld, directhitentity); delete(this); } @@ -26,7 +26,7 @@ void W_RocketPropelledChainsaw_Touch (entity this, entity toucher) W_RocketPropelledChainsaw_Explode(this, toucher); } -void W_RocketPropelledChainsaw_Damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force) +void W_RocketPropelledChainsaw_Damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, .entity weaponentity, vector hitloc, vector force) { if (this.health <= 0) return; @@ -54,7 +54,7 @@ void W_RocketPropelledChainsaw_Think(entity this) tracebox(this.origin, this.mins, this.maxs, this.origin + mydir * (2 * myspeed_accel), MOVE_NORMAL, this); if(IS_PLAYER(trace_ent)) - Damage (trace_ent, this, this.realowner, WEP_CVAR(rpc, damage2), this.projectiledeathtype, this.origin, normalize(this.origin - trace_ent.origin) * WEP_CVAR(rpc, force)); + Damage (trace_ent, this, this.realowner, WEP_CVAR(rpc, damage2), this.projectiledeathtype, this.weaponentity_fld, this.origin, normalize(this.origin - trace_ent.origin) * WEP_CVAR(rpc, force)); this.velocity = mydir * (myspeed + (WEP_CVAR(rpc, speedaccel) * sys_frametime)); @@ -85,6 +85,7 @@ void W_RocketPropelledChainsaw_Attack (Weapon thiswep, entity actor, .entity wea set_movetype(missile, MOVETYPE_FLY); missile.projectiledeathtype = WEP_RPC.m_id; + missile.weaponentity_fld = weaponentity; setsize (missile, '-3 -3 -3', '3 3 3'); // give it some size so it can be shot setorigin(missile, w_shotorg - v_forward * 3); // move it back so it hits the wall at the right point diff --git a/qcsrc/common/mutators/mutator/physical_items/sv_physical_items.qc b/qcsrc/common/mutators/mutator/physical_items/sv_physical_items.qc index 38cd7474b..63b43e018 100644 --- a/qcsrc/common/mutators/mutator/physical_items/sv_physical_items.qc +++ b/qcsrc/common/mutators/mutator/physical_items/sv_physical_items.qc @@ -79,7 +79,7 @@ void physical_item_touch(entity this, entity toucher) } } -void physical_item_damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force) +void physical_item_damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, .entity weaponentity, vector hitloc, vector force) { if(!this.cnt) // not for dropped items if(ITEM_DAMAGE_NEEDKILL(deathtype)) diff --git a/qcsrc/common/mutators/mutator/touchexplode/sv_touchexplode.qc b/qcsrc/common/mutators/mutator/touchexplode/sv_touchexplode.qc index a1b38fb6e..6be2c5963 100644 --- a/qcsrc/common/mutators/mutator/touchexplode/sv_touchexplode.qc +++ b/qcsrc/common/mutators/mutator/touchexplode/sv_touchexplode.qc @@ -20,7 +20,7 @@ void PlayerTouchExplode(entity p1, entity p2) entity e = spawn(); setorigin(e, org); - RadiusDamage(e, NULL, autocvar_g_touchexplode_damage, autocvar_g_touchexplode_edgedamage, autocvar_g_touchexplode_radius, NULL, NULL, autocvar_g_touchexplode_force, DEATH_TOUCHEXPLODE.m_id, NULL); + RadiusDamage(e, NULL, autocvar_g_touchexplode_damage, autocvar_g_touchexplode_edgedamage, autocvar_g_touchexplode_radius, NULL, NULL, autocvar_g_touchexplode_force, DEATH_TOUCHEXPLODE.m_id, DMG_NOWEP, NULL); delete(e); } diff --git a/qcsrc/common/mutators/mutator/vampirehook/sv_vampirehook.qc b/qcsrc/common/mutators/mutator/vampirehook/sv_vampirehook.qc index ce9e27065..d0f01a576 100644 --- a/qcsrc/common/mutators/mutator/vampirehook/sv_vampirehook.qc +++ b/qcsrc/common/mutators/mutator/vampirehook/sv_vampirehook.qc @@ -26,7 +26,7 @@ MUTATOR_HOOKFUNCTION(vh, GrappleHookThink) { thehook.last_dmg = time + autocvar_g_vampirehook_damagerate; thehook.owner.damage_dealt += autocvar_g_vampirehook_damage; - Damage(dmgent, thehook, thehook.owner, autocvar_g_vampirehook_damage, WEP_HOOK.m_id, thehook.origin, '0 0 0'); + Damage(dmgent, thehook, thehook.owner, autocvar_g_vampirehook_damage, WEP_HOOK.m_id, DMG_NOWEP, thehook.origin, '0 0 0'); if(SAME_TEAM(thehook.owner, thehook.aiment)) thehook.aiment.health = min(thehook.aiment.health + autocvar_g_vampirehook_health_steal, g_pickup_healthsmall_max); else diff --git a/qcsrc/common/t_items.qc b/qcsrc/common/t_items.qc index 62b02c379..b5a939e50 100644 --- a/qcsrc/common/t_items.qc +++ b/qcsrc/common/t_items.qc @@ -1168,7 +1168,7 @@ float healtharmor_pickupevalfunc(entity player, entity item) return rating; } -void Item_Damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force) +void Item_Damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, .entity weaponentity, vector hitloc, vector force) { if(ITEM_DAMAGE_NEEDKILL(deathtype)) RemoveItem(this); diff --git a/qcsrc/common/triggers/func/breakable.qc b/qcsrc/common/triggers/func/breakable.qc index 84e5581c8..ec71bc3fc 100644 --- a/qcsrc/common/triggers/func/breakable.qc +++ b/qcsrc/common/triggers/func/breakable.qc @@ -42,7 +42,7 @@ // Otherwise mdl_dead will be displayed at the map origin, and nobody would // want that! -void func_breakable_damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force); +void func_breakable_damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, .entity weaponentity, vector hitloc, vector force); // // func_breakable @@ -223,7 +223,7 @@ void func_breakable_destroy(entity this, entity actor, entity trigger) _sound (this, CH_TRIGGER, this.noise, VOL_BASE, ATTEN_NORM); if(this.dmg) - RadiusDamage(this, act, this.dmg, this.dmg_edge, this.dmg_radius, this, NULL, this.dmg_force, DEATH_HURTTRIGGER.m_id, NULL); + RadiusDamage(this, act, this.dmg, this.dmg_edge, this.dmg_radius, this, NULL, this.dmg_force, DEATH_HURTTRIGGER.m_id, DMG_NOWEP, NULL); if(this.cnt) // TODO __pointparticles(this.cnt, this.absmin * 0.5 + this.absmax * 0.5, '0 0 0', this.count); @@ -246,7 +246,7 @@ void func_breakable_destroy_self(entity this) func_breakable_destroy(this, NULL, NULL); } -void func_breakable_damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force) +void func_breakable_damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, .entity weaponentity, vector hitloc, vector force) { if(this.state == 1) return; diff --git a/qcsrc/common/triggers/func/button.qc b/qcsrc/common/triggers/func/button.qc index ddd62ae4e..c51c034f1 100644 --- a/qcsrc/common/triggers/func/button.qc +++ b/qcsrc/common/triggers/func/button.qc @@ -89,7 +89,7 @@ void button_touch(entity this, entity toucher) button_fire (this); } -void button_damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force) +void button_damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, .entity weaponentity, vector hitloc, vector force) { if(this.spawnflags & DOOR_NOSPLASH) if(!(DEATH_ISSPECIAL(deathtype)) && (deathtype & HITTYPE_SPLASH)) diff --git a/qcsrc/common/triggers/func/door.qc b/qcsrc/common/triggers/func/door.qc index bb15503c7..48c91ec97 100644 --- a/qcsrc/common/triggers/func/door.qc +++ b/qcsrc/common/triggers/func/door.qc @@ -37,14 +37,14 @@ void door_blocked(entity this, entity blocker) ) { // KIll Kill Kill!! #ifdef SVQC - Damage (blocker, this, this, 10000, DEATH_HURTTRIGGER.m_id, blocker.origin, '0 0 0'); + Damage (blocker, this, this, 10000, DEATH_HURTTRIGGER.m_id, DMG_NOWEP, blocker.origin, '0 0 0'); #endif } else { #ifdef SVQC if((this.dmg) && (blocker.takedamage == DAMAGE_YES)) // Shall we bite? - Damage (blocker, this, this, this.dmg, DEATH_HURTTRIGGER.m_id, blocker.origin, '0 0 0'); + Damage (blocker, this, this, this.dmg, DEATH_HURTTRIGGER.m_id, DMG_NOWEP, blocker.origin, '0 0 0'); #endif // don't change direction for dead or dying stuff @@ -79,7 +79,7 @@ void door_blocked(entity this, entity blocker) { //gib dying stuff just to make sure if((this.dmg) && (blocker.takedamage != DAMAGE_NO)) // Shall we bite? - Damage (blocker, this, this, 10000, DEATH_HURTTRIGGER.m_id, blocker.origin, '0 0 0'); + Damage (blocker, this, this, 10000, DEATH_HURTTRIGGER.m_id, DMG_NOWEP, blocker.origin, '0 0 0'); } #endif } @@ -263,7 +263,7 @@ void door_use(entity this, entity actor, entity trigger) door_fire(this.owner, actor, trigger); } -void door_damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force) +void door_damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, .entity weaponentity, vector hitloc, vector force) { if(this.spawnflags & DOOR_NOSPLASH) if(!(DEATH_ISSPECIAL(deathtype)) && (deathtype & HITTYPE_SPLASH)) @@ -317,7 +317,7 @@ void door_generic_plat_blocked(entity this, entity blocker) { if((this.spawnflags & 8) && (blocker.takedamage != DAMAGE_NO)) { // Kill Kill Kill!! #ifdef SVQC - Damage (blocker, this, this, 10000, DEATH_HURTTRIGGER.m_id, blocker.origin, '0 0 0'); + Damage (blocker, this, this, 10000, DEATH_HURTTRIGGER.m_id, DMG_NOWEP, blocker.origin, '0 0 0'); #endif } else @@ -325,7 +325,7 @@ void door_generic_plat_blocked(entity this, entity blocker) #ifdef SVQC if((this.dmg) && (blocker.takedamage == DAMAGE_YES)) // Shall we bite? - Damage (blocker, this, this, this.dmg, DEATH_HURTTRIGGER.m_id, blocker.origin, '0 0 0'); + Damage (blocker, this, this, this.dmg, DEATH_HURTTRIGGER.m_id, DMG_NOWEP, blocker.origin, '0 0 0'); #endif //Dont chamge direction for dead or dying stuff @@ -344,7 +344,7 @@ void door_generic_plat_blocked(entity this, entity blocker) { //gib dying stuff just to make sure if((this.dmg) && (blocker.takedamage != DAMAGE_NO)) // Shall we bite? - Damage (blocker, this, this, 10000, DEATH_HURTTRIGGER.m_id, blocker.origin, '0 0 0'); + Damage (blocker, this, this, 10000, DEATH_HURTTRIGGER.m_id, DMG_NOWEP, blocker.origin, '0 0 0'); } #endif } diff --git a/qcsrc/common/triggers/func/door_secret.qc b/qcsrc/common/triggers/func/door_secret.qc index 6f2d101ef..555826964 100644 --- a/qcsrc/common/triggers/func/door_secret.qc +++ b/qcsrc/common/triggers/func/door_secret.qc @@ -66,7 +66,7 @@ void fd_secret_use(entity this, entity actor, entity trigger) _sound(this, CH_TRIGGER_SINGLE, this.noise2, VOL_BASE, ATTEN_NORM); } -void fd_secret_damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force) +void fd_secret_damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, .entity weaponentity, vector hitloc, vector force) { fd_secret_use(this, NULL, NULL); } diff --git a/qcsrc/common/triggers/misc/laser.qc b/qcsrc/common/triggers/misc/laser.qc index 2059a8126..45bd21fd1 100644 --- a/qcsrc/common/triggers/misc/laser.qc +++ b/qcsrc/common/triggers/misc/laser.qc @@ -118,7 +118,7 @@ void misc_laser_think(entity this) if(((this.spawnflags & 8) == 0) == (this.team != hitent.team)) return; if(hitent.takedamage) - Damage(hitent, this, this, ((this.dmg < 0) ? 100000 : (this.dmg * frametime)), DEATH_HURTTRIGGER.m_id, hitloc, '0 0 0'); + Damage(hitent, this, this, ((this.dmg < 0) ? 100000 : (this.dmg * frametime)), DEATH_HURTTRIGGER.m_id, DMG_NOWEP, hitloc, '0 0 0'); } } diff --git a/qcsrc/common/triggers/platforms.qc b/qcsrc/common/triggers/platforms.qc index 09e733000..8ea48275d 100644 --- a/qcsrc/common/triggers/platforms.qc +++ b/qcsrc/common/triggers/platforms.qc @@ -6,13 +6,13 @@ void generic_plat_blocked(entity this, entity blocker) { if(this.dmgtime2 < time) { - Damage (blocker, this, this, this.dmg, DEATH_HURTTRIGGER.m_id, blocker.origin, '0 0 0'); + Damage (blocker, this, this, this.dmg, DEATH_HURTTRIGGER.m_id, DMG_NOWEP, blocker.origin, '0 0 0'); this.dmgtime2 = time + this.dmgtime; } // Gib dead/dying stuff if(IS_DEAD(blocker)) - Damage (blocker, this, this, 10000, DEATH_HURTTRIGGER.m_id, blocker.origin, '0 0 0'); + Damage (blocker, this, this, 10000, DEATH_HURTTRIGGER.m_id, DMG_NOWEP, blocker.origin, '0 0 0'); } #endif } @@ -140,7 +140,7 @@ void plat_crush(entity this, entity blocker) if((this.spawnflags & 4) && (blocker.takedamage != DAMAGE_NO)) { // KIll Kill Kill!! #ifdef SVQC - Damage (blocker, this, this, 10000, DEATH_HURTTRIGGER.m_id, blocker.origin, '0 0 0'); + Damage (blocker, this, this, 10000, DEATH_HURTTRIGGER.m_id, DMG_NOWEP, blocker.origin, '0 0 0'); #endif } else @@ -148,10 +148,10 @@ void plat_crush(entity this, entity blocker) #ifdef SVQC if((this.dmg) && (blocker.takedamage != DAMAGE_NO)) { // Shall we bite? - Damage (blocker, this, this, this.dmg, DEATH_HURTTRIGGER.m_id, blocker.origin, '0 0 0'); + Damage (blocker, this, this, this.dmg, DEATH_HURTTRIGGER.m_id, DMG_NOWEP, blocker.origin, '0 0 0'); // Gib dead/dying stuff if(IS_DEAD(blocker)) - Damage (blocker, this, this, 10000, DEATH_HURTTRIGGER.m_id, blocker.origin, '0 0 0'); + Damage (blocker, this, this, 10000, DEATH_HURTTRIGGER.m_id, DMG_NOWEP, blocker.origin, '0 0 0'); } #endif diff --git a/qcsrc/common/triggers/target/kill.qc b/qcsrc/common/triggers/target/kill.qc index a821ac139..2751c600e 100644 --- a/qcsrc/common/triggers/target/kill.qc +++ b/qcsrc/common/triggers/target/kill.qc @@ -10,7 +10,7 @@ void target_kill_use(entity this, entity actor, entity trigger) if(!actor.iscreature && !actor.damagedbytriggers) return; - Damage(actor, this, trigger, 1000, DEATH_HURTTRIGGER.m_id, actor.origin, '0 0 0'); + Damage(actor, this, trigger, 1000, DEATH_HURTTRIGGER.m_id, DMG_NOWEP, actor.origin, '0 0 0'); } spawnfunc(target_kill) diff --git a/qcsrc/common/triggers/teleporters.qc b/qcsrc/common/triggers/teleporters.qc index 5aedf3021..25626e01b 100644 --- a/qcsrc/common/triggers/teleporters.qc +++ b/qcsrc/common/triggers/teleporters.qc @@ -51,11 +51,11 @@ void tdeath(entity player, entity teleporter, entity telefragger, vector telefra if(IS_PLAYER(head)) if(head.health >= 1) ++tdeath_hit; - Damage (head, teleporter, telefragger, 10000, DEATH_TELEFRAG.m_id, head.origin, '0 0 0'); + Damage (head, teleporter, telefragger, 10000, DEATH_TELEFRAG.m_id, DMG_NOWEP, head.origin, '0 0 0'); } } else // dead bodies and monsters gib themselves instead of telefragging - Damage (telefragger, teleporter, telefragger, 10000, DEATH_TELEFRAG.m_id, telefragger.origin, '0 0 0'); + Damage (telefragger, teleporter, telefragger, 10000, DEATH_TELEFRAG.m_id, DMG_NOWEP, telefragger.origin, '0 0 0'); } } diff --git a/qcsrc/common/triggers/trigger/hurt.qc b/qcsrc/common/triggers/trigger/hurt.qc index d0ba4ebd1..9c09f923b 100644 --- a/qcsrc/common/triggers/trigger/hurt.qc +++ b/qcsrc/common/triggers/trigger/hurt.qc @@ -35,7 +35,7 @@ void trigger_hurt_touch(entity this, entity toucher) this.enemy = NULL; // I still hate you all } - Damage (toucher, this, own, this.dmg, DEATH_HURTTRIGGER.m_id, toucher.origin, '0 0 0'); + Damage (toucher, this, own, this.dmg, DEATH_HURTTRIGGER.m_id, DMG_NOWEP, toucher.origin, '0 0 0'); } } else if(toucher.damagedbytriggers) @@ -43,7 +43,7 @@ void trigger_hurt_touch(entity this, entity toucher) if(toucher.takedamage) { EXACTTRIGGER_TOUCH(this, toucher); - Damage(toucher, this, this, this.dmg, DEATH_HURTTRIGGER.m_id, toucher.origin, '0 0 0'); + Damage(toucher, this, this, this.dmg, DEATH_HURTTRIGGER.m_id, DMG_NOWEP, toucher.origin, '0 0 0'); } } diff --git a/qcsrc/common/triggers/trigger/multi.qc b/qcsrc/common/triggers/trigger/multi.qc index 2f32e50fa..24b7d5f2a 100644 --- a/qcsrc/common/triggers/trigger/multi.qc +++ b/qcsrc/common/triggers/trigger/multi.qc @@ -97,7 +97,7 @@ void multi_touch(entity this, entity toucher) multi_trigger(this); } -void multi_eventdamage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force) +void multi_eventdamage(entity this, entity inflictor, entity attacker, float damage, int deathtype, .entity weaponentity, vector hitloc, vector force) { if(!this.takedamage) return; diff --git a/qcsrc/common/triggers/trigger/swamp.qc b/qcsrc/common/triggers/trigger/swamp.qc index 71c5247c7..058e41ca2 100644 --- a/qcsrc/common/triggers/trigger/swamp.qc +++ b/qcsrc/common/triggers/trigger/swamp.qc @@ -55,7 +55,7 @@ void swampslug_think(entity this) // Or we have exited it very recently. // Do the damage and renew the timer. #ifdef SVQC - Damage (this.owner, this, this, this.dmg, DEATH_SWAMP.m_id, this.owner.origin, '0 0 0'); + Damage (this.owner, this, this, this.dmg, DEATH_SWAMP.m_id, DMG_NOWEP, this.owner.origin, '0 0 0'); #endif this.nextthink = time + this.swamp_interval; diff --git a/qcsrc/common/turrets/sv_turrets.qc b/qcsrc/common/turrets/sv_turrets.qc index cb69bf0ff..21da98a48 100644 --- a/qcsrc/common/turrets/sv_turrets.qc +++ b/qcsrc/common/turrets/sv_turrets.qc @@ -212,7 +212,7 @@ void turret_die(entity this) } } -void turret_damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector vforce) +void turret_damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, .entity weaponentity, vector hitloc, vector vforce) { // Enough already! if(this.deadflag == DEAD_DEAD) @@ -439,11 +439,11 @@ void turret_projectile_explode(entity this) this.event_damage = func_null; #ifdef TURRET_DEBUG float d; - d = RadiusDamage (this, this.owner, this.owner.shot_dmg, 0, this.owner.shot_radius, this, NULL, this.owner.shot_force, this.totalfrags, NULL); + d = RadiusDamage (this, this.owner, this.owner.shot_dmg, 0, this.owner.shot_radius, this, NULL, this.owner.shot_force, this.totalfrags, DMG_NOWEP, NULL); this.owner.tur_debug_dmg_t_h = this.owner.tur_debug_dmg_t_h + d; this.owner.tur_debug_dmg_t_f = this.owner.tur_debug_dmg_t_f + this.owner.shot_dmg; #else - RadiusDamage (this, this.realowner, this.owner.shot_dmg, 0, this.owner.shot_radius, this, NULL, this.owner.shot_force, this.totalfrags, NULL); + RadiusDamage (this, this.realowner, this.owner.shot_dmg, 0, this.owner.shot_radius, this, NULL, this.owner.shot_force, this.totalfrags, DMG_NOWEP, NULL); #endif delete(this); } @@ -454,7 +454,7 @@ void turret_projectile_touch(entity this, entity toucher) turret_projectile_explode(this); } -void turret_projectile_damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector vforce) +void turret_projectile_damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, .entity weaponentity, vector hitloc, vector vforce) { this.velocity += vforce; this.health -= damage; diff --git a/qcsrc/common/turrets/turret/flac_weapon.qc b/qcsrc/common/turrets/turret/flac_weapon.qc index 10d53aa08..0195d5789 100644 --- a/qcsrc/common/turrets/turret/flac_weapon.qc +++ b/qcsrc/common/turrets/turret/flac_weapon.qc @@ -41,11 +41,11 @@ void turret_flac_projectile_think_explode(entity this) setorigin(this, this.enemy.origin + randomvec() * this.owner.shot_radius); #ifdef TURRET_DEBUG - float d = RadiusDamage (this, this.owner, this.owner.shot_dmg, this.owner.shot_dmg, this.owner.shot_radius, this, NULL, this.owner.shot_force, this.totalfrags, NULL); + float d = RadiusDamage (this, this.owner, this.owner.shot_dmg, this.owner.shot_dmg, this.owner.shot_radius, this, NULL, this.owner.shot_force, this.totalfrags, DMG_NOWEP, NULL); this.owner.tur_dbg_dmg_t_h = this.owner.tur_dbg_dmg_t_h + d; this.owner.tur_dbg_dmg_t_f = this.owner.tur_dbg_dmg_t_f + this.owner.shot_dmg; #else - RadiusDamage (this, this.realowner, this.owner.shot_dmg, this.owner.shot_dmg, this.owner.shot_radius, this, NULL, this.owner.shot_force, this.totalfrags, NULL); + RadiusDamage (this, this.realowner, this.owner.shot_dmg, this.owner.shot_dmg, this.owner.shot_radius, this, NULL, this.owner.shot_force, this.totalfrags, DMG_NOWEP, NULL); #endif delete(this); } diff --git a/qcsrc/common/turrets/turret/tesla_weapon.qc b/qcsrc/common/turrets/turret/tesla_weapon.qc index 88ca4db97..4593cc940 100644 --- a/qcsrc/common/turrets/turret/tesla_weapon.qc +++ b/qcsrc/common/turrets/turret/tesla_weapon.qc @@ -73,7 +73,7 @@ entity toast(entity actor, entity from, float range, float damage) if (etarget) { te_csqc_lightningarc(from.origin, etarget.origin); - Damage(etarget, actor, actor, damage, DEATH_TURRET_TESLA.m_id, etarget.origin, '0 0 0'); + Damage(etarget, actor, actor, damage, DEATH_TURRET_TESLA.m_id, DMG_NOWEP, etarget.origin, '0 0 0'); etarget.railgunhit = true; IL_PUSH(g_railgunhit, etarget); } diff --git a/qcsrc/common/turrets/turret/walker.qc b/qcsrc/common/turrets/turret/walker.qc index 415d5dfee..8cf795a93 100644 --- a/qcsrc/common/turrets/turret/walker.qc +++ b/qcsrc/common/turrets/turret/walker.qc @@ -62,7 +62,7 @@ void walker_melee_do_dmg(entity this) { if (turret_validate_target(this, e, this.target_validate_flags)) if (e != this && e.owner != this) - Damage(e, this, this, (autocvar_g_turrets_unit_walker_melee_damage), DEATH_TURRET_WALK_MELEE.m_id, '0 0 0', v_forward * (autocvar_g_turrets_unit_walker_melee_force)); + Damage(e, this, this, (autocvar_g_turrets_unit_walker_melee_damage), DEATH_TURRET_WALK_MELEE.m_id, DMG_NOWEP, '0 0 0', v_forward * (autocvar_g_turrets_unit_walker_melee_force)); e = e.chain; } @@ -75,7 +75,7 @@ void walker_setnoanim(entity this) } void walker_rocket_explode(entity this) { - RadiusDamage (this, this.owner, (autocvar_g_turrets_unit_walker_rocket_damage), 0, (autocvar_g_turrets_unit_walker_rocket_radius), this, NULL, (autocvar_g_turrets_unit_walker_rocket_force), DEATH_TURRET_WALK_ROCKET.m_id, NULL); + RadiusDamage (this, this.owner, (autocvar_g_turrets_unit_walker_rocket_damage), 0, (autocvar_g_turrets_unit_walker_rocket_radius), this, NULL, (autocvar_g_turrets_unit_walker_rocket_force), DEATH_TURRET_WALK_ROCKET.m_id, DMG_NOWEP, NULL); delete(this); } @@ -84,7 +84,7 @@ void walker_rocket_touch(entity this, entity toucher) walker_rocket_explode(this); } -void walker_rocket_damage(entity this, entity inflictor, entity attacker, float damage, float deathtype, vector hitloc, vector vforce) +void walker_rocket_damage(entity this, entity inflictor, entity attacker, float damage, float deathtype, .entity weaponentity, vector hitloc, vector vforce) { this.health = this.health - damage; this.velocity = this.velocity + vforce; diff --git a/qcsrc/common/turrets/util.qc b/qcsrc/common/turrets/util.qc index d4cbb4fb1..5201f4751 100644 --- a/qcsrc/common/turrets/util.qc +++ b/qcsrc/common/turrets/util.qc @@ -85,7 +85,7 @@ void FireImoBeam(entity this, vector start, vector end, vector smin, vector smax // apply the damage if (ent.takedamage) { - Damage (ent, this, this, f_dmg, deathtype, hitloc, force); + Damage (ent, this, this, f_dmg, deathtype, DMG_NOWEP, hitloc, force); ent.velocity = ent.velocity * f_velfactor; //ent.alpha = 0.25 + random() * 0.75; } diff --git a/qcsrc/common/vehicles/sv_vehicles.qc b/qcsrc/common/vehicles/sv_vehicles.qc index 5505d5d58..63d662923 100644 --- a/qcsrc/common/vehicles/sv_vehicles.qc +++ b/qcsrc/common/vehicles/sv_vehicles.qc @@ -201,7 +201,7 @@ vector vehicles_force_fromtag_maglev(entity this, string tag_name, float spring_ } // projectile handling -void vehicles_projectile_damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force) +void vehicles_projectile_damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, .entity weaponentity, vector hitloc, vector force) { // Ignore damage from oterh projectiles from my owner (dont mess up volly's) if(inflictor.owner == this.owner) @@ -232,7 +232,7 @@ void vehicles_projectile_explode(entity this, entity toucher) PROJECTILE_TOUCH(this, toucher); this.event_damage = func_null; - RadiusDamage (this, this.realowner, this.shot_dmg, 0, this.shot_radius, this, NULL, this.shot_force, this.totalfrags, toucher); + RadiusDamage (this, this.realowner, this.shot_dmg, 0, this.shot_radius, this, NULL, this.shot_force, this.totalfrags, DMG_NOWEP, toucher); delete(this); } @@ -640,7 +640,7 @@ void vehicles_frame(entity this, entity actor) vehicles_painframe(this); } -void vehicles_damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force) +void vehicles_damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, .entity weaponentity, vector hitloc, vector force) { this.dmg_time = time; @@ -753,7 +753,7 @@ void vehicles_impact(entity this, float _minspeed, float _speedfac, float _maxpa if(_minspeed < wc) { float take = min(_speedfac * wc, _maxpain); - Damage (this, NULL, NULL, take, DEATH_FALL.m_id, this.origin, '0 0 0'); + Damage (this, NULL, NULL, take, DEATH_FALL.m_id, DMG_NOWEP, this.origin, '0 0 0'); this.play_time = time + 0.25; //dprint("wc: ", ftos(wc), "\n"); @@ -901,7 +901,7 @@ void vehicles_touch(entity this, entity toucher) if(vehicles_crushable(toucher)) { if(vdist(this.velocity, >=, 30)) - Damage(toucher, this, this.owner, autocvar_g_vehicles_crush_dmg, DEATH_VH_CRUSH.m_id, '0 0 0', normalize(toucher.origin - this.origin) * autocvar_g_vehicles_crush_force); + Damage(toucher, this, this.owner, autocvar_g_vehicles_crush_dmg, DEATH_VH_CRUSH.m_id, DMG_NOWEP, '0 0 0', normalize(toucher.origin - this.origin) * autocvar_g_vehicles_crush_force); return; // Dont do selfdamage when hitting "soft targets". } diff --git a/qcsrc/common/vehicles/vehicle/bumblebee.qc b/qcsrc/common/vehicles/vehicle/bumblebee.qc index 018e1a17d..f0519aa21 100644 --- a/qcsrc/common/vehicles/vehicle/bumblebee.qc +++ b/qcsrc/common/vehicles/vehicle/bumblebee.qc @@ -538,7 +538,7 @@ bool bumblebee_pilot_frame(entity this, float dt) { if(autocvar_g_vehicle_bumblebee_raygun) { - Damage(trace_ent, vehic, this, autocvar_g_vehicle_bumblebee_raygun_dps * PHYS_INPUT_FRAMETIME, DEATH_GENERIC.m_id, trace_endpos, v_forward * autocvar_g_vehicle_bumblebee_raygun_fps * PHYS_INPUT_FRAMETIME); + Damage(trace_ent, vehic, this, autocvar_g_vehicle_bumblebee_raygun_dps * PHYS_INPUT_FRAMETIME, DEATH_GENERIC.m_id, DMG_NOWEP, trace_endpos, v_forward * autocvar_g_vehicle_bumblebee_raygun_fps * PHYS_INPUT_FRAMETIME); vehic.vehicle_energy -= autocvar_g_vehicle_bumblebee_raygun_aps * PHYS_INPUT_FRAMETIME; } else @@ -676,7 +676,7 @@ void bumblebee_blowup(entity this) autocvar_g_vehicle_bumblebee_blowup_edgedamage, autocvar_g_vehicle_bumblebee_blowup_radius, this, NULL, autocvar_g_vehicle_bumblebee_blowup_forceintensity, - DEATH_VH_BUMB_DEATH.m_id, NULL); + DEATH_VH_BUMB_DEATH.m_id, DMG_NOWEP, NULL); sound(this, CH_SHOTS, SND_ROCKET_IMPACT, VOL_BASE, ATTEN_NORM); Send_Effect(EFFECT_EXPLOSION_BIG, (this.origin + '0 0 100') + (randomvec() * 80), '0 0 0', 1); diff --git a/qcsrc/common/vehicles/vehicle/racer.qc b/qcsrc/common/vehicles/vehicle/racer.qc index 8dbfae467..70ee753e0 100644 --- a/qcsrc/common/vehicles/vehicle/racer.qc +++ b/qcsrc/common/vehicles/vehicle/racer.qc @@ -462,7 +462,7 @@ void racer_blowup(entity this) autocvar_g_vehicle_racer_blowup_edgedamage, autocvar_g_vehicle_racer_blowup_radius, NULL, NULL, autocvar_g_vehicle_racer_blowup_forceintensity, - DEATH_VH_WAKI_DEATH.m_id, NULL); + DEATH_VH_WAKI_DEATH.m_id, DMG_NOWEP, NULL); this.nextthink = time + autocvar_g_vehicle_racer_respawntime; setthink(this, vehicles_spawn); diff --git a/qcsrc/common/vehicles/vehicle/raptor.qc b/qcsrc/common/vehicles/vehicle/raptor.qc index d7ef38abc..a80efdab3 100644 --- a/qcsrc/common/vehicles/vehicle/raptor.qc +++ b/qcsrc/common/vehicles/vehicle/raptor.qc @@ -493,7 +493,7 @@ void raptor_blowup(entity this, entity toucher) { this.deadflag = DEAD_DEAD; this.vehicle_exit(this, VHEF_NORMAL); - RadiusDamage (this, this.enemy, 250, 15, 250, NULL, NULL, 250, DEATH_VH_RAPT_DEATH.m_id, NULL); + RadiusDamage (this, this.enemy, 250, 15, 250, NULL, NULL, 250, DEATH_VH_RAPT_DEATH.m_id, DMG_NOWEP, NULL); this.alpha = -1; set_movetype(this, MOVETYPE_NONE); diff --git a/qcsrc/common/vehicles/vehicle/raptor_weapons.qc b/qcsrc/common/vehicles/vehicle/raptor_weapons.qc index 514d67c0e..7d7d7e71d 100644 --- a/qcsrc/common/vehicles/vehicle/raptor_weapons.qc +++ b/qcsrc/common/vehicles/vehicle/raptor_weapons.qc @@ -50,7 +50,7 @@ METHOD(RaptorBomb, wr_think, void(entity thiswep, entity actor, .entity weaponen } void raptor_flare_think(entity this); -void raptor_flare_damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force); +void raptor_flare_damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, .entity weaponentity, vector hitloc, vector force); void raptor_flare_touch(entity this, entity toucher); METHOD(RaptorFlare, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire)) { @@ -88,7 +88,7 @@ void raptor_bomblet_boom(entity this) RadiusDamage (this, this.realowner, autocvar_g_vehicle_raptor_bomblet_damage, autocvar_g_vehicle_raptor_bomblet_edgedamage, autocvar_g_vehicle_raptor_bomblet_radius, NULL, NULL, - autocvar_g_vehicle_raptor_bomblet_force, DEATH_VH_RAPT_BOMB.m_id, NULL); + autocvar_g_vehicle_raptor_bomblet_force, DEATH_VH_RAPT_BOMB.m_id, DMG_NOWEP, NULL); delete(this); } @@ -189,7 +189,7 @@ void raptor_flare_touch(entity this, entity toucher) delete(this); } -void raptor_flare_damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force) +void raptor_flare_damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, .entity weaponentity, vector hitloc, vector force) { this.health -= damage; if(this.health <= 0) diff --git a/qcsrc/common/vehicles/vehicle/spiderbot.qc b/qcsrc/common/vehicles/vehicle/spiderbot.qc index 57486a2f3..a0954b501 100644 --- a/qcsrc/common/vehicles/vehicle/spiderbot.qc +++ b/qcsrc/common/vehicles/vehicle/spiderbot.qc @@ -449,7 +449,7 @@ void spiderbot_blowup(entity this) SUB_SetFade(g1, time, min(this.respawntime, 10)); SUB_SetFade(g2, time, min(this.respawntime, 10)); - RadiusDamage (this, this.enemy, 250, 15, 250, NULL, NULL, 250, DEATH_VH_SPID_DEATH.m_id, NULL); + RadiusDamage (this, this.enemy, 250, 15, 250, NULL, NULL, 250, DEATH_VH_SPID_DEATH.m_id, DMG_NOWEP, NULL); this.alpha = this.tur_head.alpha = this.gun1.alpha = this.gun2.alpha = -1; set_movetype(this, MOVETYPE_NONE); diff --git a/qcsrc/common/weapons/weapon/arc.qc b/qcsrc/common/weapons/weapon/arc.qc index 763a979df..430bceb6d 100644 --- a/qcsrc/common/weapons/weapon/arc.qc +++ b/qcsrc/common/weapons/weapon/arc.qc @@ -94,7 +94,7 @@ void Arc_Player_SetHeat(entity player, .entity weaponentity) void W_Arc_Bolt_Explode(entity this, entity directhitentity) { this.event_damage = func_null; - RadiusDamage(this, this.realowner, WEP_CVAR(arc, bolt_damage), WEP_CVAR(arc, bolt_edgedamage), WEP_CVAR(arc, bolt_radius), NULL, NULL, WEP_CVAR(arc, bolt_force), this.projectiledeathtype, directhitentity); + RadiusDamage(this, this.realowner, WEP_CVAR(arc, bolt_damage), WEP_CVAR(arc, bolt_edgedamage), WEP_CVAR(arc, bolt_radius), NULL, NULL, WEP_CVAR(arc, bolt_force), this.projectiledeathtype, this.weaponentity_fld, directhitentity); delete(this); } @@ -104,7 +104,7 @@ void W_Arc_Bolt_Explode_use(entity this, entity actor, entity trigger) W_Arc_Bolt_Explode(this, trigger); } -void W_Arc_Bolt_Damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force) +void W_Arc_Bolt_Damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, .entity weaponentity, vector hitloc, vector force) { if(this.health <= 0) return; @@ -154,6 +154,7 @@ void W_Arc_Attack_Bolt(Weapon thiswep, entity actor, .entity weaponentity) missile.nextthink = time + WEP_CVAR(arc, bolt_lifetime); PROJECTILE_MAKETRIGGER(missile); missile.projectiledeathtype = WEP_ARC.m_id | HITTYPE_SECONDARY; + missile.weaponentity_fld = weaponentity; setorigin(missile, w_shotorg); setsize(missile, '0 0 0', '0 0 0'); @@ -504,6 +505,7 @@ void W_Arc_Beam_Think(entity this) own, rootdamage * coefficient * falloff, WEP_ARC.m_id, + weaponentity, hitorigin, WEP_CVAR(arc, beam_force) * new_dir * coefficient * falloff ); diff --git a/qcsrc/common/weapons/weapon/blaster.qc b/qcsrc/common/weapons/weapon/blaster.qc index 2189c1db2..be6664960 100644 --- a/qcsrc/common/weapons/weapon/blaster.qc +++ b/qcsrc/common/weapons/weapon/blaster.qc @@ -18,6 +18,7 @@ void W_Blaster_Touch(entity this, entity toucher) NULL, this.blaster_force, this.projectiledeathtype, + this.weaponentity_fld, toucher ); @@ -88,6 +89,7 @@ void W_Blaster_Attack( IL_PUSH(g_bot_dodge, missile); missile.missile_flags = MIF_SPLASH; missile.projectiledeathtype = atk_deathtype; + missile.weaponentity_fld = weaponentity; setthink(missile, W_Blaster_Think); missile.nextthink = time + atk_delay; diff --git a/qcsrc/common/weapons/weapon/crylink.qc b/qcsrc/common/weapons/weapon/crylink.qc index 246452fe6..94cf04f0f 100644 --- a/qcsrc/common/weapons/weapon/crylink.qc +++ b/qcsrc/common/weapons/weapon/crylink.qc @@ -66,7 +66,7 @@ void W_Crylink_LinkExplode(entity e, entity e2, entity directhitentity) float isprimary = !(e.projectiledeathtype & HITTYPE_SECONDARY); RadiusDamage(e, e.realowner, WEP_CVAR_BOTH(crylink, isprimary, damage) * a, WEP_CVAR_BOTH(crylink, isprimary, edgedamage) * a, WEP_CVAR_BOTH(crylink, isprimary, radius), - NULL, NULL, WEP_CVAR_BOTH(crylink, isprimary, force) * a, e.projectiledeathtype, directhitentity); + NULL, NULL, WEP_CVAR_BOTH(crylink, isprimary, force) * a, e.projectiledeathtype, e.weaponentity_fld, directhitentity); W_Crylink_LinkExplode(e.queuenext, e2, directhitentity); @@ -196,6 +196,7 @@ void W_Crylink_LinkJoinEffect_Think(entity this) NULL, WEP_CVAR_BOTH(crylink, isprimary, joinexplode_force) * n, e.projectiledeathtype, + e.weaponentity_fld, NULL ); Send_Effect(EFFECT_CRYLINK_JOINEXPLODE, this.origin, '0 0 0', n); @@ -246,7 +247,8 @@ void W_Crylink_Touch(entity this, entity toucher) if(a) f *= a; - float totaldamage = RadiusDamage(this, this.realowner, WEP_CVAR_BOTH(crylink, isprimary, damage) * f, WEP_CVAR_BOTH(crylink, isprimary, edgedamage) * f, WEP_CVAR_BOTH(crylink, isprimary, radius), NULL, NULL, WEP_CVAR_BOTH(crylink, isprimary, force) * f, this.projectiledeathtype, toucher); + float totaldamage = RadiusDamage(this, this.realowner, WEP_CVAR_BOTH(crylink, isprimary, damage) * f, WEP_CVAR_BOTH(crylink, isprimary, edgedamage) * f, WEP_CVAR_BOTH(crylink, isprimary, radius), + NULL, NULL, WEP_CVAR_BOTH(crylink, isprimary, force) * f, this.projectiledeathtype, this.weaponentity_fld, toucher); if(totaldamage && ((WEP_CVAR_BOTH(crylink, isprimary, linkexplode) == 2) || ((WEP_CVAR_BOTH(crylink, isprimary, linkexplode) == 1) && !W_Crylink_Touch_WouldHitFriendly(this, WEP_CVAR_BOTH(crylink, isprimary, radius))))) { diff --git a/qcsrc/common/weapons/weapon/devastator.qc b/qcsrc/common/weapons/weapon/devastator.qc index 46db8358c..3d0df1d47 100644 --- a/qcsrc/common/weapons/weapon/devastator.qc +++ b/qcsrc/common/weapons/weapon/devastator.qc @@ -38,6 +38,7 @@ void W_Devastator_Explode(entity this, entity directhitentity) NULL, WEP_CVAR(devastator, force), this.projectiledeathtype, + this.weaponentity_fld, directhitentity ); @@ -112,6 +113,7 @@ void W_Devastator_DoRemoteExplode(entity this, .entity weaponentity) head, (WEP_CVAR(devastator, remote_jump_force) ? WEP_CVAR(devastator, remote_jump_force) : 0), this.projectiledeathtype | HITTYPE_BOUNCE, + this.weaponentity_fld, NULL ); break; @@ -131,6 +133,7 @@ void W_Devastator_DoRemoteExplode(entity this, .entity weaponentity) NULL, WEP_CVAR(devastator, remote_force), this.projectiledeathtype | HITTYPE_BOUNCE, + this.weaponentity_fld, NULL ); @@ -276,7 +279,7 @@ void W_Devastator_Touch(entity this, entity toucher) W_Devastator_Explode(this, toucher); } -void W_Devastator_Damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force) +void W_Devastator_Damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, .entity weaponentity, vector hitloc, vector force) { if(this.health <= 0) return; diff --git a/qcsrc/common/weapons/weapon/electro.qc b/qcsrc/common/weapons/weapon/electro.qc index 05f306174..8b8512946 100644 --- a/qcsrc/common/weapons/weapon/electro.qc +++ b/qcsrc/common/weapons/weapon/electro.qc @@ -65,6 +65,7 @@ void W_Electro_ExplodeCombo(entity this) NULL, WEP_CVAR(electro, combo_force), WEP_ELECTRO.m_id | HITTYPE_BOUNCE, // use THIS type for a combo because primary can't bounce + this.weaponentity_fld, NULL ); @@ -95,6 +96,7 @@ void W_Electro_Explode(entity this, entity directhitentity) NULL, WEP_CVAR_SEC(electro, force), this.projectiledeathtype, + this.weaponentity_fld, directhitentity ); } @@ -111,6 +113,7 @@ void W_Electro_Explode(entity this, entity directhitentity) NULL, WEP_CVAR_PRI(electro, force), this.projectiledeathtype, + this.weaponentity_fld, directhitentity ); } @@ -216,6 +219,7 @@ void W_Electro_Attack_Bolt(Weapon thiswep, entity actor, .entity weaponentity) proj.ltime = time + WEP_CVAR_PRI(electro, lifetime); PROJECTILE_MAKETRIGGER(proj); proj.projectiledeathtype = WEP_ELECTRO.m_id; + proj.weaponentity_fld = weaponentity; setorigin(proj, w_shotorg); // if (IS_CSQC) @@ -261,6 +265,7 @@ void W_Electro_Orb_Stick(entity this, entity to) set_movetype(newproj, MOVETYPE_NONE); // lock the orb in place newproj.projectiledeathtype = this.projectiledeathtype; + newproj.weaponentity_fld = this.weaponentity_fld; settouch(newproj, func_null); setthink(newproj, getthink(this)); @@ -292,7 +297,7 @@ void W_Electro_Orb_Touch(entity this, entity toucher) } } -void W_Electro_Orb_Damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force) +void W_Electro_Orb_Damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, .entity weaponentity, vector hitloc, vector force) { if(this.health <= 0) return; @@ -363,6 +368,7 @@ void W_Electro_Attack_Orb(Weapon thiswep, entity actor, .entity weaponentity) proj.nextthink = time + WEP_CVAR_SEC(electro, lifetime); PROJECTILE_MAKETRIGGER(proj); proj.projectiledeathtype = WEP_ELECTRO.m_id | HITTYPE_SECONDARY; + proj.weaponentity_fld = weaponentity; setorigin(proj, w_shotorg); //proj.glow_size = 50; diff --git a/qcsrc/common/weapons/weapon/fireball.qc b/qcsrc/common/weapons/weapon/fireball.qc index 3f6830f33..dc33a8d59 100644 --- a/qcsrc/common/weapons/weapon/fireball.qc +++ b/qcsrc/common/weapons/weapon/fireball.qc @@ -15,7 +15,7 @@ void W_Fireball_Explode(entity this, entity directhitentity) // 1. dist damage d = (this.realowner.health + this.realowner.armorvalue); - RadiusDamage(this, this.realowner, WEP_CVAR_PRI(fireball, damage), WEP_CVAR_PRI(fireball, edgedamage), WEP_CVAR_PRI(fireball, radius), NULL, NULL, WEP_CVAR_PRI(fireball, force), this.projectiledeathtype, directhitentity); + RadiusDamage(this, this.realowner, WEP_CVAR_PRI(fireball, damage), WEP_CVAR_PRI(fireball, edgedamage), WEP_CVAR_PRI(fireball, radius), NULL, NULL, WEP_CVAR_PRI(fireball, force), this.projectiledeathtype, this.weaponentity_fld, directhitentity); if(this.realowner.health + this.realowner.armorvalue >= d) if(!this.cnt) { @@ -44,7 +44,7 @@ void W_Fireball_Explode(entity this, entity directhitentity) if(accuracy_isgooddamage(this.realowner, e)) accuracy_add(this.realowner, WEP_FIREBALL.m_id, 0, WEP_CVAR_PRI(fireball, bfgdamage) * points); - Damage(e, this, this.realowner, WEP_CVAR_PRI(fireball, bfgdamage) * points, this.projectiledeathtype | HITTYPE_BOUNCE | HITTYPE_SPLASH, e.origin + e.view_ofs, WEP_CVAR_PRI(fireball, bfgforce) * dir); + Damage(e, this, this.realowner, WEP_CVAR_PRI(fireball, bfgdamage) * points, this.projectiledeathtype | HITTYPE_BOUNCE | HITTYPE_SPLASH, this.weaponentity_fld, e.origin + e.view_ofs, WEP_CVAR_PRI(fireball, bfgforce) * dir); Send_Effect(EFFECT_FIREBALL_BFGDAMAGE, e.origin, -1 * dir, 1); } } @@ -117,7 +117,7 @@ void W_Fireball_Think(entity this) this.nextthink = time + 0.1; } -void W_Fireball_Damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force) +void W_Fireball_Damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, .entity weaponentity, vector hitloc, vector force) { if(this.health <= 0) return; @@ -154,6 +154,8 @@ void W_Fireball_Attack1(entity actor, .entity weaponentity) proj.damageforcescale = WEP_CVAR_PRI(fireball, damageforcescale); PROJECTILE_MAKETRIGGER(proj); proj.projectiledeathtype = WEP_FIREBALL.m_id; + proj.weaponentity_fld = weaponentity; + proj.weaponentity_fld = weaponentity; setorigin(proj, w_shotorg); set_movetype(proj, MOVETYPE_FLY); diff --git a/qcsrc/common/weapons/weapon/hagar.qc b/qcsrc/common/weapons/weapon/hagar.qc index b7c4c8c16..0d8d94f59 100644 --- a/qcsrc/common/weapons/weapon/hagar.qc +++ b/qcsrc/common/weapons/weapon/hagar.qc @@ -7,7 +7,7 @@ void W_Hagar_Explode(entity this, entity directhitentity) { this.event_damage = func_null; - RadiusDamage(this, this.realowner, WEP_CVAR_PRI(hagar, damage), WEP_CVAR_PRI(hagar, edgedamage), WEP_CVAR_PRI(hagar, radius), NULL, NULL, WEP_CVAR_PRI(hagar, force), this.projectiledeathtype, directhitentity); + RadiusDamage(this, this.realowner, WEP_CVAR_PRI(hagar, damage), WEP_CVAR_PRI(hagar, edgedamage), WEP_CVAR_PRI(hagar, radius), NULL, NULL, WEP_CVAR_PRI(hagar, force), this.projectiledeathtype, this.weaponentity_fld, directhitentity); delete(this); } @@ -20,7 +20,7 @@ void W_Hagar_Explode_use(entity this, entity actor, entity trigger) void W_Hagar_Explode2(entity this, entity directhitentity) { this.event_damage = func_null; - RadiusDamage(this, this.realowner, WEP_CVAR_SEC(hagar, damage), WEP_CVAR_SEC(hagar, edgedamage), WEP_CVAR_SEC(hagar, radius), NULL, NULL, WEP_CVAR_SEC(hagar, force), this.projectiledeathtype, directhitentity); + RadiusDamage(this, this.realowner, WEP_CVAR_SEC(hagar, damage), WEP_CVAR_SEC(hagar, edgedamage), WEP_CVAR_SEC(hagar, radius), NULL, NULL, WEP_CVAR_SEC(hagar, force), this.projectiledeathtype, this.weaponentity_fld, directhitentity); delete(this); } @@ -30,7 +30,7 @@ void W_Hagar_Explode2_use(entity this, entity actor, entity trigger) W_Hagar_Explode2(this, trigger); } -void W_Hagar_Damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force) +void W_Hagar_Damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, .entity weaponentity, vector hitloc, vector force) { if(this.health <= 0) return; @@ -103,6 +103,7 @@ void W_Hagar_Attack(Weapon thiswep, entity actor, .entity weaponentity) missile.nextthink = time + WEP_CVAR_PRI(hagar, lifetime); PROJECTILE_MAKETRIGGER(missile); missile.projectiledeathtype = WEP_HAGAR.m_id; + missile.weaponentity_fld = weaponentity; setorigin(missile, w_shotorg); setsize(missile, '0 0 0', '0 0 0'); @@ -149,6 +150,7 @@ void W_Hagar_Attack2(Weapon thiswep, entity actor, .entity weaponentity) missile.nextthink = time + WEP_CVAR_SEC(hagar, lifetime_min) + random() * WEP_CVAR_SEC(hagar, lifetime_rand); PROJECTILE_MAKETRIGGER(missile); missile.projectiledeathtype = WEP_HAGAR.m_id | HITTYPE_SECONDARY; + missile.weaponentity_fld = weaponentity; setorigin(missile, w_shotorg); setsize(missile, '0 0 0', '0 0 0'); diff --git a/qcsrc/common/weapons/weapon/hlac.qc b/qcsrc/common/weapons/weapon/hlac.qc index ae6c9a663..cdc0747c2 100644 --- a/qcsrc/common/weapons/weapon/hlac.qc +++ b/qcsrc/common/weapons/weapon/hlac.qc @@ -12,7 +12,8 @@ void W_HLAC_Touch(entity this, entity toucher) isprimary = !(this.projectiledeathtype & HITTYPE_SECONDARY); - RadiusDamage(this, this.realowner, WEP_CVAR_BOTH(hlac, isprimary, damage), WEP_CVAR_BOTH(hlac, isprimary, edgedamage), WEP_CVAR_BOTH(hlac, isprimary, radius), NULL, NULL, WEP_CVAR_BOTH(hlac, isprimary, force), this.projectiledeathtype, toucher); + RadiusDamage(this, this.realowner, WEP_CVAR_BOTH(hlac, isprimary, damage), WEP_CVAR_BOTH(hlac, isprimary, edgedamage), WEP_CVAR_BOTH(hlac, isprimary, radius), + NULL, NULL, WEP_CVAR_BOTH(hlac, isprimary, force), this.projectiledeathtype, this.weaponentity_fld, toucher); delete(this); } @@ -61,6 +62,7 @@ void W_HLAC_Attack(Weapon thiswep, entity actor, .entity weaponentity) IL_PUSH(g_projectiles, missile); IL_PUSH(g_bot_dodge, missile); missile.projectiledeathtype = WEP_HLAC.m_id; + missile.weaponentity_fld = weaponentity; CSQCProjectile(missile, true, PROJECTILE_HLAC, true); @@ -106,6 +108,7 @@ void W_HLAC_Attack2(entity actor, .entity weaponentity) IL_PUSH(g_bot_dodge, missile); missile.missile_flags = MIF_SPLASH; missile.projectiledeathtype = WEP_HLAC.m_id | HITTYPE_SECONDARY; + missile.weaponentity_fld = weaponentity; CSQCProjectile(missile, true, PROJECTILE_HLAC, true); diff --git a/qcsrc/common/weapons/weapon/hook.qc b/qcsrc/common/weapons/weapon/hook.qc index 13b5661fe..c8cf49f17 100644 --- a/qcsrc/common/weapons/weapon/hook.qc +++ b/qcsrc/common/weapons/weapon/hook.qc @@ -12,7 +12,7 @@ void W_Hook_ExplodeThink(entity this) f = this.dmg_last - dmg_remaining_next; this.dmg_last = dmg_remaining_next; - RadiusDamage(this, this.realowner, this.dmg * f, this.dmg_edge * f, this.dmg_radius, this.realowner, NULL, this.dmg_force * f, this.projectiledeathtype, NULL); + RadiusDamage(this, this.realowner, this.dmg * f, this.dmg_edge * f, this.dmg_radius, this.realowner, NULL, this.dmg_force * f, this.projectiledeathtype, this.weaponentity_fld, NULL); this.projectiledeathtype |= HITTYPE_BOUNCE; //RadiusDamage(this, NULL, this.dmg * f, this.dmg_edge * f, this.dmg_radius, NULL, NULL, this.dmg_force * f, this.projectiledeathtype, NULL); @@ -46,7 +46,7 @@ void W_Hook_Explode2_use(entity this, entity actor, entity trigger) W_Hook_Explode2(this); } -void W_Hook_Damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force) +void W_Hook_Damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, .entity weaponentity, vector hitloc, vector force) { if(this.health <= 0) return; @@ -78,6 +78,7 @@ void W_Hook_Attack2(Weapon thiswep, entity actor, .entity weaponentity) set_movetype(gren, MOVETYPE_TOSS); PROJECTILE_MAKETRIGGER(gren); gren.projectiledeathtype = WEP_HOOK.m_id | HITTYPE_SECONDARY; + gren.weaponentity_fld = weaponentity; setorigin(gren, w_shotorg); setsize(gren, '0 0 0', '0 0 0'); diff --git a/qcsrc/common/weapons/weapon/minelayer.qc b/qcsrc/common/weapons/weapon/minelayer.qc index 727ac08c6..411ac7b9b 100644 --- a/qcsrc/common/weapons/weapon/minelayer.qc +++ b/qcsrc/common/weapons/weapon/minelayer.qc @@ -64,7 +64,7 @@ void W_MineLayer_Explode(entity this, entity directhitentity) this.event_damage = func_null; this.takedamage = DAMAGE_NO; - RadiusDamage(this, this.realowner, WEP_CVAR(minelayer, damage), WEP_CVAR(minelayer, edgedamage), WEP_CVAR(minelayer, radius), NULL, NULL, WEP_CVAR(minelayer, force), this.projectiledeathtype, directhitentity); + RadiusDamage(this, this.realowner, WEP_CVAR(minelayer, damage), WEP_CVAR(minelayer, edgedamage), WEP_CVAR(minelayer, radius), NULL, NULL, WEP_CVAR(minelayer, force), this.projectiledeathtype, this.weaponentity_fld, directhitentity); .entity weaponentity = this.weaponentity_fld; if(this.realowner.(weaponentity).m_weapon == WEP_MINE_LAYER) @@ -96,7 +96,8 @@ void W_MineLayer_DoRemoteExplode(entity this) if(this.move_movetype == MOVETYPE_NONE || this.move_movetype == MOVETYPE_FOLLOW) this.velocity = this.mine_orientation; // particle fx and decals need .velocity - RadiusDamage(this, this.realowner, WEP_CVAR(minelayer, remote_damage), WEP_CVAR(minelayer, remote_edgedamage), WEP_CVAR(minelayer, remote_radius), NULL, NULL, WEP_CVAR(minelayer, remote_force), this.projectiledeathtype | HITTYPE_BOUNCE, NULL); + RadiusDamage(this, this.realowner, WEP_CVAR(minelayer, remote_damage), WEP_CVAR(minelayer, remote_edgedamage), WEP_CVAR(minelayer, remote_radius), + NULL, NULL, WEP_CVAR(minelayer, remote_force), this.projectiledeathtype | HITTYPE_BOUNCE, this.weaponentity_fld, NULL); .entity weaponentity = this.weaponentity_fld; if(this.realowner.(weaponentity).m_weapon == WEP_MINE_LAYER) @@ -246,7 +247,7 @@ void W_MineLayer_Touch(entity this, entity toucher) } } -void W_MineLayer_Damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force) +void W_MineLayer_Damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, .entity weaponentity, vector hitloc, vector force) { if(this.health <= 0) return; @@ -307,6 +308,7 @@ void W_MineLayer_Attack(Weapon thiswep, entity actor, .entity weaponentity) set_movetype(mine, MOVETYPE_TOSS); PROJECTILE_MAKETRIGGER(mine); mine.projectiledeathtype = WEP_MINE_LAYER.m_id; + mine.weaponentity_fld = weaponentity; setsize(mine, '-4 -4 -4', '4 4 4'); // give it some size so it can be shot setorigin(mine, w_shotorg - v_forward * 4); // move it back so it hits the wall at the right point diff --git a/qcsrc/common/weapons/weapon/mortar.qc b/qcsrc/common/weapons/weapon/mortar.qc index 6ada37cd6..cd56bb387 100644 --- a/qcsrc/common/weapons/weapon/mortar.qc +++ b/qcsrc/common/weapons/weapon/mortar.qc @@ -17,7 +17,7 @@ void W_Mortar_Grenade_Explode(entity this, entity directhitentity) if(this.move_movetype == MOVETYPE_NONE) this.velocity = this.oldvelocity; - RadiusDamage(this, this.realowner, WEP_CVAR_PRI(mortar, damage), WEP_CVAR_PRI(mortar, edgedamage), WEP_CVAR_PRI(mortar, radius), NULL, NULL, WEP_CVAR_PRI(mortar, force), this.projectiledeathtype, directhitentity); + RadiusDamage(this, this.realowner, WEP_CVAR_PRI(mortar, damage), WEP_CVAR_PRI(mortar, edgedamage), WEP_CVAR_PRI(mortar, radius), NULL, NULL, WEP_CVAR_PRI(mortar, force), this.projectiledeathtype, this.weaponentity_fld, directhitentity); delete(this); } @@ -42,7 +42,7 @@ void W_Mortar_Grenade_Explode2(entity this, entity directhitentity) if(this.move_movetype == MOVETYPE_NONE) this.velocity = this.oldvelocity; - RadiusDamage(this, this.realowner, WEP_CVAR_SEC(mortar, damage), WEP_CVAR_SEC(mortar, edgedamage), WEP_CVAR_SEC(mortar, radius), NULL, NULL, WEP_CVAR_SEC(mortar, force), this.projectiledeathtype, directhitentity); + RadiusDamage(this, this.realowner, WEP_CVAR_SEC(mortar, damage), WEP_CVAR_SEC(mortar, edgedamage), WEP_CVAR_SEC(mortar, radius), NULL, NULL, WEP_CVAR_SEC(mortar, force), this.projectiledeathtype, this.weaponentity_fld, directhitentity); delete(this); } @@ -52,7 +52,7 @@ void W_Mortar_Grenade_Explode2_use(entity this, entity actor, entity trigger) W_Mortar_Grenade_Explode2(this, trigger); } -void W_Mortar_Grenade_Damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force) +void W_Mortar_Grenade_Damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, .entity weaponentity, vector hitloc, vector force) { if(this.health <= 0) return; @@ -165,6 +165,7 @@ void W_Mortar_Attack(Weapon thiswep, entity actor, .entity weaponentity) gren.bouncestop = WEP_CVAR(mortar, bouncestop); PROJECTILE_MAKETRIGGER(gren); gren.projectiledeathtype = WEP_MORTAR.m_id; + gren.weaponentity_fld = weaponentity; setorigin(gren, w_shotorg); setsize(gren, '-3 -3 -3', '3 3 3'); @@ -216,6 +217,7 @@ void W_Mortar_Attack2(Weapon thiswep, entity actor, .entity weaponentity) gren.bouncestop = WEP_CVAR(mortar, bouncestop); PROJECTILE_MAKETRIGGER(gren); gren.projectiledeathtype = WEP_MORTAR.m_id | HITTYPE_SECONDARY; + gren.weaponentity_fld = weaponentity; setorigin(gren, w_shotorg); setsize(gren, '-3 -3 -3', '3 3 3'); diff --git a/qcsrc/common/weapons/weapon/seeker.qc b/qcsrc/common/weapons/weapon/seeker.qc index 5e3faeeab..494697403 100644 --- a/qcsrc/common/weapons/weapon/seeker.qc +++ b/qcsrc/common/weapons/weapon/seeker.qc @@ -8,7 +8,7 @@ void W_Seeker_Missile_Explode(entity this, entity directhitentity) { this.event_damage = func_null; - RadiusDamage(this, this.realowner, WEP_CVAR(seeker, missile_damage), WEP_CVAR(seeker, missile_edgedamage), WEP_CVAR(seeker, missile_radius), NULL, NULL, WEP_CVAR(seeker, missile_force), this.projectiledeathtype, directhitentity); + RadiusDamage(this, this.realowner, WEP_CVAR(seeker, missile_damage), WEP_CVAR(seeker, missile_edgedamage), WEP_CVAR(seeker, missile_radius), NULL, NULL, WEP_CVAR(seeker, missile_force), this.projectiledeathtype, this.weaponentity_fld, directhitentity); delete(this); } @@ -122,7 +122,7 @@ void W_Seeker_Missile_Think(entity this) -void W_Seeker_Missile_Damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force) +void W_Seeker_Missile_Damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, .entity weaponentity, vector hitloc, vector force) { if(this.health <= 0) return; @@ -189,6 +189,7 @@ void W_Seeker_Fire_Missile(Weapon thiswep, entity actor, .entity weaponentity, v missile.solid = SOLID_BBOX; missile.scale = 2; missile.takedamage = DAMAGE_YES; + missile.weaponentity_fld = weaponentity; missile.health = WEP_CVAR(seeker, missile_health); missile.damageforcescale = WEP_CVAR(seeker, missile_damageforcescale); missile.damagedbycontents = true; @@ -225,7 +226,7 @@ void W_Seeker_Flac_Explode(entity this, entity directhitentity) { this.event_damage = func_null; - RadiusDamage(this, this.realowner, WEP_CVAR(seeker, flac_damage), WEP_CVAR(seeker, flac_edgedamage), WEP_CVAR(seeker, flac_radius), NULL, NULL, WEP_CVAR(seeker, flac_force), this.projectiledeathtype, directhitentity); + RadiusDamage(this, this.realowner, WEP_CVAR(seeker, flac_damage), WEP_CVAR(seeker, flac_edgedamage), WEP_CVAR(seeker, flac_radius), NULL, NULL, WEP_CVAR(seeker, flac_force), this.projectiledeathtype, this.weaponentity_fld, directhitentity); delete(this); } @@ -282,6 +283,7 @@ void W_Seeker_Fire_Flac(Weapon thiswep, entity actor, .entity weaponentity) set_movetype(missile, MOVETYPE_FLY); missile.projectiledeathtype = WEP_SEEKER.m_id; missile.projectiledeathtype = WEP_SEEKER.m_id | HITTYPE_SECONDARY; + missile.weaponentity_fld = weaponentity; missile.flags = FL_PROJECTILE; IL_PUSH(g_projectiles, missile); IL_PUSH(g_bot_dodge, missile); @@ -412,7 +414,7 @@ void W_Seeker_Tag_Explode(entity this) delete(this); } -void W_Seeker_Tag_Damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force) +void W_Seeker_Tag_Damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, .entity weaponentity, vector hitloc, vector force) { if(this.health <= 0) return; diff --git a/qcsrc/common/weapons/weapon/shockwave.qc b/qcsrc/common/weapons/weapon/shockwave.qc index 0ca4d528f..af158c7df 100644 --- a/qcsrc/common/weapons/weapon/shockwave.qc +++ b/qcsrc/common/weapons/weapon/shockwave.qc @@ -99,6 +99,7 @@ void W_Shockwave_Melee_Think(entity this) this.realowner, swing_damage, (WEP_SHOCKWAVE.m_id | HITTYPE_SECONDARY), + this.weaponentity_fld, (this.realowner.origin + this.realowner.view_ofs), (v_forward * WEP_CVAR(shockwave, melee_force)) ); @@ -155,6 +156,7 @@ void W_Shockwave_Melee(Weapon thiswep, entity actor, .entity weaponentity, int f meleetemp.owner = meleetemp.realowner = actor; setthink(meleetemp, W_Shockwave_Melee_Think); meleetemp.nextthink = time + WEP_CVAR(shockwave, melee_delay) * W_WeaponRateFactor(actor); + meleetemp.weaponentity_fld = weaponentity; W_SetupShot_Range(actor, weaponentity, true, 0, SND_Null, 0, WEP_CVAR(shockwave, melee_damage), WEP_CVAR(shockwave, melee_range)); } @@ -384,6 +386,7 @@ void W_Shockwave_Attack(entity actor, .entity weaponentity) actor, final_damage, WEP_SHOCKWAVE.m_id, + weaponentity, head.origin, final_force ); @@ -568,6 +571,7 @@ void W_Shockwave_Attack(entity actor, .entity weaponentity) actor, final_damage, WEP_SHOCKWAVE.m_id, + weaponentity, head.origin, final_force ); diff --git a/qcsrc/common/weapons/weapon/shotgun.qc b/qcsrc/common/weapons/weapon/shotgun.qc index 9ffef6428..56e113208 100644 --- a/qcsrc/common/weapons/weapon/shotgun.qc +++ b/qcsrc/common/weapons/weapon/shotgun.qc @@ -91,7 +91,7 @@ void W_Shotgun_Melee_Think(entity this) //print(strcat(this.realowner.netname, " hitting ", target_victim.netname, " with ", strcat(ftos(swing_damage), " damage (factor: ", ftos(swing_factor), ") at "), ftos(time), " seconds.\n")); Damage(target_victim, this.realowner, this.realowner, - swing_damage, WEP_SHOTGUN.m_id | HITTYPE_SECONDARY, + swing_damage, WEP_SHOTGUN.m_id | HITTYPE_SECONDARY, this.weaponentity_fld, this.realowner.origin + this.realowner.view_ofs, v_forward * WEP_CVAR_SEC(shotgun, force)); @@ -136,6 +136,7 @@ void W_Shotgun_Attack2(Weapon thiswep, entity actor, .entity weaponentity, int f meleetemp.realowner = actor; setthink(meleetemp, W_Shotgun_Melee_Think); meleetemp.nextthink = time + WEP_CVAR_SEC(shotgun, melee_delay) * W_WeaponRateFactor(actor); + meleetemp.weaponentity_fld = weaponentity; W_SetupShot_Range(actor, weaponentity, true, 0, SND_Null, 0, WEP_CVAR_SEC(shotgun, damage), WEP_CVAR_SEC(shotgun, melee_range)); } diff --git a/qcsrc/common/weapons/weapon/tuba.qc b/qcsrc/common/weapons/weapon/tuba.qc index 37c36964a..306688717 100644 --- a/qcsrc/common/weapons/weapon/tuba.qc +++ b/qcsrc/common/weapons/weapon/tuba.qc @@ -305,7 +305,7 @@ void W_Tuba_NoteOn(entity actor, .entity weaponentity, float hittype) actor.(weaponentity).tuba_note.teleport_time = time + WEP_CVAR(tuba, refire) * 2 * W_WeaponRateFactor(actor); // so it can get prolonged safely //sound(actor, c, TUBA_NOTE(n), bound(0, VOL_BASE * cvar("g_balance_tuba_volume"), 1), autocvar_g_balance_tuba_attenuation); - RadiusDamage(actor, actor, WEP_CVAR(tuba, damage), WEP_CVAR(tuba, edgedamage), WEP_CVAR(tuba, radius), NULL, NULL, WEP_CVAR(tuba, force), hittype | WEP_TUBA.m_id, NULL); + RadiusDamage(actor, actor, WEP_CVAR(tuba, damage), WEP_CVAR(tuba, edgedamage), WEP_CVAR(tuba, radius), NULL, NULL, WEP_CVAR(tuba, force), hittype | WEP_TUBA.m_id, weaponentity, NULL); o = gettaginfo(actor.exteriorweaponentity, 0); if(time > actor.(weaponentity).tuba_smoketime) diff --git a/qcsrc/common/weapons/weapon/vaporizer.qc b/qcsrc/common/weapons/weapon/vaporizer.qc index 4a9475a9c..4c049c1d1 100644 --- a/qcsrc/common/weapons/weapon/vaporizer.qc +++ b/qcsrc/common/weapons/weapon/vaporizer.qc @@ -106,14 +106,14 @@ NET_HANDLE(TE_CSQC_VAPORBEAMPARTICLE, bool isNew) #ifdef SVQC -void W_RocketMinsta_Explosion(entity actor, vector loc) +void W_RocketMinsta_Explosion(entity actor, .entity weaponentity, vector loc) { if(accuracy_canbegooddamage(actor)) accuracy_add(actor, WEP_DEVASTATOR.m_id, autocvar_g_rm_damage, 0); entity dmgent = spawn(); dmgent.owner = dmgent.realowner = actor; setorigin(dmgent, loc); - RadiusDamage (dmgent, actor, autocvar_g_rm_damage, autocvar_g_rm_edgedamage, autocvar_g_rm_radius, NULL, NULL, autocvar_g_rm_force, WEP_DEVASTATOR.m_id | HITTYPE_SPLASH, NULL); + RadiusDamage (dmgent, actor, autocvar_g_rm_damage, autocvar_g_rm_edgedamage, autocvar_g_rm_radius, NULL, NULL, autocvar_g_rm_force, WEP_DEVASTATOR.m_id | HITTYPE_SPLASH, weaponentity, NULL); delete(dmgent); } @@ -146,7 +146,7 @@ void W_Vaporizer_Attack(Weapon thiswep, entity actor, .entity weaponentity) if(autocvar_g_rm) if(!(trace_dphitq3surfaceflags & (Q3SURFACEFLAG_SKY | Q3SURFACEFLAG_NOIMPACT))) - W_RocketMinsta_Explosion(actor, trace_endpos); + W_RocketMinsta_Explosion(actor, weaponentity, trace_endpos); W_DecreaseAmmo(thiswep, actor, ((g_instagib) ? 1 : WEP_CVAR_PRI(vaporizer, ammo)), weaponentity); } @@ -162,7 +162,7 @@ void W_RocketMinsta_Laser_Explode (entity this, entity directhitentity) this.event_damage = func_null; this.takedamage = DAMAGE_NO; - RadiusDamage (this, this.realowner, this.rm_damage, this.rm_edmg, autocvar_g_rm_laser_radius, NULL, NULL, this.rm_force, this.projectiledeathtype, directhitentity); + RadiusDamage (this, this.realowner, this.rm_damage, this.rm_edmg, autocvar_g_rm_laser_radius, NULL, NULL, this.rm_force, this.projectiledeathtype, this.weaponentity_fld, directhitentity); delete(this); } @@ -175,7 +175,7 @@ void W_RocketMinsta_Laser_Touch(entity this, entity toucher) { PROJECTILE_TOUCH(this, toucher); //W_RocketMinsta_Laser_Explode (); - RadiusDamage(this, this.realowner, this.rm_damage, this.rm_edmg, autocvar_g_rm_laser_radius, NULL, NULL, this.rm_force, this.projectiledeathtype, toucher); + RadiusDamage(this, this.realowner, this.rm_damage, this.rm_edmg, autocvar_g_rm_laser_radius, NULL, NULL, this.rm_force, this.projectiledeathtype, this.weaponentity_fld, toucher); delete(this); } @@ -207,6 +207,7 @@ void W_RocketMinsta_Attack2(entity actor, .entity weaponentity) proj.nextthink = time + autocvar_g_rm_laser_lifetime; PROJECTILE_MAKETRIGGER(proj); proj.projectiledeathtype = WEP_ELECTRO.m_id; + proj.weaponentity_fld = weaponentity; setorigin(proj, w_shotorg); proj.rm_force = autocvar_g_rm_laser_force / total; @@ -261,6 +262,7 @@ void W_RocketMinsta_Attack3 (entity actor, .entity weaponentity) proj.nextthink = time + autocvar_g_rm_laser_lifetime; PROJECTILE_MAKETRIGGER(proj); proj.projectiledeathtype = WEP_ELECTRO.m_id; + proj.weaponentity_fld = weaponentity; setorigin(proj, w_shotorg); proj.rm_force = autocvar_g_rm_laser_force / total; diff --git a/qcsrc/server/cheats.qc b/qcsrc/server/cheats.qc index 3233a141d..9608ee792 100644 --- a/qcsrc/server/cheats.qc +++ b/qcsrc/server/cheats.qc @@ -279,7 +279,7 @@ float CheatImpulse(entity this, int imp) e2 = spawn(); setorigin(e2, e.origin); - RadiusDamage(e2, this, 1000, 0, 128, NULL, NULL, 500, DEATH_CHEAT.m_id, e); + RadiusDamage(e2, this, 1000, 0, 128, NULL, NULL, 500, DEATH_CHEAT.m_id, DMG_NOWEP, e); delete(e2); LOG_INFO("404 Sportsmanship not found."); diff --git a/qcsrc/server/client.qc b/qcsrc/server/client.qc index 38869cea4..77f863f37 100644 --- a/qcsrc/server/client.qc +++ b/qcsrc/server/client.qc @@ -920,7 +920,7 @@ void ClientKill_Now(entity this) if(!this.killindicator_teamchange) { this.vehicle_health = -1; - Damage(this, this, this, 1 , DEATH_KILL.m_id, this.origin, '0 0 0'); + Damage(this, this, this, 1 , DEATH_KILL.m_id, DMG_NOWEP, this.origin, '0 0 0'); } } @@ -934,7 +934,7 @@ void ClientKill_Now(entity this) if (!IS_SPEC(this) && !IS_OBSERVER(this) && MUTATOR_CALLHOOK(ClientKill_Now, this) == false) { - Damage(this, this, this, 100000, DEATH_KILL.m_id, this.origin, '0 0 0'); + Damage(this, this, this, 100000, DEATH_KILL.m_id, DMG_NOWEP, this.origin, '0 0 0'); } // now I am sure the player IS dead @@ -1687,7 +1687,7 @@ void player_regen(entity this) if(this.vehicle) vehicles_exit(this.vehicle, VHEF_RELEASE); if(this.event_damage) - this.event_damage(this, this, this, 1, DEATH_ROT.m_id, this.origin, '0 0 0'); + this.event_damage(this, this, this, 1, DEATH_ROT.m_id, DMG_NOWEP, this.origin, '0 0 0'); } if (!(this.items & IT_UNLIMITED_WEAPON_AMMO)) @@ -2556,7 +2556,7 @@ void PlayerPreThink (entity this) if (this.vehicle) vehicles_exit(this.vehicle, VHEF_RELEASE); if(this.event_damage) - this.event_damage(this, this, this.frozen_by, 1, DEATH_NADE_ICE_FREEZE.m_id, this.origin, '0 0 0'); + this.event_damage(this, this, this.frozen_by, 1, DEATH_NADE_ICE_FREEZE.m_id, DMG_NOWEP, this.origin, '0 0 0'); } else if (this.revive_progress <= 0) Unfreeze(this); @@ -2669,7 +2669,7 @@ void DrownPlayer(entity this) { // drown! if (this.pain_finished < time) { - Damage (this, NULL, NULL, autocvar_g_balance_contents_playerdamage_drowning * autocvar_g_balance_contents_damagerate, DEATH_DROWN.m_id, this.origin, '0 0 0'); + Damage (this, NULL, NULL, autocvar_g_balance_contents_playerdamage_drowning * autocvar_g_balance_contents_damagerate, DEATH_DROWN.m_id, DMG_NOWEP, this.origin, '0 0 0'); this.pain_finished = time + 0.5; } } diff --git a/qcsrc/server/command/common.qc b/qcsrc/server/command/common.qc index 46d1d2b6f..2f7467eab 100644 --- a/qcsrc/server/command/common.qc +++ b/qcsrc/server/command/common.qc @@ -405,7 +405,7 @@ void CommonCommand_editmob(int request, entity caller, int argc) if (mon.realowner != caller && autocvar_g_monsters_edit < 2) { print_to(caller, "This monster does not belong to you"); return; } if (!is_visible) { print_to(caller, "You must look at your monster to edit it"); return; } - Damage(mon, NULL, NULL, mon.health + mon.max_health + 200, DEATH_KILL.m_id, mon.origin, '0 0 0'); + Damage(mon, NULL, NULL, mon.health + mon.max_health + 200, DEATH_KILL.m_id, DMG_NOWEP, mon.origin, '0 0 0'); print_to(caller, strcat("Your pet '", mon.monster_name, "' has been brutally mutilated")); return; } diff --git a/qcsrc/server/defs.qh b/qcsrc/server/defs.qh index 577753a50..d8bc4b027 100644 --- a/qcsrc/server/defs.qh +++ b/qcsrc/server/defs.qh @@ -34,7 +34,7 @@ float server_is_dedicated; // Fields -.void(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force) event_damage; +.void(entity this, entity inflictor, entity attacker, float damage, int deathtype, .entity weaponentity, vector hitloc, vector force) event_damage; //.string wad; //.string map; @@ -228,7 +228,7 @@ int have_team_spawns_forteams; // if Xth bit is 1 then team X has spawns else it .bool canteamdamage; -void Damage (entity targ, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force); +void Damage (entity targ, entity inflictor, entity attacker, float damage, int deathtype, .entity weaponentity, vector hitloc, vector force); float lockteams; diff --git a/qcsrc/server/g_damage.qc b/qcsrc/server/g_damage.qc index 75bf81f8a..44774a1d6 100644 --- a/qcsrc/server/g_damage.qc +++ b/qcsrc/server/g_damage.qc @@ -32,7 +32,7 @@ void UpdateFrags(entity player, int f) GameRules_scoring_add_team(player, SCORE, f); } -void GiveFrags (entity attacker, entity targ, float f, int deathtype) +void GiveFrags (entity attacker, entity targ, float f, int deathtype, .entity weaponentity) { // TODO route through PlayerScores instead if(game_stopped) return; @@ -60,8 +60,6 @@ void GiveFrags (entity attacker, entity targ, float f, int deathtype) GameRules_scoring_add(targ, DEATHS, 1); - .entity weaponentity = weaponentities[0]; // TODO: unhardcode - if(targ != attacker) // not for suicides if(g_weaponarena_random) { @@ -266,7 +264,7 @@ bool frag_centermessage_override(entity attacker, entity targ, int deathtype, in .int buffs = _STAT(BUFFS); // TODO: remove entity buff_FirstFromFlags(int _buffs); -void Obituary(entity attacker, entity inflictor, entity targ, int deathtype) +void Obituary(entity attacker, entity inflictor, entity targ, int deathtype, .entity weaponentity) { // Sanity check if (!IS_PLAYER(targ)) { backtrace("Obituary called on non-player?!\n"); return; } @@ -328,7 +326,7 @@ void Obituary(entity attacker, entity inflictor, entity targ, int deathtype) } LogDeath("suicide", deathtype, targ, targ); if(deathtype != DEATH_AUTOTEAMCHANGE.m_id) // special case: don't negate frags if auto switched - GiveFrags(attacker, targ, -1, deathtype); + GiveFrags(attacker, targ, -1, deathtype, weaponentity); } // ====== @@ -339,7 +337,7 @@ void Obituary(entity attacker, entity inflictor, entity targ, int deathtype) if(SAME_TEAM(attacker, targ)) { LogDeath("tk", deathtype, attacker, targ); - GiveFrags(attacker, targ, -1, deathtype); + GiveFrags(attacker, targ, -1, deathtype, weaponentity); CS(attacker).killcount = 0; @@ -353,7 +351,7 @@ void Obituary(entity attacker, entity inflictor, entity targ, int deathtype) else { LogDeath("frag", deathtype, attacker, targ); - GiveFrags(attacker, targ, 1, deathtype); + GiveFrags(attacker, targ, 1, deathtype, weaponentity); CS(attacker).taunt_soundtime = time + 1; CS(attacker).killcount = CS(attacker).killcount + 1; @@ -494,7 +492,7 @@ void Obituary(entity attacker, entity inflictor, entity targ, int deathtype) } LogDeath("accident", deathtype, targ, targ); - GiveFrags(targ, targ, -1, deathtype); + GiveFrags(targ, targ, -1, deathtype, weaponentity); if(GameRules_scoring_add(targ, SCORE, 0) == -5) { @@ -607,7 +605,7 @@ void Unfreeze (entity targ) targ.iceblock = NULL; } -void Damage (entity targ, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force) +void Damage (entity targ, entity inflictor, entity attacker, float damage, int deathtype, .entity weaponentity, vector hitloc, vector force) { float complainteamdamage = 0; float mirrordamage = 0; @@ -724,9 +722,9 @@ void Damage (entity targ, entity inflictor, entity attacker, float damage, int d { for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot) { - .entity weaponentity = weaponentities[slot]; - if(targ.(weaponentity).hook && targ.(weaponentity).hook.aiment == attacker) - RemoveHook(targ.(weaponentity).hook); + .entity went = weaponentities[slot]; + if(targ.(went).hook && targ.(went).hook.aiment == attacker) + RemoveHook(targ.(went).hook); } } @@ -896,7 +894,7 @@ void Damage (entity targ, entity inflictor, entity attacker, float damage, int d // apply damage if (damage != 0 || (targ.damageforcescale && force)) if (targ.event_damage) - targ.event_damage (targ, inflictor, attacker, damage, deathtype, hitloc, force); + targ.event_damage (targ, inflictor, attacker, damage, deathtype, weaponentity, hitloc, force); // apply mirror damage if any if(!autocvar_g_mirrordamage_onlyweapons || DEATH_WEAPONOF(deathtype) != WEP_Null) @@ -905,11 +903,12 @@ void Damage (entity targ, entity inflictor, entity attacker, float damage, int d attacker = attacker_save; force = normalize(attacker.origin + attacker.view_ofs - hitloc) * mirrorforce; - Damage(attacker, inflictor, attacker, mirrordamage, DEATH_MIRRORDAMAGE.m_id, attacker.origin, force); + Damage(attacker, inflictor, attacker, mirrordamage, DEATH_MIRRORDAMAGE.m_id, weaponentity, attacker.origin, force); } } -float RadiusDamageForSource (entity inflictor, vector inflictororigin, vector inflictorvelocity, entity attacker, float coredamage, float edgedamage, float rad, entity cantbe, entity mustbe, float inflictorselfdamage, float forceintensity, int deathtype, entity directhitentity) +float RadiusDamageForSource (entity inflictor, vector inflictororigin, vector inflictorvelocity, entity attacker, float coredamage, float edgedamage, float rad, entity cantbe, entity mustbe, + float inflictorselfdamage, float forceintensity, int deathtype, .entity weaponentity, entity directhitentity) // Returns total damage applies to creatures { entity targ; @@ -1080,9 +1079,9 @@ float RadiusDamageForSource (entity inflictor, vector inflictororigin, vector in } if(targ == directhitentity || DEATH_ISSPECIAL(deathtype)) - Damage (targ, inflictor, attacker, finaldmg, deathtype, nearest, force); + Damage (targ, inflictor, attacker, finaldmg, deathtype, weaponentity, nearest, force); else - Damage (targ, inflictor, attacker, finaldmg, deathtype | HITTYPE_SPLASH, nearest, force); + Damage (targ, inflictor, attacker, finaldmg, deathtype | HITTYPE_SPLASH, weaponentity, nearest, force); } } } @@ -1098,9 +1097,9 @@ float RadiusDamageForSource (entity inflictor, vector inflictororigin, vector in return total_damage_to_creatures; } -float RadiusDamage (entity inflictor, entity attacker, float coredamage, float edgedamage, float rad, entity cantbe, entity mustbe, float forceintensity, int deathtype, entity directhitentity) +float RadiusDamage (entity inflictor, entity attacker, float coredamage, float edgedamage, float rad, entity cantbe, entity mustbe, float forceintensity, int deathtype, .entity weaponentity, entity directhitentity) { - return RadiusDamageForSource (inflictor, (inflictor.origin + (inflictor.mins + inflictor.maxs) * 0.5), inflictor.velocity, attacker, coredamage, edgedamage, rad, cantbe, mustbe, false, forceintensity, deathtype, directhitentity); + return RadiusDamageForSource (inflictor, (inflictor.origin + (inflictor.mins + inflictor.maxs) * 0.5), inflictor.velocity, attacker, coredamage, edgedamage, rad, cantbe, mustbe, false, forceintensity, deathtype, weaponentity, directhitentity); } float Fire_IsBurning(entity e) @@ -1253,7 +1252,7 @@ void Fire_ApplyDamage(entity e) hi = e.fire_owner.damage_dealt; ty = e.fire_owner.typehitsound; - Damage(e, e, e.fire_owner, d, e.fire_deathtype, e.origin, '0 0 0'); + Damage(e, e, e.fire_owner, d, e.fire_deathtype, DMG_NOWEP, e.origin, '0 0 0'); if(e.fire_hitsound && e.fire_owner) { e.fire_owner.damage_dealt = hi; diff --git a/qcsrc/server/g_damage.qh b/qcsrc/server/g_damage.qh index aee4a93df..6b1d32e0c 100644 --- a/qcsrc/server/g_damage.qh +++ b/qcsrc/server/g_damage.qh @@ -59,7 +59,7 @@ void UpdateFrags(entity player, int f); // NOTE: f=0 means still count as a (positive) kill, but count no frags for it void W_SwitchWeapon_Force(Player this, Weapon w, .entity weaponentity); entity GiveFrags_randomweapons; -void GiveFrags (entity attacker, entity targ, float f, int deathtype); +void GiveFrags (entity attacker, entity targ, float f, int deathtype, .entity weaponentity); string AppendItemcodes(string s, entity player); @@ -80,7 +80,7 @@ float Obituary_WeaponDeath( string s1, string s2, string s3, float f1, float f2); -void Obituary(entity attacker, entity inflictor, entity targ, int deathtype); +void Obituary(entity attacker, entity inflictor, entity targ, int deathtype, .entity weaponentity); void Ice_Think(entity this); @@ -88,13 +88,13 @@ void Freeze (entity targ, float freeze_time, float frozen_type, float show_waypo void Unfreeze (entity targ); -void Damage (entity targ, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force); +void Damage (entity targ, entity inflictor, entity attacker, float damage, int deathtype, .entity weaponentity, vector hitloc, vector force); float RadiusDamage_running; -float RadiusDamageForSource (entity inflictor, vector inflictororigin, vector inflictorvelocity, entity attacker, float coredamage, float edgedamage, float rad, entity cantbe, entity mustbe, float inflictorselfdamage, float forceintensity, int deathtype, entity directhitentity); +float RadiusDamageForSource (entity inflictor, vector inflictororigin, vector inflictorvelocity, entity attacker, float coredamage, float edgedamage, float rad, entity cantbe, entity mustbe, float inflictorselfdamage, float forceintensity, int deathtype, .entity weaponentity, entity directhitentity); // Returns total damage applies to creatures -float RadiusDamage (entity inflictor, entity attacker, float coredamage, float edgedamage, float rad, entity cantbe, entity mustbe, float forceintensity, int deathtype, entity directhitentity); +float RadiusDamage (entity inflictor, entity attacker, float coredamage, float edgedamage, float rad, entity cantbe, entity mustbe, float forceintensity, int deathtype, .entity weaponentity, entity directhitentity); .float fire_damagepersec; .float fire_endtime; @@ -112,3 +112,6 @@ float Fire_AddDamage(entity e, entity o, float d, float t, float dt); void Fire_ApplyDamage(entity e); void Fire_ApplyEffect(entity e); + +// WEAPONTODO +#define DMG_NOWEP (weaponentities[0]) diff --git a/qcsrc/server/g_hook.qc b/qcsrc/server/g_hook.qc index 0fc60b2cd..7c21c45dd 100644 --- a/qcsrc/server/g_hook.qc +++ b/qcsrc/server/g_hook.qc @@ -341,7 +341,7 @@ void GrapplingHookTouch(entity this, entity toucher) //this.realowner.disableclientprediction = true; } -void GrapplingHook_Damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force) +void GrapplingHook_Damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, .entity weaponentity, vector hitloc, vector force) { if(this.health <= 0) return; diff --git a/qcsrc/server/mutators/mutator/gamemode_ctf.qc b/qcsrc/server/mutators/mutator/gamemode_ctf.qc index 3c714ad53..cdda90724 100644 --- a/qcsrc/server/mutators/mutator/gamemode_ctf.qc +++ b/qcsrc/server/mutators/mutator/gamemode_ctf.qc @@ -304,7 +304,7 @@ void ctf_CaptureShield_Touch(entity this, entity toucher) vector mymid = (this.absmin + this.absmax) * 0.5; vector theirmid = (toucher.absmin + toucher.absmax) * 0.5; - Damage(toucher, this, this, 0, DEATH_HURTTRIGGER.m_id, mymid, normalize(theirmid - mymid) * ctf_captureshield_force); + Damage(toucher, this, this, 0, DEATH_HURTTRIGGER.m_id, DMG_NOWEP, mymid, normalize(theirmid - mymid) * ctf_captureshield_force); if(IS_REAL_CLIENT(toucher)) { Send_Notification(NOTIF_ONE, toucher, MSG_CENTER, CENTER_CTF_CAPTURESHIELD_SHIELDED); } } @@ -865,7 +865,7 @@ void ctf_CheckStalemate() } } -void ctf_FlagDamage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force) +void ctf_FlagDamage(entity this, entity inflictor, entity attacker, float damage, int deathtype, .entity weaponentity, vector hitloc, vector force) { if(ITEM_DAMAGE_NEEDKILL(deathtype)) { @@ -1695,7 +1695,7 @@ void havocbot_role_ctf_carrier(entity this) { // Can't navigate to my own base, suicide! // TODO: drop it and wander around - Damage(this, this, this, 100000, DEATH_KILL.m_id, this.origin, '0 0 0'); + Damage(this, this, this, 100000, DEATH_KILL.m_id, DMG_NOWEP, this.origin, '0 0 0'); return; } } diff --git a/qcsrc/server/mutators/mutator/gamemode_keyhunt.qc b/qcsrc/server/mutators/mutator/gamemode_keyhunt.qc index e6253b091..0610faabb 100644 --- a/qcsrc/server/mutators/mutator/gamemode_keyhunt.qc +++ b/qcsrc/server/mutators/mutator/gamemode_keyhunt.qc @@ -418,7 +418,7 @@ void kh_Key_AssignTo(entity key, entity player) // runs every time a key is pic } } -void kh_Key_Damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force) +void kh_Key_Damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, .entity weaponentity, vector hitloc, vector force) { if(this.owner) return; diff --git a/qcsrc/server/player.qc b/qcsrc/server/player.qc index 26fc9e659..af6b52074 100644 --- a/qcsrc/server/player.qc +++ b/qcsrc/server/player.qc @@ -167,7 +167,7 @@ void player_anim(entity this) animdecide_setimplicitstate(this, IS_ONGROUND(this)); } -void PlayerCorpseDamage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force) +void PlayerCorpseDamage(entity this, entity inflictor, entity attacker, float damage, int deathtype, .entity weaponentity, vector hitloc, vector force) { float take, save; vector v; @@ -307,7 +307,7 @@ void calculate_player_respawn_time(entity this) this.respawn_flags = this.respawn_flags | RESPAWN_FORCE; } -void PlayerDamage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force) +void PlayerDamage(entity this, entity inflictor, entity attacker, float damage, int deathtype, .entity weaponentity, vector hitloc, vector force) { float take, save, dh, da; vector v; @@ -487,7 +487,6 @@ void PlayerDamage(entity this, entity inflictor, entity attacker, float damage, bool valid_damage_for_weaponstats = false; Weapon awep = WEP_Null; - .entity weaponentity = weaponentities[0]; // TODO: unhardcode if(vbot || IS_REAL_CLIENT(this)) if(abot || IS_REAL_CLIENT(attacker)) @@ -551,7 +550,7 @@ void PlayerDamage(entity this, entity inflictor, entity attacker, float damage, // print an obituary message if(this.classname != "body") - Obituary (attacker, inflictor, this, deathtype); + Obituary (attacker, inflictor, this, deathtype, weaponentity); // increment frag counter for used weapon type Weapon w = DEATH_WEAPONOF(deathtype); @@ -567,9 +566,9 @@ void PlayerDamage(entity this, entity inflictor, entity attacker, float damage, for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot) { .entity went = weaponentities[slot]; - if(!this.(weaponentity)) + if(!this.(went)) continue; // TODO: clones have no weapon, but we don't want to have to check this all the time - Weapon wep = this.(weaponentity).m_weapon; + Weapon wep = this.(went).m_weapon; wep.wr_playerdeath(wep, this, went); } @@ -638,7 +637,7 @@ void PlayerDamage(entity this, entity inflictor, entity attacker, float damage, // set damage function to corpse damage this.event_damage = PlayerCorpseDamage; // call the corpse damage function just in case it wants to gib - this.event_damage(this, inflictor, attacker, excess, deathtype, hitloc, force); + this.event_damage(this, inflictor, attacker, excess, deathtype, weaponentity, hitloc, force); // set up to fade out later SUB_SetFade (this, time + 6 + random (), 1); @@ -653,7 +652,7 @@ void PlayerDamage(entity this, entity inflictor, entity attacker, float damage, if(autocvar_sv_gentle > 0 || autocvar_ekg || this.classname == "body") { // remove corpse // clones don't run any animation code any more, so we must gib them when they die :( - PlayerCorpseDamage(this, inflictor, attacker, autocvar_sv_gibhealth+1.0, deathtype, hitloc, force); + PlayerCorpseDamage(this, inflictor, attacker, autocvar_sv_gibhealth+1.0, deathtype, weaponentity, hitloc, force); } // reset fields the weapons may use just in case @@ -681,7 +680,7 @@ bool MoveToTeam(entity client, int team_colour, int type) { return false; } - Damage(client, client, client, 100000, DEATH_AUTOTEAMCHANGE.m_id, client.origin, '0 0 0'); // kill the player + Damage(client, client, client, 100000, DEATH_AUTOTEAMCHANGE.m_id, DMG_NOWEP, client.origin, '0 0 0'); // kill the player lockteams = lockteams_backup; // restore the team lock LogTeamchange(client.playerid, client.team, type); return true; diff --git a/qcsrc/server/player.qh b/qcsrc/server/player.qh index dfa485e5f..ee073ccb4 100644 --- a/qcsrc/server/player.qh +++ b/qcsrc/server/player.qh @@ -52,7 +52,7 @@ void player_setupanimsformodel(entity this); void player_anim(entity this); -void PlayerCorpseDamage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force); +void PlayerCorpseDamage(entity this, entity inflictor, entity attacker, float damage, int deathtype, .entity weaponentity, vector hitloc, vector force); // g__str: // If 0, default is used. @@ -76,6 +76,6 @@ void ClientKill_Now_TeamChange(entity this); /// \return True on success, false otherwise. bool MoveToTeam(entity client, float team_colour, float type); -void PlayerDamage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force); +void PlayerDamage(entity this, entity inflictor, entity attacker, float damage, int deathtype, .entity weaponentity, vector hitloc, vector force); int Say(entity source, float teamsay, entity privatesay, string msgin, float floodcontrol); diff --git a/qcsrc/server/portals.qc b/qcsrc/server/portals.qc index 20039cfcc..ca0dc20fd 100644 --- a/qcsrc/server/portals.qc +++ b/qcsrc/server/portals.qc @@ -429,7 +429,7 @@ void Portal_Remove(entity portal, float killed) } } -void Portal_Damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force) +void Portal_Damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, .entity weaponentity, vector hitloc, vector force) { if(deathtype == DEATH_TELEFRAG.m_id) return; diff --git a/qcsrc/server/race.qc b/qcsrc/server/race.qc index 6fc828dc9..7f7f19b51 100644 --- a/qcsrc/server/race.qc +++ b/qcsrc/server/race.qc @@ -705,7 +705,7 @@ void checkpoint_passed(entity this, entity player) else { if(this.spawnflags & 4) - Damage (player, this, this, 10000, DEATH_HURTTRIGGER.m_id, player.origin, '0 0 0'); + Damage (player, this, this, 10000, DEATH_HURTTRIGGER.m_id, DMG_NOWEP, player.origin, '0 0 0'); } } diff --git a/qcsrc/server/sv_main.qc b/qcsrc/server/sv_main.qc index d2cc9b960..1130b6a4e 100644 --- a/qcsrc/server/sv_main.qc +++ b/qcsrc/server/sv_main.qc @@ -37,9 +37,9 @@ void CreatureFrame_hotliquids(entity this) if (this.flags & FL_PROJECTILE) { if (this.watertype == CONTENT_LAVA) - Damage (this, NULL, NULL, autocvar_g_balance_contents_projectiledamage * autocvar_g_balance_contents_damagerate * this.waterlevel, DEATH_LAVA.m_id, this.origin, '0 0 0'); + Damage (this, NULL, NULL, autocvar_g_balance_contents_projectiledamage * autocvar_g_balance_contents_damagerate * this.waterlevel, DEATH_LAVA.m_id, DMG_NOWEP, this.origin, '0 0 0'); else if (this.watertype == CONTENT_SLIME) - Damage (this, NULL, NULL, autocvar_g_balance_contents_projectiledamage * autocvar_g_balance_contents_damagerate * this.waterlevel, DEATH_SLIME.m_id, this.origin, '0 0 0'); + Damage (this, NULL, NULL, autocvar_g_balance_contents_projectiledamage * autocvar_g_balance_contents_damagerate * this.waterlevel, DEATH_SLIME.m_id, DMG_NOWEP, this.origin, '0 0 0'); } else { @@ -50,7 +50,7 @@ void CreatureFrame_hotliquids(entity this) this.watersound_finished = time + 0.5; sound (this, CH_PLAYER_SINGLE, SND_LAVA, VOL_BASE, ATTEN_NORM); } - Damage (this, NULL, NULL, autocvar_g_balance_contents_playerdamage_lava * autocvar_g_balance_contents_damagerate * this.waterlevel, DEATH_LAVA.m_id, this.origin, '0 0 0'); + Damage (this, NULL, NULL, autocvar_g_balance_contents_playerdamage_lava * autocvar_g_balance_contents_damagerate * this.waterlevel, DEATH_LAVA.m_id, DMG_NOWEP, this.origin, '0 0 0'); if(autocvar_g_balance_contents_playerdamage_lava_burn) Fire_AddDamage(this, NULL, autocvar_g_balance_contents_playerdamage_lava_burn * this.waterlevel, autocvar_g_balance_contents_playerdamage_lava_burn_time * this.waterlevel, DEATH_LAVA.m_id); } @@ -61,7 +61,7 @@ void CreatureFrame_hotliquids(entity this) this.watersound_finished = time + 0.5; sound (this, CH_PLAYER_SINGLE, SND_SLIME, VOL_BASE, ATTEN_NORM); } - Damage (this, NULL, NULL, autocvar_g_balance_contents_playerdamage_slime * autocvar_g_balance_contents_damagerate * this.waterlevel, DEATH_SLIME.m_id, this.origin, '0 0 0'); + Damage (this, NULL, NULL, autocvar_g_balance_contents_playerdamage_slime * autocvar_g_balance_contents_damagerate * this.waterlevel, DEATH_SLIME.m_id, DMG_NOWEP, this.origin, '0 0 0'); } } } @@ -116,11 +116,11 @@ void CreatureFrame_FallDamage(entity this) else dm = min((dm - autocvar_g_balance_falldamage_minspeed) * autocvar_g_balance_falldamage_factor, autocvar_g_balance_falldamage_maxdamage); if (dm > 0) - Damage (this, NULL, NULL, dm, DEATH_FALL.m_id, this.origin, '0 0 0'); + Damage (this, NULL, NULL, dm, DEATH_FALL.m_id, DMG_NOWEP, this.origin, '0 0 0'); } if(autocvar_g_maxspeed > 0 && velocity_len > autocvar_g_maxspeed) - Damage (this, NULL, NULL, 100000, DEATH_SHOOTING_STAR.m_id, this.origin, '0 0 0'); + Damage (this, NULL, NULL, 100000, DEATH_SHOOTING_STAR.m_id, DMG_NOWEP, this.origin, '0 0 0'); } } diff --git a/qcsrc/server/teamplay.qc b/qcsrc/server/teamplay.qc index 33ad8f8ed..cf21de4bf 100644 --- a/qcsrc/server/teamplay.qc +++ b/qcsrc/server/teamplay.qc @@ -190,7 +190,7 @@ void KillPlayerForTeamChange(entity player) { return; } - Damage(player, player, player, 100000, DEATH_TEAMCHANGE.m_id, player.origin, + Damage(player, player, player, 100000, DEATH_TEAMCHANGE.m_id, DMG_NOWEP, player.origin, '0 0 0'); } diff --git a/qcsrc/server/weapons/tracing.qc b/qcsrc/server/weapons/tracing.qc index de9f20402..c22fdd0fe 100644 --- a/qcsrc/server/weapons/tracing.qc +++ b/qcsrc/server/weapons/tracing.qc @@ -303,7 +303,7 @@ void FireRailgunBullet (entity this, .entity weaponentity, vector start, vector // apply the damage if (it.takedamage) - Damage (it, this, this, bdamage * foff, deathtype, hitloc, it.railgunforce * ffs); + Damage (it, this, this, bdamage * foff, deathtype, weaponentity, hitloc, it.railgunforce * ffs); // create a small explosion to throw gibs around (if applicable) //setorigin(explosion, hitloc); @@ -416,7 +416,7 @@ void fireBullet(entity this, .entity weaponentity, vector start, vector dir, flo MUTATOR_CALLHOOK(FireBullet_Hit, this, hit, start, end, damage, this.(weaponentity)); damage = M_ARGV(4, float); float g = accuracy_isgooddamage(this, hit); - Damage(hit, this, this, damage * solid_penetration_left, dtype, start, force * dir * solid_penetration_left); + Damage(hit, this, this, damage * solid_penetration_left, dtype, weaponentity, start, force * dir * solid_penetration_left); // calculate hits for ballistic weapons if(g) { -- 2.39.2