|
|
|
|
@@ -12,9 +12,6 @@
|
|
|
|
|
#include "ParticleObject.h"
|
|
|
|
|
#include "Particle.h"
|
|
|
|
|
|
|
|
|
|
#ifdef TOGGLEABLE_BETA_FEATURES
|
|
|
|
|
bool CParticle::bEnableBannedParticles = false;
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#define MAX_PARTICLES_ON_SCREEN (1000)
|
|
|
|
|
|
|
|
|
|
@@ -388,8 +385,12 @@ void CParticle::Initialise()
|
|
|
|
|
|
|
|
|
|
gpFlame5Tex = RwTextureRead("flame5", nil);
|
|
|
|
|
|
|
|
|
|
#ifdef FIX_BUGS
|
|
|
|
|
gpFlame5Raster = RwTextureGetRaster(gpFlame5Tex);
|
|
|
|
|
#else
|
|
|
|
|
gpFlame5Raster = RwTextureGetRaster(gpFlame1Tex); // copy-paste bug ?
|
|
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
gpRainDropSmallTex = RwTextureRead("rainsmall", nil);
|
|
|
|
|
gpRainDropSmallRaster = RwTextureGetRaster(gpRainDropSmallTex);
|
|
|
|
|
|
|
|
|
|
@@ -767,9 +768,8 @@ CParticle *CParticle::AddParticle(tParticleType type, CVector const &vecPos, CVe
|
|
|
|
|
{
|
|
|
|
|
if ( CTimer::GetIsPaused() )
|
|
|
|
|
return NULL;
|
|
|
|
|
#ifdef TOGGLEABLE_BETA_FEATURES
|
|
|
|
|
if(!bEnableBannedParticles)
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#ifdef PC_PARTICLE
|
|
|
|
|
if ( ( type == PARTICLE_ENGINE_SMOKE
|
|
|
|
|
|| type == PARTICLE_ENGINE_SMOKE2
|
|
|
|
|
|| type == PARTICLE_ENGINE_STEAM
|
|
|
|
|
@@ -782,6 +782,7 @@ CParticle *CParticle::AddParticle(tParticleType type, CVector const &vecPos, CVe
|
|
|
|
|
{
|
|
|
|
|
return nil;
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
CParticle *pParticle = m_pUnusedListHead;
|
|
|
|
|
|
|
|
|
|
@@ -853,6 +854,7 @@ CParticle *CParticle::AddParticle(tParticleType type, CVector const &vecPos, CVe
|
|
|
|
|
|
|
|
|
|
pParticle->m_nRotation = nRotation;
|
|
|
|
|
|
|
|
|
|
// PC only
|
|
|
|
|
if ( pParticle->m_nRotation >= 360 )
|
|
|
|
|
pParticle->m_nRotation -= 360;
|
|
|
|
|
else if ( pParticle->m_nRotation < 0 )
|
|
|
|
|
@@ -1348,12 +1350,13 @@ void CParticle::Update()
|
|
|
|
|
|
|
|
|
|
particle->m_nAlpha = clamp(particle->m_nAlpha - psystem->m_nFadeAlphaAmount,
|
|
|
|
|
0, 255);
|
|
|
|
|
|
|
|
|
|
#ifdef PC_PARTICLE
|
|
|
|
|
if ( particle->m_nAlpha == 0 )
|
|
|
|
|
{
|
|
|
|
|
bRemoveParticle = true;
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
++particle->m_nFadeAlphaTimer;
|
|
|
|
|
@@ -1448,18 +1451,15 @@ void CParticle::Render()
|
|
|
|
|
for ( int32 i = 0; i < MAX_PARTICLES; i++ )
|
|
|
|
|
{
|
|
|
|
|
tParticleSystemData *psystem = &mod_ParticleSystemManager.m_aParticles[i];
|
|
|
|
|
|
|
|
|
|
#ifdef PC_PARTICLE
|
|
|
|
|
bool particleBanned = false;
|
|
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
CParticle *particle = psystem->m_pParticles;
|
|
|
|
|
|
|
|
|
|
RwRaster **frames = psystem->m_ppRaster;
|
|
|
|
|
|
|
|
|
|
#ifdef PC_PARTICLE
|
|
|
|
|
tParticleType type = psystem->m_Type;
|
|
|
|
|
|
|
|
|
|
#ifdef TOGGLEABLE_BETA_FEATURES
|
|
|
|
|
if (!bEnableBannedParticles)
|
|
|
|
|
#endif
|
|
|
|
|
if ( type == PARTICLE_ENGINE_SMOKE
|
|
|
|
|
|| type == PARTICLE_ENGINE_SMOKE2
|
|
|
|
|
|| type == PARTICLE_ENGINE_STEAM
|
|
|
|
|
@@ -1471,7 +1471,8 @@ void CParticle::Render()
|
|
|
|
|
{
|
|
|
|
|
particleBanned = true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
if ( particle )
|
|
|
|
|
{
|
|
|
|
|
if ( (flags & DRAW_OPAQUE) != (psystem->Flags & DRAW_OPAQUE)
|
|
|
|
|
@@ -1512,10 +1513,11 @@ void CParticle::Render()
|
|
|
|
|
while ( particle != nil )
|
|
|
|
|
{
|
|
|
|
|
bool canDraw = true;
|
|
|
|
|
#ifdef PC_PARTICLE
|
|
|
|
|
|
|
|
|
|
if ( particle->m_nAlpha == 0 )
|
|
|
|
|
canDraw = false;
|
|
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
if ( canDraw && psystem->m_nFinalAnimationFrame != 0 && frames != nil )
|
|
|
|
|
{
|
|
|
|
|
RwRaster *curFrame = frames[particle->m_nCurrentFrame];
|
|
|
|
|
@@ -1538,7 +1540,7 @@ void CParticle::Render()
|
|
|
|
|
particle->m_fSize * 63.0f,
|
|
|
|
|
particle->m_Color,
|
|
|
|
|
particle->m_nColorIntensity,
|
|
|
|
|
(float)particle->m_nRotation,
|
|
|
|
|
(float)particle->m_nRotation, //DEGTORAD((float)particle->m_nRotation) ps2
|
|
|
|
|
particle->m_nAlpha);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
@@ -1564,8 +1566,10 @@ void CParticle::Render()
|
|
|
|
|
|
|
|
|
|
if ( CSprite::CalcScreenCoors(particle->m_vecPosition, coors, &w, &h, true) )
|
|
|
|
|
{
|
|
|
|
|
#ifdef PC_PARTICLE
|
|
|
|
|
if ( (!particleBanned || SCREEN_WIDTH * fParticleScaleLimit >= w)
|
|
|
|
|
&& SCREEN_HEIGHT * fParticleScaleLimit >= h )
|
|
|
|
|
#endif
|
|
|
|
|
{
|
|
|
|
|
if ( particle->m_nRotation != 0 )
|
|
|
|
|
{
|
|
|
|
|
@@ -1576,7 +1580,7 @@ void CParticle::Render()
|
|
|
|
|
particle->m_Color.blue,
|
|
|
|
|
particle->m_nColorIntensity,
|
|
|
|
|
1.0f / coors.z,
|
|
|
|
|
float(particle->m_nRotation),
|
|
|
|
|
float(particle->m_nRotation), // DEGTORAD((float)particle->m_nRotation) ps2
|
|
|
|
|
particle->m_nAlpha);
|
|
|
|
|
}
|
|
|
|
|
else if ( psystem->Flags & SCREEN_TRAIL )
|
|
|
|
|
@@ -1601,7 +1605,6 @@ void CParticle::Render()
|
|
|
|
|
|
|
|
|
|
fTrailLength = fDist;
|
|
|
|
|
|
|
|
|
|
//Float fRot = Atan2( vecDist.x / fDist, Sqrt(1.0f - vecDist.x / fDist * (vecDist.x / fDist)) );
|
|
|
|
|
float fRot = Asin(vecDist.x / fDist);
|
|
|
|
|
|
|
|
|
|
fRotation = fRot;
|
|
|
|
|
@@ -1653,7 +1656,6 @@ void CParticle::Render()
|
|
|
|
|
|
|
|
|
|
fTrailLength = fDist;
|
|
|
|
|
|
|
|
|
|
//Float fRot = Atan2(vecDist.x / fDist, Sqrt(1.0f - vecDist.x / fDist * (vecDist.x / fDist)));
|
|
|
|
|
float fRot = Asin(vecDist.x / fDist);
|
|
|
|
|
|
|
|
|
|
fRotation = fRot;
|
|
|
|
|
|