summaryrefslogtreecommitdiffstats
path: root/src/render
diff options
context:
space:
mode:
authorNikolay Korolev <nickvnuk@gmail.com>2020-02-22 13:35:46 +0100
committerNikolay Korolev <nickvnuk@gmail.com>2020-02-22 13:35:46 +0100
commit3481e431c9856f50463ca9aff24da7a51da94eb7 (patch)
tree5761efccfb0b5aed89af3702031633923606b68a /src/render
parentscript 1000-1154 (diff)
downloadre3-3481e431c9856f50463ca9aff24da7a51da94eb7.tar
re3-3481e431c9856f50463ca9aff24da7a51da94eb7.tar.gz
re3-3481e431c9856f50463ca9aff24da7a51da94eb7.tar.bz2
re3-3481e431c9856f50463ca9aff24da7a51da94eb7.tar.lz
re3-3481e431c9856f50463ca9aff24da7a51da94eb7.tar.xz
re3-3481e431c9856f50463ca9aff24da7a51da94eb7.tar.zst
re3-3481e431c9856f50463ca9aff24da7a51da94eb7.zip
Diffstat (limited to 'src/render')
-rw-r--r--src/render/SpecialFX.cpp21
1 files changed, 10 insertions, 11 deletions
diff --git a/src/render/SpecialFX.cpp b/src/render/SpecialFX.cpp
index 39b22671..e52222a2 100644
--- a/src/render/SpecialFX.cpp
+++ b/src/render/SpecialFX.cpp
@@ -386,13 +386,15 @@ CMoneyMessages::RegisterOne(CVector vecPos, const char *pText, uint8 bRed, uint8
aMoneyMessages[nIndex].m_fOpacity = fOpacity;
}
+CRGBA FoamColour(255, 255, 255, 255);
+unsigned int CSpecialParticleStuff::BoatFromStart;
+
void CSpecialParticleStuff::CreateFoamAroundObject(CMatrix* pMatrix, float innerFw, float innerRg, float innerUp, int32 particles)
{
- int attempts = 0;
float outerFw = innerFw + 5.0f;
float outerRg = innerRg + 5.0f;
float outerUp = innerUp + 5.0f;
- while (particles > 0 && attempts < 1000) {
+ for (int attempts = 0; particles > 0 && attempts < 1000; attempts++) {
CVector pos;
int rnd = CGeneral::GetRandomNumber();
pos.x = (int8)(rnd - 128) / 110.0f;
@@ -400,20 +402,20 @@ void CSpecialParticleStuff::CreateFoamAroundObject(CMatrix* pMatrix, float inner
pos.z = 0.0f;
if (DotProduct2D(pos, TheCamera.GetForward()) >= 0)
continue;
+ // was there any point in adding it here?
pos += pMatrix->GetPosition();
pos.z = 2.0f;
- // was there any point in adding it here?
- float fw = DotProduct(pMatrix->GetForward(), pos - pMatrix->GetPosition());
+ float fw = Abs(DotProduct(pMatrix->GetForward(), pos - pMatrix->GetPosition()));
if (fw >= outerFw)
continue;
- float rg = DotProduct(pMatrix->GetRight(), pos - pMatrix->GetPosition());
+ float rg = Abs(DotProduct(pMatrix->GetRight(), pos - pMatrix->GetPosition()));
if (rg >= outerRg)
continue;
- float up = DotProduct(pMatrix->GetUp(), pos - pMatrix->GetPosition());
+ float up = Abs(DotProduct(pMatrix->GetUp(), pos - pMatrix->GetPosition()));
if (up >= outerUp)
continue;
if (fw > innerFw || rg > innerRg || up > innerUp) {
- CParticle::AddParticle(PARTICLE_STEAM2, pos, CVector(0.0f, 0.0f, 0.0f), nil, 4.0f, 1, 0, 0, 0);
+ CParticle::AddParticle(PARTICLE_STEAM2, pos, CVector(0.0f, 0.0f, 0.0f), nil, 4.0f, FoamColour, 1, 0, 0, 0);
particles--;
}
}
@@ -424,9 +426,6 @@ void CSpecialParticleStuff::StartBoatFoamAnimation()
BoatFromStart = CTimer::GetTimeInMilliseconds();
}
-CRGBA FoamColour(255, 255, 255, 255);
-unsigned int CSpecialParticleStuff::BoatFromStart;
-
void CSpecialParticleStuff::UpdateBoatFoamAnimation(CMatrix* pMatrix)
{
static int32 FrameInAnimation = 0;
@@ -441,7 +440,7 @@ void CSpecialParticleStuff::UpdateBoatFoamAnimation(CMatrix* pMatrix)
CVector pos = *pMatrix * CVector(X, Y, Z);
CParticle::AddParticle(PARTICLE_STEAM_NY, pos, CVector(0.0f, 0.0f, 0.0f),
nil, FrameInAnimation * 0.5f + 2.0f, FoamColour, 1, 0, 0, 0);
- if (++FrameInAnimation)
+ if (++FrameInAnimation > 15)
FrameInAnimation = 0;
}
if ((cur & 0x3FF) < (prev & 0x3FF)) {