mirror of
https://github.com/ZDoom/raze-gles.git
synced 2025-02-05 21:30:55 +00:00
- simplified calcSinTableValue and inlined it.
There's no need for all this magic voodoo - the sin function already returns the proper values all by itself.
This commit is contained in:
parent
9606601554
commit
8acc4101be
3 changed files with 11 additions and 13 deletions
|
@ -938,7 +938,14 @@ int32_t videoSetRenderMode(int32_t renderer);
|
||||||
void renderSetRollAngle(float rolla);
|
void renderSetRollAngle(float rolla);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
double calcSinTableValue(double index);
|
//
|
||||||
|
// Calculates and returns a sintable[] value of the equivilent index (and supports fractional indexes also)
|
||||||
|
//
|
||||||
|
inline double calcSinTableValue(double index)
|
||||||
|
{
|
||||||
|
return 16384. * sin(BANG2RAD * index);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// pal: pass -1 to invalidate all palettes for the tile, or >=0 for a particular palette
|
// pal: pass -1 to invalidate all palettes for the tile, or >=0 for a particular palette
|
||||||
// how: pass -1 to invalidate all instances of the tile in texture memory, or a bitfield
|
// how: pass -1 to invalidate all instances of the tile in texture memory, or a bitfield
|
||||||
|
|
|
@ -4323,12 +4323,3 @@ void renderSetRollAngle(float rolla)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//
|
|
||||||
// Calculates and returns a sintable[] value of the equivilent index (and supports fractional indexes also)
|
|
||||||
//
|
|
||||||
double calcSinTableValue(double index)
|
|
||||||
{
|
|
||||||
double value = fabs(16384. * sin(BANG2RAD * (index - (fmod(index, 512) * 2))));
|
|
||||||
return (index >= 1024 ? -value : value);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
|
@ -305,11 +305,11 @@ void displayweapon_d(int snum, double smoothratio)
|
||||||
gun_pos = 80 - (opos + fmulscale16(npos - opos, smoothratio));
|
gun_pos = 80 - (opos + fmulscale16(npos - opos, smoothratio));
|
||||||
|
|
||||||
weapon_xoffset = (160)-90;
|
weapon_xoffset = (160)-90;
|
||||||
weapon_xoffset -= calcSinTableValue(fmod((weapon_sway / 2.) + 512, 2048)) / (1024. + 512.);
|
weapon_xoffset -= calcSinTableValue((weapon_sway / 2.) + 512) / (1024. + 512.);
|
||||||
weapon_xoffset -= 58 + p->weapon_ang;
|
weapon_xoffset -= 58 + p->weapon_ang;
|
||||||
if( sprite[p->i].xrepeat < 32 )
|
if( sprite[p->i].xrepeat < 32 )
|
||||||
gun_pos -= fabs(calcSinTableValue(fmod(weapon_sway * 4., 2048)) / 512.);
|
gun_pos -= fabs(calcSinTableValue(weapon_sway * 4.) / 512.);
|
||||||
else gun_pos -= fabs(calcSinTableValue(fmod(weapon_sway / 2., 2048)) / 1024.);
|
else gun_pos -= fabs(calcSinTableValue(weapon_sway / 2.) / 1024.);
|
||||||
|
|
||||||
gun_pos -= (p->hard_landing<<3);
|
gun_pos -= (p->hard_landing<<3);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue