if(!autocvar_hud_panel_strafehud_uncapped)
slicksteps = min(slicksteps, 4);
- slicksteps = 90 / 2 ** slicksteps;
+ slicksteps = 90 * DEG2RAD / 2 ** slicksteps;
slickdetected = real_onslick; // don't need to traceline if already touching slick
// traceline into every direction
trace_dphitq3surfaceflags = 0;
vector traceorigin = strafeplayer.origin + eZ * strafeplayer.mins.z;
- for(float i = 0; i < 90 && !slickdetected; i += slicksteps)
+ for(float i = 0; i < 90 * DEG2RAD - 0.00001 && !slickdetected; i += slicksteps)
{
vector slickoffset;
float slickrotate;
- slickoffset.z = -cos(i * DEG2RAD) * autocvar_hud_panel_strafehud_slickdetector_range;
- slickrotate = sin(i * DEG2RAD) * autocvar_hud_panel_strafehud_slickdetector_range;
+ slickoffset.z = -cos(i) * autocvar_hud_panel_strafehud_slickdetector_range;
+ slickrotate = sin(i) * autocvar_hud_panel_strafehud_slickdetector_range;
- for(float j = 0; j < 360 && !slickdetected; j += slicksteps)
+ for(float j = 0; j < 360 * DEG2RAD - 0.00001 && !slickdetected; j += slicksteps)
{
- slickoffset.x = sin(j * DEG2RAD) * slickrotate;
- slickoffset.y = cos(j * DEG2RAD) * slickrotate;
+ slickoffset.x = sin(j) * slickrotate;
+ slickoffset.y = cos(j) * slickrotate;
traceline(traceorigin, traceorigin + slickoffset, MOVE_NOMONSTERS, strafeplayer);
- if((PHYS_FRICTION(strafeplayer) == 0 && trace_fraction < 1)
+ if((PHYS_FRICTION(strafeplayer) == 0 && trace_fraction < 1)
|| (trace_dphitq3surfaceflags & Q3SURFACEFLAG_SLICK))
slickdetected = true;
if(i == 0)
{
q = M_PI / 16 * q;
p = M_PI / 16 * p - M_PI_2;
- out.x = cos(q) * cos(p);
- out.y = sin(q) * cos(p);
+ float cos_p = cos(p);
+ out.x = cos(q) * cos_p;
+ out.y = sin(q) * cos_p;
out.z = -sin(p);
}
float atk_deathtype)
{
bool isprimary = !(atk_deathtype & HITTYPE_SECONDARY);
- float atk_shotangle = WEP_CVAR_BOTH(blaster, isprimary, shotangle);
+ float atk_shotangle_rad = WEP_CVAR_BOTH(blaster, isprimary, shotangle) * DEG2RAD;
float atk_damage = WEP_CVAR_BOTH(blaster, isprimary, damage);
- vector s_forward = v_forward * cos(atk_shotangle * DEG2RAD) + v_up * sin(atk_shotangle * DEG2RAD);
+ vector s_forward = v_forward * cos(atk_shotangle_rad) + v_up * sin(atk_shotangle_rad);
W_SetupShot_Dir(actor, weaponentity, s_forward, false, 3, SND_LASERGUN_FIRE, CH_WEAPON_B, atk_damage, atk_deathtype);
W_MuzzleFlash(WEP_BLASTER, actor, weaponentity, w_shotorg, w_shotdir);