@@ -212,16 +212,16 @@ void ParticleUplinkCannonUpdate::killEverything()
212
212
removeAllEffects ();
213
213
214
214
// This laser is independent from the other effects and needs to be specially handled.
215
- if ( m_orbitToTargetBeamID != INVALID_DRAWABLE_ID )
215
+ if ( m_orbitToTargetBeamID )
216
216
{
217
217
Drawable *beam = TheGameClient->findDrawableByID ( m_orbitToTargetBeamID );
218
218
if ( beam )
219
219
{
220
220
TheGameClient->destroyDrawable ( beam );
221
221
}
222
222
m_orbitToTargetBeamID = INVALID_DRAWABLE_ID;
223
+ m_orbitToTargetLaserRadius = LaserRadiusUpdate ();
223
224
}
224
- m_orbitToTargetLaserRadius = LaserRadiusUpdate ();
225
225
226
226
TheAudio->removeAudioEvent ( m_powerupSound.getPlayingHandle () );
227
227
TheAudio->removeAudioEvent ( m_unpackToReadySound.getPlayingHandle () );
@@ -457,43 +457,40 @@ UpdateSleepTime ParticleUplinkCannonUpdate::update()
457
457
break ;
458
458
case LASERSTATUS_BORN:
459
459
{
460
- if ( orbitalDecayStart <= now )
460
+ Drawable *beam = TheGameClient->findDrawableByID ( m_orbitToTargetBeamID );
461
+ if ( beam )
461
462
{
462
- Drawable * beam = TheGameClient-> findDrawableByID ( m_orbitToTargetBeamID );
463
- if ( beam )
463
+ // m_annihilationSound.setPosition( beam->getPosition() );
464
+ if ( orbitalDecayStart <= now )
464
465
{
465
- // m_annihilationSound.setPosition( beam->getPosition() );
466
466
static NameKeyType nameKeyClientUpdate = NAMEKEY ( " LaserUpdate" );
467
467
LaserUpdate *update = (LaserUpdate*)beam->findClientUpdateModule ( nameKeyClientUpdate );
468
468
if ( update )
469
469
{
470
470
update->setDecayFrames ( data->m_widthGrowFrames );
471
+ m_orbitToTargetLaserRadius.setDecayFrames ( data->m_widthGrowFrames );
471
472
}
473
+ m_laserStatus = LASERSTATUS_DECAYING;
472
474
}
473
- m_orbitToTargetLaserRadius.setDecayFrames ( data->m_widthGrowFrames );
474
- m_laserStatus = LASERSTATUS_DECAYING;
475
475
}
476
476
break ;
477
477
}
478
478
case LASERSTATUS_DECAYING:
479
479
{
480
- if ( orbitalDeathFrame <= now )
480
+ Drawable *beam = TheGameClient->findDrawableByID ( m_orbitToTargetBeamID );
481
+ if ( beam )
481
482
{
483
+ // m_annihilationSound.setPosition( beam->getPosition() );
482
484
TheAudio->removeAudioEvent ( m_annihilationSound.getPlayingHandle () );
483
- if ( m_orbitToTargetBeamID != INVALID_DRAWABLE_ID )
485
+ if ( orbitalDeathFrame <= now )
484
486
{
485
- Drawable *beam = TheGameClient->findDrawableByID ( m_orbitToTargetBeamID );
486
- if ( beam )
487
- {
488
- // m_annihilationSound.setPosition( beam->getPosition() );
489
- TheGameClient->destroyDrawable ( beam );
490
- }
487
+ TheGameClient->destroyDrawable ( beam );
491
488
m_orbitToTargetBeamID = INVALID_DRAWABLE_ID;
489
+ m_orbitToTargetLaserRadius = LaserRadiusUpdate ();
490
+ m_laserStatus = LASERSTATUS_DEAD;
491
+ m_startAttackFrame = 0 ;
492
+ setLogicalStatus ( STATUS_IDLE );
492
493
}
493
- m_orbitToTargetLaserRadius = LaserRadiusUpdate ();
494
- m_laserStatus = LASERSTATUS_DEAD;
495
- m_startAttackFrame = 0 ;
496
- setLogicalStatus ( STATUS_IDLE );
497
494
}
498
495
break ;
499
496
}
@@ -502,8 +499,8 @@ UpdateSleepTime ParticleUplinkCannonUpdate::update()
502
499
break ;
503
500
}
504
501
505
- const Bool isFiring = m_laserStatus != LASERSTATUS_NONE && m_laserStatus != LASERSTATUS_DEAD ;
506
- if ( isFiring )
502
+ Drawable *beam = TheGameClient-> findDrawableByID ( m_orbitToTargetBeamID ) ;
503
+ if ( beam && orbitalBirthFrame <= now && now <= orbitalDeathFrame )
507
504
{
508
505
509
506
if ( !m_manualTargetMode && !m_scriptedWaypointMode )
@@ -612,35 +609,27 @@ UpdateSleepTime ParticleUplinkCannonUpdate::update()
612
609
613
610
Real scorchRadius = 0 .0f ;
614
611
Real damageRadius = 0 .0f ;
615
- Real templateLaserRadius = 13 .0f ;
616
- Real visualLaserRadius = 0 .0f ;
617
612
618
613
// Reset the laser position
619
- Drawable *beam = TheGameClient->findDrawableByID ( m_orbitToTargetBeamID );
620
- if ( beam )
614
+ static NameKeyType nameKeyClientUpdate = NAMEKEY ( " LaserUpdate" );
615
+ LaserUpdate *update = (LaserUpdate*)beam->findClientUpdateModule ( nameKeyClientUpdate );
616
+ if ( update )
621
617
{
622
- static NameKeyType nameKeyClientUpdate = NAMEKEY ( " LaserUpdate" );
623
- LaserUpdate *update = (LaserUpdate*)beam->findClientUpdateModule ( nameKeyClientUpdate );
624
- if ( update )
625
- {
626
- update->initLaser ( NULL , NULL , &orbitPosition, &m_currentTargetPosition, " " );
627
- // TheSuperHackers @logic-client-separation The GameLogic has a dependency on this drawable.
628
- // The logical laser radius for the damage should probably be part of ParticleUplinkCannonUpdateModuleData.
629
- templateLaserRadius = update->getTemplateLaserRadius ();
630
- visualLaserRadius = update->getCurrentLaserRadius ();
631
- }
632
- }
633
- // TheSuperHackers @refactor helmutbuhler/xezon 17/05/2025
634
- // Originally the damageRadius was calculated with a value updated by LaserUpdate::clientUpdate.
635
- // To no longer rely on GameClient updates, this class now maintains a copy of the LaserRadiusUpdate.
636
- m_orbitToTargetLaserRadius.updateRadius ();
637
- const Real logicalLaserRadius = templateLaserRadius * m_orbitToTargetLaserRadius.getWidthScale ();
638
- damageRadius = logicalLaserRadius * data->m_damageRadiusScalar ;
639
- scorchRadius = logicalLaserRadius * data->m_scorchMarkScalar ;
640
- #if defined(RETAIL_COMPATIBLE_CRC)
641
- DEBUG_ASSERTCRASH (logicalLaserRadius == visualLaserRadius,
642
- (" ParticleUplinkCannonUpdate's laser radius does not match LaserUpdate's laser radius - will cause mismatch in VS6 retail compatible builds\n " ));
618
+ update->initLaser ( NULL , NULL , &orbitPosition, &m_currentTargetPosition, " " );
619
+ const Real visualLaserRadius = update->getCurrentLaserRadius ();
620
+ scorchRadius = visualLaserRadius * data->m_scorchMarkScalar ;
621
+
622
+ // TheSuperHackers @refactor helmutbuhler/xezon 17/05/2025
623
+ // Originally the damage radius was calculated with a value updated by LaserUpdate::clientUpdate().
624
+ // To no longer rely on client updates, this class now maintains a logical copy of the visual laser radius.
625
+ m_orbitToTargetLaserRadius.updateRadius ();
626
+ const Real logicalLaserRadius = update->getTemplateLaserRadius () * m_orbitToTargetLaserRadius.getWidthScale ();
627
+ damageRadius = logicalLaserRadius * data->m_damageRadiusScalar ;
628
+ #if RETAIL_COMPATIBLE_XFER_CRC
629
+ DEBUG_ASSERTCRASH (logicalLaserRadius == visualLaserRadius,
630
+ (" ParticleUplinkCannonUpdate's laser radius does not match LaserUpdate's laser radius - will cause mismatch in VS6 retail compatible builds\n " ));
643
631
#endif
632
+ }
644
633
645
634
// Create scorch marks periodically
646
635
if ( m_nextScorchMarkFrame <= now )
@@ -999,15 +988,13 @@ void ParticleUplinkCannonUpdate::createOrbitToTargetLaser( UnsignedInt growthFra
999
988
{
1000
989
const ParticleUplinkCannonUpdateModuleData *data = getParticleUplinkCannonUpdateModuleData ();
1001
990
1002
- if ( m_orbitToTargetBeamID != INVALID_DRAWABLE_ID )
991
+ Drawable *beam = TheGameClient->findDrawableByID ( m_orbitToTargetBeamID );
992
+ if ( beam )
1003
993
{
1004
- Drawable *beam = TheGameClient->findDrawableByID ( m_orbitToTargetBeamID );
1005
- if ( beam )
1006
- {
1007
- TheAudio->removeAudioEvent ( m_annihilationSound.getPlayingHandle () );
1008
- TheGameClient->destroyDrawable ( beam );
1009
- }
994
+ TheAudio->removeAudioEvent ( m_annihilationSound.getPlayingHandle () );
995
+ TheGameClient->destroyDrawable ( beam );
1010
996
m_orbitToTargetBeamID = INVALID_DRAWABLE_ID;
997
+ m_orbitToTargetLaserRadius = LaserRadiusUpdate ();
1011
998
}
1012
999
1013
1000
if ( data->m_particleBeamLaserName .isNotEmpty () )
@@ -1027,6 +1014,7 @@ void ParticleUplinkCannonUpdate::createOrbitToTargetLaser( UnsignedInt growthFra
1027
1014
orbitPosition.set ( &m_initialTargetPosition );
1028
1015
orbitPosition.z += 500 .0f ;
1029
1016
update->initLaser ( NULL , NULL , &orbitPosition, &m_initialTargetPosition, " " , growthFrames );
1017
+ m_orbitToTargetLaserRadius.initRadius ( growthFrames );
1030
1018
}
1031
1019
}
1032
1020
}
@@ -1037,9 +1025,6 @@ void ParticleUplinkCannonUpdate::createOrbitToTargetLaser( UnsignedInt growthFra
1037
1025
m_annihilationSound.setPlayingHandle ( TheAudio->addAudioEvent ( &m_annihilationSound ) );
1038
1026
}
1039
1027
}
1040
-
1041
- m_orbitToTargetLaserRadius = LaserRadiusUpdate ();
1042
- m_orbitToTargetLaserRadius.initRadius ( growthFrames );
1043
1028
}
1044
1029
1045
1030
// -------------------------------------------------------------------------------------------------
0 commit comments