Skip to content

Commit 0c384c9

Browse files
committed
refactor(video): remove isVideoPlaying() and make skipVideo() return Bool
1 parent 150a8b6 commit 0c384c9

File tree

4 files changed

+19
-40
lines changed

4 files changed

+19
-40
lines changed

Generals/Code/GameEngine/Include/GameClient/LoadScreen.h

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,7 @@ class LoadScreen
6060
virtual void update( Int percent ); ///< Update the state of the slider bars
6161
virtual void processProgress(Int playerId, Int percentage) = 0;
6262
virtual void setProgressRange( Int min, Int max ) = 0;
63-
virtual Bool isVideoPlaying( void ) const = 0;
64-
virtual void skipVideo( void ) = 0;
63+
virtual Bool skipVideo( void ) = 0;
6564
protected:
6665
void setLoadScreen( GameWindow *g ) { m_loadScreen = g; }
6766
GameWindow *m_loadScreen; ///< The GameWindow that is our loadscreen
@@ -93,8 +92,7 @@ class SinglePlayerLoadScreen : public LoadScreen
9392

9493
virtual void setProgressRange( Int min, Int max );
9594

96-
virtual Bool isVideoPlaying( void ) const;
97-
virtual void skipVideo( void );
95+
virtual Bool skipVideo( void );
9896

9997
private:
10098
GameWindow *m_progressBar; ///< Pointer to the Progress Bar on the window
@@ -143,8 +141,7 @@ class ShellGameLoadScreen : public LoadScreen
143141
DEBUG_CRASH(("We Got to a single player load screen throw the Network..."));
144142
}
145143
virtual void setProgressRange( Int min, Int max ) { }
146-
virtual Bool isVideoPlaying( void ) const { return FALSE; }
147-
virtual void skipVideo( void ) { }
144+
virtual Bool skipVideo( void ) { return FALSE; }
148145

149146
private:
150147
GameWindow *m_progressBar ; ///< Pointer to the Progress Bar on the window
@@ -170,8 +167,7 @@ class MultiPlayerLoadScreen : public LoadScreen
170167
virtual void update(Int percent); ///< Update the state of the progress bar
171168
void processProgress(Int playerId, Int percentage);
172169
virtual void setProgressRange( Int min, Int max ) { }
173-
virtual Bool isVideoPlaying( void ) const { return FALSE; }
174-
virtual void skipVideo( void ) { }
170+
virtual Bool skipVideo( void ) { return FALSE; }
175171
private:
176172
GameWindow *m_progressBars[MAX_SLOTS]; ///< pointer array to all the progress bars on the window
177173
GameWindow *m_playerNames[MAX_SLOTS]; ///< pointer array to all the static text player names on the window
@@ -200,8 +196,7 @@ class GameSpyLoadScreen : public LoadScreen
200196
virtual void update(Int percent); ///< Update the state of the progress bar
201197
void processProgress(Int playerId, Int percentage);
202198
virtual void setProgressRange( Int min, Int max ) { }
203-
virtual Bool isVideoPlaying( void ) const { return FALSE; }
204-
virtual void skipVideo( void ) { }
199+
virtual Bool skipVideo( void ) { return FALSE; }
205200
private:
206201
GameWindow *m_progressBars[MAX_SLOTS]; ///< pointer array to all the progress bars on the window
207202
GameWindow *m_playerNames[MAX_SLOTS]; ///< pointer array to all the static text player names on the window
@@ -242,8 +237,7 @@ class MapTransferLoadScreen : public LoadScreen
242237
virtual void setProgressRange( Int min, Int max ) { }
243238
void processTimeout(Int secondsLeft);
244239
void setCurrentFilename(AsciiString filename);
245-
virtual Bool isVideoPlaying( void ) const { return FALSE; }
246-
virtual void skipVideo( void ) { }
240+
virtual Bool skipVideo( void ) { return FALSE; }
247241
private:
248242
GameWindow *m_progressBars[MAX_SLOTS]; ///< pointer array to all the progress bars on the window
249243
GameWindow *m_playerNames[MAX_SLOTS]; ///< pointer array to all the static text player names on the window

Generals/Code/GameEngine/Source/GameClient/GUI/LoadScreen.cpp

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -194,17 +194,14 @@ SinglePlayerLoadScreen::~SinglePlayerLoadScreen( void )
194194

195195
}
196196

