Skip to content
Draft
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 @@ -34,6 +34,7 @@
#include "Common/Thing.h"
#include "Common/ThingFactory.h"
#include "Common/GameAudio.h"
#include "Common/GameState.h"
#include "Common/ThingTemplate.h"
#include "Common/Xfer.h"
#include "GameLogic/Weapon.h"
Expand Down Expand Up @@ -106,7 +107,12 @@ W3DTankDraw::W3DTankDraw( Thing *thing, const ModuleData* moduleData )
m_lastDirection.y=0.0f;
m_lastDirection.z=0.0f;

createTreadEmitters();
// TheSuperHackers @bugfix stephanmeesters 20/02/2026
// If loading from savegame, delay non-saveable emitter creation until postProcess.
if (TheGameState == nullptr || TheGameState->isInLoadGame() == FALSE)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is calling a function that is commented with "brutal hack", indicating that using this function is undesired. Can we solve this another way perhaps? Perhaps create particle effects later?

{
createTreadEmitters();
}
}

//-------------------------------------------------------------------------------------------------
Expand Down Expand Up @@ -435,8 +441,6 @@ void W3DTankDraw::loadPostProcess( void )
// extend base class
W3DModelDraw::loadPostProcess();

// toss any existing tread emitters and re-create 'em (since this module expects 'em to always be around)
tossTreadEmitters();
createTreadEmitters();

}
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
#include "Common/Thing.h"
#include "Common/ThingFactory.h"
#include "Common/GameAudio.h"
#include "Common/GameState.h"
#include "Common/GlobalData.h"
#include "Common/ThingTemplate.h"
#include "Common/Xfer.h"
Expand Down Expand Up @@ -119,7 +120,12 @@ m_prevRenderObj(nullptr)

m_treadCount=0;

createTreadEmitters();
// TheSuperHackers @bugfix stephanmeesters 20/02/2026
// If loading from savegame, delay non-saveable emitter creation until postProcess.
if (TheGameState == nullptr || TheGameState->isInLoadGame() == FALSE)
{
createTreadEmitters();
}
}

//-------------------------------------------------------------------------------------------------
Expand Down Expand Up @@ -761,8 +767,6 @@ void W3DTankTruckDraw::loadPostProcess( void )
// toss any existing wheel emitters (no need to re-create; we'll do that on demand)
tossWheelEmitters();

// toss any existing tread emitters and re-create 'em (since this module expects 'em to always be around)
tossTreadEmitters();
createTreadEmitters();

}
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,7 @@ class AutoHealBehaviorModuleData : public UpdateModuleData
//-------------------------------------------------------------------------------------------------
class AutoHealBehavior : public UpdateModule,
public UpgradeMux,
public DamageModuleInterface
{

public DamageModuleInterface {
MEMORY_POOL_GLUE_WITH_USERLOOKUP_CREATE( AutoHealBehavior, "AutoHealBehavior" )
MAKE_STANDARD_MODULE_MACRO_WITH_MODULE_DATA( AutoHealBehavior, AutoHealBehaviorModuleData )

Expand Down Expand Up @@ -174,6 +172,7 @@ class AutoHealBehavior : public UpdateModule,
private:

void pulseHealObject( Object *obj );
void createEmitters();

ParticleSystemID m_radiusParticleSystemID;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,8 @@ class GrantStealthBehavior : public UpdateModule
private:

void grantStealthToObject( Object *obj );
void createEmitters();

ParticleSystemID m_radiusParticleSystemID;
Real m_currentScanRadius;
};
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
#include "Common/ThingTemplate.h"
#include "Common/INI.h"
#include "Common/Player.h"
#include "Common/GameState.h"
#include "Common/Xfer.h"
#include "GameClient/ParticleSys.h"
#include "GameClient/Anim2D.h"
Expand Down Expand Up @@ -94,20 +95,12 @@ AutoHealBehavior::AutoHealBehavior( Thing *thing, const ModuleData* moduleData )
m_radiusParticleSystemID = INVALID_PARTICLE_SYSTEM_ID;
m_soonestHealFrame = 0;
m_stopped = false;
Object *obj = getObject();

// TheSuperHackers @bugfix stephanmeesters 20/02/2026
// If loading from savegame, delay non-saveable emitter creation until postProcess.
if (TheGameState == nullptr || TheGameState->isInLoadGame() == FALSE)
{
if( d->m_radiusParticleSystemTmpl )
{
ParticleSystem *particleSystem;

particleSystem = TheParticleSystemManager->createParticleSystem( d->m_radiusParticleSystemTmpl );
if( particleSystem )
{
particleSystem->setPosition( obj->getPosition() );
m_radiusParticleSystemID = particleSystem->getSystemID();
}
}
createEmitters();
}

if (d->m_initiallyActive)
Expand Down Expand Up @@ -373,4 +366,22 @@ void AutoHealBehavior::loadPostProcess( void )
// extend base class
UpgradeMux::upgradeMuxLoadPostProcess();

createEmitters();

}

