From f71c50e9ce5a364ebcd0b7c57b9b6621eb748d7c Mon Sep 17 00:00:00 2001 From: Mario Date: Wed, 8 Jul 2020 13:29:59 +1000 Subject: [PATCH] Use the weapon's position for muzzle flashes even when g_shootfromeye is enabled --- qcsrc/common/weapons/all.qc | 6 ++++-- qcsrc/common/weapons/all.qh | 2 ++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/qcsrc/common/weapons/all.qc b/qcsrc/common/weapons/all.qc index 10d5bd183..fc04c2d96 100644 --- a/qcsrc/common/weapons/all.qc +++ b/qcsrc/common/weapons/all.qc @@ -384,7 +384,7 @@ vector shotorg_adjust_values(vector vecs, bool y_is_right, bool visual, int algn * writes: * this.origin, this.angles * this.weaponchild - * this.movedir, this.view_ofs + * this.movedir, this.view_ofs, this.movedir_aligned * attachment stuff * anim stuff * to free: @@ -526,6 +526,7 @@ void CL_WeaponEntity_SetModel(entity this, string name, bool _anim) } this.view_ofs = '0 0 0'; + this.movedir_aligned = this.movedir; if (this.movedir.x >= 0) { @@ -536,6 +537,7 @@ void CL_WeaponEntity_SetModel(entity this, string name, bool _anim) #endif vector v = this.movedir; this.movedir = shotorg_adjust(v, false, false, algn); + this.movedir_aligned = shotorg_adjust(v, false, true, algn); this.view_ofs = shotorg_adjust(v, false, true, algn) - v; } int compressed_shotorg = compressShotOrigin(this.movedir); @@ -711,7 +713,7 @@ NET_HANDLE(w_muzzleflash, bool isNew) if(!rlplayer) rlplayer = csqcplayer; // fall back to the global - vector md = wepent.movedir; + vector md = wepent.movedir_aligned; vector vecs = ((md.x > 0) ? md : '0 0 0'); vector dv = right * -vecs.y + up * vecs.z; vector org = rlplayer.origin + rlplayer.view_ofs + dv; diff --git a/qcsrc/common/weapons/all.qh b/qcsrc/common/weapons/all.qh index d02a496e8..14134e5e2 100644 --- a/qcsrc/common/weapons/all.qh +++ b/qcsrc/common/weapons/all.qh @@ -356,6 +356,8 @@ vector weaponentity_glowmod(Weapon wep, entity actor, int c, entity wepent) .vector spawnorigin; // for casings +.vector movedir_aligned; // shot origin based on weapon alignment (unaffected by shootfromeye) + // weapon animation vectors: .vector anim_fire1; .vector anim_fire2; -- 2.39.2