aboutsummaryrefslogtreecommitdiff
path: root/engines/mohawk
diff options
context:
space:
mode:
authorBastien Bouclet2011-01-08 12:34:41 +0000
committerBastien Bouclet2011-01-08 12:34:41 +0000
commit1a18e99e69962d3e7486571923d24e8fb6feb2c9 (patch)
tree8780f28376ba3153f25485faa432210e1528d2fc /engines/mohawk
parent12b44f2fc01b05c1fe1d34be8bc2556543967bca (diff)
downloadscummvm-rg350-1a18e99e69962d3e7486571923d24e8fb6feb2c9.tar.gz
scummvm-rg350-1a18e99e69962d3e7486571923d24e8fb6feb2c9.tar.bz2
scummvm-rg350-1a18e99e69962d3e7486571923d24e8fb6feb2c9.zip
MOHAWK: Changed Myst intro stack to behave like the original. ie fully skippable intro.
svn-id: r55164
Diffstat (limited to 'engines/mohawk')
-rw-r--r--engines/mohawk/myst.cpp35
-rw-r--r--engines/mohawk/myst.h1
-rw-r--r--engines/mohawk/myst_areas.cpp10
-rw-r--r--engines/mohawk/myst_areas.h1
-rw-r--r--engines/mohawk/myst_stacks/demo.cpp5
-rw-r--r--engines/mohawk/myst_stacks/demo.h1
-rw-r--r--engines/mohawk/myst_stacks/intro.cpp116
-rw-r--r--engines/mohawk/myst_stacks/intro.h12
8 files changed, 135 insertions, 46 deletions
diff --git a/engines/mohawk/myst.cpp b/engines/mohawk/myst.cpp
index 9b41997258..487180be22 100644
--- a/engines/mohawk/myst.cpp
+++ b/engines/mohawk/myst.cpp
@@ -292,7 +292,6 @@ Common::Error MohawkEngine_Myst::run() {
// Set the cursor
_cursor->setCursor(_currentCursor);
- _cursor->showCursor();
Common::Event event;
while (!shouldQuit()) {
@@ -371,6 +370,40 @@ Common::Error MohawkEngine_Myst::run() {
return Common::kNoError;
}
+bool MohawkEngine_Myst::skippableWait(uint32 duration) {
+ uint32 end = _system->getMillis() + duration;
+ bool skipped = false;
+
+ while (_system->getMillis() < end && !skipped) {
+ Common::Event event;
+ while (_system->getEventManager()->pollEvent(event)) {
+ switch (event.type) {
+ case Common::EVENT_LBUTTONUP:
+ skipped = true;
+ break;
+ case Common::EVENT_KEYDOWN:
+ switch (event.kbd.keycode) {
+ case Common::KEYCODE_SPACE:
+ pauseGame();
+ break;
+ case Common::KEYCODE_ESCAPE:
+ skipped = true;
+ break;
+ default:
+ break;
+ }
+ default:
+ break;
+ }
+ }
+
+ // Cut down on CPU usage
+ _system->delayMillis(10);
+ }
+
+ return skipped;
+}
+
void MohawkEngine_Myst::changeToStack(uint16 stack, uint16 card, uint16 linkSrcSound, uint16 linkDstSound) {
debug(2, "changeToStack(%d)", stack);
diff --git a/engines/mohawk/myst.h b/engines/mohawk/myst.h
index c4fe02088c..048f3fe5b7 100644
--- a/engines/mohawk/myst.h
+++ b/engines/mohawk/myst.h
@@ -162,6 +162,7 @@ public:
uint16 getMainCursor() { return _mainCursor; }
void checkCursorHints();
MystResource *updateCurrentResource();
+ bool skippableWait(uint32 duration);
MystVar *_varStore;
diff --git a/engines/mohawk/myst_areas.cpp b/engines/mohawk/myst_areas.cpp
index f83e2790db..7a65ecf701 100644
--- a/engines/mohawk/myst_areas.cpp
+++ b/engines/mohawk/myst_areas.cpp
@@ -216,6 +216,16 @@ void MystResourceType6::handleCardChange() {
playMovie();
}
+bool MystResourceType6::isPlaying() {
+ if (_videoRunning) {
+ VideoHandle handle = _vm->_video->findVideoHandle(0xFFFF);
+ if (handle != NULL_VID_HANDLE)
+ return !_vm->_video->endOfVideo(handle);
+ }
+
+ return false;
+}
+
MystResourceType7::MystResourceType7(MohawkEngine_Myst *vm, Common::SeekableReadStream *rlstStream, MystResource *parent) : MystResource(vm, rlstStream, parent) {
_var7 = rlstStream->readUint16LE();
_numSubResources = rlstStream->readUint16LE();
diff --git a/engines/mohawk/myst_areas.h b/engines/mohawk/myst_areas.h
index bb7a2a3d96..b7a12b0875 100644
--- a/engines/mohawk/myst_areas.h
+++ b/engines/mohawk/myst_areas.h
@@ -106,6 +106,7 @@ public:
MystResourceType6(MohawkEngine_Myst *vm, Common::SeekableReadStream *rlstStream, MystResource *parent);
void playMovie();
void handleCardChange();
+ bool isPlaying();
protected:
static Common::String convertMystVideoName(Common::String name);
diff --git a/engines/mohawk/myst_stacks/demo.cpp b/engines/mohawk/myst_stacks/demo.cpp
index bc8d489790..548a2d5390 100644
--- a/engines/mohawk/myst_stacks/demo.cpp
+++ b/engines/mohawk/myst_stacks/demo.cpp
@@ -49,6 +49,7 @@ MystScriptParser_Demo::~MystScriptParser_Demo() {
void MystScriptParser_Demo::setupOpcodes() {
// "Stack-Specific" Opcodes
+ OVERRIDE_OPCODE(100, opcode_100);
OPCODE(101, opcode_101);
OPCODE(102, opcode_102);
@@ -78,6 +79,10 @@ void MystScriptParser_Demo::runPersistentScripts() {
}
}
+void MystScriptParser_Demo::opcode_100(uint16 op, uint16 var, uint16 argc, uint16 *argv) {
+ // TODO: Fill in Function...
+}
+
void MystScriptParser_Demo::opcode_101(uint16 op, uint16 var, uint16 argc, uint16 *argv) {
varUnusedCheck(op, var);
diff --git a/engines/mohawk/myst_stacks/demo.h b/engines/mohawk/myst_stacks/demo.h
index c3dbeb2844..f693ea4c35 100644
--- a/engines/mohawk/myst_stacks/demo.h
+++ b/engines/mohawk/myst_stacks/demo.h
@@ -48,6 +48,7 @@ public:
private:
void setupOpcodes();
+ DECLARE_OPCODE(opcode_100);
DECLARE_OPCODE(opcode_101);
DECLARE_OPCODE(opcode_102);
diff --git a/engines/mohawk/myst_stacks/intro.cpp b/engines/mohawk/myst_stacks/intro.cpp
index 7733fd9f5a..139a4c6b38 100644
--- a/engines/mohawk/myst_stacks/intro.cpp
+++ b/engines/mohawk/myst_stacks/intro.cpp
@@ -50,18 +50,25 @@ void MystScriptParser_Intro::setupOpcodes() {
// "Init" Opcodes
OPCODE(200, o_playIntroMovies);
- OPCODE(201, opcode_201);
+ OPCODE(201, o_mystLinkBook_init);
// "Exit" Opcodes
- OPCODE(300, opcode_300);
+ OPCODE(300, NOP);
}
#undef OPCODE
void MystScriptParser_Intro::disablePersistentScripts() {
+ _introMoviesRunning = false;
+ _linkBookRunning = false;
}
void MystScriptParser_Intro::runPersistentScripts() {
+ if (_introMoviesRunning)
+ introMovies_run();
+
+ if (_linkBookRunning)
+ mystLinkBook_run();
}
uint16 MystScriptParser_Intro::getVar(uint16 var) {
@@ -89,54 +96,77 @@ void MystScriptParser_Intro::o_useLinkBook(uint16 op, uint16 var, uint16 argc, u
_vm->changeToStack(_stackMap[_globals.currentAge], _startCard[_globals.currentAge], soundIdLinkSrc, soundIdLinkDst[_globals.currentAge]);
}
-void MystScriptParser_Intro::o_playIntroMovies(uint16 op, uint16 var, uint16 argc, uint16 *argv) {
- varUnusedCheck(op, var);
-
- // TODO: Clicking during the intro movies does not stop them and change to Card 5.
- // This is due to the movies playing blocking, but making them non-blocking causes
- // the card change here to prevent them playing. Need to move the following to the
- // opcode_200_run process and wait for all movies to finish playing before the card
- // change is performed.
-
+void MystScriptParser_Intro::introMovies_run() {
// Play Intro Movies..
- if ((_vm->getFeatures() & GF_ME) && _vm->getPlatform() == Common::kPlatformMacintosh) {
- _vm->_video->playMovieCentered(_vm->wrapMovieFilename("mattel", kIntroStack));
- _vm->_video->playMovieCentered(_vm->wrapMovieFilename("presto", kIntroStack));
- } else
- _vm->_video->playMovieCentered(_vm->wrapMovieFilename("broder", kIntroStack));
-
- _vm->_video->playMovieCentered(_vm->wrapMovieFilename("cyanlogo", kIntroStack));
-
- if (!(_vm->getFeatures() & GF_DEMO)) { // The demo doesn't have the intro video
- if ((_vm->getFeatures() & GF_ME) && _vm->getPlatform() == Common::kPlatformMacintosh)
- // intro.mov uses Sorenson, introc uses Cinepak. Otherwise, they're the same.
- _vm->_video->playMovieCentered(_vm->wrapMovieFilename("introc", kIntroStack));
- else
- _vm->_video->playMovieCentered(_vm->wrapMovieFilename("intro", kIntroStack));
+ if (_introStep == 0) {
+ _introStep = 1;
+
+ if ((_vm->getFeatures() & GF_ME) && _vm->getPlatform() == Common::kPlatformMacintosh) {
+ _vm->_video->playBackgroundMovie(_vm->wrapMovieFilename("mattel", kIntroStack));
+ _vm->_video->playBackgroundMovie(_vm->wrapMovieFilename("presto", kIntroStack));
+ } else
+ _vm->_video->playBackgroundMovie(_vm->wrapMovieFilename("broder", kIntroStack));
+ } else if (_introStep == 1) {
+ VideoHandle handle = _vm->_video->findVideoHandle(0xFFFF);
+ if (handle == NULL_VID_HANDLE || _vm->_video->endOfVideo(handle))
+ _introStep = 2;
+ } else if (_introStep == 2) {
+ _introStep = 3;
+
+ _vm->_video->playBackgroundMovie(_vm->wrapMovieFilename("cyanlogo", kIntroStack));
+ } else if (_introStep == 3) {
+ VideoHandle handle = _vm->_video->findVideoHandle(0xFFFF);
+ if (handle == NULL_VID_HANDLE || _vm->_video->endOfVideo(handle))
+ _introStep = 4;
+ } else if (_introStep == 4) {
+ _introStep = 5;
+
+ if (!(_vm->getFeatures() & GF_DEMO)) { // The demo doesn't have the intro video
+ if ((_vm->getFeatures() & GF_ME) && _vm->getPlatform() == Common::kPlatformMacintosh)
+ // intro.mov uses Sorenson, introc uses Cinepak. Otherwise, they're the same.
+ _vm->_video->playBackgroundMovie(_vm->wrapMovieFilename("introc", kIntroStack));
+ else
+ _vm->_video->playBackgroundMovie(_vm->wrapMovieFilename("intro", kIntroStack));
+ }
+ } else if (_introStep == 5) {
+ VideoHandle handle = _vm->_video->findVideoHandle(0xFFFF);
+ if (handle == NULL_VID_HANDLE || _vm->_video->endOfVideo(handle))
+ _introStep = 6;
+ } else {
+ if (_vm->getFeatures() & GF_DEMO) {
+ _vm->changeToCard(2001, true);
+ } else {
+ _vm->changeToCard(2, true);
+ }
}
-
- _vm->changeToCard(2, true);
}
-void MystScriptParser_Intro::opcode_201(uint16 op, uint16 var, uint16 argc, uint16 *argv) {
- varUnusedCheck(op, var);
-
- _vm->_gfx->copyBackBufferToScreen(Common::Rect(544, 333));
- _vm->_system->updateScreen();
- _vm->_system->delayMillis(4 * 1000);
- _vm->_gfx->copyImageToBackBuffer(4, Common::Rect(544, 333));
- _vm->_gfx->copyBackBufferToScreen(Common::Rect(544, 333));
- _vm->_system->updateScreen();
+void MystScriptParser_Intro::o_playIntroMovies(uint16 op, uint16 var, uint16 argc, uint16 *argv) {
+ _introMoviesRunning = true;
+ _introStep = 0;
+}
- MystResourceType6 *resource = static_cast<MystResourceType6 *>(_invokingResource);
- resource->playMovie();
- // TODO: Complete / Fix
+void MystScriptParser_Intro::mystLinkBook_run() {
+ if (_startTime == 1) {
+ _startTime = 0;
+
+ if (!_vm->skippableWait(5000)) {
+ _linkBookMovie->playMovie();
+ _vm->_gfx->copyImageToBackBuffer(4, Common::Rect(544, 333));
+ _vm->_gfx->copyBackBufferToScreen(Common::Rect(544, 333));
+ }
+ } else {
+ if (!_linkBookMovie->isPlaying())
+ _vm->changeToCard(5, true);
+ }
}
-void MystScriptParser_Intro::opcode_300(uint16 op, uint16 var, uint16 argc, uint16 *argv) {
- varUnusedCheck(op, var);
- // In the original engine, this opcode stopped Intro Movies if playing,
- // upon card change, but this behavior is now default in this engine.
+void MystScriptParser_Intro::o_mystLinkBook_init(uint16 op, uint16 var, uint16 argc, uint16 *argv) {
+ debugC(kDebugScript, "Opcode %d: Myst link book init", op);
+
+ _linkBookMovie = static_cast<MystResourceType6 *>(_invokingResource);
+ _startTime = 1;
+ _linkBookRunning = true;
}
} // End of namespace Mohawk
diff --git a/engines/mohawk/myst_stacks/intro.h b/engines/mohawk/myst_stacks/intro.h
index fc2ae5e1e7..a40d268d7d 100644
--- a/engines/mohawk/myst_stacks/intro.h
+++ b/engines/mohawk/myst_stacks/intro.h
@@ -35,6 +35,7 @@ namespace Mohawk {
#define DECLARE_OPCODE(x) void x(uint16 op, uint16 var, uint16 argc, uint16 *argv)
class MohawkEngine_Myst;
+class MystResourceType6;
struct MystScriptEntry;
class MystScriptParser_Intro : public MystScriptParser {
@@ -52,9 +53,16 @@ private:
DECLARE_OPCODE(o_useLinkBook);
DECLARE_OPCODE(o_playIntroMovies);
- DECLARE_OPCODE(opcode_201);
+ DECLARE_OPCODE(o_mystLinkBook_init);
- DECLARE_OPCODE(opcode_300);
+ void introMovies_run();
+ void mystLinkBook_run();
+
+ bool _introMoviesRunning;
+ uint16 _introStep;
+
+ bool _linkBookRunning;
+ MystResourceType6 *_linkBookMovie;
};
} // End of namespace Mohawk