]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/weapons/hitplot.qc
Merge branch 'master' into Mario/wepent_experimental
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / weapons / hitplot.qc
index 39d91a21e9f78ff3de1ff4a74dea83a6ff7a6ecb..d148ab54f4597de3da7193d05c8104bd09a7fc80 100644 (file)
@@ -1,8 +1,10 @@
 #include "hitplot.qh"
-#include "../_all.qh"
 
 #include "../antilag.qh"
-#include "../../common/weapons/all.qh"
+#include "../g_subs.qh"
+#include <common/weapons/_all.qh>
+#include <common/state.qh>
+#include <common/wepent.qh>
 
 vector W_HitPlotUnnormalizedUntransform(vector screenforward, vector screenright, vector screenup, vector v)
 {
@@ -50,7 +52,7 @@ vector W_HitPlotNormalizedUntransform(vector org, entity targ, vector screenforw
        return ret;
 }
 
-void W_HitPlotAnalysis(entity player, vector screenforward, vector screenright, vector screenup)
+void W_HitPlotAnalysis(entity player, .entity weaponentity, vector screenforward, vector screenright, vector screenup)
 {
        vector hitplot;
        vector org;
@@ -68,10 +70,11 @@ void W_HitPlotAnalysis(entity player, vector screenforward, vector screenright,
                traceline_antilag_force(player, org, org + screenforward * MAX_SHOT_DISTANCE, MOVE_NORMAL, player, lag);
                if(IS_CLIENT(trace_ent) || IS_MONSTER(trace_ent))
                {
-                       antilag_takeback(trace_ent, time - lag);
+                   entity store = IS_CLIENT(trace_ent) ? CS(trace_ent) : trace_ent;
+                       antilag_takeback(trace_ent, store, time - lag);
                        hitplot = W_HitPlotNormalizedUntransform(org, trace_ent, screenforward, screenright, screenup, trace_endpos);
-                       antilag_restore(trace_ent);
-                       fputs(player.hitplotfh, strcat(ftos(hitplot.x), " ", ftos(hitplot.y), " ", ftos(hitplot.z), " ", ftos(player.switchweapon), "\n"));
+                       antilag_restore(trace_ent, store);
+                       fputs(player.hitplotfh, strcat(ftos(hitplot.x), " ", ftos(hitplot.y), " ", ftos(hitplot.z), " ", ftos(player.(weaponentity).m_switchweapon.m_id), "\n"));
                        //print(strcat(ftos(hitplot_x), " ", ftos(hitplot_y), " ", ftos(hitplot_z), "\n"));
                }
        }