aboutsummaryrefslogtreecommitdiff
path: root/engines/lilliput
diff options
context:
space:
mode:
authorStrangerke2012-04-30 17:57:23 +0200
committerEugene Sandulenko2018-03-28 17:36:57 +0200
commitc77a3e2e5184f8ebaf2eb45594c5c9b52bba4675 (patch)
tree18482ba4599ce9b751653080cde6ec8fdc7edba8 /engines/lilliput
parentab3b7972e0dfdaa9912b22bb60f581231423032e (diff)
downloadscummvm-rg350-c77a3e2e5184f8ebaf2eb45594c5c9b52bba4675.tar.gz
scummvm-rg350-c77a3e2e5184f8ebaf2eb45594c5c9b52bba4675.tar.bz2
scummvm-rg350-c77a3e2e5184f8ebaf2eb45594c5c9b52bba4675.zip
LILLIPUT: Some renaming
Diffstat (limited to 'engines/lilliput')
-rw-r--r--engines/lilliput/lilliput.cpp52
-rw-r--r--engines/lilliput/lilliput.h10
-rw-r--r--engines/lilliput/script.cpp41
-rw-r--r--engines/lilliput/script.h6
4 files changed, 57 insertions, 52 deletions
diff --git a/engines/lilliput/lilliput.cpp b/engines/lilliput/lilliput.cpp
index a021829ada..aee940e2fb 100644
--- a/engines/lilliput/lilliput.cpp
+++ b/engines/lilliput/lilliput.cpp
@@ -193,12 +193,12 @@ LilliputEngine::LilliputEngine(OSystem *syst, const LilliputGameDescription *gd)
_characterPositionX[i] = 0xFFFF;
_characterPositionY[i] = 0xFFFF;
_rulesBuffer2_3[i] = 0;
- _rulesBuffer2_4[i] = 0;
+ _characterFrameArray[i] = 0;
_rulesBuffer2_5[i] = 0xFF;
_rulesBuffer2_6[i] = 4;
_rulesBuffer2_7[i] = 0;
- _rulesBuffer2_8[i] = 20;
- _rulesBuffer2_9[i] = 0;
+ _spriteSizeArray[i] = 20;
+ _characterDirectionArray[i] = 0;
_rulesBuffer2_10[i] = 0;
_rulesBuffer2_11[i] = 0;
_rulesBuffer2_12[i] = 0;
@@ -295,8 +295,8 @@ Common::Platform LilliputEngine::getPlatform() const {
return _platform;
}
-void LilliputEngine::displayFunction18(int index, int x, int y, int flags) {
- debugC(2, kDebugEngine, "displayFunction18(%d, %d, %d, %d)", index, x, y, flags);
+void LilliputEngine::displayCharacter(int index, int x, int y, int flags) {
+ debugC(2, kDebugEngine, "displayCharacter(%d, %d, %d, %d)", index, x, y, flags);
byte *buf = _buffer1_45k + (y << 8) + x;
@@ -321,9 +321,10 @@ void LilliputEngine::displayFunction18(int index, int x, int y, int flags) {
buf += 256;
}
} else {
-// src += 14;
+ // Sprite mirror
for (int y = 0; y < 16; y++) {
for (int x = 0; x < 16; x++) {
+ // May need a hack of 1 pixel
if (src[15 - x] != 0)
buf[x] = src[15 - x];
}
@@ -689,11 +690,11 @@ void LilliputEngine::sub16217() {
int index2 = _rulesBuffer2_5[i];
_rulesBuffer2_3[i] = _rulesBuffer2_3[index2] + _rulesBuffer2_7[i];
int tmpVal = _rulesBuffer2_6[i];
- _rulesBuffer2_9[i] = _rulesBuffer2_9[index2];
+ _characterDirectionArray[i] = _characterDirectionArray[index2];
int var3 = _characterPositionX[index2];
int var4 = _characterPositionY[index2];
- switch (_rulesBuffer2_9[i]) {
+ switch (_characterDirectionArray[i]) {
case 0:
var3 -= tmpVal;
break;
@@ -1003,7 +1004,7 @@ void LilliputEngine::sub16CA0() {
} else if((_rulesBuffer2_11[index] & 4) != 0) {
_byte16C9F = 0;
} else {
- if (_rulesBuffer2_9[index] == 0) {
+ if (_characterDirectionArray[index] == 0) {
if (d1 > c1) {
_byte16C9F = 2;
@@ -1013,7 +1014,7 @@ void LilliputEngine::sub16CA0() {
if (sub16DD5(c1, d1, c2, d2) != 0)
_byte16C9F = 1;
}
- } else if (_rulesBuffer2_9[index] == 1) {
+ } else if (_characterDirectionArray[index] == 1) {
if (d2 < c2) {
_byte16C9F = 2;
@@ -1023,7 +1024,7 @@ void LilliputEngine::sub16CA0() {
if (sub16DD5(c1, d1, c2, d2) != 0)
_byte16C9F = 1;
}
- } else if (_rulesBuffer2_9[index] == 2) {
+ } else if (_characterDirectionArray[index] == 2) {
if (d2 > c2) {
_byte16C9F = 2;
@@ -1245,17 +1246,20 @@ void LilliputEngine::renderCharacters(byte *buf, byte x, byte y) {
int displayX = _characterDisplayX[index];
int displayY = _characterDisplayY[index];
+ if ((displayX == 104) && (displayY == 132))
+ warning("");
+
if (index == _scriptHandler->_word1881B)
sub1546F(displayX, displayY);
if (_byte16552 != 1) {
- int flag = _rulesBuffer2_9[index];
- int frame = _rulesBuffer2_4[index];
+ int flag = _characterDirectionArray[index];
+ int frame = _characterFrameArray[index];
if (frame != 0xFFFF) {
frame += _scriptHandler->_array10AB1[index];
if ((flag & 1) == 1)
- frame += _rulesBuffer2_8[index];
+ frame += _spriteSizeArray[index];
if (_array12299[index] != 0xFF) {
frame = _array12299[index] + 82;
@@ -1263,7 +1267,7 @@ void LilliputEngine::renderCharacters(byte *buf, byte x, byte y) {
frame = -frame;
}
- displayFunction18(frame, displayX, displayY, flag);
+ displayCharacter(frame, displayX, displayY, flag);
}
}
@@ -1370,7 +1374,7 @@ int LilliputEngine::sub16799(int param1, int index) {
int var1 = (_scriptHandler->_array16123[index] << 8) + _scriptHandler->_array1614B[index];
int var2 = (_array109E9[index] << 8) + _array10A11[index];
- _rulesBuffer2_9[index] = sub16B0C(var1, var2);
+ _characterDirectionArray[index] = sub16B0C(var1, var2);
warning("sub_1693A");
_scriptHandler->_array12811[index] -= (param1 >> 8) & 0x0F;
@@ -1484,7 +1488,7 @@ void LilliputEngine::sub16626() {
int LilliputEngine::sub166DD(int index, int var1) {
- _rulesBuffer2_9[index] = (var1 >> 8) & 3;
+ _characterDirectionArray[index] = (var1 >> 8) & 3;
sub16685(index, var1 & 0xFF);
return 0;
}
@@ -1728,14 +1732,14 @@ void LilliputEngine::sub16B63(int index) {
debugC(2, kDebugEngine, "sub16B63(%d)", index);
static const byte nextFrame[4] = {1, 3, 0, 2};
- _rulesBuffer2_9[index] = nextFrame[_rulesBuffer2_9[index]];
+ _characterDirectionArray[index] = nextFrame[_characterDirectionArray[index]];
}
void LilliputEngine::sub16B76(int index) {
debugC(2, kDebugEngine, "sub16B76(%d)", index);
static const byte nextFrame[4] = {2, 0, 3, 1};
- _rulesBuffer2_9[index] = nextFrame[_rulesBuffer2_9[index]];
+ _characterDirectionArray[index] = nextFrame[_characterDirectionArray[index]];
}
void LilliputEngine::sub166C0(int index) {
@@ -1791,7 +1795,7 @@ void LilliputEngine::sub16B31(int index, int val) {
int newX = _characterPositionX[index];
int newY = _characterPositionY[index];
- switch (_rulesBuffer2_9[index]) {
+ switch (_characterDirectionArray[index]) {
case 0:
newX += val;
break;
@@ -1805,7 +1809,7 @@ void LilliputEngine::sub16B31(int index, int val) {
newX -= val;
break;
}
- sub16B8F(index, newX, newY, _rulesBuffer2_9[index]);
+ sub16B8F(index, newX, newY, _characterDirectionArray[index]);
}
void LilliputEngine::sub16B8F(int index, int x, int y, int flag) {
@@ -2119,12 +2123,12 @@ void LilliputEngine::loadRules() {
_characterPositionY[j] = curWord;
_rulesBuffer2_3[j] = (f.readUint16LE() & 0xFF);
- _rulesBuffer2_4[j] = f.readUint16LE();
+ _characterFrameArray[j] = f.readUint16LE();
_rulesBuffer2_5[j] = f.readByte();
_rulesBuffer2_6[j] = f.readByte();
_rulesBuffer2_7[j] = f.readByte();
- _rulesBuffer2_8[j] = f.readByte();
- _rulesBuffer2_9[j] = f.readByte();
+ _spriteSizeArray[j] = f.readByte();
+ _characterDirectionArray[j] = f.readByte();
_rulesBuffer2_10[j] = f.readByte();
_rulesBuffer2_11[j] = f.readByte();
_rulesBuffer2_12[j] = f.readByte();
diff --git a/engines/lilliput/lilliput.h b/engines/lilliput/lilliput.h
index 1c15e8a486..e26526e051 100644
--- a/engines/lilliput/lilliput.h
+++ b/engines/lilliput/lilliput.h
@@ -151,12 +151,12 @@ public:
int _characterPositionX[40];
int _characterPositionY[40];
byte _rulesBuffer2_3[40];
- int _rulesBuffer2_4[40];
+ int _characterFrameArray[40];
byte _rulesBuffer2_5[40];
byte _rulesBuffer2_6[40];
byte _rulesBuffer2_7[40];
- byte _rulesBuffer2_8[40];
- byte _rulesBuffer2_9[40];
+ byte _spriteSizeArray[40];
+ byte _characterDirectionArray[40];
byte _rulesBuffer2_10[40];
byte _rulesBuffer2_11[40];
byte _rulesBuffer2_12[40];
@@ -233,7 +233,7 @@ public:
void displayFunction15();
void displayFunction16();
void displayFunction17();
- void displayFunction18(int index, int x, int y, int flags);
+ void displayCharacter(int index, int x, int y, int flags);
void displayString(byte *buf, int var2, int var4);
void displayChar(int index, int var1);
void sub130B6();
@@ -253,8 +253,6 @@ public:
void renderCharacters(byte *buf, byte x, byte y);
- void sub16553(byte *buf);
-
int sub16799(int param1, int index);
int sub16B0C(int param1, int param2);
void addCharToBuf(byte character);
diff --git a/engines/lilliput/script.cpp b/engines/lilliput/script.cpp
index 3186826957..e8bd50cd17 100644
--- a/engines/lilliput/script.cpp
+++ b/engines/lilliput/script.cpp
@@ -209,7 +209,7 @@ byte LilliputScript::handleOpcodeType1(int curWord) {
return OC_sub1795E();
break;
case 0x2A:
- return OC_sub1796E();
+ return OC_checkCharacterDirection();
break;
case 0x2B:
return OC_sub17984();
@@ -410,7 +410,7 @@ void LilliputScript::handleOpcodeType2(int curWord) {
OC_sub18074();
break;
case 0x38:
- OC_sub1808B();
+ OC_setCurrentCharacterDirection();
break;
case 0x39:
OC_sub18099();
@@ -515,7 +515,7 @@ void LilliputScript::handleOpcodeType2(int curWord) {
OC_sub18690();
break;
case 0x5B:
- OC_setWord10802();
+ OC_setViewPortCharacterTarget();
break;
case 0x5C:
OC_sub186A1();
@@ -1850,13 +1850,13 @@ byte LilliputScript::OC_sub1795E() {
return 0;
}
-byte LilliputScript::OC_sub1796E() {
- debugC(1, kDebugScript, "OC_sub1796E()");
+byte LilliputScript::OC_checkCharacterDirection() {
+ debugC(1, kDebugScript, "OC_checkCharacterDirection()");
int var1 = getValue1();
int var2 = _currScript->readUint16LE();
- if (_vm->_rulesBuffer2_9[var1] == var2)
+ if (_vm->_characterDirectionArray[var1] == var2)
return 1;
return 0;
}
@@ -2344,19 +2344,21 @@ void LilliputScript::OC_sub17D23() {
computeOperation(buf, var1, var2 >> 8);
computeOperation(buf + 1, var1, var2 & 0xFF);
}
+
void LilliputScript::OC_sub17E6D() {
debugC(1, kDebugScript, "OC_sub17E6D()");
int var1 = _currScript->readUint16LE();
_vm->_rulesBuffer2_12[_vm->_rulesBuffer2PrevIndx] = (var1 - 2000) & 0xFF;
}
+
void LilliputScript::OC_sub17E7E() {
debugC(2, kDebugScript, "OC_sub17E7E()");
int var1 = _currScript->readUint16LE();
int var2 = _currScript->readUint16LE();
- _vm->_rulesBuffer2_4[_vm->_rulesBuffer2PrevIndx] = var1;
- _vm->_rulesBuffer2_8[_vm->_rulesBuffer2PrevIndx] = var2;
+ _vm->_characterFrameArray[_vm->_rulesBuffer2PrevIndx] = var1;
+ _vm->_spriteSizeArray[_vm->_rulesBuffer2PrevIndx] = var2;
}
@@ -2405,18 +2407,18 @@ void LilliputScript::OC_sub17EF4() {
int var1 = getValue2();
int posTile = sub17285(_vm->_rulesBuffer2PrevIndx);
int dir = _vm->sub16B0C(posTile, var1);
- _vm->_rulesBuffer2_9[_vm->_rulesBuffer2PrevIndx] = dir;
+ _vm->_characterDirectionArray[_vm->_rulesBuffer2PrevIndx] = dir;
}
void LilliputScript::OC_sub17F08() {
debugC(1, kDebugScript, "OC_sub17F08()");
- int var1 = getValue1();
+ int index = getValue1();
- static const byte _array16B04[] = { 0, 2, 0, 1, 3, 2, 3, 1 };
+ static const byte _directionsArray[] = { 0, 2, 0, 1, 3, 2, 3, 1 };
- int dx = _vm->_characterPositionX[var1] - _vm->_characterDisplayX[_vm->_rulesBuffer2PrevIndx];
- int dy = _vm->_characterPositionY[var1] - _vm->_characterDisplayY[_vm->_rulesBuffer2PrevIndx];
+ int dx = _vm->_characterPositionX[index] - _vm->_characterDisplayX[_vm->_rulesBuffer2PrevIndx];
+ int dy = _vm->_characterPositionY[index] - _vm->_characterDisplayY[_vm->_rulesBuffer2PrevIndx];
int flag = 0;
if (dx < 0) {
@@ -2431,7 +2433,7 @@ void LilliputScript::OC_sub17F08() {
flag |= 1;
}
- _vm->_rulesBuffer2_9[_vm->_rulesBuffer2PrevIndx] = _array16B04[flag];
+ _vm->_characterDirectionArray[_vm->_rulesBuffer2PrevIndx] = _directionsArray[flag];
}
void LilliputScript::OC_sub17F4F() {
@@ -2440,6 +2442,7 @@ void LilliputScript::OC_sub17F4F() {
_array10A39[_vm->_rulesBuffer2PrevIndx] = var;
_vm->_array109E9[_vm->_rulesBuffer2PrevIndx] = 0xFF;
}
+
void LilliputScript::OC_sub17F68() {
warning("OC_sub17F68");
}
@@ -2496,10 +2499,10 @@ void LilliputScript::OC_sub18074() {
_vm->_rulesBuffer2_16[(_vm->_rulesBuffer2PrevIndx * 32) + var2] = var1;
}
-void LilliputScript::OC_sub1808B() {
- debugC(1, kDebugScript, "OC_sub1808B()");
+void LilliputScript::OC_setCurrentCharacterDirection() {
+ debugC(1, kDebugScript, "OC_setCurrentCharacterDirection()");
- _vm->_rulesBuffer2_9[_vm->_rulesBuffer2PrevIndx] = (_currScript->readUint16LE() & 0xFF);
+ _vm->_characterDirectionArray[_vm->_rulesBuffer2PrevIndx] = (_currScript->readUint16LE() & 0xFF);
}
void LilliputScript::OC_sub18099() {
@@ -2874,8 +2877,8 @@ void LilliputScript::OC_sub18690() {
warning("OC_sub18690");
}
-void LilliputScript::OC_setWord10802() {
- debugC(1, kDebugScript, "OC_setWord10802()");
+void LilliputScript::OC_setViewPortCharacterTarget() {
+ debugC(1, kDebugScript, "OC_setViewPortCharacterTarget()");
_viewportCharacterTarget = getValue1();
}
diff --git a/engines/lilliput/script.h b/engines/lilliput/script.h
index 24063e4053..b6ddafaec2 100644
--- a/engines/lilliput/script.h
+++ b/engines/lilliput/script.h
@@ -168,7 +168,7 @@ private:
byte OC_sub1792A();
byte OC_sub1793E();
byte OC_sub1795E();
- byte OC_sub1796E();
+ byte OC_checkCharacterDirection();
byte OC_sub17984();
byte OC_checkSavedMousePos();
byte OC_sub179AE();
@@ -234,7 +234,7 @@ private:
void OC_sub1801D();
void OC_sub1805D();
void OC_sub18074();
- void OC_sub1808B();
+ void OC_setCurrentCharacterDirection();
void OC_sub18099();
void OC_sub180C3();
void OC_sub1810A();
@@ -270,7 +270,7 @@ private:
void OC_initArr18560();
void OC_sub18678();
void OC_sub18690();
- void OC_setWord10802();
+ void OC_setViewPortCharacterTarget();
void OC_sub186A1();
void OC_sub186E5_snd();
void OC_sub1870A_snd();