diff options
Diffstat (limited to 'engines')
-rw-r--r-- | engines/director/director.cpp | 8 | ||||
-rw-r--r-- | engines/director/director.h | 2 | ||||
-rw-r--r-- | engines/director/module.mk | 1 | ||||
-rw-r--r-- | engines/director/movie.cpp | 66 | ||||
-rw-r--r-- | engines/director/movie.h | 51 |
5 files changed, 124 insertions, 4 deletions
diff --git a/engines/director/director.cpp b/engines/director/director.cpp index fb93400c52..25a0e3fdf0 100644 --- a/engines/director/director.cpp +++ b/engines/director/director.cpp @@ -87,11 +87,11 @@ Common::Error DirectorEngine::run() { _mainArchive = new RIFFArchive(); _mainArchive->openFile("bookshelf_example.mmm"); - Score score(this); - debug(0, "Score name %s", score.getMacName().c_str()); + _currentScore = new Score(this); + debug(0, "Score name %s", _currentScore->getMacName().c_str()); - score.loadArchive(); - score.startLoop(); + _currentScore->loadArchive(); + _currentScore->startLoop(); if (getPlatform() == Common::kPlatformWindows) loadEXE(); diff --git a/engines/director/director.h b/engines/director/director.h index 7e32d5f8ca..8a35ac029f 100644 --- a/engines/director/director.h +++ b/engines/director/director.h @@ -61,6 +61,7 @@ public: DirectorSound *getSoundManager() const { return _soundManager; } Archive *getMainArchive() const { return _mainArchive; } Lingo *getLingo() const { return _lingo; } + Score *getCurrentScore() const { return _currentScore; } void setPalette(byte *palette, uint16 count); bool hasFeature(EngineFeature f) const; const byte *getPalette() const { return _currentPalette; } @@ -89,6 +90,7 @@ private: byte *_currentPalette; uint16 _currentPaletteLength; Lingo *_lingo; + Score *_currentScore; }; } // End of namespace Director diff --git a/engines/director/module.mk b/engines/director/module.mk index c6f1f02a79..2d0bb51646 100644 --- a/engines/director/module.mk +++ b/engines/director/module.mk @@ -4,6 +4,7 @@ MODULE_OBJS = \ detection.o \ dib.o \ director.o \ + movie.o \ resource.o \ score.o \ sound.o \ diff --git a/engines/director/movie.cpp b/engines/director/movie.cpp new file mode 100644 index 0000000000..3c34e2d432 --- /dev/null +++ b/engines/director/movie.cpp @@ -0,0 +1,66 @@ +/* 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. + * + * Additional copyright for this file: + * Copyright (C) 1995-1997 Presto Studios, Inc. + * + * 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 "video/qt_decoder.h" +#include "director/movie.h" +#include "director/score.h" +#include "common/debug.h" +#include "common/system.h" +namespace Director { + +Movie::Movie(Common::String fileName, DirectorEngine *vm) { + _vm = vm; + _currentVideo = new Video::QuickTimeDecoder(); + if (!_currentVideo->loadFile(fileName)) { + warning("Can not open file %s", fileName.c_str()); + return; + } +} + +void Movie::play(Common::Point dest) { + + _currentVideo->start(); + + uint16 width = _currentVideo->getWidth(); + uint16 height = _currentVideo->getHeight(); + + while (!_currentVideo->endOfVideo()) { + if (_currentVideo->needsUpdate()) { + const Graphics::Surface *frame = _currentVideo->decodeNextFrame(); + g_system->copyRectToScreen(frame->getPixels(), frame->pitch, dest.x, dest.y, width, height); + g_system->updateScreen(); + } + g_system->delayMillis(10); + _vm->getCurrentScore()->processEvents(); + } +} + +void Movie::stop() { + _currentVideo->stop(); +} + +Movie::~Movie() { + delete _currentVideo; +} + +} //End of namespace Director diff --git a/engines/director/movie.h b/engines/director/movie.h new file mode 100644 index 0000000000..e26d10a7c7 --- /dev/null +++ b/engines/director/movie.h @@ -0,0 +1,51 @@ +/* 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. + * + * Additional copyright for this file: + * Copyright (C) 1995-1997 Presto Studios, Inc. + * + * 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 DIRECTOR_MOVIE_H +#define DIRECTOR_MOVIE_H + +#include "common/str.h" +#include "common/rect.h" +#include "graphics/managed_surface.h" +#include "director/director.h" + +namespace Video { +class VideoDecoder; +} + +namespace Director { + +class Movie { +public: + Movie(Common::String fileName, DirectorEngine *vm); + ~Movie(); + void play(Common::Point dest); + void stop(); + +private: + Video::VideoDecoder *_currentVideo; + DirectorEngine *_vm; +}; +} //End of namespace Director + +#endif |