aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew Hoops2012-08-31 22:06:56 -0400
committerMatthew Hoops2012-08-31 22:06:56 -0400
commit1043283e535a3870b557ef428223a99e9e3b5be5 (patch)
tree89e813c12a1b2c6932c709a8a86eae2f071946f1
parent790a74ab9df5eae7bcf9d923b0d5ec26569771b2 (diff)
downloadscummvm-rg350-1043283e535a3870b557ef428223a99e9e3b5be5.tar.gz
scummvm-rg350-1043283e535a3870b557ef428223a99e9e3b5be5.tar.bz2
scummvm-rg350-1043283e535a3870b557ef428223a99e9e3b5be5.zip
PEGASUS: Use setEndTime()
-rw-r--r--engines/pegasus/movie.cpp17
-rw-r--r--engines/pegasus/movie.h2
-rw-r--r--engines/pegasus/pegasus.cpp5
3 files changed, 19 insertions, 5 deletions
diff --git a/engines/pegasus/movie.cpp b/engines/pegasus/movie.cpp
index fc722e5043..6187d87a2d 100644
--- a/engines/pegasus/movie.cpp
+++ b/engines/pegasus/movie.cpp
@@ -81,7 +81,7 @@ void Movie::initFromMovieFile(const Common::String &fileName, bool transparent)
allocateSurface(bounds);
setStart(0, getScale());
- setStop(_video->getDuration().convertToFramerate(getScale()).totalNumberOfFrames(), getScale());
+ TimeBase::setStop(_video->getDuration().convertToFramerate(getScale()).totalNumberOfFrames(), getScale());
}
void Movie::redrawMovieWorld() {
@@ -132,6 +132,13 @@ void Movie::moveMovieBoxTo(const CoordType h, const CoordType v) {
_movieBox.moveTo(h, v);
}
+void Movie::setStop(const TimeValue stopTime, const TimeScale scale) {
+ TimeBase::setStop(stopTime, scale);
+
+ if (_video)
+ _video->setEndTime(Audio::Timestamp(0, _stopTime, _stopScale));
+}
+
void Movie::setVolume(uint16 volume) {
if (_video)
_video->setVolume(MIN<uint>(volume, 0xFF));
@@ -205,12 +212,18 @@ TimeValue Movie::getDuration(const TimeScale scale) const {
void Movie::updateTime() {
// The reason why we overrode TimeBase's updateTime():
// Again, avoiding timers and handling it here
- if (_video && !_video->isPaused()) {
+ if (_video && _video->isPlaying() && !_video->isPaused()) {
redrawMovieWorld();
uint32 startTime = _startTime * getScale() / _startScale;
uint32 stopTime = _stopTime * getScale() / _stopScale;
uint32 actualTime = CLIP<int>(_video->getTime() * getScale() / 1000, startTime, stopTime);
+
+ // HACK: Due to the inaccuracy of the time, we won't actually allow us to hit
+ // the stop time unless we've actually reached the end of the segment.
+ if (actualTime == stopTime && !_video->endOfVideo())
+ actualTime--;
+
_time = Common::Rational(actualTime, getScale());
}
}
diff --git a/engines/pegasus/movie.h b/engines/pegasus/movie.h
index efe4a7c244..9b9cc2bdbe 100644
--- a/engines/pegasus/movie.h
+++ b/engines/pegasus/movie.h
@@ -62,6 +62,8 @@ public:
virtual void moveMovieBoxTo(const CoordType, const CoordType);
+ virtual void setStop(const TimeValue, const TimeScale = 0);
+
virtual TimeValue getDuration(const TimeScale = 0) const;
// *** HACK ALERT
diff --git a/engines/pegasus/pegasus.cpp b/engines/pegasus/pegasus.cpp
index efa57d586f..423d321fe0 100644
--- a/engines/pegasus/pegasus.cpp
+++ b/engines/pegasus/pegasus.cpp
@@ -2087,15 +2087,14 @@ void PegasusEngine::playEndMessage() {
}
void PegasusEngine::doSubChase() {
- static const uint32 endTime = 133200 * 1000 / 600;
-
Video::VideoDecoder *video = new Video::QuickTimeDecoder();
if (!video->loadFile("Images/Norad Alpha/Sub Chase Movie"))
error("Failed to load sub chase");
+ video->setEndTime(Audio::Timestamp(0, 133200, 600));
video->start();
- while (!shouldQuit() && !video->endOfVideo() && video->getTime() < endTime) {
+ while (!shouldQuit() && !video->endOfVideo()) {
if (video->needsUpdate()) {
const Graphics::Surface *frame = video->decodeNextFrame();