diff options
author | sylvaintv | 2012-04-23 01:51:17 +0200 |
---|---|---|
committer | Eugene Sandulenko | 2018-03-28 17:36:57 +0200 |
commit | 98b39800a86f4fba98e6cb2b1e04b247a1e7c977 (patch) | |
tree | 181db40792e5445b20b7c58e492ab81d52685d77 /engines | |
parent | b4629af5585033bcfd8aa1f50840f6fe2a36f161 (diff) | |
download | scummvm-rg350-98b39800a86f4fba98e6cb2b1e04b247a1e7c977.tar.gz scummvm-rg350-98b39800a86f4fba98e6cb2b1e04b247a1e7c977.tar.bz2 scummvm-rg350-98b39800a86f4fba98e6cb2b1e04b247a1e7c977.zip |
LILLIPUT: Implementation of sub16CA0
Big sub16CA0 function implementation
Diffstat (limited to 'engines')
-rw-r--r-- | engines/lilliput/lilliput.cpp | 111 | ||||
-rw-r--r-- | engines/lilliput/lilliput.h | 3 | ||||
-rw-r--r-- | engines/lilliput/script.h | 3 |
3 files changed, 114 insertions, 3 deletions
diff --git a/engines/lilliput/lilliput.cpp b/engines/lilliput/lilliput.cpp index 1fd207c4e1..ecefbdcd98 100644 --- a/engines/lilliput/lilliput.cpp +++ b/engines/lilliput/lilliput.cpp @@ -672,7 +672,7 @@ void LilliputEngine::displayFunction16() { warning("sub_15F0C"); sub16626(); sub12F37(); - warning("sub_16CA0"); + sub16CA0(); sub16EBC(); sub171CF(); warning("sub_15EAE"); @@ -683,7 +683,7 @@ void LilliputEngine::displayFunction16() { displayFunction14(); sub16626(); sub12F37(); - warning("sub_16CA0"); + sub16CA0(); sub16EBC(); sub171CF(); warning("sub_130EE"); @@ -692,6 +692,113 @@ void LilliputEngine::displayFunction16() { } } +int LilliputEngine::sub16DD5(int x1, int y1, int x2, int y2) +{ + warning("sub16DD5"); + return 0; +} + +void LilliputEngine::sub16CA0() { + + + for (int index = _word10807_ERULES - 1; index >= 0; index--) { + if (_rulesBuffer2_11[index] & 1) + continue; + int c1 = _scriptHandler->_array16123[index]; + int c2 = _scriptHandler->_array1614B[index]; + + for(int index2 = _word10807_ERULES - 1; index2 >= 0; index2--) { + if ( index == index2 ) + continue; + + if (_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) { + if (_rulesBuffer2_9[index] == 0) { + if (d1 > c1) { + _byte16C9F = 2; + if (d2 == c2) { + _byte16C9F = 3; + } else { + if (sub16DD5(c1,d1,c2,d2)) { + _byte16C9F = 1; + } + } + } + } + else if (_rulesBuffer2_9[index] == 1) { + if (d2 < c2) { + _byte16C9F = 2; + if(d1 == c1) { + _byte16C9F = 3; + } else { + if (sub16DD5(c1,d1,c2,d2)) { + _byte16C9F = 1; + } + } + } + } + else if (_rulesBuffer2_9[index] == 2) { + if (d2 > c2) { + _byte16C9F = 2; + if(d1 == c1) { + _byte16C9F = 3; + } else { + if (sub16DD5(c1,d1,c2,d2)) { + _byte16C9F = 1; + } + } + } + } + else { + if (d1 < c1) { + _byte16C9F = 2; + if (d2 == c2) { + _byte16C9F = 3; + } else { + if (sub16DD5(c1,d1,c2,d2)) { + _byte16C9F = 1; + } + } + } + } + + + } + } + } + } + } + + int val = _scriptHandler->_array10B51[index2 + index * 40]; + val = (val & 0xFF) + ((val & 0xFF) << 8); + if( (val & 0xFF) != _byte16C9F ) { + _scriptHandler->_array10B29[index] = 1; + val = (val & 0xFF00) | _byte16C9F; + } + _scriptHandler->_array10B51[index2 + index * 40] = val; + } + + } + + } +} + void LilliputEngine::displayFunction17() { debugC(2, kDebugEngine, "displayFunction17()"); diff --git a/engines/lilliput/lilliput.h b/engines/lilliput/lilliput.h index 48971b4ad4..49a1a04080 100644 --- a/engines/lilliput/lilliput.h +++ b/engines/lilliput/lilliput.h @@ -238,9 +238,11 @@ public: int sub16675(int idx, int var1); int sub16685(int idx, int var1); void sub16EBC(); + void sub16CA0(); int sub166DD(int index, int var1); void sub171CF(); void sub12FE5(); + int sub16DD5(int x1, int y1, int x2, int y2); void displayHeroismIndicator(); void initGame(const LilliputGameDescription *gd); @@ -276,6 +278,7 @@ public: byte _byte12FCE; byte _byte129A0; byte _byte160FA; + byte _byte16C9F; int _word10804; int _word16213; int _word16215; diff --git a/engines/lilliput/script.h b/engines/lilliput/script.h index 9c8381e721..3ea50791db 100644 --- a/engines/lilliput/script.h +++ b/engines/lilliput/script.h @@ -44,6 +44,8 @@ public: byte _array12811[40]; byte _array10AB1[40]; byte _array122FD[20]; + short _array10B51[40 * 40]; + byte *_savedBuffer215Ptr; int _word12A00; @@ -76,7 +78,6 @@ private: byte _array128EF[40]; byte _array12839[40]; - byte _array10B51[40 * 40]; int _word16F00; int _word10804; |