Skip to content
Open
2 changes: 2 additions & 0 deletions Core/GameEngine/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,7 @@ set(GAMEENGINE_SRC
Include/GameClient/Image.h
Include/GameClient/IMEManager.h
# Include/GameClient/InGameUI.h
Include/GameClient/Intro.h
Include/GameClient/Keyboard.h
# Include/GameClient/KeyDefs.h
Include/GameClient/LanguageFilter.h
Expand Down Expand Up @@ -806,6 +807,7 @@ set(GAMEENGINE_SRC
# Source/GameClient/InGameUI.cpp
Source/GameClient/Input/Keyboard.cpp
Source/GameClient/Input/Mouse.cpp
Source/GameClient/Intro.cpp
Source/GameClient/LanguageFilter.cpp
Source/GameClient/Line2D.cpp
Source/GameClient/MapUtil.cpp
Expand Down
6 changes: 0 additions & 6 deletions Core/GameEngine/Include/GameClient/Display.h
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,6 @@ class Display : public SubsystemInterface
Int endX, Int endY ) = 0;

/// FullScreen video playback
virtual void playLogoMovie( AsciiString movieName, Int minMovieLength, Int minCopyrightLength );
virtual void playMovie( AsciiString movieName );
virtual void stopMovie();
virtual Bool isMoviePlaying();
Expand Down Expand Up @@ -216,11 +215,6 @@ class Display : public SubsystemInterface
Real m_letterBoxFadeLevel; ///<tracks the current alpha level for fading letter-boxed mode in/out.
Bool m_letterBoxEnabled; ///<current state of letterbox
UnsignedInt m_letterBoxFadeStartTime; ///< time of letterbox fade start
Int m_movieHoldTime; ///< time that we hold on the last frame of the movie
Int m_copyrightHoldTime; ///< time that the copyright must be on the screen
UnsignedInt m_elapsedMovieTime; ///< used to make sure we show the stuff long enough
UnsignedInt m_elapsedCopywriteTime; ///< Hold on the last frame until both have expired
DisplayString *m_copyrightDisplayString;///< this'll hold the display string
};

// the singleton
Expand Down
86 changes: 86 additions & 0 deletions Core/GameEngine/Include/GameClient/Intro.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
/*
** Command & Conquer Generals Zero Hour(tm)
** Copyright 2026 TheSuperHackers
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

#pragma once

#include <vector>

class DisplayString;
class Image;

class Intro
{
enum IntroState
{
IntroState_Start,
IntroState_EALogoMovie,
IntroState_TheSuperHackersWait,
IntroState_TheSuperHackers,
IntroState_SizzleMovieWait,
IntroState_SizzleMovie,
IntroState_Done,
};

struct DisplayEntity
{
DisplayEntity()
: displayString(nullptr)
, image(nullptr)
, sizeX(10)
, sizeY(10)
, centerOffsetY(0)
{}
~DisplayEntity();

DisplayString* displayString;
const Image* image;
Int sizeX;
Int sizeY;
Int centerOffsetY;
};

public:

Intro();

void update();
void draw();

Bool isDone() const { return m_currentState == IntroState_Done; }

private:

void enterNextState();

void doEALogoMovie();
void doTheSuperHackers();
void doSizzleMovie();
void doPostIntro();
void doAsyncWait(UnsignedInt milliseconds);

void drawDisplayEntities();

private:

IntroState m_currentState;
UnsignedInt m_allowedStateFlags;
UnsignedInt m_waitUntilMs;
UnicodeString m_unicodeStrings[1];
std::vector<DisplayEntity> m_displayEntities;
Real m_fadeValue;
};
75 changes: 1 addition & 74 deletions Core/GameEngine/Source/GameClient/Display.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,6 @@ Display::Display()
m_cinematicText = AsciiString::TheEmptyString;
m_cinematicFont = nullptr;
m_cinematicTextFrames = 0;
m_movieHoldTime = -1;
m_copyrightHoldTime = -1;
m_elapsedMovieTime = 0;
m_elapsedCopywriteTime = 0;
m_copyrightDisplayString = nullptr;

m_currentlyPlayingMovie.clear();
m_letterBoxFadeStartTime = 0;
Expand Down Expand Up @@ -200,41 +195,6 @@ void Display::setHeight( UnsignedInt height )

}

//============================================================================
// Display::playLogoMovie
// minMovieLength is in milliseconds
// minCopyrightLength
//============================================================================

void Display::playLogoMovie( AsciiString movieName, Int minMovieLength, Int minCopyrightLength )
{

stopMovie();

m_videoStream = TheVideoPlayer->open( movieName );

if ( m_videoStream == nullptr )
{
return;
}

m_currentlyPlayingMovie = movieName;
m_movieHoldTime = minMovieLength;
m_copyrightHoldTime = minCopyrightLength;
m_elapsedMovieTime = timeGetTime(); // we're using time get time because legal wants actual "Seconds"

m_videoBuffer = createVideoBuffer();
if ( m_videoBuffer == nullptr ||
!m_videoBuffer->allocate( m_videoStream->width(),
m_videoStream->height())
)
{
stopMovie();
return;
}

}

//============================================================================
// Display::playMovie
//============================================================================
Expand Down Expand Up @@ -286,13 +246,6 @@ void Display::stopMovie()
//TheScriptEngine->notifyOfCompletedVideo(m_currentlyPlayingMovie); // Removing this sync-error cause MDC
m_currentlyPlayingMovie = AsciiString::TheEmptyString;
}
if(m_copyrightDisplayString)
{
TheDisplayStringManager->freeDisplayString(m_copyrightDisplayString);
m_copyrightDisplayString = nullptr;
}
m_copyrightHoldTime = -1;
m_movieHoldTime = -1;
}

//============================================================================
Expand All @@ -308,34 +261,8 @@ void Display::update()
m_videoStream->frameDecompress();
m_videoStream->frameRender( m_videoBuffer );
if( m_videoStream->frameIndex() != m_videoStream->frameCount() - 1)
m_videoStream->frameNext();
else if( m_copyrightHoldTime >= 0 ||m_movieHoldTime >= 0 )
{
if( m_elapsedCopywriteTime == 0 && m_elapsedCopywriteTime >= 0)
{
//display the copyrighttext;
deleteInstance(m_copyrightDisplayString);
m_copyrightDisplayString = TheDisplayStringManager->newDisplayString();
m_copyrightDisplayString->setText(TheGameText->fetch("GUI:EACopyright"));
if (TheGlobalLanguageData && TheGlobalLanguageData->m_copyrightFont.name.isNotEmpty())
{ FontDesc *fontdesc=&TheGlobalLanguageData->m_copyrightFont;
m_copyrightDisplayString->setFont(TheFontLibrary->getFont(fontdesc->name,
TheGlobalLanguageData->adjustFontSize(fontdesc->size),
fontdesc->bold));
}
else
m_copyrightDisplayString->setFont(TheFontLibrary->getFont("Courier",
TheGlobalLanguageData->adjustFontSize(12), TRUE));
m_elapsedCopywriteTime = timeGetTime();
}
if(m_movieHoldTime + m_elapsedMovieTime < timeGetTime() &&
m_copyrightHoldTime + m_elapsedCopywriteTime < timeGetTime())
{
m_movieHoldTime = -1;
m_elapsedMovieTime = 0;
m_elapsedCopywriteTime = 0;
m_copyrightHoldTime = -1;
}
m_videoStream->frameNext();
}
else
{
Expand Down
Loading
Loading