aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/lilliput/lilliput.cpp73
-rw-r--r--engines/lilliput/lilliput.h7
-rw-r--r--engines/lilliput/script.cpp33
-rw-r--r--engines/lilliput/script.h7
4 files changed, 93 insertions, 27 deletions
diff --git a/engines/lilliput/lilliput.cpp b/engines/lilliput/lilliput.cpp
index 3bb410a8c4..6730f5bf3f 100644
--- a/engines/lilliput/lilliput.cpp
+++ b/engines/lilliput/lilliput.cpp
@@ -143,6 +143,7 @@ LilliputEngine::LilliputEngine(OSystem *syst, const LilliputGameDescription *gd)
_byte12A09 = 0;
_byte1881D = 0;
_byte16552 = 0;
+ _byte18AED = 0;
_rulesBuffer2PrevIndx = 0;
_word16EFA = 0;
@@ -155,6 +156,7 @@ LilliputEngine::LilliputEngine(OSystem *syst, const LilliputGameDescription *gd)
_word15AC2 = 0;
_word16213 = 0;
_word16215 = 0;
+ _displayStringIndex = 0;
_saveFlag = false;
_byte16F07_menuId = 0;
@@ -191,6 +193,9 @@ LilliputEngine::LilliputEngine(OSystem *syst, const LilliputGameDescription *gd)
for (int i = 0; i < 256; i++)
_array15AC8[i] = 0;
+ for (int i = 0; i < 160; i++)
+ _displayStringBuf[i] = 0;
+
_ptr_rulesBuffer2_15 = NULL;
_bufferIdeogram = NULL;
_bufferMen = NULL;
@@ -694,6 +699,36 @@ void LilliputEngine::displayFunction17() {
displayFunction4();
}
+void LilliputEngine::displayFunction18(byte *buf, int var2, int var4) {
+ debugC(2, kDebugEngine, "displayFunction18(buf, %d, %d)", var2, var4);
+
+ int index = var2;
+ int tmpVar4 = (var4 >> 8) + ((var4 & 0xFF) << 8);
+ index = index + tmpVar4 + (tmpVar4 >> 2);
+
+ int i = 0;
+ while (buf[i] != 0) {
+ displayChar(index, buf[i]);
+ ++i;
+ index += 4;
+ }
+}
+
+void LilliputEngine::displayChar(int index, int var1) {
+ debugC(2, kDebugEngine, "displayChar(%d, %d)", index, var1);
+
+ int indexVga = index;
+ int indexChar = var1 << 5;
+
+ for (int i = 0; i < 8; i++) {
+ for (int j = 0; j < 4; j++)
+ ((byte *)_mainSurface->getPixels())[indexVga + j] = _bufferIsoChars[indexChar + j];
+ indexVga += 320;
+ indexChar += 4;
+ }
+
+}
+
void LilliputEngine::sub16323() {
debugC(2, kDebugEngine, "sub16323()");
@@ -707,8 +742,8 @@ void LilliputEngine::sub16323() {
for (int var2 = 0; var2 < var4; var2++) {
int index1 = _array160FB[var2];
int index2 = _array160FB[var2 + 1];
-
- if (_array1619B[index1] < _array1619B[index2])
+
+ if (_array1619B[index1] < _array1619B[index2])
continue;
if (_array1619B[index1] == _array1619B[index2]) {
@@ -931,6 +966,40 @@ int LilliputEngine::sub16799(int param1, int index) {
}
+void LilliputEngine::sub18A3E(byte param1) {
+ debugC(2, kDebugEngine, "sub18A3E(%d)", param1);
+
+ _displayStringBuf[_displayStringIndex] = param1;
+ if (_displayStringIndex < 158)
+ ++_displayStringIndex;
+}
+
+void LilliputEngine::sub18AEE(int param1) {
+ debugC(2, kDebugEngine, "sub18AEE(%d)", param1);
+
+ static const int _array18AE3[6] = {10000, 1000, 100, 10, 1};
+
+ int count;
+ int var1 = param1;
+ for (int i = 0; i < 5; i++) {
+ count = 0;
+ while (var1 >= 0) {
+ ++count;
+ var1 -= _array18AE3[i];
+ }
+ var1 += _array18AE3[i];
+ byte tmpVal = var1 + 0x30;
+
+ if (i == 4)
+ sub18A3E(tmpVal);
+ else if ((var1 != 0) || (_byte18AED != 1)) {
+ _byte18AED = 0;
+ sub18A3E(tmpVal);
+ }
+ }
+}
+
+
void LilliputEngine::sub16626() {
debugC(2, kDebugEngine, "sub16626()");
diff --git a/engines/lilliput/lilliput.h b/engines/lilliput/lilliput.h
index bdbda3fde8..d4d5dfcadf 100644
--- a/engines/lilliput/lilliput.h
+++ b/engines/lilliput/lilliput.h
@@ -101,6 +101,7 @@ public:
byte _byte12A09;
byte _byte1881D;
byte _byte16552;
+ byte _byte18AED;
byte _buffer1[45056];
byte _buffer2[45056];
@@ -113,6 +114,7 @@ public:
byte *_bufferIdeogram;
byte _buffer10[4032];
byte _curPalette[768];
+ byte _displayStringBuf[160];
bool _saveFlag;
bool _int8installed;
@@ -127,6 +129,7 @@ public:
int _word15BCA;
int _word15AC2;
int _word16550;
+ int _displayStringIndex;
int _array11D49[40];
@@ -214,6 +217,8 @@ public:
void displayFunction15();
void displayFunction16();
void displayFunction17();
+ void displayFunction18(byte *buf, int var2, int var4);
+ void displayChar(int index, int var1);
void sub16323();
void sub1638C();
@@ -223,6 +228,8 @@ public:
void sub16553(byte *buf);
int sub16799(int param1, int index);
int sub16B0C(int param1, int param2);
+ void sub18A3E(byte param1);
+ void sub18AEE(int param1);
void initGame(const LilliputGameDescription *gd);
byte *loadVGA(Common::String filename, bool loadPal);
diff --git a/engines/lilliput/script.cpp b/engines/lilliput/script.cpp
index caa9d52d0f..ca7e389170 100644
--- a/engines/lilliput/script.cpp
+++ b/engines/lilliput/script.cpp
@@ -36,12 +36,7 @@ LilliputScript::LilliputScript(LilliputEngine *vm) : _vm(vm), _currScript(NULL)
_byte10806 = 0;
_byte12FE4 = 0xFF;
_byte16F02 = 0;
- _byte18778 = 0;
- _byte18779 = 0;
- _byte1877A = 0;
- _byte1877B = 0;
- _word18818 = 0;
_word1855E = 0;
_word16F00 = -1;
_word10802 = -1;
@@ -1676,7 +1671,7 @@ void LilliputScript::OC_unkPaletteFunction_1() {
}
_vm->_system->getPaletteManager()->setPalette(palette, 0, 256);
_vm->_system->updateScreen();
- _vm->_system->delayMillis(33);
+ _vm->_system->delayMillis(20);
}
}
void LilliputScript::OC_unkPaletteFunction_2() {
@@ -1688,7 +1683,7 @@ void LilliputScript::OC_unkPaletteFunction_2() {
}
_vm->_system->getPaletteManager()->setPalette(palette, 0, 256);
_vm->_system->updateScreen();
- _vm->_system->delayMillis(33);
+ _vm->_system->delayMillis(20);
}
}
@@ -1763,28 +1758,28 @@ void LilliputScript::OC_sub1847F() {
byte tmpVal = buf215Ptr[0];
int curWord = _currScript->readUint16LE();
assert(curWord != 0);
- int var1 = tmpVal / curWord;
+ int var1 = tmpVal / (curWord & 0xFF);
int var2 = _currScript->readUint16LE();
- int var3 = _currScript->readUint16LE();
+ int var4 = _currScript->readUint16LE();
if (_byte16F08 != 1) {
_vm->displayFunction5();
- sub18BE6();
+ sub18BE6(var1 & 0xFF, var2, var4);
_vm->displayFunction4();
}
}
-void LilliputScript::sub18BE6() {
- debugC(1, kDebugScript, "sub18BE6()");
+void LilliputScript::sub18BE6(byte var1, int var2, int var4) {
+ debugC(1, kDebugScript, "sub18BE6(%d, %d, %d)", var1, var2, var4);
- _word18818 = 0;
- _byte18778 = 32;
- _byte18779 = 32;
- _byte1877A = 32;
- _byte1877B = 0;
+ _vm->_displayStringIndex = 0;
+ _vm->_displayStringBuf[0] = 32;
+ _vm->_displayStringBuf[1] = 32;
+ _vm->_displayStringBuf[2] = 32;
+ _vm->_displayStringBuf[3] = 0;
- warning("sub_18AEE");
- warning("sub_15A8B(_vm_byte18778);");
+ _vm->sub18AEE(var1);
+ _vm->displayFunction18(_vm->_displayStringBuf, var2, var4);
}
void LilliputScript::OC_displayVGAFile() {
diff --git a/engines/lilliput/script.h b/engines/lilliput/script.h
index 4b5bc3df00..07d2139663 100644
--- a/engines/lilliput/script.h
+++ b/engines/lilliput/script.h
@@ -69,10 +69,6 @@ private:
byte _byte10806;
byte _byte12FE4;
byte _byte16F02;
- byte _byte18778;
- byte _byte18779;
- byte _byte1877A;
- byte _byte1877B;
byte *_savedBuffer215Ptr;
byte _array122FD[20];
@@ -80,7 +76,6 @@ private:
byte _array12839[40];
byte _array10B51[40 * 40];
- int _word18818;
int _word16F00;
int _word10804;
int _word15FFB;
@@ -102,7 +97,7 @@ private:
int sub17D40(int var);
void sub18A56(byte *buf);
void sub18B3C(int var);
- void sub18BE6();
+ void sub18BE6(byte var1, int var2, int var4);
int getValue1();
int getValue2();