@@ -184,6 +184,10 @@ ParticleUplinkCannonUpdate::ParticleUplinkCannonUpdate( Thing *thing, const Modu
184184 m_nextDamagePulseFrame = 0 ;
185185 m_startAttackFrame = 0 ;
186186 m_startDecayFrame = 0 ;
187+ #if RETAIL_COMPATIBLE_XFER_SAVE
188+ m_lastDrivingClickFrame = 0 ;
189+ m_2ndLastDrivingClickFrame = 0 ;
190+ #endif
187191 m_lastDrivingClickTimeMsec = 0 ;
188192 m_2ndLastDrivingClickTimeMsec = 0 ;
189193 m_clientShroudedLastFrame = FALSE ;
@@ -374,6 +378,10 @@ void ParticleUplinkCannonUpdate::setSpecialPowerOverridableDestination( const Co
374378 {
375379 m_overrideTargetDestination = *loc;
376380 m_manualTargetMode = TRUE ;
381+ #if RETAIL_COMPATIBLE_XFER_SAVE
382+ m_2ndLastDrivingClickFrame = m_lastDrivingClickFrame;
383+ m_lastDrivingClickFrame = TheGameLogic->getFrame ();
384+ #endif
377385 m_2ndLastDrivingClickTimeMsec = m_lastDrivingClickTimeMsec;
378386 m_lastDrivingClickTimeMsec = timeGetTime ();
379387 }
@@ -567,7 +575,11 @@ UpdateSleepTime ParticleUplinkCannonUpdate::update()
567575 else
568576 {
569577 Real speed = data->m_manualDrivingSpeed ;
578+ #if !RETAIL_COMPATIBLE_CRC
570579 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 );
@@ -1499,10 +1516,38 @@ void ParticleUplinkCannonUpdate::xfer( Xfer *xfer )
14991516 }
15001517
15011518 // the time of last manual target click (milliseconds)
1502- xfer->xferUnsignedInt ( & m_lastDrivingClickTimeMsec );
1503-
1504- // the time of the 2nd last manual target click (milliseconds)
1505- xfer->xferUnsignedInt ( &m_2ndLastDrivingClickTimeMsec );
1519+ #if RETAIL_COMPATIBLE_XFER_SAVE
1520+ // Retail builds stay at version 3 for compatibility, so always use old frame format
1521+ xfer->xferUnsignedInt ( & m_lastDrivingClickFrame );
1522+ 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