aboutsummaryrefslogtreecommitdiff
path: root/engines/mohawk
diff options
context:
space:
mode:
authorBastien Bouclet2017-07-30 17:30:50 +0200
committerBastien Bouclet2017-07-30 17:42:01 +0200
commit07aaed5659e352db1ddece44e715a854159d58ec (patch)
tree03dfa6ebbfe81c60b79d7bbc55fa9295f8b2f4a9 /engines/mohawk
parent4fee9a492ea9db7fd3c7830e2e07b7d79808bbdc (diff)
downloadscummvm-rg350-07aaed5659e352db1ddece44e715a854159d58ec.tar.gz
scummvm-rg350-07aaed5659e352db1ddece44e715a854159d58ec.tar.bz2
scummvm-rg350-07aaed5659e352db1ddece44e715a854159d58ec.zip
MOHAWK: Myst: Set the mixer sound type to SFX for videos
Also simplify video filename construction.
Diffstat (limited to 'engines/mohawk')
-rw-r--r--engines/mohawk/console.cpp34
-rw-r--r--engines/mohawk/myst.cpp31
-rw-r--r--engines/mohawk/myst.h15
-rw-r--r--engines/mohawk/myst_areas.cpp6
-rw-r--r--engines/mohawk/myst_areas.h2
-rw-r--r--engines/mohawk/myst_stacks/channelwood.cpp48
-rw-r--r--engines/mohawk/myst_stacks/dni.cpp40
-rw-r--r--engines/mohawk/myst_stacks/intro.cpp15
-rw-r--r--engines/mohawk/myst_stacks/mechanical.cpp19
-rw-r--r--engines/mohawk/myst_stacks/myst.cpp149
-rw-r--r--engines/mohawk/myst_stacks/selenitic.cpp78
-rw-r--r--engines/mohawk/myst_stacks/stoneship.cpp51
-rw-r--r--engines/mohawk/video.cpp7
-rw-r--r--engines/mohawk/video.h5
14 files changed, 190 insertions, 310 deletions
diff --git a/engines/mohawk/console.cpp b/engines/mohawk/console.cpp
index 877c1acd37..f24df96b55 100644
--- a/engines/mohawk/console.cpp
+++ b/engines/mohawk/console.cpp
@@ -248,37 +248,27 @@ bool MystConsole::Cmd_StopSound(int argc, const char **argv) {
}
bool MystConsole::Cmd_PlayMovie(int argc, const char **argv) {
- if (argc < 2) {
- debugPrintf("Usage: playMovie <name> [<stack>] [<left> <top>]\n");
+ if (argc < 3) {
+ debugPrintf("Usage: playMovie <name> <stack> [<left> <top>]\n");
debugPrintf("NOTE: The movie will play *once* in the background.\n");
return true;
}
- Common::String fileName;
- if (argc == 3 || argc > 4) {
- int8 stackNum = 0;
- for (byte i = 1; i <= ARRAYSIZE(mystStackNames); i++)
- if (!scumm_stricmp(argv[2], mystStackNames[i - 1])) {
- stackNum = i;
- break;
- }
-
- if (!stackNum) {
- debugPrintf("\'%s\' is not a stack name!\n", argv[2]);
- return true;
+ Common::String fileName = argv[1];
+ int8 stackNum = -1;
+ for (byte i = 0; i < ARRAYSIZE(mystStackNames); i++)
+ if (!scumm_stricmp(argv[2], mystStackNames[i])) {
+ stackNum = i;
+ break;
}
- fileName = _vm->wrapMovieFilename(argv[1], stackNum - 1);
- } else {
- fileName = argv[1];
- }
-
- VideoEntryPtr video = _vm->_video->playMovie(fileName);
- if (!video) {
- debugPrintf("Failed to open movie '%s'\n", fileName.c_str());
+ if (stackNum < 0) {
+ debugPrintf("\'%s\' is not a stack name!\n", argv[2]);
return true;
}
+ VideoEntryPtr video = _vm->playMovie(fileName, static_cast<MystStack>(stackNum));
+
if (argc == 4) {
video->setX(atoi(argv[2]));
video->setY(atoi(argv[3]));
diff --git a/engines/mohawk/myst.cpp b/engines/mohawk/myst.cpp
index 9ce38b92b5..bd4af66360 100644
--- a/engines/mohawk/myst.cpp
+++ b/engines/mohawk/myst.cpp
@@ -225,11 +225,27 @@ Common::String MohawkEngine_Myst::wrapMovieFilename(const Common::String &movieN
return Common::String("qtw/") + prefix + movieName + ".mov";
}
+VideoEntryPtr MohawkEngine_Myst::playMovie(const Common::String &name, MystStack stack) {
+ Common::String filename = wrapMovieFilename(name, stack);
+ VideoEntryPtr video = _video->playMovie(filename, Audio::Mixer::kSFXSoundType);
-void MohawkEngine_Myst::playMovieBlocking(const Common::String &fileName, uint16 x, uint16 y) {
- VideoEntryPtr video = _video->playMovie(fileName);
if (!video) {
- error("Failed to open the '%s' movie", fileName.c_str());
+ error("Failed to open the '%s' movie", filename.c_str());
+ }
+
+ return video;
+}
+
+VideoEntryPtr MohawkEngine_Myst::findVideo(const Common::String &name, MystStack stack) {
+ Common::String filename = wrapMovieFilename(name, stack);
+ return _video->findVideo(filename);
+}
+
+void MohawkEngine_Myst::playMovieBlocking(const Common::String &name, MystStack stack, uint16 x, uint16 y) {
+ Common::String filename = wrapMovieFilename(name, stack);
+ VideoEntryPtr video = _video->playMovie(filename, Audio::Mixer::kSFXSoundType);
+ if (!video) {
+ error("Failed to open the '%s' movie", filename.c_str());
}
video->moveTo(x, y);
@@ -237,10 +253,11 @@ void MohawkEngine_Myst::playMovieBlocking(const Common::String &fileName, uint16
waitUntilMovieEnds(video);
}
-void MohawkEngine_Myst::playMovieBlockingCentered(const Common::String &fileName) {
- VideoEntryPtr video = _video->playMovie(fileName);
+void MohawkEngine_Myst::playFlybyMovie(const Common::String &name) {
+ Common::String filename = wrapMovieFilename(name, kMasterpieceOnly);
+ VideoEntryPtr video = _video->playMovie(filename, Audio::Mixer::kSFXSoundType);
if (!video) {
- error("Failed to open the '%s' movie", fileName.c_str());
+ error("Failed to open the '%s' movie", filename.c_str());
}
// Clear screen
@@ -579,7 +596,7 @@ void MohawkEngine_Myst::changeToStack(uint16 stack, uint16 card, uint16 linkSrcS
}
if (flyby) {
- playMovieBlockingCentered(wrapMovieFilename(flyby, kMasterpieceOnly));
+ playFlybyMovie(flyby);
}
}
diff --git a/engines/mohawk/myst.h b/engines/mohawk/myst.h
index f9823e5291..3f756faee0 100644
--- a/engines/mohawk/myst.h
+++ b/engines/mohawk/myst.h
@@ -63,7 +63,7 @@ enum {
};
// Myst Stacks
-enum {
+enum MystStack {
kChannelwoodStack = 0, // Channelwood Age
kCreditsStack, // Credits
kDemoStack, // Demo Main Menu
@@ -181,8 +181,6 @@ public:
Common::SeekableReadStream *getResource(uint32 tag, uint16 id) override;
Common::Array<uint16> getResourceIDList(uint32 type) const;
- Common::String wrapMovieFilename(const Common::String &movieName, uint16 stack);
-
void changeToStack(uint16 stack, uint16 card, uint16 linkSrcSound, uint16 linkDstSound);
void changeToCard(uint16 card, TransitionType transition);
uint16 getCurCard() { return _curCard; }
@@ -228,8 +226,10 @@ public:
void setCacheState(bool state) { _cache.enabled = state; }
bool getCacheState() { return _cache.enabled; }
- void playMovieBlocking(const Common::String &filename, uint16 x, uint16 y);
- void playMovieBlockingCentered(const Common::String &filename);
+ VideoEntryPtr playMovie(const Common::String &name, MystStack stack);
+ VideoEntryPtr findVideo(const Common::String &name, MystStack stack);
+ void playMovieBlocking(const Common::String &name, MystStack stack, uint16 x, uint16 y);
+ void playFlybyMovie(const Common::String &name);
void waitUntilMovieEnds(const VideoEntryPtr &video);
void playSoundBlocking(uint16 id);
@@ -269,6 +269,9 @@ private:
void loadResources();
void drawResourceRects();
void checkCurrentResource();
+ void updateActiveResource();
+
+ Common::String wrapMovieFilename(const Common::String &movieName, uint16 stack);
/** Area of type kMystAreaHover being hovered by the mouse, if any */
MystAreaHover *_hoverResource;
@@ -291,8 +294,6 @@ private:
uint16 _mainCursor; // Also defines the current page being held (white, blue, red, or none)
void pauseEngineIntern(bool) override;
-
- void updateActiveResource();
};
template<class T>
diff --git a/engines/mohawk/myst_areas.cpp b/engines/mohawk/myst_areas.cpp
index 61b0d8796b..7cc39e97b2 100644
--- a/engines/mohawk/myst_areas.cpp
+++ b/engines/mohawk/myst_areas.cpp
@@ -162,7 +162,7 @@ const Common::String MystAreaAction::describe() {
}
// In Myst/Making of Myst, the paths are hardcoded ala Windows style without extension. Convert them.
-Common::String MystAreaVideo::convertMystVideoName(Common::String name) {
+Common::String MystAreaVideo::convertMystVideoName(const Common::String &name) {
Common::String temp;
for (uint32 i = 1; i < name.size(); i++) {
@@ -217,7 +217,7 @@ VideoEntryPtr MystAreaVideo::playMovie() {
// If the video is not running, play it
if (!handle) {
- handle = _vm->_video->playMovie(_videoFile);
+ handle = _vm->_video->playMovie(_videoFile, Audio::Mixer::kSFXSoundType);
if (!handle)
error("Failed to open '%s'", _videoFile.c_str());
@@ -256,7 +256,7 @@ VideoEntryPtr MystAreaVideo::getVideo() {
VideoEntryPtr handle = _vm->_video->findVideo(_videoFile);
if (!handle) {
// If the video has not been loaded yet, do it but don't start playing it
- handle = _vm->_video->playMovie(_videoFile);
+ handle = _vm->_video->playMovie(_videoFile, Audio::Mixer::kSFXSoundType);
if (!handle)
error("Failed to open '%s'", _videoFile.c_str());
handle->stop();
diff --git a/engines/mohawk/myst_areas.h b/engines/mohawk/myst_areas.h
index 3108a197fb..32b6ca4f2f 100644
--- a/engines/mohawk/myst_areas.h
+++ b/engines/mohawk/myst_areas.h
@@ -117,7 +117,7 @@ public:
void pauseMovie(bool pause);
protected:
- static Common::String convertMystVideoName(Common::String name);
+ static Common::String convertMystVideoName(const Common::String &name);
Common::String _videoFile;
int16 _left;
diff --git a/engines/mohawk/myst_stacks/channelwood.cpp b/engines/mohawk/myst_stacks/channelwood.cpp
index 4777e92899..17df749c74 100644
--- a/engines/mohawk/myst_stacks/channelwood.cpp
+++ b/engines/mohawk/myst_stacks/channelwood.cpp
@@ -296,10 +296,7 @@ bool Channelwood::pipeChangeValve(bool open, uint16 mask) {
}
void Channelwood::o_bridgeToggle(uint16 var, const ArgumentsArray &args) {
- VideoEntryPtr bridge = _vm->_video->playMovie(_vm->wrapMovieFilename("bridge", kChannelwoodStack));
- if (!bridge)
- error("Failed to open 'bridge' movie");
-
+ VideoEntryPtr bridge = _vm->playMovie("bridge", kChannelwoodStack);
bridge->moveTo(292, 203);
// Toggle bridge state
@@ -316,10 +313,7 @@ void Channelwood::o_pipeExtend(uint16 var, const ArgumentsArray &args) {
debugC(kDebugScript, "\tsoundId: %d", soundId);
_vm->_sound->playEffect(soundId);
- VideoEntryPtr pipe = _vm->_video->playMovie(_vm->wrapMovieFilename("pipebrid", kChannelwoodStack));
- if (!pipe)
- error("Failed to open 'pipebrid' movie");
-
+ VideoEntryPtr pipe = _vm->playMovie("pipebrid", kChannelwoodStack);
pipe->moveTo(267, 170);
// Toggle pipe state
@@ -581,27 +575,19 @@ void Channelwood::o_hologramMonitor(uint16 var, const ArgumentsArray &args) {
switch (button) {
case 0:
- video = _vm->_video->playMovie(_vm->wrapMovieFilename("monalgh", kChannelwoodStack));
- if (!video)
- error("Failed to open monalgh movie");
+ video = _vm->playMovie("monalgh", kChannelwoodStack);
video->moveTo(227, 70);
break;
case 1:
- video = _vm->_video->playMovie(_vm->wrapMovieFilename("monamth", kChannelwoodStack));
- if (!video)
- error("Failed to open monamth movie");
+ video = _vm->playMovie("monamth", kChannelwoodStack);
video->moveTo(227, 70);
break;
case 2:
- video = _vm->_video->playMovie(_vm->wrapMovieFilename("monasirs", kChannelwoodStack));
- if (!video)
- error("Failed to open monasirs movie");
+ video = _vm->playMovie("monasirs", kChannelwoodStack);
video->moveTo(227, 70);
break;
case 3:
- video = _vm->_video->playMovie(_vm->wrapMovieFilename("monsmsg", kChannelwoodStack));
- if (!video)
- error("Failed to open monsmsg movie");
+ video = _vm->playMovie("monsmsg", kChannelwoodStack);
video->moveTo(226, 68);
break;
default:
@@ -623,16 +609,16 @@ void Channelwood::o_hologramTemple(uint16 var, const ArgumentsArray &args) {
// Used on Card 3333 (Temple Hologram)
switch (_state.holoprojectorSelection) {
case 0:
- _vm->playMovieBlocking(_vm->wrapMovieFilename("holoalgh", kChannelwoodStack), 139, 64);
+ _vm->playMovieBlocking("holoalgh", kChannelwoodStack, 139, 64);
break;
case 1:
- _vm->playMovieBlocking(_vm->wrapMovieFilename("holoamth", kChannelwoodStack), 127, 73);
+ _vm->playMovieBlocking("holoamth", kChannelwoodStack, 127, 73);
break;
case 2:
- _vm->playMovieBlocking(_vm->wrapMovieFilename("holoasir", kChannelwoodStack), 139, 64);
+ _vm->playMovieBlocking("holoasir", kChannelwoodStack, 139, 64);
break;
case 3:
- _vm->playMovieBlocking(_vm->wrapMovieFilename("holosmsg", kChannelwoodStack), 127, 45);
+ _vm->playMovieBlocking("holosmsg", kChannelwoodStack, 127, 45);
break;
default:
warning("Opcode o_hologramTemple Control Variable Out of Range");
@@ -673,32 +659,32 @@ void Channelwood::o_elevatorMovies(uint16 var, const ArgumentsArray &args) {
x = 214;
y = 106;
if (direction == 1)
- movie = _vm->wrapMovieFilename("welev1up", kChannelwoodStack);
+ movie = "welev1up";
else
- movie = _vm->wrapMovieFilename("welev1dn", kChannelwoodStack);
+ movie = "welev1dn";
break;
case 2:
x = 215;
y = 117;
if (direction == 1)
- movie = _vm->wrapMovieFilename("welev2up", kChannelwoodStack);
+ movie = "welev2up";
else
- movie = _vm->wrapMovieFilename("welev2dn", kChannelwoodStack);
+ movie = "welev2dn";
break;
case 3:
x = 213;
y = 98;
if (direction == 1)
- movie = _vm->wrapMovieFilename("welev3up", kChannelwoodStack);
+ movie = "welev3up";
else
- movie = _vm->wrapMovieFilename("welev3dn", kChannelwoodStack);
+ movie = "welev3dn";
break;
default:
error("Unknown elevator state %d in o_elevatorMovies", elevator);
}
_vm->_sound->pauseBackground();
- _vm->playMovieBlocking(movie, x, y);
+ _vm->playMovieBlocking(movie, kChannelwoodStack, x, y);
_vm->_sound->resumeBackground();
}
diff --git a/engines/mohawk/myst_stacks/dni.cpp b/engines/mohawk/myst_stacks/dni.cpp
index c668a8c37e..dce40c71f4 100644
--- a/engines/mohawk/myst_stacks/dni.cpp
+++ b/engines/mohawk/myst_stacks/dni.cpp
@@ -95,7 +95,7 @@ void Dni::o_handPage(uint16 var, const ArgumentsArray &args) {
// Used in Card 5014 (Atrus)
// Find Atrus movie
- VideoEntryPtr atrus = _vm->_video->findVideo(_video);
+ VideoEntryPtr atrus = _vm->findVideo(_video, kDniStack);
// Good ending and Atrus asked to give page
if (_globals.ending == 1 && atrus && atrus->getTime() > (uint)Audio::Timestamp(0, 6801, 600).msecs()) {
@@ -115,11 +115,8 @@ void Dni::o_handPage(uint16 var, const ArgumentsArray &args) {
void Dni::atrusLeft_run() {
if (_vm->_system->getMillis() > _atrusLeftTime + 63333) {
- _video = _vm->wrapMovieFilename("atrus2", kDniStack);
- VideoEntryPtr atrus = _vm->_video->playMovie(_video);
- if (!atrus)
- error("Failed to open '%s'", _video.c_str());
-
+ _video = "atrus2";
+ VideoEntryPtr atrus = _vm->playMovie(_video, kDniStack);
atrus->moveTo(215, 77);
atrus->setBounds(Audio::Timestamp(0, 0, 600), Audio::Timestamp(0, 98000, 600));
@@ -138,10 +135,7 @@ void Dni::atrusLeft_run() {
void Dni::loopVideo_run() {
if (!_vm->_video->isVideoPlaying()) {
- VideoEntryPtr atrus = _vm->_video->playMovie(_video);
- if (!atrus)
- error("Failed to open '%s'", _video.c_str());
-
+ VideoEntryPtr atrus = _vm->playMovie(_video, kDniStack);
atrus->moveTo(215, 77);
atrus->setBounds(Audio::Timestamp(0, _loopStart, 600), Audio::Timestamp(0, _loopEnd, 600));
atrus->setLooping(true);
@@ -157,22 +151,16 @@ void Dni::atrus_run() {
} else if (_globals.ending == 1) {
// Atrus asking for page
if (!_vm->_video->isVideoPlaying()) {
- _video = _vm->wrapMovieFilename("atr1page", kDniStack);
- VideoEntryPtr atrus = _vm->_video->playMovie(_video);
- if (!atrus)
- error("Failed to open '%s'", _video.c_str());
-
+ _video = "atr1page";
+ VideoEntryPtr atrus = _vm->playMovie(_video, kDniStack);
atrus->moveTo(215, 77);
atrus->setLooping(true);
atrus->setBounds(Audio::Timestamp(0, 7388, 600), Audio::Timestamp(0, 14700, 600));
}
} else if (_globals.ending != 3 && _globals.ending != 4) {
if (_globals.heldPage == 13) {
- _video = _vm->wrapMovieFilename("atr1page", kDniStack);
- VideoEntryPtr atrus = _vm->_video->playMovie(_video);
- if (!atrus)
- error("Failed to open '%s'", _video.c_str());
-
+ _video = "atr1page";
+ VideoEntryPtr atrus = _vm->playMovie(_video, kDniStack);
atrus->moveTo(215, 77);
atrus->setBounds(Audio::Timestamp(0, 0, 600), Audio::Timestamp(0, 14700, 600));
@@ -184,11 +172,8 @@ void Dni::atrus_run() {
_globals.ending = 1;
} else {
- _video = _vm->wrapMovieFilename("atr1nopg", kDniStack);
- VideoEntryPtr atrus = _vm->_video->playMovie(_video);
- if (!atrus)
- error("Failed to open '%s'", _video.c_str());
-
+ _video = "atr1nopg";
+ VideoEntryPtr atrus = _vm->playMovie(_video, kDniStack);
atrus->moveTo(215, 77);
atrus->setBounds(Audio::Timestamp(0, 0, 600), Audio::Timestamp(0, 46175, 600));
@@ -200,10 +185,7 @@ void Dni::atrus_run() {
_globals.ending = 3;
}
} else if (!_vm->_video->isVideoPlaying()) {
- VideoEntryPtr atrus = _vm->_video->playMovie(_vm->wrapMovieFilename("atrwrite", kDniStack));
- if (!atrus)
- error("Failed to open atrwrite movie");
-
+ VideoEntryPtr atrus = _vm->playMovie("atrwrite", kDniStack);
atrus->moveTo(215, 77);
atrus->setLooping(true);
}
diff --git a/engines/mohawk/myst_stacks/intro.cpp b/engines/mohawk/myst_stacks/intro.cpp
index b77fa0851d..2b431e834a 100644
--- a/engines/mohawk/myst_stacks/intro.cpp
+++ b/engines/mohawk/myst_stacks/intro.cpp
@@ -94,10 +94,7 @@ void Intro::introMovies_run() {
switch (_introStep) {
case 0:
_introStep = 1;
- video = _vm->_video->playMovie(_vm->wrapMovieFilename("broder", kIntroStack));
- if (!video)
- error("Failed to open broder movie");
-
+ video = _vm->playMovie("broder", kIntroStack);
video->center();
break;
case 1:
@@ -106,10 +103,7 @@ void Intro::introMovies_run() {
break;
case 2:
_introStep = 3;
- video = _vm->_video->playMovie(_vm->wrapMovieFilename("cyanlogo", kIntroStack));
- if (!video)
- error("Failed to open cyanlogo movie");
-
+ video = _vm->playMovie("cyanlogo", kIntroStack);
video->center();
break;
case 3:
@@ -120,10 +114,7 @@ void Intro::introMovies_run() {
_introStep = 5;
if (!(_vm->getFeatures() & GF_DEMO)) { // The demo doesn't have the intro video
- video = _vm->_video->playMovie(_vm->wrapMovieFilename("intro", kIntroStack));
- if (!video)
- error("Failed to open intro movie");
-
+ video = _vm->playMovie("intro", kIntroStack);
video->center();
}
break;
diff --git a/engines/mohawk/myst_stacks/mechanical.cpp b/engines/mohawk/myst_stacks/mechanical.cpp
index 0f07e8be29..34238f37f7 100644
--- a/engines/mohawk/myst_stacks/mechanical.cpp
+++ b/engines/mohawk/myst_stacks/mechanical.cpp
@@ -305,10 +305,7 @@ void Mechanical::o_snakeBoxTrigger(uint16 var, const ArgumentsArray &args) {
}
void Mechanical::o_fortressStaircaseMovie(uint16 var, const ArgumentsArray &args) {
- VideoEntryPtr staircase = _vm->_video->playMovie(_vm->wrapMovieFilename("hhstairs", kMechanicalStack));
- if (!staircase)
- error("Failed to open hhstairs movie");
-
+ VideoEntryPtr staircase = _vm->playMovie("hhstairs", kMechanicalStack);
staircase->moveTo(174, 222);
if (_state.staircaseState) {
@@ -532,12 +529,10 @@ void Mechanical::o_elevatorWindowMovie(uint16 var, const ArgumentsArray &args) {
uint16 startTime = args[0];
uint16 endTime = args[1];
- VideoEntryPtr window = _vm->_video->playMovie(_vm->wrapMovieFilename("ewindow", kMechanicalStack));
- if (!window)
- error("Failed to open ewindow movie");
-
+ VideoEntryPtr window = _vm->playMovie("ewindow", kMechanicalStack);
window->moveTo(253, 0);
window->setBounds(Audio::Timestamp(0, startTime, 600), Audio::Timestamp(0, endTime, 600));
+
_vm->waitUntilMovieEnds(window);
}
@@ -603,12 +598,10 @@ void Mechanical::o_elevatorTopMovie(uint16 var, const ArgumentsArray &args) {
uint16 startTime = args[0];
uint16 endTime = args[1];
- VideoEntryPtr window = _vm->_video->playMovie(_vm->wrapMovieFilename("hcelev", kMechanicalStack));
- if (!window)
- error("Failed to open hcelev movie");
-
+ VideoEntryPtr window = _vm->playMovie("hcelev", kMechanicalStack);
window->moveTo(206, 38);
window->setBounds(Audio::Timestamp(0, startTime, 600), Audio::Timestamp(0, endTime, 600));
+
_vm->waitUntilMovieEnds(window);
}
@@ -625,7 +618,7 @@ void Mechanical::o_fortressRotationSetPosition(uint16 var, const ArgumentsArray
}
void Mechanical::o_mystStaircaseMovie(uint16 var, const ArgumentsArray &args) {
- _vm->playMovieBlocking(_vm->wrapMovieFilename("sstairs", kMechanicalStack), 199, 108);
+ _vm->playMovieBlocking("sstairs", kMechanicalStack, 199, 108);
}
void Mechanical::o_elevatorWaitTimeout(uint16 var, const ArgumentsArray &args) {
diff --git a/engines/mohawk/myst_stacks/myst.cpp b/engines/mohawk/myst_stacks/myst.cpp
index 37b0d4fba7..e72d4e5c59 100644
--- a/engines/mohawk/myst_stacks/myst.cpp
+++ b/engines/mohawk/myst_stacks/myst.cpp
@@ -866,9 +866,9 @@ void Myst::o_fireplaceRotation(uint16 var, const ArgumentsArray &args) {
uint16 movieNum = args[0];
if (movieNum)
- _vm->playMovieBlocking(_vm->wrapMovieFilename("fpout", kMystStack), 167, 4);
+ _vm->playMovieBlocking("fpout", kMystStack, 167, 4);
else
- _vm->playMovieBlocking(_vm->wrapMovieFilename("fpin", kMystStack), 167, 4);
+ _vm->playMovieBlocking("fpin", kMystStack, 167, 4);
}
void Myst::o_courtyardBoxesCheckSolution(uint16 var, const ArgumentsArray &args) {
@@ -1107,12 +1107,10 @@ void Myst::o_clockWheelsExecute(uint16 var, const ArgumentsArray &args) {
_vm->wait(500);
// Gears rise up
- VideoEntryPtr gears = _vm->_video->playMovie(_vm->wrapMovieFilename("gears", kMystStack));
- if (!gears)
- error("Failed to open gears movie");
-
+ VideoEntryPtr gears = _vm->playMovie("gears", kMystStack);
gears->moveTo(305, 33);
gears->setBounds(Audio::Timestamp(0, 0, 600), Audio::Timestamp(0, 650, 600));
+
_vm->waitUntilMovieEnds(gears);
_state.clockTowerBridgeOpen = 1;
@@ -1122,12 +1120,10 @@ void Myst::o_clockWheelsExecute(uint16 var, const ArgumentsArray &args) {
_vm->wait(500);
// Gears sink down
- VideoEntryPtr gears = _vm->_video->playMovie(_vm->wrapMovieFilename("gears", kMystStack));
- if (!gears)
- error("Failed to open gears movie");
-
+ VideoEntryPtr gears = _vm->playMovie("gears", kMystStack);
gears->moveTo(305, 33);
gears->setBounds(Audio::Timestamp(0, 700, 600), Audio::Timestamp(0, 1300, 600));
+
_vm->waitUntilMovieEnds(gears);
_state.clockTowerBridgeOpen = 0;
@@ -1166,22 +1162,16 @@ void Myst::o_imagerPlayButton(uint16 var, const ArgumentsArray &args) {
case 1: // Mountain
if (_state.imagerActive) {
// Mountains disappearing
- Common::String file = _vm->wrapMovieFilename("vltmntn", kMystStack);
- VideoEntryPtr mountain = _vm->_video->playMovie(file);
- if (!mountain)
- error("Failed to open '%s'", file.c_str());
-
+ Common::String file = "vltmntn";
+ VideoEntryPtr mountain = _vm->playMovie(file, kMystStack);
mountain->moveTo(159, 96);
mountain->setBounds(Audio::Timestamp(0, 11180, 600), Audio::Timestamp(0, 16800, 600));
_state.imagerActive = 0;
} else {
// Mountains appearing
- Common::String file = _vm->wrapMovieFilename("vltmntn", kMystStack);
- VideoEntryPtr mountain = _vm->_video->playMovie(file);
- if (!mountain)
- error("Failed to open '%s'", file.c_str());
-
+ Common::String file = "vltmntn";
+ VideoEntryPtr mountain = _vm->playMovie(file, kMystStack);
mountain->moveTo(159, 96);
mountain->setBounds(Audio::Timestamp(0, 0, 600), Audio::Timestamp(0, 11180, 600));
@@ -1301,10 +1291,10 @@ void Myst::o_towerElevatorAnimation(uint16 var, const ArgumentsArray &args) {
switch (args[0]) {
case 0:
- _vm->playMovieBlocking(_vm->wrapMovieFilename("libdown", kMystStack), 216, 78);
+ _vm->playMovieBlocking("libdown", kMystStack, 216, 78);
break;
case 1:
- _vm->playMovieBlocking(_vm->wrapMovieFilename("libup", kMystStack), 216, 78);
+ _vm->playMovieBlocking("libup", kMystStack, 216, 78);
break;
default:
break;
@@ -1878,16 +1868,10 @@ Common::Rational Myst::boilerComputeGaugeRate(uint16 pressure, uint32 delay) {
void Myst::boilerResetGauge(const Common::Rational &rate) {
if (!_cabinGaugeMovie || _cabinGaugeMovie->endOfVideo()) {
if (_vm->getCurCard() == 4098) {
- _cabinGaugeMovie = _vm->_video->playMovie(_vm->wrapMovieFilename("cabingau", kMystStack));
- if (!_cabinGaugeMovie)
- error("Failed to open cabingau movie");
-
+ _cabinGaugeMovie = _vm->playMovie("cabingau", kMystStack);
_cabinGaugeMovie->moveTo(243, 96);
} else {
- _cabinGaugeMovie = _vm->_video->playMovie(_vm->wrapMovieFilename("cabcgfar", kMystStack));
- if (!_cabinGaugeMovie)
- error("Failed to open cabingau movie");
-
+ _cabinGaugeMovie = _vm->playMovie("cabcgfar", kMystStack);
_cabinGaugeMovie->moveTo(254, 136);
}
}
@@ -2207,20 +2191,15 @@ void Myst::rocketCheckSolution() {
lever->drawFrame(0);
// Book appearing
- Common::String movieFile = _vm->wrapMovieFilename("selenbok", kMystStack);
- _rocketLinkBook = _vm->_video->playMovie(movieFile);
- if (!_rocketLinkBook)
- error("Failed to open '%s'", movieFile.c_str());
-
+ Common::String movieFile = "selenbok";
+ _rocketLinkBook = _vm->playMovie(movieFile, kMystStack);
_rocketLinkBook->moveTo(224, 41);
_rocketLinkBook->setBounds(Audio::Timestamp(0, 0, 600), Audio::Timestamp(0, 660, 600));
+
_vm->waitUntilMovieEnds(_rocketLinkBook);
// Book looping closed
- _rocketLinkBook = _vm->_video->playMovie(movieFile);
- if (!_rocketLinkBook)
- error("Failed to open '%s'", movieFile.c_str());
-
+ _rocketLinkBook = _vm->playMovie(movieFile, kMystStack);
_rocketLinkBook->moveTo(224, 41);
_rocketLinkBook->setLooping(true);
_rocketLinkBook->setBounds(Audio::Timestamp(0, 660, 600), Audio::Timestamp(0, 3500, 600));
@@ -2804,10 +2783,7 @@ void Myst::clockGearForwardOneStep(uint16 gear) {
// Set video bounds
uint16 gearPosition = _clockGearsPositions[gear] - 1;
- _clockGearsVideos[gear] = _vm->_video->playMovie(_vm->wrapMovieFilename(videos[gear], kMystStack));
- if (!_clockGearsVideos[gear])
- error("Failed to open %s movie", videos[gear]);
-
+ _clockGearsVideos[gear] = _vm->playMovie(videos[gear], kMystStack);
_clockGearsVideos[gear]->moveTo(x[gear], y[gear]);
_clockGearsVideos[gear]->setBounds(
Audio::Timestamp(0, startTime[gearPosition], 600),
@@ -2821,10 +2797,7 @@ void Myst::clockWeightDownOneStep() {
// Set video bounds
if (updateVideo) {
- _clockWeightVideo = _vm->_video->playMovie(_vm->wrapMovieFilename("cl1wlfch", kMystStack));
- if (!_clockWeightVideo)
- error("Failed to open cl1wlfch movie");
-
+ _clockWeightVideo = _vm->playMovie("cl1wlfch", kMystStack);
_clockWeightVideo->moveTo(124, 0);
_clockWeightVideo->setBounds(
Audio::Timestamp(0, _clockWeightPosition, 600),
@@ -2852,7 +2825,7 @@ void Myst::o_clockLeverEndMove(uint16 var, const ArgumentsArray &args) {
// Let movies stop playing
for (uint i = 0; i < ARRAYSIZE(videos); i++) {
- VideoEntryPtr handle = _vm->_video->findVideo(_vm->wrapMovieFilename(videos[i], kMystStack));
+ VideoEntryPtr handle = _vm->findVideo(videos[i], kMystStack);
if (handle)
_vm->waitUntilMovieEnds(handle);
}
@@ -2878,14 +2851,12 @@ void Myst::clockGearsCheckSolution() {
// Make weight go down
_vm->_sound->playEffect(9113);
- _clockWeightVideo = _vm->_video->playMovie(_vm->wrapMovieFilename("cl1wlfch", kMystStack));
- if (!_clockWeightVideo)
- error("Failed to open cl1wlfch movie");
-
+ _clockWeightVideo = _vm->playMovie("cl1wlfch", kMystStack);
_clockWeightVideo->moveTo(124, 0);
_clockWeightVideo->setBounds(
Audio::Timestamp(0, _clockWeightPosition, 600),
Audio::Timestamp(0, 2214, 600));
+
_vm->waitUntilMovieEnds(_clockWeightVideo);
_clockWeightPosition = 2214;
@@ -2894,7 +2865,7 @@ void Myst::clockGearsCheckSolution() {
_vm->_sound->playEffect(7113);
// Gear opening video
- _vm->playMovieBlocking(_vm->wrapMovieFilename("cl1wggat", kMystStack), 195, 225);
+ _vm->playMovieBlocking("cl1wggat", kMystStack, 195, 225);
_state.gearsOpen = 1;
_vm->redrawArea(40);
@@ -2932,7 +2903,7 @@ void Myst::clockReset() {
// Let movies stop playing
for (uint i = 0; i < ARRAYSIZE(videos); i++) {
- VideoEntryPtr handle = _vm->_video->findVideo(_vm->wrapMovieFilename(videos[i], kMystStack));
+ VideoEntryPtr handle = _vm->findVideo(videos[i], kMystStack);
if (handle)
_vm->waitUntilMovieEnds(handle);
}
@@ -2946,10 +2917,7 @@ void Myst::clockReset() {
_vm->_sound->playEffect(7113);
// Gear closing movie
- VideoEntryPtr handle = _vm->_video->playMovie(_vm->wrapMovieFilename("cl1wggat", kMystStack));
- if (!handle)
- error("Failed to open cl1wggat movie");
-
+ VideoEntryPtr handle = _vm->playMovie("cl1wggat", kMystStack);
handle->moveTo(195, 225);
handle->seek(handle->getDuration());
handle->setRate(-1);
@@ -2966,10 +2934,7 @@ void Myst::clockReset() {
void Myst::clockResetWeight() {
_vm->_sound->playEffect(9113);
- _clockWeightVideo = _vm->_video->playMovie(_vm->wrapMovieFilename("cl1wlfch", kMystStack));
- if (!_clockWeightVideo)
- error("Failed to open cl1wlfch movie");
-
+ _clockWeightVideo = _vm->playMovie("cl1wlfch", kMystStack);
_clockWeightVideo->moveTo(124, 0);
// Play the movie backwards, weight going up
@@ -2989,10 +2954,7 @@ void Myst::clockResetGear(uint16 gear) {
// Set video bounds, gears going to 3
uint16 gearPosition = _clockGearsPositions[gear] - 1;
if (gearPosition != 2) {
- _clockGearsVideos[gear] = _vm->_video->playMovie(_vm->wrapMovieFilename(videos[gear], kMystStack));
- if (!_clockGearsVideos[gear])
- error("Failed to open gears movie");
-
+ _clockGearsVideos[gear] = _vm->playMovie(videos[gear], kMystStack);
_clockGearsVideos[gear]->moveTo(x[gear], y[gear]);
_clockGearsVideos[gear]->setBounds(
Audio::Timestamp(0, time[gearPosition], 600),
@@ -3319,11 +3281,9 @@ void Myst::gullsFly1_run() {
else
x = _vm->_rnd->getRandomNumber(160) + 260;
- VideoEntryPtr handle = _vm->_video->playMovie(_vm->wrapMovieFilename(gulls[video], kMystStack));
- if (!handle)
- error("Failed to open gulls movie");
-
+ VideoEntryPtr handle = _vm->playMovie(gulls[video], kMystStack);
handle->moveTo(x, 0);
+
_gullsNextTime = time + _vm->_rnd->getRandomNumber(16667) + 13334;
}
}
@@ -3460,11 +3420,9 @@ void Myst::gullsFly2_run() {
if (time > _gullsNextTime) {
uint16 video = _vm->_rnd->getRandomNumber(3);
if (video != 3) {
- VideoEntryPtr handle = _vm->_video->playMovie(_vm->wrapMovieFilename(gulls[video], kMystStack));
- if (!handle)
- error("Failed to open gulls movie");
-
+ VideoEntryPtr handle = _vm->playMovie(gulls[video], kMystStack);
handle->moveTo(424, 0);
+
_gullsNextTime = time + _vm->_rnd->getRandomNumber(16667) + 13334;
}
}
@@ -3489,10 +3447,7 @@ void Myst::o_boilerMovies_init(uint16 var, const ArgumentsArray &args) {
void Myst::boilerFireInit() {
if (_vm->getCurCard() == 4098) {
- _cabinFireMovie = _vm->_video->playMovie(_vm->wrapMovieFilename("cabfire", kMystStack));
- if (!_cabinFireMovie)
- error("Failed to open cabfire movie");
-
+ _cabinFireMovie = _vm->playMovie("cabfire", kMystStack);
_cabinFireMovie->moveTo(240, 279);
_cabinFireMovie->setLooping(true);
_cabinFireMovie->pause(true);
@@ -3501,10 +3456,7 @@ void Myst::boilerFireInit() {
boilerFireUpdate(true);
} else {
if (_state.cabinPilotLightLit == 1 && _state.cabinValvePosition >= 1) {
- _cabinFireMovie = _vm->_video->playMovie(_vm->wrapMovieFilename("cabfirfr", kMystStack));
- if (!_cabinFireMovie)
- error("Failed to open cabfirfr movie");
-
+ _cabinFireMovie = _vm->playMovie("cabfirfr", kMystStack);
_cabinFireMovie->moveTo(254, 244);
_cabinFireMovie->setLooping(true);
}
@@ -3531,16 +3483,10 @@ void Myst::boilerFireUpdate(bool init) {
void Myst::boilerGaugeInit() {
if (_vm->getCurCard() == 4098) {
- _cabinGaugeMovie = _vm->_video->playMovie(_vm->wrapMovieFilename("cabingau", kMystStack));
- if (!_cabinGaugeMovie)
- error("Failed to open cabingau movie");
-
+ _cabinGaugeMovie = _vm->playMovie("cabingau", kMystStack);
_cabinGaugeMovie->moveTo(243, 96);
} else {
- _cabinGaugeMovie = _vm->_video->playMovie(_vm->wrapMovieFilename("cabcgfar", kMystStack));
- if (!_cabinGaugeMovie)
- error("Failed to open cabcgfar movie");
-
+ _cabinGaugeMovie = _vm->playMovie("cabcgfar", kMystStack);
_cabinGaugeMovie->moveTo(254, 136);
}
@@ -3589,26 +3535,23 @@ void Myst::o_greenBook_init(uint16 var, const ArgumentsArray &args) {
void Myst::greenBook_run() {
uint loopStart = 0;
uint loopEnd = 0;
- Common::String file;
+ Common::String videoName;
if (!_state.greenBookOpenedBefore) {
loopStart = 113200;
loopEnd = 116400;
- file = _vm->wrapMovieFilename("atrusbk1", kMystStack);
+ videoName = "atrusbk1";
} else {
loopStart = 8800;
loopEnd = 9700;
- file = _vm->wrapMovieFilename("atrusbk2", kMystStack);
+ videoName = "atrusbk2";
}
if (_tempVar == 1) {
_vm->_sound->stopEffect();
_vm->_sound->pauseBackground();
- VideoEntryPtr book = _vm->_video->playMovie(file);
- if (!book)
- error("Failed to open '%s'", file.c_str());
-
+ VideoEntryPtr book = _vm->playMovie(videoName, kMystStack);
book->moveTo(314, 76);
if (_globals.ending != 4) {
@@ -3619,13 +3562,11 @@ void Myst::greenBook_run() {
_tempVar = 0;
}
} else if (_tempVar == 2 && !_vm->_video->isVideoPlaying()) {
- VideoEntryPtr book = _vm->_video->playMovie(file);
- if (!book)
- error("Failed to open '%s'", file.c_str());
-
+ VideoEntryPtr book = _vm->playMovie(videoName, kMystStack);
book->moveTo(314, 76);
book->setBounds(Audio::Timestamp(0, loopStart, 600), Audio::Timestamp(0, loopEnd, 600));
book->setLooping(true);
+
_tempVar = 0;
}
}
@@ -3646,11 +3587,9 @@ void Myst::gullsFly3_run() {
if (video != 3) {
uint16 x = _vm->_rnd->getRandomNumber(280) + 135;
- VideoEntryPtr handle = _vm->_video->playMovie(_vm->wrapMovieFilename(gulls[video], kMystStack));
- if (!handle)
- error("Failed to open gulls movie");
-
+ VideoEntryPtr handle = _vm->playMovie(gulls[video], kMystStack);
handle->moveTo(x, 0);
+
_gullsNextTime = time + _vm->_rnd->getRandomNumber(16667) + 13334;
}
}
diff --git a/engines/mohawk/myst_stacks/selenitic.cpp b/engines/mohawk/myst_stacks/selenitic.cpp
index e9439047ff..0f1949f128 100644
--- a/engines/mohawk/myst_stacks/selenitic.cpp
+++ b/engines/mohawk/myst_stacks/selenitic.cpp
@@ -365,123 +365,123 @@ void Selenitic::mazeRunnerBacktrack(uint16 &oldPosition) {
}
void Selenitic::mazeRunnerPlayVideo(uint16 video, uint16 pos) {
- Common::String file;
+ Common::String videoName;
switch (video) {
case 1:
- file = _vm->wrapMovieFilename("forwa1", kSeleniticStack);
+ videoName = "forwa1";
break;
case 2:
- file = _vm->wrapMovieFilename("forwe0", kSeleniticStack);
+ videoName = "forwe0";
break;
case 3:
if (mazeRunnerForwardAllowed(_mazeRunnerPosition))
- file = _vm->wrapMovieFilename("forwf1", kSeleniticStack);
+ videoName = "forwf1";
else
- file = _vm->wrapMovieFilename("forwf0", kSeleniticStack);
+ videoName = "forwf0";
break;
case 4:
- file = _vm->wrapMovieFilename("left00", kSeleniticStack);
+ videoName = "left00";
break;
case 5:
- file = _vm->wrapMovieFilename("left01", kSeleniticStack);
+ videoName = "left01";
break;
case 6:
- file = _vm->wrapMovieFilename("left10", kSeleniticStack);
+ videoName = "left10";
break;
case 7:
- file = _vm->wrapMovieFilename("left11", kSeleniticStack);
+ videoName = "left11";
break;
case 8:
- file = _vm->wrapMovieFilename("right00", kSeleniticStack);
+ videoName = "right00";
break;
case 9:
- file = _vm->wrapMovieFilename("right01", kSeleniticStack);
+ videoName = "right01";
break;
case 10:
- file = _vm->wrapMovieFilename("right10", kSeleniticStack);
+ videoName = "right10";
break;
case 11:
- file = _vm->wrapMovieFilename("right11", kSeleniticStack);
+ videoName = "right11";
break;
case 12:
if (mazeRunnerForwardAllowed(_mazeRunnerPosition))
- file = _vm->wrapMovieFilename("forwo1", kSeleniticStack);
+ videoName = "forwo1";
else
- file = _vm->wrapMovieFilename("forwo0", kSeleniticStack);
+ videoName = "forwo0";
break;
case 13:
if (mazeRunnerForwardAllowed(_mazeRunnerPosition))
- file = _vm->wrapMovieFilename("forwp1", kSeleniticStack);
+ videoName = "forwp1";
else
- file = _vm->wrapMovieFilename("forwp0", kSeleniticStack);
+ videoName = "forwp0";
break;
case 14:
if (mazeRunnerForwardAllowed(_mazeRunnerPosition))
- file = _vm->wrapMovieFilename("forws1", kSeleniticStack);
+ videoName = "forws1";
else
- file = _vm->wrapMovieFilename("forws0", kSeleniticStack);
+ videoName = "forws0";
break;
case 15:
if (mazeRunnerForwardAllowed(_mazeRunnerPosition))
- file = _vm->wrapMovieFilename("forwr1", kSeleniticStack);
+ videoName = "forwr1";
else
- file = _vm->wrapMovieFilename("forwr0", kSeleniticStack);
+ videoName = "forwr0";
break;
case 16:
if (mazeRunnerForwardAllowed(_mazeRunnerPosition))
- file = _vm->wrapMovieFilename("forwl1", kSeleniticStack);
+ videoName = "forwl1";
else
- file = _vm->wrapMovieFilename("forwl0", kSeleniticStack);
+ videoName = "forwl0";
break;
case 17:
- file = _vm->wrapMovieFilename("backa1", kSeleniticStack);
+ videoName = "backa1";
break;
case 18:
- file = _vm->wrapMovieFilename("backe1", kSeleniticStack);
+ videoName = "backe1";
break;
case 19:
if (mazeRunnerForwardAllowed(pos))
- file = _vm->wrapMovieFilename("backf1", kSeleniticStack);
+ videoName = "backf1";
else
- file = _vm->wrapMovieFilename("backf0", kSeleniticStack);
+ videoName = "backf0";
break;
case 20:
if (mazeRunnerForwardAllowed(pos))
- file = _vm->wrapMovieFilename("backo1", kSeleniticStack);
+ videoName = "backo1";
else
- file = _vm->wrapMovieFilename("backo0", kSeleniticStack);
+ videoName = "backo0";
break;
case 21:
if (mazeRunnerForwardAllowed(pos))
- file = _vm->wrapMovieFilename("backp1", kSeleniticStack);
+ videoName = "backp1";
else
- file = _vm->wrapMovieFilename("backp0", kSeleniticStack);
+ videoName = "backp0";
break;
case 22:
if (mazeRunnerForwardAllowed(pos)) {
- file = _vm->wrapMovieFilename("backs1", kSeleniticStack);
+ videoName = "backs1";
} else {
- file = _vm->wrapMovieFilename("backs0", kSeleniticStack);
+ videoName = "backs0";
}
break;
case 23:
if (mazeRunnerForwardAllowed(pos))
- file = _vm->wrapMovieFilename("backr1", kSeleniticStack);
+ videoName = "backr1";
else
- file = _vm->wrapMovieFilename("backr0", kSeleniticStack);
+ videoName = "backr0";
break;
case 24:
if (mazeRunnerForwardAllowed(pos))
- file = _vm->wrapMovieFilename("backl1", kSeleniticStack);
+ videoName = "backl1";
else
- file = _vm->wrapMovieFilename("backl0", kSeleniticStack);
+ videoName = "backl0";
break;
}
- if (!file.empty()) {
+ if (!videoName.empty()) {
const Common::Rect &dest = _mazeRunnerWindow->getRect();
- _vm->playMovieBlocking(file, dest.left, dest.top);
+ _vm->playMovieBlocking(videoName, kSeleniticStack, dest.left, dest.top);
}
}
diff --git a/engines/mohawk/myst_stacks/stoneship.cpp b/engines/mohawk/myst_stacks/stoneship.cpp
index f4b38305f2..534efe7197 100644
--- a/engines/mohawk/myst_stacks/stoneship.cpp
+++ b/engines/mohawk/myst_stacks/stoneship.cpp
@@ -417,12 +417,10 @@ void Stoneship::o_cabinBookMovie(uint16 var, const ArgumentsArray &args) {
uint16 startTime = args[0];
uint16 endTime = args[1];
- VideoEntryPtr book = _vm->_video->playMovie(_vm->wrapMovieFilename("bkroom", kStoneshipStack));
- if (!book)
- error("Failed to open bkroom movie");
-
+ VideoEntryPtr book = _vm->playMovie("bkroom", kStoneshipStack);
book->moveTo(159, 99);
book->setBounds(Audio::Timestamp(0, startTime, 600), Audio::Timestamp(0, endTime, 600));
+
_vm->waitUntilMovieEnds(book);
}
@@ -642,36 +640,27 @@ void Stoneship::o_compassButton(uint16 var, const ArgumentsArray &args) {
}
void Stoneship::o_chestValveVideos(uint16 var, const ArgumentsArray &args) {
- Common::String movie = _vm->wrapMovieFilename("ligspig", kStoneshipStack);
-
_vm->_sound->playEffect(2132);
if (_state.chestValveState) {
// Valve closing
- VideoEntryPtr valve = _vm->_video->playMovie(movie);
- if (!valve)
- error("Failed to open '%s'", movie.c_str());
-
+ VideoEntryPtr valve = _vm->playMovie("ligspig", kStoneshipStack);
valve->moveTo(97, 267);
valve->setBounds(Audio::Timestamp(0, 0, 600), Audio::Timestamp(0, 350, 600));
+
_vm->waitUntilMovieEnds(valve);
} else if (_state.chestWaterState) {
// Valve opening, spilling water
- VideoEntryPtr valve = _vm->_video->playMovie(movie);
- if (!valve)
- error("Failed to open '%s'", movie.c_str());
-
+ VideoEntryPtr valve = _vm->playMovie("ligspig", kStoneshipStack);
valve->moveTo(97, 267);
valve->setBounds(Audio::Timestamp(0, 350, 600), Audio::Timestamp(0, 650, 600));
+
_vm->waitUntilMovieEnds(valve);
_vm->_sound->playEffect(3132);
for (uint i = 0; i < 25; i++) {
- valve = _vm->_video->playMovie(movie);
- if (!valve)
- error("Failed to open '%s'", movie.c_str());
-
+ valve = _vm->playMovie("ligspig", kStoneshipStack);
valve->moveTo(97, 267);
valve->setBounds(Audio::Timestamp(0, 650, 600), Audio::Timestamp(0, 750, 600));
_vm->waitUntilMovieEnds(valve);
@@ -680,13 +669,11 @@ void Stoneship::o_chestValveVideos(uint16 var, const ArgumentsArray &args) {
_vm->_sound->resumeBackground();
} else {
// Valve opening
- VideoEntryPtr valve = _vm->_video->playMovie(movie);
- if (!valve)
- error("Failed to open '%s'", movie.c_str());
-
+ VideoEntryPtr valve = _vm->playMovie("ligspig", kStoneshipStack);
valve->moveTo(97, 267);
valve->seek(Audio::Timestamp(0, 350, 600));
valve->setRate(-1);
+
_vm->waitUntilMovieEnds(valve);
}
}
@@ -701,22 +688,14 @@ void Stoneship::o_chestDropKey(uint16 var, const ArgumentsArray &args) {
}
void Stoneship::o_trapLockOpen(uint16 var, const ArgumentsArray &args) {
- Common::String movie = _vm->wrapMovieFilename("openloc", kStoneshipStack);
-
- VideoEntryPtr lock = _vm->_video->playMovie(movie);
- if (!lock)
- error("Failed to open '%s'", movie.c_str());
-
+ VideoEntryPtr lock = _vm->playMovie("openloc", kStoneshipStack);
lock->moveTo(187, 71);
lock->setBounds(Audio::Timestamp(0, 0, 600), Audio::Timestamp(0, 750, 600));
_vm->waitUntilMovieEnds(lock);
_vm->_sound->playEffect(2143);
- lock = _vm->_video->playMovie(movie);
- if (!lock)
- error("Failed to open '%s'", movie.c_str());
-
+ lock = _vm->playMovie("openloc", kStoneshipStack);
lock->moveTo(187, 71);
lock->setBounds(Audio::Timestamp(0, 750, 600), Audio::Timestamp(0, 10000, 600));
_vm->waitUntilMovieEnds(lock);
@@ -735,19 +714,19 @@ void Stoneship::o_sideDoorsMovies(uint16 var, const ArgumentsArray &args) {
switch (movieId) {
case 0:
// Card 2251
- _vm->playMovieBlocking(_vm->wrapMovieFilename("tunaup", kStoneshipStack), 149, 161);
+ _vm->playMovieBlocking("tunaup", kStoneshipStack, 149, 161);
break;
case 1:
// Card 2247
- _vm->playMovieBlocking(_vm->wrapMovieFilename("tunadown", kStoneshipStack), 218, 150);
+ _vm->playMovieBlocking("tunadown", kStoneshipStack, 218, 150);
break;
case 2:
// Card 2289
- _vm->playMovieBlocking(_vm->wrapMovieFilename("tuncup", kStoneshipStack), 259, 161);
+ _vm->playMovieBlocking("tuncup", kStoneshipStack, 259, 161);
break;
case 3:
// Card 2285
- _vm->playMovieBlocking(_vm->wrapMovieFilename("tuncdown", kStoneshipStack), 166, 150);
+ _vm->playMovieBlocking("tuncdown", kStoneshipStack, 166, 150);
break;
default:
warning("Opcode 120 MovieId Out Of Range");
diff --git a/engines/mohawk/video.cpp b/engines/mohawk/video.cpp
index 4354bb5b97..994e219b03 100644
--- a/engines/mohawk/video.cpp
+++ b/engines/mohawk/video.cpp
@@ -164,8 +164,8 @@ void VideoManager::stopVideos() {
_videos.clear();
}
-VideoEntryPtr VideoManager::playMovie(const Common::String &fileName) {
- VideoEntryPtr ptr = open(fileName);
+VideoEntryPtr VideoManager::playMovie(const Common::String &fileName, Audio::Mixer::SoundType soundType) {
+ VideoEntryPtr ptr = open(fileName, soundType);
if (!ptr)
return VideoEntryPtr();
@@ -313,7 +313,7 @@ VideoEntryPtr VideoManager::open(uint16 id) {
return entry;
}
-VideoEntryPtr VideoManager::open(const Common::String &fileName) {
+VideoEntryPtr VideoManager::open(const Common::String &fileName, Audio::Mixer::SoundType soundType) {
// If this video is already playing, return that entry
VideoEntryPtr oldVideo = findVideo(fileName);
if (oldVideo)
@@ -325,6 +325,7 @@ VideoEntryPtr VideoManager::open(const Common::String &fileName) {
return VideoEntryPtr();
Video::VideoDecoder *video = new Video::QuickTimeDecoder();
+ video->setSoundType(soundType);
if (!video->loadStream(stream)) {
// FIXME: Better error handling
delete video;
diff --git a/engines/mohawk/video.h b/engines/mohawk/video.h
index 07dc128641..1f8b93d467 100644
--- a/engines/mohawk/video.h
+++ b/engines/mohawk/video.h
@@ -23,6 +23,7 @@
#ifndef MOHAWK_VIDEO_H
#define MOHAWK_VIDEO_H
+#include "audio/mixer.h"
#include "audio/timestamp.h"
#include "common/array.h"
#include "common/list.h"
@@ -240,7 +241,7 @@ public:
virtual ~VideoManager();
// Generic movie functions
- VideoEntryPtr playMovie(const Common::String &filename);
+ VideoEntryPtr playMovie(const Common::String &filename, Audio::Mixer::SoundType soundType = Audio::Mixer::kPlainSoundType);
VideoEntryPtr playMovie(uint16 id);
bool updateMovies();
void pauseVideos();
@@ -263,7 +264,7 @@ protected:
// Utility functions for managing entries
VideoEntryPtr open(uint16 id);
- VideoEntryPtr open(const Common::String &fileName);
+ VideoEntryPtr open(const Common::String &fileName, Audio::Mixer::SoundType soundType);
VideoList::iterator findEntry(VideoEntryPtr ptr);