Skip to content

Zero Hour rebuilt from EA's source: x64, Direct3D 11, VS2022/CMake, ~60 original bugs fixed, an AI that builds a base. Bring your own game.

fix(gameengine): stop a catch-up burst on the first -video frame

Olcay Seyganeeadf31f9bad
diff --git a/GeneralsMD/Code/Data/Scenarios/laserlook.txt b/GeneralsMD/Code/Data/Scenarios/laserlook.txt
index f947d30af..6e2429690 100644
--- a/GeneralsMD/Code/Data/Scenarios/laserlook.txt
+++ b/GeneralsMD/Code/Data/Scenarios/laserlook.txt
@@ -7,13 +7,15 @@
# generals.exe -win -xres 1920 -yres 1080 -msaa 0 -quickstart -noshellmap -observer -multiInstance
# -fps 120 -noFPSLimit -particlecap 2500 -cinema nohud -freecam 3170 3790 270 0 -36
# -map "Maps\Twilight Flame\Twilight Flame.map" -autoskirmish 2 -takeover
-# -side 0 FactionAmerica -side 1 FactionChina -seed 7 -maxframes 250 -logicthread 0
+# -side 0 FactionAmerica -side 1 FactionChina -seed 7 -maxframes 250
# -video 120 240 laserlook_d3d11 -scenario laserlook -logPrefix laserlook_d3d11_
#
# Add -d3d9 and change the names for the reference device. The Avenger's beam is on from about
-# logic frame 140 to the end; the Crusaders fire at 147 to 152 and 207 to 212, which is where a
-# still is taken (209). -logicthread 0 because with the logic thread on, two runs of the same
-# seed fired the first Crusader shot at 199 and 207 (2026-10-19); off, two runs agreed.
+# logic frame 140 to the end. The beam at 147 to 152 and 207 to 212, where a still is taken (209),
+# is the Paladin's gun, fired on logic frames 146 and 206; the Crusaders do not fire before 250.
+# Those frames are the same in every run at either -logicthread. A shot that once seemed to come at
+# 199 was a recording that opened 8 frames late (2026-10-19); the VIDEO line now names the frame
+# of the first picture.
30 spawn 0 Lazr_AmericaTankCrusader 3 3300 3740 40
30 spawn 0 Lazr_AmericaTankPaladin 1 3420 3740
diff --git a/GeneralsMD/Code/GameEngine/Source/Common/GameEngine.cpp b/GeneralsMD/Code/GameEngine/Source/Common/GameEngine.cpp
index 08c745f7c..d915a53cd 100644
--- a/GeneralsMD/Code/GameEngine/Source/Common/GameEngine.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/Common/GameEngine.cpp
@@ -3084,6 +3084,12 @@ void GameEngine::update( void )
if (!mayCatchUp)
break;
+ /* -video: the recorded frames run one a pass (fast mode in planLogicPass), but a burst that
+ started in front of them ran on into them, over frames nobody drew. The recording then
+ opened a few frames late and every file after was numbered that much early: a laserlook
+ shot on frame 207 sat in the file for 199. The burst stops on the first one instead. */
+ if (!networkPaced && isVideoFrame( (Int)TheGameLogic->getFrame() ))
+ break;
tCatchupNow = Clock_Ticks();
if (!GameEngine_mayStartAnotherCatchupTick( logicTicksThisPass, maxTicksThisPass,
engineElapsedMS( tCatchupStart, tCatchupNow ) ))
diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp
index 695ff5261..441284435 100644
--- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp
+++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp
@@ -4889,8 +4889,11 @@ static void captureVideoFrame(void)
// a directory left over from an earlier run would hand ffmpeg its tail as well
deleteVideoFrames();
- DEBUG_LOG(("VIDEO: recording logic frames %d to %d into %s\n",
- TheGlobalData->m_videoStartFrame, TheGlobalData->m_videoEndFrame, s_videoDirectory));
+ DEBUG_LOG(("VIDEO: recording logic frames %d to %d into %s, the first picture on frame %d\n",
+ TheGlobalData->m_videoStartFrame, TheGlobalData->m_videoEndFrame, s_videoDirectory, frame));
+ // the files are numbered from the first picture taken, so a late first one moves every file after it
+ // that many frames early; say so in the summary rather than leave the count short and silent
+ s_videoFramesMissed += picture - (UnsignedInt)TheGlobalData->m_videoStartFrame * GameEngine_videoPictures();
}
else if (picture <= s_videoLastPicture)
{