X-Git-Url: http://git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fserver%2Fweapons%2Fhitplot.qc;h=2a0fad7dee0c832e086d8feb2ff85ea347d7f3d3;hb=38ad97a27a38fe7e497d1cccefca9a8d26de7862;hp=065edf1b1478661e197562cf4f3e413c61e9d704;hpb=91b39b7f670f5a1234c18ec92851eb1a1f176d8c;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/server/weapons/hitplot.qc b/qcsrc/server/weapons/hitplot.qc index 065edf1b1..2a0fad7de 100644 --- a/qcsrc/server/weapons/hitplot.qc +++ b/qcsrc/server/weapons/hitplot.qc @@ -1,8 +1,10 @@ #include "hitplot.qh" -#include "../_all.qh" #include "../antilag.qh" -#include "../../common/weapons/all.qh" +#include "../g_subs.qh" +#include +#include +#include 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; @@ -65,13 +67,14 @@ void W_HitPlotAnalysis(entity player, vector screenforward, vector screenright, lag = 0; // only antilag for clients org = player.origin + player.view_ofs; - traceline_antilag_force(player, org, org + screenforward * MAX_SHOT_DISTANCE, MOVE_NORMAL, player, lag); + 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")); } } @@ -79,10 +82,10 @@ void W_HitPlotAnalysis(entity player, vector screenforward, vector screenright, void W_HitPlotOpen(entity player) { - if(autocvar_g_hitplots || strstrofs(strcat(" ", autocvar_g_hitplots_individuals, " "), strcat(" ", player.netaddress, " "), 0) >= 0) + if(autocvar_g_hitplots || strhasword(autocvar_g_hitplots_individuals, player.netaddress)) { player.hitplotfh = fopen(strcat("hits-", matchid, "-", player.netaddress, "-", ftos(player.playerid), ".plot"), FILE_WRITE); - fputs(player.hitplotfh, strcat("#name ", player.netname, "\n")); + fputs(player.hitplotfh, strcat("#name ", playername(player, false), "\n")); } else { player.hitplotfh = -1; } }