diff options
author | Bastien Bouclet | 2011-01-14 21:42:33 +0000 |
---|---|---|
committer | Bastien Bouclet | 2011-01-14 21:42:33 +0000 |
commit | aa38ad519ce331170e2f74a13feb12e5bd2c15d1 (patch) | |
tree | 2b0cbf72605aa20041159eee2e14c942f60672b5 /engines/mohawk | |
parent | ca249f5c65b39f440fe6cea3916022c7b4c47e48 (diff) | |
download | scummvm-rg350-aa38ad519ce331170e2f74a13feb12e5bd2c15d1.tar.gz scummvm-rg350-aa38ad519ce331170e2f74a13feb12e5bd2c15d1.tar.bz2 scummvm-rg350-aa38ad519ce331170e2f74a13feb12e5bd2c15d1.zip |
MOHAWK: Implement Atrus videos in D'ni
svn-id: r55245
Diffstat (limited to 'engines/mohawk')
-rw-r--r-- | engines/mohawk/myst_stacks/dni.cpp | 104 | ||||
-rw-r--r-- | engines/mohawk/myst_stacks/dni.h | 11 |
2 files changed, 85 insertions, 30 deletions
diff --git a/engines/mohawk/myst_stacks/dni.cpp b/engines/mohawk/myst_stacks/dni.cpp index eb5d2a63c6..b6becff793 100644 --- a/engines/mohawk/myst_stacks/dni.cpp +++ b/engines/mohawk/myst_stacks/dni.cpp @@ -46,25 +46,33 @@ MystScriptParser_Dni::~MystScriptParser_Dni() { void MystScriptParser_Dni::setupOpcodes() { // "Stack-Specific" Opcodes - OPCODE(100, opcode_100); + OPCODE(100, NOP); OPCODE(101, o_handPage); // "Init" Opcodes OPCODE(200, o_atrus_init); // "Exit" Opcodes - OPCODE(300, opcode_300); + OPCODE(300, NOP); } #undef OPCODE void MystScriptParser_Dni::disablePersistentScripts() { _atrusRunning = false; + _waitForLoop = false; + _atrusLeft = false; } void MystScriptParser_Dni::runPersistentScripts() { if (_atrusRunning) atrus_run(); + + if (_waitForLoop) + loopVideo_run(); + + if (_atrusLeft) + atrusLeft_run(); } uint16 MystScriptParser_Dni::getVar(uint16 var) { @@ -87,46 +95,93 @@ uint16 MystScriptParser_Dni::getVar(uint16 var) { } } -void MystScriptParser_Dni::opcode_100(uint16 op, uint16 var, uint16 argc, uint16 *argv) { - // Used in Card 5014 (Atrus) - debugC(kDebugScript, "Opcode %d: Stop persistent scripts", op); - // TODO: Stop persistent scripts -} - void MystScriptParser_Dni::o_handPage(uint16 op, uint16 var, uint16 argc, uint16 *argv) { debugC(kDebugScript, "Opcode %d: Hand page to Atrus", op); // Used in Card 5014 (Atrus) - if (_globals.ending == 1) { + + // Find Atrus movie + VideoHandle atrus = _vm->_video->findVideoHandle(_video); + + // Good ending and Atrus asked to give page + if (_globals.ending == 1 && _vm->_video->getElapsedTime(atrus) > Graphics::VideoTimestamp(6801, 600).getUnitsInScale(1000)) { _globals.ending = 2; _globals.heldPage = 0; _vm->_cursor->setCursor(kDefaultMystCursor); - // TODO: Complete, play movie end + // Play movie end (atrus leaving) + _vm->_video->setVideoBounds(atrus, Graphics::VideoTimestamp(14813, 600), Graphics::VideoTimestamp(0xFFFFFFFF)); + _vm->_video->setVideoLooping(atrus, false); + + _atrusLeft = true; + _waitForLoop = false; + _atrusLeftTime = _vm->_system->getMillis(); + } +} + +void MystScriptParser_Dni::atrusLeft_run() { + if (_vm->_system->getMillis() > _atrusLeftTime + 63333) { + _video = _vm->wrapMovieFilename("atrus2", kDniStack); + VideoHandle atrus = _vm->_video->playBackgroundMovie(_video, 215, 77); + _vm->_video->setVideoBounds(atrus, Graphics::VideoTimestamp(0, 600), Graphics::VideoTimestamp(98000, 600)); + + _waitForLoop = true; + _loopStart = 73095; + _loopEnd = 98000; + + // Good ending + _globals.ending = 4; + _globals.bluePagesInBook = 63; + _globals.redPagesInBook = 63; + + _atrusLeft = false; + } +} + +void MystScriptParser_Dni::loopVideo_run() { + if (!_vm->_video->isVideoPlaying()) { + VideoHandle atrus = _vm->_video->playBackgroundMovie(_video, 215, 77); + _vm->_video->setVideoBounds(atrus, Graphics::VideoTimestamp(_loopStart, 600), Graphics::VideoTimestamp(_loopEnd, 600)); + _vm->_video->setVideoLooping(atrus, true); + + _waitForLoop = false; } } void MystScriptParser_Dni::atrus_run() { if (_globals.ending == 2) { + // Wait for atrus to come back + _atrusLeft = true; + } else if (_globals.ending == 1) { + // Atrus asking for page if (!_vm->_video->isVideoPlaying()) { - _vm->_video->playBackgroundMovie(_vm->wrapMovieFilename("atrus2", kDniStack), 215, 77); - _globals.ending = 4; - _globals.bluePagesInBook = 63; - _globals.redPagesInBook = 63; + _video = _vm->wrapMovieFilename("atr1page", kDniStack); + VideoHandle atrus = _vm->_video->playBackgroundMovie(_video, 215, 77, true); + _vm->_video->setVideoBounds(atrus, Graphics::VideoTimestamp(7388, 600), Graphics::VideoTimestamp(14700, 600)); } - // TODO: Complete/fix - } else if (_globals.ending == 1) { - // TODO: Complete, loop atr1page end } else if (_globals.ending != 3 && _globals.ending != 4) { if (_globals.heldPage == 13) { - _vm->_video->playBackgroundMovie(_vm->wrapMovieFilename("atr1page", kDniStack), 215, 77); + _video = _vm->wrapMovieFilename("atr1page", kDniStack); + VideoHandle atrus = _vm->_video->playBackgroundMovie(_video, 215, 77); + _vm->_video->setVideoBounds(atrus, Graphics::VideoTimestamp(0, 600), Graphics::VideoTimestamp(14700, 600)); + + _waitForLoop = true; + _loopStart = 7388; + _loopEnd = 14700; + + // Wait for page _globals.ending = 1; - // TODO: Complete, movie control/looping } else { - _vm->_video->playBackgroundMovie(_vm->wrapMovieFilename("atr1nopg", kDniStack), 215, 77); - _globals.ending = 3; + _video = _vm->wrapMovieFilename("atr1nopg", kDniStack); + VideoHandle atrus = _vm->_video->playBackgroundMovie(_video, 215, 77); + _vm->_video->setVideoBounds(atrus, Graphics::VideoTimestamp(0, 600), Graphics::VideoTimestamp(46175, 600)); + + _waitForLoop = true; + _loopStart = 30656; + _loopEnd = 46175; - // TODO: Complete, movie control/looping + // Bad ending + _globals.ending = 3; } } else if (!_vm->_video->isVideoPlaying()) { _vm->_video->playBackgroundMovie(_vm->wrapMovieFilename("atrwrite", kDniStack), 215, 77, true); @@ -139,9 +194,4 @@ void MystScriptParser_Dni::o_atrus_init(uint16 op, uint16 var, uint16 argc, uint _atrusRunning = true; } -void MystScriptParser_Dni::opcode_300(uint16 op, uint16 var, uint16 argc, uint16 *argv) { - // Used in Card 5014 (Atrus Writing) - // TODO: Stop persistent scripts -} - } // End of namespace Mohawk diff --git a/engines/mohawk/myst_stacks/dni.h b/engines/mohawk/myst_stacks/dni.h index 653e52037c..85900ad562 100644 --- a/engines/mohawk/myst_stacks/dni.h +++ b/engines/mohawk/myst_stacks/dni.h @@ -50,16 +50,21 @@ private: uint16 getVar(uint16 var); void atrus_run(); + void loopVideo_run(); + void atrusLeft_run(); - DECLARE_OPCODE(opcode_100); DECLARE_OPCODE(o_handPage); DECLARE_OPCODE(o_atrus_init); - DECLARE_OPCODE(opcode_300); - bool _atrusRunning; bool _notSeenAtrus; // 56 + uint32 _atrusLeftTime; // 60 + Common::String _video; // 64 + bool _waitForLoop; + uint32 _loopStart; // 72 + uint32 _loopEnd; // 76 + bool _atrusLeft; // 80 }; } // End of namespace Mohawk |