aboutsummaryrefslogtreecommitdiff
path: root/engines/pegasus
diff options
context:
space:
mode:
authorMatthew Hoops2012-08-26 15:49:45 -0400
committerMatthew Hoops2012-08-26 16:12:25 -0400
commitbb1e60e8b2f3bba06ae3b089097f94ea82a70c8a (patch)
treea434233367725fbb6dc7072776c312f52254d57f /engines/pegasus
parent7a49b3669a0e18210a2f5409cb35da735f549b11 (diff)
parent857b92f8ffececa9c1f990d21a6a8d1630199a62 (diff)
downloadscummvm-rg350-bb1e60e8b2f3bba06ae3b089097f94ea82a70c8a.tar.gz
scummvm-rg350-bb1e60e8b2f3bba06ae3b089097f94ea82a70c8a.tar.bz2
scummvm-rg350-bb1e60e8b2f3bba06ae3b089097f94ea82a70c8a.zip
Merge remote branch 'upstream/master' into pegasus
Conflicts: AUTHORS devtools/credits.pl gui/credits.h
Diffstat (limited to 'engines/pegasus')
-rw-r--r--engines/pegasus/movie.cpp16
-rw-r--r--engines/pegasus/movie.h6
-rw-r--r--engines/pegasus/neighborhood/caldoria/caldoria.cpp4
-rw-r--r--engines/pegasus/neighborhood/mars/mars.cpp4
-rw-r--r--engines/pegasus/pegasus.cpp19
-rw-r--r--engines/pegasus/pegasus.h4
-rw-r--r--engines/pegasus/surface.cpp8
-rw-r--r--engines/pegasus/surface.h8
8 files changed, 39 insertions, 30 deletions
diff --git a/engines/pegasus/movie.cpp b/engines/pegasus/movie.cpp
index 5d393de492..fc722e5043 100644
--- a/engines/pegasus/movie.cpp
+++ b/engines/pegasus/movie.cpp
@@ -73,8 +73,6 @@ void Movie::initFromMovieFile(const Common::String &fileName, bool transparent)
error("Could not load video '%s'", fileName.c_str());
}
- _video->pauseVideo(true);
-
Common::Rect bounds(0, 0, _video->getWidth(), _video->getHeight());
sizeElement(_video->getWidth(), _video->getHeight());
_movieBox = bounds;
@@ -83,7 +81,7 @@ void Movie::initFromMovieFile(const Common::String &fileName, bool transparent)
allocateSurface(bounds);
setStart(0, getScale());
- setStop(_video->getDuration() * getScale() / 1000, getScale());
+ setStop(_video->getDuration().convertToFramerate(getScale()).totalNumberOfFrames(), getScale());
}
void Movie::redrawMovieWorld() {
@@ -149,7 +147,7 @@ void Movie::setTime(const TimeValue time, const TimeScale scale) {
else if (timeFrac >= Common::Rational(_stopTime, _stopScale))
return;
- _video->seekToTime(Audio::Timestamp(0, timeFrac.getNumerator(), timeFrac.getDenominator()));
+ _video->seek(Audio::Timestamp(0, timeFrac.getNumerator(), timeFrac.getDenominator()));
_time = timeFrac;
_lastMillis = 0;
}
@@ -166,15 +164,15 @@ void Movie::setRate(const Common::Rational rate) {
}
void Movie::start() {
- if (_video && _video->isPaused())
- _video->pauseVideo(false);
+ if (_video)
+ _video->start();
TimeBase::start();
}
void Movie::stop() {
- if (_video && !_video->isPaused())
- _video->pauseVideo(true);
+ if (_video)
+ _video->stop();
TimeBase::stop();
}
@@ -199,7 +197,7 @@ TimeValue Movie::getDuration(const TimeScale scale) const {
// but the problem is that too much code requires this function to behave this way...
if (_video)
- return _video->getDuration() * ((scale == 0) ? getScale() : scale) / 1000;
+ return _video->getDuration().convertToFramerate(((scale == 0) ? getScale() : scale)).totalNumberOfFrames();
return 0;
}
diff --git a/engines/pegasus/movie.h b/engines/pegasus/movie.h
index 593442fa44..efe4a7c244 100644
--- a/engines/pegasus/movie.h
+++ b/engines/pegasus/movie.h
@@ -32,7 +32,7 @@
#include "pegasus/surface.h"
namespace Video {
- class SeekableVideoDecoder;
+class VideoDecoder;
}
namespace Pegasus {
@@ -65,13 +65,13 @@ public:
virtual TimeValue getDuration(const TimeScale = 0) const;
// *** HACK ALERT
- Video::SeekableVideoDecoder *getMovie() { return _video; }
+ Video::VideoDecoder *getMovie() { return _video; }
void setVolume(uint16);
protected:
void updateTime();
- Video::SeekableVideoDecoder *_video;
+ Video::VideoDecoder *_video;
Common::Rect _movieBox;
};
diff --git a/engines/pegasus/neighborhood/caldoria/caldoria.cpp b/engines/pegasus/neighborhood/caldoria/caldoria.cpp
index ce62b17265..a6806d5c46 100644
--- a/engines/pegasus/neighborhood/caldoria/caldoria.cpp
+++ b/engines/pegasus/neighborhood/caldoria/caldoria.cpp
@@ -205,13 +205,11 @@ void Caldoria::start() {
error("Could not load pullback movie");
// Draw the first frame so we can fade to it
- pullbackMovie->pauseVideo(true);
const Graphics::Surface *frame = pullbackMovie->decodeNextFrame();
assert(frame);
assert(frame->format == g_system->getScreenFormat());
g_system->copyRectToScreen((byte *)frame->pixels, frame->pitch, 64, 112, frame->w, frame->h);
_vm->_gfx->doFadeInSync(kTwoSeconds * kFifteenTicksPerSecond, kFifteenTicksPerSecond);
- pullbackMovie->pauseVideo(false);
bool saveAllowed = _vm->swapSaveAllowed(false);
bool openAllowed = _vm->swapLoadAllowed(false);
@@ -219,6 +217,8 @@ void Caldoria::start() {
bool skipped = false;
Input input;
+ pullbackMovie->start();
+
while (!_vm->shouldQuit() && !pullbackMovie->endOfVideo()) {
if (pullbackMovie->needsUpdate()) {
frame = pullbackMovie->decodeNextFrame();
diff --git a/engines/pegasus/neighborhood/mars/mars.cpp b/engines/pegasus/neighborhood/mars/mars.cpp
index c950a85897..816a13f01d 100644
--- a/engines/pegasus/neighborhood/mars/mars.cpp
+++ b/engines/pegasus/neighborhood/mars/mars.cpp
@@ -2405,6 +2405,8 @@ void Mars::doCanyonChase() {
if (!video->loadFile("Images/Mars/M44ESA.movie"))
error("Could not load interface->shuttle transition video");
+ video->start();
+
while (!_vm->shouldQuit() && !video->endOfVideo()) {
if (video->needsUpdate()) {
const Graphics::Surface *frame = video->decodeNextFrame();
@@ -3024,6 +3026,8 @@ void Mars::transportToRobotShip() {
if (!video->loadFile("Images/Mars/M98EAE.movie"))
error("Could not load shuttle->interface transition video");
+ video->start();
+
while (!_vm->shouldQuit() && !video->endOfVideo()) {
if (video->needsUpdate()) {
const Graphics::Surface *frame = video->decodeNextFrame();
diff --git a/engines/pegasus/pegasus.cpp b/engines/pegasus/pegasus.cpp
index 0e426a2943..bbe2e0e212 100644
--- a/engines/pegasus/pegasus.cpp
+++ b/engines/pegasus/pegasus.cpp
@@ -289,8 +289,10 @@ void PegasusEngine::runIntro() {
bool skipped = false;
- Video::SeekableVideoDecoder *video = new Video::QuickTimeDecoder();
+ Video::VideoDecoder *video = new Video::QuickTimeDecoder();
if (video->loadFile(_introDirectory + "/BandaiLogo.movie")) {
+ video->start();
+
while (!shouldQuit() && !video->endOfVideo() && !skipped) {
if (video->needsUpdate()) {
const Graphics::Surface *frame = video->decodeNextFrame();
@@ -320,7 +322,8 @@ void PegasusEngine::runIntro() {
if (!video->loadFile(_introDirectory + "/Big Movie.movie"))
error("Could not load intro movie");
- video->seekToTime(Audio::Timestamp(0, 10 * 600, 600));
+ video->seek(Audio::Timestamp(0, 10 * 600, 600));
+ video->start();
playMovieScaled(video, 0, 0);
@@ -671,13 +674,14 @@ void PegasusEngine::introTimerExpired() {
bool skipped = false;
- Video::SeekableVideoDecoder *video = new Video::QuickTimeDecoder();
+ Video::VideoDecoder *video = new Video::QuickTimeDecoder();
if (!video->loadFile(_introDirectory + "/LilMovie.movie"))
error("Failed to load little movie");
bool saveAllowed = swapSaveAllowed(false);
bool openAllowed = swapLoadAllowed(false);
+ video->start();
skipped = playMovieScaled(video, 0, 0);
delete video;
@@ -815,13 +819,14 @@ void PegasusEngine::doGameMenuCommand(const GameMenuCommand command) {
_gfx->clearScreen();
_gfx->updateDisplay();
- Video::SeekableVideoDecoder *video = new Video::QuickTimeDecoder();
+ Video::VideoDecoder *video = new Video::QuickTimeDecoder();
if (!video->loadFile(_introDirectory + "/Closing.movie"))
error("Could not load closing movie");
uint16 x = (640 - video->getWidth() * 2) / 2;
uint16 y = (480 - video->getHeight() * 2) / 2;
+ video->start();
playMovieScaled(video, x, y);
delete video;
@@ -1261,7 +1266,7 @@ void PegasusEngine::checkFlashlight() {
_neighborhood->checkFlashlight();
}
-bool PegasusEngine::playMovieScaled(Video::SeekableVideoDecoder *video, uint16 x, uint16 y) {
+bool PegasusEngine::playMovieScaled(Video::VideoDecoder *video, uint16 x, uint16 y) {
bool skipped = false;
while (!shouldQuit() && !video->endOfVideo() && !skipped) {
@@ -2084,10 +2089,12 @@ void PegasusEngine::playEndMessage() {
void PegasusEngine::doSubChase() {
static const uint32 endTime = 133200 * 1000 / 600;
- Video::SeekableVideoDecoder *video = new Video::QuickTimeDecoder();
+ Video::VideoDecoder *video = new Video::QuickTimeDecoder();
if (!video->loadFile("Images/Norad Alpha/Sub Chase Movie"))
error("Failed to load sub chase");
+ video->start();
+
while (!shouldQuit() && !video->endOfVideo() && video->getTime() < endTime) {
if (video->needsUpdate()) {
const Graphics::Surface *frame = video->decodeNextFrame();
diff --git a/engines/pegasus/pegasus.h b/engines/pegasus/pegasus.h
index a1b4cff9ab..1ee0136c30 100644
--- a/engines/pegasus/pegasus.h
+++ b/engines/pegasus/pegasus.h
@@ -50,7 +50,7 @@ namespace Common {
}
namespace Video {
- class SeekableVideoDecoder;
+ class VideoDecoder;
}
namespace Pegasus {
@@ -253,7 +253,7 @@ private:
Hotspot _returnHotspot;
InputHandler *_savedHandler;
void showTempScreen(const Common::String &fileName);
- bool playMovieScaled(Video::SeekableVideoDecoder *video, uint16 x, uint16 y);
+ bool playMovieScaled(Video::VideoDecoder *video, uint16 x, uint16 y);
void throwAwayEverything();
void shellGameInput(const Input &input, const Hotspot *cursorSpot);
Common::RandomSource *_rnd;
diff --git a/engines/pegasus/surface.cpp b/engines/pegasus/surface.cpp
index 897305f2a3..343bc415f3 100644
--- a/engines/pegasus/surface.cpp
+++ b/engines/pegasus/surface.cpp
@@ -108,8 +108,8 @@ void Surface::getImageFromPICTStream(Common::SeekableReadStream *stream) {
_bounds = Common::Rect(0, 0, _surface->w, _surface->h);
}
-void Surface::getImageFromMovieFrame(Video::SeekableVideoDecoder *video, TimeValue time) {
- video->seekToTime(Audio::Timestamp(0, time, 600));
+void Surface::getImageFromMovieFrame(Video::VideoDecoder *video, TimeValue time) {
+ video->seek(Audio::Timestamp(0, time, 600));
const Graphics::Surface *frame = video->decodeNextFrame();
if (frame) {
@@ -344,7 +344,7 @@ void Frame::initFromPICTResource(Common::MacResManager *resFork, uint16 id, bool
_transparent = transparent;
}
-void Frame::initFromMovieFrame(Video::SeekableVideoDecoder *video, TimeValue time, bool transparent) {
+void Frame::initFromMovieFrame(Video::VideoDecoder *video, TimeValue time, bool transparent) {
getImageFromMovieFrame(video, time);
_transparent = transparent;
}
@@ -381,7 +381,7 @@ void Picture::initFromPICTResource(Common::MacResManager *resFork, uint16 id, bo
sizeElement(surfaceBounds.width(), surfaceBounds.height());
}
-void Picture::initFromMovieFrame(Video::SeekableVideoDecoder *video, TimeValue time, bool transparent) {
+void Picture::initFromMovieFrame(Video::VideoDecoder *video, TimeValue time, bool transparent) {
Frame::initFromMovieFrame(video, time, transparent);
Common::Rect surfaceBounds;
diff --git a/engines/pegasus/surface.h b/engines/pegasus/surface.h
index 34a88dbd53..311fb50419 100644
--- a/engines/pegasus/surface.h
+++ b/engines/pegasus/surface.h
@@ -41,7 +41,7 @@ namespace Graphics {
}
namespace Video {
- class SeekableVideoDecoder;
+ class VideoDecoder;
}
namespace Pegasus {
@@ -76,7 +76,7 @@ public:
virtual void getImageFromPICTFile(const Common::String &fileName);
virtual void getImageFromPICTResource(Common::MacResManager *resFork, uint16 id);
- virtual void getImageFromMovieFrame(Video::SeekableVideoDecoder *, TimeValue);
+ virtual void getImageFromMovieFrame(Video::VideoDecoder *, TimeValue);
protected:
bool _ownsSurface;
@@ -110,7 +110,7 @@ public:
virtual void initFromPICTFile(const Common::String &fileName, bool transparent = false);
virtual void initFromPICTResource(Common::MacResManager *resFork, uint16 id, bool transparent = false);
- virtual void initFromMovieFrame(Video::SeekableVideoDecoder *, TimeValue, bool transparent = false);
+ virtual void initFromMovieFrame(Video::VideoDecoder *, TimeValue, bool transparent = false);
};
class SpriteFrame : public Frame {
@@ -130,7 +130,7 @@ public:
virtual void initFromPICTFile(const Common::String &fileName, bool transparent = false);
virtual void initFromPICTResource(Common::MacResManager *resFork, uint16 id, bool transparent = false);
- virtual void initFromMovieFrame(Video::SeekableVideoDecoder *, TimeValue, bool transparent = false);
+ virtual void initFromMovieFrame(Video::VideoDecoder *, TimeValue, bool transparent = false);
virtual void draw(const Common::Rect &);
};