Skip to content
Original file line number Diff line number Diff line change
Expand Up @@ -225,8 +225,13 @@ class ParticleUplinkCannonUpdate : public UpdateModule, public SpecialPowerUpdat
UnsignedInt m_nextDamagePulseFrame;
UnsignedInt m_startAttackFrame;
UnsignedInt m_startDecayFrame;
UnsignedInt m_lastDrivingClickFrame;
UnsignedInt m_2ndLastDrivingClickFrame;
#if RETAIL_COMPATIBLE_CRC || RETAIL_COMPATIBLE_XFER_SAVE
UnsignedInt m_lastDrivingClickFrame; // Frame number for retail compatibility
UnsignedInt m_2ndLastDrivingClickFrame; // Frame number for retail compatibility
#else
UnsignedInt m_lastDrivingClickTimeMsec; // Real-time milliseconds
UnsignedInt m_2ndLastDrivingClickTimeMsec; // Real-time milliseconds
#endif

Bool m_upBonesCached;
Bool m_defaultInfoCached;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -183,8 +183,13 @@ ParticleUplinkCannonUpdate::ParticleUplinkCannonUpdate( Thing *thing, const Modu
m_nextDamagePulseFrame = 0;
m_startAttackFrame = 0;
m_startDecayFrame = 0;
#if RETAIL_COMPATIBLE_CRC || RETAIL_COMPATIBLE_XFER_SAVE
m_lastDrivingClickFrame = 0;
m_2ndLastDrivingClickFrame = 0;
#else
m_lastDrivingClickTimeMsec = 0;
m_2ndLastDrivingClickTimeMsec = 0;
#endif
m_clientShroudedLastFrame = FALSE;

for( Int i = 0; i < MAX_OUTER_NODES; i++ )
Expand Down Expand Up @@ -324,8 +329,13 @@ void ParticleUplinkCannonUpdate::setSpecialPowerOverridableDestination( const Co
{
m_overrideTargetDestination = *loc;
m_manualTargetMode = true;
#if RETAIL_COMPATIBLE_CRC || RETAIL_COMPATIBLE_XFER_SAVE
m_2ndLastDrivingClickFrame = m_lastDrivingClickFrame;
m_lastDrivingClickFrame = TheGameLogic->getFrame();
#else
m_2ndLastDrivingClickTimeMsec = m_lastDrivingClickTimeMsec;
m_lastDrivingClickTimeMsec = timeGetTime();
#endif
}
}

Expand Down Expand Up @@ -517,7 +527,14 @@ UpdateSleepTime ParticleUplinkCannonUpdate::update()
else
{
Real speed = data->m_manualDrivingSpeed;
if( m_lastDrivingClickFrame - m_2ndLastDrivingClickFrame < data->m_doubleClickToFastDriveDelay )
#if RETAIL_COMPATIBLE_CRC
DEBUG_ASSERTCRASH(m_lastDrivingClickFrame >= m_2ndLastDrivingClickFrame, ("m_lastDrivingClickFrame should always be >= m_2ndLastDrivingClickFrame"));
const Bool useFasterSpeed = m_lastDrivingClickFrame - m_2ndLastDrivingClickFrame < data->m_doubleClickToFastDriveDelay;
#else
DEBUG_ASSERTCRASH(m_lastDrivingClickTimeMsec >= m_2ndLastDrivingClickTimeMsec, ("m_lastDrivingClickTimeMsec should always be >= m_2ndLastDrivingClickTimeMsec"));
const Bool useFasterSpeed = m_lastDrivingClickTimeMsec - m_2ndLastDrivingClickTimeMsec < data->m_doubleClickToFastDriveDelay;
#endif
if( useFasterSpeed )
{
//Because we double clicked, use the faster driving speed.
speed = data->m_manualFastDrivingSpeed;
Expand Down Expand Up @@ -1308,17 +1325,22 @@ void ParticleUplinkCannonUpdate::crc( Xfer *xfer )
// ------------------------------------------------------------------------------------------------
/** Xfer method
* Version Info:
* 1: Initial version */
* 1: Initial version
* 2: Added m_startDecayFrame
* 3: Added m_manualTargetMode
* 4: Added m_orbitToTargetLaserRadius
* 5: Changed m_lastDrivingClickFrame and m_2ndLastDrivingClickFrame to m_lastDrivingClickTimeMsec and m_2ndLastDrivingClickTimeMsec (frames to milliseconds)
*/
// ------------------------------------------------------------------------------------------------
void ParticleUplinkCannonUpdate::xfer( Xfer *xfer )
{
const ParticleUplinkCannonUpdateModuleData *data = getParticleUplinkCannonUpdateModuleData();

// version
#if RETAIL_COMPATIBLE_XFER_SAVE
const XferVersion currentVersion = 2;
const XferVersion currentVersion = 3;
#else
const XferVersion currentVersion = 4;
const XferVersion currentVersion = 5;
#endif
XferVersion version = currentVersion;
xfer->xferVersion( &version, currentVersion );
Expand Down Expand Up @@ -1415,10 +1437,35 @@ void ParticleUplinkCannonUpdate::xfer( Xfer *xfer )
}

// the time of last manual target click
xfer->xferUnsignedInt( & m_lastDrivingClickFrame );

// the time of the 2nd last manual target click
#if RETAIL_COMPATIBLE_CRC || RETAIL_COMPATIBLE_XFER_SAVE
// Retail builds stay at version 3 for compatibility, so always use old frame format
xfer->xferUnsignedInt( &m_lastDrivingClickFrame );
xfer->xferUnsignedInt( &m_2ndLastDrivingClickFrame );
#else
if( version >= 5 )
{
xfer->xferUnsignedInt( &m_lastDrivingClickTimeMsec );
xfer->xferUnsignedInt( &m_2ndLastDrivingClickTimeMsec );
}
else
{
// Old versions stored frame numbers, which we can't meaningfully convert to milliseconds
UnsignedInt oldLastDrivingClickFrame = 0;
UnsignedInt old2ndLastDrivingClickFrame = 0;
xfer->xferUnsignedInt( &oldLastDrivingClickFrame );
xfer->xferUnsignedInt( &old2ndLastDrivingClickFrame );
if( xfer->getXferMode() == XFER_LOAD )
{
m_lastDrivingClickTimeMsec = 0;
m_2ndLastDrivingClickTimeMsec = 0;
}
}
#endif

if( version >= 3 )
{
xfer->xferBool( &m_manualTargetMode );
}

if( version >= 4 )
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -227,8 +227,13 @@ class ParticleUplinkCannonUpdate : public SpecialPowerUpdateModule
UnsignedInt m_nextDamagePulseFrame;
UnsignedInt m_startAttackFrame;
UnsignedInt m_startDecayFrame;
UnsignedInt m_lastDrivingClickFrame;
UnsignedInt m_2ndLastDrivingClickFrame;
#if RETAIL_COMPATIBLE_CRC || RETAIL_COMPATIBLE_XFER_SAVE
UnsignedInt m_lastDrivingClickFrame; // Frame number for retail compatibility
UnsignedInt m_2ndLastDrivingClickFrame; // Frame number for retail compatibility
#else
UnsignedInt m_lastDrivingClickTimeMsec; // Real-time milliseconds
UnsignedInt m_2ndLastDrivingClickTimeMsec; // Real-time milliseconds
#endif
UnsignedInt m_nextDestWaypointID;

Bool m_upBonesCached;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -184,8 +184,13 @@ ParticleUplinkCannonUpdate::ParticleUplinkCannonUpdate( Thing *thing, const Modu
m_nextDamagePulseFrame = 0;
m_startAttackFrame = 0;
m_startDecayFrame = 0;
#if RETAIL_COMPATIBLE_CRC || RETAIL_COMPATIBLE_XFER_SAVE
m_lastDrivingClickFrame = 0;
m_2ndLastDrivingClickFrame = 0;
#else
m_lastDrivingClickTimeMsec = 0;
m_2ndLastDrivingClickTimeMsec = 0;
#endif
m_clientShroudedLastFrame = FALSE;

for( Int i = 0; i < MAX_OUTER_NODES; i++ )
Expand Down Expand Up @@ -374,8 +379,13 @@ void ParticleUplinkCannonUpdate::setSpecialPowerOverridableDestination( const Co
{
m_overrideTargetDestination = *loc;
m_manualTargetMode = TRUE;
#if RETAIL_COMPATIBLE_CRC || RETAIL_COMPATIBLE_XFER_SAVE
m_2ndLastDrivingClickFrame = m_lastDrivingClickFrame;
m_lastDrivingClickFrame = TheGameLogic->getFrame();
#else
m_2ndLastDrivingClickTimeMsec = m_lastDrivingClickTimeMsec;
m_lastDrivingClickTimeMsec = timeGetTime();
#endif
}
}

Expand Down Expand Up @@ -567,7 +577,14 @@ UpdateSleepTime ParticleUplinkCannonUpdate::update()
else
{
Real speed = data->m_manualDrivingSpeed;
if( m_scriptedWaypointMode || m_lastDrivingClickFrame - m_2ndLastDrivingClickFrame < data->m_doubleClickToFastDriveDelay )
#if RETAIL_COMPATIBLE_CRC
DEBUG_ASSERTCRASH(m_lastDrivingClickFrame >= m_2ndLastDrivingClickFrame, ("m_lastDrivingClickFrame should always be >= m_2ndLastDrivingClickFrame"));
const Bool useFasterSpeed = m_scriptedWaypointMode || (m_lastDrivingClickFrame - m_2ndLastDrivingClickFrame < data->m_doubleClickToFastDriveDelay);
#else
DEBUG_ASSERTCRASH(m_lastDrivingClickTimeMsec >= m_2ndLastDrivingClickTimeMsec, ("m_lastDrivingClickTimeMsec should always be >= m_2ndLastDrivingClickTimeMsec"));
const Bool useFasterSpeed = m_scriptedWaypointMode || (m_lastDrivingClickTimeMsec - m_2ndLastDrivingClickTimeMsec < data->m_doubleClickToFastDriveDelay);
#endif
if( useFasterSpeed )
{
//Because we double clicked, use the faster driving speed.
speed = data->m_manualFastDrivingSpeed;
Expand Down Expand Up @@ -1392,7 +1409,12 @@ void ParticleUplinkCannonUpdate::crc( Xfer *xfer )
// ------------------------------------------------------------------------------------------------
/** Xfer method
* Version Info:
* 1: Initial version */
* 1: Initial version
* 2: Added m_startDecayFrame
* 3: Added m_manualTargetMode, m_scriptedWaypointMode, m_nextDestWaypointID
* 4: Added m_orbitToTargetLaserRadius
* 5: Changed m_lastDrivingClickFrame and m_2ndLastDrivingClickFrame to m_lastDrivingClickTimeMsec and m_2ndLastDrivingClickTimeMsec (frames to milliseconds)
*/
// ------------------------------------------------------------------------------------------------
void ParticleUplinkCannonUpdate::xfer( Xfer *xfer )
{
Expand All @@ -1402,7 +1424,7 @@ void ParticleUplinkCannonUpdate::xfer( Xfer *xfer )
#if RETAIL_COMPATIBLE_XFER_SAVE
const XferVersion currentVersion = 3;
#else
const XferVersion currentVersion = 4;
const XferVersion currentVersion = 5;
#endif
XferVersion version = currentVersion;
xfer->xferVersion( &version, currentVersion );
Expand Down Expand Up @@ -1499,10 +1521,30 @@ void ParticleUplinkCannonUpdate::xfer( Xfer *xfer )
}

// the time of last manual target click
xfer->xferUnsignedInt( & m_lastDrivingClickFrame );

// the time of the 2nd last manual target click
#if RETAIL_COMPATIBLE_CRC || RETAIL_COMPATIBLE_XFER_SAVE
// Retail builds stay at version 3 for compatibility, so always use old frame format
xfer->xferUnsignedInt( &m_lastDrivingClickFrame );
xfer->xferUnsignedInt( &m_2ndLastDrivingClickFrame );
#else
if( version >= 5 )
{
xfer->xferUnsignedInt( &m_lastDrivingClickTimeMsec );
xfer->xferUnsignedInt( &m_2ndLastDrivingClickTimeMsec );
}
else
{
// Old versions stored frame numbers, which we can't meaningfully convert to milliseconds
UnsignedInt oldLastDrivingClickFrame = 0;
UnsignedInt old2ndLastDrivingClickFrame = 0;
xfer->xferUnsignedInt( &oldLastDrivingClickFrame );
xfer->xferUnsignedInt( &old2ndLastDrivingClickFrame );
if( xfer->getXferMode() == XFER_LOAD )
{
m_lastDrivingClickTimeMsec = 0;
m_2ndLastDrivingClickTimeMsec = 0;
}
}
#endif

if( version >= 3 )
{
Expand Down
Loading