#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>
vector W_HitPlotUnnormalizedUntransform(vector screenforward, vector screenright, vector screenup, vector v)
{
org = player.origin + player.view_ofs;
traceline_antilag_force(player, org, org + screenforward * MAX_SHOT_DISTANCE, MOVE_NORMAL, player, lag);
- if(IS_CLIENT(trace_ent) || (trace_ent.flags & FL_MONSTER))
+ 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(PS(player).m_switchweapon.m_id), "\n"));
//print(strcat(ftos(hitplot_x), " ", ftos(hitplot_y), " ", ftos(hitplot_z), "\n"));
}
}
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"));