diff options
author | Strangerke | 2012-04-29 00:35:44 +0200 |
---|---|---|
committer | Eugene Sandulenko | 2018-03-28 17:36:57 +0200 |
commit | dd8131652822c78d9ce62b63a7ce00c8d5ef455f (patch) | |
tree | 57c772c6e688fdd096c0ae1cf03a62ec3ea4d7d0 /engines | |
parent | 6dfec1f58e62ee0f3fe8237bf9460c2542d946b0 (diff) | |
download | scummvm-rg350-dd8131652822c78d9ce62b63a7ce00c8d5ef455f.tar.gz scummvm-rg350-dd8131652822c78d9ce62b63a7ce00c8d5ef455f.tar.bz2 scummvm-rg350-dd8131652822c78d9ce62b63a7ce00c8d5ef455f.zip |
LILLIPUT: Implement some functions related to string display
Diffstat (limited to 'engines')
-rw-r--r-- | engines/lilliput/lilliput.cpp | 75 | ||||
-rw-r--r-- | engines/lilliput/lilliput.h | 4 | ||||
-rw-r--r-- | engines/lilliput/script.cpp | 119 | ||||
-rw-r--r-- | engines/lilliput/script.h | 8 |
4 files changed, 194 insertions, 12 deletions
diff --git a/engines/lilliput/lilliput.cpp b/engines/lilliput/lilliput.cpp index 9afa97a307..50b19c299a 100644 --- a/engines/lilliput/lilliput.cpp +++ b/engines/lilliput/lilliput.cpp @@ -509,6 +509,71 @@ void LilliputEngine::displayFunction10() { displayFunction4(); } +void LilliputEngine::sub15A4C(int &vgaIndex, byte *srcBuf, int &bufIndex) { + debugC(2, kDebugEngine, "sub15A4C()"); + + int var3 = 0; + int var1; + int bckIndex = bufIndex; + + for (;;) { + var1 = srcBuf[bufIndex]; + if ((var1 == 0) || (var1 == '|')) + break; + + ++bufIndex; + ++var3; + } + + var1 = (0x3D - var3) < 1; + vgaIndex += var1; + + bufIndex = bckIndex; + for (;;) { + var1 = srcBuf[bufIndex]; + ++bufIndex; + if ((var1 == 0) || (var1 == '|')) + break; + + displayChar(vgaIndex, srcBuf[bufIndex]); + vgaIndex += 4; + } + +} + +void LilliputEngine::displayFunction11(byte *buf) { + debugC(2, kDebugEngine, "displayFunction11(%s)", buf); + + displayFunction5(); + + int vgaIndex = 70; + int bufIndex = 0; + + byte _byte15A0C = 0; + int var1; + + for (;;) { + var1 = buf[bufIndex]; + ++bufIndex; + if (var1 == 0) { + vgaIndex += (4 * 320); + break; + } else if (var1 == 0x7C) { + _byte15A0C = 1; + break; + } + } + + bufIndex = 0; + sub15A4C(vgaIndex, buf, bufIndex); + if (_byte15A0C == 1) { + vgaIndex += (8 * 320); + sub15A4C(vgaIndex, buf, bufIndex); + } + + displayFunction4(); +} + void LilliputEngine::displayFunction12() { debugC(1, kDebugEngine, "displayFunction12()"); @@ -1209,10 +1274,10 @@ int LilliputEngine::sub16799(int param1, int index) { } -void LilliputEngine::sub18A3E(byte param1) { - debugC(2, kDebugEngine, "sub18A3E(%d)", param1); +void LilliputEngine::addCharToBuf(byte character) { + debugC(2, kDebugEngine, "addCharToBuf(%c)", character); - _displayStringBuf[_displayStringIndex] = param1; + _displayStringBuf[_displayStringIndex] = character; if (_displayStringIndex < 158) ++_displayStringIndex; } @@ -1237,10 +1302,10 @@ void LilliputEngine::prepareGoldAmount(int param1) { byte tmpVal = count + 0x30; if (i == 4) - sub18A3E(tmpVal); + addCharToBuf(tmpVal); else if ((count != 0) || (!hideZeros)) { hideZeros = false; - sub18A3E(tmpVal); + addCharToBuf(tmpVal); } } } diff --git a/engines/lilliput/lilliput.h b/engines/lilliput/lilliput.h index d49385d855..756cc11604 100644 --- a/engines/lilliput/lilliput.h +++ b/engines/lilliput/lilliput.h @@ -222,6 +222,7 @@ public: void displayFunction8(); void displayFunction9(); void displayFunction10(); + void displayFunction11(byte *buf); void displayFunction12(); void displayFunction13(byte *buf, int var1, int var2, int var3); void displayFunction14(); @@ -241,7 +242,7 @@ public: void renderCharacters(byte *buf, int x, int y); int sub16799(int param1, int index); int sub16B0C(int param1, int param2); - void sub18A3E(byte param1); + void addCharToBuf(byte character); void prepareGoldAmount(int param1); void sub12F37(); int sub16675(int idx, int var1); @@ -263,6 +264,7 @@ public: void sub131FC(int var2, int var4); void sub1546F(byte displayX, byte displayY); void sub15498(byte x, byte y, int var2); + void sub15A4C(int &vgaIndex, byte *srcBuf, int &bufIndex); 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 2479fed2e7..9bcc8adf67 100644 --- a/engines/lilliput/script.cpp +++ b/engines/lilliput/script.cpp @@ -37,7 +37,10 @@ LilliputScript::LilliputScript(LilliputEngine *vm) : _vm(vm), _currScript(NULL) _byte12FE4 = 0xFF; _byte16F02 = 0; _byte16F04 = 0; - + _byte1881A = 0; + _byte18823 = 0; + _byte1881E = 3; + _byte1881D = 0; _word1855E = 0; _word16F00 = -1; _viewportCharacterTarget = -1; @@ -933,8 +936,116 @@ void LilliputScript::sub17D40(bool &forceReturnFl) { return; } +void LilliputScript::sub189F5() { + debugC(2, kDebugScript, "sub189F5()"); + + int index = 0; + int var2 = 0x100; + int var1; + + for (;;) { + var1 = _vm->_displayStringBuf[index]; + if (var1 == 0) + break; + + if (var1 == '|') { + var2 &= 0xFF; + ++var2; + continue; + } + + var2 += 0x100; + if ((var2 >> 8) < 61) + continue; + + if ((var2 & 0xFF) == 1) { + _vm->_displayStringBuf[index - 1] = 0; + break; + } + + --index; + while (_vm->_displayStringBuf[index] != ' ') + --index; + + _vm->_displayStringBuf[index] = '|'; + ++var2; + var2 &= 0xFF; + ++index; + } +} + +void LilliputScript::sub189B8() { + debugC(2, kDebugScript, "sub189B8()"); + + sub189F5(); + int index = 0; + + for (;;) { + if (_vm->_displayStringBuf[index] == 0) + break; + ++index; + } + + index /= _byte1881E; + index += 4; + _byte1881D = index; + _vm->displayFunction10(); + _vm->displayFunction11(_vm->_displayStringBuf); +} + void LilliputScript::sub18A56(byte *buf) { - warning("TODO: sub18A56(buf)"); + debugC(2, kDebugScript, "sub18A56(buf)"); + + static const char *nounsArrayPtr = "I am |You are |you are |hou art |in the |is the |is a |in a |To the |to the |by |going |here |The|the|and |some |build|not |way|I |a |an |from |of |him|her|by |his |ing |tion|have |you|I''ve |can''t |up |to |he |she |down |what|What|with|are |and|ent|ian|ome|ed |me|my|ai|it|is|of|oo|ea|er|es|th|we|ou|ow|or|gh|go|er|st|ee|th|sh|ch|ct|on|ly|ng|nd|nt|ty|ll|le|de|as|ie|in|ss|''s |''t |re|gg|tt|pp|nn|ay|ar|wh|"; + + _vm->_displayStringIndex = 0; + _byte1881A = 0; + int index = 0; + byte var1 = 0; + for (;;) { + var1 = buf[index]; + ++index; + if (var1 == ']') + var1 = 0; + + if (var1 < 0x80) { + if (var1 == '@') { + var1 = buf[index]; + ++index; + if (var1 == '#') { + _vm->prepareGoldAmount(_byte18823); + } + } else { + _vm->addCharToBuf(var1); + if (var1 == 0) + break; + } + } else { + int nounIndex = 0; + byte var3 = 0xFF - var1; + for (int i = 0; i < var3; i++) { + for (;;) { + var1 = nounsArrayPtr[nounIndex]; + ++nounIndex; + + if (var1 == '|') + break; + } + } + + for (;;) { + var1 = nounsArrayPtr[nounIndex]; + ++nounIndex; + + if (var1 == '|') + break; + + _vm->addCharToBuf(var1); + } + } + } + + sub189B8(); } void LilliputScript::sub18B3C(int var) { @@ -1729,8 +1840,8 @@ byte LilliputScript::OC_sub179C2() { debugC(1, kDebugScript, "OC_sub179C2()"); int var1 = getValue2(); - if (_vm->_array10999[_vm->_rulesBuffer2PrevIndx] == var1 >> 8 - && _vm->_array109C1[_vm->_rulesBuffer2PrevIndx] == var1 & 0xFF) + if ((_vm->_array10999[_vm->_rulesBuffer2PrevIndx] == (var1 >> 8)) + && (_vm->_array109C1[_vm->_rulesBuffer2PrevIndx] == (var1 & 0xFF))) return 1; return 0; diff --git a/engines/lilliput/script.h b/engines/lilliput/script.h index 3bb2c92577..8356f92b1d 100644 --- a/engines/lilliput/script.h +++ b/engines/lilliput/script.h @@ -85,6 +85,10 @@ private: byte _byte12FE4; byte _byte16F02; byte _byte16F04; + byte _byte1881A; + byte _byte18823; + byte _byte1881E; + byte _byte1881D; int _word16F00; int _word10804; @@ -95,8 +99,6 @@ private: byte handleOpcodeType1(int curWord); void handleOpcodeType2(int curWord); - - void sub1863B(); void sub185ED(byte index, byte subIndex); void sub185B4_display(); @@ -112,6 +114,8 @@ private: byte *sub173D2(); void sub171AF(int var1, int var2, int var4); void sub18B7C(int var1, int var3); + void sub189B8(); + void sub189F5(); int getValue1(); int getValue2(); |