aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/mohawk/myst.cpp98
-rw-r--r--engines/mohawk/myst.h8
-rw-r--r--engines/mohawk/myst_areas.cpp2
-rw-r--r--engines/mohawk/myst_stacks/channelwood.cpp14
-rw-r--r--engines/mohawk/myst_stacks/mechanical.cpp10
-rw-r--r--engines/mohawk/myst_stacks/myst.cpp26
-rw-r--r--engines/mohawk/myst_stacks/selenitic.cpp2
-rw-r--r--engines/mohawk/myst_stacks/stoneship.cpp24
-rw-r--r--engines/mohawk/video.cpp74
-rw-r--r--engines/mohawk/video.h5
10 files changed, 120 insertions, 143 deletions
diff --git a/engines/mohawk/myst.cpp b/engines/mohawk/myst.cpp
index 7804fb52bd..f965756fca 100644
--- a/engines/mohawk/myst.cpp
+++ b/engines/mohawk/myst.cpp
@@ -84,6 +84,8 @@ MohawkEngine_Myst::MohawkEngine_Myst(OSystem *syst, const MohawkGameDescription
_optionsDialog = nullptr;
_prevStack = nullptr;
+
+ _escapePressed = false;
}
MohawkEngine_Myst::~MohawkEngine_Myst() {
@@ -220,6 +222,52 @@ Common::String MohawkEngine_Myst::wrapMovieFilename(const Common::String &movieN
return Common::String("qtw/") + prefix + movieName + ".mov";
}
+
+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());
+ }
+
+ video->moveTo(x, y);
+
+ waitUntilMovieEnds(video);
+}
+
+void MohawkEngine_Myst::playMovieBlockingCentered(const Common::String &fileName) {
+ VideoEntryPtr video = _video->playMovie(fileName);
+ if (!video) {
+ error("Failed to open the '%s' movie", fileName.c_str());
+ }
+
+ // Clear screen
+ _system->fillScreen(_system->getScreenFormat().RGBToColor(0, 0, 0));
+
+ video->center();
+ waitUntilMovieEnds(video);
+}
+
+void MohawkEngine_Myst::waitUntilMovieEnds(const VideoEntryPtr &video) {
+ assert(video);
+
+ // Sanity check
+ if (video->isLooping())
+ error("Called waitUntilMovieEnds() on a looping video");
+
+ while (!video->endOfVideo() && !shouldQuit()) {
+ doFrame();
+
+ // Allow skipping
+ if (_escapePressed) {
+ _escapePressed = false;
+ break;
+ }
+ }
+
+ // Ensure it's removed
+ _video->removeEntry(video);
+}
+
Common::Error MohawkEngine_Myst::run() {
MohawkEngine::run();
@@ -336,6 +384,18 @@ void MohawkEngine_Myst::doFrame() {
_needsShowCredits = false;
}
break;
+ case Common::KEYCODE_ESCAPE:
+ _escapePressed = true;
+ break;
+ default:
+ break;
+ }
+ break;
+ case Common::EVENT_KEYUP:
+ switch (event.kbd.keycode) {
+ case Common::KEYCODE_ESCAPE:
+ _escapePressed = false;
+ break;
default:
break;
}
@@ -355,36 +415,17 @@ void MohawkEngine_Myst::doFrame() {
bool MohawkEngine_Myst::wait(uint32 duration, bool skippable) {
uint32 end = getTotalPlayTime() + duration;
- bool skipped = false;
- while (getTotalPlayTime() < end && !skipped && !shouldQuit()) {
- Common::Event event;
- while (_system->getEventManager()->pollEvent(event)) {
- switch (event.type) {
- case Common::EVENT_LBUTTONUP:
- skipped = skippable;
- break;
- case Common::EVENT_KEYDOWN:
- switch (event.kbd.keycode) {
- case Common::KEYCODE_SPACE:
- pauseGame();
- break;
- case Common::KEYCODE_ESCAPE:
- skipped = skippable;
- break;
- default:
- break;
- }
- default:
- break;
- }
- }
+ while (getTotalPlayTime() < end && !shouldQuit()) {
+ doFrame();
- // Cut down on CPU usage
- _system->delayMillis(10);
+ if (_escapePressed && skippable) {
+ _escapePressed = false;
+ return true; // Return true if skipped
+ }
}
- return skipped;
+ return false;
}
void MohawkEngine_Myst::pollAndDiscardEvents() {
@@ -539,8 +580,9 @@ void MohawkEngine_Myst::changeToStack(uint16 stack, uint16 card, uint16 linkSrcS
break;
}
- if (flyby)
- _video->playMovieBlockingCentered(wrapMovieFilename(flyby, kMasterpieceOnly));
+ if (flyby) {
+ playMovieBlockingCentered(wrapMovieFilename(flyby, kMasterpieceOnly));
+ }
}
changeToCard(card, kTransitionCopy);
diff --git a/engines/mohawk/myst.h b/engines/mohawk/myst.h
index a5a5494408..e3fa5a91c6 100644
--- a/engines/mohawk/myst.h
+++ b/engines/mohawk/myst.h
@@ -27,6 +27,7 @@
#include "mohawk/mohawk.h"
#include "mohawk/resource_cache.h"
#include "mohawk/myst_scripts.h"
+#include "mohawk/video.h"
#include "common/events.h"
#include "common/random.h"
@@ -225,6 +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);
+ void waitUntilMovieEnds(const VideoEntryPtr &video);
+
GUI::Debugger *getDebugger() override { return _console; }
bool canLoadGameStateCurrently() override;
@@ -270,6 +275,9 @@ private:
/** Active area being clicked on / dragged, if any */
MystArea *_clickedResource;
+ // Input
+ bool _escapePressed;
+
Common::Array<MystCursorHint> _cursorHints;
void loadCursorHints();
uint16 _currentCursor;
diff --git a/engines/mohawk/myst_areas.cpp b/engines/mohawk/myst_areas.cpp
index 5bad3e5a04..568a95d1de 100644
--- a/engines/mohawk/myst_areas.cpp
+++ b/engines/mohawk/myst_areas.cpp
@@ -244,7 +244,7 @@ VideoEntryPtr MystAreaVideo::playMovie() {
}
if (_playBlocking) {
- _vm->_video->waitUntilMovieEnds(handle);
+ _vm->waitUntilMovieEnds(handle);
return VideoEntryPtr();
}
diff --git a/engines/mohawk/myst_stacks/channelwood.cpp b/engines/mohawk/myst_stacks/channelwood.cpp
index aee3036327..7e91dbb2c1 100644
--- a/engines/mohawk/myst_stacks/channelwood.cpp
+++ b/engines/mohawk/myst_stacks/channelwood.cpp
@@ -314,7 +314,7 @@ void Channelwood::o_bridgeToggle(uint16 op, uint16 var, uint16 argc, uint16 *arg
else
bridge->setBounds(Audio::Timestamp(0, 0, 600), Audio::Timestamp(0, 3050, 600));
- _vm->_video->waitUntilMovieEnds(bridge);
+ _vm->waitUntilMovieEnds(bridge);
}
void Channelwood::o_pipeExtend(uint16 op, uint16 var, uint16 argc, uint16 *argv) {
@@ -336,7 +336,7 @@ void Channelwood::o_pipeExtend(uint16 op, uint16 var, uint16 argc, uint16 *argv)
else
pipe->setBounds(Audio::Timestamp(0, 0, 600), Audio::Timestamp(0, 3040, 600));
- _vm->_video->waitUntilMovieEnds(pipe);
+ _vm->waitUntilMovieEnds(pipe);
_vm->_sound->resumeBackgroundMyst();
}
@@ -667,16 +667,16 @@ void Channelwood::o_hologramTemple(uint16 op, uint16 var, uint16 argc, uint16 *a
// Used on Card 3333 (Temple Hologram)
switch (_state.holoprojectorSelection) {
case 0:
- _vm->_video->playMovieBlocking(_vm->wrapMovieFilename("holoalgh", kChannelwoodStack), 139, 64);
+ _vm->playMovieBlocking(_vm->wrapMovieFilename("holoalgh", kChannelwoodStack), 139, 64);
break;
case 1:
- _vm->_video->playMovieBlocking(_vm->wrapMovieFilename("holoamth", kChannelwoodStack), 127, 73);
+ _vm->playMovieBlocking(_vm->wrapMovieFilename("holoamth", kChannelwoodStack), 127, 73);
break;
case 2:
- _vm->_video->playMovieBlocking(_vm->wrapMovieFilename("holoasir", kChannelwoodStack), 139, 64);
+ _vm->playMovieBlocking(_vm->wrapMovieFilename("holoasir", kChannelwoodStack), 139, 64);
break;
case 3:
- _vm->_video->playMovieBlocking(_vm->wrapMovieFilename("holosmsg", kChannelwoodStack), 127, 45);
+ _vm->playMovieBlocking(_vm->wrapMovieFilename("holosmsg", kChannelwoodStack), 127, 45);
break;
default:
warning("Opcode %d Control Variable Out of Range", op);
@@ -748,7 +748,7 @@ void Channelwood::o_elevatorMovies(uint16 op, uint16 var, uint16 argc, uint16 *a
}
_vm->_sound->pauseBackgroundMyst();
- _vm->_video->playMovieBlocking(movie, x, y);
+ _vm->playMovieBlocking(movie, x, y);
_vm->_sound->resumeBackgroundMyst();
}
diff --git a/engines/mohawk/myst_stacks/mechanical.cpp b/engines/mohawk/myst_stacks/mechanical.cpp
index 7c5989f6f2..351379b01c 100644
--- a/engines/mohawk/myst_stacks/mechanical.cpp
+++ b/engines/mohawk/myst_stacks/mechanical.cpp
@@ -331,7 +331,7 @@ void Mechanical::o_fortressStaircaseMovie(uint16 op, uint16 var, uint16 argc, ui
staircase->setBounds(Audio::Timestamp(0, 0, 600), Audio::Timestamp(0, 840, 600));
}
- _vm->_video->waitUntilMovieEnds(staircase);
+ _vm->waitUntilMovieEnds(staircase);
}
void Mechanical::o_elevatorRotationStart(uint16 op, uint16 var, uint16 argc, uint16 *argv) {
@@ -584,7 +584,7 @@ void Mechanical::o_elevatorWindowMovie(uint16 op, uint16 var, uint16 argc, uint1
window->moveTo(253, 0);
window->setBounds(Audio::Timestamp(0, startTime, 600), Audio::Timestamp(0, endTime, 600));
- _vm->_video->waitUntilMovieEnds(window);
+ _vm->waitUntilMovieEnds(window);
}
void Mechanical::o_elevatorGoMiddle(uint16 op, uint16 var, uint16 argc, uint16 *argv) {
@@ -661,7 +661,7 @@ void Mechanical::o_elevatorTopMovie(uint16 op, uint16 var, uint16 argc, uint16 *
window->moveTo(206, 38);
window->setBounds(Audio::Timestamp(0, startTime, 600), Audio::Timestamp(0, endTime, 600));
- _vm->_video->waitUntilMovieEnds(window);
+ _vm->waitUntilMovieEnds(window);
}
void Mechanical::o_fortressRotationSetPosition(uint16 op, uint16 var, uint16 argc, uint16 *argv) {
@@ -681,7 +681,7 @@ void Mechanical::o_fortressRotationSetPosition(uint16 op, uint16 var, uint16 arg
void Mechanical::o_mystStaircaseMovie(uint16 op, uint16 var, uint16 argc, uint16 *argv) {
debugC(kDebugScript, "Opcode %d: Myst book staircase video", op);
- _vm->_video->playMovieBlocking(_vm->wrapMovieFilename("sstairs", kMechanicalStack), 199, 108);
+ _vm->playMovieBlocking(_vm->wrapMovieFilename("sstairs", kMechanicalStack), 199, 108);
}
void Mechanical::o_elevatorWaitTimeout(uint16 op, uint16 var, uint16 argc, uint16 *argv) {
@@ -925,7 +925,7 @@ void Mechanical::fortressSimulation_run() {
_vm->_system->delayMillis(10);
}
_vm->_sound->replaceBackgroundMyst(_fortressSimulationStartSound1, 65535);
- _vm->_video->waitUntilMovieEnds(startup);
+ _vm->waitUntilMovieEnds(startup);
_vm->_sound->stopBackgroundMyst();
_vm->_sound->replaceSoundMyst(_fortressSimulationStartSound2);
diff --git a/engines/mohawk/myst_stacks/myst.cpp b/engines/mohawk/myst_stacks/myst.cpp
index 2840b7c797..6979ce5333 100644
--- a/engines/mohawk/myst_stacks/myst.cpp
+++ b/engines/mohawk/myst_stacks/myst.cpp
@@ -887,9 +887,9 @@ void Myst::o_fireplaceRotation(uint16 op, uint16 var, uint16 argc, uint16 *argv)
debugC(kDebugScript, "\tmovieNum: %d", movieNum);
if (movieNum)
- _vm->_video->playMovieBlocking(_vm->wrapMovieFilename("fpout", kMystStack), 167, 4);
+ _vm->playMovieBlocking(_vm->wrapMovieFilename("fpout", kMystStack), 167, 4);
else
- _vm->_video->playMovieBlocking(_vm->wrapMovieFilename("fpin", kMystStack), 167, 4);
+ _vm->playMovieBlocking(_vm->wrapMovieFilename("fpin", kMystStack), 167, 4);
}
void Myst::o_courtyardBoxesCheckSolution(uint16 op, uint16 var, uint16 argc, uint16 *argv) {
@@ -1145,7 +1145,7 @@ void Myst::o_clockWheelsExecute(uint16 op, uint16 var, uint16 argc, uint16 *argv
gears->moveTo(305, 33);
gears->setBounds(Audio::Timestamp(0, 0, 600), Audio::Timestamp(0, 650, 600));
- _vm->_video->waitUntilMovieEnds(gears);
+ _vm->waitUntilMovieEnds(gears);
_state.clockTowerBridgeOpen = 1;
_vm->redrawArea(12);
@@ -1160,7 +1160,7 @@ void Myst::o_clockWheelsExecute(uint16 op, uint16 var, uint16 argc, uint16 *argv
gears->moveTo(305, 33);
gears->setBounds(Audio::Timestamp(0, 700, 600), Audio::Timestamp(0, 1300, 600));
- _vm->_video->waitUntilMovieEnds(gears);
+ _vm->waitUntilMovieEnds(gears);
_state.clockTowerBridgeOpen = 0;
_vm->redrawArea(12);
@@ -1239,7 +1239,7 @@ void Myst::o_imagerPlayButton(uint16 op, uint16 var, uint16 argc, uint16 *argv)
// Water appearing
VideoEntryPtr water = _imagerMovie->playMovie();
water->setBounds(Audio::Timestamp(0, 0, 600), Audio::Timestamp(0, 1814, 600));
- _vm->_video->waitUntilMovieEnds(water);
+ _vm->waitUntilMovieEnds(water);
// Water looping
water = _imagerMovie->playMovie();
@@ -1340,10 +1340,10 @@ void Myst::o_towerElevatorAnimation(uint16 op, uint16 var, uint16 argc, uint16 *
switch (argv[0]) {
case 0:
- _vm->_video->playMovieBlocking(_vm->wrapMovieFilename("libdown", kMystStack), 216, 78);
+ _vm->playMovieBlocking(_vm->wrapMovieFilename("libdown", kMystStack), 216, 78);
break;
case 1:
- _vm->_video->playMovieBlocking(_vm->wrapMovieFilename("libup", kMystStack), 216, 78);
+ _vm->playMovieBlocking(_vm->wrapMovieFilename("libup", kMystStack), 216, 78);
break;
default:
break;
@@ -2279,7 +2279,7 @@ void Myst::rocketCheckSolution() {
_rocketLinkBook->moveTo(224, 41);
_rocketLinkBook->setBounds(Audio::Timestamp(0, 0, 600), Audio::Timestamp(0, 660, 600));
- _vm->_video->waitUntilMovieEnds(_rocketLinkBook);
+ _vm->waitUntilMovieEnds(_rocketLinkBook);
// Book looping closed
_rocketLinkBook = _vm->_video->playMovie(movieFile);
@@ -2981,7 +2981,7 @@ void Myst::o_clockLeverEndMove(uint16 op, uint16 var, uint16 argc, uint16 *argv)
for (uint i = 0; i < ARRAYSIZE(videos); i++) {
VideoEntryPtr handle = _vm->_video->findVideo(_vm->wrapMovieFilename(videos[i], kMystStack));
if (handle)
- _vm->_video->waitUntilMovieEnds(handle);
+ _vm->waitUntilMovieEnds(handle);
}
if (_clockMiddleGearMovedAlone)
@@ -3013,7 +3013,7 @@ void Myst::clockGearsCheckSolution() {
_clockWeightVideo->setBounds(
Audio::Timestamp(0, _clockWeightPosition, 600),
Audio::Timestamp(0, 2214, 600));
- _vm->_video->waitUntilMovieEnds(_clockWeightVideo);
+ _vm->waitUntilMovieEnds(_clockWeightVideo);
_clockWeightPosition = 2214;
_vm->_sound->replaceSoundMyst(6113);
@@ -3021,7 +3021,7 @@ void Myst::clockGearsCheckSolution() {
_vm->_sound->replaceSoundMyst(7113);
// Gear opening video
- _vm->_video->playMovieBlocking(_vm->wrapMovieFilename("cl1wggat", kMystStack), 195, 225);
+ _vm->playMovieBlocking(_vm->wrapMovieFilename("cl1wggat", kMystStack), 195, 225);
_state.gearsOpen = 1;
_vm->redrawArea(40);
@@ -3065,7 +3065,7 @@ void Myst::clockReset() {
for (uint i = 0; i < ARRAYSIZE(videos); i++) {
VideoEntryPtr handle = _vm->_video->findVideo(_vm->wrapMovieFilename(videos[i], kMystStack));
if (handle)
- _vm->_video->waitUntilMovieEnds(handle);
+ _vm->waitUntilMovieEnds(handle);
}
_vm->_sound->replaceSoundMyst(10113);
@@ -3084,7 +3084,7 @@ void Myst::clockReset() {
handle->moveTo(195, 225);
handle->seek(handle->getDuration());
handle->setRate(-1);
- _vm->_video->waitUntilMovieEnds(handle);
+ _vm->waitUntilMovieEnds(handle);
// Redraw gear
_state.gearsOpen = 0;
diff --git a/engines/mohawk/myst_stacks/selenitic.cpp b/engines/mohawk/myst_stacks/selenitic.cpp
index 99cb5c4571..22cb8567f8 100644
--- a/engines/mohawk/myst_stacks/selenitic.cpp
+++ b/engines/mohawk/myst_stacks/selenitic.cpp
@@ -484,7 +484,7 @@ void Selenitic::mazeRunnerPlayVideo(uint16 video, uint16 pos) {
if (!file.empty()) {
const Common::Rect &dest = _mazeRunnerWindow->getRect();
- _vm->_video->playMovieBlocking(file, dest.left, dest.top);
+ _vm->playMovieBlocking(file, dest.left, dest.top);
}
}
diff --git a/engines/mohawk/myst_stacks/stoneship.cpp b/engines/mohawk/myst_stacks/stoneship.cpp
index cd63da44db..5fbb664d7b 100644
--- a/engines/mohawk/myst_stacks/stoneship.cpp
+++ b/engines/mohawk/myst_stacks/stoneship.cpp
@@ -433,7 +433,7 @@ void Stoneship::o_cabinBookMovie(uint16 op, uint16 var, uint16 argc, uint16 *arg
book->moveTo(159, 99);
book->setBounds(Audio::Timestamp(0, startTime, 600), Audio::Timestamp(0, endTime, 600));
- _vm->_video->waitUntilMovieEnds(book);
+ _vm->waitUntilMovieEnds(book);
}
void Stoneship::o_drawerOpenSirius(uint16 op, uint16 var, uint16 argc, uint16 *argv) {
@@ -608,7 +608,7 @@ void Stoneship::o_hologramPlayback(uint16 op, uint16 var, uint16 argc, uint16 *a
displayMovie->setBounds(Audio::Timestamp(0, startPoint, 600), Audio::Timestamp(0, endPoint, 600));
}
- _vm->_video->waitUntilMovieEnds(displayMovie);
+ _vm->waitUntilMovieEnds(displayMovie);
}
void Stoneship::o_hologramSelectionStart(uint16 op, uint16 var, uint16 argc, uint16 *argv) {
@@ -685,7 +685,7 @@ void Stoneship::o_chestValveVideos(uint16 op, uint16 var, uint16 argc, uint16 *a
valve->moveTo(97, 267);
valve->setBounds(Audio::Timestamp(0, 0, 600), Audio::Timestamp(0, 350, 600));
- _vm->_video->waitUntilMovieEnds(valve);
+ _vm->waitUntilMovieEnds(valve);
} else if (_state.chestWaterState) {
// Valve opening, spilling water
VideoEntryPtr valve = _vm->_video->playMovie(movie);
@@ -694,7 +694,7 @@ void Stoneship::o_chestValveVideos(uint16 op, uint16 var, uint16 argc, uint16 *a
valve->moveTo(97, 267);
valve->setBounds(Audio::Timestamp(0, 350, 600), Audio::Timestamp(0, 650, 600));
- _vm->_video->waitUntilMovieEnds(valve);
+ _vm->waitUntilMovieEnds(valve);
_vm->_sound->playSound(3132);
@@ -705,7 +705,7 @@ void Stoneship::o_chestValveVideos(uint16 op, uint16 var, uint16 argc, uint16 *a
valve->moveTo(97, 267);
valve->setBounds(Audio::Timestamp(0, 650, 600), Audio::Timestamp(0, 750, 600));
- _vm->_video->waitUntilMovieEnds(valve);
+ _vm->waitUntilMovieEnds(valve);
}
_vm->_sound->resumeBackgroundMyst();
@@ -718,7 +718,7 @@ void Stoneship::o_chestValveVideos(uint16 op, uint16 var, uint16 argc, uint16 *a
valve->moveTo(97, 267);
valve->seek(Audio::Timestamp(0, 350, 600));
valve->setRate(-1);
- _vm->_video->waitUntilMovieEnds(valve);
+ _vm->waitUntilMovieEnds(valve);
}
}
@@ -744,7 +744,7 @@ void Stoneship::o_trapLockOpen(uint16 op, uint16 var, uint16 argc, uint16 *argv)
lock->moveTo(187, 71);
lock->setBounds(Audio::Timestamp(0, 0, 600), Audio::Timestamp(0, 750, 600));
- _vm->_video->waitUntilMovieEnds(lock);
+ _vm->waitUntilMovieEnds(lock);
_vm->_sound->playSound(2143);
@@ -754,7 +754,7 @@ void Stoneship::o_trapLockOpen(uint16 op, uint16 var, uint16 argc, uint16 *argv)
lock->moveTo(187, 71);
lock->setBounds(Audio::Timestamp(0, 750, 600), Audio::Timestamp(0, 10000, 600));
- _vm->_video->waitUntilMovieEnds(lock);
+ _vm->waitUntilMovieEnds(lock);
if (_state.pumpState != 4)
_vm->_sound->playSound(4143);
@@ -773,19 +773,19 @@ void Stoneship::o_sideDoorsMovies(uint16 op, uint16 var, uint16 argc, uint16 *ar
switch (movieId) {
case 0:
// Card 2251
- _vm->_video->playMovieBlocking(_vm->wrapMovieFilename("tunaup", kStoneshipStack), 149, 161);
+ _vm->playMovieBlocking(_vm->wrapMovieFilename("tunaup", kStoneshipStack), 149, 161);
break;
case 1:
// Card 2247
- _vm->_video->playMovieBlocking(_vm->wrapMovieFilename("tunadown", kStoneshipStack), 218, 150);
+ _vm->playMovieBlocking(_vm->wrapMovieFilename("tunadown", kStoneshipStack), 218, 150);
break;
case 2:
// Card 2289
- _vm->_video->playMovieBlocking(_vm->wrapMovieFilename("tuncup", kStoneshipStack), 259, 161);
+ _vm->playMovieBlocking(_vm->wrapMovieFilename("tuncup", kStoneshipStack), 259, 161);
break;
case 3:
// Card 2285
- _vm->_video->playMovieBlocking(_vm->wrapMovieFilename("tuncdown", kStoneshipStack), 166, 150);
+ _vm->playMovieBlocking(_vm->wrapMovieFilename("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 6148472b1a..4aff5b59c8 100644
--- a/engines/mohawk/video.cpp
+++ b/engines/mohawk/video.cpp
@@ -166,76 +166,6 @@ void VideoManager::stopVideos() {
_videos.clear();
}
-void VideoManager::playMovieBlocking(const Common::String &fileName, uint16 x, uint16 y) {
- VideoEntryPtr ptr = open(fileName);
- if (!ptr)
- return;
-
- ptr->moveTo(x, y);
- ptr->start();
-
- waitUntilMovieEnds(ptr);
-}
-
-void VideoManager::playMovieBlockingCentered(const Common::String &fileName) {
- VideoEntryPtr ptr = open(fileName);
- if (!ptr)
- return;
-
- // Clear screen
- _vm->_system->fillScreen(_vm->_system->getScreenFormat().RGBToColor(0, 0, 0));
- _vm->_system->updateScreen();
-
- ptr->center();
- ptr->start();
- waitUntilMovieEnds(ptr);
-}
-
-void VideoManager::waitUntilMovieEnds(const VideoEntryPtr &video) {
- if (!video)
- return;
-
- // Sanity check
- if (video->isLooping())
- error("Called waitUntilMovieEnds() on a looping video");
-
- bool continuePlaying = true;
-
- while (!video->endOfVideo() && !_vm->shouldQuit() && continuePlaying) {
- if (updateMovies())
- _vm->_system->updateScreen();
-
- Common::Event event;
- while (_vm->_system->getEventManager()->pollEvent(event)) {
- switch (event.type) {
- case Common::EVENT_RTL:
- case Common::EVENT_QUIT:
- continuePlaying = false;
- break;
- case Common::EVENT_KEYDOWN:
- switch (event.kbd.keycode) {
- case Common::KEYCODE_SPACE:
- _vm->pauseGame();
- break;
- case Common::KEYCODE_ESCAPE:
- continuePlaying = false;
- break;
- default:
- break;
- }
- default:
- break;
- }
- }
-
- // Cut down on CPU usage
- _vm->_system->delayMillis(10);
- }
-
- // Ensure it's removed
- removeEntry(video);
-}
-
VideoEntryPtr VideoManager::playMovie(const Common::String &fileName) {
VideoEntryPtr ptr = open(fileName);
if (!ptr)
@@ -456,8 +386,8 @@ VideoManager::VideoList::iterator VideoManager::findEntry(VideoEntryPtr ptr) {
return Common::find(_videos.begin(), _videos.end(), ptr);
}
-void VideoManager::removeEntry(VideoEntryPtr ptr) {
- VideoManager::VideoList::iterator it = findEntry(ptr);
+void VideoManager::removeEntry(const VideoEntryPtr &video) {
+ VideoManager::VideoList::iterator it = findEntry(video);
if (it != _videos.end())
_videos.erase(it);
}
diff --git a/engines/mohawk/video.h b/engines/mohawk/video.h
index 20da42948c..07dc128641 100644
--- a/engines/mohawk/video.h
+++ b/engines/mohawk/video.h
@@ -240,8 +240,6 @@ public:
virtual ~VideoManager();
// Generic movie functions
- void playMovieBlocking(const Common::String &filename, uint16 x, uint16 y);
- void playMovieBlockingCentered(const Common::String &filename);
VideoEntryPtr playMovie(const Common::String &filename);
VideoEntryPtr playMovie(uint16 id);
bool updateMovies();
@@ -253,8 +251,8 @@ public:
// Handle functions
VideoEntryPtr findVideo(uint16 id);
VideoEntryPtr findVideo(const Common::String &fileName);
- void waitUntilMovieEnds(const VideoEntryPtr &video);
void drawVideoFrame(const VideoEntryPtr &video, const Audio::Timestamp &time);
+ void removeEntry(const VideoEntryPtr &video);
protected:
MohawkEngine *_vm;
@@ -268,7 +266,6 @@ protected:
VideoEntryPtr open(const Common::String &fileName);
VideoList::iterator findEntry(VideoEntryPtr ptr);
- void removeEntry(VideoEntryPtr ptr);
bool drawNextFrame(VideoEntryPtr videoEntry);