197-
Bool SinglePlayerLoadScreen::isVideoPlaying( void ) const
198-
{
199-
return m_videoStream != NULL && m_videoBuffer != NULL;
200-
}
201-
202-
void SinglePlayerLoadScreen::skipVideo( void )
197+
Bool SinglePlayerLoadScreen::skipVideo( void )
203198
{
204199
if ( m_videoStream )
205200
{
206201
m_videoStream->frameGoto(m_videoStream->frameCount() - 1);
202+
return TRUE;
207203
}
204+
return FALSE;
208205
}
209206

210207
void SinglePlayerLoadScreen::moveWindows( Int frame )

GeneralsMD/Code/GameEngine/Include/GameClient/LoadScreen.h

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,7 @@ class LoadScreen
6363
virtual void update( Int percent ); ///< Update the state of the slider bars
6464
virtual void processProgress(Int playerId, Int percentage) = 0;
6565
virtual void setProgressRange( Int min, Int max ) = 0;
66-
virtual Bool isVideoPlaying( void ) const { return FALSE; }
67-
virtual void skipVideo( void ) { }
66+
virtual Bool skipVideo( void ) { return FALSE; }
6867
protected:
6968
void setLoadScreen( GameWindow *g ) { m_loadScreen = g; }
7069
GameWindow *m_loadScreen; ///< The GameWindow that is our loadscreen
@@ -96,8 +95,7 @@ class SinglePlayerLoadScreen : public LoadScreen
9695

9796
virtual void setProgressRange( Int min, Int max );
9897

99-
virtual Bool isVideoPlaying( void ) const;
100-
virtual void skipVideo( void );
98+
virtual Bool skipVideo( void );
10199

102100
private:
103101
GameWindow *m_progressBar; ///< Pointer to the Progress Bar on the window
@@ -149,8 +147,7 @@ class ChallengeLoadScreen : public LoadScreen
149147

150148
virtual void setProgressRange( Int min, Int max );
151149

152-
virtual Bool isVideoPlaying( void ) const;
153-
virtual void skipVideo( void );
150+
virtual Bool skipVideo( void );
154151

155152
private:
156153
GameWindow *m_progressBar; ///< Pointer to the Progress Bar on the window

GeneralsMD/Code/GameEngine/Source/GameClient/GUI/LoadScreen.cpp

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -216,17 +216,14 @@ SinglePlayerLoadScreen::~SinglePlayerLoadScreen( void )
216216

217217
}
218218

219-
Bool SinglePlayerLoadScreen::isVideoPlaying( void ) const
220-
{
221-
return m_videoStream != NULL && m_videoBuffer != NULL;
222-
}
223-
224-
void SinglePlayerLoadScreen::skipVideo( void )
219+
Bool SinglePlayerLoadScreen::skipVideo( void )
225220
{
226221
if ( m_videoStream )
227222
{
228223
m_videoStream->frameGoto(m_videoStream->frameCount() - 1);
224+
return TRUE;
229225
}
226+
return FALSE;
230227
}
231228

232229
void SinglePlayerLoadScreen::moveWindows( Int frame )
@@ -755,17 +752,14 @@ ChallengeLoadScreen::~ChallengeLoadScreen( void )
755752
m_ambientLoopHandle = NULL;
756753
}
757754

758-
Bool ChallengeLoadScreen::isVideoPlaying( void ) const
759-
{
760-
return m_videoStream != NULL && m_videoBuffer != NULL;
761-
}
762-
763-
void ChallengeLoadScreen::skipVideo( void )
755+
Bool ChallengeLoadScreen::skipVideo( void )
764756
{
765757
if ( m_videoStream )
766758
{
767759
m_videoStream->frameGoto(m_videoStream->frameCount() - 1);
760+
return TRUE;
768761
}
762+
return FALSE;
769763
}
770764

771765
// accepts the number of chars to advance, the window we're concerned with, the total text for final display, and the current position of the readout
@@ -1091,13 +1085,10 @@ void ChallengeLoadScreen::init( GameInfo *game )
10911085
{
10921086
TheGameEngine->serviceWindowsOS();
10931087

1094-
if ( TheKeyboard )
1088+
if( TheKeyboard && TheMessageStream )
10951089
{
10961090
TheKeyboard->UPDATE();
10971091
TheKeyboard->createStreamMessages();
1098-
}
1099-
if ( TheMessageStream )
1100-
{
11011092
TheMessageStream->propagateMessages();
11021093
}
11031094

0 commit comments

Comments
 (0)