Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -108,14 +108,11 @@ static ParticleSystem* createParticleSystem( Drawable *draw )
templateName.format("BeaconSmokeFFFFFF");
const ParticleSystemTemplate *failsafeTemplate = TheParticleSystemManager->findTemplate( templateName );
DEBUG_ASSERTCRASH(failsafeTemplate, ("Doh, this is bad \n I Could not even find the white particle system to make a failsafe system out of."));
if (failsafeTemplate)
system = TheParticleSystemManager->createParticleSystem( failsafeTemplate );
if (system)
{
system = TheParticleSystemManager->createParticleSystem( failsafeTemplate );
if (system)
{
system->attachToDrawable( draw );
system->tintAllColors( obj->getIndicatorColor() );
}
system->attachToDrawable( draw );
system->tintAllColors( obj->getIndicatorColor() );
}
}
}
Expand Down
8 changes: 3 additions & 5 deletions Core/GameEngine/Source/GameClient/System/ParticleSys.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2061,9 +2061,9 @@ Bool ParticleSystem::update( Int localPlayerIndex )
if (m_attachedSystemName.isEmpty() == false)
{
const ParticleSystemTemplate *tmp = TheParticleSystemManager->findTemplate( m_attachedSystemName );
if (tmp)
ParticleSystem *sys = TheParticleSystemManager->createParticleSystem( tmp, TRUE );
if (sys)
{
ParticleSystem *sys = TheParticleSystemManager->createParticleSystem( tmp, TRUE );
sys->setControlParticle( p );
p->controlParticleSystem( sys );
}
Expand Down Expand Up @@ -2867,9 +2867,7 @@ ParticleSystem *ParticleSystemTemplate::createSlaveSystem( Bool createSlaves ) c
if (m_slaveTemplate == nullptr && m_slaveSystemName.isEmpty() == false)
m_slaveTemplate = TheParticleSystemManager->findTemplate( m_slaveSystemName );

ParticleSystem *slave = nullptr;
if (m_slaveTemplate)
slave = TheParticleSystemManager->createParticleSystem( m_slaveTemplate, createSlaves );
ParticleSystem *slave = TheParticleSystemManager->createParticleSystem( m_slaveTemplate, createSlaves );

return slave;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -247,9 +247,10 @@ void W3DTankTruckDraw::createWheelEmitters()
{
if (m_truckEffectIDs[i] == INVALID_PARTICLE_SYSTEM_ID)
{
if (const ParticleSystemTemplate *sysTemplate = TheParticleSystemManager->findTemplate(*effectNames[i]))
const ParticleSystemTemplate *sysTemplate = TheParticleSystemManager->findTemplate(*effectNames[i]);
ParticleSystem *particleSys = TheParticleSystemManager->createParticleSystem( sysTemplate );
if (particleSys)
{
ParticleSystem *particleSys = TheParticleSystemManager->createParticleSystem( sysTemplate );
particleSys->attachToObject(getDrawable()->getObject());
// important: mark it as do-not-save, since we'll just re-create it when we reload.
particleSys->setSaveable(FALSE);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -170,9 +170,10 @@ void W3DTruckDraw::createWheelEmitters()
{
if (m_truckEffectIDs[i] == INVALID_PARTICLE_SYSTEM_ID)
{
if (const ParticleSystemTemplate *sysTemplate = TheParticleSystemManager->findTemplate(*effectNames[i]))
const ParticleSystemTemplate *sysTemplate = TheParticleSystemManager->findTemplate(*effectNames[i]);
ParticleSystem *particleSys = TheParticleSystemManager->createParticleSystem( sysTemplate );
if (particleSys)
{
ParticleSystem *particleSys = TheParticleSystemManager->createParticleSystem( sysTemplate );
particleSys->attachToObject(getDrawable()->getObject());
// important: mark it as do-not-save, since we'll just re-create it when we reload.
particleSys->setSaveable(FALSE);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -279,13 +279,10 @@ void AutoHealBehavior::pulseHealObject( Object *obj )
obj->attemptHealingFromSoleBenefactor( data->m_healingAmount, getObject(), data->m_healingDelay );


if( data->m_unitHealPulseParticleSystemTmpl )
ParticleSystem *system = TheParticleSystemManager->createParticleSystem( data->m_unitHealPulseParticleSystemTmpl );
if( system )
{
ParticleSystem *system = TheParticleSystemManager->createParticleSystem( data->m_unitHealPulseParticleSystemTmpl );
if( system )
{
system->setPosition( obj->getPosition() );
}
system->setPosition( obj->getPosition() );
}

m_soonestHealFrame = TheGameLogic->getFrame() + data->m_healingDelay;// In case onDamage tries to wake us up early
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -959,9 +959,9 @@ class GenericObjectCreationNugget : public ObjectCreationNugget
if (!m_particleSysName.isEmpty())
{
const ParticleSystemTemplate *tmp = TheParticleSystemManager->findTemplate(m_particleSysName);
if (tmp)
ParticleSystem *sys = TheParticleSystemManager->createParticleSystem(tmp);
if (sys)
{
ParticleSystem *sys = TheParticleSystemManager->createParticleSystem(tmp);
sys->attachToObject(obj);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -229,40 +229,36 @@ void HelicopterSlowDeathBehavior::beginSlowDeath( const DamageInfo *damageInfo )
locomotor->setMaxBraking( modData->m_maxBraking );

// attach particle system to bone if present
if( modData->m_attachParticleSystem )
ParticleSystem *pSys = TheParticleSystemManager->createParticleSystem( modData->m_attachParticleSystem );
if( pSys )
{
ParticleSystem *pSys = TheParticleSystemManager->createParticleSystem( modData->m_attachParticleSystem );
if( pSys )

// where do the offset attachment to
if( modData->m_attachParticleBone.isEmpty() == FALSE )
{
Drawable *draw = getObject()->getDrawable();

// where do the offset attachment to
if( modData->m_attachParticleBone.isEmpty() == FALSE )
if( draw )
{
Drawable *draw = getObject()->getDrawable();
Coord3D pos;

if( draw )
{
Coord3D pos;

if( draw->getPristineBonePositions( modData->m_attachParticleBone.str(), 0, &pos, nullptr, 1 ) )
pSys->setPosition( &pos );

}
if( draw->getPristineBonePositions( modData->m_attachParticleBone.str(), 0, &pos, nullptr, 1 ) )
pSys->setPosition( &pos );

}
else
{

// use location coord specified ... it will be zero if not given which is center of obj anyway
pSys->setPosition( &modData->m_attachParticleLoc );

}
}
else
{

// attach the particle system to the object
pSys->attachToObject( getObject() );
// use location coord specified ... it will be zero if not given which is center of obj anyway
pSys->setPosition( &modData->m_attachParticleLoc );

}

// attach the particle system to the object
pSys->attachToObject( getObject() );

}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -258,27 +258,21 @@ void LaserUpdate::initLaser( const Object *parent, const Coord3D *startPos, cons
if( data->m_particleSystemName.isNotEmpty() )
{
const ParticleSystemTemplate *tmp = TheParticleSystemManager->findTemplate( data->m_particleSystemName );
if( tmp )
system = TheParticleSystemManager->createParticleSystem( tmp );
if( system )
{
system = TheParticleSystemManager->createParticleSystem( tmp );
if( system )
{
m_particleSystemID = system->getSystemID();
}
m_particleSystemID = system->getSystemID();
}
}

//If we don't have a particle system for the target effect, create it.
if( data->m_targetParticleSystemName.isNotEmpty() )
{
const ParticleSystemTemplate *tmp = TheParticleSystemManager->findTemplate( data->m_targetParticleSystemName );
if( tmp )
system = TheParticleSystemManager->createParticleSystem( tmp );
if( system )
{
system = TheParticleSystemManager->createParticleSystem( tmp );
if( system )
{
m_targetParticleSystemID = system->getSystemID();
}
m_targetParticleSystemID = system->getSystemID();
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -849,15 +849,11 @@ void ParticleUplinkCannonUpdate::createConnectorFlare( IntensityTypes intensity
if( str.isNotEmpty() )
{
const ParticleSystemTemplate *tmp = TheParticleSystemManager->findTemplate( str );
ParticleSystem *system;
if( tmp )
ParticleSystem *system = TheParticleSystemManager->createParticleSystem( tmp );
if( system )
{
system = TheParticleSystemManager->createParticleSystem( tmp );
if( system )
{
m_connectorSystemID = system->getSystemID();
system->setPosition( &m_connectorNodePosition );
}
m_connectorSystemID = system->getSystemID();
system->setPosition( &m_connectorNodePosition );
}
}
}
Expand Down Expand Up @@ -885,14 +881,11 @@ void ParticleUplinkCannonUpdate::createLaserBaseFlare( IntensityTypes intensity
if( str.isNotEmpty() )
{
const ParticleSystemTemplate *tmp = TheParticleSystemManager->findTemplate( str );
if( tmp )
ParticleSystem *system = TheParticleSystemManager->createParticleSystem( tmp );
if( system )
{
ParticleSystem *system = TheParticleSystemManager->createParticleSystem( tmp );
if( system )
{
m_laserBaseSystemID = system->getSystemID();
system->setPosition( &m_laserOriginPosition );
}
m_laserBaseSystemID = system->getSystemID();
system->setPosition( &m_laserOriginPosition );
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -616,30 +616,27 @@ void SlavedUpdate::setRepairState( RepairStates repairState )
if( !data->m_weldingSysName.isEmpty() )
{
const ParticleSystemTemplate *tmp = TheParticleSystemManager->findTemplate( data->m_weldingSysName );
if( tmp )
ParticleSystem *weldingSys = TheParticleSystemManager->createParticleSystem(tmp);
if( weldingSys )
{
ParticleSystem *weldingSys = TheParticleSystemManager->createParticleSystem(tmp);
if( weldingSys )
Coord3D pos;
//Get the bone position
if( draw->getPristineBonePositions( data->m_weldingFXBone.str(), 0, &pos, nullptr, 1 ) )
{
Coord3D pos;
//Get the bone position
if( draw->getPristineBonePositions( data->m_weldingFXBone.str(), 0, &pos, nullptr, 1 ) )
{
pos.add( obj->getPosition() );
}
else
{
pos.set( obj->getPosition() );
}

weldingSys->setPosition( &pos );
Real time = (Real)(m_framesToWait * LOGICFRAMES_PER_SECOND);
weldingSys->setLifetimeRange( time, time );

AudioEventRTS soundToPlay = TheAudio->getMiscAudio()->m_repairSparks;
soundToPlay.setPosition( &pos );
TheAudio->addAudioEvent( &soundToPlay );
pos.add( obj->getPosition() );
}
else
{
pos.set( obj->getPosition() );
}

weldingSys->setPosition( &pos );
Real time = (Real)(m_framesToWait * LOGICFRAMES_PER_SECOND);
weldingSys->setLifetimeRange( time, time );

AudioEventRTS soundToPlay = TheAudio->getMiscAudio()->m_repairSparks;
soundToPlay.setPosition( &pos );
TheAudio->addAudioEvent( &soundToPlay );
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -290,22 +290,16 @@ UpdateSleepTime StealthDetectorUpdate::update()
theirDraw->setHeatVisionOpacity( 1.0f );
}

if (data->m_IRGridParticleSysTmpl)
const ParticleSystemTemplate *gridTemplate = data->m_IRGridParticleSysTmpl;
ParticleSystem *sys = TheParticleSystemManager->createParticleSystem( gridTemplate );//GRID
if (sys)
{
const ParticleSystemTemplate *gridTemplate = data->m_IRGridParticleSysTmpl;
if (gridTemplate)
{
ParticleSystem *sys = TheParticleSystemManager->createParticleSystem( gridTemplate );//GRID
if (sys)
{
Coord3D gridPosition = *them->getPosition();
gridPosition.z = self->getPosition()->z + 17;
gridPosition.x -= ((Int)gridPosition.x)%12;
gridPosition.y -= ((Int)gridPosition.y)%12;
Coord3D gridPosition = *them->getPosition();
gridPosition.z = self->getPosition()->z + 17;
gridPosition.x -= ((Int)gridPosition.x)%12;
gridPosition.y -= ((Int)gridPosition.y)%12;

sys->setPosition( &gridPosition );
}
}
sys->setPosition( &gridPosition );
}

}
Expand Down Expand Up @@ -352,34 +346,28 @@ UpdateSleepTime StealthDetectorUpdate::update()
else
pingTemplate = data->m_IRParticleSysTmpl;

if (pingTemplate)
ParticleSystem *sys = TheParticleSystemManager->createParticleSystem( pingTemplate );
if (sys)
{
ParticleSystem *sys = TheParticleSystemManager->createParticleSystem( pingTemplate );
if (sys)
{
if (myDraw)
sys->attachToDrawable( myDraw );
else
sys->attachToObject( self );
if (myDraw)
sys->attachToDrawable( myDraw );
else
sys->attachToObject( self );

sys->setPosition( &bonePosition );
}
sys->setPosition( &bonePosition );
}

const ParticleSystemTemplate *beaconTemplate = data->m_IRBeaconParticleSysTmpl;
if (beaconTemplate)
sys = TheParticleSystemManager->createParticleSystem( beaconTemplate );//BEACON
if (sys)
{
ParticleSystem *sys = TheParticleSystemManager->createParticleSystem( beaconTemplate );//BEACON
if (sys)
{
if (myDraw)
sys->attachToDrawable( myDraw );
else
sys->attachToObject( self );
if (myDraw)
sys->attachToDrawable( myDraw );
else
sys->attachToObject( self );

sys->setPosition( &bonePosition );
sys->setPosition( &bonePosition );

}
}

AudioEventRTS IRPingSound;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9442,15 +9442,12 @@ static void _updateAndSetCurrentSystem()
// to be a tiny memory overwrite, now it is a crash since destroy() now has a function call.

ParticleSystemTemplate *parentTemp = TheParticleSystemManager->findParentTemplate(pTemp->getName(), 0);
if (parentTemp) {
ParticleSystem *parentSystem = nullptr;
parentSystem = TheParticleSystemManager->createParticleSystem(parentTemp);

if (parentSystem) {
ParticleSystem::mergeRelatedParticleSystems(parentSystem, st_particleSystem, true);
parentSystem->stop();
parentSystem->destroy();
}
ParticleSystem *parentSystem = TheParticleSystemManager->createParticleSystem(parentTemp);

if (parentSystem) {
ParticleSystem::mergeRelatedParticleSystems(parentSystem, st_particleSystem, true);
parentSystem->stop();
parentSystem->destroy();
}

Coord3D pos;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -294,13 +294,10 @@ void AutoHealBehavior::pulseHealObject( Object *obj )
obj->attemptHealingFromSoleBenefactor( data->m_healingAmount, getObject(), data->m_healingDelay );


if( data->m_unitHealPulseParticleSystemTmpl )
ParticleSystem *system = TheParticleSystemManager->createParticleSystem( data->m_unitHealPulseParticleSystemTmpl );
if( system )
{
ParticleSystem *system = TheParticleSystemManager->createParticleSystem( data->m_unitHealPulseParticleSystemTmpl );
if( system )
{
system->setPosition( obj->getPosition() );
}
system->setPosition( obj->getPosition() );
}

m_soonestHealFrame = TheGameLogic->getFrame() + data->m_healingDelay;// In case onDamage tries to wake us up early
Expand Down
Loading
Loading