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
7 changes: 7 additions & 0 deletions GeneralsMD/Code/GameEngine/Include/GameLogic/ScriptEngine.h
Original file line number Diff line number Diff line change
Expand Up @@ -407,6 +407,9 @@ class ScriptEngine : public SubsystemInterface,

void particleEditorUpdate();
void updateFades();
#if defined(GENERALS_ONLINE_HIGH_FPS_SERVER)
Bool hasLegacyTimerTickPassed();
#endif

AttackPriorityInfo* findAttackInfo(const AsciiString& name, Bool addIfNotFound);

Expand Down Expand Up @@ -481,6 +484,10 @@ class ScriptEngine : public SubsystemInterface,
GameDifficulty m_gameDifficulty;

Bool m_freezeByScript;
#if defined(GENERALS_ONLINE_HIGH_FPS_SERVER)
UnsignedInt m_lastTimerFrame;
UnsignedInt m_timerTicksOnFrame;
#endif
AllObjectTypes m_allObjectTypeLists;
Bool m_objectsShouldReceiveDifficultyBonus;
Bool m_ChooseVictimAlwaysUsesNormal;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -466,6 +466,10 @@ ScriptEngine::ScriptEngine() :
{
st_CanAppCont = true;
st_LastCurrentFrame = st_CurrentFrame = 0;
#if defined(GENERALS_ONLINE_HIGH_FPS_SERVER)
m_lastTimerFrame = 0;
m_timerTicksOnFrame = 0;
#endif
// By default, difficulty should be normal.
setGlobalDifficulty(DIFFICULTY_NORMAL);

Expand Down Expand Up @@ -5314,6 +5318,10 @@ void ScriptEngine::reset()
m_breezeInfo.m_breezeVersion = 0;

m_freezeByScript = FALSE;
#if defined(GENERALS_ONLINE_HIGH_FPS_SERVER)
m_lastTimerFrame = 0;
m_timerTicksOnFrame = 0;
#endif
m_objectsShouldReceiveDifficultyBonus = TRUE;
m_ChooseVictimAlwaysUsesNormal = false;

Expand Down Expand Up @@ -5498,6 +5506,22 @@ void ScriptEngine::newMap()

}

#if defined(GENERALS_ONLINE_HIGH_FPS_SERVER)
//-------------------------------------------------------------------------------------------------
Bool ScriptEngine::hasLegacyTimerTickPassed()
{
const UnsignedInt frame = TheGameLogic->getFrame();
if (frame != m_lastTimerFrame) {
m_lastTimerFrame = frame;
m_timerTicksOnFrame = 0;
return TheGameLogic->HasLegacyFrameAdvanced();
}

++m_timerTicksOnFrame;
return (m_timerTicksOnFrame % 2) == 0;
}
#endif

//-------------------------------------------------------------------------------------------------
/** Update */
//-------------------------------------------------------------------------------------------------
Expand Down Expand Up @@ -5525,7 +5549,7 @@ void ScriptEngine::update()
#endif

#if defined(GENERALS_ONLINE_HIGH_FPS_SERVER)
const bool legacyFrameAdvanced = TheGameLogic->HasLegacyFrameAdvanced();
const bool legacyFrameAdvanced = hasLegacyTimerTickPassed();
#else
const bool legacyFrameAdvanced = true;
#endif
Expand Down