// ------------------------------------------------------------------------------------------------
// ------------------------------------------------------------------------------------------------
void AutoHealBehavior::createEmitters( void )
{
const AutoHealBehaviorModuleData *d = getAutoHealBehaviorModuleData();
if( m_radiusParticleSystemID == INVALID_PARTICLE_SYSTEM_ID && d->m_radiusParticleSystemTmpl )
{
ParticleSystem *particleSystem = TheParticleSystemManager->createParticleSystem(d->m_radiusParticleSystemTmpl);
if( particleSystem )
{
particleSystem->setPosition( getObject()->getPosition() );
m_radiusParticleSystemID = particleSystem->getSystemID();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
#include "Common/ThingTemplate.h"
#include "Common/INI.h"
#include "Common/Player.h"
#include "Common/GameState.h"
#include "Common/Xfer.h"
#include "GameClient/ParticleSys.h"
#include "GameClient/Anim2D.h"
Expand Down Expand Up @@ -96,21 +97,11 @@ GrantStealthBehavior::GrantStealthBehavior( Thing *thing, const ModuleData* modu

m_currentScanRadius = d->m_startRadius;


Object *obj = getObject();

// TheSuperHackers @bugfix stephanmeesters 20/02/2026
// If loading from savegame, delay non-saveable emitter creation until postProcess.
if ( TheGameState == nullptr || TheGameState->isInLoadGame() == FALSE )
{
if( d->m_radiusParticleSystemTmpl )
{
ParticleSystem *particleSystem;

particleSystem = TheParticleSystemManager->createParticleSystem( d->m_radiusParticleSystemTmpl );
if( particleSystem )
{
particleSystem->setPosition( obj->getPosition() );
m_radiusParticleSystemID = particleSystem->getSystemID();
}
}
createEmitters();
}

setWakeFrame( getObject(), UPDATE_SLEEP_NONE );
Expand Down Expand Up @@ -246,5 +237,21 @@ void GrantStealthBehavior::loadPostProcess( void )
// extend base class
UpdateModule::loadPostProcess();

createEmitters();
}

// ------------------------------------------------------------------------------------------------
// ------------------------------------------------------------------------------------------------
void GrantStealthBehavior::createEmitters( void )
{
const GrantStealthBehaviorModuleData *d = getGrantStealthBehaviorModuleData();
if( m_radiusParticleSystemID == INVALID_PARTICLE_SYSTEM_ID && d->m_radiusParticleSystemTmpl )
{
ParticleSystem *particleSystem = TheParticleSystemManager->createParticleSystem(d->m_radiusParticleSystemTmpl);
if( particleSystem )
{
particleSystem->setPosition( getObject()->getPosition() );
m_radiusParticleSystemID = particleSystem->getSystemID();
}
}
}
Loading