@@ -1681,6 +1681,53 @@ Int W3DDisplay::getLastFrameDrawCalls()
1681
1681
return Debug_Statistics::Get_Draw_Calls ();
1682
1682
}
1683
1683
1684
+ Bool W3DDisplay::isTimeFrozen ()
1685
+ {
1686
+ if (TheTacticalView->isTimeFrozen () && !TheTacticalView->isCameraMovementFinished ())
1687
+ return true ;
1688
+
1689
+ if (TheScriptEngine->isTimeFrozenDebug ())
1690
+ return true ;
1691
+
1692
+ if (TheScriptEngine->isTimeFrozenScript ())
1693
+ return true ;
1694
+
1695
+ if (TheGameLogic->isGamePaused ())
1696
+ return true ;
1697
+
1698
+ return false ;
1699
+ }
1700
+
1701
+ // TheSuperHackers @tweak xezon 12/08/2025 The WW3D Sync is no longer tied
1702
+ // to the draw, but is advanced separately for every fixed time step.
1703
+ void W3DDisplay::step ()
1704
+ {
1705
+ // TheSuperHackers @info This will wrap in 1205 hours at 30 fps logic step.
1706
+ static UnsignedInt syncTime = 0 ;
1707
+
1708
+ extern HWND ApplicationHWnd;
1709
+ if (ApplicationHWnd && ::IsIconic (ApplicationHWnd)) {
1710
+ return ;
1711
+ }
1712
+
1713
+ if (TheGlobalData->m_headless )
1714
+ return ;
1715
+
1716
+ Bool freezeTime = isTimeFrozen ();
1717
+
1718
+ if (!freezeTime)
1719
+ {
1720
+ syncTime += (UnsignedInt)TheW3DFrameLengthInMsec;
1721
+
1722
+ if (TheScriptEngine->isTimeFast ())
1723
+ {
1724
+ return ;
1725
+ }
1726
+ }
1727
+
1728
+ WW3D::Sync ( syncTime );
1729
+ }
1730
+
1684
1731
// DECLARE_PERF_TIMER(BigAssRenderLoop)
1685
1732
1686
1733
// W3DDisplay::draw ===========================================================
@@ -1690,7 +1737,6 @@ Int W3DDisplay::getLastFrameDrawCalls()
1690
1737
void W3DDisplay::draw ( void )
1691
1738
{
1692
1739
// USE_PERF_TIMER(W3DDisplay_draw)
1693
- static UnsignedInt syncTime = 0 ;
1694
1740
1695
1741
extern HWND ApplicationHWnd;
1696
1742
if (ApplicationHWnd && ::IsIconic (ApplicationHWnd)) {
@@ -1735,10 +1781,6 @@ void W3DDisplay::draw( void )
1735
1781
TheInGameUI->message ( UnicodeString ( L" -stats is running, at interval: %d." ), TheGlobalData->m_statsInterval );
1736
1782
}
1737
1783
}
1738
-
1739
-
1740
-
1741
-
1742
1784
#endif
1743
1785
1744
1786
// compute debug statistics for display later
@@ -1779,21 +1821,19 @@ void W3DDisplay::draw( void )
1779
1821
//
1780
1822
// PredictiveLODOptimizerClass::Optimize_LODs( 5000 );
1781
1823
1782
- Bool freezeTime = TheTacticalView->isTimeFrozen () && !TheTacticalView->isCameraMovementFinished ();
1783
- freezeTime = freezeTime || TheScriptEngine->isTimeFrozenDebug () || TheScriptEngine->isTimeFrozenScript ();
1784
- freezeTime = freezeTime || TheGameLogic->isGamePaused ();
1824
+ Bool freezeTime = isTimeFrozen ();
1785
1825
1786
1826
// hack to let client spin fast in network games but still do effects at the same pace. -MDC
1787
1827
static UnsignedInt lastFrame = ~0 ;
1788
- freezeTime = freezeTime || (lastFrame == TheGameClient->getFrame ());
1828
+ freezeTime = freezeTime || (TheNetwork != NULL && lastFrame == TheGameClient->getFrame ());
1789
1829
lastFrame = TheGameClient->getFrame ();
1790
1830
1791
1831
// / @todo: I'm assuming the first view is our main 3D view.
1792
1832
W3DView *primaryW3DView=(W3DView *)getFirstView ();
1833
+
1793
1834
if (!freezeTime && TheScriptEngine->isTimeFast ())
1794
1835
{
1795
1836
primaryW3DView->updateCameraMovements (); // Update camera motion effects.
1796
- syncTime += TheW3DFrameLengthInMsec;
1797
1837
return ;
1798
1838
}
1799
1839
@@ -1822,21 +1862,9 @@ void W3DDisplay::draw( void )
1822
1862
}
1823
1863
}
1824
1864
1825
- if (!freezeTime)
1826
- {
1827
- // / @todo Decouple framerate from timestep
1828
- // for now, use constant time steps to avoid animations running independent of framerate
1829
- syncTime += TheW3DFrameLengthInMsec;
1830
- // allow W3D to update its internals
1831
- // WW3D::Sync( GetTickCount() );
1832
- }
1833
- WW3D::Sync ( syncTime );
1834
-
1835
- // Fast & Frozen time limits the time to 33 fps.
1836
- Int minTime = 30 ;
1837
- static Int prevTime = timeGetTime (), now;
1838
-
1865
+ static Int now;
1839
1866
now=timeGetTime ();
1867
+
1840
1868
if (TheTacticalView->getTimeMultiplier ()>1 )
1841
1869
{
1842
1870
static Int timeMultiplierCounter = 1 ;
@@ -1846,12 +1874,6 @@ void W3DDisplay::draw( void )
1846
1874
timeMultiplierCounter = TheTacticalView->getTimeMultiplier ();
1847
1875
// limit the framerate, because while fast time is on, the game logic is running as fast as it can.
1848
1876
}
1849
- else
1850
- {
1851
- now = timeGetTime ();
1852
- prevTime = now - minTime; // do the first frame immediately.
1853
- }
1854
-
1855
1877
1856
1878
do {
1857
1879
0 commit comments