aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorMatthew Hoops2011-10-09 16:14:14 -0400
committerMatthew Hoops2011-10-09 16:14:14 -0400
commit09be0ed5c8732fb0fe430bc2824eb541f6f4738d (patch)
treeec00c63e293d4c9b01516c50877b4933bf419ad2 /engines
parent89773a90ce9208936a9b9c4543da52f83bb5d3ad (diff)
downloadscummvm-rg350-09be0ed5c8732fb0fe430bc2824eb541f6f4738d.tar.gz
scummvm-rg350-09be0ed5c8732fb0fe430bc2824eb541f6f4738d.tar.bz2
scummvm-rg350-09be0ed5c8732fb0fe430bc2824eb541f6f4738d.zip
PEGASUS: Fix movie end trigger not always being sent
The demo is now completable and the full game is playable up through the temporal rip in the TSA. Holy halibut, Batman!
Diffstat (limited to 'engines')
-rwxr-xr-xengines/pegasus/movie.cpp17
-rwxr-xr-xengines/pegasus/movie.h4
-rwxr-xr-xengines/pegasus/timers.cpp40
-rwxr-xr-xengines/pegasus/timers.h1
4 files changed, 29 insertions, 33 deletions
diff --git a/engines/pegasus/movie.cpp b/engines/pegasus/movie.cpp
index c3cfbfdd5d..75790ed897 100755
--- a/engines/pegasus/movie.cpp
+++ b/engines/pegasus/movie.cpp
@@ -174,10 +174,8 @@ TimeValue Movie::getDuration(const TimeScale scale) const {
return 0;
}
-void Movie::checkCallBacks() {
- TimeBase::checkCallBacks();
-
- // The reason why we overrode TimeBase's checkCallBacks():
+void Movie::updateTime() {
+ // The reason why we overrode TimeBase's updateTime():
// Again, avoiding timers and handling it here
if (_video && !_video->isPaused()) {
if (_video->needsUpdate())
@@ -187,17 +185,6 @@ void Movie::checkCallBacks() {
uint32 stopTime = _stopTime * getScale() / _stopScale;
uint32 actualTime = CLIP<int>(_video->getElapsedTime() * getScale() / 1000, startTime, stopTime);
_time = Common::Rational(actualTime, getScale());
-
- // Stop the video when we go past our end
- // TODO: Check if this should really be -1
- if (actualTime >= stopTime - 1) {
- // HACK: Handle looping here as well
- // Should be handled like the rest of TimeBases
- if (getFlags() & kLoopTimeBase)
- setTime(_startTime, _startScale);
- else
- stop();
- }
}
}
diff --git a/engines/pegasus/movie.h b/engines/pegasus/movie.h
index 12d1af97d3..704da0e92e 100755
--- a/engines/pegasus/movie.h
+++ b/engines/pegasus/movie.h
@@ -68,9 +68,9 @@ public:
Video::SeekableVideoDecoder *getMovie() { return _video; }
void setVolume(uint16);
- virtual void checkCallBacks();
-
protected:
+ void updateTime();
+
Video::SeekableVideoDecoder *_video;
Common::Rect _movieBox;
};
diff --git a/engines/pegasus/timers.cpp b/engines/pegasus/timers.cpp
index 584ddfbfe4..c9be3655b9 100755
--- a/engines/pegasus/timers.cpp
+++ b/engines/pegasus/timers.cpp
@@ -198,15 +198,7 @@ void TimeBase::setMasterTimeBase(TimeBase *tb) {
_master->_slaves.push_back(this);
}
-void TimeBase::checkCallBacks() {
- // Nothing to do if we're paused or not running
- if (_paused || !isRunning())
- return;
-
- Common::Rational startTime = Common::Rational(_startTime, _startScale);
- Common::Rational stopTime = Common::Rational(_stopTime, _stopScale);
-
- // First step: update the times
+void TimeBase::updateTime() {
if (_lastMillis == 0) {
_lastMillis = g_engine->getTotalPlayTime();
} else {
@@ -216,13 +208,25 @@ void TimeBase::checkCallBacks() {
_time += Common::Rational(curTime - _lastMillis, 1000) * getEffectiveRate();
_lastMillis = curTime;
-
- // Clip time to the boundaries
- if (_time >= stopTime)
- _time = stopTime;
- else if (_time <= startTime)
- _time = startTime;
}
+}
+
+void TimeBase::checkCallBacks() {
+ // Nothing to do if we're paused or not running
+ if (_paused || !isRunning())
+ return;
+
+ Common::Rational startTime = Common::Rational(_startTime, _startScale);
+ Common::Rational stopTime = Common::Rational(_stopTime, _stopScale);
+
+ // First step: update the times
+ updateTime();
+
+ // Clip time to the boundaries
+ if (_time >= stopTime)
+ _time = stopTime;
+ else if (_time <= startTime)
+ _time = startTime;
// TODO: Update the slaves?
@@ -253,12 +257,16 @@ void TimeBase::checkCallBacks() {
}
}
- // Loop if necessary
if (getFlags() & kLoopTimeBase) {
+ // Loop if necessary
if (getRate() < 0 && time == startTime)
setTime(_stopTime, _stopScale);
else if (getRate() > 0 && time == stopTime)
setTime(_startTime, _startScale);
+ } else {
+ // Stop at the end
+ if ((getRate() > 0 && time == stopTime) || (getRate() < 0 && time == startTime))
+ stop();
}
}
diff --git a/engines/pegasus/timers.h b/engines/pegasus/timers.h
index 0b2f59d6c7..80cec52a45 100755
--- a/engines/pegasus/timers.h
+++ b/engines/pegasus/timers.h
@@ -108,6 +108,7 @@ public:
protected:
void addCallBack(TimeBaseCallBack *);
void removeCallBack(TimeBaseCallBack *);
+ virtual void updateTime();
TimeBase *_master;
TimeScale _preferredScale;