aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Bouclet2016-03-05 16:12:42 +0100
committerBastien Bouclet2016-03-05 20:49:12 +0100
commita5b0e35626f3ceb3fa65ea05a40f8b06f193c51d (patch)
treec5f97938ff1a35567b10f181b9c715d693ddbdab
parent05bffc9832568d029582434ea13307e2364bc809 (diff)
downloadscummvm-rg350-a5b0e35626f3ceb3fa65ea05a40f8b06f193c51d.tar.gz
scummvm-rg350-a5b0e35626f3ceb3fa65ea05a40f8b06f193c51d.tar.bz2
scummvm-rg350-a5b0e35626f3ceb3fa65ea05a40f8b06f193c51d.zip
MOHAWK: Add a method to get a video handle from a MystAreaVideo
Use it to fix the fortress rotation controls once more
-rw-r--r--engines/mohawk/myst_areas.cpp14
-rw-r--r--engines/mohawk/myst_areas.h2
-rw-r--r--engines/mohawk/myst_stacks/mechanical.cpp6
3 files changed, 19 insertions, 3 deletions
diff --git a/engines/mohawk/myst_areas.cpp b/engines/mohawk/myst_areas.cpp
index 193def2a32..4b9cf546fa 100644
--- a/engines/mohawk/myst_areas.cpp
+++ b/engines/mohawk/myst_areas.cpp
@@ -251,6 +251,20 @@ VideoHandle MystAreaVideo::playMovie() {
return handle;
}
+VideoHandle MystAreaVideo::getMovieHandle() {
+ // If the video is already in the manager, just return the handle
+ VideoHandle handle = _vm->_video->findVideoHandle(_videoFile);
+ if (!handle) {
+ // If the video has not been loaded yet, do it but don't start playing it
+ handle = _vm->_video->playMovie(_videoFile);
+ if (!handle)
+ error("Failed to open '%s'", _videoFile.c_str());
+ handle->stop();
+ }
+
+ return handle;
+}
+
void MystAreaVideo::handleCardChange() {
if (_playOnCardChange)
playMovie();
diff --git a/engines/mohawk/myst_areas.h b/engines/mohawk/myst_areas.h
index 09ec6a2742..b19a2df9e2 100644
--- a/engines/mohawk/myst_areas.h
+++ b/engines/mohawk/myst_areas.h
@@ -108,6 +108,8 @@ public:
MystAreaVideo(MohawkEngine_Myst *vm, Common::SeekableReadStream *rlstStream, MystArea *parent);
VideoHandle playMovie();
+ VideoHandle getMovieHandle();
+
void handleCardChange() override;
bool isPlaying();
void setDirection(int16 direction) { _direction = direction; }
diff --git a/engines/mohawk/myst_stacks/mechanical.cpp b/engines/mohawk/myst_stacks/mechanical.cpp
index 3214c643a5..3324c9a22d 100644
--- a/engines/mohawk/myst_stacks/mechanical.cpp
+++ b/engines/mohawk/myst_stacks/mechanical.cpp
@@ -667,7 +667,7 @@ void Mechanical::o_elevatorTopMovie(uint16 op, uint16 var, uint16 argc, uint16 *
void Mechanical::o_fortressRotationSetPosition(uint16 op, uint16 var, uint16 argc, uint16 *argv) {
debugC(kDebugScript, "Opcode %d: Set fortress position", op);
- VideoHandle gears = _fortressRotationGears->playMovie();
+ VideoHandle gears = _fortressRotationGears->getMovieHandle();
uint32 moviePosition = Audio::Timestamp(gears->getTime(), 600).totalNumberOfFrames();
// Myst ME short movie workaround, explained in o_fortressRotation_init
@@ -801,7 +801,7 @@ void Mechanical::o_elevatorRotation_init(uint16 op, uint16 var, uint16 argc, uin
}
void Mechanical::fortressRotation_run() {
- VideoHandle gears = _fortressRotationGears->playMovie();
+ VideoHandle gears = _fortressRotationGears->getMovieHandle();
double oldRate = gears->getRate().toDouble();
uint32 moviePosition = Audio::Timestamp(gears->getTime(), 600).totalNumberOfFrames();
@@ -949,7 +949,7 @@ void Mechanical::fortressSimulation_run() {
_fortressSimulationInit = false;
} else {
- VideoHandle holo = _fortressSimulationHolo->playMovie();
+ VideoHandle holo = _fortressSimulationHolo->getMovieHandle();
double oldRate = holo->getRate().toDouble();