From: drjaska Date: Wed, 25 Oct 2023 22:36:28 +0000 (+0300) Subject: some documentation for shot setup X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=refs%2Fheads%2Fdrjaska%2Fshotorg-documentation;p=xonotic%2Fxonotic-data.pk3dir.git some documentation for shot setup --- diff --git a/qcsrc/server/weapons/tracing.qc b/qcsrc/server/weapons/tracing.qc index dbd3d5b27..a7b079a04 100644 --- a/qcsrc/server/weapons/tracing.qc +++ b/qcsrc/server/weapons/tracing.qc @@ -69,11 +69,13 @@ void W_SetupShot_Dir_ProjectileSize_Range(entity ent, .entity weaponentity, vect if(IS_PLAYER(ent)) W_HitPlotAnalysis(ent, wep, forward, right, up); - vector md = ent.(weaponentity).movedir; - vector vecs = ((md.x > 0) ? md : '0 0 0'); + vector md = ent.(weaponentity).movedir; // read shot origin offsets + vector vecs = ((md.x > 0) ? md : '0 0 0'); // forward/backward offset + vector dv = right * -vecs.y + up * vecs.z; // sideways and vertical offset - vector dv = right * -vecs.y + up * vecs.z; - w_shotorg = ent.origin + ent.view_ofs; + w_shotorg = ent.origin + ent.view_ofs; // player origin + view offset meaning their eyes + + // move the shotorg sideways and vertically as much as requested if possible if(antilag) { if(CS(ent).antilag_debug) @@ -96,6 +98,7 @@ void W_SetupShot_Dir_ProjectileSize_Range(entity ent, .entity weaponentity, vect else tracebox(w_shotorg, mi, ma, w_shotorg + forward * (vecs.x + nudge), MOVE_NORMAL, ent); w_shotorg = trace_endpos - forward * nudge; + // calculate the shotdir from the chosen shotorg if(W_DualWielding(ent)) w_shotdir = s_forward; diff --git a/qcsrc/server/weapons/tracing.qh b/qcsrc/server/weapons/tracing.qh index 94b3be212..45a957ba6 100644 --- a/qcsrc/server/weapons/tracing.qh +++ b/qcsrc/server/weapons/tracing.qh @@ -24,14 +24,24 @@ vector w_shotend; // make sure you call makevectors first (FIXME?) void W_SetupShot_Dir_ProjectileSize_Range(entity ent, .entity weaponentity, vector s_forward, vector mi, vector ma, float antilag, float recoil, Sound snd, float chan, float maxdamage, float range, int deathtype); -#define W_SetupShot_Dir_ProjectileSize(ent, wepent, s_forward, mi, ma, antilag, recoil, snd, chan, maxdamage, deathtype) \ - W_SetupShot_Dir_ProjectileSize_Range(ent, wepent, s_forward, mi, ma, antilag, recoil, snd, chan, maxdamage, max_shot_distance, deathtype) +// W_SetupShot_Dir -v +// W_SetupShot -> W_SetupShot_ProjectileSize -> W_SetupShot_Dir_ProjectileSize -> W_SetupShot_Dir_ProjectileSize_Range +// W_SetupShot_Range -^ + +// W_SetupShot -> W_SetupShot_ProjectileSize gains args '0 0 0', '0 0 0' for mi, ma +// W_SetupShot_ProjectileSize -> W_SetupShot_Dir_ProjectileSize gains arg v_forward for s_forward +// W_SetupShot_Dir -> W_SetupShot_Dir_ProjectileSize gains args '0 0 0', '0 0 0' for mi, ma +// W_SetupShot_Dir_ProjectileSize -> W_SetupShot_Dir_ProjectileSize_Range gains arg max_shot_distance for range +// W_SetupShot_Range -> W_SetupShot_Dir_ProjectileSize_Range gains args v_forward, '0 0 0', '0 0 0' for s_forward, mi, ma + +#define W_SetupShot(ent, wepent, antilag, recoil, snd, chan, maxdamage, deathtype) \ + W_SetupShot_ProjectileSize(ent, wepent, '0 0 0', '0 0 0', antilag, recoil, snd, chan, maxdamage, deathtype) #define W_SetupShot_ProjectileSize(ent, wepent, mi, ma, antilag, recoil, snd, chan, maxdamage, deathtype) \ W_SetupShot_Dir_ProjectileSize(ent, wepent, v_forward, mi, ma, antilag, recoil, snd, chan, maxdamage, deathtype) #define W_SetupShot_Dir(ent, wepent, s_forward, antilag, recoil, snd, chan, maxdamage, deathtype) \ W_SetupShot_Dir_ProjectileSize(ent, wepent, s_forward, '0 0 0', '0 0 0', antilag, recoil, snd, chan, maxdamage, deathtype) -#define W_SetupShot(ent, wepent, antilag, recoil, snd, chan, maxdamage, deathtype) \ - W_SetupShot_ProjectileSize(ent, wepent, '0 0 0', '0 0 0', antilag, recoil, snd, chan, maxdamage, deathtype) +#define W_SetupShot_Dir_ProjectileSize(ent, wepent, s_forward, mi, ma, antilag, recoil, snd, chan, maxdamage, deathtype) \ + W_SetupShot_Dir_ProjectileSize_Range(ent, wepent, s_forward, mi, ma, antilag, recoil, snd, chan, maxdamage, max_shot_distance, deathtype) #define W_SetupShot_Range(ent, wepent, antilag, recoil, snd, chan, maxdamage, range, deathtype) \ W_SetupShot_Dir_ProjectileSize_Range(ent, wepent, v_forward, '0 0 0', '0 0 0', antilag, recoil, snd, chan, maxdamage, range, deathtype)