Skip to content
Open
Show file tree
Hide file tree
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 @@ -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 @@ -148,7 +148,11 @@ ParticleUplinkCannonUpdateModuleData::ParticleUplinkCannonUpdateModuleData()

{ "ManualDrivingSpeed", INI::parseReal, NULL, offsetof( ParticleUplinkCannonUpdateModuleData, m_manualDrivingSpeed ) },
{ "ManualFastDrivingSpeed", INI::parseReal, NULL, offsetof( ParticleUplinkCannonUpdateModuleData, m_manualFastDrivingSpeed ) },
#if RETAIL_COMPATIBLE_CRC || RETAIL_COMPATIBLE_XFER_SAVE
{ "DoubleClickToFastDriveDelay", INI::parseDurationUnsignedInt, NULL, offsetof( ParticleUplinkCannonUpdateModuleData, m_doubleClickToFastDriveDelay ) },
#else
{ "DoubleClickToFastDriveDelay", INI::parseUnsignedInt, NULL, offsetof( ParticleUplinkCannonUpdateModuleData, m_doubleClickToFastDriveDelay ) },
#endif

{ 0, 0, 0, 0 }
};
Expand Down Expand Up @@ -183,8 +187,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 +333,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 +531,14 @@ UpdateSleepTime ParticleUplinkCannonUpdate::update()
else
{
Real speed = data->m_manualDrivingSpeed;
if( m_lastDrivingClickFrame - m_2ndLastDrivingClickFrame < data->m_doubleClickToFastDriveDelay )
#if RETAIL_COMPATIBLE_CRC || RETAIL_COMPATIBLE_XFER_SAVE
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 +1329,22 @@ void ParticleUplinkCannonUpdate::crc( Xfer *xfer )
// ------------------------------------------------------------------------------------------------
/** Xfer method
* Version Info:
* 1: Initial version */
* 1: Initial version
* 2: TheSuperHackers @tweak Added m_startDecayFrame
* 3: TheSuperHackers @tweak Added m_manualTargetMode
* 4: TheSuperHackers @tweak Added m_orbitToTargetLaserRadius
* 5: TheSuperHackers @tweak 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;
#if RETAIL_COMPATIBLE_CRC || 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 @@ -1415,10 +1441,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, read and discard to advance file position.
UnsignedInt oldLastDrivingClickFrame = 0;
UnsignedInt old2ndLastDrivingClickFrame = 0;
xfer->xferUnsignedInt( &oldLastDrivingClickFrame );
xfer->xferUnsignedInt( &old2ndLastDrivingClickFrame );
}
#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 @@ -147,7 +147,11 @@ ParticleUplinkCannonUpdateModuleData::ParticleUplinkCannonUpdateModuleData()

{ "ManualDrivingSpeed", INI::parseReal, NULL, offsetof( ParticleUplinkCannonUpdateModuleData, m_manualDrivingSpeed ) },
{ "ManualFastDrivingSpeed", INI::parseReal, NULL, offsetof( ParticleUplinkCannonUpdateModuleData, m_manualFastDrivingSpeed ) },
#if RETAIL_COMPATIBLE_CRC || RETAIL_COMPATIBLE_XFER_SAVE
{ "DoubleClickToFastDriveDelay", INI::parseDurationUnsignedInt, NULL, offsetof( ParticleUplinkCannonUpdateModuleData, m_doubleClickToFastDriveDelay ) },
#else
{ "DoubleClickToFastDriveDelay", INI::parseUnsignedInt, NULL, offsetof( ParticleUplinkCannonUpdateModuleData, m_doubleClickToFastDriveDelay ) },
#endif

{ 0, 0, 0, 0 }
};
Expand Down Expand Up @@ -184,8 +188,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 +383,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 +581,14 @@ UpdateSleepTime ParticleUplinkCannonUpdate::update()
else
{
Real speed = data->m_manualDrivingSpeed;
if( m_scriptedWaypointMode || m_lastDrivingClickFrame - m_2ndLastDrivingClickFrame < data->m_doubleClickToFastDriveDelay )
#if RETAIL_COMPATIBLE_CRC || RETAIL_COMPATIBLE_XFER_SAVE
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,17 +1413,22 @@ void ParticleUplinkCannonUpdate::crc( Xfer *xfer )
// ------------------------------------------------------------------------------------------------
/** Xfer method
* Version Info:
* 1: Initial version */
* 1: Initial version
* 2: TheSuperHackers @tweak Added m_startDecayFrame
* 3: TheSuperHackers @tweak Added m_manualTargetMode, m_scriptedWaypointMode, m_nextDestWaypointID
* 4: TheSuperHackers @tweak Added m_orbitToTargetLaserRadius
* 5: TheSuperHackers @tweak 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
#if RETAIL_COMPATIBLE_CRC || 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 +1525,25 @@ 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, read and discard to advance file position.
UnsignedInt oldLastDrivingClickFrame = 0;
UnsignedInt old2ndLastDrivingClickFrame = 0;
xfer->xferUnsignedInt( &oldLastDrivingClickFrame );
xfer->xferUnsignedInt( &old2ndLastDrivingClickFrame );
}
#endif

if( version >= 3 )
{
Expand Down
Loading