diff options
Diffstat (limited to 'engines')
-rw-r--r-- | engines/pegasus/credits.cpp | 4 | ||||
-rw-r--r-- | engines/pegasus/menu.cpp | 12 | ||||
-rw-r--r-- | engines/pegasus/module.mk | 1 | ||||
-rw-r--r-- | engines/pegasus/overview.cpp | 3 | ||||
-rw-r--r-- | engines/pegasus/pegasus.cpp | 163 | ||||
-rw-r--r-- | engines/pegasus/pegasus.h | 8 | ||||
-rw-r--r-- | engines/pegasus/video.cpp | 288 | ||||
-rw-r--r-- | engines/pegasus/video.h | 92 |
8 files changed, 123 insertions, 448 deletions
diff --git a/engines/pegasus/credits.cpp b/engines/pegasus/credits.cpp index 4ef723ecdb..6d683de8f7 100644 --- a/engines/pegasus/credits.cpp +++ b/engines/pegasus/credits.cpp @@ -142,7 +142,9 @@ void PegasusEngine::drawCredits(int button, bool highlight, int frame, Video::Qu _gfx->drawPictTransparent("Images/Credits/SelectS.pict", 40, s_creditsButtonY[button], _gfx->getColor(0xf8, 0xf8, 0xf8)); video->seekToTime(frame * 200); - _video->copyFrameToScreen(video->decodeNextFrame(), video->getWidth(), video->getHeight(), 288, 0); + + const Graphics::Surface *surf = video->decodeNextFrame(); + _system->copyRectToScreen((byte *)surf->pixels, surf->pitch, 288, 0, video->getWidth(), video->getHeight()); } void PegasusEngine::runDemoCredits() { diff --git a/engines/pegasus/menu.cpp b/engines/pegasus/menu.cpp index 49d60144d6..12c987c3b6 100644 --- a/engines/pegasus/menu.cpp +++ b/engines/pegasus/menu.cpp @@ -49,13 +49,10 @@ void PegasusEngine::runMainMenu() { sound.initFromAIFFFile("Sounds/Main Menu.aiff"); sound.loopSound(); - // Note down how long since the last click - uint32 lastClickTime = _system->getMillis(); - int buttonSelected = 0; drawMenu(buttonSelected); - while (!shouldQuit() && _system->getMillis() - lastClickTime < 60 * 1000) { + while (!shouldQuit()) { Common::Event event; // Ignore events for now @@ -105,8 +102,6 @@ void PegasusEngine::runMainMenu() { break; } - // Update our last press time too - lastClickTime = _system->getMillis(); break; default: break; @@ -119,11 +114,6 @@ void PegasusEngine::runMainMenu() { if (shouldQuit()) return; - - // Too slow! Go back and show the intro again. - sound.stopSound(); - _video->playMovie(_introDirectory + "/LilMovie.movie"); - _gameMode = kIntroMode; } void PegasusEngine::drawMenu(int buttonSelected) { diff --git a/engines/pegasus/module.mk b/engines/pegasus/module.mk index 97830fe119..131ec1ff6a 100644 --- a/engines/pegasus/module.mk +++ b/engines/pegasus/module.mk @@ -21,7 +21,6 @@ MODULE_OBJS = \ timers.o \ transition.o \ util.o \ - video.o \ items/inventory.o \ items/item.o \ items/itemlist.o \ diff --git a/engines/pegasus/overview.cpp b/engines/pegasus/overview.cpp index 8e82708a0f..90fa9a4f16 100644 --- a/engines/pegasus/overview.cpp +++ b/engines/pegasus/overview.cpp @@ -115,7 +115,8 @@ void PegasusEngine::drawInterfaceOverview(const OverviewHotspot &hotspot, Video: _gfx->drawPict("Images/Interface/OVBottom.mac", 0, kViewScreenOffset + 256, false); video->seekToTime(hotspot.time); - _video->copyFrameToScreen(video->decodeNextFrame(), video->getWidth(), video->getHeight(), kViewScreenOffset, kViewScreenOffset); + const Graphics::Surface *surf = video->decodeNextFrame(); + _system->copyRectToScreen((byte *)surf->pixels, surf->pitch, kViewScreenOffset, kViewScreenOffset, video->getWidth(), video->getHeight()); if (hotspot.time == 530) { // The keyboard is special diff --git a/engines/pegasus/pegasus.cpp b/engines/pegasus/pegasus.cpp index bc162972c8..0a4e066ca3 100644 --- a/engines/pegasus/pegasus.cpp +++ b/engines/pegasus/pegasus.cpp @@ -32,17 +32,18 @@ #include "base/plugins.h" #include "base/version.h" #include "gui/saveload.h" +#include "video/qt_decoder.h" #include "pegasus/console.h" #include "pegasus/cursor.h" #include "pegasus/gamestate.h" +#include "pegasus/movie.h" #include "pegasus/pegasus.h" #include "pegasus/timers.h" #include "pegasus/items/itemlist.h" #include "pegasus/items/biochips/biochipitem.h" #include "pegasus/items/inventory/inventoryitem.h" -//#define RUN_SUB_MOVIE // :D :D :D :D :D :D //#define RUN_INTERFACE_TEST //#define RUN_OLD_CODE @@ -59,11 +60,8 @@ PegasusEngine::PegasusEngine(OSystem *syst, const PegasusGameDescription *gamede } PegasusEngine::~PegasusEngine() { - delete _video; delete _gfx; delete _resFork; - delete _inventoryLid; - delete _biochipLid; delete _console; delete _cursor; delete _continuePoint; @@ -72,10 +70,7 @@ PegasusEngine::~PegasusEngine() { Common::Error PegasusEngine::run() { _console = new PegasusConsole(this); _gfx = new GraphicsManager(this); - _video = new VideoManager(this); _resFork = new Common::MacResManager(); - _inventoryLid = new Common::MacResManager(); - _biochipLid = new Common::MacResManager(); _cursor = new Cursor(); _gameMode = kIntroMode; _adventureMode = true; @@ -83,12 +78,6 @@ Common::Error PegasusEngine::run() { if (!_resFork->open("JMP PP Resources") || !_resFork->hasResFork()) error("Could not load JMP PP Resources"); - if (!_inventoryLid->open("Images/Lids/Inventory Lid Sequence") || !_inventoryLid->hasResFork()) - error("Could not open Inventory Lid Sequence"); - - if (!_biochipLid->open("Images/Lids/Biochip Lid Sequence") || !_biochipLid->hasResFork()) - error("Could not open Biochip Lid Sequence"); - // Initialize items createItems(); @@ -111,27 +100,7 @@ Common::Error PegasusEngine::run() { return Common::kNoGameDataFoundError; } -#if 0 - Common::MacResIDArray pictIds = _biochipLid->getResIDArray(MKID_BE('PICT')); - for (uint32 i = 0; i < pictIds.size(); i++) { - Common::String filename = Common::String::printf("PICT_%d.pict", pictIds[i]); - Common::DumpFile file; - assert(file.open(filename)); - Common::SeekableReadStream *res = _biochipLid->getResource(MKID_BE('PICT'), pictIds[i]); - byte *data = new byte[res->size()]; - res->read(data, res->size()); - for (int j = 0; j < 512; j++) - file.writeByte(0); - file.write(data, res->size()); - file.close(); - delete res; - delete[] data; - } -#endif - -#if defined(RUN_SUB_MOVIE) - _video->playMovie("Images/Norad Alpha/Sub Chase Movie"); -#elif defined(RUN_INTERFACE_TEST) +#if defined(RUN_INTERFACE_TEST) _cursor->setCurrentFrameIndex(0); _cursor->show(); drawInterface(); @@ -183,6 +152,7 @@ Common::Error PegasusEngine::run() { _biochips.setWeightLimit(8); _biochips.setOwnerID(kPlayerID); + // Start up the first notification _shellNotification.notifyMe(this, kJMPShellNotificationFlags, kJMPShellNotificationFlags); _shellNotification.setNotificationFlags(kGameStartingFlag, kGameStartingFlag); @@ -191,6 +161,7 @@ Common::Error PegasusEngine::run() { g_allHotspots.push_back(&_returnHotspot); while (!shouldQuit()) { + checkCallBacks(); checkNotifications(); InputHandler::pollForInput(); giveIdleTime(); @@ -280,10 +251,73 @@ void PegasusEngine::createItem(tItemID itemID, tNeighborhoodID neighborhoodID, t } void PegasusEngine::runIntro() { - _video->playMovieCentered(_introDirectory + "/BandaiLogo.movie"); - VideoHandle handle = _video->playBackgroundMovie(_introDirectory + "/Big Movie.movie"); - _video->seekToTime(handle, 10 * 600); - _video->waitUntilMovieEnds(handle); + Video::SeekableVideoDecoder *video = new Video::QuickTimeDecoder(); + if (video->loadFile(_introDirectory + "/BandaiLogo.movie")) { + while (!shouldQuit() && !video->endOfVideo()) { + if (video->needsUpdate()) { + const Graphics::Surface *frame = video->decodeNextFrame(); + _system->copyRectToScreen((byte *)frame->pixels, frame->pitch, 0, 0, frame->w, frame->h); + _system->updateScreen(); + } + + Common::Event event; + while (_eventMan->pollEvent(event)) + ; + } + } + + delete video; + + if (shouldQuit()) + return; + + video = new Video::QuickTimeDecoder(); + + if (!video->loadFile(_introDirectory + "/Big Movie.movie")) + error("Could not load intro movie"); + + video->seekToTime(Audio::Timestamp(0, 10 * 600, 600)); + + while (!shouldQuit() && !video->endOfVideo()) { + if (video->needsUpdate()) { + const Graphics::Surface *frame = video->decodeNextFrame(); + + // Scale up the frame doing some simple scaling + Graphics::Surface scaledFrame; + scaledFrame.create(frame->w * 2, frame->h * 2, frame->format); + const byte *src = (const byte *)frame->pixels; + byte *dst1 = (byte *)scaledFrame.pixels; + byte *dst2 = (byte *)scaledFrame.pixels + scaledFrame.pitch; + + for (int y = 0; y < frame->h; y++) { + for (int x = 0; x < frame->w; x++) { + memcpy(dst1, src, frame->format.bytesPerPixel); + dst1 += frame->format.bytesPerPixel; + memcpy(dst1, src, frame->format.bytesPerPixel); + dst1 += frame->format.bytesPerPixel; + memcpy(dst2, src, frame->format.bytesPerPixel); + dst2 += frame->format.bytesPerPixel; + memcpy(dst2, src, frame->format.bytesPerPixel); + dst2 += frame->format.bytesPerPixel; + src += frame->format.bytesPerPixel; + } + + src += frame->pitch - frame->format.bytesPerPixel * frame->w; + dst1 += scaledFrame.pitch * 2 - scaledFrame.format.bytesPerPixel * scaledFrame.w; + dst2 += scaledFrame.pitch * 2 - scaledFrame.format.bytesPerPixel * scaledFrame.w; + } + + _system->copyRectToScreen((byte *)scaledFrame.pixels, scaledFrame.pitch, 0, 0, scaledFrame.w, scaledFrame.h); + _system->updateScreen(); + scaledFrame.free(); + } + + Common::Event event; + while (_eventMan->pollEvent(event)) + ; + } + + delete video; } void PegasusEngine::drawInterface() { @@ -296,14 +330,7 @@ void PegasusEngine::drawInterface() { } void PegasusEngine::mainGameLoop() { - // TODO: Yeah... - _system->fillScreen(0); - _video->playMovieCentered("Images/Caldoria/Pullback.movie"); - drawInterface(); - - Common::String navMovie = Common::String::format("Images/%s/%s.movie", getTimeZoneFolder(GameState.getCurrentNeighborhood()).c_str(), getTimeZoneDesc(GameState.getCurrentNeighborhood()).c_str()); - _video->playMovie(navMovie, kViewScreenOffset, kViewScreenOffset); - + // TODO: Remove me _gameMode = kQuitMode; } @@ -496,7 +523,6 @@ Common::Error PegasusEngine::loadGameState(int slot) { return Common::kUnknownError; bool valid = loadFromStream(loadFile); - warning("pos = %d", loadFile->pos()); delete loadFile; return valid ? Common::kNoError : Common::kUnknownError; @@ -516,9 +542,48 @@ Common::Error PegasusEngine::saveGameState(int slot, const Common::String &desc) void PegasusEngine::receiveNotification(Notification *notification, const tNotificationFlags flags) { if (&_shellNotification == notification) { - if (flags == kGameStartingFlag) - error("Notification test complete"); + switch (flags) { + case kGameStartingFlag: { +#if 0 + // This is just some graphical test that I wrote; I'll + // keep it around for reference. + Movie opening(1); + opening.initFromMovieFile(_introDirectory + "/Big Movie.movie"); + opening.setTime(10, 1); + opening.setStart(10, 1); + opening.startDisplaying(); + opening.show(); + opening.start(); + opening.setFlags(kLoopTimeBase); + + Input input; + InputHandler::getCurrentInputDevice()->getInput(input, kFilterAllInput); + + while (opening.isRunning() && !shouldQuit()) { + checkCallBacks(); + _gfx->updateDisplay(); + + InputHandler::getCurrentInputDevice()->getInput(input, kFilterAllInput); + if (input.anyInput()) + break; + + _system->delayMillis(10); + } +#else + if (!isDemo()) + runIntro(); +#endif + break; + } + default: + break; + } } } +void PegasusEngine::checkCallBacks() { + for (Common::List<TimeBase *>::iterator it = _timeBases.begin(); it != _timeBases.end(); it++) + (*it)->checkCallBacks(); +} + } // End of namespace Pegasus diff --git a/engines/pegasus/pegasus.h b/engines/pegasus/pegasus.h index a9984ea66d..3e20ddc7de 100644 --- a/engines/pegasus/pegasus.h +++ b/engines/pegasus/pegasus.h @@ -36,12 +36,11 @@ #include "pegasus/hotspot.h" #include "pegasus/input.h" #include "pegasus/notification.h" -#include "pegasus/video.h" #include "pegasus/items/inventory.h" #include "pegasus/neighborhood/neighborhood.h" namespace Video { - class Video::QuickTimeDecoder; + class QuickTimeDecoder; } namespace Pegasus { @@ -49,7 +48,6 @@ namespace Pegasus { class PegasusConsole; struct PegasusGameDescription; class SoundManager; -class VideoManager; class GraphicsManager; class Idler; class Cursor; @@ -86,9 +84,8 @@ public: Common::Error saveGameState(int slot, const Common::String &desc); // Base classes - VideoManager *_video; GraphicsManager *_gfx; - Common::MacResManager *_resFork, *_inventoryLid, *_biochipLid; + Common::MacResManager *_resFork; // Misc. bool isDemo() const; @@ -163,6 +160,7 @@ private: // TimeBases Common::List<TimeBase *> _timeBases; + void checkCallBacks(); // Save/Load bool loadFromStream(Common::ReadStream *stream); diff --git a/engines/pegasus/video.cpp b/engines/pegasus/video.cpp deleted file mode 100644 index 89884e042f..0000000000 --- a/engines/pegasus/video.cpp +++ /dev/null @@ -1,288 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * 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 2 - * 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, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -#include "pegasus/pegasus.h" -#include "pegasus/video.h" - -#include "common/events.h" -#include "common/textconsole.h" -#include "graphics/scaler.h" -#include "video/qt_decoder.h" - -namespace Pegasus { - -VideoManager::VideoManager(PegasusEngine *vm) : _vm(vm) { - _timeZoneVideo = 0; -} - -VideoManager::~VideoManager() { - stopVideos(); - delete _timeZoneVideo; -} - -bool VideoManager::loadTimeZoneVideo(const Common::String &filename) { - Video::QuickTimeDecoder *video = new Video::QuickTimeDecoder(); - - if (!video->loadFile(filename)) { - delete video; - return false; - } - - delete _timeZoneVideo; - _timeZoneVideo = video; - - // Set it on pause - _timeZoneVideo->pauseVideo(true); - return true; -} - -void VideoManager::drawTimeZoneVideoFrame(uint32 time) { - assert(_timeZoneVideo); - - if (!_timeZoneVideo->isPaused()) - _timeZoneVideo->pauseVideo(true); - - _timeZoneVideo->seekToTime(Audio::Timestamp(0, time, 600)); - - const Graphics::Surface *frame = _timeZoneVideo->decodeNextFrame(); - - if (!frame) - error("Could not find frame at time %d", time); - - copyFrameToScreen(frame, _timeZoneVideo->getWidth(), _timeZoneVideo->getHeight(), kViewScreenOffset, kViewScreenOffset); - _vm->_system->updateScreen(); -} - -void VideoManager::playTimeZoneVideoSegment(uint32 startTime, uint32 endTime) { - assert(_timeZoneVideo); - - _timeZoneVideo->seekToTime(Audio::Timestamp(0, startTime, 600)); - - if (_timeZoneVideo->isPaused()) - _timeZoneVideo->pauseVideo(false); - - // Convert the end time to ms - endTime = Audio::Timestamp(0, endTime, 600).msecs(); - - bool continuePlaying = true; - while (!_timeZoneVideo->endOfVideo() && _timeZoneVideo->getElapsedTime() < endTime && !_vm->shouldQuit() && continuePlaying) { - if (_timeZoneVideo->needsUpdate()) { - const Graphics::Surface *frame = _timeZoneVideo->decodeNextFrame(); - - if (frame) { - copyFrameToScreen(frame, _timeZoneVideo->getWidth(), _timeZoneVideo->getHeight(), kViewScreenOffset, kViewScreenOffset); - _vm->_system->updateScreen(); - } - } - - Common::Event event; - while (_vm->_system->getEventManager()->pollEvent(event)) { - switch (event.type) { - case Common::EVENT_RTL: - case Common::EVENT_QUIT: - continuePlaying = false; - break; - case Common::EVENT_KEYDOWN: - switch (event.kbd.keycode) { - case Common::KEYCODE_ESCAPE: - continuePlaying = false; - break; - default: - break; - } - break; - default: - break; - } - } - - // Cut down on CPU usage - _vm->_system->delayMillis(10); - } - - _timeZoneVideo->pauseVideo(true); -} - -void VideoManager::pauseVideos() { - for (uint16 i = 0; i < _videoStreams.size(); i++) - _videoStreams[i]->pauseVideo(true); -} - -void VideoManager::resumeVideos() { - for (uint16 i = 0; i < _videoStreams.size(); i++) - _videoStreams[i]->pauseVideo(false); -} - -void VideoManager::stopVideos() { - for (uint16 i = 0; i < _videoStreams.size(); i++) { - delete _videoStreams[i].video; - _videoStreams[i].video = 0; - } -} - -void VideoManager::playMovie(Common::String filename, uint16 x, uint16 y) { - VideoHandle videoHandle = playBackgroundMovie(filename, x, y, false); - - if (videoHandle != NULL_VID_HANDLE) - waitUntilMovieEnds(videoHandle); -} - -void VideoManager::playMovieCentered(Common::String filename) { - VideoHandle videoHandle = playBackgroundMovie(filename, 0, 0, false); - - if (videoHandle == NULL_VID_HANDLE) - return; - - _videoStreams[videoHandle].x = (_vm->_system->getWidth() - _videoStreams[videoHandle]->getWidth()) / 2; - _videoStreams[videoHandle].y = (_vm->_system->getHeight() - _videoStreams[videoHandle]->getHeight()) / 2; - - waitUntilMovieEnds(videoHandle); -} - -void VideoManager::waitUntilMovieEnds(VideoHandle videoHandle) { - bool continuePlaying = true; - - while (!_videoStreams[videoHandle]->endOfVideo() && !_vm->shouldQuit() && continuePlaying) { - if (updateBackgroundMovies()) - _vm->_system->updateScreen(); - - Common::Event event; - while (_vm->_system->getEventManager()->pollEvent(event)) { - switch (event.type) { - case Common::EVENT_RTL: - case Common::EVENT_QUIT: - continuePlaying = false; - break; - case Common::EVENT_KEYDOWN: - switch (event.kbd.keycode) { - case Common::KEYCODE_ESCAPE: - continuePlaying = false; - break; - default: - break; - } - break; - default: - break; - } - } - - // Cut down on CPU usage - _vm->_system->delayMillis(10); - } - - delete _videoStreams[videoHandle].video; - _videoStreams.clear(); -} - -bool VideoManager::updateBackgroundMovies() { - bool updateScreen = false; - - for (uint32 i = 0; i < _videoStreams.size() && !_vm->shouldQuit(); i++) { - // Skip deleted videos - if (!_videoStreams[i].video) - continue; - - // Remove any videos that are over - if (_videoStreams[i]->endOfVideo()) { - if (_videoStreams[i].loop) { - _videoStreams[i]->rewind(); - } else { - delete _videoStreams[i].video; - memset(&_videoStreams[i], 0, sizeof(VideoEntry)); - _videoStreams[i].video = NULL; - continue; - } - } - - // Check if we need to draw a frame - if (_videoStreams[i]->needsUpdate()) { - const Graphics::Surface *frame = _videoStreams[i]->decodeNextFrame(); - - if (frame) { - copyFrameToScreen(frame, _videoStreams[i]->getWidth(), _videoStreams[i]->getHeight(), _videoStreams[i].x, _videoStreams[i].y); - - // We've drawn something to the screen, make sure we update it - updateScreen = true; - } - } - } - - // Return true if we need to update the screen - return updateScreen; -} - -VideoHandle VideoManager::playBackgroundMovie(Common::String filename, int x, int y, bool loop) { - // First, check to see if that video is already playing - for (uint32 i = 0; i < _videoStreams.size(); i++) - if (_videoStreams[i].filename == filename) - return i; - - // Otherwise, create a new entry - VideoEntry entry; - entry.video = new Video::QuickTimeDecoder(); - entry.x = x; - entry.y = y; - entry.filename = filename; - entry.loop = loop; - - if (!entry->loadFile(filename)) - return NULL_VID_HANDLE; - - // Search for any deleted videos so we can take a formerly used slot - for (uint32 i = 0; i < _videoStreams.size(); i++) - if (!_videoStreams[i].video) { - _videoStreams[i] = entry; - return i; - } - - // Otherwise, just add it to the list - _videoStreams.push_back(entry); - return _videoStreams.size() - 1; -} - -void VideoManager::seekToTime(VideoHandle handle, uint32 time) { - if (handle != NULL_VID_HANDLE) - _videoStreams[handle]->seekToTime(Audio::Timestamp(0, time, 600)); -} - -void VideoManager::copyFrameToScreen(const Graphics::Surface *frame, int width, int height, int x, int y) { - if (frame->format.bytesPerPixel == 1) - error("Unhandled 8bpp frames"); // Cut out because Pegasus Prime shouldn't need this - - // Clip the width/height to make sure we stay on the screen - width = MIN<int32>(width, _vm->_system->getWidth() - x); - height = MIN<int32>(height, _vm->_system->getHeight() - y); - - if (width == 320 && height == 240) { - // TODO: Is this right? At least "Big Movie" and the "Sub Chase Movie" need to be scaled... - // FIXME: Normal2x is only compiled in when USE_SCALERS is defined - Graphics::Surface scaledSurf; - scaledSurf.create(frame->w * 2, frame->h * 2, frame->format); - Normal2x((byte *)frame->pixels, frame->pitch, (byte *)scaledSurf.pixels, scaledSurf.pitch, frame->w, frame->h); - _vm->_system->copyRectToScreen((byte *)scaledSurf.pixels, scaledSurf.pitch, 0, 0, width * 2, height * 2); - scaledSurf.free(); - } else - _vm->_system->copyRectToScreen((byte *)frame->pixels, frame->pitch, x, y, width, height); -} - -} // End of namespace Pegasus diff --git a/engines/pegasus/video.h b/engines/pegasus/video.h deleted file mode 100644 index 56339e4c42..0000000000 --- a/engines/pegasus/video.h +++ /dev/null @@ -1,92 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * 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 2 - * 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, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -#ifndef PEGASUS_VIDEO_H -#define PEGASUS_VIDEO_H - -#include "common/array.h" - -namespace Common { - class String; -} - -namespace Video { - class QuickTimeDecoder; -} - -namespace Pegasus { - -class PegasusEngine; - -struct VideoEntry { - Video::QuickTimeDecoder *video; - uint16 x; - uint16 y; - bool loop; - Common::String filename; - - Video::QuickTimeDecoder *operator->() const { assert(video); return video; } -}; - -typedef int32 VideoHandle; - -enum { - NULL_VID_HANDLE = -1 -}; - -class VideoManager { -public: - VideoManager(PegasusEngine *vm); - ~VideoManager(); - - bool loadTimeZoneVideo(const Common::String &filename); - void drawTimeZoneVideoFrame(uint32 time); - void playTimeZoneVideoSegment(uint32 startTime, uint32 endTime); - - // Generic movie functions - void playMovie(Common::String filename, uint16 x = 0, uint16 y = 0); - void playMovieCentered(Common::String filename); - VideoHandle playBackgroundMovie(Common::String filename, int x = 0, int y = 0, bool loop = false); - bool updateBackgroundMovies(); - void pauseVideos(); - void resumeVideos(); - void stopVideos(); - void waitUntilMovieEnds(VideoHandle videoHandle); - - void seekToTime(VideoHandle handle, uint32 time); - - // Helper functions - void copyFrameToScreen(const Graphics::Surface *frame, int width, int height, int x, int y); - -private: - PegasusEngine *_vm; - - Video::QuickTimeDecoder *_timeZoneVideo; - - // Keep tabs on any videos playing - Common::Array<VideoEntry> _videoStreams; - uint32 _pauseStart; -}; - -} // End of namespace Pegasus - -#endif |