aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorStrangerke2012-05-08 18:36:01 +0200
committerEugene Sandulenko2018-03-28 17:36:57 +0200
commit355f5985606bf214ba4f9895e57f69906b1a01e4 (patch)
treea126e2ffe6b7d7bdc44f648744455ae56fd35eb0 /engines
parent23dc740de4b706a5285ef8e695c5e54ab2533555 (diff)
downloadscummvm-rg350-355f5985606bf214ba4f9895e57f69906b1a01e4.tar.gz
scummvm-rg350-355f5985606bf214ba4f9895e57f69906b1a01e4.tar.bz2
scummvm-rg350-355f5985606bf214ba4f9895e57f69906b1a01e4.zip
LILLIPUT: Rename debug channel in order to doublecheck all function, some more renaming and bugfixing, fix some GCC warnings
Diffstat (limited to 'engines')
-rw-r--r--engines/lilliput/lilliput.cpp258
-rw-r--r--engines/lilliput/lilliput.h15
-rw-r--r--engines/lilliput/script.cpp378
-rw-r--r--engines/lilliput/script.h5
-rw-r--r--engines/lilliput/sound.cpp5
-rw-r--r--engines/lilliput/sound.h1
-rw-r--r--engines/lilliput/stream.cpp2
-rw-r--r--engines/lilliput/stream.h2
8 files changed, 337 insertions, 329 deletions
diff --git a/engines/lilliput/lilliput.cpp b/engines/lilliput/lilliput.cpp
index 2d529fd2c3..63edc9f8f2 100644
--- a/engines/lilliput/lilliput.cpp
+++ b/engines/lilliput/lilliput.cpp
@@ -110,7 +110,9 @@ LilliputEngine::LilliputEngine(OSystem *syst, const LilliputGameDescription *gd)
_system = syst;
DebugMan.addDebugChannel(kDebugEngine, "Engine", "Engine debug level");
DebugMan.addDebugChannel(kDebugScript, "Script", "Script debug level");
- DebugMan.addDebugChannel(kDebugSound, "Sound", "Sound debug level");
+ DebugMan.addDebugChannel(kDebugSound, "Sound", "Sound debug level");
+ DebugMan.addDebugChannel(kDebugEngineTBC, "EngineTBC", "Engine debug level");
+ DebugMan.addDebugChannel(kDebugScriptTBC, "ScriptTBC", "Script debug level");
_console = new LilliputConsole(this);
_rnd = 0;
@@ -134,8 +136,7 @@ LilliputEngine::LilliputEngine(OSystem *syst, const LilliputGameDescription *gd)
_byte12FCE = 0;
_byte129A0 = 0xFF;
_numCharactersToDisplay = 0;
- _nextDisplayCharacterX = 0;
- _nextDisplayCharacterY = 0;
+ _nextDisplayCharacterPos = Common::Point(0, 0);
_byte12A04 = 0;
_byte12A05 = 10;
_byte12A06 = 2;
@@ -299,10 +300,10 @@ Common::Platform LilliputEngine::getPlatform() const {
return _platform;
}
-void LilliputEngine::displayCharacter(int index, int x, int y, int flags) {
- debugC(2, kDebugEngine, "displayCharacter(%d, %d, %d, %d)", index, x, y, flags);
+void LilliputEngine::displayCharacter(int index, Common::Point pos, int flags) {
+ debugC(2, kDebugEngineTBC, "displayCharacter(%d, %d - %d, %d)", index, pos.x, pos.y, flags);
- byte *buf = _buffer1_45k + (y << 8) + x;
+ byte *buf = _buffer1_45k + (pos.y << 8) + pos.x;
byte *src = _bufferMen;
if (index < 0) {
@@ -340,7 +341,7 @@ void LilliputEngine::displayCharacter(int index, int x, int y, int flags) {
// display mouse cursor, if any
void LilliputEngine::displayFunction1(byte *buf, int var1, Common::Point pos) {
- debugC(2, kDebugEngine, "displayFunction1(buf, %d, %d, %d)", var1, pos.x, pos.y);
+ debugC(2, kDebugEngineTBC, "displayFunction1(buf, %d, %d, %d)", var1, pos.x, pos.y);
int index1 = ((var1 & 0xFF) << 8) + (var1 >> 8);
byte *newBuf = &buf[index1];
@@ -361,14 +362,14 @@ void LilliputEngine::displayFunction1(byte *buf, int var1, Common::Point pos) {
}
void LilliputEngine::displayFunction1a(byte *buf, Common::Point pos) {
- debugC(2, kDebugEngine, "displayFunction1a(buf, %d, %d)", pos.x, pos.y);
+ debugC(2, kDebugEngineTBC, "displayFunction1a(buf, %d, %d)", pos.x, pos.y);
displayFunction1(buf, 0, pos);
}
// save area under mouse cursor
void LilliputEngine::displayFunction2(byte *buf, Common::Point pos) {
- debugC(2, kDebugEngine, "displayFunction2(buf, %d, %d)", pos.x, pos.y);
+ debugC(2, kDebugEngineTBC, "displayFunction2(buf, %d, %d)", pos.x, pos.y);
int tmpVal = ((pos.y & 0xFF) << 8) + (pos.y >> 8);
int index2 = pos.x + tmpVal + (tmpVal >> 2);
@@ -383,7 +384,7 @@ void LilliputEngine::displayFunction2(byte *buf, Common::Point pos) {
// Fill 16x16 rect
void LilliputEngine::displayFunction3(int var1, int var2, int var4) {
- debugC(2, kDebugEngine, "displayFunction3(%d, %d, %d)", var1, var2, var4);
+ debugC(2, kDebugEngineTBC, "displayFunction3(%d, %d, %d)", var1, var2, var4);
int tmpVal = ((var4 >> 8) + (var4 & 0xFF));
int index = var2 + tmpVal + (tmpVal >> 2);
@@ -398,7 +399,7 @@ void LilliputEngine::displayFunction3(int var1, int var2, int var4) {
// display mouse cursor
void LilliputEngine::displayFunction4() {
- debugC(2, kDebugEngine, "displayFunction4()");
+ debugC(2, kDebugEngineTBC, "displayFunction4()");
if ((_skipDisplayFlag1 != 1) && (_skipDisplayFlag2 != 1)) {
_skipDisplayFlag2 = 1;
@@ -413,7 +414,7 @@ void LilliputEngine::displayFunction4() {
}
void LilliputEngine::displayFunction5() {
- debugC(2, kDebugEngine, "displayFunction5()");
+ debugC(2, kDebugEngineTBC, "displayFunction5()");
if ((_skipDisplayFlag1 != 0) && (_skipDisplayFlag2 != 1)) {
_skipDisplayFlag2 = 1;
@@ -425,7 +426,7 @@ void LilliputEngine::displayFunction5() {
// save game area
void LilliputEngine::displayFunction6() {
- debugC(2, kDebugEngine, "displayFunction6()");
+ debugC(2, kDebugEngineTBC, "displayFunction6()");
displayFunction5();
@@ -441,7 +442,7 @@ void LilliputEngine::displayFunction6() {
// save speech zone
void LilliputEngine::displayFunction7() {
- debugC(2, kDebugEngine, "displayFunction7()");
+ debugC(2, kDebugEngineTBC, "displayFunction7()");
displayFunction5();
@@ -456,7 +457,7 @@ void LilliputEngine::displayFunction7() {
}
void LilliputEngine::displayInterfaceHotspots() {
- debugC(2, kDebugEngine, "displayInterfaceHotspots()");
+ debugC(2, kDebugEngineTBC, "displayInterfaceHotspots()");
if (_displayMap == 1)
return;
@@ -474,7 +475,7 @@ void LilliputEngine::displayInterfaceHotspots() {
}
void LilliputEngine::displayFunction9() {
- debugC(2, kDebugEngine, "displayFunction9()");
+ debugC(2, kDebugEngineTBC, "displayFunction9()");
memcpy(_buffer2_45k, _buffer3_45k, 45056);
@@ -495,7 +496,7 @@ void LilliputEngine::displayFunction9() {
// Display dialog bubble
void LilliputEngine::displayFunction10() {
- debugC(2, kDebugEngine, "displayFunction10()");
+ debugC(2, kDebugEngineTBC, "displayFunction10()");
static const byte _array15976[16] = {244, 248, 250, 250, 252, 252, 252, 252, 252, 252, 252, 252, 250, 250, 248, 244};
displayFunction5();
@@ -518,7 +519,7 @@ void LilliputEngine::displayFunction10() {
}
void LilliputEngine::sub15A4C(int &vgaIndex, byte *srcBuf, int &bufIndex) {
- debugC(2, kDebugEngine, "sub15A4C()");
+ debugC(2, kDebugEngineTBC, "sub15A4C()");
int var3 = 0;
int var1;
@@ -550,7 +551,7 @@ void LilliputEngine::sub15A4C(int &vgaIndex, byte *srcBuf, int &bufIndex) {
}
void LilliputEngine::displayFunction11(byte *buf) {
- debugC(2, kDebugEngine, "displayFunction11(%s)", buf);
+ debugC(2, kDebugEngineTBC, "displayFunction11(%s)", buf);
displayFunction5();
@@ -583,7 +584,7 @@ void LilliputEngine::displayFunction11(byte *buf) {
}
void LilliputEngine::displayFunction12() {
- debugC(1, kDebugEngine, "displayFunction12()");
+ debugC(1, kDebugEngineTBC, "displayFunction12()");
displayFunction5();
@@ -605,7 +606,7 @@ void LilliputEngine::displayFunction12() {
}
void LilliputEngine::displayFunction13(byte *buf, int var1, int var2, int var3) {
- debugC(1, kDebugEngine, "displayFunction13(buf, %d, %d, %d)", var1, var2, var3);
+ debugC(1, kDebugEngineTBC, "displayFunction13(buf, %d, %d, %d)", var1, var2, var3);
byte tmpByte1 = ((7 + (var2 >> 8) - (var2 & 0xFF)) << 4) & 0xFF;
byte tmpByte2 = ((4 + (var2 >> 8) + (var2 & 0xFF) - (var3 >> 7) ) << 3) & 0xFF;
@@ -624,7 +625,7 @@ void LilliputEngine::displayFunction13(byte *buf, int var1, int var2, int var3)
}
void LilliputEngine::displayFunction14() {
- debugC(2, kDebugEngine, "displayFunction14()");
+ debugC(2, kDebugEngineTBC, "displayFunction14()");
if (_displayMap == 1)
return;
@@ -646,7 +647,7 @@ void LilliputEngine::displayFunction14() {
}
void LilliputEngine::restoreMapPoints() {
- debugC(2, kDebugEngine, "restoreMapPoints()");
+ debugC(2, kDebugEngineTBC, "restoreMapPoints()");
displayFunction5();
@@ -659,7 +660,7 @@ void LilliputEngine::restoreMapPoints() {
}
void LilliputEngine::displayCharactersOnMap() {
- debugC(2, kDebugEngine, "displayCharactersOnMap()");
+ debugC(2, kDebugEngineTBC, "displayCharactersOnMap()");
sub16217();
displayFunction5();
@@ -679,7 +680,7 @@ void LilliputEngine::displayCharactersOnMap() {
}
void LilliputEngine::sub16217() {
- debugC(2, kDebugEngine, "sub16217()");
+ debugC(2, kDebugEngineTBC, "sub16217()");
_numCharactersToDisplay = 0;
int index = _numCharacters - 1;
@@ -739,21 +740,19 @@ void LilliputEngine::sub16217() {
}
void LilliputEngine::setNextDisplayCharacter(int var1) {
- debugC(2, kDebugEngine, "setNextDisplayCharacter(%d)", var1);
+ debugC(2, kDebugEngineTBC, "setNextDisplayCharacter(%d)", var1);
byte charNum = var1 & 0xFF;
if ( charNum < _numCharactersToDisplay) {
int index = _charactersToDisplay[charNum];
- _nextDisplayCharacterX = _characterRelativePositionX[index];
- _nextDisplayCharacterY = _characterRelativePositionY[index];
+ _nextDisplayCharacterPos = Common::Point(_characterRelativePositionX[index], _characterRelativePositionY[index]);
} else {
- _nextDisplayCharacterX = 0xFF;
- _nextDisplayCharacterY = 0xFF;
+ _nextDisplayCharacterPos = Common::Point(-1, -1);
}
}
void LilliputEngine::displayFunction15() {
- debugC(2, kDebugEngine, "displayFunction15()");
+ debugC(2, kDebugEngineTBC, "displayFunction15()");
sub16217();
_currentDisplayCharacter = 0;
@@ -773,7 +772,7 @@ void LilliputEngine::displayFunction15() {
var1 += _scriptHandler->_byte12A04;
displayFunction13(_buffer1_45k, var1, tmpVal, 1 << 8);
}
- renderCharacters(map, j, i);
+ renderCharacters(map, Common::Point(j, i));
if (map[2] != 0xFF) {
int var1 = map[2];
@@ -788,7 +787,7 @@ void LilliputEngine::displayFunction15() {
}
void LilliputEngine::displayFunction16() {
- debugC(2, kDebugEngine, "displayFunction16()");
+ debugC(2, kDebugEngineTBC, "displayFunction16()");
if (_displayMap == 1) {
bool forceReturnFl = false;
@@ -828,7 +827,7 @@ void LilliputEngine::sub1863B() {
}
void LilliputEngine::paletteFadeOut() {
- debugC(2, kDebugEngine, "paletteFadeOut()");
+ debugC(2, kDebugEngineTBC, "paletteFadeOut()");
sub1863B();
byte palette[768];
@@ -843,7 +842,7 @@ void LilliputEngine::paletteFadeOut() {
}
void LilliputEngine::paletteFadeIn() {
- debugC(2, kDebugEngine, "paletteFadeIn()");
+ debugC(2, kDebugEngineTBC, "paletteFadeIn()");
byte palette[768];
for (int fade = 8; fade <= 256; fade += 8) {
@@ -857,7 +856,7 @@ void LilliputEngine::paletteFadeIn() {
}
int LilliputEngine::sub16DD5(int x1, int y1, int x2, int y2) {
- debugC(2, kDebugEngine, "sub16DD5(%d, %d, %d, %d)", x1, y1, x2, y2);
+ debugC(2, kDebugEngineTBC, "sub16DD5(%d, %d, %d, %d)", x1, y1, x2, y2);
byte *isoMap = _bufferIsoMap + (x1 << 8) + (y1 << 2) + 1;
@@ -923,7 +922,7 @@ int LilliputEngine::sub16DD5(int x1, int y1, int x2, int y2) {
}
void LilliputEngine::sub15F75() {
- debugC(2, kDebugEngine, "sub15F75()");
+ debugC(2, kDebugEngineTBC, "sub15F75()");
_byte129A0 = 0xFF;
_savedMousePosDivided = Common::Point(-1, -1);
@@ -938,7 +937,7 @@ void LilliputEngine::sub15F75() {
}
void LilliputEngine::sub130B6() {
- debugC(2, kDebugEngine, "sub130B6()");
+ debugC(2, kDebugEngineTBC, "sub130B6()");
for (int index = 0; index < _word12F68_ERULES; index++) {
if (_scriptHandler->_array122E9[index] == 3)
@@ -947,7 +946,7 @@ void LilliputEngine::sub130B6() {
}
void LilliputEngine::sub15F31(bool &forceReturnFl) {
- debugC(2, kDebugEngine, "sub15F31()");
+ debugC(2, kDebugEngineTBC, "sub15F31()");
forceReturnFl = false;
if (_displayMap != 1)
@@ -974,7 +973,7 @@ void LilliputEngine::sub15F31(bool &forceReturnFl) {
}
void LilliputEngine::sub16CA0() {
- debugC(2, kDebugEngine, "sub16CA0()");
+ debugC(2, kDebugEngineTBC, "sub16CA0()");
for (int index = _numCharacters - 1; index >= 0; index--) {
if (_rulesBuffer2_11[index] & 1)
@@ -1065,7 +1064,7 @@ void LilliputEngine::sub16CA0() {
}
void LilliputEngine::displayFunction17() {
- debugC(2, kDebugEngine, "displayFunction17()");
+ debugC(2, kDebugEngineTBC, "displayFunction17()");
displayFunction5();
@@ -1077,7 +1076,7 @@ void LilliputEngine::displayFunction17() {
}
void LilliputEngine::displayFunction18(int var1, int var2, int var3, int var4) {
- debugC(2, kDebugEngine, "displayFunction18(%d, %d, %d, %d)", var1, var2, var3, var4);
+ debugC(2, kDebugEngineTBC, "displayFunction18(%d, %d, %d, %d)", var1, var2, var3, var4);
displayFunction5();
@@ -1109,7 +1108,7 @@ void LilliputEngine::displayFunction18(int var1, int var2, int var3, int var4) {
}
void LilliputEngine::displayString(byte *buf, int var2, int var4) {
- debugC(2, kDebugEngine, "displayString(buf, %d, %d)", var2, var4);
+ debugC(2, kDebugEngineTBC, "displayString(buf, %d, %d)", var2, var4);
int index = var2;
int tmpVar4 = (var4 >> 8) + ((var4 & 0xFF) << 8);
@@ -1124,7 +1123,7 @@ void LilliputEngine::displayString(byte *buf, int var2, int var4) {
}
void LilliputEngine::displayChar(int index, int var1) {
- debugC(2, kDebugEngine, "displayChar(%d, %d)", index, var1);
+ debugC(2, kDebugEngineTBC, "displayChar(%d, %d)", index, var1);
int indexVga = index;
int indexChar = var1 << 5;
@@ -1139,7 +1138,7 @@ void LilliputEngine::displayChar(int index, int var1) {
}
void LilliputEngine::sortCharacters() {
- debugC(2, kDebugEngine, "sortCharacters()");
+ debugC(2, kDebugEngineTBC, "sortCharacters()");
if (_numCharactersToDisplay <= 1)
return;
@@ -1183,7 +1182,7 @@ void LilliputEngine::sortCharacters() {
// Move view port to x/y
void LilliputEngine::scrollToViewportCharacterTarget() {
- debugC(2, kDebugEngine, "scrollToViewportCharacterTarget()");
+ debugC(2, kDebugEngineTBC, "scrollToViewportCharacterTarget()");
if (_scriptHandler->_viewportCharacterTarget == 0xFFFF)
return;
@@ -1220,7 +1219,7 @@ void LilliputEngine::scrollToViewportCharacterTarget() {
}
void LilliputEngine::viewportScrollTo(Common::Point goalPos) {
- debugC(2, kDebugEngine, "viewportScrollTo(%d, %d)", goalPos.x, goalPos.y);
+ debugC(2, kDebugEngineTBC, "viewportScrollTo(%d, %d)", goalPos.x, goalPos.y);
if (goalPos == _scriptHandler->_viewportPos)
return;
@@ -1259,10 +1258,10 @@ void LilliputEngine::viewportScrollTo(Common::Point goalPos) {
_soundHandler->contentFct5();
}
-void LilliputEngine::renderCharacters(byte *buf, byte x, byte y) {
- debugC(2, kDebugEngine, "renderCharacters(buf, %d, %d)", x, y);
+void LilliputEngine::renderCharacters(byte *buf, Common::Point pos) {
+ debugC(2, kDebugEngineTBC, "renderCharacters(buf, %d - %d)", pos.x, pos.y);
- if ((_nextDisplayCharacterX != x) || (_nextDisplayCharacterY != y))
+ if (_nextDisplayCharacterPos != pos)
return;
_byte16552 = 0;
@@ -1295,18 +1294,18 @@ void LilliputEngine::renderCharacters(byte *buf, byte x, byte y) {
frame = -frame;
}
- displayCharacter(frame, displayX, displayY, flag);
+ displayCharacter(frame, Common::Point(displayX, displayY), flag);
}
}
++_currentDisplayCharacter;
setNextDisplayCharacter(_currentDisplayCharacter);
- renderCharacters(buf, x, y);
+ renderCharacters(buf, pos);
}
void LilliputEngine::sub1546F(byte displayX, byte displayY) {
- debugC(2, kDebugEngine, "sub1546F(%d, %d)", displayX, displayY);
+ debugC(2, kDebugEngineTBC, "sub1546F(%d, %d)", displayX, displayY);
int orgX = displayX + 8;
int orgY = displayY;
@@ -1331,7 +1330,7 @@ void LilliputEngine::sub1546F(byte displayX, byte displayY) {
}
void LilliputEngine::sub15498(byte x, byte y, int var2) {
- debugC(2, kDebugEngine, "sub15498(%d, %d, %d)", x, y, 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--) {
@@ -1341,7 +1340,7 @@ void LilliputEngine::sub15498(byte x, byte y, int var2) {
}
void LilliputEngine::sub189DE() {
- debugC(2, kDebugEngine, "sub189DE()");
+ debugC(2, kDebugEngineTBC, "sub189DE()");
if (_byte1881D != 0) {
--_byte1881D;
@@ -1353,7 +1352,7 @@ void LilliputEngine::sub189DE() {
}
int LilliputEngine::getDirection(Common::Point param1, Common::Point param2) {
- debugC(2, kDebugEngine, "getDirection(%d - %d, %d - %d)", param1.x, param1.y, param2.x, param2.y);
+ debugC(2, kDebugEngineTBC, "getDirection(%d - %d, %d - %d)", param1.x, param1.y, param2.x, param2.y);
static const char _directionsArray[8] = {0, 2, 0, 1, 3, 2, 3, 1};
@@ -1381,7 +1380,7 @@ int LilliputEngine::getDirection(Common::Point param1, Common::Point param2) {
}
byte LilliputEngine::sub16799(int index, int param1) {
- debugC(2, kDebugEngine, "sub16799(%d, %d)", index, param1);
+ debugC(2, kDebugEngineTBC, "sub16799(%d, %d)", index, param1);
Common::Point var3 = Common::Point(_array109E9PosX[index], _array10A11PosY[index]);
@@ -1411,7 +1410,7 @@ byte LilliputEngine::sub16799(int index, int param1) {
//TODO rename arrays
void LilliputEngine::sub167EF(int index) {
- debugC(2, kDebugEngine, "sub167EF(%d)", 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]));
@@ -1455,8 +1454,8 @@ void LilliputEngine::sub167EF(int index) {
return;
}
- int var4h = (_rectYMinMax[index] >> 8);
- int var4l = (_rectYMinMax[index] & 0xFF);
+ var4h = (_rectYMinMax[index] >> 8);
+ var4l = (_rectYMinMax[index] & 0xFF);
if (var4h != var4l) {
if (_array10A11PosY[index] == var4h)
@@ -1483,7 +1482,7 @@ void LilliputEngine::sub167EF(int index) {
}
void LilliputEngine::sub1693A(int index) {
- debugC(2, kDebugEngine, "sub1693A(%d)", index);
+ debugC(2, kDebugEngineTBC, "sub1693A(%d)", index);
static const uint16 _array1692F[4] = {4, 0xFF00, 0x100, 0xFFFC};
@@ -1531,7 +1530,7 @@ void LilliputEngine::sub1693A(int index) {
}
byte LilliputEngine::sub16A76(int indexb, int indexs) {
- debugC(2, kDebugEngine, "sub16A76(%d, %d)", indexb, indexs);
+ debugC(2, kDebugEngineTBC, "sub16A76(%d, %d)", indexb, indexs);
static const char _array16A6C[4] = {1, 0, 0, -1};
static const char _array16A70[4] = {0, -1, 1, 0};
@@ -1561,7 +1560,7 @@ byte LilliputEngine::sub16A76(int indexb, int indexs) {
}
int LilliputEngine::findHotspot(Common::Point pos) {
- debugC(2, kDebugEngine, "findHotspot(%d, %d)", pos.x, pos.y);
+ debugC(2, kDebugEngineTBC, "findHotspot(%d, %d)", pos.x, pos.y);
for (int i = 0; i < _rulesChunk12_size; i++) {
if ((pos.x >= (_rectXMinMax[i] >> 8)) && (pos.x <= (_rectXMinMax[i] & 0xFF)) && (pos.y >= (_rectYMinMax[i] >> 8)) && (pos.y <= (_rectYMinMax[i] & 0xFF)))
@@ -1571,7 +1570,7 @@ int LilliputEngine::findHotspot(Common::Point pos) {
}
int LilliputEngine::reverseFindHotspot(Common::Point pos) {
- debugC(2, kDebugEngine, "reverseFindHotspot(%d, %d)", pos.x, pos.y);
+ debugC(2, kDebugEngineTBC, "reverseFindHotspot(%d, %d)", pos.x, pos.y);
for (int i = _rulesChunk12_size - 1; i >= 0 ; i--) {
if ((pos.x >= (_rectXMinMax[i] >> 8)) && (pos.x <= (_rectXMinMax[i] & 0xFF)) && (pos.y >= (_rectYMinMax[i] >> 8)) && (pos.y<= (_rectYMinMax[i] & 0xFF)))
@@ -1582,7 +1581,7 @@ int LilliputEngine::reverseFindHotspot(Common::Point pos) {
void LilliputEngine::sub16A08(int index) {
- debugC(2, kDebugEngine, "sub16A08(%d)", index);
+ debugC(2, kDebugEngineTBC, "sub16A08(%d)", index);
static const byte _array169F8[4] = {1, 0, 0, 0xFF};
static const byte _array169FC[4] = {0, 0xFF, 1, 0};
@@ -1612,7 +1611,7 @@ void LilliputEngine::sub16A08(int index) {
}
void LilliputEngine::addCharToBuf(byte character) {
- debugC(2, kDebugEngine, "addCharToBuf(%c)", character);
+ debugC(2, kDebugEngineTBC, "addCharToBuf(%c)", character);
_displayStringBuf[_displayStringIndex] = character;
if (_displayStringIndex < 158)
@@ -1620,7 +1619,7 @@ void LilliputEngine::addCharToBuf(byte character) {
}
void LilliputEngine::prepareGoldAmount(int param1) {
- debugC(2, kDebugEngine, "prepareGoldAmount(%d)", param1);
+ debugC(2, kDebugEngineTBC, "prepareGoldAmount(%d)", param1);
static const int _array18AE3[6] = {10000, 1000, 100, 10, 1};
@@ -1648,7 +1647,7 @@ void LilliputEngine::prepareGoldAmount(int param1) {
}
void LilliputEngine::sub16626() {
- debugC(2, kDebugEngine, "sub16626()");
+ debugC(2, kDebugEngineTBC, "sub16626()");
int index = _numCharacters - 1;
byte result;
@@ -1716,7 +1715,7 @@ void LilliputEngine::sub16626() {
}
byte LilliputEngine::sub166EA(int index) {
- debugC(2, kDebugEngine, "sub166EA(%d)", index);
+ debugC(2, kDebugEngineTBC, "sub166EA(%d)", index);
_scriptHandler->_array12811[index] = 0x10;
_scriptHandler->_characterScriptEnabled[index] = 1;
@@ -1724,7 +1723,7 @@ byte LilliputEngine::sub166EA(int index) {
}
byte LilliputEngine::sub166F7(int index, Common::Point var1, int tmpVal) {
- debugC(2, kDebugEngine, "sub166F7(%d, %d - %d, %d)", index, var1.x, var1.y, tmpVal);
+ debugC(2, kDebugEngineTBC, "sub166F7(%d, %d - %d, %d)", index, var1.x, var1.y, tmpVal);
byte a2 = var1.y;
if (a2 != 0) {
@@ -1743,7 +1742,7 @@ byte LilliputEngine::sub166F7(int index, Common::Point var1, int tmpVal) {
}
byte LilliputEngine::sub166DD(int index, int var1) {
- debugC(2, kDebugEngine, "sub166DD(%d, %d)", index, var1);
+ debugC(2, kDebugEngineTBC, "sub166DD(%d, %d)", index, var1);
_characterDirectionArray[index] = (var1 >> 8) & 3;
sub16685(index, var1 & 0xFF);
@@ -1751,14 +1750,14 @@ byte LilliputEngine::sub166DD(int index, int var1) {
}
byte LilliputEngine::sub16722(int index, byte var1) {
- debugC(2, kDebugEngine, "sub16722(%d, %d)", index, var1);
+ debugC(2, kDebugEngineTBC, "sub16722(%d, %d)", index, var1);
_rulesBuffer2_10[index] = var1;
return 2;
}
byte LilliputEngine::sub16729(int index) {
- debugC(2, kDebugEngine, "sub16729(%d)", index);
+ debugC(2, kDebugEngineTBC, "sub16729(%d)", index);
int arg1 = index | 0xFF00;
Common::Point pos1 = Common::Point(_scriptHandler->_array16123PosX[index], _scriptHandler->_array1614BPosY[index]);
@@ -1768,7 +1767,7 @@ byte LilliputEngine::sub16729(int index) {
}
byte LilliputEngine::sub1675D(int index, int var1) {
- debugC(2, kDebugEngine, "sub1675D(%d)", index);
+ debugC(2, kDebugEngineTBC, "sub1675D(%d)", index);
int var2 = _scriptHandler->_array10A39[index];
int var1h = _scriptHandler->_array16123PosX[var2];
@@ -1790,7 +1789,7 @@ byte LilliputEngine::sub1675D(int index, int var1) {
}
void LilliputEngine::sub16EBC() {
- debugC(2, kDebugEngine, "sub16EBC()");
+ debugC(2, kDebugEngineTBC, "sub16EBC()");
int index2 = 3;
@@ -1808,7 +1807,7 @@ void LilliputEngine::sub16EBC() {
}
void LilliputEngine::sub12F37() {
- debugC(2, kDebugEngine, "sub12F37()");
+ debugC(2, kDebugEngineTBC, "sub12F37()");
int index1 = _byte12A04 + 2;
int index2 = 0;
@@ -1837,7 +1836,7 @@ void LilliputEngine::sub130EE() {
// warning("sub13156");
if (_mouseButton == 0)
- // TODO: check _mouse_byte1299F
+ // TODO: check _mouse_clicked
return;
int button = _mouseButton;
@@ -1854,29 +1853,24 @@ void LilliputEngine::sub130EE() {
if (forceReturnFl)
return;
- int posX = _mousePos.x - 64;
- int posY = _mousePos.y - 16;
+ Common::Point pos = Common::Point(_mousePos.x - 64, _mousePos.y - 16);
- if ((posX < 0) || (posX > 255))
- return;
-
- if ((posY < 0) || (posY > 176))
+ if ((pos.x < 0) || (pos.x > 255) || (pos.y < 0) || (pos.y > 176))
return;
forceReturnFl = false;
- sub131B2(posX, posY, forceReturnFl);
+ sub131B2(pos, forceReturnFl);
if (forceReturnFl)
return;
- sub131FC(posX, posY);
+ sub131FC(pos);
}
-// TODO use Common::Point
-void LilliputEngine::sub131FC(int var2, int var4) {
- debugC(2, kDebugEngine, "sub131FC(%d, %d)", var2, var4);
+void LilliputEngine::sub131FC(Common::Point pos) {
+ debugC(2, kDebugEngine, "sub131FC(%d, %d)", pos.x, pos.y);
- int x = var2 - 8;
- int y = var4 - 4;
+ int x = pos.x - 8;
+ int y = pos.y - 4;
x = (x >> 4) - 7;
y = (y >> 3) - 4;
@@ -1892,13 +1886,13 @@ void LilliputEngine::sub131FC(int var2, int var4) {
}
}
-void LilliputEngine::sub131B2(int var2, int var4, bool &forceReturnFl) {
- debugC(2, kDebugEngine, "sub131B2(%d, %d)", var2, var4);
+void LilliputEngine::sub131B2(Common::Point pos, bool &forceReturnFl) {
+ debugC(2, kDebugEngine, "sub131B2(%d, %d)", pos.x, pos.y);
forceReturnFl = false;
for (int i = 0; i < _numCharacters; i++) {
- if ((var2 >= _characterDisplayX[i]) && (var2 <= _characterDisplayX[i] + 17) && (var4 >= _characterDisplayY[i]) && (var4 <= _characterDisplayY[i] + 17) && (i != _word10804)) {
+ if ((pos.x >= _characterDisplayX[i]) && (pos.x <= _characterDisplayX[i] + 17) && (pos.y >= _characterDisplayY[i]) && (pos.y <= _characterDisplayY[i] + 17) && (i != _word10804)) {
_byte129A0 = i;
_byte16F07_menuId = 4;
if (_byte12FCE == 1)
@@ -1912,7 +1906,7 @@ void LilliputEngine::sub131B2(int var2, int var4, bool &forceReturnFl) {
}
void LilliputEngine::checkInterfaceHotspots(bool &forceReturnFl) {
- debugC(2, kDebugEngine, "checkInterfaceHotspots()");
+ debugC(2, kDebugEngineTBC, "checkInterfaceHotspots()");
forceReturnFl = false;
for (int index = _word12F68_ERULES - 1; index >= 0; index--) {
@@ -1925,7 +1919,7 @@ void LilliputEngine::checkInterfaceHotspots(bool &forceReturnFl) {
}
int LilliputEngine::sub13240(Common::Point mousePos, int var3, int var4) {
- debugC(2, kDebugEngine, "sub13240(%d, %d, %d, %d)", mousePos.x, mousePos.y, var3, var4);
+ debugC(2, kDebugEngineTBC, "sub13240(%d, %d, %d, %d)", mousePos.x, mousePos.y, var3, var4);
if ((mousePos.x < var3) || (mousePos.y < var4))
return -1;
@@ -1940,7 +1934,7 @@ int LilliputEngine::sub13240(Common::Point mousePos, int var3, int var4) {
}
void LilliputEngine::sub1305C(byte index, byte button) {
- debugC(2, kDebugEngine, "sub1305C(%d, %d)", index, button);
+ debugC(2, kDebugEngineTBC, "sub1305C(%d, %d)", index, button);
if (_scriptHandler->_array122E9[index] < 2)
return;
@@ -1975,14 +1969,14 @@ void LilliputEngine::sub1305C(byte index, byte button) {
}
void LilliputEngine::sub16685(int idx, int var1) {
- debugC(2, kDebugEngine, "sub16685(%d, %d)", idx, var1);
+ debugC(2, kDebugEngineTBC, "sub16685(%d, %d)", idx, var1);
int index = (idx << 5) + (var1 & 0xFF);
_scriptHandler->_array10AB1[idx] = _rulesBuffer2_16[index];
}
byte LilliputEngine::sub16675(int idx, int var1) {
- debugC(2, kDebugEngine, "sub16675(%d, %d)", idx, var1);
+ debugC(2, kDebugEngineTBC, "sub16675(%d, %d)", idx, var1);
sub16685(idx, var1);
int index = (var1 & 0xFF);
@@ -2027,69 +2021,69 @@ byte LilliputEngine::sub16675(int idx, int var1) {
}
void LilliputEngine::sub16B63(int index) {
- debugC(2, kDebugEngine, "sub16B63(%d)", index);
+ debugC(2, kDebugEngineTBC, "sub16B63(%d)", index);
static const byte nextDirection[4] = {1, 3, 0, 2};
_characterDirectionArray[index] = nextDirection[_characterDirectionArray[index]];
}
void LilliputEngine::sub16B76(int index) {
- debugC(2, kDebugEngine, "sub16B76(%d)", index);
+ debugC(2, kDebugEngineTBC, "sub16B76(%d)", index);
static const byte nextDirection[4] = {2, 0, 3, 1};
_characterDirectionArray[index] = nextDirection[_characterDirectionArray[index]];
}
void LilliputEngine::sub166C0(int index) {
- debugC(2, kDebugEngine, "sub166C0(%d)", index);
+ debugC(2, kDebugEngineTBC, "sub166C0(%d)", index);
_characterPositionAltitude[index] += 1;
}
void LilliputEngine::sub166C6(int index) {
- debugC(2, kDebugEngine, "sub166C6(%d)", index);
+ debugC(2, kDebugEngineTBC, "sub166C6(%d)", index);
_characterPositionAltitude[index] += 2;
}
void LilliputEngine::sub166CC(int index) {
- debugC(2, kDebugEngine, "sub166CC(%d)", index);
+ debugC(2, kDebugEngineTBC, "sub166CC(%d)", index);
_characterPositionAltitude[index] -= 1;
}
void LilliputEngine::sub166D2(int index) {
- debugC(2, kDebugEngine, "sub166D2(%d)", index);
+ debugC(2, kDebugEngineTBC, "sub166D2(%d)", index);
_characterPositionAltitude[index] -= 2;
}
void LilliputEngine::sub166B1(int index) {
- debugC(2, kDebugEngine, "sub166B1(%d)", index);
+ debugC(2, kDebugEngineTBC, "sub166B1(%d)", index);
sub16B31(index, 2);
}
void LilliputEngine::sub166B6(int index) {
- debugC(2, kDebugEngine, "sub166B6(%d)", index);
+ debugC(2, kDebugEngineTBC, "sub166B6(%d)", index);
sub16B31(index, 4);
}
void LilliputEngine::sub166BB(int index) {
- debugC(2, kDebugEngine, "sub166BB(%d)", index);
+ debugC(2, kDebugEngineTBC, "sub166BB(%d)", index);
sub16B31(index, 0xFE);
}
void LilliputEngine::sub166D8(int index) {
- debugC(2, kDebugEngine, "sub166D8(%d)", index);
+ debugC(2, kDebugEngineTBC, "sub166D8(%d)", index);
sub16B31(index, 3);
}
void LilliputEngine::sub16B31(int index, int val) {
- debugC(2, kDebugEngine, "sub16B31(%d, %d)", index, val);
+ debugC(2, kDebugEngineTBC, "sub16B31(%d, %d)", index, val);
int newX = _characterPositionX[index];
int newY = _characterPositionY[index];
@@ -2111,7 +2105,7 @@ void LilliputEngine::sub16B31(int index, int val) {
}
void LilliputEngine::sub16B8F(int index, int x, int y, int flag) {
- debugC(2, kDebugEngine, "sub16B8F(%d, %d, %d)", index, x, y);
+ debugC(2, kDebugEngineTBC, "sub16B8F(%d, %d, %d)", index, x, y);
int diffX = x >> 3;
if (((diffX & 0xFF) == _scriptHandler->_array16123PosX[index]) && ((y >> 3) == _scriptHandler->_array1614BPosY[index])) {
@@ -2146,7 +2140,7 @@ void LilliputEngine::sub16B8F(int index, int x, int y, int flag) {
}
void LilliputEngine::sub17224(int var1, int var4) {
- debugC(2, kDebugEngine, "sub17224(%d, %d)", var1, var4);
+ debugC(2, kDebugEngineTBC, "sub17224(%d, %d)", var1, var4);
byte type = (var1 >> 8);
if (type == 0) {
@@ -2169,7 +2163,7 @@ void LilliputEngine::sub17224(int var1, int var4) {
}
void LilliputEngine::sub17264(int index, int var4) {
- debugC(2, kDebugEngine, "sub17264(%d, %d)", index, var4);
+ debugC(2, kDebugEngineTBC, "sub17264(%d, %d)", index, var4);
if (_array11D49[index] != 0xFFFF) {
_array1289F[index] = var4;
@@ -2180,7 +2174,7 @@ void LilliputEngine::sub17264(int index, int var4) {
}
void LilliputEngine::sub171CF() {
- debugC(2, kDebugEngine, "sub171CF()");
+ debugC(2, kDebugEngineTBC, "sub171CF()");
for (int i = 0; i < _numCharacters; i++) {
if (_array1289F[i] != 0xFFFF) {
@@ -2204,7 +2198,7 @@ void LilliputEngine::sub171CF() {
}
void LilliputEngine::sub12FE5() {
- debugC(2, kDebugEngine, "sub12FE5()");
+ debugC(2, kDebugEngineTBC, "sub12FE5()");
if (_byte12A04 != 1)
return;
@@ -2226,7 +2220,7 @@ void LilliputEngine::sub12FE5() {
}
void LilliputEngine::displayHeroismIndicator() {
- debugC(2, kDebugEngine, "displayHeroismIndicator()");
+ debugC(2, kDebugEngineTBC, "displayHeroismIndicator()");
if (_scriptHandler->_savedBuffer215Ptr == NULL)
return;
@@ -2275,7 +2269,7 @@ void LilliputEngine::displayHeroismIndicator() {
}
void LilliputEngine::pollEvent() {
- debugC(2, kDebugEngine, "pollEvent()");
+ debugC(2, kDebugEngineTBC, "pollEvent()");
Common::Event event;
while (_system->getEventManager()->pollEvent(event)) {
@@ -2548,7 +2542,7 @@ void LilliputEngine::loadRules() {
}
void LilliputEngine::displayVGAFile(Common::String fileName) {
- debugC(1, kDebugEngine, "displayVGAFile(%s)", fileName.c_str());
+ debugC(1, kDebugEngineTBC, "displayVGAFile(%s)", fileName.c_str());
displayFunction4();
@@ -2585,7 +2579,7 @@ void LilliputEngine::initPalette() {
}
void LilliputEngine::sub170EE(int index) {
- debugC(1, kDebugEngine, "sub170EE(%d)", index);
+ debugC(1, kDebugEngineTBC, "sub170EE(%d)", index);
_currentScriptCharacter = index;
@@ -2602,7 +2596,7 @@ void LilliputEngine::sub130DD() {
}
void LilliputEngine::handleMenu() {
- debugC(1, kDebugEngine, "handleMenu()");
+ debugC(1, kDebugEngineTBC, "handleMenu()");
if (_byte16F07_menuId == 0)
return;
@@ -2611,9 +2605,9 @@ void LilliputEngine::handleMenu() {
return;
sub170EE(_word10804);
- debugC(1, kDebugScript, "========================== Menu Script ==============================");
+ debugC(1, kDebugScriptTBC, "========================== Menu Script ==============================");
_scriptHandler->runMenuScript(ScriptStream(_menuScript, _menuScript_size));
- debugC(1, kDebugScript, "========================== End of Menu Script==============================");
+ debugC(1, kDebugScriptTBC, "========================== End of Menu Script==============================");
_savedMousePosDivided = Common::Point(-1, -1);
_byte129A0 = 0xFF;
@@ -2624,7 +2618,7 @@ void LilliputEngine::handleMenu() {
}
void LilliputEngine::handleGameScripts() {
- debugC(1, kDebugEngine, "handleGameScripts()");
+ debugC(1, kDebugEngineTBC, "handleGameScripts()");
int index = _word17081_nextIndex;
int i;
@@ -2654,23 +2648,23 @@ void LilliputEngine::handleGameScripts() {
/*
for (int i = 0; i < _gameScriptIndexSize; i++) {
assert(tmpVal < _gameScriptIndexSize);
- debugC(1, kDebugEngine, "================= Game Script %d ==================", i);
+ debugC(1, kDebugEngineTBC, "================= Game Script %d ==================", i);
ScriptStream script = ScriptStream(&_arrayGameScripts[_arrayGameScriptIndex[i]], _arrayGameScriptIndex[i + 1] - _arrayGameScriptIndex[i]);
_scriptHandler->disasmScript(script);
- debugC(1, kDebugEngine, "============= End Game Script %d ==================", i);
+ debugC(1, kDebugEngineTBC, "============= End Game Script %d ==================", i);
}
while(1);*/
assert(tmpVal < _gameScriptIndexSize);
- debugC(1, kDebugEngine, "================= Game Script %d for character %d ==================", tmpVal, index);
+ debugC(1, kDebugEngineTBC, "================= Game Script %d for character %d ==================", tmpVal, index);
_scriptHandler->runScript(ScriptStream(&_arrayGameScripts[_arrayGameScriptIndex[tmpVal]], _arrayGameScriptIndex[tmpVal + 1] - _arrayGameScriptIndex[tmpVal]));
- debugC(1, kDebugEngine, "============= End Game Script %d for character %d ==================", tmpVal, index);
+ debugC(1, kDebugEngineTBC, "============= End Game Script %d for character %d ==================", tmpVal, index);
//warning("dump char stat");
i = index;
- debugC(3, kDebugEngine, "char %d, pos %d %d, state %d, script enabled %d", i, _characterPositionX[i], _characterPositionY[i], *getCharacterVariablesPtr(i * 32 + 0), _scriptHandler->_characterScriptEnabled[i]);
+ debugC(3, kDebugEngineTBC, "char %d, pos %d %d, state %d, script enabled %d", i, _characterPositionX[i], _characterPositionY[i], *getCharacterVariablesPtr(i * 32 + 0), _scriptHandler->_characterScriptEnabled[i]);
}
Common::Error LilliputEngine::run() {
@@ -2684,6 +2678,7 @@ Common::Error LilliputEngine::run() {
// Setup mixer
syncSoundSettings();
+ //TODO: Init sound/music player
initPalette();
@@ -2695,14 +2690,15 @@ Common::Error LilliputEngine::run() {
_bufferIsoMap = loadRaw("ISOMAP.DTA");
loadRules();
+ // Hack: int8 should be installed at this point, but it's crashing during the
+ // rendering when the title screens are displayed
+ //_int8installed = true;
_lastTime = _system->getMillis();
-
-
- //TODO: Init sound/music player
_scriptHandler->runScript(ScriptStream(_initScript, _initScript_size));
+ // Hack, see above
_int8installed = true;
while(!_shouldQuit) {
@@ -2732,7 +2728,7 @@ void LilliputEngine::initialize() {
}
byte *LilliputEngine::getCharacterVariablesPtr(int16 index) {
- debugC(1, kDebugEngine, "getCharacterVariablesPtr(%d)", index);
+ debugC(1, kDebugEngineTBC, "getCharacterVariablesPtr(%d)", index);
assert((index > -3120) && (index < 1400));
if (index >= 0)
diff --git a/engines/lilliput/lilliput.h b/engines/lilliput/lilliput.h
index 316a245f2d..3892ff80f1 100644
--- a/engines/lilliput/lilliput.h
+++ b/engines/lilliput/lilliput.h
@@ -61,7 +61,9 @@ enum GameType {
enum LilliputDebugChannels {
kDebugEngine = 1 << 0,
kDebugScript = 1 << 1,
- kDebugSound = 1 << 2
+ kDebugSound = 1 << 2,
+ kDebugEngineTBC = 1 << 3,
+ kDebugScriptTBC = 1 << 4
};
struct LilliputGameDescription;
@@ -90,8 +92,7 @@ public:
struct18560 _arr18560[4];
byte _byte1714E;
byte _byte184F4;
- byte _nextDisplayCharacterX;
- byte _nextDisplayCharacterY;
+ Common::Point _nextDisplayCharacterPos;
byte _sound_byte16F06;
byte _byte16F09;
byte _keyboard_nextIndex;
@@ -239,7 +240,7 @@ public:
void displayFunction17();
void displayFunction18(int var1, int var2, int var3, int var4);
- void displayCharacter(int index, int x, int y, int flags);
+ void displayCharacter(int index, Common::Point pos, int flags);
void displayString(byte *buf, int var2, int var4);
void displayChar(int index, int var1);
void sub130B6();
@@ -263,7 +264,7 @@ public:
byte sub166EA(int index);
void sub167EF(int index);
- void renderCharacters(byte *buf, byte x, byte y);
+ void renderCharacters(byte *buf, Common::Point pos);
byte sub16799(int param1, int index);
int getDirection(Common::Point param1, Common::Point param2);
@@ -285,8 +286,8 @@ public:
void sub1305C(byte index, byte var2);
void checkInterfaceHotspots(bool &forceReturnFl);
int sub13240(Common::Point mousePos, int var3, int var4);
- void sub131B2(int var2, int var4, bool &forceReturnFl);
- void sub131FC(int var2, int var4);
+ void sub131B2(Common::Point pos, bool &forceReturnFl);
+ void sub131FC(Common::Point pos);
void sub1546F(byte displayX, byte displayY);
void sub15498(byte x, byte y, int var2);
void sub15A4C(int &vgaIndex, byte *srcBuf, int &bufIndex);
diff --git a/engines/lilliput/script.cpp b/engines/lilliput/script.cpp
index bd3791cf1e..8d1c7506a1 100644
--- a/engines/lilliput/script.cpp
+++ b/engines/lilliput/script.cpp
@@ -42,13 +42,17 @@ LilliputScript::LilliputScript(LilliputEngine *vm) : _vm(vm), _currScript(NULL)
_byte1881D = 0;
_word1855E = 0;
_word16F00 = -1;
+ _word129A3 = 0;
_viewportCharacterTarget = -1;
_heroismBarX = 0;
_heroismBarBottomY = 0;
_viewportPos.x = 0;
_viewportPos.y = 0;
_word18776 = 0;
-
+ _array129A5[0] = 0;
+ _array129A5[1] = 1;
+ _array129A5[2] = 2;
+ _array129A5[3] = 3;
_savedBuffer215Ptr = NULL;
for (int i = 0; i < 20; i++) {
@@ -79,7 +83,7 @@ LilliputScript::~LilliputScript() {
}
byte LilliputScript::handleOpcodeType1(int curWord) {
- debugC(2, kDebugScript, "handleOpcodeType1(0x%x)", curWord);
+ debugC(2, kDebugScriptTBC, "handleOpcodeType1(0x%x)", curWord);
switch (curWord) {
case 0x0:
return OC_checkCharacterGoalPos();
@@ -238,7 +242,7 @@ byte LilliputScript::handleOpcodeType1(int curWord) {
}
void LilliputScript::handleOpcodeType2(int curWord) {
- debugC(2, kDebugScript, "handleOpcodeType2(0x%x)", curWord);
+ debugC(2, kDebugScriptTBC, "handleOpcodeType2(0x%x)", curWord);
switch (curWord) {
case 0x0:
OC_setWord18821();
@@ -856,13 +860,10 @@ void LilliputScript::disasmScript( ScriptStream script) {
str += ")";
}
-
- debugC(2, kDebugScript, str.c_str());
-
-
+ debugC(2, kDebugScriptTBC, "%s", str.c_str());
}
- debugC(2, kDebugScript,"{ ");
+ debugC(2, kDebugScriptTBC, "{ ");
val = script.readUint16LE();
@@ -890,19 +891,18 @@ void LilliputScript::disasmScript( ScriptStream script) {
}
str += ");";
- debugC(2, kDebugScript, str.c_str());
-
+ debugC(2, kDebugScriptTBC, "%s", str.c_str());
val = script.readUint16LE();
}
- debugC(2, kDebugScript,"} ");
- debugC(2, kDebugScript," ");
+ debugC(2, kDebugScriptTBC, "} ");
+ debugC(2, kDebugScriptTBC, " ");
}
}
int LilliputScript::handleOpcode(ScriptStream *script) {
- debugC(2, kDebugScript, "handleOpcode");
+ debugC(2, kDebugScriptTBC, "handleOpcode");
_currScript = script;
uint16 curWord = _currScript->readUint16LE();
@@ -936,7 +936,7 @@ int LilliputScript::handleOpcode(ScriptStream *script) {
}
void LilliputScript::runScript(ScriptStream script) {
- debugC(1, kDebugScript, "runScript");
+ debugC(1, kDebugScriptTBC, "runScript");
_byte16F05_ScriptHandler = 1;
@@ -945,7 +945,7 @@ void LilliputScript::runScript(ScriptStream script) {
}
void LilliputScript::runMenuScript(ScriptStream script) {
- debugC(1, kDebugScript, "runMenuScript");
+ debugC(1, kDebugScriptTBC, "runMenuScript");
_byte16F05_ScriptHandler = 0;
@@ -954,7 +954,7 @@ void LilliputScript::runMenuScript(ScriptStream script) {
}
void LilliputScript::sub185ED(byte index, byte subIndex) {
- debugC(2, kDebugScript, "sub185ED");
+ debugC(2, kDebugScriptTBC, "sub185ED");
if (_vm->_arr18560[index]._field0 != 1)
return;
@@ -963,7 +963,7 @@ void LilliputScript::sub185ED(byte index, byte subIndex) {
}
byte LilliputScript::compareValues(byte var1, int oper, int var2) {
- debugC(2, kDebugScript, "compareValues(%d, %c, %d)", var1, oper & 0xFF, var2);
+ debugC(2, kDebugScriptTBC, "compareValues(%d, %c, %d)", var1, oper & 0xFF, var2);
switch (oper & 0xFF) {
case '<':
@@ -977,7 +977,7 @@ byte LilliputScript::compareValues(byte var1, int oper, int var2) {
}
void LilliputScript::computeOperation(byte *bufPtr, int oper, int var3) {
- debugC(1, kDebugScript, "computeOperation(bufPtr, %c, %d)", oper & 0xFF, var3 & 0xFF);
+ debugC(1, kDebugScriptTBC, "computeOperation(bufPtr, %c, %d)", oper & 0xFF, var3 & 0xFF);
switch (oper & 0xFF) {
case '=':
@@ -1045,7 +1045,7 @@ void LilliputScript::sub185B4_display() {
}
void LilliputScript::sub1823E(byte index, byte var1, byte *curBufPtr) {
- debugC(1, kDebugScript, "sub1823E(%d, %d, curBufPtr)", index, var1);
+ debugC(1, kDebugScriptTBC, "sub1823E(%d, %d, curBufPtr)", index, var1);
assert (index < 40);
_characterScriptEnabled[index] = 1;
@@ -1056,7 +1056,7 @@ void LilliputScript::sub1823E(byte index, byte var1, byte *curBufPtr) {
}
void LilliputScript::sub17B6C(int var1) {
- debugC(1, kDebugScript, "sub17B6C(%d)", var1);
+ debugC(1, kDebugScriptTBC, "sub17B6C(%d)", var1);
if (var1 == 0) {
int curWord = 0;
@@ -1080,7 +1080,7 @@ void LilliputScript::sub17B6C(int var1) {
}
void LilliputScript::sub16C86(int index, byte *buf) {
- debugC(1, kDebugScript, "sub16C86()");
+ debugC(1, kDebugScriptTBC, "sub16C86()");
_array12811[index] = 0;
@@ -1090,7 +1090,7 @@ void LilliputScript::sub16C86(int index, byte *buf) {
}
void LilliputScript::sub16C5C(int index, byte var3) {
- debugC(1, kDebugScript, "sub16C5C(%d, %d)", index, var3);
+ debugC(1, kDebugScriptTBC, "sub16C5C(%d, %d)", index, var3);
assert(index < 40);
_array12839[index] = var3;
@@ -1109,7 +1109,7 @@ void LilliputScript::sub16C5C(int index, byte var3) {
}
void LilliputScript::sub17D40(bool &forceReturnFl) {
- debugC(1, kDebugScript, "sub17D40()");
+ debugC(1, kDebugScriptTBC, "sub17D40()");
forceReturnFl = false;
if ((_vm->_displayMap != 1) && (_vm->_characterRelativePositionX[_vm->_currentScriptCharacter] != 0xFF))
@@ -1120,7 +1120,7 @@ void LilliputScript::sub17D40(bool &forceReturnFl) {
}
void LilliputScript::sub189F5() {
- debugC(2, kDebugScript, "sub189F5()");
+ debugC(2, kDebugScriptTBC, "sub189F5()");
int index = 0;
int var2 = 0x100;
@@ -1158,7 +1158,7 @@ void LilliputScript::sub189F5() {
}
void LilliputScript::sub189B8() {
- debugC(2, kDebugScript, "sub189B8()");
+ debugC(2, kDebugScriptTBC, "sub189B8()");
sub189F5();
int index = 0;
@@ -1177,7 +1177,7 @@ void LilliputScript::sub189B8() {
}
void LilliputScript::sub18A56(byte *buf) {
- debugC(2, kDebugScript, "sub18A56(buf)");
+ debugC(2, kDebugScriptTBC, "sub18A56(buf)");
static const char *nounsArrayPtr = "I am |You are |you are |hou art |in the |is the |is a |in a |To the |to the |by |going |here |The|the|and |some |build|not |way|I |a |an |from |of |him|her|by |his |ing |tion|have |you|I''ve |can''t |up |to |he |she |down |what|What|with|are |and|ent|ian|ome|ed |me|my|ai|it|is|of|oo|ea|er|es|th|we|ou|ow|or|gh|go|er|st|ee|th|sh|ch|ct|on|ly|ng|nd|nt|ty|ll|le|de|as|ie|in|ss|''s |''t |re|gg|tt|pp|nn|ay|ar|wh|";
@@ -1232,7 +1232,7 @@ void LilliputScript::sub18A56(byte *buf) {
}
int LilliputScript::sub18BB7(int index) {
- debugC(2, kDebugScript, "sub18BB7(%d)", index);
+ debugC(2, kDebugScriptTBC, "sub18BB7(%d)", index);
int chunk4Index = _vm->_rulesChunk3[index];
int result = 0;
@@ -1243,7 +1243,7 @@ int LilliputScript::sub18BB7(int index) {
}
void LilliputScript::sub18B3C(int var) {
- debugC(2, kDebugScript, "sub18B3C(%d)", var);
+ debugC(2, kDebugScriptTBC, "sub18B3C(%d)", var);
if (var == 0xFFFF)
return;
@@ -1259,7 +1259,6 @@ void LilliputScript::sub18B3C(int var) {
if (count != 0) {
int tmpVal = _vm->_rnd->getRandomNumber(count + 1);
if (tmpVal != 0) {
- int i = 0;
for (int j = 0; j < tmpVal; j++) {
do
++i;
@@ -1272,7 +1271,7 @@ void LilliputScript::sub18B3C(int var) {
}
int16 LilliputScript::getValue1() {
- debugC(2, kDebugScript, "getValue1()");
+ debugC(2, kDebugScriptTBC, "getValue1()");
int16 curWord = _currScript->readUint16LE();
if (curWord < 1000)
@@ -1296,7 +1295,7 @@ int16 LilliputScript::getValue1() {
}
Common::Point LilliputScript::getPosFromScript() {
- debugC(2, kDebugScript, "getPosFromScript()");
+ debugC(2, kDebugScriptTBC, "getPosFromScript()");
int curWord = _currScript->readUint16LE();
int tmpVal = curWord >> 8;
@@ -1347,14 +1346,14 @@ Common::Point LilliputScript::getPosFromScript() {
case 0xF6:
return _vm->_savedMousePosDivided;
default:
- Common::Point tmpVal = Common::Point(curWord >> 8, curWord & 0xFF);
- warning("getPosFromScript - High value %d -> %d %d", curWord, tmpVal.x, tmpVal.y);
- return tmpVal;
+ Common::Point pos = Common::Point(curWord >> 8, curWord & 0xFF);
+ warning("getPosFromScript - High value %d -> %d %d", curWord, pos.x, pos.y);
+ return pos;
}
}
void LilliputScript::sub130B6() {
- debugC(1, kDebugScript, "sub130B6()");
+ debugC(1, kDebugScriptTBC, "sub130B6()");
assert(_vm->_word12F68_ERULES <= 20);
for (int i = 0; i < _vm->_word12F68_ERULES; i++) {
@@ -1364,7 +1363,7 @@ void LilliputScript::sub130B6() {
}
byte *LilliputScript::getCharacterVariablePtr() {
- debugC(2, kDebugScript, "getCharacterVariablePtr()");
+ debugC(2, kDebugScriptTBC, "getCharacterVariablePtr()");
int8 tmpVal = (int8) (getValue1() & 0xFF);
int index = tmpVal * 32;
@@ -1374,7 +1373,7 @@ byte *LilliputScript::getCharacterVariablePtr() {
}
byte LilliputScript::OC_checkCharacterGoalPos() {
- debugC(2, kDebugScript, "OC_checkCharacterGoalPos()");
+ debugC(2, kDebugScriptTBC, "OC_checkCharacterGoalPos()");
if (_vm->_currentScriptCharacterPos == getPosFromScript()) {
return 1;
@@ -1383,7 +1382,7 @@ byte LilliputScript::OC_checkCharacterGoalPos() {
}
byte LilliputScript::OC_comparePos() {
- debugC(2, kDebugScript, "OC_comparePos()");
+ debugC(2, kDebugScriptTBC, "OC_comparePos()");
int index = getValue1();
byte d1 = _array16123PosX[index];
@@ -1397,7 +1396,7 @@ byte LilliputScript::OC_comparePos() {
}
byte LilliputScript::OC_sub1740A() {
- debugC(1, kDebugScript, "OC_sub1740A()");
+ debugC(1, kDebugScriptTBC, "OC_sub1740A()");
Common::Point var = _vm->_currentScriptCharacterPos;
if (var == Common::Point(-1, -1)) {
@@ -1420,7 +1419,7 @@ byte LilliputScript::OC_sub1740A() {
// Compare field0 with value -> character id?
byte LilliputScript::OC_sub17434() {
- debugC(1, kDebugScript, "OC_sub17434()");
+ debugC(1, kDebugScriptTBC, "OC_sub17434()");
byte *tmpArr = getCharacterVariablePtr();
byte var1 = tmpArr[0];
@@ -1431,7 +1430,7 @@ byte LilliputScript::OC_sub17434() {
}
byte LilliputScript::OC_sub17468() {
- debugC(1, kDebugScript, "OC_sub17468()");
+ debugC(1, kDebugScriptTBC, "OC_sub17468()");
int operation = _currScript->readUint16LE();
int val2 = _currScript->readUint16LE();
@@ -1439,7 +1438,7 @@ byte LilliputScript::OC_sub17468() {
}
byte LilliputScript::OC_getRandom() {
- debugC(1, kDebugScript, "OC_getRandom()");
+ debugC(1, kDebugScriptTBC, "OC_getRandom()");
int maxVal = _currScript->readUint16LE();
int rand = _vm->_rnd->getRandomNumber(maxVal);
@@ -1452,7 +1451,7 @@ byte LilliputScript::OC_getRandom() {
}
byte LilliputScript::OC_for() {
- debugC(1, kDebugScript, "OC_for()");
+ debugC(1, kDebugScriptTBC, "OC_for()");
int var1 = _currScript->readUint16LE();
int tmpVal = _currScript->readUint16LE() + 1;
@@ -1467,7 +1466,7 @@ byte LilliputScript::OC_for() {
}
byte LilliputScript::OC_compWord18776() {
- debugC(1, kDebugScript, "OC_compWord18776()");
+ debugC(1, kDebugScriptTBC, "OC_compWord18776()");
int var1 = _currScript->readUint16LE();
@@ -1478,7 +1477,7 @@ byte LilliputScript::OC_compWord18776() {
}
byte LilliputScript::OC_checkSaveFlag() {
- debugC(1, kDebugScript, "OC_checkSaveFlag()");
+ debugC(1, kDebugScriptTBC, "OC_checkSaveFlag()");
if (_vm->_saveFlag)
return 1;
@@ -1497,7 +1496,7 @@ byte LilliputScript::OC_compByte16F04() {
}
byte LilliputScript::OC_sub174D8() {
- debugC(1, kDebugScript, "OC_sub174D8()");
+ debugC(1, kDebugScriptTBC, "OC_sub174D8()");
byte tmpVal = getValue1() & 0xFF;
int curWord = _currScript->readUint16LE();
@@ -1524,7 +1523,7 @@ byte LilliputScript::OC_sub174D8() {
}
byte LilliputScript::OC_sub1750E() {
- debugC(1, kDebugScript, "OC_sub1750E()");
+ debugC(1, kDebugScriptTBC, "OC_sub1750E()");
byte* buf1 = getCharacterVariablePtr();
int var1 = *buf1;
@@ -1539,7 +1538,7 @@ byte LilliputScript::OC_sub1750E() {
// TODO Rename function to "Check if character pos in rectangle"
byte LilliputScript::OC_compareCoords_1() {
- debugC(1, kDebugScript, "OC_compareCoords_1()");
+ debugC(1, kDebugScriptTBC, "OC_compareCoords_1()");
int index = _currScript->readUint16LE();
assert(index < 40);
@@ -1556,7 +1555,7 @@ byte LilliputScript::OC_compareCoords_1() {
// TODO Rename function to "Check if character pos in rectangle"
byte LilliputScript::OC_compareCoords_2() {
- debugC(1, kDebugScript, "OC_compareCoords_2()");
+ debugC(1, kDebugScriptTBC, "OC_compareCoords_2()");
int index = getValue1();
Common::Point var1 = Common::Point(_array16123PosX[index], _array1614BPosY[index]);
@@ -1579,7 +1578,7 @@ byte LilliputScript::OC_sub1759E() {
}
byte LilliputScript::OC_compWord16EF8() {
- debugC(1, kDebugScript, "OC_compWord16EF8()");
+ debugC(1, kDebugScriptTBC, "OC_compWord16EF8()");
int tmpVal = getValue1();
if (tmpVal == _vm->_currentScriptCharacter)
@@ -1588,7 +1587,7 @@ byte LilliputScript::OC_compWord16EF8() {
}
byte LilliputScript::OC_sub175C8() {
- debugC(1, kDebugScript, "OC_sub175C8()");
+ debugC(1, kDebugScriptTBC, "OC_sub175C8()");
byte var4 = _currScript->readUint16LE() & 0xFF;
@@ -1632,7 +1631,7 @@ byte LilliputScript::OC_sub175C8() {
}
byte LilliputScript::OC_sub17640() {
- debugC(1, kDebugScript, "OC_sub176C4()");
+ debugC(1, kDebugScriptTBC, "OC_sub176C4()");
int var4 = _currScript->readUint16LE();
int index = _vm->_currentScriptCharacter * 40;
@@ -1683,7 +1682,7 @@ byte LilliputScript::OC_sub17640() {
}
byte LilliputScript::OC_sub176C4() {
- debugC(1, kDebugScript, "OC_sub176C4()");
+ debugC(1, kDebugScriptTBC, "OC_sub176C4()");
byte var4 = _currScript->readUint16LE() & 0xFF;
@@ -1727,7 +1726,7 @@ byte LilliputScript::OC_sub176C4() {
}
byte LilliputScript::OC_compWord10804() {
- debugC(1, kDebugScript, "OC_compWord10804()");
+ debugC(1, kDebugScriptTBC, "OC_compWord10804()");
byte tmpVal = getValue1();
if (tmpVal == _vm->_word10804)
@@ -1737,7 +1736,7 @@ byte LilliputScript::OC_compWord10804() {
}
byte LilliputScript::OC_sub17766() {
- debugC(1, kDebugScript, "OC_sub17766()");
+ debugC(1, kDebugScriptTBC, "OC_sub17766()");
byte var1 = (_currScript->readUint16LE() & 0xFF);
if ((var1 == _array12839[_vm->_currentScriptCharacter]) && (_array12811[_vm->_currentScriptCharacter] != 16))
@@ -1747,7 +1746,7 @@ byte LilliputScript::OC_sub17766() {
}
byte LilliputScript::OC_sub17782() {
- debugC(1, kDebugScript, "OC_sub17782()");
+ debugC(1, kDebugScriptTBC, "OC_sub17782()");
byte var1 = (_currScript->readUint16LE() & 0xFF);
if ((var1 == _array12839[_vm->_currentScriptCharacter]) && (_array12811[_vm->_currentScriptCharacter] == 16))
@@ -1757,13 +1756,13 @@ byte LilliputScript::OC_sub17782() {
}
byte *LilliputScript::getMapPtr(Common::Point val) {
- debugC(1, kDebugScript, "getMapPtr(%d %d)", val.x, val.y);
+ debugC(1, kDebugScriptTBC, "getMapPtr(%d %d)", val.x, val.y);
return &_vm->_bufferIsoMap[(val.y * 64 + val.x) << 2];
}
byte LilliputScript::OC_sub1779E() {
- debugC(1, kDebugScript, "OC_sub1779E()");
+ debugC(1, kDebugScriptTBC, "OC_sub1779E()");
Common::Point tmpVal = getPosFromScript();
@@ -1781,17 +1780,17 @@ byte LilliputScript::OC_sub1779E() {
}
byte LilliputScript::OC_sub177C6() {
- debugC(1, kDebugScript, "OC_sub177C6()");
+ debugC(1, kDebugScriptTBC, "OC_sub177C6()");
int index = getValue1();
- if (_vm->_characterPositionX[index] == 0xFFFF)
+ if (_vm->_characterPositionX[index] == -1)
return 0;
return 1;
}
byte LilliputScript::OC_compWord16EFE() {
- debugC(1, kDebugScript, "OC_compWord16EFE()");
+ debugC(1, kDebugScriptTBC, "OC_compWord16EFE()");
byte curByte = _currScript->readUint16LE() & 0xFF;
byte tmpVal = _vm->_word16EFE >> 8;
@@ -1804,7 +1803,7 @@ byte LilliputScript::OC_compWord16EFE() {
}
byte LilliputScript::OC_sub177F5() {
- debugC(1, kDebugScript, "OC_sub177F5()");
+ debugC(1, kDebugScriptTBC, "OC_sub177F5()");
byte var1 = _currScript->readUint16LE() & 0xFF;
byte var2 = _currScript->readUint16LE() & 0xFF;
@@ -1818,7 +1817,7 @@ byte LilliputScript::OC_sub177F5() {
}
byte LilliputScript::OC_sub17812() {
- debugC(1, kDebugScript, "OC_sub17812()");
+ debugC(1, kDebugScriptTBC, "OC_sub17812()");
byte curByte = (_currScript->readUint16LE() & 0xFF);
assert(_vm->_currentCharacterVariables != NULL);
@@ -1828,7 +1827,7 @@ byte LilliputScript::OC_sub17812() {
}
byte LilliputScript::OC_sub17825() {
- debugC(1, kDebugScript, "OC_sub17825()");
+ debugC(1, kDebugScriptTBC, "OC_sub17825()");
byte tmpVal = (_currScript->readUint16LE() & 0xFF);
@@ -1842,7 +1841,7 @@ byte LilliputScript::OC_sub17825() {
}
byte LilliputScript::OC_sub17844() {
- debugC(1, kDebugScript, "OC_sub17844()");
+ debugC(1, kDebugScriptTBC, "OC_sub17844()");
int tmpVal = _currScript->readUint16LE();
@@ -1853,7 +1852,7 @@ byte LilliputScript::OC_sub17844() {
}
byte LilliputScript::OC_sub1785C() {
- debugC(1, kDebugScript, "OC_sub1785C()");
+ debugC(1, kDebugScriptTBC, "OC_sub1785C()");
byte curByte = (_currScript->readUint16LE() & 0xFF);
int count = 0;
@@ -1870,7 +1869,7 @@ byte LilliputScript::OC_sub1785C() {
}
byte LilliputScript::OC_sub17886() {
- debugC(1, kDebugScript, "OC_sub17886()");
+ debugC(1, kDebugScriptTBC, "OC_sub17886()");
Common::Point var1 = getPosFromScript();
@@ -1883,7 +1882,7 @@ byte LilliputScript::OC_sub17886() {
}
byte LilliputScript::OC_CompareGameVariables() {
- debugC(1, kDebugScript, "OC_CompareGameVariables()");
+ debugC(1, kDebugScriptTBC, "OC_CompareGameVariables()");
int var1 = getValue1();
int var2 = getValue1();
@@ -1893,14 +1892,14 @@ byte LilliputScript::OC_CompareGameVariables() {
}
byte LilliputScript::OC_skipNextOpcode() {
- debugC(1, kDebugScript, "OC_skipNextOpcode()");
+ debugC(1, kDebugScriptTBC, "OC_skipNextOpcode()");
_currScript->readUint16LE();
return 1;
}
byte LilliputScript::OC_sub178C2() {
- debugC(1, kDebugScript, "OC_sub178C2()");
+ debugC(1, kDebugScriptTBC, "OC_sub178C2()");
assert(_vm->_currentCharacterVariables != NULL);
if (_vm->_currentCharacterVariables[2] == 1)
@@ -1909,7 +1908,7 @@ byte LilliputScript::OC_sub178C2() {
}
byte LilliputScript::OC_sub178D2() {
- debugC(1, kDebugScript, "OC_sub178D2()");
+ debugC(1, kDebugScriptTBC, "OC_sub178D2()");
int index = getValue1();
assert (index < 40);
@@ -1923,7 +1922,7 @@ byte LilliputScript::OC_sub178D2() {
}
byte LilliputScript::OC_sub178E8() {
- debugC(1, kDebugScript, "OC_sub178E8()");
+ debugC(1, kDebugScriptTBC, "OC_sub178E8()");
byte *bufPtr = getCharacterVariablePtr();
byte var1 = bufPtr[0];
@@ -1936,7 +1935,7 @@ byte LilliputScript::OC_sub178E8() {
}
byte LilliputScript::OC_sub178FC() {
- debugC(1, kDebugScript, "OC_sub178FC()");
+ debugC(1, kDebugScriptTBC, "OC_sub178FC()");
assert(_vm->_currentCharacterVariables != NULL);
byte curByte = (_currScript->readUint16LE() & 0xFF);
@@ -1947,7 +1946,7 @@ byte LilliputScript::OC_sub178FC() {
}
byte LilliputScript::OC_sub1790F() {
- debugC(1, kDebugScript, "OC_sub1790F()");
+ debugC(1, kDebugScriptTBC, "OC_sub1790F()");
int index = getValue1();
assert(index < 40);
@@ -1960,7 +1959,7 @@ byte LilliputScript::OC_sub1790F() {
}
byte LilliputScript::OC_sub1792A() {
- debugC(1, kDebugScript, "OC_sub1792A()");
+ debugC(1, kDebugScriptTBC, "OC_sub1792A()");
assert(_vm->_currentCharacterVariables != NULL);
byte curByte = (_currScript->readUint16LE() & 0xFF);
@@ -1972,7 +1971,7 @@ byte LilliputScript::OC_sub1792A() {
}
byte LilliputScript::OC_sub1793E() {
- debugC(1, kDebugScript, "OC_sub1793E()");
+ debugC(1, kDebugScriptTBC, "OC_sub1793E()");
if (_vm->_currentScriptCharacterPos == Common::Point(-1, -1))
return 0;
@@ -1984,7 +1983,7 @@ byte LilliputScript::OC_sub1793E() {
}
byte LilliputScript::OC_sub1795E() {
- debugC(1, kDebugScript, "OC_sub1795E()");
+ debugC(1, kDebugScriptTBC, "OC_sub1795E()");
assert(_vm->_currentCharacterVariables != NULL);
if (_vm->_currentCharacterVariables[3] == 1)
@@ -1994,7 +1993,7 @@ byte LilliputScript::OC_sub1795E() {
}
byte LilliputScript::OC_checkCharacterDirection() {
- debugC(1, kDebugScript, "OC_checkCharacterDirection()");
+ debugC(1, kDebugScriptTBC, "OC_checkCharacterDirection()");
int var1 = getValue1();
int var2 = _currScript->readUint16LE();
@@ -2005,7 +2004,7 @@ byte LilliputScript::OC_checkCharacterDirection() {
}
byte LilliputScript::OC_sub17984() {
- debugC(1, kDebugScript, "OC_sub17984()");
+ debugC(1, kDebugScriptTBC, "OC_sub17984()");
int index = _currScript->readUint16LE();
int var2 = _currScript->readUint16LE();
@@ -2019,7 +2018,7 @@ byte LilliputScript::OC_sub17984() {
}
byte LilliputScript::OC_checkSavedMousePos() {
- debugC(1, kDebugScript, "OC_checkSavedMousePos()");
+ debugC(1, kDebugScriptTBC, "OC_checkSavedMousePos()");
if ((_byte129A0 != 0xFF) || (_vm->_savedMousePosDivided == Common::Point(-1, -1)))
return 0;
@@ -2028,7 +2027,7 @@ byte LilliputScript::OC_checkSavedMousePos() {
}
byte LilliputScript::OC_sub179AE() {
- debugC(1, kDebugScript, "OC_sub179AE()");
+ debugC(1, kDebugScriptTBC, "OC_sub179AE()");
if ((_vm->_byte12FCE == 1) || (_byte129A0 == 0xFF))
return 0;
@@ -2037,7 +2036,7 @@ byte LilliputScript::OC_sub179AE() {
}
byte LilliputScript::OC_sub179C2() {
- debugC(1, kDebugScript, "OC_sub179C2()");
+ debugC(1, kDebugScriptTBC, "OC_sub179C2()");
Common::Point var1 = getPosFromScript();
if ((_vm->_array10999PosX[_vm->_currentScriptCharacter] == var1.x)
@@ -2047,7 +2046,7 @@ byte LilliputScript::OC_sub179C2() {
return 0;
}
byte LilliputScript::OC_sub179E5() {
- debugC(1, kDebugScript, "OC_sub17A07()");
+ debugC(1, kDebugScriptTBC, "OC_sub17A07()");
static const byte _byte179DB[10] = {0x44, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, 0x40, 0x41, 0x42, 0x43};
@@ -2060,7 +2059,7 @@ byte LilliputScript::OC_sub179E5() {
}
byte LilliputScript::OC_sub17A07() {
- debugC(1, kDebugScript, "OC_sub17A07()");
+ debugC(1, kDebugScriptTBC, "OC_sub17A07()");
static const byte _array179FD[10] = {11, 2, 3, 4, 5, 6, 7, 8, 9, 10};
@@ -2082,7 +2081,7 @@ byte LilliputScript::OC_sub17A07() {
}
byte LilliputScript::OC_sub17757() {
- debugC(1, kDebugScript, "OC_sub17757()");
+ debugC(1, kDebugScriptTBC, "OC_sub17757()");
int var1 = getValue1();
if ( var1 == _viewportCharacterTarget )
@@ -2092,11 +2091,11 @@ byte LilliputScript::OC_sub17757() {
}
void LilliputScript::OC_setWord18821() {
- debugC(1, kDebugScript, "OC_setWord18821()");
+ debugC(1, kDebugScriptTBC, "OC_setWord18821()");
_word18821 = getValue1();
}
void LilliputScript::OC_sub17A3E() {
- debugC(1, kDebugScript, "OC_sub17A3E()");
+ debugC(1, kDebugScriptTBC, "OC_sub17A3E()");
Common::Point var1 = getPosFromScript();
int var2 = _currScript->readUint16LE();
int var3 = _currScript->readUint16LE();
@@ -2114,7 +2113,7 @@ void LilliputScript::OC_sub17A3E() {
}
void LilliputScript::OC_sub17D57() {
- debugC(1, kDebugScript, "OC_sub17D57()");
+ debugC(1, kDebugScriptTBC, "OC_sub17D57()");
int curWord = _currScript->readUint16LE();
@@ -2129,7 +2128,7 @@ void LilliputScript::OC_sub17D57() {
}
void LilliputScript::sub18B7C(int var1, int var3) {
- debugC(2, kDebugScript, "sub18B7C(%d, %d)", var1, var3);
+ debugC(2, kDebugScriptTBC, "sub18B7C(%d, %d)", var1, var3);
if (var1 == 0xFFFF)
return;
@@ -2155,7 +2154,7 @@ void LilliputScript::sub18B7C(int var1, int var3) {
}
void LilliputScript::OC_sub17D7F() {
- debugC(1, kDebugScript, "OC_sub17D7F()");
+ debugC(1, kDebugScriptTBC, "OC_sub17D7F()");
int var1 = getCharacterVariablePtr()[0];
int var2 = (_currScript->readUint16LE() & 0xFF);
@@ -2174,7 +2173,7 @@ void LilliputScript::OC_sub17D7F() {
}
void LilliputScript::OC_sub17DB9() {
- debugC(1, kDebugScript, "OC_sub17DB9()");
+ debugC(1, kDebugScriptTBC, "OC_sub17DB9()");
int index = _currScript->readUint16LE();
int maxValue = sub18BB7(index);
@@ -2197,7 +2196,7 @@ void LilliputScript::OC_sub17DB9() {
}
void LilliputScript::OC_sub17DF9() {
- debugC(1, kDebugScript, "OC_sub17DF9()");
+ debugC(1, kDebugScriptTBC, "OC_sub17DF9()");
if ((_word1881B & 0xFF) == 0xFF) {
OC_sub17D57();
@@ -2208,7 +2207,7 @@ void LilliputScript::OC_sub17DF9() {
}
void LilliputScript::OC_sub17E07() {
- debugC(1, kDebugScript, "OC_sub17E07()");
+ debugC(1, kDebugScriptTBC, "OC_sub17E07()");
if ((_word1881B & 0xFF) == 0xFF) {
OC_sub17D7F();
@@ -2222,7 +2221,7 @@ void LilliputScript::OC_sub17E07() {
}
void LilliputScript::OC_sub17E15() {
- debugC(1, kDebugScript, "OC_sub17E15()");
+ debugC(1, kDebugScriptTBC, "OC_sub17E15()");
if ((_word1881B & 0xFF) == 0xFF) {
OC_sub17DB9();
@@ -2233,7 +2232,7 @@ void LilliputScript::OC_sub17E15() {
}
void LilliputScript::OC_sub17B03() {
- debugC(1, kDebugScript, "OC_sub17B03()");
+ debugC(1, kDebugScriptTBC, "OC_sub17B03()");
byte *bufPtr = getCharacterVariablePtr();
int oper = _currScript->readUint16LE();
@@ -2243,7 +2242,7 @@ void LilliputScript::OC_sub17B03() {
}
void LilliputScript::OC_getRandom_type2() {
- debugC(1, kDebugScript, "OC_getRandom_type2()");
+ debugC(1, kDebugScriptTBC, "OC_getRandom_type2()");
byte* bufPtr = getCharacterVariablePtr();
int maxVal = _currScript->readUint16LE();
@@ -2252,7 +2251,7 @@ void LilliputScript::OC_getRandom_type2() {
}
void LilliputScript::OC_setCharacterPosition() {
- debugC(1, kDebugScript, "OC_setCharacterPosition()");
+ debugC(1, kDebugScriptTBC, "OC_setCharacterPosition()");
int index = getValue1();
Common::Point tmpVal = getPosFromScript();
@@ -2266,7 +2265,7 @@ void LilliputScript::OC_setCharacterPosition() {
}
void LilliputScript::OC_sub17A8D() {
- debugC(1, kDebugScript, "OC_sub17A8D()");
+ debugC(1, kDebugScriptTBC, "OC_sub17A8D()");
int tmpVal = getValue1();
assert(tmpVal < 40);
@@ -2283,7 +2282,7 @@ void LilliputScript::OC_saveAndQuit() {
}
void LilliputScript::OC_sub17B93() {
- debugC(1, kDebugScript, "OC_sub17B93()");
+ debugC(1, kDebugScriptTBC, "OC_sub17B93()");
int var1 = _currScript->readUint16LE();
sub17B6C(var1);
@@ -2294,7 +2293,7 @@ void LilliputScript::OC_sub17E37() {
}
void LilliputScript::OC_resetByte1714E() {
- debugC(1, kDebugScript, "OC_resetByte1714E()");
+ debugC(1, kDebugScriptTBC, "OC_resetByte1714E()");
_vm->_byte1714E = 0;
}
@@ -2304,13 +2303,13 @@ void LilliputScript::OC_deleteSavegameAndQuit() {
}
void LilliputScript::OC_incByte16F04() {
- debugC(1, kDebugScript, "OC_incByte16F04()");
+ debugC(1, kDebugScriptTBC, "OC_incByte16F04()");
++_byte16F04;
}
void LilliputScript::OC_sub17BA5() {
- debugC(1, kDebugScript, "OC_sub17BA5()");
+ debugC(1, kDebugScriptTBC, "OC_sub17BA5()");
byte *tmpArr = getCharacterVariablePtr();
byte oper = (_currScript->readUint16LE() & 0xFF);
@@ -2319,14 +2318,14 @@ void LilliputScript::OC_sub17BA5() {
}
void LilliputScript::OC_setByte18823() {
- debugC(1, kDebugScript, "OC_setByte18823()");
+ debugC(1, kDebugScriptTBC, "OC_setByte18823()");
byte *tmpArr = getCharacterVariablePtr();
_byte18823 = *tmpArr;
}
void LilliputScript::OC_callScript() {
- debugC(1, kDebugScript, "OC_callScript()");
+ debugC(1, kDebugScriptTBC, "OC_callScript()");
int index = _currScript->readUint16LE();
int var1 = getValue1();
@@ -2341,9 +2340,9 @@ void LilliputScript::OC_callScript() {
if (_byte16F05_ScriptHandler == 0) {
_vm->_byte1714E = 0;
- debugC(1, kDebugScript, "========================== Menu Script %d==============================", scriptIndex);
+ debugC(1, kDebugScriptTBC, "========================== Menu Script %d==============================", scriptIndex);
runMenuScript(ScriptStream(&_vm->_arrayGameScripts[scriptIndex], _vm->_arrayGameScriptIndex[index + 1] - _vm->_arrayGameScriptIndex[index]));
- debugC(1, kDebugScript, "========================== End of Menu Script==============================");
+ debugC(1, kDebugScriptTBC, "========================== End of Menu Script==============================");
} else {
runScript(ScriptStream(&_vm->_arrayGameScripts[scriptIndex], _vm->_arrayGameScriptIndex[index + 1] - _vm->_arrayGameScriptIndex[index]));
}
@@ -2354,14 +2353,14 @@ void LilliputScript::OC_callScript() {
}
void LilliputScript::OC_sub17BF2() {
- debugC(1, kDebugScript, "OC_sub17BF2()");
+ debugC(1, kDebugScriptTBC, "OC_sub17BF2()");
OC_callScript();
sub17B6C(0);
}
void LilliputScript::OC_setCurrentScriptCharacterPos() {
- debugC(1, kDebugScript, "OC_setCurrentScriptCharacterPos()");
+ debugC(1, kDebugScriptTBC, "OC_setCurrentScriptCharacterPos()");
Common::Point pos = getPosFromScript();
_vm->_array10999PosX[_vm->_currentScriptCharacter] = pos.x;
@@ -2370,33 +2369,33 @@ void LilliputScript::OC_setCurrentScriptCharacterPos() {
}
void LilliputScript::OC_resetByte16F04() {
- debugC(1, kDebugScript, "OC_resetByte16F04()");
+ debugC(1, kDebugScriptTBC, "OC_resetByte16F04()");
_byte16F04 = 0;
}
void LilliputScript::OC_sub17AE1() {
- debugC(1, kDebugScript, "OC_sub17AE1()");
+ debugC(1, kDebugScriptTBC, "OC_sub17AE1()");
byte var3 = (_currScript->readUint16LE() & 0xFF);
sub16C5C(_vm->_currentScriptCharacter, var3);
}
void LilliputScript::OC_sub17AEE() {
- debugC(1, kDebugScript, "OC_sub17AEE()");
+ debugC(1, kDebugScriptTBC, "OC_sub17AEE()");
byte var3 = (_currScript->readUint16LE() & 0xFF);
sub16C5C(_vm->_currentScriptCharacter + 1, var3);
}
void LilliputScript::OC_setWord10804() {
- debugC(1, kDebugScript, "OC_setWord10804()");
+ debugC(1, kDebugScriptTBC, "OC_setWord10804()");
_vm->_word10804 = getValue1();
}
void LilliputScript::OC_sub17C0E() {
- debugC(1, kDebugScript, "OC_sub17C0E()");
+ debugC(1, kDebugScriptTBC, "OC_sub17C0E()");
assert(_vm->_currentCharacterVariables != NULL);
Common::Point var1 = Common::Point(_vm->_currentCharacterVariables[4], _vm->_currentCharacterVariables[5]);
@@ -2414,7 +2413,7 @@ void LilliputScript::OC_sub17C0E() {
}
void LilliputScript::OC_sub17C55() {
- debugC(1, kDebugScript, "OC_sub17C55()");
+ debugC(1, kDebugScriptTBC, "OC_sub17C55()");
int var1 = getValue1();
int var2 = getValue1();
@@ -2427,7 +2426,7 @@ void LilliputScript::OC_sub17C55() {
_vm->_rulesBuffer2_7[var2] = var4 & 0xFF;
}
void LilliputScript::OC_sub17C76() {
- debugC(1, kDebugScript, "OC_sub17C76()");
+ debugC(1, kDebugScriptTBC, "OC_sub17C76()");
int var1 = getValue1();
_vm->_rulesBuffer2_5[var1] = 0xFF;
@@ -2436,13 +2435,13 @@ void LilliputScript::OC_sub17C76() {
}
void LilliputScript::OC_sub17AFC() {
- debugC(1, kDebugScript, "OC_sub17AFC()");
+ debugC(1, kDebugScriptTBC, "OC_sub17AFC()");
int var1 = getValue1();
_vm->sub170EE(var1);
}
void LilliputScript::sub171AF(int var1, int var2, int var4) {
- debugC(2, kDebugScript, "sub171AF()");
+ debugC(2, kDebugScriptTBC, "sub171AF()");
int index = 0;
for (int i = 0; i < 10; i++) {
@@ -2456,7 +2455,7 @@ void LilliputScript::sub171AF(int var1, int var2, int var4) {
}
void LilliputScript::OC_sub17C8B() {
- debugC(1, kDebugScript, "OC_sub17C8B()");
+ debugC(1, kDebugScriptTBC, "OC_sub17C8B()");
int var1 = 2 << 8;
int var4 = _currScript->readUint16LE();
@@ -2467,7 +2466,7 @@ void LilliputScript::OC_sub17C8B() {
}
void LilliputScript::OC_sub17CA2() {
- debugC(1, kDebugScript, "OC_sub17CA2()");
+ debugC(1, kDebugScriptTBC, "OC_sub17CA2()");
int var1 = 1 << 8;
int var4 = _currScript->readUint16LE();
@@ -2478,7 +2477,7 @@ void LilliputScript::OC_sub17CA2() {
}
void LilliputScript::OC_sub17CB9() {
- debugC(1, kDebugScript, "OC_sub17CB9()");
+ debugC(1, kDebugScriptTBC, "OC_sub17CB9()");
int var4 = _currScript->readUint16LE();
int var1 = getValue1();
@@ -2489,7 +2488,7 @@ void LilliputScript::OC_sub17CB9() {
}
void LilliputScript::OC_sub17CD1() {
- debugC(1, kDebugScript, "OC_sub17CD1()");
+ debugC(1, kDebugScriptTBC, "OC_sub17CD1()");
int var1 = 3 << 8;
int var4 = _currScript->readUint16LE();
@@ -2500,13 +2499,13 @@ void LilliputScript::OC_sub17CD1() {
}
void LilliputScript::OC_resetWord16EFE() {
- debugC(1, kDebugScript, "OC_resetWord16EFE()");
+ debugC(1, kDebugScriptTBC, "OC_resetWord16EFE()");
_vm->_word16EFE = 0xFFFF;
}
void LilliputScript::OC_sub17CEF() {
- debugC(1, kDebugScript, "OC_sub17CEF()");
+ debugC(1, kDebugScriptTBC, "OC_sub17CEF()");
int var1 = _currScript->readUint16LE();
sub1823E(_vm->_currentScriptCharacter , var1, _vm->_currentCharacterVariables);
@@ -2514,14 +2513,14 @@ void LilliputScript::OC_sub17CEF() {
}
void LilliputScript::OC_sub17D1B() {
- debugC(1, kDebugScript, "OC_sub17D1B()");
+ debugC(1, kDebugScriptTBC, "OC_sub17D1B()");
assert(_vm->_currentCharacterVariables != NULL);
++_vm->_currentCharacterVariables[1];
}
void LilliputScript::OC_sub17D23() {
- debugC(1, kDebugScript, "OC_sub17D23()");
+ debugC(1, kDebugScriptTBC, "OC_sub17D23()");
int var1 = _currScript->readUint16LE();
Common::Point var2 = getPosFromScript();
@@ -2531,14 +2530,14 @@ void LilliputScript::OC_sub17D23() {
}
void LilliputScript::OC_sub17E6D() {
- debugC(1, kDebugScript, "OC_sub17E6D()");
+ debugC(1, kDebugScriptTBC, "OC_sub17E6D()");
int var1 = _currScript->readUint16LE();
_vm->_rulesBuffer2_12[_vm->_currentScriptCharacter] = (var1 - 2000) & 0xFF;
}
void LilliputScript::OC_changeCurrentCharacterSprite() {
- debugC(2, kDebugScript, "OC_changeCurrentCharacterSprite()");
+ debugC(2, kDebugScriptTBC, "OC_changeCurrentCharacterSprite()");
int var1 = _currScript->readUint16LE();
int var2 = _currScript->readUint16LE();
@@ -2548,14 +2547,14 @@ void LilliputScript::OC_changeCurrentCharacterSprite() {
}
byte *LilliputScript::sub173D2() {
- debugC(2, kDebugScript, "sub173D2()");
+ debugC(2, kDebugScriptTBC, "sub173D2()");
int index = _currScript->readUint16LE();
return &_vm->_currentCharacterVariables[index];
}
void LilliputScript::OC_sub17E99() {
- debugC(1, kDebugScript, "OC_sub17E99()");
+ debugC(1, kDebugScriptTBC, "OC_sub17E99()");
byte *compBuf = sub173D2();
int oper = _currScript->readUint16LE();
@@ -2569,7 +2568,7 @@ void LilliputScript::OC_sub17E99() {
}
void LilliputScript::OC_sub17EC5() {
- //debugC(1, kDebugScript, "OC_sub17EC5()");
+ //debugC(1, kDebugScriptTBC, "OC_sub17EC5()");
warning("OC_sub17EC5");
/*byte *compBuf = sub173D2();
int oper = _currScript->readUint16LE();
@@ -2583,13 +2582,13 @@ void LilliputScript::OC_sub17EC5() {
}
Common::Point LilliputScript::getCharacterTilePos(int index) {
- debugC(2, kDebugScript, "getCharacterTilePos(%d)", index);
+ debugC(2, kDebugScriptTBC, "getCharacterTilePos(%d)", index);
return Common::Point(_vm->_characterPositionX[index] >> 3, _vm->_characterPositionY[index] >> 3);
}
void LilliputScript::OC_setCharacterDirectionTowardsPos() {
- debugC(1, kDebugScript, "OC_setCharacterDirectionTowardsPos()");
+ debugC(1, kDebugScriptTBC, "OC_setCharacterDirectionTowardsPos()");
Common::Point pos1 = getPosFromScript();
Common::Point tilePos = getCharacterTilePos(_vm->_currentScriptCharacter);
@@ -2598,7 +2597,7 @@ void LilliputScript::OC_setCharacterDirectionTowardsPos() {
}
void LilliputScript::OC_sub17F08() {
- debugC(1, kDebugScript, "OC_sub17F08()");
+ debugC(1, kDebugScriptTBC, "OC_sub17F08()");
int index = getValue1();
@@ -2624,7 +2623,7 @@ void LilliputScript::OC_sub17F08() {
}
void LilliputScript::OC_sub17F4F() {
- debugC(1, kDebugScript, "OC_sub17F4F()");
+ debugC(1, kDebugScriptTBC, "OC_sub17F4F()");
int var = getValue1();
_array10A39[_vm->_currentScriptCharacter] = var & 0xFF;
@@ -2632,7 +2631,7 @@ void LilliputScript::OC_sub17F4F() {
}
void LilliputScript::OC_sub17F68() {
- debugC(1, kDebugScript, "OC_sub17F68()");
+ debugC(1, kDebugScriptTBC, "OC_sub17F68()");
if (_vm->_currentScriptCharacter != _viewportCharacterTarget)
return;
@@ -2667,13 +2666,13 @@ void LilliputScript::OC_sub17F68() {
}
void LilliputScript::OC_skipNextVal() {
- debugC(1, kDebugScript, "OC_skipNextVal()");
+ debugC(1, kDebugScriptTBC, "OC_skipNextVal()");
_currScript->readUint16LE();
}
void LilliputScript::OC_sub17FD2() {
- debugC(1, kDebugScript, "OC_sub17FD2()");
+ debugC(1, kDebugScriptTBC, "OC_sub17FD2()");
int var1 = getValue1();
_vm->_currentCharacterVariables[6] = var1 & 0xFF;
@@ -2681,7 +2680,7 @@ void LilliputScript::OC_sub17FD2() {
}
void LilliputScript::OC_sub17FDD() {
- debugC(1, kDebugScript, "OC_sub17FDD()");
+ debugC(1, kDebugScriptTBC, "OC_sub17FDD()");
int index = _currScript->readUint16LE();
@@ -2692,13 +2691,13 @@ void LilliputScript::OC_sub17FDD() {
}
void LilliputScript::OC_setByte10B29() {
- debugC(1, kDebugScript, "OC_setByte10B29()");
+ debugC(1, kDebugScriptTBC, "OC_setByte10B29()");
int var1 = getValue1();
_characterScriptEnabled[var1] = 1;
}
void LilliputScript::OC_sub18007() {
- debugC(1, kDebugScript, "OC_sub18007()");
+ debugC(1, kDebugScriptTBC, "OC_sub18007()");
int curWord = _currScript->readUint16LE();
assert(_vm->_currentCharacterVariables != NULL);
@@ -2706,14 +2705,14 @@ void LilliputScript::OC_sub18007() {
}
void LilliputScript::OC_sub18014() {
- debugC(1, kDebugScript, "OC_sub18014()");
+ debugC(1, kDebugScriptTBC, "OC_sub18014()");
assert(_vm->_currentCharacterVariables != NULL);
_vm->_currentCharacterVariables[2] = 0;
}
void LilliputScript::OC_sub1801D() {
- debugC(1, kDebugScript, "OC_sub18014()");
+ debugC(1, kDebugScriptTBC, "OC_sub18014()");
int var1 = getValue1();
@@ -2730,14 +2729,15 @@ void LilliputScript::OC_sub1801D() {
}
void LilliputScript::OC_sub1805D() {
- debugC(1, kDebugScript, "OC_sub1805D()");
-
- int var1 = getValue1();
-
+ debugC(1, kDebugScriptTBC, "OC_sub1805D()");
+
+ _word129A3 = getValue1();
+ for (int i = 0; i < 4; i++)
+ _array129A5[i] = _currScript->readUint16LE() & 0xFF;
}
void LilliputScript::OC_sub18074() {
- debugC(1, kDebugScript, "OC_sub18074()");
+ debugC(1, kDebugScriptTBC, "OC_sub18074()");
int var2 = _currScript->readUint16LE();
byte var1 = (_currScript->readUint16LE() & 0xFF);
@@ -2746,13 +2746,13 @@ void LilliputScript::OC_sub18074() {
}
void LilliputScript::OC_setCurrentCharacterDirection() {
- debugC(1, kDebugScript, "OC_setCurrentCharacterDirection()");
+ debugC(1, kDebugScriptTBC, "OC_setCurrentCharacterDirection()");
_vm->_characterDirectionArray[_vm->_currentScriptCharacter] = (_currScript->readUint16LE() & 0xFF);
}
void LilliputScript::OC_sub18099() {
- debugC(1, kDebugScript, "OC_sub18099()");
+ debugC(1, kDebugScriptTBC, "OC_sub18099()");
int index = _currScript->readUint16LE();
assert((index >= 0) && (index < 20));
@@ -2765,7 +2765,7 @@ void LilliputScript::OC_sub18099() {
}
void LilliputScript::OC_sub180C3() {
- debugC(1, kDebugScript, "OC_sub180C3()");
+ debugC(1, kDebugScriptTBC, "OC_sub180C3()");
_viewportCharacterTarget = 0xFFFF;
int var1 = _currScript->readUint16LE();
@@ -2794,7 +2794,7 @@ void LilliputScript::OC_sub180C3() {
}
void LilliputScript::OC_sub1810A() {
- debugC(1, kDebugScript, "OC_sub1810A()");
+ debugC(1, kDebugScriptTBC, "OC_sub1810A()");
_viewportCharacterTarget = 0xFFFF;
_viewportPos = getPosFromScript();
@@ -2804,13 +2804,13 @@ void LilliputScript::OC_sub1810A() {
}
void LilliputScript::OC_sub1812D() {
- debugC(1, kDebugScript, "OC_sub1812D()");
+ debugC(1, kDebugScriptTBC, "OC_sub1812D()");
_vm->_characterPositionAltitude[_vm->_currentScriptCharacter] = (_currScript->readUint16LE() & 0xFF);
}
void LilliputScript::OC_sub1817F() {
- debugC(1, kDebugScript, "OC_sub1817F()");
+ debugC(1, kDebugScriptTBC, "OC_sub1817F()");
int var1 = _currScript->readUint16LE();
int var2 = _currScript->readUint16LE();
@@ -2820,8 +2820,9 @@ void LilliputScript::OC_sub1817F() {
sub1818B(b1,b2);
}
+//TODO checkme: parameter order is maybe wrong
void LilliputScript::sub1818B(int b1, int b2) {
- debugC(2, kDebugScript, "sub1818B(%d, %d)", b1, b2);
+ debugC(2, kDebugScriptTBC, "sub1818B(%d, %d)", b1, b2);
for (int i = 0; i < _vm->_word1817B; i++) {
if ((_array1813B[i] >> 8) == b2 ) {
b2 += _array1813B[i] & 0xFF;
@@ -2837,8 +2838,9 @@ void LilliputScript::sub1818B(int b1, int b2) {
_array1813B[_vm->_word1817B++] = (b1 << 8) + b2;
}
+//TODO checkme: case 0x2D is dubious
void LilliputScript::OC_sub181BB() {
- debugC(1, kDebugScript, "OC_sub181BB()");
+ debugC(1, kDebugScriptTBC, "OC_sub181BB()");
int b = _currScript->readUint16LE();
int d = _currScript->readUint16LE() & 0xFF;
@@ -2861,14 +2863,14 @@ void LilliputScript::OC_sub181BB() {
c = c * 2;
}
- int a = _currScript->readUint16LE() * c + (c & 0xFF);
- b = b & 0xFF00 + a;
+ int a = (_currScript->readUint16LE() * c) + (c & 0xFF);
+ b = (b & 0xFF00) + a;
sub1818B(b & 0xFF, b >> 8);
}
void LilliputScript::OC_sub18213() {
- debugC(1, kDebugScript, "OC_sub18213()");
+ debugC(1, kDebugScriptTBC, "OC_sub18213()");
int var1 = _currScript->readUint16LE();
@@ -2885,7 +2887,7 @@ void LilliputScript::OC_sub18213() {
}
void LilliputScript::OC_sub18252() {
- debugC(1, kDebugScript, "OC_sub18252()");
+ debugC(1, kDebugScriptTBC, "OC_sub18252()");
int index = getValue1();
assert(index < 40);
@@ -2898,7 +2900,7 @@ void LilliputScript::OC_sub18260() {
}
void LilliputScript::OC_sub182EC() {
- debugC(1, kDebugScript, "OC_sub182EC()");
+ debugC(1, kDebugScriptTBC, "OC_sub182EC()");
byte *tmpArr = getCharacterVariablePtr();
@@ -2912,7 +2914,7 @@ void LilliputScript::OC_sub182EC() {
}
void LilliputScript::OC_PaletteFadeOut() {
- debugC(1, kDebugScript, "OC_PaletteFadeOut()");
+ debugC(1, kDebugScriptTBC, "OC_PaletteFadeOut()");
_byte12A09 = 1;
_vm->paletteFadeOut();
@@ -2920,7 +2922,7 @@ void LilliputScript::OC_PaletteFadeOut() {
}
void LilliputScript::OC_PaletteFadeIn() {
- debugC(1, kDebugScript, "OC_PaletteFadeIn()");
+ debugC(1, kDebugScriptTBC, "OC_PaletteFadeIn()");
_byte12A09 = 1;
_vm->paletteFadeIn();
@@ -2928,7 +2930,7 @@ void LilliputScript::OC_PaletteFadeIn() {
}
void LilliputScript::OC_loadAndDisplayCUBESx_GFX() {
- debugC(1, kDebugScript, "OC_loadAndDisplayCUBESx_GFX()");
+ debugC(1, kDebugScriptTBC, "OC_loadAndDisplayCUBESx_GFX()");
int curWord = _currScript->readUint16LE();
assert((curWord >= 0) && (curWord <= 9));
@@ -2941,7 +2943,7 @@ void LilliputScript::OC_loadAndDisplayCUBESx_GFX() {
}
void LilliputScript::OC_sub1834C() {
- debugC(1, kDebugScript, "OC_sub1834C()");
+ debugC(1, kDebugScriptTBC, "OC_sub1834C()");
byte curWord = _currScript->readUint16LE() & 0xFF;
assert(_vm->_currentCharacterVariables != NULL);
@@ -2950,14 +2952,14 @@ void LilliputScript::OC_sub1834C() {
}
void LilliputScript::OC_setArray122C1() {
- debugC(1, kDebugScript, "OC_setArray122C1()");
+ debugC(1, kDebugScriptTBC, "OC_setArray122C1()");
int var1 = _currScript->readUint16LE();
_array122C1[_vm->_currentScriptCharacter] = var1;
}
void LilliputScript::OC_sub18367() {
- debugC(1, kDebugScript, "OC_sub18367()");
+ debugC(1, kDebugScriptTBC, "OC_sub18367()");
_characterScriptEnabled[_vm->_currentScriptCharacter] = 1;
_vm->_currentCharacterVariables[0] = _array122C1[_vm->_currentScriptCharacter];
@@ -2967,7 +2969,7 @@ void LilliputScript::OC_sub18367() {
}
void LilliputScript::OC_sub17D04() {
- debugC(1, kDebugScript, "OC_sub17D04()");
+ debugC(1, kDebugScriptTBC, "OC_sub17D04()");
int16 index = getValue1();
byte var2 = _currScript->readUint16LE() & 0xFF;
@@ -2976,7 +2978,7 @@ void LilliputScript::OC_sub17D04() {
}
void LilliputScript::OC_sub18387() {
- debugC(1, kDebugScript, "OC_sub18387()");
+ debugC(1, kDebugScriptTBC, "OC_sub18387()");
int index = getValue1();
byte var1 = _currScript->readUint16LE() & 0xFF;
@@ -2986,13 +2988,13 @@ void LilliputScript::OC_sub18387() {
}
void LilliputScript::OC_setDebugFlag() {
- debugC(1, kDebugScript, "OC_setDebugFlag()");
+ debugC(1, kDebugScriptTBC, "OC_setDebugFlag()");
_vm->_debugFlag = 1;
}
void LilliputScript::OC_setByte14837() {
- debugC(1, kDebugScript, "OC_setByte14837()");
+ debugC(1, kDebugScriptTBC, "OC_setByte14837()");
_vm->_byte14837 = 1;
}
@@ -3005,7 +3007,7 @@ void LilliputScript::OC_sub183C6() {
}
void LilliputScript::OC_loadFile_AERIAL_GFX() {
- debugC(1, kDebugScript, "OC_loadFile_AERIAL_GFX()");
+ debugC(1, kDebugScriptTBC, "OC_loadFile_AERIAL_GFX()");
int var1 = _currScript->readUint16LE() & 0xff;
_vm->_byte15EAD = var1;
@@ -3033,7 +3035,7 @@ void LilliputScript::OC_sub1844A() {
}
void LilliputScript::OC_sub1847F() {
- debugC(1, kDebugScript, "OC_sub1847F()");
+ debugC(1, kDebugScriptTBC, "OC_sub1847F()");
byte *buf215Ptr = getCharacterVariablePtr();
byte tmpVal = buf215Ptr[0];
@@ -3051,7 +3053,7 @@ void LilliputScript::OC_sub1847F() {
}
void LilliputScript::sub18BE6(byte var1, int var2, int var4) {
- debugC(1, kDebugScript, "sub18BE6(%d, %d, %d)", var1, var2, var4);
+ debugC(1, kDebugScriptTBC, "sub18BE6(%d, %d, %d)", var1, var2, var4);
_vm->_displayStringIndex = 0;
_vm->_displayStringBuf[0] = 32;
@@ -3064,7 +3066,7 @@ void LilliputScript::sub18BE6(byte var1, int var2, int var4) {
}
void LilliputScript::OC_displayVGAFile() {
- debugC(1, kDebugScript, "OC_displayVGAFile()");
+ debugC(1, kDebugScriptTBC, "OC_displayVGAFile()");
_byte12A09 = 1;
OC_PaletteFadeOut();
@@ -3081,7 +3083,7 @@ void LilliputScript::OC_sub184D7() {
}
void LilliputScript::OC_displayTitleScreen() {
- debugC(1, kDebugScript, "OC_displayTitleScreen()");
+ debugC(1, kDebugScriptTBC, "OC_displayTitleScreen()");
_vm->_byte184F4 = (_currScript->readUint16LE() & 0xFF);
_vm->_sound_byte16F06 = _vm->_byte184F4;
@@ -3113,7 +3115,7 @@ void LilliputScript::OC_displayTitleScreen() {
}
void LilliputScript::OC_sub1853B() {
- debugC(1, kDebugScript, "OC_sub1853B()");
+ debugC(1, kDebugScriptTBC, "OC_sub1853B()");
OC_PaletteFadeOut();
_vm->_displayMap = 0;
@@ -3129,7 +3131,7 @@ void LilliputScript::OC_sub1853B() {
}
void LilliputScript::OC_sub1864D() {
- debugC(1, kDebugScript, "OC_sub1864D()");
+ debugC(1, kDebugScriptTBC, "OC_sub1864D()");
byte *tmpArr = getCharacterVariablePtr();
int var1 = (_currScript->readUint16LE() & 0xFF);
@@ -3141,7 +3143,7 @@ void LilliputScript::OC_sub1864D() {
}
void LilliputScript::OC_initArr18560() {
- debugC(1, kDebugScript, "OC_initArr18560()");
+ debugC(1, kDebugScriptTBC, "OC_initArr18560()");
int curWord = _currScript->readUint16LE();
assert (curWord < 4);
@@ -3154,7 +3156,7 @@ void LilliputScript::OC_initArr18560() {
}
void LilliputScript::OC_sub18678() {
- debugC(1, kDebugScript, "OC_initArr18578()");
+ debugC(1, kDebugScriptTBC, "OC_initArr18578()");
_savedBuffer215Ptr = getCharacterVariablePtr();
_heroismBarX = _currScript->readUint16LE();
_heroismBarBottomY = _currScript->readUint16LE();
@@ -3165,7 +3167,7 @@ void LilliputScript::OC_sub18690() {
}
void LilliputScript::OC_setViewPortCharacterTarget() {
- debugC(1, kDebugScript, "OC_setViewPortCharacterTarget()");
+ debugC(1, kDebugScriptTBC, "OC_setViewPortCharacterTarget()");
_viewportCharacterTarget = getValue1();
}
@@ -3175,7 +3177,7 @@ void LilliputScript::OC_sub186A1() {
}
void LilliputScript::OC_sub186E5_snd() {
- debugC(1, kDebugScript, "OC_sub186E5_snd()");
+ debugC(1, kDebugScriptTBC, "OC_sub186E5_snd()");
int index = getValue1();
assert(index < 40);
@@ -3191,7 +3193,7 @@ void LilliputScript::OC_sub186E5_snd() {
}
void LilliputScript::OC_sub1870A_snd() {
- debugC(1, kDebugScript, "OC_sub1870A_snd()");
+ debugC(1, kDebugScriptTBC, "OC_sub1870A_snd()");
Common::Point var3 = getPosFromScript();
Common::Point var4 = var3;
@@ -3202,7 +3204,7 @@ void LilliputScript::OC_sub1870A_snd() {
}
void LilliputScript::OC_sub18725_snd() {
- debugC(1, kDebugScript, "OC_sub18725_snd()");
+ debugC(1, kDebugScriptTBC, "OC_sub18725_snd()");
int var4 = getValue1() | 0xFF00;
@@ -3210,7 +3212,7 @@ void LilliputScript::OC_sub18725_snd() {
}
void LilliputScript::OC_sub18733_snd() {
- debugC(1, kDebugScript, "OC_sub18733_snd()");
+ debugC(1, kDebugScriptTBC, "OC_sub18733_snd()");
Common::Point var4 = getPosFromScript();
@@ -3218,13 +3220,13 @@ void LilliputScript::OC_sub18733_snd() {
}
void LilliputScript::OC_sub1873F_snd() {
- debugC(1, kDebugScript, "OC_sub1873F_snd()");
+ debugC(1, kDebugScriptTBC, "OC_sub1873F_snd()");
_vm->_soundHandler->contentFct4();
}
void LilliputScript::OC_sub18746_snd() {
- debugC(1, kDebugScript, "OC_sub18746_snd()");
+ debugC(1, kDebugScriptTBC, "OC_sub18746_snd()");
int var4 = -1;
int var2 = (_viewportPos.x << 8) + _viewportPos.y;
@@ -3234,13 +3236,13 @@ void LilliputScript::OC_sub18746_snd() {
}
void LilliputScript::OC_sub1875D_snd() {
- debugC(1, kDebugScript, "OC_sub1875D_snd()");
+ debugC(1, kDebugScriptTBC, "OC_sub1875D_snd()");
_vm->_soundHandler->contentFct6();
}
void LilliputScript::OC_sub18764() {
- debugC(1, kDebugScript, "OC_sub18764()");
+ debugC(1, kDebugScriptTBC, "OC_sub18764()");
int index = getValue1();
int var1 = _currScript->readUint16LE();
diff --git a/engines/lilliput/script.h b/engines/lilliput/script.h
index 2e62c1f9b5..8ef723e7b6 100644
--- a/engines/lilliput/script.h
+++ b/engines/lilliput/script.h
@@ -40,7 +40,7 @@ enum KValueType {
kCompareOperation,
kComputeOperation,
kGetValue1,
- kgetPosFromScript,
+ kgetPosFromScript
};
@@ -115,6 +115,9 @@ private:
int _word16F00;
int _word18776;
int _word18821;
+ int _word129A3;
+
+ char _array129A5[4];
int handleOpcode(ScriptStream *script);
byte handleOpcodeType1(int curWord);
diff --git a/engines/lilliput/sound.cpp b/engines/lilliput/sound.cpp
index d5f37d7df0..571191f060 100644
--- a/engines/lilliput/sound.cpp
+++ b/engines/lilliput/sound.cpp
@@ -33,6 +33,11 @@ LilliputSound::LilliputSound(LilliputEngine *vm) : _vm(vm) {
LilliputSound::~LilliputSound() {
}
+// Used during initialisation
+void LilliputSound::contentFct0() {
+ debugC(1, kDebugSound, "contentFct0()");
+}
+
void LilliputSound::contentFct1() {
debugC(1, kDebugSound, "contentFct1()");
}
diff --git a/engines/lilliput/sound.h b/engines/lilliput/sound.h
index 5fa84bfbcb..c4f2126cbb 100644
--- a/engines/lilliput/sound.h
+++ b/engines/lilliput/sound.h
@@ -32,6 +32,7 @@ public:
LilliputSound(LilliputEngine *vm);
~LilliputSound();
+ void contentFct0();
void contentFct1();
void contentFct2();
void contentFct3();
diff --git a/engines/lilliput/stream.cpp b/engines/lilliput/stream.cpp
index 03195dc955..cd0b918fa9 100644
--- a/engines/lilliput/stream.cpp
+++ b/engines/lilliput/stream.cpp
@@ -24,7 +24,7 @@
namespace Lilliput {
-ScriptStream::ScriptStream(byte *buf, int size) : Common::MemoryReadStream(buf, size) {
+ScriptStream::ScriptStream(byte *buf, int bufSize) : Common::MemoryReadStream(buf, bufSize) {
_orgPtr = buf;
}
diff --git a/engines/lilliput/stream.h b/engines/lilliput/stream.h
index d6b8c36510..52b80e3524 100644
--- a/engines/lilliput/stream.h
+++ b/engines/lilliput/stream.h
@@ -31,7 +31,7 @@ class ScriptStream : public Common::MemoryReadStream {
private:
byte *_orgPtr;
public:
- ScriptStream(byte *buf, int size);
+ ScriptStream(byte *buf, int bufSize);
virtual ~ScriptStream();
void writeUint16LE(int value, int relativePos = 0);