From: Mario Date: Fri, 10 Jul 2020 15:16:17 +0000 (+1000) Subject: Send the server-side shot origin and use it while in third person view (the client... X-Git-Tag: xonotic-v0.8.5~851^2~7 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=000b15c528c0f3c9e77f6c86d8756fb8bee46af2;p=xonotic%2Fxonotic-data.pk3dir.git Send the server-side shot origin and use it while in third person view (the client-side view model position isn't accessible in this case) --- diff --git a/qcsrc/common/weapons/all.qc b/qcsrc/common/weapons/all.qc index fc04c2d96..abc4bab55 100644 --- a/qcsrc/common/weapons/all.qc +++ b/qcsrc/common/weapons/all.qc @@ -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)