aboutsummaryrefslogtreecommitdiff
path: root/engines/mohawk
diff options
context:
space:
mode:
authorBastien Bouclet2014-06-29 18:54:35 +0200
committerBastien Bouclet2016-02-07 15:27:03 +0100
commite50f93f2987f41b6c9d193dcf07383ba415cb96d (patch)
tree348859f3d7a183e8e0b0d4169ac55f0ae7e14386 /engines/mohawk
parentbc687c72162809c8848065f46166513aeea69223 (diff)
downloadscummvm-rg350-e50f93f2987f41b6c9d193dcf07383ba415cb96d.tar.gz
scummvm-rg350-e50f93f2987f41b6c9d193dcf07383ba415cb96d.tar.bz2
scummvm-rg350-e50f93f2987f41b6c9d193dcf07383ba415cb96d.zip
MOHAWK: Fix Myst's fortress simulator using a hack
The proper solution implies support for playing movies with edit lists backwards in QT code.
Diffstat (limited to 'engines/mohawk')
-rw-r--r--engines/mohawk/myst_stacks/mechanical.cpp35
-rw-r--r--engines/mohawk/myst_stacks/mechanical.h4
2 files changed, 38 insertions, 1 deletions
diff --git a/engines/mohawk/myst_stacks/mechanical.cpp b/engines/mohawk/myst_stacks/mechanical.cpp
index 4f8ce54923..20d01f57d2 100644
--- a/engines/mohawk/myst_stacks/mechanical.cpp
+++ b/engines/mohawk/myst_stacks/mechanical.cpp
@@ -941,6 +941,10 @@ void Mechanical::fortressSimulation_run() {
holo->setLooping(true);
holo->setRate(0);
+ // HACK: Support negative rates with edit lists
+ _fortressSimulationHoloRate = 0;
+ // END HACK
+
_vm->_cursor->showCursor();
_fortressSimulationInit = false;
@@ -948,6 +952,11 @@ void Mechanical::fortressSimulation_run() {
VideoHandle holo = _fortressSimulationHolo->playMovie();
double oldRate = holo->getRate().toDouble();
+
+ // HACK: Support negative rates with edit lists
+ oldRate = _fortressSimulationHoloRate;
+ // END HACK
+
uint32 moviePosition = Audio::Timestamp(holo->getTime(), 600).totalNumberOfFrames();
int32 positionInQuarter = 900 - (moviePosition + 900) % 1800;
@@ -981,7 +990,26 @@ void Mechanical::fortressSimulation_run() {
newRate = CLIP<double>(newRate, -2.5, 2.5);
- holo->setRate(Common::Rational((int)(newRate * 1000.0), 1000));
+ // HACK: Support negative rates with edit lists
+
+ // Our current QuickTime implementation does not support negative
+ // playback rates for movies using edit lists.
+ // The fortress rotation simulator movie this code handles is the
+ // only movie in the game requiring that feature.
+
+ // This hack approximates the next frame to display when the rate
+ // is negative, and seeks to it. It's not intended to be precise.
+
+ _fortressSimulationHoloRate = newRate;
+
+ if (_fortressSimulationHoloRate < 0) {
+ uint32 newMoviePosition = moviePosition + _fortressSimulationHoloRate * 10;
+ holo->setRate(0);
+ holo->seek(Audio::Timestamp(0, newMoviePosition, 600));
+ } else {
+ holo->setRate(Common::Rational((int)(newRate * 1000.0), 1000));
+ }
+ // END HACK
_gearsWereRunning = true;
} else if (_gearsWereRunning) {
@@ -989,6 +1017,11 @@ void Mechanical::fortressSimulation_run() {
uint16 simulationPosition = (moviePosition + 900) / 1800 % 4;
holo->setRate(0);
+
+ // HACK: Support negative rates with edit lists
+ _fortressSimulationHoloRate = 0;
+ // END HACK
+
holo->seek(Audio::Timestamp(0, 1800 * simulationPosition, 600));
_vm->_sound->playSoundBlocking( _fortressRotationSounds[simulationPosition]);
diff --git a/engines/mohawk/myst_stacks/mechanical.h b/engines/mohawk/myst_stacks/mechanical.h
index 159a330c79..aae02df433 100644
--- a/engines/mohawk/myst_stacks/mechanical.h
+++ b/engines/mohawk/myst_stacks/mechanical.h
@@ -124,6 +124,10 @@ private:
MystAreaVideo *_fortressSimulationHolo; // 160
MystAreaVideo *_fortressSimulationStartup; // 164
+ // HACK: Support negative rates with edit lists
+ double _fortressSimulationHoloRate;
+ // END HACK
+
uint16 _elevatorGoingDown; // 112
float _elevatorRotationSpeed; // 120