@@ -184,8 +184,12 @@ ParticleUplinkCannonUpdate::ParticleUplinkCannonUpdate( Thing *thing, const Modu
184184 m_nextDamagePulseFrame = 0 ;
185185 m_startAttackFrame = 0 ;
186186 m_startDecayFrame = 0 ;
187+ #if RETAIL_COMPATIBLE_XFER_SAVE
187188 m_lastDrivingClickFrame = 0 ;
188189 m_2ndLastDrivingClickFrame = 0 ;
190+ #endif
191+ m_lastDrivingClickTimeMsec = 0 ;
192+ m_2ndLastDrivingClickTimeMsec = 0 ;
189193 m_clientShroudedLastFrame = FALSE ;
190194
191195 for ( Int i = 0 ; i < MAX_OUTER_NODES; i++ )
@@ -374,8 +378,12 @@ void ParticleUplinkCannonUpdate::setSpecialPowerOverridableDestination( const Co
374378 {
375379 m_overrideTargetDestination = *loc;
376380 m_manualTargetMode = TRUE ;
381+ #if RETAIL_COMPATIBLE_XFER_SAVE
377382 m_2ndLastDrivingClickFrame = m_lastDrivingClickFrame;
378383 m_lastDrivingClickFrame = TheGameLogic->getFrame ();
384+ #endif
385+ m_2ndLastDrivingClickTimeMsec = m_lastDrivingClickTimeMsec;
386+ m_lastDrivingClickTimeMsec = timeGetTime ();
379387 }
380388}
381389
@@ -567,7 +575,11 @@ UpdateSleepTime ParticleUplinkCannonUpdate::update()
567575 else
568576 {
569577 Real speed = data->m_manualDrivingSpeed ;
570- if ( m_scriptedWaypointMode || m_lastDrivingClickFrame - m_2ndLastDrivingClickFrame < data->m_doubleClickToFastDriveDelay )
578+ #if !RETAIL_COMPATIBLE_CRC
579+ if ( m_scriptedWaypointMode || (m_lastDrivingClickTimeMsec != 0 && m_2ndLastDrivingClickTimeMsec != 0 && m_lastDrivingClickTimeMsec - m_2ndLastDrivingClickTimeMsec < data->m_doubleClickToFastDriveDelay ) )
580+ #else
581+ if ( m_scriptedWaypointMode || (m_lastDrivingClickFrame - m_2ndLastDrivingClickFrame < data->m_doubleClickToFastDriveDelay ) )
582+ #endif
571583 {
572584 // Because we double clicked, use the faster driving speed.
573585 speed = data->m_manualFastDrivingSpeed ;
@@ -1392,7 +1404,12 @@ void ParticleUplinkCannonUpdate::crc( Xfer *xfer )
13921404// ------------------------------------------------------------------------------------------------
13931405/* * Xfer method
13941406 * Version Info:
1395- * 1: Initial version */
1407+ * 1: Initial version
1408+ * 2: Added m_startDecayFrame
1409+ * 3: Added m_manualTargetMode, m_scriptedWaypointMode, m_nextDestWaypointID
1410+ * 4: Added m_orbitToTargetLaserRadius
1411+ * 5: Changed m_lastDrivingClickFrame and m_2ndLastDrivingClickFrame to m_lastDrivingClickTimeMsec and m_2ndLastDrivingClickTimeMsec (frames to milliseconds)
1412+ */
13961413// ------------------------------------------------------------------------------------------------
13971414void ParticleUplinkCannonUpdate::xfer ( Xfer *xfer )
13981415{
@@ -1402,7 +1419,7 @@ void ParticleUplinkCannonUpdate::xfer( Xfer *xfer )
14021419#if RETAIL_COMPATIBLE_XFER_SAVE
14031420 const XferVersion currentVersion = 3 ;
14041421#else
1405- const XferVersion currentVersion = 4 ;
1422+ const XferVersion currentVersion = 5 ;
14061423#endif
14071424 XferVersion version = currentVersion;
14081425 xfer->xferVersion ( &version, currentVersion );
@@ -1498,11 +1515,39 @@ void ParticleUplinkCannonUpdate::xfer( Xfer *xfer )
14981515 m_startDecayFrame = m_startAttackFrame + data->m_totalFiringFrames ;
14991516 }
15001517
1501- // the time of last manual target click
1518+ // the time of last manual target click (milliseconds)
1519+ #if RETAIL_COMPATIBLE_XFER_SAVE
1520+ // Retail builds stay at version 3 for compatibility, so always use old frame format
15021521 xfer->xferUnsignedInt ( & m_lastDrivingClickFrame );
1503-
1504- // the time of the 2nd last manual target click
15051522 xfer->xferUnsignedInt ( &m_2ndLastDrivingClickFrame );
1523+ #if !RETAIL_COMPATIBLE_CRC
1524+ if ( xfer->getXferMode () == XFER_LOAD )
1525+ {
1526+ // Can't convert frames to milliseconds accurately, so set to 0
1527+ m_lastDrivingClickTimeMsec = 0 ;
1528+ m_2ndLastDrivingClickTimeMsec = 0 ;
1529+ }
1530+ #endif
1531+ #else
1532+ if ( version >= 5 )
1533+ {
1534+ xfer->xferUnsignedInt ( & m_lastDrivingClickTimeMsec );
1535+ xfer->xferUnsignedInt ( &m_2ndLastDrivingClickTimeMsec );
1536+ }
1537+ else
1538+ {
1539+ // Old versions stored frame numbers, which we can't meaningfully convert to milliseconds
1540+ UnsignedInt oldLastDrivingClickFrame = 0 ;
1541+ UnsignedInt old2ndLastDrivingClickFrame = 0 ;
1542+ xfer->xferUnsignedInt ( &oldLastDrivingClickFrame );
1543+ xfer->xferUnsignedInt ( &old2ndLastDrivingClickFrame );
1544+ if ( xfer->getXferMode () == XFER_LOAD )
1545+ {
1546+ m_lastDrivingClickTimeMsec = 0 ;
1547+ m_2ndLastDrivingClickTimeMsec = 0 ;
1548+ }
1549+ }
1550+ #endif
15061551
15071552 if ( version >= 3 )
15081553 {
0 commit comments