Skip to content

Commit 49f0e5f

Browse files
committed
unity(particlesys): Merge removal of Drawable Particle Attachments from Zero Hour (TheSuperHackers#2153)
1 parent 64d9b08 commit 49f0e5f

5 files changed

Lines changed: 2 additions & 90 deletions

File tree

Generals/Code/GameEngine/Include/GameClient/Drawable.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -432,9 +432,6 @@ class Drawable : public Thing,
432432
void clearAndSetModelConditionFlags( const ModelConditionFlags& clr, const ModelConditionFlags& set );
433433
void replaceModelConditionFlags( const ModelConditionFlags &flags, Bool forceReplace = FALSE );
434434

435-
void attachToParticleSystem( Particle *p ); ///< attach this Drawable to a particle system
436-
void detachFromParticleSystem( void ); ///< detach this from any particle system
437-
438435
Bool handleWeaponFireFX(
439436
WeaponSlotType wslot,
440437
Int specificBarrelToUse,
@@ -538,8 +535,6 @@ class Drawable : public Thing,
538535

539536
Bool getShouldAnimate( Bool considerPower ) const;
540537

541-
void friend_setParticle( Particle *particle ) { m_particle = particle; }
542-
543538
// flash drawable methods ---------------------------------------------------------
544539
Int getFlashCount( void ) { return m_flashCount; }
545540
void setFlashCount( Int count ) { m_flashCount = count; }
@@ -636,7 +631,6 @@ class Drawable : public Thing,
636631
Real m_decalOpacity;
637632

638633
Object *m_object; ///< object (if any) that this drawable represents
639-
Particle *m_particle; ///< particle (if any) that this Drawable is associated with
640634

641635
DrawableID m_id; ///< this drawable's unique ID
642636
Drawable *m_nextDrawable;

Generals/Code/GameEngine/Include/GameClient/ParticleSys.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,6 @@ class Particle : public MemoryPoolObject,
174174
void doWindMotion( void ); ///< do wind motion (if present) from particle system
175175

176176
void applyForce( const Coord3D *force ); ///< add the given acceleration
177-
void detachDrawable( void ) { m_drawable = nullptr; } ///< detach the Drawable pointer from this particle
178177

179178
const Coord3D *getPosition( void ) { return &m_pos; }
180179
Real getSize( void ) { return m_size; }
@@ -231,7 +230,6 @@ class Particle : public MemoryPoolObject,
231230
RGBColor m_colorRate; ///< current rate of color change
232231
Int m_colorTargetKey; ///< next index into key array
233232

234-
Drawable * m_drawable; ///< drawable associated with this particle
235233

236234
Bool m_isCulled; ///< status of particle relative to screen bounds
237235
public:

Generals/Code/GameEngine/Source/GameClient/Drawable.cpp

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -384,7 +384,6 @@ Drawable::Drawable( const ThingTemplate *thingTemplate, DrawableStatusBits statu
384384

385385
// initially not bound to an object
386386
m_object = nullptr;
387-
m_particle = nullptr;
388387

389388
// tintStatusTracking
390389
m_tintStatus = 0;
@@ -514,7 +513,6 @@ Drawable::~Drawable()
514513

515514
// reset object to nullptr so we never mistaken grab "dead" objects
516515
m_object = nullptr;
517-
m_particle = nullptr;
518516

519517
// delete any icons present
520518
deleteInstance(m_iconInfo);
@@ -762,26 +760,6 @@ Bool Drawable::getCurrentWorldspaceClientBonePositions(const char* boneName, Mat
762760
return false;
763761
}
764762

765-
//-------------------------------------------------------------------------------------------------
766-
/** Attach to a particle system */
767-
//-------------------------------------------------------------------------------------------------
768-
void Drawable::attachToParticleSystem( Particle *p )
769-
{
770-
m_particle = p;
771-
}
772-
773-
//-------------------------------------------------------------------------------------------------
774-
/** Detach from a particle system, if attached */
775-
//-------------------------------------------------------------------------------------------------
776-
void Drawable::detachFromParticleSystem( void )
777-
{
778-
if (m_particle)
779-
{
780-
m_particle->detachDrawable();
781-
m_particle = nullptr;
782-
}
783-
}
784-
785763
//-------------------------------------------------------------------------------------------------
786764
void Drawable::setTerrainDecal(TerrainDecalType type)
787765
{

Generals/Code/GameEngine/Source/GameClient/GameClient.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -810,9 +810,6 @@ void GameClient::destroyDrawable( Drawable *draw )
810810
// remove any notion of the Drawable in the in-game user interface
811811
TheInGameUI->disregardDrawable( draw );
812812

813-
// detach this Drawable from any particle system that may be using it
814-
draw->detachFromParticleSystem();
815-
816813
// remove from the master list
817814
draw->removeFromList(&m_drawableList);
818815

Generals/Code/GameEngine/Source/GameClient/System/ParticleSys.cpp

Lines changed: 2 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -326,18 +326,6 @@ Particle::Particle( ParticleSystem *system, const ParticleInfo *info )
326326

327327
m_colorScale = info->m_colorScale;
328328

329-
if (system->isUsingDrawables())
330-
{
331-
const ThingTemplate *tmpl = TheThingFactory->findTemplate(system->getParticleTypeName());
332-
DEBUG_ASSERTCRASH(tmpl, ("Drawable %s not found",system->getParticleTypeName().str()));
333-
if (tmpl)
334-
{
335-
m_drawable = TheThingFactory->newDrawable(tmpl);
336-
if (m_drawable)
337-
m_drawable->attachToParticleSystem( this );
338-
}
339-
}
340-
341329
m_inSystemList = m_inOverallList = FALSE;
342330
m_systemPrev = m_systemNext = m_overallPrev = m_overallNext = nullptr;
343331

@@ -358,10 +346,6 @@ Particle::~Particle()
358346
// tell the particle system that this particle is gone
359347
m_system->removeParticle( this );
360348

361-
if (m_drawable)
362-
TheGameClient->destroyDrawable( m_drawable );
363-
m_drawable = nullptr;
364-
365349
// if this particle was controlling another particle system, destroy that system
366350
if (m_systemUnderControl)
367351
{
@@ -517,17 +501,6 @@ Bool Particle::update( void )
517501
m_accel.y = 0.0f;
518502
m_accel.z = 0.0f;
519503

520-
if (m_drawable)
521-
{
522-
Matrix3D rot;
523-
rot.Make_Identity();
524-
rot.Rotate_X( m_angleX );
525-
rot.Rotate_Y( m_angleY );
526-
rot.Rotate_Z( m_angleZ );
527-
m_drawable->setInstanceMatrix( &rot );
528-
m_drawable->setPosition( &m_pos );
529-
}
530-
531504
// monitor lifetime
532505
if (m_lifetimeLeft && --m_lifetimeLeft == 0)
533506
return false;
@@ -640,11 +613,6 @@ ParticlePriorityType Particle::getPriority( void )
640613
// ------------------------------------------------------------------------------------------------
641614
Bool Particle::isInvisible( void )
642615
{
643-
// Drawables are never invisible (yet)
644-
/// @todo Allow Drawables to fade via alpha (MSB)
645-
if (m_drawable)
646-
return false;
647-
648616
switch (m_system->getShaderType())
649617
{
650618
case ParticleSystemInfo::ADDITIVE:
@@ -742,31 +710,8 @@ void Particle::xfer( Xfer *xfer )
742710
xfer->xferInt( &m_colorTargetKey );
743711

744712
// drawable
745-
DrawableID drawableID = m_drawable ? m_drawable->getID() : INVALID_DRAWABLE_ID;
746-
xfer->xferDrawableID( &drawableID );
747-
if( xfer->getXferMode() == XFER_LOAD && drawableID != INVALID_DRAWABLE_ID )
748-
{
749-
750-
//
751-
// save drawable pointer, note that this xfer block is after all the drawable stuff
752-
// so we don't need to post process anything all the correct drawables are loaded
753-
// and available to us
754-
//
755-
m_drawable = TheGameClient->findDrawableByID( drawableID );
756-
757-
// sanity
758-
if( m_drawable == nullptr )
759-
{
760-
761-
DEBUG_CRASH(( "Particle::xfer - Unable to find matching drawable id for particle" ));
762-
throw SC_INVALID_DATA;
763-
764-
}
765-
766-
// set the particle pointer in the drawable
767-
m_drawable->friend_setParticle( this );
768-
769-
}
713+
DrawableID drawableID = INVALID_DRAWABLE_ID;
714+
xfer->xferDrawableID( &drawableID ); //saving for backwards compatibility when we supported drawables.
770715

771716
// system under control as an id
772717
ParticleSystemID systemUnderControlID = m_systemUnderControl ? m_systemUnderControl->getSystemID() : INVALID_PARTICLE_SYSTEM_ID;

0 commit comments

Comments
 (0)