mirror of
https://github.com/DrBeef/Raze.git
synced 2025-03-01 15:00:53 +00:00
- Blood: Consolidate duplicated code in viewUpdateShake()
into a lambda.
This commit is contained in:
parent
5f8c8fe0a4
commit
8bd2b960ee
1 changed files with 15 additions and 36 deletions
|
@ -359,43 +359,22 @@ 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);
|
int nValue = ClipHigh(effectType * 8, 2000);
|
||||||
shakeX += QRandom2(nValue >> 4);
|
cH += buildhoriz(QRandom2(nValue >> 8));
|
||||||
shakeY += QRandom2(nValue >> 4);
|
cA += buildang(QRandom2(nValue >> 8));
|
||||||
shakeZ += QRandom2(nValue);
|
cX += QRandom2(nValue >> 4);
|
||||||
shakeBobX += QRandom2(nValue);
|
cY += QRandom2(nValue >> 4);
|
||||||
shakeBobY += QRandom2(nValue);
|
cZ += QRandom2(nValue);
|
||||||
}
|
pshakeX += QRandom2(nValue);
|
||||||
if (gView->quakeEffect)
|
pshakeY += QRandom2(nValue);
|
||||||
{
|
}
|
||||||
int nValue = ClipHigh(gView->quakeEffect * 8, 2000);
|
};
|
||||||
shakeHoriz += QRandom2(nValue >> 8);
|
doEffect(gView->flickerEffect);
|
||||||
shakeAngle += QRandom2(nValue >> 8);
|
doEffect(gView->quakeEffect);
|
||||||
shakeX += QRandom2(nValue >> 4);
|
|
||||||
shakeY += QRandom2(nValue >> 4);
|
|
||||||
shakeZ += QRandom2(nValue);
|
|
||||||
shakeBobX += QRandom2(nValue);
|
|
||||||
shakeBobY += QRandom2(nValue);
|
|
||||||
}
|
|
||||||
cH += buildhoriz(shakeHoriz);
|
|
||||||
cA += buildang(shakeAngle);
|
|
||||||
cX += shakeX;
|
|
||||||
cY += shakeY;
|
|
||||||
cZ += shakeZ;
|
|
||||||
pshakeX += shakeBobX;
|
|
||||||
pshakeY += shakeBobY;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue