-
Notifications
You must be signed in to change notification settings - Fork 146
Tweak(Gui): Hide the custom overlay during video playback and add the ability to correctly scale campaign videos #2053
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -476,32 +476,6 @@ void SinglePlayerLoadScreen::init( GameInfo *game ) | |
|
|
||
| */ | ||
| m_ambientLoop.setEventName("LoadScreenAmbient"); | ||
| // create the new stream | ||
| m_videoStream = TheVideoPlayer->open( TheCampaignManager->getCurrentMission()->m_movieLabel ); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Are Would it make sense to first make a single refactor change that merges all the video playbacks into the same code before doing any of the other changes? Because it looks to me that this change does multiple different but related things right now.
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. they are no longer required because i am making use of the video handling within The majority of the changes within this PR just handle the moving of the video handling out of I don't think it's entirely worth it's own PR for that, but i could move them into their own commits? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think m_videoStream, m_videoBuffer were not removed. They are now unused. Separate Pull or Commit makes sense, because the video change is a refactor, nothing user facing, whereas the clock visuals change is user facing. |
||
| if ( m_videoStream == NULL ) | ||
| { | ||
| m_percent->winHide(TRUE); | ||
| return; | ||
| } | ||
|
|
||
| // Create the new buffer | ||
| m_videoBuffer = TheDisplay->createVideoBuffer(); | ||
| if ( m_videoBuffer == NULL || | ||
| !m_videoBuffer->allocate( m_videoStream->width(), | ||
| m_videoStream->height()) | ||
| ) | ||
| { | ||
| delete m_videoBuffer; | ||
| m_videoBuffer = NULL; | ||
|
|
||
| if ( m_videoStream ) | ||
| { | ||
| m_videoStream->close(); | ||
| m_videoStream = NULL; | ||
| } | ||
|
|
||
| return; | ||
| } | ||
|
|
||
| // format the progress bar: USA to blue, GLA to green, China to red | ||
| // and set the background image | ||
|
|
@@ -530,9 +504,13 @@ void SinglePlayerLoadScreen::init( GameInfo *game ) | |
| // TheSuperHackers @bugfix Originally this movie render loop stopped rendering when the game window was inactive. | ||
| // This either skipped the movie or caused decompression artifacts. Now the video just keeps playing until it done. | ||
|
|
||
| Int progressUpdateCount = m_videoStream->frameCount() / FRAME_FUDGE_ADD; | ||
| Int shiftedPercent = -FRAME_FUDGE_ADD + 1; | ||
| while (m_videoStream->frameIndex() < m_videoStream->frameCount() - 1 ) | ||
| // Hide the background window while the movie is playing | ||
| backgroundWin->winEnable(false); | ||
|
|
||
| // TheSuperHackers @info We now make use of movie playback within the display object | ||
| TheDisplay->playMovie(TheCampaignManager->getCurrentMission()->m_movieLabel); | ||
|
|
||
| while(TheDisplay->isMoviePlaying()) | ||
| { | ||
| // TheSuperHackers @feature User can now skip video by pressing ESC | ||
| if (TheKeyboard) | ||
|
|
@@ -548,51 +526,23 @@ void SinglePlayerLoadScreen::init( GameInfo *game ) | |
|
|
||
| TheGameEngine->serviceWindowsOS(); | ||
|
|
||
| if(!m_videoStream->isFrameReady()) | ||
| { | ||
| Sleep(1); | ||
| continue; | ||
| } | ||
|
|
||
| m_videoStream->frameDecompress(); | ||
| m_videoStream->frameRender(m_videoBuffer); | ||
|
|
||
| // PULLED FROM THE MISSION DISK | ||
| // moveWindows( m_videoStream->frameIndex()); | ||
|
|
||
| m_videoStream->frameNext(); | ||
|
|
||
| if(m_videoBuffer) | ||
| m_loadScreen->winGetInstanceData()->setVideoBuffer(m_videoBuffer); | ||
| if(m_videoStream->frameIndex() % progressUpdateCount == 0) | ||
| { | ||
| shiftedPercent++; | ||
| if(shiftedPercent >0) | ||
| shiftedPercent = 0; | ||
| Int percent = (shiftedPercent + FRAME_FUDGE_ADD)/1.3; | ||
| UnicodeString per; | ||
| per.format(L"%d%%",percent); | ||
| TheMouse->setCursorTooltip(UnicodeString::TheEmptyString); | ||
| GadgetProgressBarSetProgress(m_progressBar, percent); | ||
| GadgetStaticTextSetText(m_percent, per); | ||
|
|
||
| } | ||
| TheWindowManager->update(); | ||
|
|
||
| // redraw all views, update the GUI | ||
| TheWindowManager->update(); | ||
| TheDisplay->update(); | ||
| TheDisplay->draw(); | ||
| } | ||
|
|
||
| // let the background image show through | ||
| m_videoStream->close(); | ||
| m_videoStream = NULL; | ||
| m_loadScreen->winGetInstanceData()->setVideoBuffer( NULL ); | ||
| TheDisplay->stopMovie(); | ||
| backgroundWin->winEnable(true); | ||
| TheDisplay->draw(); | ||
| } | ||
| else | ||
| { | ||
| // if we're min spec'ed don't play a movie | ||
|
|
||
| backgroundWin->winEnable(true); | ||
|
|
||
| Int delay = mission->m_voiceLength * 1000; | ||
| Int begin = timeGetTime(); | ||
| Int currTime = begin; | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this test perhaps be higher up the call chain? Because it seems oddly specific to just return this call and none of the other window draw functions. Why are the other window draw functions not necessary to exclude from video playback?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The custom overlay we added as a post post draw is the only one that really interferes with video playback, the majority of the other draw functions don't enter the code within themselves since there is no text or other objects to display.