]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Use the weapon's position for muzzle flashes even when g_shootfromeye is enabled
authorMario <mario.mario@y7mail.com>
Wed, 8 Jul 2020 03:29:59 +0000 (13:29 +1000)
committerMario <mario.mario@y7mail.com>
Wed, 8 Jul 2020 03:29:59 +0000 (13:29 +1000)
qcsrc/common/weapons/all.qc
qcsrc/common/weapons/all.qh

index 10d5bd183c5432b96ae64dcca0d2a5d1b8d607b8..fc04c2d961c65471f7b2c6ecb4831ade4ca8a90d 100644 (file)
@@ -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;
index d02a496e8175f4d7a8b7fb1c537b6520219dcc0b..14134e5e287b5c4ce2967cd80b7c11576413d06c 100644 (file)
@@ -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;