aboutsummaryrefslogtreecommitdiff
path: root/engines/pegasus/movie.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'engines/pegasus/movie.cpp')
-rw-r--r--engines/pegasus/movie.cpp17
1 files changed, 15 insertions, 2 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());
}
}