From: Mario Date: Wed, 8 Jul 2020 03:29:59 +0000 (+1000) Subject: Use the weapon's position for muzzle flashes even when g_shootfromeye is enabled X-Git-Tag: xonotic-v0.8.5~851^2~8 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=f71c50e9ce5a364ebcd0b7c57b9b6621eb748d7c;p=xonotic%2Fxonotic-data.pk3dir.git Use the weapon's position for muzzle flashes even when g_shootfromeye is enabled --- 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;