]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/weapons/tracing.qc
Merge branch 'master' into Juhu/strafehud
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / weapons / tracing.qc
index 9fd07eb2e4920b4e5bd79542b7ebb07bd51ec5fb..b82095a69971beaa49e6be3a86e07f2e760dc71a 100644 (file)
@@ -7,8 +7,10 @@
 #include "hitplot.qh"
 #include "weaponsystem.qh"
 
-#include "../g_damage.qh"
-#include "../antilag.qh"
+#include "../damage.qh"
+#include <server/main.qh>
+#include <server/mutators/_mod.qh>
+#include <server/antilag.qh>
 
 #include <common/constants.qh>
 #include <common/net_linked.qh>
@@ -195,7 +197,7 @@ void W_SetupProjVelocity_Explicit(entity proj, vector dir, vector upDir, float p
        mspercallsum -= gettime(GETTIME_HIRES);
        #endif
 
-       dir = W_CalculateSpread(dir, spread, g_weaponspreadfactor, autocvar_g_projectiles_spread_style);
+       dir = W_CalculateSpread(dir, spread, autocvar_g_weaponspreadfactor, autocvar_g_projectiles_spread_style);
 
        #if 0
        mspercallsum += gettime(GETTIME_HIRES);
@@ -300,7 +302,7 @@ void FireRailgunBullet (entity this, .entity weaponentity, vector start, vector
 
                msg_entity = it;
                // we want this to be very loud when close but fall off quickly -> using max base volume and high attenuation
-               soundtoat(MSG_ONE, pseudoprojectile, beampos, CH_SHOTS, SND(NEXWHOOSH_RANDOM()), VOL_BASEVOICE, ATTEN_IDLE);
+               soundtoat(MSG_ONE, pseudoprojectile, beampos, CH_SHOTS, SND(NEXWHOOSH_RANDOM()), VOL_BASEVOICE, ATTEN_IDLE, 0);
        });
        if(pseudoprojectile)
                delete(pseudoprojectile);
@@ -498,3 +500,44 @@ void fireBullet(entity this, .entity weaponentity, vector start, vector dir, flo
 {
        fireBullet_antilag(this, weaponentity, start, dir, spread, max_solid_penetration, damage, headshot_multiplier, force, dtype, tracer_effect, true);
 }
+
+void crosshair_trace(entity pl)
+{
+       traceline_antilag(pl, CS(pl).cursor_trace_start, CS(pl).cursor_trace_start + normalize(CS(pl).cursor_trace_endpos - CS(pl).cursor_trace_start) * max_shot_distance, MOVE_NORMAL, pl, ANTILAG_LATENCY(pl));
+}
+
+void crosshair_trace_plusvisibletriggers(entity pl)
+{
+       crosshair_trace_plusvisibletriggers__is_wz(pl, false);
+}
+
+void WarpZone_crosshair_trace_plusvisibletriggers(entity pl)
+{
+       crosshair_trace_plusvisibletriggers__is_wz(pl, true);
+}
+
+void crosshair_trace_plusvisibletriggers__is_wz(entity pl, bool is_wz)
+{
+       FOREACH_ENTITY_FLOAT(solid, SOLID_TRIGGER,
+       {
+               if(it.model != "")
+               {
+                       it.solid = SOLID_BSP;
+                       IL_PUSH(g_ctrace_changed, it);
+               }
+       });
+
+       if (is_wz)
+               WarpZone_crosshair_trace(pl);
+       else
+               crosshair_trace(pl);
+
+       IL_EACH(g_ctrace_changed, true, { it.solid = SOLID_TRIGGER; });
+
+       IL_CLEAR(g_ctrace_changed);
+}
+
+void WarpZone_crosshair_trace(entity pl)
+{
+       WarpZone_traceline_antilag(pl, CS(pl).cursor_trace_start, CS(pl).cursor_trace_start + normalize(CS(pl).cursor_trace_endpos - CS(pl).cursor_trace_start) * max_shot_distance, MOVE_NORMAL, pl, ANTILAG_LATENCY(pl));
+}