{
float zoomsensitivity, zoomspeed, zoomfactor, zoomdir;
float velocityzoom, curspeed;
+ vector v;
zoomsensitivity = autocvar_cl_zoomsensitivity;
zoomfactor = autocvar_cl_zoomfactor;
if(autocvar_cl_velocityzoom && autocvar_cl_velocityzoom_type) // _type = 0 disables velocity zoom too
{
+ v = pmove_vel;
+ if(csqcplayer)
+ v = csqcplayer.velocity;
+
switch(autocvar_cl_velocityzoom_type)
{
- case 3: curspeed = max(0, v_forward * pmove_vel); break;
- case 2: curspeed = (v_forward * pmove_vel); break;
- case 1: default: curspeed = vlen(pmove_vel); break;
+ case 3: curspeed = max(0, v_forward * v); break;
+ case 2: curspeed = (v_forward * v); break;
+ case 1: default: curspeed = vlen(v); break;
}
velocityzoom = bound(0, drawframetime / max(0.000000001, autocvar_cl_velocityzoom_time), 1); // speed at which the zoom adapts to player velocity
float EnemyHitCheck()
{
- float t;
+ float t, n;
wcross_origin = project_3d_to_2d(trace_endpos);
wcross_origin_z = 0;
- if(trace_networkentity < 1)
+ if(trace_ent)
+ n = trace_ent.entnum;
+ else
+ n = trace_networkentity;
+ if(n < 1)
return SHOTTYPE_HITWORLD;
- if(trace_networkentity > maxclients)
+ if(n > maxclients)
return SHOTTYPE_HITWORLD;
- t = GetPlayerColor(trace_networkentity - 1);
+ t = GetPlayerColor(n - 1);
if(teamplay)
if(t == myteam)
return SHOTTYPE_HITTEAM;
else
{
traceline(view_origin, ent.origin, MOVE_NORMAL, ent);
- if(trace_fraction < 1 && trace_networkentity != ent.sv_entnum)
+ if(trace_fraction < 1 && (trace_networkentity != ent.sv_entnum && trace_ent.entnum != ent.sv_entnum))
hit = 0;
else
hit = 1;