aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorStrangerke2012-04-22 22:54:50 +0200
committerEugene Sandulenko2018-03-28 17:36:57 +0200
commitc4dc1e37611a0e6a00dbeb67696bba47be45f006 (patch)
tree08161889de619c6833754274536a3e997575eea9 /engines
parentebb7f492f062fc45223e900e5d04333cdf513e0c (diff)
downloadscummvm-rg350-c4dc1e37611a0e6a00dbeb67696bba47be45f006.tar.gz
scummvm-rg350-c4dc1e37611a0e6a00dbeb67696bba47be45f006.tar.bz2
scummvm-rg350-c4dc1e37611a0e6a00dbeb67696bba47be45f006.zip
LILLIPUT: Add display heroism bar
Diffstat (limited to 'engines')
-rw-r--r--engines/lilliput/lilliput.cpp136
-rw-r--r--engines/lilliput/lilliput.h8
-rw-r--r--engines/lilliput/script.h10
3 files changed, 139 insertions, 15 deletions
diff --git a/engines/lilliput/lilliput.cpp b/engines/lilliput/lilliput.cpp
index 31500e8cb0..8d8091af5f 100644
--- a/engines/lilliput/lilliput.cpp
+++ b/engines/lilliput/lilliput.cpp
@@ -156,6 +156,7 @@ LilliputEngine::LilliputEngine(OSystem *syst, const LilliputGameDescription *gd)
_word16213 = 0;
_word16215 = 0;
_displayStringIndex = 0;
+ _word1289D = 0;
_saveFlag = false;
_byte16F07_menuId = 0;
@@ -171,6 +172,7 @@ LilliputEngine::LilliputEngine(OSystem *syst, const LilliputGameDescription *gd)
_array12299[i] = 0xFF;
_array109E9[i] = 0xFF;
_array10A11[i] = 0xFF;
+ _array16E94[i] = 0;
_array11D49[i] = 0xFFFF;
_rulesBuffer2_1[i] = 0xFFFF;
@@ -187,8 +189,12 @@ LilliputEngine::LilliputEngine(OSystem *syst, const LilliputGameDescription *gd)
_rulesBuffer2_12[i] = 0;
_rulesBuffer2_13[i] = 0;
_rulesBuffer2_14[i] = 0;
+ _array1289F[i] = 0xFFFF;
}
+ for (int i = 0; i < 30; i++)
+ _array12861[i] = 0xFFFF;
+
for (int i = 0; i < 256; i++)
_array15AC8[i] = 0;
@@ -667,8 +673,8 @@ void LilliputEngine::displayFunction16() {
sub16626();
sub12F37();
warning("sub_16CA0");
- warning("sub_16EBC");
- warning("sub_171CF");
+ sub16EBC();
+ sub171CF();
warning("sub_15EAE");
} else {
sub1638C();
@@ -678,11 +684,11 @@ void LilliputEngine::displayFunction16() {
sub16626();
sub12F37();
warning("sub_16CA0");
- warning("sub_16EBC");
- warning("sub_171CF");
+ sub16EBC();
+ sub171CF();
warning("sub_130EE");
- warning("sub_12FE5");
- warning("sub_15FFF");
+ sub12FE5();
+ displayHeroismIndicator();
}
}
@@ -1001,7 +1007,6 @@ void LilliputEngine::prepareGoldAmount(int param1) {
}
}
-
void LilliputEngine::sub16626() {
debugC(2, kDebugEngine, "sub16626()");
@@ -1020,7 +1025,7 @@ void LilliputEngine::sub16626() {
var2 = ((var1 >> 8) >> 3);
var2 &= 0xFE;
- // temporary hack
+ // temporary hack
result = 0;
switch (var2 / 2) {
@@ -1073,6 +1078,24 @@ void LilliputEngine::sub16626() {
}
}
+void LilliputEngine::sub16EBC() {
+ debugC(2, kDebugEngine, "sub16EBC()");
+
+ int index2 = 3;
+
+ for (int index1 = _word10807_ERULES - 1; index1 >= 0; index1--) {
+ int var2 = (_scriptHandler->_array1614B[index1] << 8) + (_scriptHandler->_array16123[index1] << 2);
+ int var1 = (_bufferIsoMap[index2 + var2] & 0x40);
+
+ if (var1 == _array16E94[index1])
+ continue;
+
+ _array16E94[index1] = var1;
+ if (var1 != 0)
+ _scriptHandler->_array10B29[index1] = 1;
+ }
+}
+
void LilliputEngine::sub12F37() {
debugC(2, kDebugEngine, "sub12F37()");
@@ -1084,7 +1107,7 @@ void LilliputEngine::sub12F37() {
--_rulesBuffer2_15[index1];
if (_rulesBuffer2_15[index1] == 1)
_scriptHandler->_array10B29[index2] = 1;
- } else
+ } else
_rulesBuffer2_15[index1] = 0;
index1 += 32;
@@ -1106,7 +1129,7 @@ int LilliputEngine::sub16675(int idx, int var1) {
warning("sub16675(%d, %d)", idx, var1);
int index = sub16685(idx, var1);
-
+
switch (index) {
case 0:
break;
@@ -1147,6 +1170,99 @@ int LilliputEngine::sub16675(int idx, int var1) {
return 0;
}
+void LilliputEngine::sub171CF() {
+ debugC(2, kDebugEngine, "sub171CF()");
+
+ for (int i = 0; i < _word10807_ERULES; i++) {
+ if (_array1289F[i] != 0xFFFF) {
+ _array11D49[i] = _array1289F[i];
+ _array1289F[i] = 0xFFFF;
+ _scriptHandler->_array10B29[i] = 1;
+ }
+ }
+
+ ++_word1289D;
+
+ for (int i = 0; i < 10; i++) {
+ if ((_array12861[(3 * i) + 1] != 0xFFFF) && (_array12861[3 * i] = _word1289D)) {
+ int var1 = _array12861[(3 * i) + 1];
+ int var4 = _array12861[(3 * i) + 2];
+ _array12861[(3 * i) + 1] = 0xFFFF;
+
+ warning("sub_17224");
+ }
+ }
+}
+
+void LilliputEngine::sub12FE5() {
+ debugC(2, kDebugEngine, "sub12FE5()");
+
+ if (_byte12A04 != 1)
+ return;
+
+ int index = 0;
+ int count = 0;
+ for (int i = 0; i < _word12F68_ERULES; i++) {
+ if (_scriptHandler->_array122FD[index] != 0) {
+ --_scriptHandler->_array122FD[index];
+ if (_scriptHandler->_array122FD[index] == 0) {
+ _scriptHandler->_array122E9[index] = 2;
+ ++count;
+ }
+ }
+ }
+
+ if (count !=0)
+ displayFunction8();
+}
+
+void LilliputEngine::displayHeroismIndicator() {
+ debugC(2, kDebugEngine, "displayHeroismIndicator()");
+
+ if (_scriptHandler->_savedBuffer215Ptr == NULL)
+ return;
+
+ int var1 = (_scriptHandler->_savedBuffer215Ptr[0] * 25) >> 8;
+
+ if (var1 == _scriptHandler->_byte15FFA)
+ return;
+
+ displayFunction5();
+ int var2 = 1;
+ if (var1 > _scriptHandler->_byte15FFA)
+ var1 = 150;
+ else {
+ var2 = -1;
+ var1 = 40;
+ }
+
+ _scriptHandler->_byte15FFA += var2;
+
+ int var4 = (_scriptHandler->_word15FFD >> 8) + ((_scriptHandler->_word15FFD & 0xFF) << 8);
+ int index = _scriptHandler->_word15FFB + var4 + (var4 >> 2);
+
+ if ((_scriptHandler->_byte15FFA & 0xFF) == 0) {
+// sub16064(var1, _scriptHandler->_byte15FFA);
+ for (int i = 0; i < (_scriptHandler->_byte15FFA << 2); i++) {
+ ((byte *)_mainSurface->getPixels())[index - (i * 320)] = var1;
+ ((byte *)_mainSurface->getPixels())[index - (i * 320) + 1] = var1;
+ ((byte *)_mainSurface->getPixels())[index - (i * 320) + 2] = var1;
+ }
+ }
+
+ if (25 - _scriptHandler->_byte15FFA != 0) {
+// sub16064(23, 25 - _scriptHandler->_byte15FFA);
+ var2 = (25 - _scriptHandler->_byte15FFA) << 2;
+ for (int i = 0; i < var2; i++) {
+ ((byte *)_mainSurface->getPixels())[index - (i * 320)] = 23;
+ ((byte *)_mainSurface->getPixels())[index - (i * 320) + 1] = 23;
+ ((byte *)_mainSurface->getPixels())[index - (i * 320) + 2] = 23;
+ }
+ }
+
+ displayFunction4();
+}
+
void LilliputEngine::pollEvent() {
debugC(2, kDebugEngine, "pollEvent()");
diff --git a/engines/lilliput/lilliput.h b/engines/lilliput/lilliput.h
index 2cb63f9edf..e13cd0a860 100644
--- a/engines/lilliput/lilliput.h
+++ b/engines/lilliput/lilliput.h
@@ -129,8 +129,11 @@ public:
int _word15AC2;
int _word16550;
int _displayStringIndex;
+ int _word1289D;
int _array11D49[40];
+ int _array1289F[40];
+ int _array12861[30];
byte *_rulesChunk1;
int _rulesBuffer2PrevIndx;
@@ -186,6 +189,7 @@ public:
byte _array12299[40];
byte _array109E9[40];
byte _array10A11[40];
+ byte _array16E94[40];
byte _buffer1_45k[45056];
byte _buffer2_45k[45056];
@@ -232,6 +236,10 @@ public:
void sub12F37();
int sub16675(int idx, int var1);
int sub16685(int idx, int var1);
+ void sub16EBC();
+ void sub171CF();
+ void sub12FE5();
+ void displayHeroismIndicator();
void initGame(const LilliputGameDescription *gd);
byte *loadVGA(Common::String filename, bool loadPal);
diff --git a/engines/lilliput/script.h b/engines/lilliput/script.h
index 668040d499..3521ad1e4b 100644
--- a/engines/lilliput/script.h
+++ b/engines/lilliput/script.h
@@ -34,6 +34,7 @@ class LilliputScript {
public:
byte _byte16F08;
byte _byte12A04;
+ byte _byte15FFA;
byte _array10B29[40];
byte _array122E9[20];
@@ -42,11 +43,15 @@ public:
byte _array16173[40];
byte _array12811[40];
byte _array10AB1[40];
+ byte _array122FD[20];
+ byte *_savedBuffer215Ptr;
int _word12A00;
int _word12A02;
int _word10802;
int _word1881B;
+ int _word15FFB;
+ int _word15FFD;
short _array12311[640];
@@ -64,22 +69,17 @@ private:
byte _byte16F05_ScriptHandler;
byte _byte12A09;
byte _byte129A0;
- byte _byte15FFA;
byte _byte1855D;
byte _byte10806;
byte _byte12FE4;
byte _byte16F02;
- byte *_savedBuffer215Ptr;
- byte _array122FD[20];
byte _array128EF[40];
byte _array12839[40];
byte _array10B51[40 * 40];
int _word16F00;
int _word10804;
- int _word15FFB;
- int _word15FFD;
int _word1855E;
int _word18776;