diff options
author | Matthew Hoops | 2011-09-22 10:53:53 -0400 |
---|---|---|
committer | Matthew Hoops | 2011-09-22 11:52:33 -0400 |
commit | 2e9c7b5342290005c92f30bcce35401c91fcd175 (patch) | |
tree | c002e143779408f37b5bdd1414dd588fa5104150 /engines | |
parent | c88e33abd7ba8c282a6d2839c4b5cce57ad17773 (diff) | |
download | scummvm-rg350-2e9c7b5342290005c92f30bcce35401c91fcd175.tar.gz scummvm-rg350-2e9c7b5342290005c92f30bcce35401c91fcd175.tar.bz2 scummvm-rg350-2e9c7b5342290005c92f30bcce35401c91fcd175.zip |
PEGASUS: Don't allow for seeking beyond the ends of the movie
Diffstat (limited to 'engines')
-rwxr-xr-x | engines/pegasus/movie.cpp | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/engines/pegasus/movie.cpp b/engines/pegasus/movie.cpp index 9d9c18994f..2bf852a496 100755 --- a/engines/pegasus/movie.cpp +++ b/engines/pegasus/movie.cpp @@ -81,6 +81,9 @@ void Movie::redrawMovieWorld() { if (_video) { const Graphics::Surface *frame = _video->decodeNextFrame(); + if (!frame) + return; + if (_directDraw) { // Copy to the screen Common::Rect bounds; @@ -117,8 +120,16 @@ void Movie::setVolume(uint16 volume) { void Movie::setTime(const TimeValue time, const TimeScale scale) { if (_video) { - _video->seekToTime(Audio::Timestamp(0, time, ((scale == 0) ? getScale() : scale))); - _time = Common::Rational(time, ((scale == 0) ? getScale() : scale)); + // Don't go past the ends of the movie + Common::Rational timeFrac = Common::Rational(time, ((scale == 0) ? getScale() : scale)); + + if (timeFrac < Common::Rational(_startTime, _startScale)) + timeFrac = Common::Rational(_startTime, _startScale); + else if (timeFrac >= Common::Rational(_stopTime, _stopScale)) + return; + + _video->seekToTime(Audio::Timestamp(0, timeFrac.getNumerator(), timeFrac.getDenominator())); + _time = timeFrac; } } |