@@ -1606,6 +1606,53 @@ Int W3DDisplay::getLastFrameDrawCalls()
16061606 return Debug_Statistics::Get_Draw_Calls ();
16071607}
16081608
1609+ Bool W3DDisplay::isTimeFrozen ()
1610+ {
1611+ if (TheTacticalView->isTimeFrozen () && !TheTacticalView->isCameraMovementFinished ())
1612+ return true ;
1613+
1614+ if (TheScriptEngine->isTimeFrozenDebug ())
1615+ return true ;
1616+
1617+ if (TheScriptEngine->isTimeFrozenScript ())
1618+ return true ;
1619+
1620+ if (TheGameLogic->isGamePaused ())
1621+ return true ;
1622+
1623+ return false ;
1624+ }
1625+
1626+ // TheSuperHackers @tweak xezon 12/08/2025 The WW3D Sync is no longer tied
1627+ // to the render update, but is advanced separately for every fixed time step.
1628+ void W3DDisplay::step ()
1629+ {
1630+ // TheSuperHackers @info This will wrap in 1205 hours at 30 fps logic step.
1631+ static UnsignedInt syncTime = 0 ;
1632+
1633+ extern HWND ApplicationHWnd;
1634+ if (ApplicationHWnd && ::IsIconic (ApplicationHWnd)) {
1635+ return ;
1636+ }
1637+
1638+ if (TheGlobalData->m_headless )
1639+ return ;
1640+
1641+ Bool freezeTime = isTimeFrozen ();
1642+
1643+ if (!freezeTime)
1644+ {
1645+ syncTime += (UnsignedInt)TheW3DFrameLengthInMsec;
1646+
1647+ if (TheScriptEngine->isTimeFast ())
1648+ {
1649+ return ;
1650+ }
1651+ }
1652+
1653+ WW3D::Sync ( syncTime );
1654+ }
1655+
16091656// DECLARE_PERF_TIMER(BigAssRenderLoop)
16101657
16111658// W3DDisplay::draw ===========================================================
@@ -1615,7 +1662,6 @@ Int W3DDisplay::getLastFrameDrawCalls()
16151662void W3DDisplay::draw ( void )
16161663{
16171664 // USE_PERF_TIMER(W3DDisplay_draw)
1618- static UnsignedInt syncTime = 0 ;
16191665
16201666 extern HWND ApplicationHWnd;
16211667 if (ApplicationHWnd && ::IsIconic (ApplicationHWnd)) {
@@ -1690,21 +1736,19 @@ void W3DDisplay::draw( void )
16901736 //
16911737 // PredictiveLODOptimizerClass::Optimize_LODs( 5000 );
16921738
1693- Bool freezeTime = TheTacticalView->isTimeFrozen () && !TheTacticalView->isCameraMovementFinished ();
1694- freezeTime = freezeTime || TheScriptEngine->isTimeFrozenDebug () || TheScriptEngine->isTimeFrozenScript ();
1695- freezeTime = freezeTime || TheGameLogic->isGamePaused ();
1739+ Bool freezeTime = isTimeFrozen ();
16961740
16971741 // hack to let client spin fast in network games but still do effects at the same pace. -MDC
16981742 static UnsignedInt lastFrame = ~0 ;
1699- freezeTime = freezeTime || (lastFrame == TheGameClient->getFrame ());
1743+ freezeTime = freezeTime || (TheNetwork != NULL && lastFrame == TheGameClient->getFrame ());
17001744 lastFrame = TheGameClient->getFrame ();
17011745
17021746 // / @todo: I'm assuming the first view is our main 3D view.
17031747 W3DView *primaryW3DView=(W3DView *)getFirstView ();
1748+
17041749 if (!freezeTime && TheScriptEngine->isTimeFast ())
17051750 {
17061751 primaryW3DView->updateCameraMovements (); // Update camera motion effects.
1707- syncTime += TheW3DFrameLengthInMsec;
17081752 return ;
17091753 }
17101754
@@ -1733,21 +1777,9 @@ void W3DDisplay::draw( void )
17331777 }
17341778 }
17351779
1736- if (!freezeTime)
1737- {
1738- // / @todo Decouple framerate from timestep
1739- // for now, use constant time steps to avoid animations running independent of framerate
1740- syncTime += TheW3DFrameLengthInMsec;
1741- // allow W3D to update its internals
1742- // WW3D::Sync( GetTickCount() );
1743- }
1744- WW3D::Sync ( syncTime );
1745-
1746- // Fast & Frozen time limits the time to 33 fps.
1747- Int minTime = 30 ;
1748- static Int prevTime = timeGetTime (), now;
1749-
1780+ static Int now;
17501781 now=timeGetTime ();
1782+
17511783 if (TheTacticalView->getTimeMultiplier ()>1 )
17521784 {
17531785 static Int timeMultiplierCounter = 1 ;
@@ -1757,12 +1789,6 @@ void W3DDisplay::draw( void )
17571789 timeMultiplierCounter = TheTacticalView->getTimeMultiplier ();
17581790 // limit the framerate, because while fast time is on, the game logic is running as fast as it can.
17591791 }
1760- else
1761- {
1762- now = timeGetTime ();
1763- prevTime = now - minTime; // do the first frame immediately.
1764- }
1765-
17661792
17671793 do {
17681794
0 commit comments