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
21 changes: 8 additions & 13 deletions Generals/Code/GameEngine/Source/Common/GameEngine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -654,7 +654,7 @@ void GameEngine::resetSubsystems()
/// -----------------------------------------------------------------------------------------------
Bool GameEngine::canUpdateGameLogic(UnsignedInt logicTimeQueryFlags)
{
// Must be first.
// This updates the paused game status of the game logic.
TheGameLogic->preUpdate();

TheFramePacer->setTimeFrozen(isTimeFrozen());
Expand Down Expand Up @@ -748,20 +748,15 @@ void GameEngine::update()
}
}

const Bool canUpdate = canUpdateGameLogic(FramePacer::IgnoreFrozenTime | FramePacer::IgnoreHaltedGame);
const Bool canUpdateLogic = canUpdate && !TheFramePacer->isGameHalted() && !TheFramePacer->isTimeFrozen();
const Bool canUpdateScript = canUpdate && !TheFramePacer->isGameHalted();

if (canUpdateLogic)
// TheSuperHackers @info Ignores frozen time because the script engine needs updating in the logic update regardless.
if (canUpdateGameLogic(FramePacer::IgnoreFrozenTime))
{
TheGameClient->step();
TheGameLogic->UPDATE();
}
else if (canUpdateScript)
{
// TheSuperHackers @info Still update the Script Engine to allow
// for scripted camera movements while the time is frozen.
TheScriptEngine->UPDATE();

if (!TheFramePacer->isTimeFrozen())
{
TheGameClient->step();
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3193,6 +3193,12 @@ void GameLogic::update()
TheScriptEngine->UPDATE();
}

// TheSuperHackers @info Updates the frozen time status because it may have changed after the script engine update.
TheFramePacer->setTimeFrozen(TheGameEngine->isTimeFrozen());

if (TheFramePacer->isTimeFrozen())
return;

// Note - TerrainLogic update needs to happen after ScriptEngine update, but before object updates. jba.
// This way changes in bridges are noted in the script engine before being cleared in TerrainLogic->update
{
Expand Down
21 changes: 8 additions & 13 deletions GeneralsMD/Code/GameEngine/Source/Common/GameEngine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -821,7 +821,7 @@ void GameEngine::resetSubsystems()
/// -----------------------------------------------------------------------------------------------
Bool GameEngine::canUpdateGameLogic(UnsignedInt logicTimeQueryFlags)
{
// Must be first.
// This updates the paused game status of the game logic.
TheGameLogic->preUpdate();

TheFramePacer->setTimeFrozen(isTimeFrozen());
Expand Down Expand Up @@ -915,20 +915,15 @@ void GameEngine::update()
}
}

const Bool canUpdate = canUpdateGameLogic(FramePacer::IgnoreFrozenTime | FramePacer::IgnoreHaltedGame);
const Bool canUpdateLogic = canUpdate && !TheFramePacer->isGameHalted() && !TheFramePacer->isTimeFrozen();
const Bool canUpdateScript = canUpdate && !TheFramePacer->isGameHalted();

if (canUpdateLogic)
// TheSuperHackers @info Ignores frozen time because the script engine needs updating in the logic update regardless.
if (canUpdateGameLogic(FramePacer::IgnoreFrozenTime))
{
TheGameClient->step();
TheGameLogic->UPDATE();
}
else if (canUpdateScript)
{
// TheSuperHackers @info Still update the Script Engine to allow
// for scripted camera movements while the time is frozen.
TheScriptEngine->UPDATE();

if (!TheFramePacer->isTimeFrozen())
{
TheGameClient->step();
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3732,6 +3732,12 @@ void GameLogic::update()
TheScriptEngine->UPDATE();
}

// TheSuperHackers @info Updates the frozen time status because it may have changed after the script engine update.
TheFramePacer->setTimeFrozen(TheGameEngine->isTimeFrozen());

if (TheFramePacer->isTimeFrozen())
return;

// Note - TerrainLogic update needs to happen after ScriptEngine update, but before object updates. jba.
// This way changes in bridges are noted in the script engine before being cleared in TerrainLogic->update
{
Expand Down
Loading