refactor(loadscreen): Refactor the single player load screen to use TheDisplay for intro video playback#2273
Conversation
| } | ||
|
|
||
| // if the display has a movie playing then we need to draw the displays video buffer | ||
| if (TheDisplay->isMoviePlaying()) |
There was a problem hiding this comment.
This is added in addition to the original drawing functionality as some screens still use the original method, such as the challenge load screen.
The challenge load screen does something more complex with it's video handling and needs looking at seperate from this change.
|
| Filename | Overview |
|---|---|
| Core/GameEngine/Source/GameClient/GUI/LoadScreen.cpp | Refactored to use TheDisplay's video playback methods, simplified progress tracking, and improved video progress bar logic |
| Generals/Code/GameEngine/Source/GameClient/Display.cpp | Implemented getMovieProgress() to calculate video playback progress with proper null checks |
| Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp | Implemented parameterless video buffer drawing methods that use internal m_videoBuffer and m_videoStream members |
| Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/W3DGameWindow.cpp | Added logic to draw TheDisplay's video buffer when isMoviePlaying() is true and no local video buffer exists |
| GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp | Identical implementation to Generals version with parameterless video buffer drawing methods |
Sequence Diagram
sequenceDiagram
participant LoadScreen as SinglePlayerLoadScreen
participant Display as TheDisplay
participant VideoPlayer as TheVideoPlayer
participant WindowManager as TheWindowManager
participant GameWindow as W3DGameWindow
LoadScreen->>Display: playMovie(movieLabel)
Display->>VideoPlayer: open(movieName)
VideoPlayer-->>Display: VideoStream
Display->>Display: createVideoBuffer()
Note over Display: Store m_videoStream & m_videoBuffer
loop While movie is playing
LoadScreen->>Display: isMoviePlaying()
Display-->>LoadScreen: true
LoadScreen->>Display: getMovieProgress()
Display-->>LoadScreen: progress (0.0-1.0)
LoadScreen->>LoadScreen: Update progress bar
LoadScreen->>WindowManager: update()
LoadScreen->>Display: update()
Display->>Display: frameDecompress() & frameRender()
LoadScreen->>Display: draw()
Display->>GameWindow: draw window
GameWindow->>Display: isMoviePlaying()
Display-->>GameWindow: true
GameWindow->>Display: drawVideoBuffer(coords)
Display->>Display: Render video to screen
end
LoadScreen->>Display: stopMovie()
Display->>Display: Delete buffer & close stream
Last reviewed commit: 097b484
xezon
left a comment
There was a problem hiding this comment.
Does the loading bar in videos still work?
No i removed the video playback being part of the loading bar since the code behind it is hacky and it didn't add anything to the playback. |
54be1bc to
a71ec34
Compare
|
Tweaked to now show and properly update the progress bar during the video playback. The bar now correctly displays where the video is during its playback, the bar then gets reset for the normal loading portion of the intro screen. |
a71ec34 to
03e38b6
Compare
|
This should be good to go |
GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp
Show resolved
Hide resolved
GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp
Show resolved
Hide resolved
|
So is this still a pure refactor or now a bugfix? |
it's prob a mix of both with the change of the load bar behaviour |
03e38b6 to
53ae2e5
Compare
|
Tweaked |
GeneralsMD/Code/GameEngine/Source/GameClient/GUI/LoadScreen.cpp
Outdated
Show resolved
Hide resolved
GeneralsMD/Code/GameEngine/Source/GameClient/GUI/LoadScreen.cpp
Outdated
Show resolved
Hide resolved
GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/W3DGameWindow.cpp
Outdated
Show resolved
Hide resolved
53ae2e5 to
ebb01a2
Compare
GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/W3DGameWindow.cpp
Outdated
Show resolved
Hide resolved
39c7788 to
14332fd
Compare
|
Manually merged to generals, there are some differences in the loadscreen.cpp which made it a little more difficult to determine how to merge. |
|
Perhaps a unify is better before this? |
Zero hour changes quite a bit of the load screen behaviour, including adding the challenge load screen. |
I went ahead and made a merge of them with #2332 |
|
#2332 is merged. This change can now advance. |
Will take a look soon |
…eo playback (#2273)
…heDisplay for intro video playback (#2273)
14332fd to
097b484
Compare
|
Rebased and tweaked this based on the merge |
xezon
left a comment
There was a problem hiding this comment.
My expectation is that this breaks Generals Campaign videos in its current form.
| UnicodeString m_unicodeObjectiveLines[MAX_OBJECTIVE_LINES]; | ||
|
|
||
| VideoBuffer *m_videoBuffer; | ||
| VideoStreamInterface *m_videoStream; |
There was a problem hiding this comment.
There also is video buffer in ChallengeLoadScreen
There was a problem hiding this comment.
Challenge load screen is still using the old method due to extra complexities that need handling seperately.
There was a problem hiding this comment.
That needs handling on it's own for now, it uses a seperate video player handling object and it's not just a single video being played. The challenge screen is composed of multiple different videos.
| { | ||
| #if RTS_GENERALS | ||
| // if we're min speced | ||
| m_videoStream->frameGoto(m_videoStream->frameCount()); // zero based |
There was a problem hiding this comment.
What is the replacement for this? The intent here is to show the last frame of the video as a static image.
There was a problem hiding this comment.
The load screen background shows instead like in zero hour.
There was a problem hiding this comment.
Why? Better preserve the original behavior.
| m_videoStream->frameRender(m_videoBuffer); | ||
|
|
||
| #if RTS_GENERALS | ||
| moveWindows( m_videoStream->frameIndex()); |
There was a problem hiding this comment.
What is the replacement for this? As I understand, this is necessary to show the moving pictures and texts during Generals Campaign Videos?
There was a problem hiding this comment.
i will double check this, might need to add a method to get the current frame from the video playing in TheDisplay
There was a problem hiding this comment.
i need to look at this a bit more because the refactor to display the movie using TheDisplay causes the output to also show in all nested GameWindows.
Merge with rebase
This breaks out changes from #2053 that involve the refactoring of the video playback.
I split this into two commits, one with the changes to TheDisplay for adding extra functionality, the second is the load screen refactor changes.
The other changes will come along after for video scaling options and for disabling the custom overlay during video playback.
This also fixes how the video playback is displayed in the progress bar.
Now the video progress filles the entire bar before resetting the bar for the normal data loading portion of the intro screen.