mirror of
https://github.com/ZDoom/raze-gles.git
synced 2025-01-12 11:10:39 +00:00
- Blood: Use more precision for flicker, quake and tilt effects.
This commit is contained in:
parent
dc0d201275
commit
3c09f41b43
2 changed files with 22 additions and 37 deletions
|
@ -561,6 +561,11 @@ inline int QRandom2(int a1)
|
||||||
return MulScale(qrand(), a1, 14)-a1;
|
return MulScale(qrand(), a1, 14)-a1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline double QRandom2F(double a1)
|
||||||
|
{
|
||||||
|
return MulScaleF(qrand(), a1, 14)-a1;
|
||||||
|
}
|
||||||
|
|
||||||
template<class T>
|
template<class T>
|
||||||
inline void SetBitString(T *pArray, int nIndex)
|
inline void SetBitString(T *pArray, int nIndex)
|
||||||
{
|
{
|
||||||
|
|
|
@ -359,43 +359,23 @@ void viewUpdateDelirium(void)
|
||||||
|
|
||||||
void viewUpdateShake(int& cX, int& cY, int& cZ, binangle& cA, fixedhoriz& cH, double& pshakeX, double& pshakeY)
|
void viewUpdateShake(int& cX, int& cY, int& cZ, binangle& cA, fixedhoriz& cH, double& pshakeX, double& pshakeY)
|
||||||
{
|
{
|
||||||
int shakeHoriz = 0;
|
auto doEffect = [&](const int& effectType)
|
||||||
int shakeAngle = 0;
|
|
||||||
int shakeX = 0;
|
|
||||||
int shakeY = 0;
|
|
||||||
int shakeZ = 0;
|
|
||||||
int shakeBobX = 0;
|
|
||||||
int shakeBobY = 0;
|
|
||||||
if (gView->flickerEffect)
|
|
||||||
{
|
{
|
||||||
int nValue = ClipHigh(gView->flickerEffect * 8, 2000);
|
if (effectType)
|
||||||
shakeHoriz += QRandom2(nValue >> 8);
|
|
||||||
shakeAngle += QRandom2(nValue >> 8);
|
|
||||||
shakeX += QRandom2(nValue >> 4);
|
|
||||||
shakeY += QRandom2(nValue >> 4);
|
|
||||||
shakeZ += QRandom2(nValue);
|
|
||||||
shakeBobX += QRandom2(nValue);
|
|
||||||
shakeBobY += QRandom2(nValue);
|
|
||||||
}
|
|
||||||
if (gView->quakeEffect)
|
|
||||||
{
|
{
|
||||||
int nValue = ClipHigh(gView->quakeEffect * 8, 2000);
|
int nValue = ClipHigh(effectType * 8, 2000);
|
||||||
shakeHoriz += QRandom2(nValue >> 8);
|
cH += buildfhoriz(QRandom2F(nValue * (1. / 256.)));
|
||||||
shakeAngle += QRandom2(nValue >> 8);
|
cA += buildfang(QRandom2F(nValue * (1. / 256.)));
|
||||||
shakeX += QRandom2(nValue >> 4);
|
cX += QRandom2(nValue >> 4);
|
||||||
shakeY += QRandom2(nValue >> 4);
|
cY += QRandom2(nValue >> 4);
|
||||||
shakeZ += QRandom2(nValue);
|
cZ += QRandom2(nValue);
|
||||||
shakeBobX += QRandom2(nValue);
|
pshakeX += QRandom2F(nValue);
|
||||||
shakeBobY += QRandom2(nValue);
|
pshakeY += QRandom2F(nValue);
|
||||||
}
|
}
|
||||||
cH += buildhoriz(shakeHoriz);
|
};
|
||||||
cA += buildang(shakeAngle);
|
|
||||||
cX += shakeX;
|
|
||||||
cY += shakeY;
|
|
||||||
cZ += shakeZ;
|
|
||||||
pshakeX += shakeBobX;
|
|
||||||
pshakeY += shakeBobY;
|
|
||||||
|
|
||||||
|
doEffect(gView->flickerEffect);
|
||||||
|
doEffect(gView->quakeEffect);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -483,7 +463,7 @@ void SetupView(int &cX, int& cY, int& cZ, binangle& cA, fixedhoriz& cH, int& nSe
|
||||||
}
|
}
|
||||||
|
|
||||||
viewUpdateShake(cX, cY, cZ, cA, cH, shakeX, shakeY);
|
viewUpdateShake(cX, cY, cZ, cA, cH, shakeX, shakeY);
|
||||||
cH += buildhoriz(MulScale(0x40000000 - Cos(gView->tiltEffect << 2), 30, 30));
|
cH += q16horiz(xs_CRoundToInt(MulScaleF(double(0x40000000) - bcosf(gView->tiltEffect << 2, 16), 30, 14)));
|
||||||
if (gViewPos == 0)
|
if (gViewPos == 0)
|
||||||
{
|
{
|
||||||
if (cl_viewhbob)
|
if (cl_viewhbob)
|
||||||
|
@ -495,7 +475,7 @@ void SetupView(int &cX, int& cY, int& cZ, binangle& cA, fixedhoriz& cH, int& nSe
|
||||||
{
|
{
|
||||||
cZ += bobHeight;
|
cZ += bobHeight;
|
||||||
}
|
}
|
||||||
cZ += xs_CRoundToInt(cH.asq16() / 6553.6);
|
cZ += xs_CRoundToInt(cH.asq16() * (1. / 6553.6));
|
||||||
cameradist = -1;
|
cameradist = -1;
|
||||||
cameraclock = PlayClock + MulScale(4, (int)gInterpolate, 16);
|
cameraclock = PlayClock + MulScale(4, (int)gInterpolate, 16);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue