mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-14 05:38:56 +00:00
MOHAWK: Allow background videos to be played/manipulated with resource handles
svn-id: r54843
This commit is contained in:
parent
8be4da02f6
commit
32ed3b3582
@ -223,7 +223,7 @@ void RivenExternal::runEndGame(uint16 video) {
|
||||
void RivenExternal::runCredits(uint16 video) {
|
||||
// TODO: Play until the last frame and then run the credits
|
||||
|
||||
VideoHandle videoHandle = _vm->_video->findVideoHandle(video);
|
||||
VideoHandle videoHandle = _vm->_video->findVideoHandleRiven(video);
|
||||
|
||||
while (!_vm->_video->endOfVideo(videoHandle) && !_vm->shouldQuit()) {
|
||||
if (_vm->_video->updateBackgroundMovies())
|
||||
@ -247,7 +247,7 @@ void RivenExternal::runDomeButtonMovie() {
|
||||
void RivenExternal::runDomeCheck() {
|
||||
// Check if we clicked while the golden frame was showing
|
||||
|
||||
VideoHandle video = _vm->_video->findVideoHandle(1);
|
||||
VideoHandle video = _vm->_video->findVideoHandleRiven(1);
|
||||
assert(video != NULL_VID_HANDLE);
|
||||
|
||||
int32 curFrame = _vm->_video->getCurFrame(video);
|
||||
@ -1531,7 +1531,7 @@ void RivenExternal::xbookclick(uint16 argc, uint16 *argv) {
|
||||
_vm->_cursor->setCursor(kRivenHideCursor);
|
||||
|
||||
// Let's hook onto our video
|
||||
VideoHandle video = _vm->_video->findVideoHandle(argv[0]);
|
||||
VideoHandle video = _vm->_video->findVideoHandleRiven(argv[0]);
|
||||
|
||||
// Convert from the standard QuickTime base time to milliseconds
|
||||
// The values are in terms of 1/600 of a second.
|
||||
|
@ -141,6 +141,20 @@ void VideoManager::playBackgroundMovie(const Common::String &filename, int16 x,
|
||||
_videoStreams[videoHandle].y = (_vm->_system->getHeight() - _videoStreams[videoHandle]->getHeight()) / 2;
|
||||
}
|
||||
|
||||
void VideoManager::playBackgroundMovie(uint16 id, int16 x, int16 y, bool loop) {
|
||||
VideoHandle videoHandle = createVideoHandle(id, x, y, loop);
|
||||
if (videoHandle == NULL_VID_HANDLE)
|
||||
return;
|
||||
|
||||
// Center x if requested
|
||||
if (x < 0)
|
||||
_videoStreams[videoHandle].x = (_vm->_system->getWidth() - _videoStreams[videoHandle]->getWidth()) / 2;
|
||||
|
||||
// Center y if requested
|
||||
if (y < 0)
|
||||
_videoStreams[videoHandle].y = (_vm->_system->getHeight() - _videoStreams[videoHandle]->getHeight()) / 2;
|
||||
}
|
||||
|
||||
bool VideoManager::updateBackgroundMovies() {
|
||||
bool updateScreen = false;
|
||||
|
||||
@ -169,9 +183,9 @@ bool VideoManager::updateBackgroundMovies() {
|
||||
|
||||
if (frame && _videoStreams[i].enabled) {
|
||||
// Convert from 8bpp to the current screen format if necessary
|
||||
if (frame->bytesPerPixel == 1) {
|
||||
Graphics::PixelFormat pixelFormat = _vm->_system->getScreenFormat();
|
||||
if (frame->bytesPerPixel == 1 && pixelFormat.bytesPerPixel != 1) {
|
||||
Graphics::Surface *newFrame = new Graphics::Surface();
|
||||
Graphics::PixelFormat pixelFormat = _vm->_system->getScreenFormat();
|
||||
byte *palette = _videoStreams[i]->getPalette();
|
||||
assert(palette);
|
||||
|
||||
@ -392,7 +406,7 @@ VideoHandle VideoManager::createVideoHandle(const Common::String &filename, uint
|
||||
return _videoStreams.size() - 1;
|
||||
}
|
||||
|
||||
VideoHandle VideoManager::findVideoHandle(uint16 id) {
|
||||
VideoHandle VideoManager::findVideoHandleRiven(uint16 id) {
|
||||
for (uint16 i = 0; i < _mlstRecords.size(); i++)
|
||||
if (_mlstRecords[i].code == id)
|
||||
for (uint16 j = 0; j < _videoStreams.size(); j++)
|
||||
@ -402,6 +416,14 @@ VideoHandle VideoManager::findVideoHandle(uint16 id) {
|
||||
return NULL_VID_HANDLE;
|
||||
}
|
||||
|
||||
VideoHandle VideoManager::findVideoHandle(uint16 id) {
|
||||
for (uint16 j = 0; j < _videoStreams.size(); j++)
|
||||
if (_videoStreams[j].video && _videoStreams[j].id == id)
|
||||
return j;
|
||||
|
||||
return NULL_VID_HANDLE;
|
||||
}
|
||||
|
||||
int32 VideoManager::getCurFrame(const VideoHandle &handle) {
|
||||
assert(handle != NULL_VID_HANDLE);
|
||||
return _videoStreams[handle]->getCurFrame();
|
||||
|
@ -75,6 +75,7 @@ public:
|
||||
void playMovie(const Common::String &filename, uint16 x = 0, uint16 y = 0, bool clearScreen = false);
|
||||
void playMovieCentered(const Common::String &filename, bool clearScreen = true);
|
||||
void playBackgroundMovie(const Common::String &filename, int16 x = -1, int16 y = -1, bool loop = false);
|
||||
void playBackgroundMovie(uint16 id, int16 x = -1, int16 y = -1, bool loop = false);
|
||||
bool updateBackgroundMovies();
|
||||
void pauseVideos();
|
||||
void resumeVideos();
|
||||
@ -89,6 +90,7 @@ public:
|
||||
void playMovie(uint16 id);
|
||||
void stopMovie(uint16 id);
|
||||
void playMovieBlocking(uint16 id);
|
||||
VideoHandle findVideoHandleRiven(uint16 id);
|
||||
|
||||
// Handle functions
|
||||
VideoHandle findVideoHandle(uint16 id);
|
||||
|
Loading…
Reference in New Issue
Block a user