aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
Diffstat (limited to 'engines')
-rw-r--r--engines/mohawk/console.cpp9
-rw-r--r--engines/mohawk/myst.cpp70
-rw-r--r--engines/mohawk/myst.h2
-rw-r--r--engines/mohawk/myst_scripts.cpp72
-rw-r--r--engines/mohawk/myst_stacks/intro.cpp68
-rw-r--r--engines/mohawk/myst_stacks/slides.cpp4
-rw-r--r--engines/mohawk/myst_state.cpp7
7 files changed, 95 insertions, 137 deletions
diff --git a/engines/mohawk/console.cpp b/engines/mohawk/console.cpp
index bf1d9b02ce..d5170b2813 100644
--- a/engines/mohawk/console.cpp
+++ b/engines/mohawk/console.cpp
@@ -152,12 +152,13 @@ bool MystConsole::Cmd_ChangeStack(int argc, const char **argv) {
// as the next card could continue playing it if it.
_vm->_sound->stopSound();
- _vm->changeToStack(stackNum - 1);
-
+ uint16 card = 0;
if (argc == 3)
- _vm->changeToCard((uint16)atoi(argv[2]), true);
+ card = (uint16)atoi(argv[2]);
else
- _vm->changeToCard(default_start_card[stackNum - 1], true);
+ card = default_start_card[stackNum - 1];
+
+ _vm->changeToStack(stackNum - 1, card, 0, 0);
return false;
}
diff --git a/engines/mohawk/myst.cpp b/engines/mohawk/myst.cpp
index b4d035bdfb..9b41997258 100644
--- a/engines/mohawk/myst.cpp
+++ b/engines/mohawk/myst.cpp
@@ -272,16 +272,11 @@ Common::Error MohawkEngine_Myst::run() {
} else {
// Start us on the first stack.
if (getGameType() == GType_MAKINGOF)
- changeToStack(kMakingOfStack);
+ changeToStack(kMakingOfStack, 1, 0, 0);
else if (getFeatures() & GF_DEMO)
- changeToStack(kDemoStack);
+ changeToStack(kDemoStack, 2000, 0, 0);
else
- changeToStack(kIntroStack);
-
- if (getFeatures() & GF_DEMO)
- changeToCard(2000, true);
- else
- changeToCard(1, true);
+ changeToStack(kIntroStack, 1, 0, 0);
}
// Load Help System (Masterpiece Edition Only)
@@ -376,11 +371,16 @@ Common::Error MohawkEngine_Myst::run() {
return Common::kNoError;
}
-void MohawkEngine_Myst::changeToStack(uint16 stack) {
+void MohawkEngine_Myst::changeToStack(uint16 stack, uint16 card, uint16 linkSrcSound, uint16 linkDstSound) {
debug(2, "changeToStack(%d)", stack);
_curStack = stack;
+ _sound->stopSound();
+ _sound->stopBackground();
+ if (linkSrcSound)
+ _sound->playSoundBlocking(linkSrcSound);
+
// Delete the previous stack and move the current stack to the previous one
// There's probably a better way to do this, but the script classes shouldn't
// take up much memory.
@@ -454,7 +454,57 @@ void MohawkEngine_Myst::changeToStack(uint16 stack) {
// Clear the resource cache and the image cache
_cache.clear();
_gfx->clearCache();
- _sound->stopBackground();
+
+ // Play Flyby Entry Movie on Masterpiece Edition. The Macintosh version is currently hooked
+ // up to the Cinepak versions of the video (the 'c' suffix) until the SVQ1 decoder is completed.
+ const char *flyby = 0;
+ if (getFeatures() & GF_ME) {
+ switch (_curStack) {
+ case kSeleniticStack:
+ if (getPlatform() == Common::kPlatformMacintosh)
+ flyby = "FLY_SEc";
+ else
+ flyby = "selenitic flyby";
+ break;
+ case kStoneshipStack:
+ if (getPlatform() == Common::kPlatformMacintosh)
+ flyby = "FLY_STc";
+ else
+ flyby = "stoneship flyby";
+ break;
+ // Myst Flyby Movie not used in Original Masterpiece Edition Engine
+ case kMystStack:
+ if (_tweaksEnabled) {
+ if (getPlatform() == Common::kPlatformMacintosh)
+ flyby = "FLY_MYc";
+ else
+ flyby = "myst flyby";
+ }
+ break;
+ case kMechanicalStack:
+ if (getPlatform() == Common::kPlatformMacintosh)
+ flyby = "FLY_MEc";
+ else
+ flyby = "mech age flyby";
+ break;
+ case kChannelwoodStack:
+ if (getPlatform() == Common::kPlatformMacintosh)
+ flyby = "FLY_CHc";
+ else
+ flyby = "channelwood flyby";
+ break;
+ default:
+ break;
+ }
+
+ if (flyby)
+ _video->playMovieCentered(wrapMovieFilename(flyby, kMasterpieceOnly));
+ }
+
+ changeToCard(card, true);
+
+ if (linkDstSound)
+ _sound->playSoundBlocking(linkDstSound);
}
uint16 MohawkEngine_Myst::getCardBackgroundId() {
diff --git a/engines/mohawk/myst.h b/engines/mohawk/myst.h
index 082aacab59..c4fe02088c 100644
--- a/engines/mohawk/myst.h
+++ b/engines/mohawk/myst.h
@@ -154,7 +154,7 @@ public:
void runLoadDialog();
void runSaveDialog();
- void changeToStack(uint16 stack);
+ void changeToStack(uint16 stack, uint16 card, uint16 linkSrcSound, uint16 linkDstSound);
void changeToCard(uint16 card, bool updateScreen);
uint16 getCurCard() { return _curCard; }
uint16 getCurStack() { return _curStack; }
diff --git a/engines/mohawk/myst_scripts.cpp b/engines/mohawk/myst_scripts.cpp
index 7e481c9c1a..645eafdec5 100644
--- a/engines/mohawk/myst_scripts.cpp
+++ b/engines/mohawk/myst_scripts.cpp
@@ -203,7 +203,7 @@ MystScript MystScriptParser::readScript(Common::SeekableReadStream *stream, Myst
MystScriptEntry &entry = script->operator[](i);
entry.type = type;
- // u0 only exists in INIT and EXIT scripts
+ // Resource ID only exists in INIT and EXIT scripts
if (type != kMystScriptNormal)
entry.resourceId = stream->readUint16LE();
@@ -827,63 +827,27 @@ void MystScriptParser::o_delay(uint16 op, uint16 var, uint16 argc, uint16 *argv)
}
void MystScriptParser::o_changeStack(uint16 op, uint16 var, uint16 argc, uint16 *argv) {
- Audio::SoundHandle *handle;
- varUnusedCheck(op, var);
-
- if (argc == 3) {
- debugC(kDebugScript, "Opcode %d: changeStack", op);
-
- uint16 targetStack = argv[0];
- uint16 soundIdLinkSrc = argv[1];
- uint16 soundIdLinkDst = argv[2];
-
- debugC(kDebugScript, "\tTarget Stack: %d", targetStack);
- debugC(kDebugScript, "\tSource Stack Link Sound: %d", soundIdLinkSrc);
- debugC(kDebugScript, "\tDestination Stack Link Sound: %d", soundIdLinkDst);
-
- _vm->_sound->stopSound();
-
- if (_vm->getFeatures() & GF_DEMO) {
-
- // The demo has linking sounds too for this, but it just sounds completely
- // wrong as you're not actually linking when using this opcode. The sounds are only
- // played for the full game linking.
- if (!_vm->_tweaksEnabled) {
- handle= _vm->_sound->replaceSound(soundIdLinkSrc);
- while (_vm->_mixer->isSoundHandleActive(*handle))
- _vm->_system->delayMillis(10);
- }
+ debugC(kDebugScript, "Opcode %d: changeStack", op);
- // No need to have a table for just this data...
- if (targetStack == 1) {
- _vm->changeToStack(kDemoSlidesStack);
- _vm->changeToCard(1000, true);
- } else if (targetStack == 2) {
- _vm->changeToStack(kDemoPreviewStack);
- _vm->changeToCard(3000, true);
- }
+ uint16 targetStack = argv[0];
+ uint16 soundIdLinkSrc = argv[1];
+ uint16 soundIdLinkDst = argv[2];
- if (!_vm->_tweaksEnabled) {
- handle = _vm->_sound->replaceSound(soundIdLinkDst);
- while (_vm->_mixer->isSoundHandleActive(*handle))
- _vm->_system->delayMillis(10);
- }
- } else {
- handle = _vm->_sound->replaceSound(soundIdLinkSrc);
- while (_vm->_mixer->isSoundHandleActive(*handle))
- _vm->_system->delayMillis(10);
+ debugC(kDebugScript, "\tTarget Stack: %d", targetStack);
+ debugC(kDebugScript, "\tSource Stack Link Sound: %d", soundIdLinkSrc);
+ debugC(kDebugScript, "\tDestination Stack Link Sound: %d", soundIdLinkDst);
- // TODO: Play Flyby Entry Movie on Masterpiece Edition..? Only on Myst to Age Link?
+ _vm->_sound->stopSound();
- _vm->changeToStack(_stackMap[targetStack]);
- _vm->changeToCard(_startCard[targetStack], true);
-
- handle = _vm->_sound->replaceSound(soundIdLinkDst);
- while (_vm->_mixer->isSoundHandleActive(*handle))
- _vm->_system->delayMillis(10);
- }
- } else
- unknown(op, var, argc, argv);
+ if (_vm->getFeatures() & GF_DEMO) {
+ // No need to have a table for just this data...
+ if (targetStack == 1)
+ _vm->changeToStack(kDemoSlidesStack, 1000, soundIdLinkSrc, soundIdLinkDst);
+ else if (targetStack == 2)
+ _vm->changeToStack(kDemoPreviewStack, 3000, soundIdLinkSrc, soundIdLinkDst);
+ } else {
+ _vm->changeToStack(_stackMap[targetStack], _startCard[targetStack], soundIdLinkSrc, soundIdLinkDst);
+ }
}
void MystScriptParser::o_changeCardPlaySoundDirectional(uint16 op, uint16 var, uint16 argc, uint16 *argv) {
diff --git a/engines/mohawk/myst_stacks/intro.cpp b/engines/mohawk/myst_stacks/intro.cpp
index a8b30492e4..7733fd9f5a 100644
--- a/engines/mohawk/myst_stacks/intro.cpp
+++ b/engines/mohawk/myst_stacks/intro.cpp
@@ -67,7 +67,10 @@ void MystScriptParser_Intro::runPersistentScripts() {
uint16 MystScriptParser_Intro::getVar(uint16 var) {
switch(var) {
case 0:
- return _vm->_gameState->_globals.currentAge;
+ if (_globals.currentAge == 9 || _globals.currentAge == 10)
+ return 2;
+ else
+ return _globals.currentAge;
default:
return MystScriptParser::getVar(var);
}
@@ -77,68 +80,13 @@ void MystScriptParser_Intro::o_useLinkBook(uint16 op, uint16 var, uint16 argc, u
// Hard coded SoundId valid only for Intro Stack.
// Other stacks use Opcode 40, which takes SoundId values as arguments.
const uint16 soundIdLinkSrc = 5;
+ const uint16 soundIdLinkDst[] = { 2282, 3029, 6396, 7122, 3137, 0, 9038, 5134, 0, 4739, 4741 };
debugC(kDebugScript, "Opcode %d: o_useLinkBook", op);
debugC(kDebugScript, "\tvar: %d", var);
- // TODO: Merge with changeStack (Opcode 40) Implementation?
- if (getVar(var) == 5 || getVar(var) > 7) {
- // TODO: Dead Book i.e. Released Sirrus/Achenar
- } else {
- // Play Linking Sound, blocking...
- _vm->_sound->stopSound();
- Audio::SoundHandle *handle = _vm->_sound->replaceSound(soundIdLinkSrc);
- while (_vm->_mixer->isSoundHandleActive(*handle))
- _vm->_system->delayMillis(10);
-
- // Play Flyby Entry Movie on Masterpiece Edition. The Macintosh version is currently hooked
- // up to the Cinepak versions of the video (the 'c' suffix) until the SVQ1 decoder is completed.
- if ((_vm->getFeatures() & GF_ME)) {
- switch (_stackMap[getVar(var)]) {
- case kSeleniticStack:
- if (_vm->getPlatform() == Common::kPlatformMacintosh)
- _vm->_video->playMovieCentered(_vm->wrapMovieFilename("FLY_SEc", kMasterpieceOnly));
- else
- _vm->_video->playMovieCentered(_vm->wrapMovieFilename("selenitic flyby", kMasterpieceOnly));
- break;
- case kStoneshipStack:
- if (_vm->getPlatform() == Common::kPlatformMacintosh)
- _vm->_video->playMovieCentered(_vm->wrapMovieFilename("FLY_STc", kMasterpieceOnly));
- else
- _vm->_video->playMovieCentered(_vm->wrapMovieFilename("stoneship flyby", kMasterpieceOnly));
- break;
- // Myst Flyby Movie not used in Original Masterpiece Edition Engine
- case kMystStack:
- if (_vm->_tweaksEnabled) {
- if (_vm->getPlatform() == Common::kPlatformMacintosh)
- _vm->_video->playMovieCentered(_vm->wrapMovieFilename("FLY_MYc", kMasterpieceOnly));
- else
- _vm->_video->playMovieCentered(_vm->wrapMovieFilename("myst flyby", kMasterpieceOnly));
- }
- break;
- case kMechanicalStack:
- if (_vm->getPlatform() == Common::kPlatformMacintosh)
- _vm->_video->playMovieCentered(_vm->wrapMovieFilename("FLY_MEc", kMasterpieceOnly));
- else
- _vm->_video->playMovieCentered(_vm->wrapMovieFilename("mech age flyby", kMasterpieceOnly));
- break;
- case kChannelwoodStack:
- if (_vm->getPlatform() == Common::kPlatformMacintosh)
- _vm->_video->playMovieCentered(_vm->wrapMovieFilename("FLY_CHc", kMasterpieceOnly));
- else
- _vm->_video->playMovieCentered(_vm->wrapMovieFilename("channelwood flyby", kMasterpieceOnly));
- break;
- default:
- break;
- }
- }
-
- uint16 varValue = getVar(var);
- _vm->changeToStack(_stackMap[varValue]);
- _vm->changeToCard(_startCard[varValue], true);
-
- // TODO: No soundIdLinkDst for Opcode 100 link? Check Original.
- }
+ // Change to dest stack
+ _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) {
@@ -167,7 +115,7 @@ void MystScriptParser_Intro::o_playIntroMovies(uint16 op, uint16 var, uint16 arg
_vm->_video->playMovieCentered(_vm->wrapMovieFilename("intro", kIntroStack));
}
- _vm->changeToCard(_vm->getCurCard() + 1, true);
+ _vm->changeToCard(2, true);
}
void MystScriptParser_Intro::opcode_201(uint16 op, uint16 var, uint16 argc, uint16 *argv) {
diff --git a/engines/mohawk/myst_stacks/slides.cpp b/engines/mohawk/myst_stacks/slides.cpp
index cdc0db1560..128505d266 100644
--- a/engines/mohawk/myst_stacks/slides.cpp
+++ b/engines/mohawk/myst_stacks/slides.cpp
@@ -68,9 +68,7 @@ void MystScriptParser_Slides::runPersistentScripts() {
}
void MystScriptParser_Slides::o_returnToMenu(uint16 op, uint16 var, uint16 argc, uint16 *argv) {
- // TODO: Change to changeStack call?
- _vm->changeToStack(kDemoStack);
- _vm->changeToCard(2001, true);
+ _vm->changeToStack(kDemoStack, 2001, 0, 0);
}
void MystScriptParser_Slides::o_setCardSwap(uint16 op, uint16 var, uint16 argc, uint16 *argv) {
diff --git a/engines/mohawk/myst_state.cpp b/engines/mohawk/myst_state.cpp
index e5522ac72b..8b845b3952 100644
--- a/engines/mohawk/myst_state.cpp
+++ b/engines/mohawk/myst_state.cpp
@@ -97,9 +97,6 @@ bool MystGameState::load(const Common::String &filename) {
syncGameState(s, size == 664);
delete loadFile;
- // Switch us back to the intro stack
- _vm->changeToStack(kIntroStack);
-
// Set our default cursor
if (_globals.heldPage == 0 || _globals.heldPage > 13)
_vm->setMainCursor(kDefaultMystCursor);
@@ -110,8 +107,8 @@ bool MystGameState::load(const Common::String &filename) {
else // if (globals.heldPage == 13)
_vm->setMainCursor(kWhitePageCursor);
- // Set us to the linking book
- _vm->changeToCard(5, true);
+ // Switch us back to the intro stack, to the linking book
+ _vm->changeToStack(kIntroStack, 5, 0, 0);
return true;
}