aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsylvaintv2012-04-24 00:31:34 +0200
committerEugene Sandulenko2018-03-28 17:36:57 +0200
commitb348db605b07cd829ab275d921a5b3ce8d0ecf4c (patch)
tree5f4d430576219fd78e10cad75f86d55f26ce326d
parent1864f1e5189aa039a2f3c7e3aa7e9dc86927f5be (diff)
downloadscummvm-rg350-b348db605b07cd829ab275d921a5b3ce8d0ecf4c.tar.gz
scummvm-rg350-b348db605b07cd829ab275d921a5b3ce8d0ecf4c.tar.bz2
scummvm-rg350-b348db605b07cd829ab275d921a5b3ce8d0ecf4c.zip
LILLIPUT: Implements character display on map
Draw and restore points
-rw-r--r--engines/lilliput/lilliput.cpp67
-rw-r--r--engines/lilliput/lilliput.h4
-rw-r--r--engines/lilliput/script.cpp10
-rw-r--r--engines/lilliput/script.h6
4 files changed, 61 insertions, 26 deletions
diff --git a/engines/lilliput/lilliput.cpp b/engines/lilliput/lilliput.cpp
index 35261f35d8..e808f48ffc 100644
--- a/engines/lilliput/lilliput.cpp
+++ b/engines/lilliput/lilliput.cpp
@@ -436,7 +436,7 @@ void LilliputEngine::displayFunction7() {
void LilliputEngine::displayFunction8() {
debugC(2, kDebugEngine, "displayFunction8()");
- if (_scriptHandler->_byte16F08 == 1)
+ if (_scriptHandler->displayMap == 1)
return;
displayFunction5();
@@ -538,7 +538,7 @@ void LilliputEngine::displayFunction13(byte *buf, int var1, int var2, int var3)
void LilliputEngine::displayFunction14() {
debugC(2, kDebugEngine, "displayFunction14()");
- if (_scriptHandler->_byte16F08 == 1)
+ if (_scriptHandler->displayMap == 1)
return;
if (_mouseDisplayX > 48)
@@ -557,6 +557,37 @@ void LilliputEngine::displayFunction14() {
displayFunction4();
};
+void LilliputEngine::restoreMapPoints() {
+ displayFunction5();
+
+ byte* buf = (byte*)_mainSurface->getPixels();
+ for (int index = 0; index < _word10807_ERULES; index++) {
+ buf[_word15E5D[index]] = _byte15E35[index];
+ }
+
+ displayFunction4();
+}
+
+void LilliputEngine::displayCharactersOnMap() {
+ sub16217();
+ displayFunction5();
+
+ byte* buf = (byte*)_mainSurface->getPixels();
+ for( int index = _word10807_ERULES - 1; index >=0; index--) {
+ if(_rulesBuffer2_11[index] & 2 == 0 &&
+ _scriptHandler->_array1614B[index] != -1) {
+ int y = 3 * _scriptHandler->_array1614B[index] + 1;
+ int x = _scriptHandler->_array16123[index] * 4 + 1;
+
+ _word15E5D[index] = y * 320 + x;
+ _byte15E35[index] = buf[y * 320 + x];
+ buf[y * 320 + x] = _scriptHandler->_array128EF[index];
+
+ }
+ }
+ displayFunction4();
+}
+
void LilliputEngine::sub16217() {
debugC(2, kDebugEngine, "sub16217()");
@@ -669,15 +700,15 @@ void LilliputEngine::displayFunction15() {
void LilliputEngine::displayFunction16() {
debugC(2, kDebugEngine, "displayFunction16()");
- if (_scriptHandler->_byte16F08 == 1) {
+ if (_scriptHandler->displayMap == 1) {
warning("sub_15F31");
- warning("sub_15F0C");
+ restoreMapPoints();
sub16626();
sub12F37();
sub16CA0();
sub16EBC();
sub171CF();
- warning("sub_15EAE");
+ displayCharactersOnMap();
} else {
sub1638C();
sub189DE();
@@ -701,7 +732,7 @@ int LilliputEngine::sub16DD5(int x1, int y1, int x2, int y2)
int dx = x2 - x1;
int dy = y2 - y1;
- int word16DCB = 0;
+ int word16DCB = 0;
int word16DCD = 0;
int word16DD1 = 0;
int word16DCF = 0;
@@ -740,7 +771,7 @@ int LilliputEngine::sub16DD5(int x1, int y1, int x2, int y2)
word16DCB += word16DCD;
int var1 = byte16DD4;
- int count = 0;
+ int count = 0;
while ( *isoMap == 0xFF ) {
if (var1 > 0) {
@@ -750,7 +781,7 @@ int LilliputEngine::sub16DD5(int x1, int y1, int x2, int y2)
isoMap += word16DCF;
var1 += byte16DD4;
}
-
+
count++;
if (count == dy) {
return 0;
@@ -771,20 +802,20 @@ void LilliputEngine::sub16CA0() {
for(int index2 = _word10807_ERULES - 1; index2 >= 0; index2--) {
_byte16C9F = 0;
- if ((index != index2 ) &&
+ if ((index != index2 ) &&
(_rulesBuffer2_5[index] != index2) &&
(_rulesBuffer2_5[index2] != index) &&
(_rulesBuffer2_11[index2] & 2) == 0) {
int d1 = _scriptHandler->_array16123[index2];
int d2 = _scriptHandler->_array1614B[index2];
-
+
if (d1 != 0xFF) {
int x = c1 - d1;
if ((x > -6) && (x < 6)) {
int y = c2 - d2;
if ((y > -6) && (y < 6)) {
_byte16C9F = 1;
-
+
if ((c1 == d1) && (c2 == d2)) {
_byte16C9F = 4;
} else if((_rulesBuffer2_11[index] & 4) != 0) {
@@ -798,7 +829,7 @@ void LilliputEngine::sub16CA0() {
_byte16C9F = 3;
if (sub16DD5(c1, d1, c2, d2) != 0)
- _byte16C9F = 1;
+ _byte16C9F = 1;
}
} else if (_rulesBuffer2_9[index] == 1) {
if (d2 < c2) {
@@ -808,7 +839,7 @@ void LilliputEngine::sub16CA0() {
_byte16C9F = 3;
if (sub16DD5(c1, d1, c2, d2) != 0)
- _byte16C9F = 1;
+ _byte16C9F = 1;
}
} else if (_rulesBuffer2_9[index] == 2) {
if (d2 > c2) {
@@ -818,7 +849,7 @@ void LilliputEngine::sub16CA0() {
_byte16C9F = 3;
if (sub16DD5(c1, d1, c2, d2) != 0)
- _byte16C9F = 1;
+ _byte16C9F = 1;
}
} else {
if (d1 < c1) {
@@ -828,7 +859,7 @@ void LilliputEngine::sub16CA0() {
_byte16C9F = 3;
if (sub16DD5(c1, d1, c2, d2) != 0)
- _byte16C9F = 1;
+ _byte16C9F = 1;
}
}
}
@@ -843,7 +874,7 @@ void LilliputEngine::sub16CA0() {
_scriptHandler->_array10B29[index] = 1;
val = (val & 0xFF00) | _byte16C9F;
}
- _scriptHandler->_array10B51[index2 + index * 40] = val;
+ _scriptHandler->_array10B51[index2 + index * 40] = val;
}
@@ -1237,7 +1268,7 @@ void LilliputEngine::sub16626() {
}
int LilliputEngine::sub166DD(int index, int var1) {
-
+
_rulesBuffer2_9[index] = (var1 >> 8) & 3;
sub16685(index, var1 & 0xFF);
return 0;
@@ -1305,7 +1336,7 @@ void LilliputEngine::sub130EE() {
if ((posX < 0) || (posX > 255))
return;
-
+
if ((posY < 0) || (posY > 176))
return;
diff --git a/engines/lilliput/lilliput.h b/engines/lilliput/lilliput.h
index 6ddfb07481..948e05145a 100644
--- a/engines/lilliput/lilliput.h
+++ b/engines/lilliput/lilliput.h
@@ -132,6 +132,8 @@ public:
int _word16550;
int _displayStringIndex;
int _word1289D;
+ short _word15E5D[40];
+ byte _byte15E35[40];
int _array11D49[40];
int _array1289F[40];
@@ -245,6 +247,8 @@ public:
void sub171CF();
void sub12FE5();
int sub16DD5(int x1, int y1, int x2, int y2);
+ void displayCharactersOnMap();
+ void restoreMapPoints();
void displayHeroismIndicator();
void sub130EE();
void sub1305C(byte index, byte var2);
diff --git a/engines/lilliput/script.cpp b/engines/lilliput/script.cpp
index 59180a042b..4de70635d5 100644
--- a/engines/lilliput/script.cpp
+++ b/engines/lilliput/script.cpp
@@ -30,7 +30,7 @@ namespace Lilliput {
LilliputScript::LilliputScript(LilliputEngine *vm) : _vm(vm), _currScript(NULL) {
_byte129A0 = 0xFF;
- _byte16F08 = 0;
+ displayMap = 0;
_byte1855D = 0;
_byte12A04 = 0;
_byte10806 = 0;
@@ -764,7 +764,7 @@ void LilliputScript::sub16C5C(int index, byte var3) {
int LilliputScript::sub17D40(int var) {
debugC(1, kDebugScript, "sub17D40(%d)", var);
- if ((_byte16F08 != 1) && (_array16173[_vm->_rulesBuffer2PrevIndx] != 0xFF))
+ if ((displayMap != 1) && (_array16173[_vm->_rulesBuffer2PrevIndx] != 0xFF))
return var;
warning("sub17D40() - FIXME: Unexpected POP");
@@ -1340,7 +1340,7 @@ void LilliputScript::OC_sub17D57() {
int curWord = _currScript->readUint16LE();
- if((_byte16F08 == 1) || (_array16173[_vm->_rulesBuffer2PrevIndx] == 0xFF))
+ if((displayMap == 1) || (_array16173[_vm->_rulesBuffer2PrevIndx] == 0xFF))
return;
_word1881B = _vm->_rulesBuffer2PrevIndx;
@@ -1766,7 +1766,7 @@ void LilliputScript::OC_sub1847F() {
int var2 = _currScript->readUint16LE();
int var4 = _currScript->readUint16LE();
- if (_byte16F08 != 1) {
+ if (displayMap != 1) {
_vm->displayFunction5();
sub18BE6(var1 & 0xFF, var2, var4);
_vm->displayFunction4();
@@ -1839,7 +1839,7 @@ void LilliputScript::OC_sub1853B() {
debugC(1, kDebugScript, "OC_sub1853B()");
OC_PaletteFadeOut();
- _byte16F08 = 0;
+ displayMap = 0;
_byte15FFA = 0;
sub130B6();
diff --git a/engines/lilliput/script.h b/engines/lilliput/script.h
index 63a9aab805..e29c676ef1 100644
--- a/engines/lilliput/script.h
+++ b/engines/lilliput/script.h
@@ -32,7 +32,7 @@ namespace Lilliput {
class LilliputEngine;
class LilliputScript {
public:
- byte _byte16F08;
+ byte displayMap;
byte _byte12A04;
byte _byte15FFA;
@@ -56,6 +56,8 @@ public:
int _word15FFD;
short _array12311[640];
+ byte _array128EF[40];
+ byte _array12839[40];
void sub130B6();
@@ -78,8 +80,6 @@ private:
byte _byte12FE4;
byte _byte16F02;
- byte _array128EF[40];
- byte _array12839[40];
int _word16F00;
int _word10804;