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.

feat(w3ddevice): record footage at 60 fps with -recordfps

Olcay Seygan58f5b9fcbc37
diff --git a/GeneralsMD/Code/GameEngine/Include/Common/GameEngine.h b/GeneralsMD/Code/GameEngine/Include/Common/GameEngine.h
index 14cf596e3..c2a988a0f 100644
--- a/GeneralsMD/Code/GameEngine/Include/Common/GameEngine.h
+++ b/GeneralsMD/Code/GameEngine/Include/Common/GameEngine.h
@@ -59,6 +59,24 @@ Int GameEngine_logicCatchupMaxFrames( Int logicFps );
void GameEngine_noteLogicTickDone( Int logicFps, Bool fastMode );
Real GameEngine_logicTickFraction( void );
+/** -video and -directorrecord: whether the logic frame is one a range records. -recordfps draws
+ GameEngine_videoPictures() pictures of each of those, and the logic runs after the last; the coming
+ draw is picture GameEngine_videoPicture() of them, 0 first. 1 and 0 outside a range, and at 30.
+ The last picture shows the logic frame, and each one before it is that share of a frame earlier: its
+ blend fraction is (picture + 1) / pictures, and GameEngine_pictureFrame is its time in logic frames,
+ what an animation drawn for footage runs on instead of the wall clock. GameEngine_pictureMilliseconds
+ is the same time in milliseconds, the logic frame times 1000 / LOGICFRAMES_PER_SECOND for its last
+ picture. All client side: the logic runs the frames it always did. */
+Bool GameEngine_isVideoFrame( void );
+Int GameEngine_videoPictures( void );
+/** The pictures of this logic frame or of the next one are blends, so smooth motion has to see this one. */
+Bool GameEngine_videoBlends( void );
+/** What the movie is told: -recordfps, or 30 where it does not apply (a network game, -headless). */
+Int GameEngine_videoFramesPerSecond( void );
+Int GameEngine_videoPicture( void );
+Real GameEngine_pictureFrame( void );
+UnsignedInt GameEngine_pictureMilliseconds( void );
+
/** How long the catch-up loop may keep starting new logic ticks before it gives up for this pass.
A frame count cannot tell a cheap tick from an expensive one, and that is the whole difference
diff --git a/GeneralsMD/Code/GameEngine/Include/Common/GlobalData.h b/GeneralsMD/Code/GameEngine/Include/Common/GlobalData.h
index ca2fdebc8..84e1b5eb3 100644
--- a/GeneralsMD/Code/GameEngine/Include/Common/GlobalData.h
+++ b/GeneralsMD/Code/GameEngine/Include/Common/GlobalData.h
@@ -490,6 +490,7 @@ public:
Int m_videoStartFrame; ///< -video <from> <to> [name]: the first logic frame recorded
Int m_videoEndFrame; ///< -video: the last logic frame recorded (0 = no video)
AsciiString m_videoName; ///< -video: the recording is Videos\<name>.mp4 next to the save games
+ Int m_videoPictures; ///< -recordfps <n>: pictures recorded of each logic frame, n over LOGICFRAMES_PER_SECOND (1 = 30 fps)
Bool m_directorRecord; ///< -directorrecord [name]: the director films the whole match, split for two fights, and the run quits at its end
AsciiString m_directorScoutFile; ///< -directorscout <file>: -directorrecord's first pass, headless, writes the match's fights and special powers here
AsciiString m_directorTimelineFile; ///< -directortimeline <file>: what the first pass wrote, which the filming pass reads to arrive before each fight
diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/ObserverCamera.h b/GeneralsMD/Code/GameEngine/Include/GameClient/ObserverCamera.h
index 0a882561f..5995f4085 100644
--- a/GeneralsMD/Code/GameEngine/Include/GameClient/ObserverCamera.h
+++ b/GeneralsMD/Code/GameEngine/Include/GameClient/ObserverCamera.h
@@ -111,12 +111,14 @@ struct DirectorShowing
/// this frame
Bool ObserverCamera_advanceShowing( std::vector< DirectorShowing > &queue, UnsignedInt frame, UnsignedInt moveFrames, UnsignedInt holdAlone,
Bool keepLast );
-/// how far in a queued thing that comes and goes over moveFrames is on frame, 0 to 1, eased in and out
-Real ObserverCamera_showingShown( const DirectorShowing &showing, UnsignedInt frame, UnsignedInt moveFrames );
+/// how far in a queued thing that comes and goes over moveFrames is on frame, 0 to 1, eased in and out.
+/// frame and the frames below are a picture's time (GameEngine_pictureFrame), between two logic frames
+/// for a -recordfps picture
+Real ObserverCamera_showingShown( const DirectorShowing &showing, Real frame, UnsignedInt moveFrames );
/// a defeated player's card on frame: how bright its red flash is, how far the line through it has
/// drawn and how far it has collapsed, each 0 to 1. defeated is the frame he lost on, collapseFrom the
/// frame his card starts to go
-void ObserverCamera_cardExit( UnsignedInt frame, UnsignedInt defeated, UnsignedInt collapseFrom, Real *flash, Real *struck, Real *collapse );
+void ObserverCamera_cardExit( Real frame, UnsignedInt defeated, UnsignedInt collapseFrom, Real *flash, Real *struck, Real *collapse );
/// the frame the card of a player who lost on defeated starts to collapse: once it has been seen struck,
/// and not before the card that went before it, from lastCollapse, has gone, so the others slide for
/// one card at a time
@@ -351,7 +353,7 @@ Real ObserverCamera_paneGround( Real screenGround, Real circleGround, Real reach
Int ObserverCamera_panePolygon( const Real *rays, Int count, Int pane, const Coord2D &origin, Int width, Int height,
Coord2D *vertices );
/// how far an animation of length frames that started on start is on frame, eased in and out, 0 to 1
-Real ObserverCamera_easeFrames( UnsignedInt frame, UnsignedInt start, UnsignedInt length );
+Real ObserverCamera_easeFrames( Real frame, UnsignedInt start, UnsignedInt length );
/// the dark edge each side of the gold of a line between panes and of the radar's frame, in pixels
enum { OBSERVER_PANE_LINE_EDGE = 2 };
/// the gold of a line between panes, in pixels, for a picture height pixels high: 6 at 720, 9 at 1080
@@ -367,7 +369,7 @@ Real ObserverCamera_bandShown( Real progress );
Real ObserverCamera_frameTraced( Real progress );
/// where along the gold lines the travelling light is on logic frame frame, 0 at the meeting point and
/// 1 at the far end, eased; below 0 between two runs
-Real ObserverCamera_shimmerAt( UnsignedInt frame );
+Real ObserverCamera_shimmerAt( Real frame );
class ObserverCamera
{
@@ -500,6 +502,7 @@ private:
Real splitApart( const Coord2D &second ) const;
void updateIntroPlaces( void );
void advancePanes( UnsignedInt frame );
+ void easePanes( Real at );
void fitPanes( UnsignedInt frame );
Real paneZoom( Int pane ) const;
void stepPaneCameras( const ViewLocation &step, Real elapsedSeconds );
@@ -555,6 +558,8 @@ private:
Bool m_survivorHandover; ///< the panes have just gone out on pane 1, whose camera the single view takes over this update
Coord3D m_drivenTo; ///< where this put the camera last frame, inside the view's constraint
UnsignedInt m_lastUpdate;
+ UnsignedInt m_directedFrame; ///< the logic frame -directorrecord's once-a-frame work last ran on; -recordfps updates a frame more than once
+ Bool m_directing; ///< this update is the logic frame's first, or there is no -directorrecord: the director decides on it
ObserverCameraVelocity m_velocity;
ViewLocation m_playerViews[ MAX_PLAYER_COUNT ];
diff --git a/GeneralsMD/Code/GameEngine/Source/Common/CommandLine.cpp b/GeneralsMD/Code/GameEngine/Source/Common/CommandLine.cpp
index b8419e4c0..854dff85a 100644
--- a/GeneralsMD/Code/GameEngine/Source/Common/CommandLine.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/Common/CommandLine.cpp
@@ -1588,6 +1588,33 @@ Int parseDirectorRecord(char *args[], int num)
return consumed;
}
+/* -recordfps <n>: the frame rate -video and -directorrecord record at, a multiple of the logic's 30.
+ *
+ * At 30 a picture is a logic frame. At 60 each recorded logic frame is drawn twice before the next
+ * one runs, the first picture blended half way from the frame before (smooth motion, on for it
+ * whatever the option says), and ffmpeg is told 60. The logic runs the same frames either way. */
+Int parseRecordFps(char *args[], int num)
+{
+ if (num < 2)
+ {
+ DEBUG_LOG(("-recordfps: wants a frame rate, a multiple of %d\n", LOGICFRAMES_PER_SECOND));
+ return num;
+ }
+ // four pictures a frame at most: W3D's clock moves in whole milliseconds, and a picture's share of a
+ // 33 ms frame has to be one at least or the drawables are never drawn
+ const Int MOST_PICTURES = 4;
+ const Int fps = atoi(args[1]);
+ if (fps < LOGICFRAMES_PER_SECOND || fps % LOGICFRAMES_PER_SECOND != 0 || fps > MOST_PICTURES * LOGICFRAMES_PER_SECOND)
+ {
+ DEBUG_LOG(("-recordfps: %s is not a multiple of %d up to %d, recording at %d\n", args[1], LOGICFRAMES_PER_SECOND,
+ MOST_PICTURES * LOGICFRAMES_PER_SECOND, LOGICFRAMES_PER_SECOND));
+ return 2;
+ }
+ if (TheWritableGlobalData)
+ TheWritableGlobalData->m_videoPictures = fps / LOGICFRAMES_PER_SECOND;
+ return 2;
+}
+
/* -directorscout <file> and -directortimeline <file>: the two passes of -directorrecord. WinMain
starts the same match again headless with -directorscout before it films anything, and that run
writes down where and when every fight starts and every special power is used; the filming run
@@ -2678,6 +2705,7 @@ static CommandLineParam params[] =
{ "-showHudOverlay", parseShowHudOverlay },
{ "-video", parseVideo },
{ "-directorrecord", parseDirectorRecord },
+ { "-recordfps", parseRecordFps },
{ "-directorscout", parseDirectorScout },
{ "-directortimeline", parseDirectorTimeline },
{ "-wav", parseWav },
diff --git a/GeneralsMD/Code/GameEngine/Source/Common/GameEngine.cpp b/GeneralsMD/Code/GameEngine/Source/Common/GameEngine.cpp
index 3057cec61..dbc341956 100644
--- a/GeneralsMD/Code/GameEngine/Source/Common/GameEngine.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/Common/GameEngine.cpp
@@ -1549,8 +1549,74 @@ void GameEngine_noteLogicTickDone( Int logicFps, Bool fastMode )
s_msPerLogicTick = (logicFps > 0 && !fastMode) ? 1000.0f / (Real)logicFps : 0.0f;
}
+/* -recordfps: which of the logic frame's pictures the coming draw is. The logic loop moves it on once a
+ pass and runs the next frame after the last one (the fast-mode branch in GameEngine::update). */
+static Int s_videoPicture = 0;
+
+static Bool isVideoFrame( Int frame )
+{
+ if (TheGlobalData->m_videoEndFrame <= 0 || TheGameLogic == NULL || !TheGameLogic->isInGame() || TheGameLogic->isInShellGame())
+ return FALSE;
+ return frame >= TheGlobalData->m_videoStartFrame && frame <= TheGlobalData->m_videoEndFrame;
+}
+
+/* -recordfps's pictures of a recorded logic frame. A network game's clock is the network's, one logic
+ frame a pass or more, and -headless draws no picture to make more of */
+static Int videoPicturesOn( Int frame )
+{
+ if (TheNetwork != NULL || TheGlobalData->m_headless || !isVideoFrame( frame ))
+ return 1;
+ return TheGlobalData->m_videoPictures;
+}
+
+Bool GameEngine_isVideoFrame( void )
+{
+ return TheGameLogic != NULL && isVideoFrame( (Int)TheGameLogic->getFrame() );
+}
+
+Int GameEngine_videoPictures( void )
+{
+ return TheGameLogic == NULL ? 1 : videoPicturesOn( (Int)TheGameLogic->getFrame() );
+}
+
+Bool GameEngine_videoBlends( void )
+{
+ if (TheGameLogic == NULL)
+ return FALSE;
+ const Int frame = (Int)TheGameLogic->getFrame();
+ return videoPicturesOn( frame ) > 1 || videoPicturesOn( frame + 1 ) > 1;
+}
+
+Int GameEngine_videoFramesPerSecond( void )
+{
+ return TheNetwork != NULL || TheGlobalData->m_headless ? LOGICFRAMES_PER_SECOND
+ : LOGICFRAMES_PER_SECOND * TheGlobalData->m_videoPictures;
+}
+
+Int GameEngine_videoPicture( void )
+{
+ // a match that ended between two pictures of a frame leaves the count where it was
+ return GameEngine_videoPictures() > 1 ? s_videoPicture : 0;
+}
+
+Real GameEngine_pictureFrame( void )
+{
+ const Int pictures = GameEngine_videoPictures();
+ return (Real)TheGameLogic->getFrame() - (Real)(pictures - 1 - GameEngine_videoPicture()) / (Real)pictures;
+}
+
+UnsignedInt GameEngine_pictureMilliseconds( void )
+{
+ const Int64 pictures = GameEngine_videoPictures();
+ const Int64 shown = (Int64)TheGameLogic->getFrame() * pictures - (pictures - 1 - GameEngine_videoPicture());
+ return shown <= 0 ? 0 : (UnsignedInt)(shown * 1000 / (LOGICFRAMES_PER_SECOND * pictures));
+}
+
Real GameEngine_logicTickFraction( void )
{
+ const Int pictures = GameEngine_videoPictures();
+ if (pictures > 1)
+ return (Real)(GameEngine_videoPicture() + 1) / (Real)pictures;
if (s_msPerLogicTick <= 0.0f)
return 1.0f;
const Real ms = (Real)(Clock_Ticks() - s_lastLogicTickTicks) * 1000.0f / (Real)Clock_Ticks_Per_Second();
@@ -2686,6 +2752,9 @@ void GameEngine::update( void )
Real elapsedMs = (Real)(now - prevLogicTime);
prevLogicTime = now;
+ const Bool logicMayRun =
+ ((TheNetwork == NULL && !TheGameLogic->isGamePaused()) || (TheNetwork && TheNetwork->isFrameDataReady()));
+
Bool logicFrameDue;
Bool mayCatchUp = FALSE;
const Bool networkPaced = TheNetwork != NULL && TheNetwork->isPacingLogicFrames();
@@ -2711,7 +2780,11 @@ void GameEngine::update( void )
else if (fastMode)
{
logicAccumMs = 0.0f;
- logicFrameDue = TRUE;
+ // -recordfps: a recorded frame is drawn as many times as it has pictures, the logic waiting
+ // for the last of them. A paused game draws its last picture again
+ if (logicMayRun)
+ s_videoPicture = (s_videoPicture + 1) % GameEngine_videoPictures();
+ logicFrameDue = s_videoPicture == 0;
}
else
{
@@ -2720,9 +2793,6 @@ void GameEngine::update( void )
mayCatchUp = (m_maxFPS > 0);
}
- const Bool logicMayRun =
- ((TheNetwork == NULL && !TheGameLogic->isGamePaused()) || (TheNetwork && TheNetwork->isFrameDataReady()));
-
if (!logicMayRun)
{
// A paused game, or one waiting on the network, is not falling behind - it is stopped.
@@ -2747,6 +2817,7 @@ void GameEngine::update( void )
plus the render is a dropped frame nobody files a bug about. */
Int64 tCatchupStart, tCatchupNow;
tCatchupStart = Clock_Ticks();
+ const UnsignedInt frameBeforeTicks = TheGameLogic->getFrame();
for( ;; )
{
TheGameLogic->UPDATE();
@@ -2792,6 +2863,10 @@ void GameEngine::update( void )
break;
}
GameEngine_noteLogicTickDone( networkPaced ? TheGlobalData->m_framesPerSecondLimit : m_maxFPS, fastMode );
+ // a frame held by a scripted freeze keeps showing its last picture, rather than going back
+ // half a frame every other pass
+ if (TheGameLogic->getFrame() == frameBeforeTicks)
+ s_videoPicture = GameEngine_videoPictures() - 1;
#ifdef DEBUG_LOGGING
tLogicEnd = Clock_Ticks();
logicMS = engineElapsedMS( tLogicStart, tLogicEnd );
diff --git a/GeneralsMD/Code/GameEngine/Source/Common/GlobalData.cpp b/GeneralsMD/Code/GameEngine/Source/Common/GlobalData.cpp
index b74fec0df..6d4fbbe74 100644
--- a/GeneralsMD/Code/GameEngine/Source/Common/GlobalData.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/Common/GlobalData.cpp
@@ -734,6 +734,7 @@ GlobalData::GlobalData()
m_videoStartFrame = 0;
m_videoEndFrame = 0; // record nothing unless -video asks for a range
m_videoName.clear();
+ m_videoPictures = 1; // a picture a logic frame, 30 a second, unless -recordfps asks for more
m_directorRecord = FALSE;
m_directorScoutFile.clear();
m_directorTimelineFile.clear();
diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/CinemaDirector.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/CinemaDirector.cpp
index 60b7d3919..c22001b36 100644
--- a/GeneralsMD/Code/GameEngine/Source/GameClient/CinemaDirector.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/GameClient/CinemaDirector.cpp
@@ -486,7 +486,9 @@ static Real cinemaNow( void )
if (fraction > 1.0f)
fraction = 1.0f;
}
- const Real logicNow = ((Real)frame + fraction) / (Real)LOGICFRAMES_PER_SECOND;
+ // recording, the picture's own time: the logic frame, or a share of one before it for a -recordfps
+ // picture between two (CinemaDirector_update runs after the logic loop has named the coming picture)
+ const Real logicNow = (recording ? GameEngine_pictureFrame() : (Real)frame + fraction) / (Real)LOGICFRAMES_PER_SECOND;
const Real wallSeconds = (Real)(wall - theCinemaClockWall) / 1000.0f;
theCinemaClockWall = wall;
diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp
index 909734022..dc982f813 100644
--- a/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp
@@ -4193,7 +4193,9 @@ void InGameUI::update( void )
if( !CinemaDirector_showsMap() )
CinemaDirector_setHudHidden( TRUE, TRUE );
TheMouse->setVisibility( FALSE );
- observerNowMs = TheGameLogic->getFrame() * 1000 / LOGICFRAMES_PER_SECOND;
+ // the picture's own time, a share of a frame before the logic frame for a -recordfps
+ // picture between two of them
+ observerNowMs = GameEngine_pictureMilliseconds();
}
TheObserverCamera.update( observerNowMs );
}
@@ -11074,7 +11076,7 @@ void InGameUI::drawDirectorBroadcast( void )
const Int seat = named[ index ].player->getPlayerIndex();
Real flash = 0.0f, struck = 0.0f, collapse = 0.0f;
if( TheObserverCamera.getDefeatFrame( seat ) != 0 )
- ObserverCamera_cardExit( frame, TheObserverCamera.getDefeatFrame( seat ), TheObserverCamera.getCollapseFrame( seat ),
+ ObserverCamera_cardExit( GameEngine_pictureFrame(), TheObserverCamera.getDefeatFrame( seat ), TheObserverCamera.getCollapseFrame( seat ),
&flash, &struck, &collapse );
if( collapse >= 1.0f )
continue;
diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/ObserverCamera.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/ObserverCamera.cpp
index 39ab30485..efadf1fdf 100644
--- a/GeneralsMD/Code/GameEngine/Source/GameClient/ObserverCamera.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/GameClient/ObserverCamera.cpp
@@ -23,6 +23,7 @@
#include "PreRTS.h" // This must go first in EVERY cpp file int the GameEngine
+#include "Common/GameEngine.h"
#include "Common/Player.h"
#include "Common/PlayerList.h"
#include "Common/PlayerTemplate.h"
@@ -1367,11 +1368,11 @@ Bool ObserverCamera_parseMoment( const char *line, DirectorMoment *moment )
}
//-------------------------------------------------------------------------------------------------
-Real ObserverCamera_easeFrames( UnsignedInt frame, UnsignedInt start, UnsignedInt length )
+Real ObserverCamera_easeFrames( Real frame, UnsignedInt start, UnsignedInt length )
{
- if( frame <= start )
+ if( frame <= (Real)start )
return 0.0f;
- const Real t = min( (Real)( frame - start ) / length, 1.0f );
+ const Real t = min( ( frame - (Real)start ) / length, 1.0f );
return t * t * ( 3.0f - 2.0f * t );
}
@@ -1413,12 +1414,12 @@ Real ObserverCamera_frameTraced( Real progress )
}
//-------------------------------------------------------------------------------------------------
-Real ObserverCamera_shimmerAt( UnsignedInt frame )
+Real ObserverCamera_shimmerAt( Real frame )
{
- const UnsignedInt into = frame % PANE_SHIMMER_PERIOD;
- if( into >= PANE_SHIMMER_FRAMES )
+ const Real into = fmodf( frame, (Real)PANE_SHIMMER_PERIOD );
+ if( into >= (Real)PANE_SHIMMER_FRAMES )
return -1.0f;
- return ObserverCamera_easeBetween( (Real)into, 0.0f, (Real)PANE_SHIMMER_FRAMES );
+ return ObserverCamera_easeBetween( into, 0.0f, (Real)PANE_SHIMMER_FRAMES );
}
//-------------------------------------------------------------------------------------------------
@@ -1443,7 +1444,7 @@ Bool ObserverCamera_advanceShowing( std::vector< DirectorShowing > &queue, Unsig
}
//-------------------------------------------------------------------------------------------------
-Real ObserverCamera_showingShown( const DirectorShowing &showing, UnsignedInt frame, UnsignedInt moveFrames )
+Real ObserverCamera_showingShown( const DirectorShowing &showing, Real frame, UnsignedInt moveFrames )
{
if( showing.start == 0 )
return 0.0f;
@@ -1454,7 +1455,7 @@ Real ObserverCamera_showingShown( const DirectorShowing &showing, UnsignedInt fr
}
//-------------------------------------------------------------------------------------------------
-void ObserverCamera_cardExit( UnsignedInt frame, UnsignedInt defeated, UnsignedInt collapseFrom, Real *flash, Real *struck, Real *collapse )
+void ObserverCamera_cardExit( Real frame, UnsignedInt defeated, UnsignedInt collapseFrom, Real *flash, Real *struck, Real *collapse )
{
// up in a third of the flash, down over the rest
const UnsignedInt up = CARD_FLASH_FRAMES / 3;
@@ -1503,6 +1504,8 @@ void ObserverCamera::reset( void )
m_survivorHandover = FALSE;
m_drivenTo.zero();
m_lastUpdate = 0;
+ m_directedFrame = 0xFFFFFFFFu;
+ m_directing = TRUE;
m_velocity.x = m_velocity.y = m_velocity.z = m_velocity.angle = m_velocity.pitch = m_velocity.zoom = 0.0f;
for( Int index = 0; index < MAX_PLAYER_COUNT; index++ )
m_playerViews[ index ] = ViewLocation();
@@ -1745,7 +1748,7 @@ const DirectorShowing *ObserverCamera::getPowerFlag( Int playerIndex, Real *drop
const std::vector< DirectorShowing > &flags = m_flags[ playerIndex ];
if( flags.empty() || flags.front().start == 0 )
return NULL;
- *drop = ObserverCamera_showingShown( flags.front(), TheGameLogic->getFrame(), FLAG_MOVE_FRAMES );
+ *drop = ObserverCamera_showingShown( flags.front(), GameEngine_pictureFrame(), FLAG_MOVE_FRAMES );
return &flags.front();
}
@@ -1754,14 +1757,14 @@ const DirectorShowing *ObserverCamera::getDefeatBanner( Real *shown ) const
{
if( m_defeatBanners.empty() || m_defeatBanners.front().start == 0 )
return NULL;
- *shown = ObserverCamera_showingShown( m_defeatBanners.front(), TheGameLogic->getFrame(), BANNER_MOVE_FRAMES );
+ *shown = ObserverCamera_showingShown( m_defeatBanners.front(), GameEngine_pictureFrame(), BANNER_MOVE_FRAMES );
return &m_defeatBanners.front();
}
//-------------------------------------------------------------------------------------------------
Real ObserverCamera::getWinnerShown( void ) const
{
- return m_winnerFrame == 0 ? 0.0f : ObserverCamera_easeFrames( TheGameLogic->getFrame(), m_winnerFrame, BANNER_MOVE_FRAMES );
+ return m_winnerFrame == 0 ? 0.0f : ObserverCamera_easeFrames( GameEngine_pictureFrame(), m_winnerFrame, BANNER_MOVE_FRAMES );
}
//-------------------------------------------------------------------------------------------------
@@ -2499,7 +2502,15 @@ void ObserverCamera::advancePanes( UnsignedInt frame )
m_panePhase = next;
m_panePhaseStart = frame;
}
+}
+//-------------------------------------------------------------------------------------------------
+/** How far the panes, the corner radar and the lines are into the phase advancePanes left them in, at
+ * the picture's time: the logic frame, or a share of one before it for a -recordfps picture between
+ * two logic frames. */
+//-------------------------------------------------------------------------------------------------
+void ObserverCamera::easePanes( Real at )
+{
switch( m_panePhase )
{
case PANES_NONE:
@@ -2508,10 +2519,10 @@ void ObserverCamera::advancePanes( UnsignedInt frame )
break;
case PANES_RADAR_OUT:
m_paneProgress = 0.0f;
- m_cornerRadarSlide = ObserverCamera_easeFrames( frame, m_panePhaseStart, PANE_RADAR_FRAMES );
+ m_cornerRadarSlide = ObserverCamera_easeFrames( at, m_panePhaseStart, PANE_RADAR_FRAMES );
break;
case PANES_IN:
- m_paneProgress = ObserverCamera_easeFrames( frame, m_panePhaseStart, PANE_SLIDE_FRAMES );
+ m_paneProgress = ObserverCamera_easeFrames( at, m_panePhaseStart, PANE_SLIDE_FRAMES );
m_cornerRadarSlide = 1.0f;
break;
case PANES_DRAW:
@@ -2527,22 +2538,22 @@ void ObserverCamera::advancePanes( UnsignedInt frame )
m_cornerRadarSlide = 1.0f;
break;
case PANES_OUT:
- m_paneProgress = 1.0f - ObserverCamera_easeFrames( frame, m_panePhaseStart, PANE_SLIDE_FRAMES );
+ m_paneProgress = 1.0f - ObserverCamera_easeFrames( at, m_panePhaseStart, PANE_SLIDE_FRAMES );
m_cornerRadarSlide = 1.0f;
break;
case PANES_RADAR_IN:
m_paneProgress = 0.0f;
- m_cornerRadarSlide = 1.0f - ObserverCamera_easeFrames( frame, m_panePhaseStart, PANE_RADAR_FRAMES );
+ m_cornerRadarSlide = 1.0f - ObserverCamera_easeFrames( at, m_panePhaseStart, PANE_RADAR_FRAMES );
break;
}
// the gold draws on the panes once they have settled and goes back in before they leave
- const UnsignedInt phaseFrames = frame >= m_panePhaseStart ? frame - m_panePhaseStart : 0;
+ const Real phaseFrames = at >= (Real)m_panePhaseStart ? at - (Real)m_panePhaseStart : 0.0f;
m_lineProgress = m_panePhase == PANES_HELD ? 1.0f : 0.0f;
if( m_panePhase == PANES_DRAW )
- m_lineProgress = min( (Real)phaseFrames / PANE_DRAW_FRAMES, 1.0f );
+ m_lineProgress = min( phaseFrames / PANE_DRAW_FRAMES, 1.0f );
if( m_panePhase == PANES_UNDRAW )
- m_lineProgress = 1.0f - min( (Real)phaseFrames / PANE_UNDRAW_FRAMES, 1.0f );
+ m_lineProgress = 1.0f - min( phaseFrames / PANE_UNDRAW_FRAMES, 1.0f );
m_paneOrigin.x = TheDisplay->getWidth() * 0.5f;
m_paneOrigin.y = TheDisplay->getHeight() * 0.5f;
if( m_paneCount >= 2 )
@@ -3268,7 +3279,7 @@ Bool ObserverCamera::chooseTarget( const ViewLocation &current, ViewLocation *ta
Coord2D place;
if( !directorPlace( narrowTo, &place ) )
return FALSE;
- if( TheGlobalData->m_directorRecord && m_placeScanned == TheGameLogic->getFrame() && updateSplit() )
+ if( TheGlobalData->m_directorRecord && m_directing && m_placeScanned == TheGameLogic->getFrame() && updateSplit() )
place = m_place;
// the opening shows the first player's base in pane 0. Pane 0 keeps its place until the panes
// have gone: a split ends when the director moves onto the second fight, and pane 0 going there at
@@ -3389,16 +3400,23 @@ void ObserverCamera::update( UnsignedInt nowMilliseconds )
return;
}
- // -directorrecord's panes run on the logic clock, on the split the last scan decided
- if( TheGlobalData->m_directorRecord )
+ // -directorrecord's panes run on the logic clock, on the split the last scan decided. What it decides
+ // it decides once a logic frame, -recordfps updating each frame once a picture; the glide and the
+ // panes' easing below go on at every picture's own time
+ m_directing = !TheGlobalData->m_directorRecord || TheGameLogic->getFrame() != m_directedFrame;
+ if( TheGlobalData->m_directorRecord && !m_directing )
+ easePanes( GameEngine_pictureFrame() );
+ else if( TheGlobalData->m_directorRecord )
{
const UnsignedInt frame = TheGameLogic->getFrame();
+ m_directedFrame = frame;
if( !m_timelineLoaded )
loadTimeline();
checkTimeline( frame );
updateBroadcastMoments( frame );
const Bool introStarting = !m_introDone;
advancePanes( frame );
+ easePanes( GameEngine_pictureFrame() );
if( m_intro && introStarting )
pickIntroBases();
if( m_intro && ( introStarting || frame % DIRECTOR_SCAN_FRAMES == 0 ) )
@@ -3553,7 +3571,7 @@ void ObserverCamera::update( UnsignedInt nowMilliseconds )
TheTacticalView->getPosition( &m_drivenTo );
m_driving = TRUE;
- if( TheGlobalData->m_directorRecord )
+ if( TheGlobalData->m_directorRecord && m_directing )
{
logPanes( TheGameLogic->getFrame() );
logHandover( step, placed );
diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp
index 50c945baa..b40e570bf 100644
--- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp
+++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp
@@ -2186,7 +2186,10 @@ static Bool s_smoothApplied = FALSE;
static void smoothMotionBegin()
{
- TheSmoothMotionActive = TheGlobalData->m_smoothMotion && !TheGlobalData->m_headless && !TheGlobalData->isClassicUI();
+ // -recordfps's pictures between two logic frames are nothing but the blend, so it is on for them
+ // whatever the option and the interface say, from the frame before the first so that one is captured
+ TheSmoothMotionActive = !TheGlobalData->m_headless
+ && ((TheGlobalData->m_smoothMotion && !TheGlobalData->isClassicUI()) || GameEngine_videoBlends());
TheSmoothMotionAlpha = TheSmoothMotionActive ? GameEngine_logicTickFraction() : 1.0f;
if (!TheSmoothMotionActive)
return;
@@ -2395,9 +2398,12 @@ AGAIN:
freezeTime = freezeTime || TheGameLogic->isGamePaused();
// hack to let client spin fast in network games but still do effects at the same pace. -MDC
+ // A -recordfps picture is a step of its own: the clock moves on each picture of a logic frame and
+ // stands still on a pane's second draw of one
static UnsignedInt lastFrame = ~0;
- freezeTime = freezeTime || (lastFrame == TheGameClient->getFrame());
- lastFrame = TheGameClient->getFrame();
+ const UnsignedInt picture = TheGameClient->getFrame() * GameEngine_videoPictures() + GameEngine_videoPicture();
+ freezeTime = freezeTime || (lastFrame == picture);
+ lastFrame = picture;
/// @todo: I'm assuming the first view is our main 3D view.
W3DView *primaryW3DView=(W3DView *)getFirstView();
@@ -2451,10 +2457,14 @@ AGAIN:
prevSyncMs = nowSyncMs;
if (deltaMs > TheW3DFrameLengthInMsec * 4)
deltaMs = TheW3DFrameLengthInMsec * 4; // a level load must not fast-forward everything
- // a recorded picture is one logic frame however long it took to draw and save, so the clock
- // moves one logic frame too, or the footage plays every animation fast
+ // a recorded picture is its share of a logic frame however long it took to draw and save, so the
+ // clock moves that much too, or the footage plays every animation fast
if (videoRecordingFrame())
- deltaMs = TheW3DFrameLengthInMsec;
+ {
+ const Int pictures = GameEngine_videoPictures();
+ const Int shown = GameEngine_videoPicture();
+ deltaMs = TheW3DFrameLengthInMsec * (shown + 1) / pictures - TheW3DFrameLengthInMsec * shown / pictures;
+ }
syncTime += deltaMs;
// allow W3D to update its internals
@@ -4074,14 +4084,21 @@ static void saveScreenShot(void)
// -video <from> <to> [name]: one picture per logic frame across the range, written as numbered
// .bmp files under Videos\<name>\ and then handed to ffmpeg for Videos\<name>.mp4. GameEngine runs
// one logic frame a pass over the range, so a picture is a logic frame and a second of video is
-// LOGICFRAMES_PER_SECOND of them.
+// LOGICFRAMES_PER_SECOND of them. -recordfps 60 draws each frame twice before the next one runs, and
+// a second is twice as many pictures; a picture is numbered by its logic frame times the pictures a
+// frame plus which of them it is.
//=============================================================================
static const char VIDEO_FRAME_PATTERN[] = "frame%06d.bmp";
static const char VIDEO_ENCODER[] = "ffmpeg.exe";
+static Int videoFramesPerSecond(void)
+{
+ return GameEngine_videoFramesPerSecond();
+}
+
static Bool s_videoStarted = FALSE;
static Bool s_videoFinished = FALSE;
-static UnsignedInt s_videoLastFrame = 0;
+static UnsignedInt s_videoLastPicture = 0;
static Int s_videoFramesWritten = 0;
static Int s_videoFramesMissed = 0;
static char s_videoDirectory[_MAX_PATH];
@@ -4097,9 +4114,9 @@ static_assert(VIDEO_RECORDS * OBSERVER_MOST_PANES <= DX11_FRAME_COPY_SLOTS,
struct VideoRecord
{
Bool pending; ///< pane 0's copy is made and the frame is still to be written
- UnsignedInt frame;
+ UnsignedInt picture;
Bool paneCopied[OBSERVER_MOST_PANES];
- UnsignedInt paneFrame[OBSERVER_MOST_PANES];
+ UnsignedInt panePicture[OBSERVER_MOST_PANES];
Int paneCount;
Real paneRays[OBSERVER_MOST_PANES];
Coord2D paneOrigin;
@@ -4207,8 +4224,8 @@ static void finishVideo(void)
// the last frame drawn is still waiting on its copy
writeVideoRecord(1 - s_videoDrawingRecord);
- DEBUG_LOG(("VIDEO: %d frames written to %s, %d logic frames went by without a picture\n",
- s_videoFramesWritten, s_videoDirectory, s_videoFramesMissed));
+ DEBUG_LOG(("VIDEO: %d frames written to %s at %d a second, %d pictures went by unrecorded\n",
+ s_videoFramesWritten, s_videoDirectory, videoFramesPerSecond(), s_videoFramesMissed));
releaseFrameCopies();
std::vector<UnsignedByte>().swap(s_videoJoined);
std::vector<ObserverPaneRun>().swap(s_videoPaneRuns);
@@ -4243,7 +4260,7 @@ static void finishVideo(void)
#if !defined(_WIN32)
// Off Windows the encoder is not started for you: the frames stay, and this is how to make the movie.
DEBUG_LOG(("VIDEO: encode with: ffmpeg -framerate %d -i \"%s%s\" -c:v libx264 -pix_fmt yuv420p out.mp4\n",
- LOGICFRAMES_PER_SECOND, s_videoDirectory, VIDEO_FRAME_PATTERN));
+ videoFramesPerSecond(), s_videoDirectory, VIDEO_FRAME_PATTERN));
#else
char encoderPath[_MAX_PATH];
if (!findVideoEncoder(encoderPath, ARRAY_SIZE(encoderPath)))
@@ -4260,7 +4277,7 @@ static void finishVideo(void)
snprintf(commandLine, ARRAY_SIZE(commandLine),
"\"%s\" -y -loglevel error -framerate %d -i \"%s%s\" -vf pad=ceil(iw/2)*2:ceil(ih/2)*2 "
"-c:v libx264 -pix_fmt yuv420p -crf 18 \"%s\"",
- encoderPath, LOGICFRAMES_PER_SECOND, s_videoDirectory, VIDEO_FRAME_PATTERN, moviePath);
+ encoderPath, videoFramesPerSecond(), s_videoDirectory, VIDEO_FRAME_PATTERN, moviePath);
STARTUPINFOA startup;
memset(&startup, 0, sizeof(startup));
@@ -4335,7 +4352,7 @@ static Bool openVideoPipe(Int width, Int height)
snprintf(commandLine, ARRAY_SIZE(commandLine),
"\"%s\" -y -loglevel error -f rawvideo -pix_fmt bgr0 -s %dx%d -framerate %d -i - "
"-vf pad=ceil(iw/2)*2:ceil(ih/2)*2 -c:v libx264 -pix_fmt yuv420p -crf 18 \"%s\"",
- encoderPath, width, height, LOGICFRAMES_PER_SECOND, moviePath);
+ encoderPath, width, height, videoFramesPerSecond(), moviePath);
STARTUPINFOA startup;
memset(&startup, 0, sizeof(startup));
@@ -4461,7 +4478,7 @@ static void joinVideoPanes(const VideoRecord &record, Int recordIndex, UnsignedB
Int panePitches[OBSERVER_MOST_PANES] = { 0 };
for (Int pane = 1; pane < record.paneCount; ++pane)
{
- if (!record.paneCopied[pane] || record.paneFrame[pane] != record.frame)
+ if (!record.paneCopied[pane] || record.panePicture[pane] != record.picture)
continue;
Int paneWidth = 0;
Int paneHeight = 0;
@@ -4508,7 +4525,7 @@ static void joinVideoPanes(const VideoRecord &record, Int recordIndex, UnsignedB
/** One picture of the recording, VIDEO_PIXEL_BYTES a pixel with no gap between rows, into ffmpeg's pipe
* under -directorrecord, as the next numbered .bmp otherwise. */
-static Bool writeVideoFrame(const UnsignedByte *pixels, Int width, Int height, UnsignedInt frame)
+static Bool writeVideoFrame(const UnsignedByte *pixels, Int width, Int height, UnsignedInt picture)
{
#if defined(_WIN32)
if (TheGlobalData->m_directorRecord && !s_videoPipeTried)
@@ -4526,7 +4543,7 @@ static Bool writeVideoFrame(const UnsignedByte *pixels, Int width, Int height, U
if (WriteFile(s_videoPipe, pixels, bytes, &written, NULL) && written == bytes)
return TRUE;
DEBUG_LOG(("VIDEO: %s stopped taking frames (error %u) at logic frame %u\n", VIDEO_ENCODER,
- (unsigned)GetLastError(), frame));
+ (unsigned)GetLastError(), picture * LOGICFRAMES_PER_SECOND / videoFramesPerSecond()));
return FALSE;
}
#endif
@@ -4585,7 +4602,7 @@ static void writeVideoRecord(Int recordIndex)
pixels = &s_videoJoined[0];
}
- if (writeVideoFrame(pixels, width, height, record.frame))
+ if (writeVideoFrame(pixels, width, height, record.picture))
++s_videoFramesWritten;
else
++s_videoFramesMissed;
@@ -4608,13 +4625,16 @@ static void captureVideoFrame(void)
return;
}
- // -directorrecord's panes past the first: kept for pane 0's draw, the last on this logic frame
+ // a picture is a logic frame and which of its -recordfps pictures it is
+ const UnsignedInt picture = frame * GameEngine_videoPictures() + GameEngine_videoPicture();
+
+ // -directorrecord's panes past the first: kept for pane 0's draw, the last of this picture
if (TheObserverCamera.isDrawingSecond())
{
const Int pane = TheObserverCamera.getDrawingPane();
VideoRecord &drawing = s_videoRecords[s_videoDrawingRecord];
drawing.paneCopied[pane] = queueFrameCopy(videoCopySlot(s_videoDrawingRecord, pane));
- drawing.paneFrame[pane] = frame;
+ drawing.panePicture[pane] = picture;
return;
}
@@ -4641,15 +4661,15 @@ static void captureVideoFrame(void)
DEBUG_LOG(("VIDEO: recording logic frames %d to %d into %s\n",
TheGlobalData->m_videoStartFrame, TheGlobalData->m_videoEndFrame, s_videoDirectory));
}
- else if (frame == s_videoLastFrame)
+ else if (picture <= s_videoLastPicture)
{
return;
}
- else if (frame > s_videoLastFrame + 1)
+ else if (picture > s_videoLastPicture + 1)
{
- s_videoFramesMissed += frame - s_videoLastFrame - 1;
+ s_videoFramesMissed += picture - s_videoLastPicture - 1;
}
- s_videoLastFrame = frame;
+ s_videoLastPicture = picture;
const Int drawingIndex = s_videoDrawingRecord;
VideoRecord &drawing = s_videoRecords[drawingIndex];
@@ -4659,7 +4679,7 @@ static void captureVideoFrame(void)
return;
}
drawing.pending = TRUE;
- drawing.frame = frame;
+ drawing.picture = picture;
drawing.paneCount = TheObserverCamera.getDrawnPaneCount();
memcpy(drawing.paneRays, TheObserverCamera.getPaneRays(), sizeof(drawing.paneRays));
drawing.paneOrigin = TheObserverCamera.getPaneOrigin();
diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DInGameUI.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DInGameUI.cpp
index 5bf92f290..9a172dace 100644
--- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DInGameUI.cpp
+++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DInGameUI.cpp
@@ -32,6 +32,7 @@
#include <stdlib.h>
#include "Lib/Clock.h"
+#include "Common/GameEngine.h"
#include "Common/GlobalData.h"
#include "Common/Player.h"
#include "Common/PlayerList.h"
@@ -497,7 +498,7 @@ static void drawPaneRays( void )
}
}
- const Real shimmer = ObserverCamera_shimmerAt( TheGameLogic->getFrame() );
+ const Real shimmer = ObserverCamera_shimmerAt( GameEngine_pictureFrame() );
if( drawn < 1.0f || shimmer < 0.0f )
return;
const Real half = length * PANE_SHIMMER_SHARE * 0.5f;
diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DView.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DView.cpp
index b7ce156d6..42c7cf52a 100644
--- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DView.cpp
+++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DView.cpp
@@ -43,6 +43,7 @@
// USER INCLUDES //////////////////////////////////////////////////////////////////////////////////
#include "Common/BuildAssistant.h"
+#include "Common/GameEngine.h"
#include "Common/GlobalData.h"
#include "Common/Radar.h"
#include "Common/Module.h"
@@ -128,6 +129,28 @@ Int TheW3DFrameLengthInMsec = 1000/LOGICFRAMES_PER_SECOND; // default is 33msec/
static const Int MAX_REQUEST_CACHE_SIZE = 40; // Any size larger than 10, or examine code below for changes. jkmcd.
static const Real DRAWABLE_OVERSCAN = 75.0f; ///< 3D world coords of how much to overscan in the 3D screen region
+/* The drawables are drawn when W3D's clock has moved, which is once a logic frame: the clock stands still
+ between ticks. -recordfps moves it on every picture of a recorded frame, and a picture after the
+ first has nothing new to draw them with; smooth motion moves the models for it. */
+static Bool drawsDrawables( void )
+{
+ return WW3D::Get_Frame_Time() != 0 && GameEngine_videoPicture() == 0;
+}
+
+/* The camera's own clock: the wall clock, and while a -video range records the time of the picture
+ being drawn, which is what the footage shows however long the picture took to draw and save. A
+ scripted pan that freezes the logic keeps the wall clock: the picture's time stands still with the
+ logic, and W3DDisplay::draw loops until the pan is done. */
+static Bool onPictureClock( View *view )
+{
+ return GameEngine_isVideoFrame() && !( view->isTimeFrozen() && !view->isCameraMovementFinished() );
+}
+
+static UnsignedInt cameraClockMilliseconds( View *view )
+{
+ return onPictureClock( view ) ? GameEngine_pictureMilliseconds() : Clock_Milliseconds();
+}
+
@@ -516,8 +539,8 @@ void W3DView::buildCameraTransform( Matrix3D *transform )
//WST 11/12/2002 New camera shaker system
// This runs once per render frame (and again on every scrollBy), not once per 30Hz
// tick, so step the shaker by real elapsed time to keep shakes framerate-independent.
- static UnsignedInt prevShakeTime = Clock_Milliseconds();
- UnsignedInt nowShakeTime = Clock_Milliseconds();
+ static UnsignedInt prevShakeTime = cameraClockMilliseconds( this );
+ UnsignedInt nowShakeTime = cameraClockMilliseconds( this );
Real shakeDt = (nowShakeTime - prevShakeTime) * 0.001f;
prevShakeTime = nowShakeTime;
if (shakeDt > 1.0f/30.0f)
@@ -1671,13 +1694,25 @@ void W3DView::update(void)
// the original wall-clock cadence so camera motion speed is framerate-independent,
// while the camera transform itself still updates every render frame.
static UnsignedInt prevCameraStepTime = 0;
- UnsignedInt nowCameraStepTime = Clock_Milliseconds();
+ const Bool pictureClock = onPictureClock( this );
+ UnsignedInt nowCameraStepTime = cameraClockMilliseconds( this );
Bool stepTime = (nowCameraStepTime - prevCameraStepTime) >= (UnsignedInt)TheW3DFrameLengthInMsec;
// During a scripted frozen-time pan, W3DDisplay::draw's inner loop calls us and
// paces itself to ~30fps already; gating on top of that ran the pan at half speed.
if (isTimeFrozen() && !isCameraMovementFinished())
stepTime = TRUE;
- if (stepTime)
+ if (pictureClock)
+ {
+ // a recorded logic frame steps once, on its last picture: not on a -recordfps picture before it,
+ // whose 16 or 17 ms would put the step on every second picture in a phase that drifts, nor on a
+ // -directorrecord pane's second draw
+ static UnsignedInt steppedFrame = 0xFFFFFFFFu;
+ stepTime = GameEngine_videoPicture() == GameEngine_videoPictures() - 1 && TheGameLogic->getFrame() != steppedFrame;
+ if (stepTime)
+ steppedFrame = TheGameLogic->getFrame();
+ prevCameraStepTime = nowCameraStepTime;
+ }
+ else if (stepTime)
{
// carry the remainder instead of discarding it: with a render cadence that is not
// a multiple of 33ms (the shell caps at 45fps), discarding ran the steppers at a
@@ -1740,7 +1775,7 @@ void W3DView::update(void)
wholeMap.hi.y += DRAWABLE_OVERSCAN;
wholeMap.lo.z -= 999999.0f;
wholeMap.hi.z += 999999.0f;
- if (WW3D::Get_Frame_Time())
+ if (drawsDrawables())
TheGameClient->iterateDrawablesInRegion( &wholeMap, drawDrawable, this );
return;
}
@@ -2025,8 +2060,10 @@ void W3DView::update(void)
static UnsignedInt prevZoomStepTime = 0;
Real zoomSteps = (Real)(nowCameraStepTime - prevZoomStepTime) / (Real)TheW3DFrameLengthInMsec;
prevZoomStepTime = nowCameraStepTime;
- if (zoomSteps <= 0.0f || zoomSteps > 10.0f)
- zoomSteps = 1.0f; // first frame ever, or a hitch: take one plain step
+ // first frame ever, or a hitch: take one plain step. A recorded picture's second draw, a
+ // -directorrecord pane, is no time at all and takes none
+ if ((zoomSteps <= 0.0f && !pictureClock) || zoomSteps > 10.0f)
+ zoomSteps = 1.0f;
Real cameraAdjustSpeed = 1.0f - (Real)pow(1.0f - TheGlobalData->m_cameraAdjustSpeed, zoomSteps);
// The director asks for a slower settle: at CameraAdjustSpeed's third of a second every ridge
// the five height samples crossed during a glide stepped the picture in and out.
@@ -2106,7 +2143,7 @@ void W3DView::update(void)
// render all of the visible Drawables
/// @todo this needs to use a real region partition or something
- if (WW3D::Get_Frame_Time()) //make sure some time actually elapsed
+ if (drawsDrawables()) //make sure some time actually elapsed
TheGameClient->iterateDrawablesInRegion( &axisAlignedRegion, drawDrawable, this );
}