diff options
author | Strangerke | 2012-04-11 18:23:17 +0200 |
---|---|---|
committer | Eugene Sandulenko | 2018-03-28 17:36:57 +0200 |
commit | 9074e59fef9eabb67099bc1b6977240558a19237 (patch) | |
tree | c6bdf38d0b9f3c77a5111846022457a99ae46e34 | |
parent | 58dc875b2eecc2ba0482951c7c4a0df0102e7717 (diff) | |
download | scummvm-rg350-9074e59fef9eabb67099bc1b6977240558a19237.tar.gz scummvm-rg350-9074e59fef9eabb67099bc1b6977240558a19237.tar.bz2 scummvm-rg350-9074e59fef9eabb67099bc1b6977240558a19237.zip |
LILLIPUT: Implement opcodes used by game scripts 3 and 4
-rw-r--r-- | engines/lilliput/lilliput.cpp | 10 | ||||
-rw-r--r-- | engines/lilliput/lilliput.h | 2 | ||||
-rw-r--r-- | engines/lilliput/script.cpp | 68 | ||||
-rw-r--r-- | engines/lilliput/script.h | 18 |
4 files changed, 75 insertions, 23 deletions
diff --git a/engines/lilliput/lilliput.cpp b/engines/lilliput/lilliput.cpp index 5465086363..efd5f38dac 100644 --- a/engines/lilliput/lilliput.cpp +++ b/engines/lilliput/lilliput.cpp @@ -139,6 +139,7 @@ LilliputEngine::LilliputEngine(OSystem *syst, const LilliputGameDescription *gd) _array11D49[i] = 0xFFFF; } + _ptr_rulesBuffer2_15 = NULL; } LilliputEngine::~LilliputEngine() { @@ -501,8 +502,9 @@ void LilliputEngine::handleMenu() { _byte16F07_menuId = 0; } -void LilliputEngine::sub17083() { - warning("sub17083"); +void LilliputEngine::handleGameScripts() { + debugC(1, kDebugEngine, "handleGameScripts()"); + int index = _word17081_nextIndex; int i; for (i = 0; (_scriptHandler->_array10B29[index] == 0) && (i < _word10807_ERULES); i++) { @@ -531,6 +533,8 @@ void LilliputEngine::sub17083() { return; assert(tmpVal < _gameScriptIndexSize); + warning("========================== Game Script %d ==============================", tmpVal); + _scriptHandler->runScript(Common::MemoryReadStream(&_arrayGameScripts[_arrayGameScriptIndex[tmpVal]], _arrayGameScriptIndex[tmpVal + 1] - _arrayGameScriptIndex[tmpVal])); } @@ -562,7 +566,7 @@ Common::Error LilliputEngine::run() { while(!_shouldQuit) { handleMenu(); - sub17083(); + handleGameScripts(); // To be removed when handled in the previous fonctions pollEvent(); } diff --git a/engines/lilliput/lilliput.h b/engines/lilliput/lilliput.h index 0280f6762d..b59b98a445 100644 --- a/engines/lilliput/lilliput.h +++ b/engines/lilliput/lilliput.h @@ -193,7 +193,7 @@ public: void pollEvent(); void sub170EE(int index); void sub130DD(); - void sub17083(); + void handleGameScripts(); // Temporary stubs byte _keyboard_getch(); diff --git a/engines/lilliput/script.cpp b/engines/lilliput/script.cpp index 2a971a0d35..10502b64c5 100644 --- a/engines/lilliput/script.cpp +++ b/engines/lilliput/script.cpp @@ -893,13 +893,26 @@ byte LilliputScript::OC_sub1779E() { return 0; } byte LilliputScript::OC_sub177C6() { - warning("OC_sub177C6"); - return 0; + debugC(1, kDebugScript, "OC_sub177C6()"); + + int index = _currScript->readUint16LE(); + if (_vm->_rulesBuffer2_1[index] == 0xFFFF) + return 0; + + return 1; } byte LilliputScript::OC_compWord16EFE() { - warning("OC_compWord16EFE"); - return 0; + debugC(1, kDebugScript, "OC_compWord16EFE()"); + byte curByte = _currScript->readUint16LE() & 0xFF; + byte tmpVal = _vm->_word16EFE >> 8; + + if (curByte != tmpVal) + return 0; + + _word16F00 = (_vm->_word16EFE & 0xFF); + return 1; } + byte LilliputScript::OC_sub177F5() { warning("OC_sub177F5"); return 0; @@ -942,7 +955,11 @@ byte LilliputScript::OC_sub178BA() { return 0; } byte LilliputScript::OC_sub178C2() { - warning("OC_sub178C2"); + debugC(1, kDebugScript, "OC_sub178C2()"); + + assert(_vm->_ptr_rulesBuffer2_15 != NULL); + if (_vm->_ptr_rulesBuffer2_15[2] == 1) + return 1; return 0; } byte LilliputScript::OC_sub178D2() { @@ -970,7 +987,11 @@ byte LilliputScript::OC_sub1793E() { return 0; } byte LilliputScript::OC_sub1795E() { - warning("OC_sub1795E"); + debugC(1, kDebugScript, "OC_sub1795E()"); + + assert(_vm->_ptr_rulesBuffer2_15 != NULL); + if (_vm->_ptr_rulesBuffer2_15[3] == 1) + return 1; return 0; } byte LilliputScript::OC_sub1796E() { @@ -978,7 +999,16 @@ byte LilliputScript::OC_sub1796E() { return 0; } byte LilliputScript::OC_sub17984() { - warning("OC_sub17984"); + debugC(1, kDebugScript, "OC_sub17984()"); + + int index = _currScript->readUint16LE(); + int var2 = _currScript->readUint16LE(); + + assert(index < 20); + + if (_array122E9[index] == (var2 & 0xFF)) + return 1; + return 0; } byte LilliputScript::OC_checkSavedMousePos() { @@ -1046,7 +1076,16 @@ void LilliputScript::OC_sub17A66() { warning("OC_sub17A66"); } void LilliputScript::OC_sub17A8D() { - warning("OC_sub17A8D"); + debugC(1, kDebugScript, "OC_sub17A8D()"); + + int tmpVal = getValue1(); + assert(tmpVal < 40); + + if (tmpVal == _word10804) + _word10802 = 0xFFFF; + + _vm->_rulesBuffer2_1[tmpVal] = 0xFFFF; + _vm->_rulesBuffer2_2[tmpVal] = 0xFFFF; } void LilliputScript::OC_saveAndQuit() { warning("OC_saveAndQuit"); @@ -1168,7 +1207,11 @@ void LilliputScript::OC_setByte10B29() { warning("OC_setByte10B29"); } void LilliputScript::OC_sub18007() { - warning("OC_sub18007"); + debugC(1, kDebugScript, "OC_sub18007()"); + + int curWord = _currScript->readUint16LE(); + assert(_vm->_ptr_rulesBuffer2_15 != NULL); + _vm->_ptr_rulesBuffer2_15[2] = curWord & 0xFF; } void LilliputScript::OC_sub18014() { warning("OC_sub18014"); @@ -1243,7 +1286,12 @@ void LilliputScript::OC_loadAndDisplayCUBESx_GFX() { } void LilliputScript::OC_sub1834C() { - warning("OC_sub1834C"); + debugC(1, kDebugScript, "OC_sub1834C()"); + + byte curWord = _currScript->readUint16LE() & 0xFF; + assert(_vm->_ptr_rulesBuffer2_15 != NULL); + + _vm->_ptr_rulesBuffer2_15[3] = curWord; } void LilliputScript::OC_sub18359() { warning("OC_sub18359"); diff --git a/engines/lilliput/script.h b/engines/lilliput/script.h index d8a87768af..fd323b04ab 100644 --- a/engines/lilliput/script.h +++ b/engines/lilliput/script.h @@ -57,15 +57,15 @@ private: byte _array122FD[20]; byte _array128EF[40]; - int16 _word1881B; - int16 _word16F00; - int16 _word10802; - int16 _word10804; - int16 _word15FFB; - int16 _word15FFD; - int16 _word12A00; - int16 _word12A02; - int16 _word1855E; + int _word1881B; + int _word16F00; + int _word10802; + int _word10804; + int _word15FFB; + int _word15FFD; + int _word12A00; + int _word12A02; + int _word1855E; int handleOpcode(Common::MemoryReadStream *script); byte handleOpcodeType1(int curWord); |