aboutsummaryrefslogtreecommitdiff
path: root/engines/lilliput
diff options
context:
space:
mode:
Diffstat (limited to 'engines/lilliput')
-rw-r--r--engines/lilliput/lilliput.cpp25
-rw-r--r--engines/lilliput/lilliput.h1
-rw-r--r--engines/lilliput/script.cpp20
-rw-r--r--engines/lilliput/script.h1
4 files changed, 36 insertions, 11 deletions
diff --git a/engines/lilliput/lilliput.cpp b/engines/lilliput/lilliput.cpp
index 986b6c7055..86bd94ea06 100644
--- a/engines/lilliput/lilliput.cpp
+++ b/engines/lilliput/lilliput.cpp
@@ -204,13 +204,17 @@ GUI::Debugger *LilliputEngine::getDebugger() {
}
void LilliputEngine::update() {
- newInt8();
- pollEvent();
+
+ // update every 20 ms.
+ int currentTime = _system->getMillis();
+ if(currentTime - _lastTime > 20) {
+ _lastTime += 20;
+ newInt8();
+ pollEvent();
+ }
}
void LilliputEngine::newInt8() {
- if (!_int8installed)
- return;
if (_byte12A06 == 0) {
_byte12A06 = 2;
@@ -218,6 +222,10 @@ void LilliputEngine::newInt8() {
}
--_byte12A06;
// TODO: check 'out 20h, 20h'
+
+ // hack for the title stars because _int8installed is not set at the good place for the moment
+ //if (!_int8installed)
+ // return;
// if (_soundEnabled)
warning("TODO: call sound function #1");
@@ -232,7 +240,7 @@ void LilliputEngine::newInt8() {
--_sound_byte16F06;
_byte12A04 ^= 1;
- if (_byte12A09 != 1)
+ if (_byte12A09 != 1 && _int8installed) // hack for the title stars because _int8installed is not set at the good place for the moment
displayFunction16();
}
_byte12A08 = 0;
@@ -709,7 +717,7 @@ void LilliputEngine::sub1638C() {
void LilliputEngine::sub163F0(int var1, int var3) {
debugC(2, kDebugEngine, "sub163F0(%d, %d)", var1, var3);
- if ((var1 == _scriptHandler->_word12A00) && (var3 = _scriptHandler->_word12A02))
+ if ((var1 == _scriptHandler->_word12A00) && (var3 == _scriptHandler->_word12A02))
return;
int var2 = 0;
@@ -1152,6 +1160,10 @@ Common::Error LilliputEngine::run() {
loadRules();
+ _lastTime = _system->getMillis();
+
+
+
//TODO: Init sound/music player
_scriptHandler->runScript(Common::MemoryReadStream(_initScript, _initScript_size));
@@ -1162,7 +1174,6 @@ Common::Error LilliputEngine::run() {
handleGameScripts();
// To be removed when handled in the previous fonctions
update();
- pollEvent();
}
return Common::kNoError;
diff --git a/engines/lilliput/lilliput.h b/engines/lilliput/lilliput.h
index c1d8f55b1b..adda3930a6 100644
--- a/engines/lilliput/lilliput.h
+++ b/engines/lilliput/lilliput.h
@@ -259,6 +259,7 @@ public:
protected:
Common::EventManager *_eventMan;
bool _shouldQuit;
+ int _lastTime;
// Engine APIs
Common::Error run();
diff --git a/engines/lilliput/script.cpp b/engines/lilliput/script.cpp
index 4aab2f6b4b..576e738cbd 100644
--- a/engines/lilliput/script.cpp
+++ b/engines/lilliput/script.cpp
@@ -597,12 +597,21 @@ void LilliputScript::runMenuScript(Common::MemoryReadStream script) {
_vm->update();
}
+void LilliputScript::sub1863B() {
+ _vm->_arr18560[0]._field0 = 0;
+ _vm->_arr18560[1]._field0 = 0;
+ _vm->_arr18560[2]._field0 = 0;
+ _vm->_arr18560[3]._field0 = 0;
+ _word1855E = 0;
+}
+
+
void LilliputScript::sub185ED(byte index, byte subIndex) {
debugC(2, kDebugScript, "sub185ED");
if (_vm->_arr18560[index]._field0 != 1)
return;
- _vm->displayFunction1(_vm->_bufferIdeogram, _vm->_arr18560[index]._field5[0], _vm->_arr18560[index]._field1, _vm->_arr18560[index]._field3);
+ _vm->displayFunction1(_vm->_bufferIdeogram, _vm->_arr18560[index]._field5[subIndex], _vm->_arr18560[index]._field1, _vm->_arr18560[index]._field3);
}
byte LilliputScript::compareValues(byte var1, int oper, int var2) {
@@ -665,11 +674,13 @@ void LilliputScript::computeOperation(byte *bufPtr, int oper, int var2) {
}
}
+
+
void LilliputScript::sub185B4_display() {
- if (_byte12A04 == _byte1855D)
+ if (_vm->_byte12A04 == _byte1855D)
return;
- _byte1855D = _byte12A04;
+ _byte1855D = _vm->_byte12A04;
assert(_word1855E < 8);
int subIndex = _word1855E;
@@ -874,6 +885,7 @@ int LilliputScript::getValue2() {
}
}
+
void LilliputScript::sub130B6() {
debugC(1, kDebugScript, "sub130B6()");
assert(_vm->_word12F68_ERULES <= 20);
@@ -1651,7 +1663,7 @@ void LilliputScript::OC_sub182EC() {
warning("OC_sub182EC");
}
void LilliputScript::OC_unkPaletteFunction_1() {
-
+ sub1863B();
byte palette[768];
for (int fade = 256; fade >= 0; fade -= 8) {
for (int i = 0; i < 768; i++) {
diff --git a/engines/lilliput/script.h b/engines/lilliput/script.h
index 6113fd8808..27140e6f41 100644
--- a/engines/lilliput/script.h
+++ b/engines/lilliput/script.h
@@ -87,6 +87,7 @@ private:
byte handleOpcodeType1(int curWord);
void handleOpcodeType2(int curWord);
+ void sub1863B();
void sub185ED(byte index, byte subIndex);
void sub185B4_display();
void sub1823E(byte var1, byte var2, byte *curBufPtr);