|
36 | 36 | #include "Common/RandomValue.h" |
37 | 37 | #include "Common/Xfer.h" |
38 | 38 | #include "GameClient/Drawable.h" |
| 39 | +#include "GameClient/ParticleSys.h" |
39 | 40 | #include "GameClient/FXList.h" |
40 | 41 | #include "GameLogic/GameLogic.h" |
41 | 42 | #include "GameLogic/Object.h" |
@@ -126,13 +127,16 @@ DumbProjectileBehavior::DumbProjectileBehavior( Thing *thing, const ModuleData* |
126 | 127 | m_flightPathEnd.zero(); |
127 | 128 | m_currentFlightPathStep = 0; |
128 | 129 | m_extraBonusFlags = 0; |
| 130 | + m_exhaustSysTmpl = nullptr; |
| 131 | + m_exhaustID = INVALID_PARTICLE_SYSTEM_ID; |
129 | 132 |
|
130 | 133 | m_hasDetonated = FALSE; |
131 | 134 | } |
132 | 135 |
|
133 | 136 | //------------------------------------------------------------------------------------------------- |
134 | 137 | DumbProjectileBehavior::~DumbProjectileBehavior() |
135 | 138 | { |
| 139 | + tossExhaust(); |
136 | 140 | } |
137 | 141 |
|
138 | 142 | //------------------------------------------------------------------------------------------------- |
@@ -324,6 +328,16 @@ static Bool calcTrajectory( |
324 | 328 |
|
325 | 329 | #endif // NOT_IN_USE |
326 | 330 |
|
| 331 | +//------------------------------------------------------------------------------------------------- |
| 332 | +void DumbProjectileBehavior::tossExhaust() |
| 333 | +{ |
| 334 | + if (m_exhaustID != INVALID_PARTICLE_SYSTEM_ID) |
| 335 | + { |
| 336 | + TheParticleSystemManager->destroyParticleSystemByID(m_exhaustID); |
| 337 | + m_exhaustID = INVALID_PARTICLE_SYSTEM_ID; |
| 338 | + } |
| 339 | +} |
| 340 | + |
327 | 341 | //------------------------------------------------------------------------------------------------- |
328 | 342 | // Prepares the missile for launch via proper weapon-system channels. |
329 | 343 | //------------------------------------------------------------------------------------------------- |
@@ -407,6 +421,12 @@ void DumbProjectileBehavior::projectileFireAtObjectOrPosition( const Object *vic |
407 | 421 | return; |
408 | 422 | } |
409 | 423 | m_currentFlightPathStep = 0;// We are at the first point, because the launching put us there |
| 424 | + |
| 425 | + m_exhaustSysTmpl = exhaustSysOverride; |
| 426 | + if (m_exhaustSysTmpl != nullptr) |
| 427 | + { |
| 428 | + m_exhaustID = TheParticleSystemManager->createAttachedParticleSystemID(m_exhaustSysTmpl, getObject()); |
| 429 | + } |
410 | 430 | } |
411 | 431 |
|
412 | 432 | //------------------------------------------------------------------------------------------------- |
@@ -845,6 +865,18 @@ void DumbProjectileBehavior::xfer( Xfer *xfer ) |
845 | 865 |
|
846 | 866 | } |
847 | 867 |
|
| 868 | + AsciiString exhaustName; |
| 869 | + if (m_exhaustSysTmpl) |
| 870 | + { |
| 871 | + exhaustName = m_exhaustSysTmpl->getName(); |
| 872 | + } |
| 873 | + xfer->xferAsciiString(&exhaustName); |
| 874 | + if (exhaustName.isNotEmpty() && m_exhaustSysTmpl == nullptr) |
| 875 | + { |
| 876 | + m_exhaustSysTmpl = TheParticleSystemManager->findTemplate(exhaustName); |
| 877 | + } |
| 878 | + |
| 879 | + |
848 | 880 | // lifespan frame |
849 | 881 | xfer->xferUnsignedInt( &m_lifespanFrame ); |
850 | 882 |
|
|
0 commit comments