From: Mario Date: Sun, 1 Nov 2020 08:09:50 +0000 (+1000) Subject: Calculate a rough shot origin to show Arc smoke effects, rather than calling W_SetupS... X-Git-Tag: xonotic-v0.8.5~705 X-Git-Url: https://git.xonotic.org/?a=commitdiff_plain;h=c34a186bb9d81d71772cc81cdc6354da04f085ae;p=xonotic%2Fxonotic-data.pk3dir.git Calculate a rough shot origin to show Arc smoke effects, rather than calling W_SetupShot every frame, improves performance slightly while holding the Arc --- diff --git a/qcsrc/common/weapons/weapon/arc.qc b/qcsrc/common/weapons/weapon/arc.qc index 848825f14..d7ad8368a 100644 --- a/qcsrc/common/weapons/weapon/arc.qc +++ b/qcsrc/common/weapons/weapon/arc.qc @@ -557,9 +557,14 @@ void W_Arc_Attack(Weapon thiswep, entity actor, .entity weaponentity, int fire) } void Arc_Smoke(Weapon thiswep, entity actor, .entity weaponentity, int fire) { - // TODO: spamming this without checking any refires is asking for trouble! + // calculate a rough shot origin to show the effect from TODO: move this to the client side! makevectors(actor.v_angle); - W_SetupShot_Range(actor,weaponentity,false,0,SND_Null,0,0,0,thiswep.m_id); // TODO: probably doesn't need deathtype, since this is just a prefire effect + w_shotdir = v_forward; + vector md = actor.(weaponentity).movedir; + vector vecs = ((md.x > 0) ? md : '0 0 0'); + vector dv = v_forward * vecs.x + v_right * -vecs.y + v_up * vecs.z; + w_shotorg = actor.origin + actor.view_ofs + dv; + //W_SetupShot_Range(actor,weaponentity,false,0,SND_Null,0,0,0,thiswep.m_id); vector smoke_origin = w_shotorg + actor.velocity*frametime; if ( actor.arc_overheat > time )