From bfa521b1a19a9a594c70a0fceeefdbb5d6543bc0 Mon Sep 17 00:00:00 2001 From: Mircea Kitsune Date: Sat, 9 Mar 2019 14:50:23 +0200 Subject: [PATCH] Use a weapon flag to mark weapons that induce bleeding --- qcsrc/common/effects/qc/damageeffects.qc | 8 +++++--- qcsrc/common/weapons/weapon.qh | 1 + qcsrc/common/weapons/weapon/machinegun.qh | 2 +- qcsrc/common/weapons/weapon/shotgun.qh | 2 +- 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/qcsrc/common/effects/qc/damageeffects.qc b/qcsrc/common/effects/qc/damageeffects.qc index cc487a552..fe509e3d4 100644 --- a/qcsrc/common/effects/qc/damageeffects.qc +++ b/qcsrc/common/effects/qc/damageeffects.qc @@ -108,7 +108,7 @@ void DamageEffect(entity this, vector hitorg, float thedamage, int type, int spe int nearestbone = 0; float life; string effectname; - entity e; + entity e, wep; if(!autocvar_cl_damageeffect || autocvar_cl_gentle || autocvar_cl_gentle_damage) return; @@ -148,9 +148,11 @@ void DamageEffect(entity this, vector hitorg, float thedamage, int type, int spe life = bound(autocvar_cl_damageeffect_lifetime_min, thedamage * autocvar_cl_damageeffect_lifetime, autocvar_cl_damageeffect_lifetime_max); - effectname = strcat("damage_", DEATH_WEAPONOF(type).netname); - if(DEATH_WEAPONOF(type) == WEP_SHOTGUN || DEATH_WEAPONOF(type) == WEP_MACHINEGUN) + wep = DEATH_WEAPONOF(type); + effectname = strcat("damage_", wep.netname); + if((wep.spawnflags & WEP_FLAG_BLEED)) { + // if this weapon induces bleeding, use the effect name with the proper species prefix (blood type) if((this.isplayermodel & ISPLAYER_MODEL)) { string specstr = species_prefix(specnum); diff --git a/qcsrc/common/weapons/weapon.qh b/qcsrc/common/weapons/weapon.qh index 0d65bbef9..c4f16cd21 100644 --- a/qcsrc/common/weapons/weapon.qh +++ b/qcsrc/common/weapons/weapon.qh @@ -197,6 +197,7 @@ const int WEP_TYPE_MELEE_SEC = BIT(10); // secondary attack is melee swing const int WEP_FLAG_DUALWIELD = BIT(11); // weapon can be dual wielded const int WEP_FLAG_NODUAL = BIT(12); // weapon doesn't work well with dual wielding (fireball etc just explode on fire), doesn't currently prevent anything const int WEP_FLAG_PENETRATEWALLS = BIT(13); // weapon has high calibur bullets that can penetrate thick walls (WEAPONTODO) +const int WEP_FLAG_BLEED = BIT(14); // weapon pierces and causes bleeding (used for damage effects) // variables: string weaponorder_byid; diff --git a/qcsrc/common/weapons/weapon/machinegun.qh b/qcsrc/common/weapons/weapon/machinegun.qh index 2ecd8082f..a53d17a8d 100644 --- a/qcsrc/common/weapons/weapon/machinegun.qh +++ b/qcsrc/common/weapons/weapon/machinegun.qh @@ -4,7 +4,7 @@ CLASS(MachineGun, Weapon) /* spawnfunc */ ATTRIB(MachineGun, m_canonical_spawnfunc, string, "weapon_machinegun"); /* ammotype */ ATTRIB(MachineGun, ammo_type, int, RES_BULLETS); /* impulse */ ATTRIB(MachineGun, impulse, int, 3); -/* flags */ ATTRIB(MachineGun, spawnflags, int, WEP_FLAG_NORMAL | WEP_FLAG_RELOADABLE | WEP_TYPE_HITSCAN | WEP_FLAG_PENETRATEWALLS); +/* flags */ ATTRIB(MachineGun, spawnflags, int, WEP_FLAG_NORMAL | WEP_FLAG_RELOADABLE | WEP_TYPE_HITSCAN | WEP_FLAG_PENETRATEWALLS | WEP_FLAG_BLEED); /* rating */ ATTRIB(MachineGun, bot_pickupbasevalue, float, 7000); /* color */ ATTRIB(MachineGun, wpcolor, vector, '1 1 0'); /* modelname */ ATTRIB(MachineGun, mdl, string, "uzi"); diff --git a/qcsrc/common/weapons/weapon/shotgun.qh b/qcsrc/common/weapons/weapon/shotgun.qh index 5a47a1889..dc6dae157 100644 --- a/qcsrc/common/weapons/weapon/shotgun.qh +++ b/qcsrc/common/weapons/weapon/shotgun.qh @@ -4,7 +4,7 @@ CLASS(Shotgun, Weapon) /* spawnfunc */ ATTRIB(Shotgun, m_canonical_spawnfunc, string, "weapon_shotgun"); /* ammotype */ ATTRIB(Shotgun, ammo_type, int, RES_SHELLS); /* impulse */ ATTRIB(Shotgun, impulse, int, 2); -/* flags */ ATTRIB(Shotgun, spawnflags, int, WEP_FLAG_NORMAL | WEP_FLAG_RELOADABLE | WEP_TYPE_HITSCAN | WEP_TYPE_MELEE_SEC); +/* flags */ ATTRIB(Shotgun, spawnflags, int, WEP_FLAG_NORMAL | WEP_FLAG_RELOADABLE | WEP_TYPE_HITSCAN | WEP_TYPE_MELEE_SEC | WEP_FLAG_BLEED); /* rating */ ATTRIB(Shotgun, bot_pickupbasevalue, float, 6000); /* color */ ATTRIB(Shotgun, wpcolor, vector, '0.5 0.25 0'); /* modelname */ ATTRIB(Shotgun, mdl, string, "shotgun"); -- 2.39.2