]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Send the server-side shot origin and use it while in third person view (the client...
authorMario <mario.mario@y7mail.com>
Fri, 10 Jul 2020 15:16:17 +0000 (01:16 +1000)
committerMario <mario.mario@y7mail.com>
Fri, 10 Jul 2020 15:16:17 +0000 (01:16 +1000)
qcsrc/common/weapons/all.qc

index fc04c2d961c65471f7b2c6ecb4831ade4ca8a90d..abc4bab552cf9d70ca57bc98eb96657cd6ee230a 100644 (file)
@@ -691,6 +691,7 @@ void W_MuzzleFlash(entity actor, .entity weaponentity, entity eff, vector shotor
                (Effects_COUNT >= 255)
                ? WriteShort(channel, eff.m_id)
                : WriteByte(channel, eff.m_id);
+               WriteVector(channel, shotorg);
        });
 }
 #elif defined(CSQC)
@@ -699,15 +700,23 @@ NET_HANDLE(w_muzzleflash, bool isNew)
        return = true;
     int slot = ReadByte();
     int net_name = (Effects_COUNT >= 255) ? ReadShort() : ReadByte();
+    vector sv_shotorg = ReadVector();
 
-    if(!autocvar_r_drawviewmodel || autocvar_chase_active) return;
-       entity wepent = viewmodels[slot];
-       entity eff = Effects_from(net_name);
-
-       vector viewangles = getpropertyvec(VF_CL_VIEWANGLES);
+    entity eff = Effects_from(net_name);
+    vector viewangles = getpropertyvec(VF_CL_VIEWANGLES);
        vector forward, right, up;
        MAKE_VECTORS(viewangles, forward, right, up);
 
+       if(autocvar_chase_active)
+       {
+               // in third person mode, show the muzzle flash from the server side weapon position
+               // we don't have a view model to reference in this case
+               pointparticles(eff, sv_shotorg, forward * 1000, 1);
+               return;
+       }
+    if(!autocvar_r_drawviewmodel) return;
+
+       entity wepent = viewmodels[slot];
        // get the local player entity to calculate shot origin
        entity rlplayer = CSQCModel_server2csqc(player_localentnum - 1);
        if(!rlplayer)