aboutsummaryrefslogtreecommitdiff
path: root/engines/lilliput
diff options
context:
space:
mode:
authorStrangerke2012-05-11 23:32:26 +0200
committerEugene Sandulenko2018-03-28 17:36:57 +0200
commit4fe3a02154c3563de5a07043a20b4863b5354b89 (patch)
tree8db88b267fef26e8010428db096d594932443c9c /engines/lilliput
parent72b99e99e46a3f7b69e3894ba6a552204f069638 (diff)
downloadscummvm-rg350-4fe3a02154c3563de5a07043a20b4863b5354b89.tar.gz
scummvm-rg350-4fe3a02154c3563de5a07043a20b4863b5354b89.tar.bz2
scummvm-rg350-4fe3a02154c3563de5a07043a20b4863b5354b89.zip
LILLIPUT: More renaming
Diffstat (limited to 'engines/lilliput')
-rw-r--r--engines/lilliput/lilliput.cpp164
-rw-r--r--engines/lilliput/lilliput.h9
-rw-r--r--engines/lilliput/script.cpp97
-rw-r--r--engines/lilliput/script.h22
4 files changed, 146 insertions, 146 deletions
diff --git a/engines/lilliput/lilliput.cpp b/engines/lilliput/lilliput.cpp
index b9e5ded185..b710d0b9e6 100644
--- a/engines/lilliput/lilliput.cpp
+++ b/engines/lilliput/lilliput.cpp
@@ -144,11 +144,10 @@ LilliputEngine::LilliputEngine(OSystem *syst, const LilliputGameDescription *gd)
_byte12A07 = 0;
_byte12A08 = 0;
_byte12A09 = 0;
- _byte1881D = 0;
_byte16552 = 0;
_byte12FE4 = 0xFF;
_byte12FE3 = 0;
- _byte16F08 = 0;
+ _byte16F08 = 0;
_byte16C9F = 0;
_lastAnimationTick = 0;
@@ -261,7 +260,7 @@ void LilliputEngine::newInt8() {
}
--_byte12A06;
// TODO: check 'out 20h, 20h'
-
+
// hack for the title stars because _int8installed is not set at the good place for the moment
//if (!_int8installed)
// return;
@@ -331,7 +330,7 @@ void LilliputEngine::displayCharacter(int index, Common::Point pos, int flags) {
// Sprite mirror
for (int y = 0; y < 16; y++) {
for (int x = 0; x < 16; x++) {
- // May need a hack of 1 pixel
+ // May need a hack of 1 pixel
if (src[15 - x] != 0)
buf[x] = src[15 - x];
}
@@ -382,9 +381,8 @@ void LilliputEngine::SaveSurfaceUnderMouseCursor(byte *buf, Common::Point pos) {
}
}
-// Fill 16x16 rect
-void LilliputEngine::displayFunction3(int var1, int var2, int var4) {
- debugC(2, kDebugEngineTBC, "displayFunction3(%d, %d, %d)", var1, var2, var4);
+void LilliputEngine::fill16x16Rect(int var1, int var2, int var4) {
+ debugC(2, kDebugEngineTBC, "fill16x16Rect(%d, %d, %d)", var1, var2, var4);
int tmpVal = ((var4 >> 8) + (var4 & 0xFF));
int index = var2 + tmpVal + (tmpVal >> 2);
@@ -744,7 +742,7 @@ void LilliputEngine::moveCharacters() {
_characterDisplayY[i] = (20 + tmpVal2 + tmpVal3 - tmpVal4) & 0xFF;
_charactersToDisplay[_numCharactersToDisplay] = i;
++_numCharactersToDisplay;
- }
+ }
}
sortCharacters();
@@ -802,7 +800,7 @@ void LilliputEngine::displayFunction16() {
if (_displayMap == 1) {
bool forceReturnFl = false;
- sub15F31(forceReturnFl);
+ checkMapClosing(forceReturnFl);
if (forceReturnFl)
return;
@@ -815,7 +813,7 @@ void LilliputEngine::displayFunction16() {
displayCharactersOnMap();
} else {
scrollToViewportCharacterTarget();
- sub189DE();
+ checkSpeechClosing();
prepareGameArea();
displayGameArea();
sub16626();
@@ -907,7 +905,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;
@@ -946,7 +944,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) {
@@ -956,7 +954,7 @@ int LilliputEngine::sub16DD5(int x1, int y1, int x2, int y2) {
isoMap += word16DCF;
var1 += byte16DD4;
}
-
+
count++;
if (count == dy) {
return 0;
@@ -970,12 +968,12 @@ void LilliputEngine::sub15F75() {
_byte129A0 = 0xFF;
_savedMousePosDivided = Common::Point(-1, -1);
- byte newX = _mousePos.x >> 2;
+ byte newX = _mousePos.x >> 2;
byte newY = _mousePos.y / 3;
if ((newX >= 64) || (newY >= 64))
return;
-
+
_savedMousePosDivided = Common::Point(newX, newY);
_byte16F07_menuId = 5;
}
@@ -989,22 +987,22 @@ void LilliputEngine::sub130B6() {
}
}
-void LilliputEngine::sub15F31(bool &forceReturnFl) {
- debugC(2, kDebugEngineTBC, "sub15F31()");
+void LilliputEngine::checkMapClosing(bool &forceReturnFl) {
+ debugC(2, kDebugEngineTBC, "checkMapClosing()");
forceReturnFl = false;
if (_displayMap != 1)
return;
pollEvent();
- warning("sub15F31- TODO: Check keyboard");
+ warning("checkMapClosing- TODO: Check keyboard");
if ((_mouseButton & 1) == 0)
return;
_mouseButton = 0;
sub15F75();
-
+
_displayMap = 0;
paletteFadeOut();
_word15AC2 = 0;
@@ -1028,20 +1026,20 @@ void LilliputEngine::sub16CA0() {
for (int index2 = _numCharacters - 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->_array16123PosX[index2];
int d2 = _scriptHandler->_array1614BPosY[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) {
@@ -1055,7 +1053,7 @@ void LilliputEngine::sub16CA0() {
_byte16C9F = 3;
if (sub16DD5(c1, d1, c2, d2) != 0)
- _byte16C9F = 1;
+ _byte16C9F = 1;
}
} else if (_characterDirectionArray[index] == 1) {
if (d2 < c2) {
@@ -1065,7 +1063,7 @@ void LilliputEngine::sub16CA0() {
_byte16C9F = 3;
if (sub16DD5(c1, d1, c2, d2) != 0)
- _byte16C9F = 1;
+ _byte16C9F = 1;
}
} else if (_characterDirectionArray[index] == 2) {
if (d2 > c2) {
@@ -1075,7 +1073,7 @@ void LilliputEngine::sub16CA0() {
_byte16C9F = 3;
if (sub16DD5(c1, d1, c2, d2) != 0)
- _byte16C9F = 1;
+ _byte16C9F = 1;
}
} else {
if (d1 < c1) {
@@ -1085,7 +1083,7 @@ void LilliputEngine::sub16CA0() {
_byte16C9F = 3;
if (sub16DD5(c1, d1, c2, d2) != 0)
- _byte16C9F = 1;
+ _byte16C9F = 1;
}
}
}
@@ -1100,7 +1098,7 @@ void LilliputEngine::sub16CA0() {
_scriptHandler->_characterScriptEnabled[index] = 1;
val = (val & 0xFF00) | _byte16C9F;
}
- _scriptHandler->_array10B51[index2 + index * 40] = val;
+ _scriptHandler->_array10B51[index2 + index * 40] = val;
}
@@ -1109,13 +1107,13 @@ void LilliputEngine::sub16CA0() {
void LilliputEngine::displayFunction18(int var1, int var2, int var3, int var4) {
debugC(2, kDebugEngineTBC, "displayFunction18(%d, %d, %d, %d)", var1, var2, var3, var4);
-
+
restoreSurfaceUnderMousePointer();
-
+
if ((var1 & 0xFF) == 0x2D) {
var2 += 35;
var3 -= 35;
-
+
if (var3 < 0) {
var2 += var3;
var3 = -var3;
@@ -1125,17 +1123,17 @@ void LilliputEngine::displayFunction18(int var1, int var2, int var3, int var4) {
byte *vgaBuf = (byte *)_mainSurface->getPixels();
int tmpVal = (var3 >> 8) + ((var3 & 0xFF) << 8);
int vgaIndex = var2 + tmpVal + (tmpVal >> 2);
-
+
if (var3 == 0)
++var3;
-
+
for (int i = 0; i < 4; i++) {
for (int j = 0; j < var3; j++) {
vgaBuf[vgaIndex + j] = 2;
}
vgaIndex += 320;
}
-
+
displayMousePointer();
}
@@ -1181,8 +1179,8 @@ void LilliputEngine::sortCharacters() {
for (int var2 = 0; var2 < var4; var2++) {
int index1 = _charactersToDisplay[var2];
int index2 = _charactersToDisplay[var2 + 1];
-
- if (_characterRelativePositionY[index1] < _characterRelativePositionY[index2])
+
+ if (_characterRelativePositionY[index1] < _characterRelativePositionY[index2])
continue;
if (_characterRelativePositionY[index1] == _characterRelativePositionY[index2]) {
@@ -1273,7 +1271,7 @@ void LilliputEngine::viewportScrollTo(Common::Point goalPos) {
do {
_scriptHandler->_viewportPos.x += dx;
_scriptHandler->_viewportPos.y += dy;
-
+
displayLandscape();
prepareGameArea();
displayGameArea();
@@ -1305,7 +1303,7 @@ void LilliputEngine::renderCharacters(byte *buf, Common::Point pos) {
int index = _charactersToDisplay[_currentDisplayCharacter];
Common::Point characterPos = Common::Point(_characterDisplayX[index], _characterDisplayY[index]);
- if (index == _scriptHandler->_word1881B)
+ if (index == _scriptHandler->_talkingCharacter)
sub1546F(characterPos);
if (_byte16552 != 1) {
@@ -1316,7 +1314,7 @@ void LilliputEngine::renderCharacters(byte *buf, Common::Point pos) {
frame += _scriptHandler->_array10AB1[index];
if ((flag & 1) == 1)
frame += _spriteSizeArray[index];
-
+
if (_array12299[index] != 0xFF) {
frame = _array12299[index] + 82;
--_array12299[index];
@@ -1335,47 +1333,47 @@ void LilliputEngine::renderCharacters(byte *buf, Common::Point pos) {
void LilliputEngine::sub1546F(Common::Point displayPos) {
debugC(2, kDebugEngineTBC, "sub1546F(%d, %d)", displayPos.x, displayPos.y);
-
+
int orgX = displayPos.x + 8;
int orgY = displayPos.y;
int var2 = 0;
-
+
int x = orgX;
int y = orgY;
do {
- sub15498(x, y, var2);
+ sub15498(Common::Point(x, y), var2);
--x;
y >>= 1;
} while (y != 0);
-
+
x = orgX + 1;
y = orgY >> 1;
-
+
while (y != 0) {
- sub15498(x, y, var2);
+ sub15498(Common::Point(x, y), var2);
++x;
y >>= 1;
}
}
-void LilliputEngine::sub15498(byte x, byte y, int var2) {
- debugC(2, kDebugEngineTBC, "sub15498(%d, %d, %d)", x, y, var2);
-
- int index = x + ((var2 & 0xFF) << 8) + (var2 >> 8);
- for (int i = 1 + y - var2; i > 0; i--) {
+void LilliputEngine::sub15498(Common::Point pos, int var2) {
+ debugC(2, kDebugEngineTBC, "sub15498(%d - %d, %d)", pos.x, pos.y, var2);
+
+ int index = pos.x + ((var2 & 0xFF) << 8) + (var2 >> 8);
+ for (int i = 1 + pos.y - var2; i > 0; i--) {
_savedSurfaceGameArea1[index] = 17;
index += 256;
}
}
-void LilliputEngine::sub189DE() {
- debugC(2, kDebugEngineTBC, "sub189DE()");
+void LilliputEngine::checkSpeechClosing() {
+ debugC(2, kDebugEngineTBC, "checkSpeechClosing()");
- if (_byte1881D != 0) {
- --_byte1881D;
- if (_byte1881D == 0) {
+ if (_scriptHandler->_speechTimer != 0) {
+ --_scriptHandler->_speechTimer;
+ if (_scriptHandler->_speechTimer == 0) {
restoreSurfaceSpeech();
- _scriptHandler->_word1881B = -1;
+ _scriptHandler->_talkingCharacter = -1;
}
}
}
@@ -1439,24 +1437,24 @@ byte LilliputEngine::sub16799(int index, Common::Point param1) {
void LilliputEngine::sub167EF(int index) {
debugC(2, kDebugEngineTBC, "sub167EF(%d)", index);
-
+
int word167EB = findHotspot(Common::Point(_scriptHandler->_array16123PosX[index], _scriptHandler->_array1614BPosY[index]));
int word167ED = findHotspot(Common::Point(_array10999PosX[index], _array109C1PosY[index]));
-
+
if (word167EB == word167ED) {
_array109E9PosX[index] = _array10999PosX[index];
_array10A11PosY[index] = _array109C1PosY[index];
return;
}
-
+
if (word167EB == -1) {
int tmpVal = reverseFindHotspot(Common::Point(_array10999PosX[index], _array109C1PosY[index]));
_array109E9PosX[index] = _rulesBuffer12Pos4[tmpVal].x;
_array10A11PosY[index] = _rulesBuffer12Pos4[tmpVal].y;
return;
}
-
- if ((word167ED != -1) &&
+
+ if ((word167ED != -1) &&
(_array10999PosX[index] >= (_rectXMinMax[word167EB] >> 8)) &&
(_array10999PosX[index] <= (_rectXMinMax[word167EB] & 0xFF)) &&
(_array109C1PosY[index] >= (_rectYMinMax[word167EB] >> 8)) &&
@@ -1465,18 +1463,18 @@ void LilliputEngine::sub167EF(int index) {
_array10A11PosY[index] = _rulesBuffer12Pos4[word167ED].y;
return;
}
-
+
_array109E9PosX[index] = _rulesBuffer12Pos4[word167EB].x;
_array10A11PosY[index] = _rulesBuffer12Pos4[word167EB].y;
int var4h = (_rectXMinMax[index] >> 8);
int var4l = (_rectXMinMax[index] & 0xFF);
-
+
if (var4h != var4l) {
if (_array109E9PosX[index] == var4h) {
--_array109E9PosX[index];
return;
}
-
+
if (_array109E9PosX[index] == var4l) {
++_array109E9PosX[index];
return;
@@ -1493,7 +1491,7 @@ void LilliputEngine::sub167EF(int index) {
return;
}
}
-
+
// var4h == var4l
int mapIndex = (((_array10A11PosY[index] << 8) >> 2) + _array109E9PosX[index]) << 2;
int tmpVal = _bufferIsoMap[mapIndex + 3];
@@ -1503,25 +1501,25 @@ void LilliputEngine::sub167EF(int index) {
--_array10A11PosY[index];
else if ((tmpVal & 2) != 0)
++_array10A11PosY[index];
- else
+ else
--_array109E9PosX[index];
-
+
return;
}
void LilliputEngine::sub1693A(int index) {
debugC(2, kDebugEngineTBC, "sub1693A(%d)", index);
-
+
static const uint16 _array1692F[4] = {4, 0xFF00, 0x100, 0xFFFC};
_word16937Pos = Common::Point(_scriptHandler->_array16123PosX[index], _scriptHandler->_array1614BPosY[index]);
sub16A08(index);
-
+
int var2 = (_characterDirectionArray[index] ^ 3);
_array1692B[var2] += 0xF8;
_byte16939 = 0;
-
+
int mapIndex = ((((_word16937Pos.y << 8) >> 2) + _word16937Pos.x) << 2);
int subMapIndex = 0;
int retVal = 0;
@@ -1531,7 +1529,7 @@ void LilliputEngine::sub1693A(int index) {
if ((_bufferIsoMap[mapIndex + subMapIndex + 3] & 0x80) != 0) {
if (sub16A76(i, index) != 0)
_array1692B[i] += 0xEC;
-
+
int tmpVal = ((_rulesBuffer2_10[index] & 7) ^ 7);
retVal = _rulesChunk9[_bufferIsoMap[mapIndex + subMapIndex]];
tmpVal &= retVal;
@@ -1553,7 +1551,7 @@ void LilliputEngine::sub1693A(int index) {
tmpVal = _array1692B[i];
}
}
-
+
_characterDirectionArray[index] = retVal;
}
@@ -1562,7 +1560,7 @@ byte LilliputEngine::sub16A76(int indexb, int indexs) {
static const char _array16A6C[4] = {1, 0, 0, -1};
static const char _array16A70[4] = {0, -1, 1, 0};
-
+
char var1h = _word16937Pos.x + _array16A6C[indexb];
char var1l = _word16937Pos.y + _array16A70[indexs];
@@ -1648,7 +1646,7 @@ void LilliputEngine::addCharToBuf(byte character) {
void LilliputEngine::prepareGoldAmount(int param1) {
debugC(2, kDebugEngineTBC, "prepareGoldAmount(%d)", param1);
-
+
static const int _array18AE3[6] = {10000, 1000, 100, 10, 1};
int count;
@@ -1664,7 +1662,7 @@ void LilliputEngine::prepareGoldAmount(int param1) {
--count;
byte tmpVal = count + 0x30;
-
+
if (i == 4)
addCharToBuf(tmpVal);
else if ((count != 0) || (!hideZeros)) {
@@ -1771,7 +1769,7 @@ byte LilliputEngine::sub166F7(int index, Common::Point var1, int tmpVal) {
byte LilliputEngine::sub166DD(int index, Common::Point var1) {
debugC(2, kDebugEngineTBC, "sub166DD(%d, %d - %d)", index, var1.x, var1.y);
-
+
_characterDirectionArray[index] = (var1.x & 3);
sub16685(index, var1);
return 0;
@@ -1821,7 +1819,7 @@ void LilliputEngine::sub16EBC() {
int index2 = 3;
for (int index1 = _numCharacters - 1; index1 >= 0; index1--) {
- int var2 = (_scriptHandler->_array1614BPosY[index1] << 8) + (_scriptHandler->_array16123PosX[index1] << 2);
+ int var2 = (_scriptHandler->_array1614BPosY[index1] << 8) + (_scriptHandler->_array16123PosX[index1] << 2);
int var1 = (_bufferIsoMap[index2 + var2] & 0x40);
if (var1 == _array16E94[index1])
@@ -1848,7 +1846,7 @@ void LilliputEngine::sub12F37() {
--varPtr[0];
if (varPtr[0] == 1)
_scriptHandler->_characterScriptEnabled[index2] = 1;
- }
+ }
}
index1 += 32;
@@ -2006,7 +2004,7 @@ byte LilliputEngine::sub16675(int idx, Common::Point var1) {
debugC(2, kDebugEngineTBC, "sub16675(%d, %d - %d)", idx, var1.x, var1.y);
sub16685(idx, var1);
- int index = var1.y;
+ int index = var1.y;
switch (var1.x) {
case 0:
break;
@@ -2174,7 +2172,7 @@ void LilliputEngine::sub17224(int var1, int var4) {
sub17264(var1, var4);
return;
}
-
+
if (type == 3) {
for (int i = _numCharacters - 1; i >= 0; i--)
sub17264(i, var4);
@@ -2267,7 +2265,7 @@ void LilliputEngine::displayHeroismIndicator() {
}
_scriptHandler->_heroismLevel += var2;
-
+
int index = _scriptHandler->_heroismBarX + _scriptHandler->_heroismBarBottomY * 320 ;
var2 = _scriptHandler->_heroismLevel & 0xFF;
@@ -2319,7 +2317,7 @@ void LilliputEngine::pollEvent() {
break;
}
}
-
+
if (_mousePos != _oldMousePos) {
_oldMousePos = _mousePos;
if (_skipDisplayFlag1 != 0) {
@@ -2420,7 +2418,7 @@ void LilliputEngine::loadRules() {
error("Missing game file ERULES.PRG");
_word10800_ERULES = f.readUint16LE();
-
+
// Chunk 1
int size = f.readUint16LE();
_rulesChunk1 = (byte *)malloc(sizeof(byte) * size);
@@ -2729,7 +2727,7 @@ Common::Error LilliputEngine::run() {
_scriptHandler->runScript(ScriptStream(_initScript, _initScriptSize));
- // Hack, see above
+ // Hack, see above
_int8installed = true;
while(!_shouldQuit) {
diff --git a/engines/lilliput/lilliput.h b/engines/lilliput/lilliput.h
index efdbdbe6d7..35d6915162 100644
--- a/engines/lilliput/lilliput.h
+++ b/engines/lilliput/lilliput.h
@@ -105,7 +105,6 @@ public:
byte _byte12A07;
byte _byte12A08;
byte _byte12A09;
- byte _byte1881D;
byte _byte16552;
byte _byte12FE4;
byte _byte12FE3;
@@ -221,7 +220,7 @@ public:
void display16x16IndexedBuf(byte *buf, int var1, Common::Point pos);
void display16x16Buf(byte *buf, Common::Point pos);
void SaveSurfaceUnderMouseCursor(byte *buf, Common::Point pos);
- void displayFunction3(int var1, int var2, int var4);
+ void fill16x16Rect(int var1, int var2, int var4);
void displayMousePointer();
void restoreSurfaceUnderMousePointer();
void saveSurfaceGameArea();
@@ -252,7 +251,7 @@ public:
void sortCharacters();
void scrollToViewportCharacterTarget();
void viewportScrollTo(Common::Point goalPos);
- void sub189DE();
+ void checkSpeechClosing();
void sub16626();
void sub16A08(int index);
byte sub16A76(int indexb, int indexs);
@@ -289,9 +288,9 @@ public:
void sub131B2(Common::Point pos, bool &forceReturnFl);
void sub131FC(Common::Point pos);
void sub1546F(Common::Point displayPos);
- void sub15498(byte x, byte y, int var2);
+ void sub15498(Common::Point pos, int var2);
void sub15A4C(int &vgaIndex, byte *srcBuf, int &bufIndex);
- void sub15F31(bool &forceReturnFl);
+ void checkMapClosing(bool &forceReturnFl);
void sub16B63(int index);
void sub16B76(int index);
void sub166C0(int index);
diff --git a/engines/lilliput/script.cpp b/engines/lilliput/script.cpp
index 74171e3641..bd5bb1e4ce 100644
--- a/engines/lilliput/script.cpp
+++ b/engines/lilliput/script.cpp
@@ -36,8 +36,8 @@ LilliputScript::LilliputScript(LilliputEngine *vm) : _vm(vm), _currScript(NULL)
_byte16F04 = 0;
_byte1881A = 0;
_byte18823 = 0;
- _byte1881E = 3;
- _byte1881D = 0;
+ _speechDisplaySpeed = 3;
+ _speechTimer = 0;
_word16F00 = -1;
_word129A3 = 0;
_viewportCharacterTarget = -1;
@@ -251,22 +251,22 @@ void LilliputScript::handleOpcodeType2(int curWord) {
OC_sub17A3E();
break;
case 0x2:
- OC_sub17D57();
+ OC_sub17D57_speech1();
break;
case 0x3:
- OC_sub17D7F();
+ OC_sub17D7F_speech2();
break;
case 0x4:
- OC_sub17DB9();
+ OC_sub17DB9_speech3();
break;
case 0x5:
- OC_sub17DF9();
+ OC_sub17DF9_speech1param();
break;
case 0x6:
- OC_sub17E07();
+ OC_sub17E07_speech4param();
break;
case 0x7:
- OC_sub17E15();
+ OC_sub17E15_speech2param();
break;
case 0x8:
OC_sub17B03();
@@ -287,7 +287,7 @@ void LilliputScript::handleOpcodeType2(int curWord) {
OC_sub17B93();
break;
case 0xE:
- OC_sub17E37();
+ OC_sub17E37_speech4();
break;
case 0xF:
OC_resetByte1714E();
@@ -485,7 +485,7 @@ void LilliputScript::handleOpcodeType2(int curWord) {
OC_loadFile_AERIAL_GFX();
break;
case 0x50:
- OC_sub17E22();
+ OC_sub17E22_speech1IfSoundOff();
break;
case 0x51:
OC_sub1844A();
@@ -613,19 +613,19 @@ static const OpCode opCodes1[] = {
static const OpCode opCodes2[] = {
/* 0x00 */ { "OC_setWord18821", 1, kGetValue1, kNone, kNone, kNone, kNone },
/* 0x01 */ { "OC_sub17A3E", 3, kgetPosFromScript, kImmediateValue, kImmediateValue, kNone, kNone },
-/* 0x02 */ { "OC_sub17D57", 1, kImmediateValue, kNone, kNone, kNone, kNone },
-/* 0x03 */ { "OC_sub17D7F", 4, kGetValue1, kImmediateValue, kImmediateValue, kImmediateValue, kNone },
-/* 0x04 */ { "OC_sub17DB9", 2, kImmediateValue, kImmediateValue, kNone, kNone, kNone }, // todo
-/* 0x05 */ { "OC_sub17DF9", 1, kImmediateValue, kNone, kNone, kNone, kNone },
-/* 0x06 */ { "OC_sub17E07", 4, kGetValue1, kImmediateValue, kImmediateValue, kImmediateValue, kNone }, // pb
-/* 0x07 */ { "OC_sub17E15", 2, kImmediateValue, kImmediateValue, kNone, kNone, kNone },
+/* 0x02 */ { "OC_sub17D57_speech1", 1, kImmediateValue, kNone, kNone, kNone, kNone },
+/* 0x03 */ { "OC_sub17D7F_speech2", 4, kGetValue1, kImmediateValue, kImmediateValue, kImmediateValue, kNone },
+/* 0x04 */ { "OC_sub17DB9_speech3", 2, kImmediateValue, kImmediateValue, kNone, kNone, kNone }, // todo
+/* 0x05 */ { "OC_sub17DF9_speech1param", 1, kImmediateValue, kNone, kNone, kNone, kNone },
+/* 0x06 */ { "OC_sub17E07_speech4param", 4, kGetValue1, kImmediateValue, kImmediateValue, kImmediateValue, kNone }, // pb
+/* 0x07 */ { "OC_sub17E15_speech2param", 2, kImmediateValue, kImmediateValue, kNone, kNone, kNone },
/* 0x08 */ { "OC_sub17B03", 4, kGetValue1, kImmediateValue, kComputeOperation, kImmediateValue, kNone },
/* 0x09 */ { "OC_getRandom_type2", 3, kGetValue1, kImmediateValue, kImmediateValue, kNone, kNone },
/* 0x0a */ { "OC_setCharacterPosition", 2, kGetValue1, kgetPosFromScript, kNone, kNone, kNone },
/* 0x0b */ { "OC_sub17A8D", 1, kGetValue1, kNone, kNone, kNone, kNone },
/* 0x0c */ { "OC_saveAndQuit", 0, kNone, kNone, kNone, kNone, kNone },
/* 0x0d */ { "OC_sub17B93", 1, kImmediateValue, kNone, kNone, kNone, kNone }, // todo : jump to other opcode
-/* 0x0e */ { "OC_sub17E37", 0, kNone, kNone, kNone, kNone, kNone }, // todo
+/* 0x0e */ { "OC_sub17E37_speech4", 0, kNone, kNone, kNone, kNone, kNone }, // todo
/* 0x0f */ { "OC_resetByte1714E", 0, kNone, kNone, kNone, kNone, kNone },
/* 0x10 */ { "OC_deleteSavegameAndQuit", 0, kNone, kNone, kNone, kNone, kNone },
/* 0x11 */ { "OC_incByte16F04", 0, kNone, kNone, kNone, kNone, kNone },
@@ -691,7 +691,7 @@ static const OpCode opCodes2[] = {
/* 0x4d */ { "OC_sub183A2", 0, kNone, kNone, kNone, kNone, kNone },
/* 0x4e */ { "OC_sub183C6", 2, kImmediateValue, kImmediateValue, kNone, kNone, kNone }, // TODO
/* 0x4f */ { "OC_loadFile_AERIAL_GFX", 1, kImmediateValue, kNone, kNone, kNone, kNone },
-/* 0x50 */ { "OC_sub17E22", 1, kImmediateValue, kNone, kNone, kNone, kNone },
+/* 0x50 */ { "OC_sub17E22_speech1IfSoundOff", 1, kImmediateValue, kNone, kNone, kNone, kNone },
/* 0x51 */ { "OC_sub1844A", 2, kGetValue1, kImmediateValue, kNone, kNone, kNone },
/* 0x52 */ { "OC_sub1847F", 5, kGetValue1, kImmediateValue, kImmediateValue, kImmediateValue, kImmediateValue },
/* 0x53 */ { "OC_displayVGAFile", 1, kImmediateValue, kNone, kNone, kNone, kNone },
@@ -1146,9 +1146,9 @@ void LilliputScript::sub189B8() {
++index;
}
- index /= _byte1881E;
+ index /= _speechDisplaySpeed;
index += 4;
- _byte1881D = index;
+ _speechTimer = index;
_vm->displayFunction10();
_vm->displayFunction11(_vm->_displayStringBuf);
}
@@ -2068,8 +2068,10 @@ byte LilliputScript::OC_checkViewPortCharacterTarget() {
void LilliputScript::OC_setWord18821() {
debugC(1, kDebugScriptTBC, "OC_setWord18821()");
+
_word18821 = getValue1();
}
+
void LilliputScript::OC_sub17A3E() {
debugC(1, kDebugScriptTBC, "OC_sub17A3E()");
Common::Point var1 = getPosFromScript();
@@ -2088,8 +2090,8 @@ void LilliputScript::OC_sub17A3E() {
}
}
-void LilliputScript::OC_sub17D57() {
- debugC(1, kDebugScriptTBC, "OC_sub17D57()");
+void LilliputScript::OC_sub17D57_speech1() {
+ debugC(1, kDebugScriptTBC, "OC_sub17D57_speech1()");
int curWord = _currScript->readUint16LE();
@@ -2098,7 +2100,7 @@ void LilliputScript::OC_sub17D57() {
if (forceReturnFl)
return;
- _word1881B = _vm->_currentScriptCharacter;
+ _talkingCharacter = _vm->_currentScriptCharacter;
sub18B3C(curWord);
}
@@ -2129,8 +2131,8 @@ void LilliputScript::sub18B7C(int var1, int var3) {
decodePackedText(&_vm->_packedStrings[index]);
}
-void LilliputScript::OC_sub17D7F() {
- debugC(1, kDebugScriptTBC, "OC_sub17D7F()");
+void LilliputScript::OC_sub17D7F_speech2() {
+ debugC(1, kDebugScriptTBC, "OC_sub17D7F_speech2()");
int var1 = getCharacterVariablePtr()[0];
int var2 = (_currScript->readUint16LE() & 0xFF);
@@ -2143,13 +2145,13 @@ void LilliputScript::OC_sub17D7F() {
if (forceReturnFl)
return;
- _word1881B = _vm->_currentScriptCharacter;
+ _talkingCharacter = _vm->_currentScriptCharacter;
sub18B7C(var1, var3);
}
-void LilliputScript::OC_sub17DB9() {
- debugC(1, kDebugScriptTBC, "OC_sub17DB9()");
+void LilliputScript::OC_sub17DB9_speech3() {
+ debugC(1, kDebugScriptTBC, "OC_sub17DB9_speech3()");
int index = _currScript->readUint16LE();
int maxValue = sub18BB7(index);
@@ -2165,28 +2167,28 @@ void LilliputScript::OC_sub17DB9() {
if (forceReturnFl)
return;
- _word1881B = _vm->_currentScriptCharacter;
+ _talkingCharacter = _vm->_currentScriptCharacter;
sub18B7C(index, oldVal);
}
-void LilliputScript::OC_sub17DF9() {
- debugC(1, kDebugScriptTBC, "OC_sub17DF9()");
+void LilliputScript::OC_sub17DF9_speech1param() {
+ debugC(1, kDebugScriptTBC, "OC_sub17DF9_speech1param()");
- if ((_word1881B & 0xFF) == 0xFF) {
- OC_sub17D57();
+ if (_talkingCharacter == -1) {
+ OC_sub17D57_speech1();
return;
}
_currScript->readUint16LE();
}
-void LilliputScript::OC_sub17E07() {
- debugC(1, kDebugScriptTBC, "OC_sub17E07()");
+void LilliputScript::OC_sub17E07_speech4param() {
+ debugC(1, kDebugScriptTBC, "OC_sub17E07_speech4param()");
- if ((_word1881B & 0xFF) == 0xFF) {
- OC_sub17D7F();
+ if (_talkingCharacter == -1) {
+ OC_sub17D7F_speech2();
return;
}
_currScript->readUint16LE();
@@ -2196,11 +2198,11 @@ void LilliputScript::OC_sub17E07() {
}
-void LilliputScript::OC_sub17E15() {
- debugC(1, kDebugScriptTBC, "OC_sub17E15()");
+void LilliputScript::OC_sub17E15_speech2param() {
+ debugC(1, kDebugScriptTBC, "OC_sub17E15_speech2param()");
- if ((_word1881B & 0xFF) == 0xFF) {
- OC_sub17DB9();
+ if (_talkingCharacter == -1) {
+ OC_sub17DB9_speech3();
return;
}
_currScript->readUint16LE();
@@ -2264,8 +2266,8 @@ void LilliputScript::OC_sub17B93() {
sub17B6C(var1);
}
-void LilliputScript::OC_sub17E37() {
- warning("OC_sub17E37");
+void LilliputScript::OC_sub17E37_speech4() {
+ warning("OC_sub17E37_speech4");
}
void LilliputScript::OC_resetByte1714E() {
@@ -2989,7 +2991,7 @@ void LilliputScript::OC_loadFile_AERIAL_GFX() {
_vm->_byte15EAD = var1;
_byte12A09 = 1;
- _word1881B = -1;
+ _talkingCharacter = -1;
OC_PaletteFadeOut();
_vm->_word15AC2 = 1;
_vm->displayVGAFile("AERIAL.GFX");
@@ -3003,9 +3005,10 @@ void LilliputScript::OC_loadFile_AERIAL_GFX() {
_vm->_byte12A09 = 0;
}
-void LilliputScript::OC_sub17E22() {
- warning("OC_sub17E22");
+void LilliputScript::OC_sub17E22_speech1IfSoundOff() {
+ warning("OC_sub17E22_speech1IfSoundOff");
}
+
void LilliputScript::OC_sub1844A() {
warning("OC_sub1844A");
}
@@ -3049,7 +3052,7 @@ void LilliputScript::OC_displayVGAFile() {
int curWord = _currScript->readUint16LE();
int index = _vm->_packedStringIndex[curWord];
Common::String fileName = Common::String((const char *)&_vm->_packedStrings[index]);
- _word1881B = -1;
+ _talkingCharacter = -1;
_vm->displayVGAFile(fileName);
_vm->paletteFadeIn();
}
diff --git a/engines/lilliput/script.h b/engines/lilliput/script.h
index bae66cca7a..1de19bf193 100644
--- a/engines/lilliput/script.h
+++ b/engines/lilliput/script.h
@@ -57,6 +57,7 @@ struct OpCode {
class LilliputScript {
public:
byte _heroismLevel;
+ byte _speechTimer;
byte _characterScriptEnabled[40];
byte _array122E9[20];
@@ -73,7 +74,7 @@ public:
Common::Point _viewportPos;
int _viewportCharacterTarget;
- int _word1881B;
+ int _talkingCharacter;
int _heroismBarX;
int _heroismBarBottomY;
@@ -106,8 +107,7 @@ private:
byte _byte16F04;
byte _byte1881A;
byte _byte18823;
- byte _byte1881E;
- byte _byte1881D;
+ byte _speechDisplaySpeed;
int _word16F00;
int _word18776;
@@ -199,19 +199,19 @@ private:
// Opcodes Type 2
void OC_setWord18821();
void OC_sub17A3E();
- void OC_sub17D57();
- void OC_sub17D7F();
- void OC_sub17DB9();
- void OC_sub17DF9();
- void OC_sub17E07();
- void OC_sub17E15();
+ void OC_sub17D57_speech1();
+ void OC_sub17D7F_speech2();
+ void OC_sub17DB9_speech3();
+ void OC_sub17DF9_speech1param();
+ void OC_sub17E07_speech4param();
+ void OC_sub17E15_speech2param();
void OC_sub17B03();
void OC_getRandom_type2();
void OC_setCharacterPosition();
void OC_sub17A8D();
void OC_saveAndQuit();
void OC_sub17B93();
- void OC_sub17E37();
+ void OC_sub17E37_speech4();
void OC_resetByte1714E();
void OC_deleteSavegameAndQuit();
void OC_incByte16F04();
@@ -278,7 +278,7 @@ private:
void OC_sub183A2();
void OC_sub183C6();
void OC_loadFile_AERIAL_GFX();
- void OC_sub17E22();
+ void OC_sub17E22_speech1IfSoundOff();
void OC_sub1844A();
void OC_sub1847F();
void OC_displayVGAFile();