Skip to content

Commit 52f5452

Browse files
committed
fix(particle-uplink): scale double-click delay by logic time scale for fast-forward support
1 parent d74ec2c commit 52f5452

File tree

2 files changed

+16
-4
lines changed

2 files changed

+16
-4
lines changed

Generals/Code/GameEngine/Source/GameLogic/Object/Update/ParticleUplinkCannonUpdate.cpp

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
#define DEFINE_DEATH_NAMES
3434

3535
// INCLUDES ///////////////////////////////////////////////////////////////////////////////////////
36+
#include "Common/FramePacer.h"
3637
#include "Common/GameUtility.h"
3738
#include "Common/ThingTemplate.h"
3839
#include "Common/ThingFactory.h"
@@ -519,8 +520,13 @@ UpdateSleepTime ParticleUplinkCannonUpdate::update()
519520
{
520521
Real speed = data->m_manualDrivingSpeed;
521522
DEBUG_ASSERTCRASH(m_lastDrivingClickFrame >= m_2ndLastDrivingClickFrame, ("m_lastDrivingClickFrame should always be >= m_2ndLastDrivingClickFrame"));
522-
// TheSuperHackers @fix Scale delay threshold by frame rate to maintain consistent real-time feel
523-
const UnsignedInt scaledDelay = data->m_doubleClickToFastDriveDelay * LOGICFRAMES_PER_SECOND / BaseFps;
523+
// TheSuperHackers @fix Scale delay threshold by frame rate and logic time scale to maintain consistent real-time feel
524+
UnsignedInt scaledDelay = data->m_doubleClickToFastDriveDelay * LOGICFRAMES_PER_SECOND / BaseFps;
525+
if (TheFramePacer != NULL)
526+
{
527+
const Real timeScaleRatio = TheFramePacer->getActualLogicTimeScaleRatio();
528+
scaledDelay = (UnsignedInt)(scaledDelay * timeScaleRatio);
529+
}
524530
const Bool useFasterSpeed = m_lastDrivingClickFrame - m_2ndLastDrivingClickFrame < scaledDelay;
525531
if( useFasterSpeed )
526532
{

GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/ParticleUplinkCannonUpdate.cpp

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
#define DEFINE_DEATH_NAMES
3333

3434
// INCLUDES ///////////////////////////////////////////////////////////////////////////////////////
35+
#include "Common/FramePacer.h"
3536
#include "Common/GameUtility.h"
3637
#include "Common/ThingTemplate.h"
3738
#include "Common/ThingFactory.h"
@@ -569,8 +570,13 @@ UpdateSleepTime ParticleUplinkCannonUpdate::update()
569570
{
570571
Real speed = data->m_manualDrivingSpeed;
571572
DEBUG_ASSERTCRASH(m_lastDrivingClickFrame >= m_2ndLastDrivingClickFrame, ("m_lastDrivingClickFrame should always be >= m_2ndLastDrivingClickFrame"));
572-
// TheSuperHackers @fix Scale delay threshold by frame rate to maintain consistent real-time feel
573-
const UnsignedInt scaledDelay = data->m_doubleClickToFastDriveDelay * LOGICFRAMES_PER_SECOND / BaseFps;
573+
// TheSuperHackers @fix Scale delay threshold by frame rate and logic time scale to maintain consistent real-time feel
574+
UnsignedInt scaledDelay = data->m_doubleClickToFastDriveDelay * LOGICFRAMES_PER_SECOND / BaseFps;
575+
if (TheFramePacer != NULL)
576+
{
577+
const Real timeScaleRatio = TheFramePacer->getActualLogicTimeScaleRatio();
578+
scaledDelay = (UnsignedInt)(scaledDelay * timeScaleRatio);
579+
}
574580
const Bool useFasterSpeed = m_scriptedWaypointMode || (m_lastDrivingClickFrame - m_2ndLastDrivingClickFrame < scaledDelay);
575581
if( useFasterSpeed )
576582
{

0 commit comments

Comments
 (0)