From 7c944977aad6cf69b7f1d611f5b06e50d3652848 Mon Sep 17 00:00:00 2001 From: TimePath Date: Mon, 30 Nov 2015 16:52:40 +1100 Subject: [PATCH] Viewmodels: fix muzzleflashes --- qcsrc/common/weapons/all.qc | 2 +- qcsrc/server/weapons/weaponsystem.qc | 15 ++++++++++----- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/qcsrc/common/weapons/all.qc b/qcsrc/common/weapons/all.qc index d95bf1260..e9d46e575 100644 --- a/qcsrc/common/weapons/all.qc +++ b/qcsrc/common/weapons/all.qc @@ -590,7 +590,7 @@ void wframe_send(entity actor, entity weaponentity, vector a, bool restartanim) WriteByte(channel, restartanim); WriteByte(channel, weaponentity.state); WriteFloat(channel, weaponentity.weapon_nextthink); - WriteByte(channel, weaponentity.alpha * 255); + WriteByte(channel, weaponentity.m_alpha * 255); Weapon w = Weapons_from(actor.weapon); switch (weaponentity.state) { diff --git a/qcsrc/server/weapons/weaponsystem.qc b/qcsrc/server/weapons/weaponsystem.qc index d8706b26e..7e10c8a60 100644 --- a/qcsrc/server/weapons/weaponsystem.qc +++ b/qcsrc/server/weapons/weaponsystem.qc @@ -59,6 +59,7 @@ vector CL_Weapon_GetShotOrg(int wpn) } ..entity weaponentity_fld; +.float m_alpha; void CL_Weaponentity_Think() { @@ -92,13 +93,17 @@ void CL_Weaponentity_Think() CL_WeaponEntity_SetModel(this, this.owner.weaponname); } - this.effects = EF_NODRAW; // TODO: don't render this entity at all + this.alpha = -1; // TODO: don't render this entity at all - if (this.owner.alpha == default_player_alpha) this.alpha = default_weapon_alpha; - else if (this.owner.alpha != 0) this.alpha = this.owner.alpha; - else this.alpha = 1; + if (this.owner.alpha == default_player_alpha) this.m_alpha = default_weapon_alpha; + else if (this.owner.alpha != 0) this.m_alpha = this.owner.alpha; + else this.m_alpha = 1; - if (this.weaponchild) this.weaponchild.effects = this.effects; + if (this.weaponchild) + { + this.weaponchild.alpha = this.alpha; + this.weaponchild.effects = this.effects; + } } void CL_ExteriorWeaponentity_Think() -- 2.39.2