mirror of
https://github.com/ZDoom/raze-gles.git
synced 2025-01-01 14:11:01 +00:00
- Blood: Create high-precision Sinf()
and Cosf()
inlines and use for player's horizon, using calcSinTableValue()
from the backend, bypassing game's costable[]
.
This commit is contained in:
parent
c38c1cb1f1
commit
547bf110b2
3 changed files with 14 additions and 4 deletions
|
@ -90,6 +90,16 @@ inline int Cos(int ang)
|
||||||
return costable[ang & 2047];
|
return costable[ang & 2047];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline double Sinf(double ang)
|
||||||
|
{
|
||||||
|
return (1 << 30) * sin(BANG2RAD * ang);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline double Cosf(double ang)
|
||||||
|
{
|
||||||
|
return (1 << 30) * sin(BANG2RAD * (ang + 512.));
|
||||||
|
}
|
||||||
|
|
||||||
inline int SinScale16(int ang)
|
inline int SinScale16(int ang)
|
||||||
{
|
{
|
||||||
return FixedToInt(costable[(ang - 512) & 2047]);
|
return FixedToInt(costable[(ang - 512) & 2047]);
|
||||||
|
|
|
@ -1558,9 +1558,9 @@ void ProcessInput(PLAYER *pPlayer)
|
||||||
}
|
}
|
||||||
pPlayer->q16look = clamp(pPlayer->q16look+pInput->q16horz, IntToFixed(-60), IntToFixed(60));
|
pPlayer->q16look = clamp(pPlayer->q16look+pInput->q16horz, IntToFixed(-60), IntToFixed(60));
|
||||||
if (pPlayer->q16look > 0)
|
if (pPlayer->q16look > 0)
|
||||||
pPlayer->q16horiz = IntToFixed(mulscale30(120, Sin(FixedToInt(pPlayer->q16look)<<3)));
|
pPlayer->q16horiz = FloatToFixed(fmulscale30(120., Sinf(FixedToFloat(pPlayer->q16look) * 8.)));
|
||||||
else if (pPlayer->q16look < 0)
|
else if (pPlayer->q16look < 0)
|
||||||
pPlayer->q16horiz = IntToFixed(mulscale30(180, Sin(FixedToInt(pPlayer->q16look)<<3)));
|
pPlayer->q16horiz = FloatToFixed(fmulscale30(180., Sinf(FixedToFloat(pPlayer->q16look) * 8.)));
|
||||||
else
|
else
|
||||||
pPlayer->q16horiz = 0;
|
pPlayer->q16horiz = 0;
|
||||||
int nSector = pSprite->sectnum;
|
int nSector = pSprite->sectnum;
|
||||||
|
|
|
@ -232,9 +232,9 @@ static void fakeProcessInput(PLAYER *pPlayer, InputPacket *pInput)
|
||||||
predict.at20 = clamp(predict.at20+pInput->q16horz, IntToFixed(-60), IntToFixed(60));
|
predict.at20 = clamp(predict.at20+pInput->q16horz, IntToFixed(-60), IntToFixed(60));
|
||||||
|
|
||||||
if (predict.at20 > 0)
|
if (predict.at20 > 0)
|
||||||
predict.at24 = mulscale30(IntToFixed(120), Sin(FixedToInt(predict.at20<<3)));
|
predict.at24 = FloatToFixed(fmulscale30(120., Sinf(FixedToFloat(predict.at20) * 8.)));
|
||||||
else if (predict.at20 < 0)
|
else if (predict.at20 < 0)
|
||||||
predict.at24 = mulscale30(IntToFixed(180), Sin(FixedToInt(predict.at20<<3)));
|
predict.at24 = FloatToFixed(fmulscale30(180., Sinf(FixedToFloat(predict.at20) * 8.)));
|
||||||
else
|
else
|
||||||
predict.at24 = 0;
|
predict.at24 = 0;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue