Skip to content
Open
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 @@ -1559,4 +1559,36 @@ void ParticleUplinkCannonUpdate::loadPostProcess( void )
}
}

// TheSuperHackers @bugfix stephanmeesters 13/02/2026
// Fix issue where particle cannon sounds are not audible after saveload.

if( (m_status == STATUS_CHARGING || m_status == STATUS_PREPARING || m_status == STATUS_ALMOST_READY) &&
m_powerupSound.getEventName().isNotEmpty() )
{
m_powerupSound.setObjectID( getObject()->getID() );
m_powerupSound.setPlayingHandle( TheAudio->addAudioEvent( &m_powerupSound ) );
}

if( (m_status == STATUS_PREPARING || m_status == STATUS_ALMOST_READY || m_status == STATUS_READY_TO_FIRE || m_status == STATUS_PREFIRE) &&
m_unpackToReadySound.getEventName().isNotEmpty() )
{
m_unpackToReadySound.setObjectID( getObject()->getID() );
m_unpackToReadySound.setPlayingHandle( TheAudio->addAudioEvent( &m_unpackToReadySound ) );
}

if ( m_status == STATUS_FIRING || m_status == STATUS_POSTFIRE ||
(m_status == STATUS_PACKING && (m_laserStatus == LASERSTATUS_DECAYING || m_laserStatus == LASERSTATUS_DEAD)) )
Copy link

Choose a reason for hiding this comment

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

This is really difficult to maintain correctness, because it needs to manually mirror the logic correctly and when the audio logic changes then this code would need to be adapted again, which then carries the risk of creating new bugs.

Instead, I suggest adding an Xfer function to AudioEventRTS and handle the state save/load in there for all possibilities. This will not work for legacy save files, but going forward it should be much simpler to maintain and be robust for any logic changes.

This also means that Xfer can be used for other module sounds as well. I expect Particle Cannon is not the only object that has this audio issue. But it is very obvious for it.

Copy link
Author

Choose a reason for hiding this comment

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

That sounds like a much better solution.

Perhaps keep this code but put it behind RETAIL_COMPATIBLE_CRC or similar, so we know to drop it after breaking compatibility?

{
if( m_firingToIdleSound.getEventName().isNotEmpty() )
{
m_firingToIdleSound.setObjectID( getObject()->getID() );
m_firingToIdleSound.setPlayingHandle( TheAudio->addAudioEvent( &m_firingToIdleSound ) );
}

if( m_orbitToTargetBeamID != INVALID_DRAWABLE_ID && m_annihilationSound.getEventName().isNotEmpty() )
{
m_annihilationSound.setDrawableID( m_orbitToTargetBeamID );
m_annihilationSound.setPlayingHandle( TheAudio->addAudioEvent( &m_annihilationSound ) );
}
}
}
Loading