aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsylvaintv2012-05-17 02:27:17 +0200
committerEugene Sandulenko2018-03-28 17:36:57 +0200
commit6dd3a1009d6203b79dd3c610fb25f924c0ee6d52 (patch)
tree5e8b8541ec22efeac10598fd5419d21afaae423c
parentc914fdb0b76999c350159e881e53769990cc4149 (diff)
downloadscummvm-rg350-6dd3a1009d6203b79dd3c610fb25f924c0ee6d52.tar.gz
scummvm-rg350-6dd3a1009d6203b79dd3c610fb25f924c0ee6d52.tar.bz2
scummvm-rg350-6dd3a1009d6203b79dd3c610fb25f924c0ee6d52.zip
LILLIPUT: Fix pathfinding & some renaming
-rw-r--r--engines/lilliput/lilliput.cpp39
-rw-r--r--engines/lilliput/lilliput.h2
-rw-r--r--engines/lilliput/script.cpp28
-rw-r--r--engines/lilliput/script.h6
4 files changed, 37 insertions, 38 deletions
diff --git a/engines/lilliput/lilliput.cpp b/engines/lilliput/lilliput.cpp
index ceff413a74..455618e612 100644
--- a/engines/lilliput/lilliput.cpp
+++ b/engines/lilliput/lilliput.cpp
@@ -1463,8 +1463,8 @@ void LilliputEngine::sub167EF(int index) {
_array109E9PosX[index] = _rulesBuffer12Pos4[word167EB].x;
_array10A11PosY[index] = _rulesBuffer12Pos4[word167EB].y;
- int var4h = (_rectXMinMax[index] >> 8);
- int var4l = (_rectXMinMax[index] & 0xFF);
+ int var4h = (_rectXMinMax[word167EB] >> 8);
+ int var4l = (_rectXMinMax[word167EB] & 0xFF);
if (var4h != var4l) {
if (_array109E9PosX[index] == var4h) {
@@ -1477,8 +1477,8 @@ void LilliputEngine::sub167EF(int index) {
return;
}
- var4h = (_rectYMinMax[index] >> 8);
- var4l = (_rectYMinMax[index] & 0xFF);
+ var4h = (_rectYMinMax[word167EB] >> 8);
+ var4l = (_rectYMinMax[word167EB] & 0xFF);
if (var4h != var4l) {
if (_array10A11PosY[index] == var4h)
@@ -1506,7 +1506,7 @@ void LilliputEngine::sub167EF(int index) {
void LilliputEngine::sub1693A(int index) {
debugC(2, kDebugEngineTBC, "sub1693A(%d)", index);
-
+
static const int16 mapArrayMove[4] = {4, -256, 256, -4};
_word16937Pos = Common::Point(_scriptHandler->_array16123PosX[index], _scriptHandler->_array1614BPosY[index]);
@@ -1514,8 +1514,8 @@ void LilliputEngine::sub1693A(int index) {
sub16A08(index);
int var2 = (_characterDirectionArray[index] ^ 3);
- // initialized by sub16A08, values: [0, 6[
- _array1692B[var2] += 0xF8;
+ // initialized by sub16A08, values: [0, 3[
+ _array1692B[var2] -= 8;
byte byte16939 = 0;
int mapIndex = ((((_word16937Pos.y << 8) >> 2) + _word16937Pos.x) << 2);
@@ -1524,25 +1524,24 @@ void LilliputEngine::sub1693A(int index) {
for (int i = 3; i >= 0; i--) {
mapIndexDiff = mapArrayMove[i];
if (((_bufferIsoMap[mapIndex + mapIndexDiff + 3] & _array16C54[i]) != 0) && ((_bufferIsoMap[mapIndex + 3] & _array16C58[i]) != 0)) {
- if ((_bufferIsoMap[mapIndex + mapIndexDiff + 3] & 0x80) != 0) {
- if (sub16A76(i, index) != 0)
- _array1692B[i] += 0xEC;
-
- int tmpVal = ((_rulesBuffer2_10[index] & 7) ^ 7);
- retVal = _rulesChunk9[_bufferIsoMap[mapIndex + mapIndexDiff]];
- tmpVal &= retVal;
- if (tmpVal == 0)
- continue;
+ if ((_bufferIsoMap[mapIndex + mapIndexDiff + 3] & 0x80) != 0 && (sub16A76(i, index) != 0)) {
+ _array1692B[i] -= 20;
}
+
+ int tmpVal = ((_rulesBuffer2_10[index] & 7) ^ 7);
+ retVal = _rulesChunk9[_bufferIsoMap[mapIndex + mapIndexDiff]];
+ tmpVal &= retVal;
+ if (tmpVal == 0)
+ continue;
}
- _array1692B[i] = 0x9E;
+ _array1692B[i] = -98;
++byte16939;
}
if (byte16939 != 0)
_array1692B[_characterDirectionArray[index]] += 3;
- int tmpVal = 0x9D;
+ int tmpVal = -97;
for (int i = 3; i >= 0; i--) {
if (tmpVal < _array1692B[i]) {
retVal = i;
@@ -1622,7 +1621,7 @@ void LilliputEngine::sub16A08(int index) {
_array1692B[i] = 0;
int8 tmpIndex = 0;
- for (int i = 6; i > 0; i--) {
+ for (int i = 3; i > 0; i--) {
int16 tmpVal = 0x7FFF;
for (int j = 0; j < 4; j++) {
if (tmpVal > arrayDistance[j]) {
@@ -2684,7 +2683,7 @@ void LilliputEngine::handleGameScripts() {
/* Decompiler follows
- _scriptHandler->listAllTexts();
+ //_scriptHandler->listAllTexts();
debugC(1, kDebugEngineTBC, "================= Menu Script ==================");
ScriptStream script = ScriptStream(_menuScript, _menuScriptSize);
diff --git a/engines/lilliput/lilliput.h b/engines/lilliput/lilliput.h
index 8df04bce25..2d803ceaac 100644
--- a/engines/lilliput/lilliput.h
+++ b/engines/lilliput/lilliput.h
@@ -114,7 +114,7 @@ public:
byte _byte14837; // Unused byte, set by an opcode
byte _array147D1[3];
- byte _array1692B[4];
+ char _array1692B[4];
byte *_bufferIsoMap;
byte *_bufferCubegfx;
byte *_bufferMen;
diff --git a/engines/lilliput/script.cpp b/engines/lilliput/script.cpp
index 588223c750..8cfa12214a 100644
--- a/engines/lilliput/script.cpp
+++ b/engines/lilliput/script.cpp
@@ -95,7 +95,7 @@ byte LilliputScript::handleOpcodeType1(int curWord) {
return OC_sub1740A();
break;
case 0x3:
- return OC_compareCharacterId();
+ return OC_compareCharacterVariable();
break;
case 0x4:
return OC_CompareByte16F02With();
@@ -269,7 +269,7 @@ void LilliputScript::handleOpcodeType2(int curWord) {
OC_sub17E15_speech2param();
break;
case 0x8:
- OC_sub17B03();
+ OC_ComputeCharacterVariable();
break;
case 0x9:
OC_getRandom_type2();
@@ -443,7 +443,7 @@ void LilliputScript::handleOpcodeType2(int curWord) {
OC_sub18260();
break;
case 0x42:
- OC_sub182EC();
+ OC_CharacterVariableAddOrRemoveFlag();
break;
case 0x43:
OC_PaletteFadeOut();
@@ -560,7 +560,7 @@ static const OpCode opCodes1[] = {
{ "OC_checkCharacterGoalPos", 1, kgetPosFromScript, kNone, kNone, kNone, kNone },
{ "OC_comparePos", 2, kGetValue1, kgetPosFromScript, kNone, kNone, kNone },
{ "OC_sub1740A", 1, kImmediateValue, kNone, kNone, kNone, kNone },
- { "OC_compareCharacterId", 4, kGetValue1, kImmediateValue, kCompareOperation, kImmediateValue, kNone },
+ { "OC_compareCharacterVariable", 4, kGetValue1, kImmediateValue, kCompareOperation, kImmediateValue, kNone },
{ "OC_CompareByte16F02With", 2, kCompareOperation, kImmediateValue, kNone, kNone, kNone },
{ "OC_getRandom", 1, kImmediateValue, kNone, kNone, kNone, kNone },
{ "OC_for", 2, kImmediateValue, kImmediateValue, kNone, kNone, kNone },
@@ -619,7 +619,7 @@ static const OpCode opCodes2[] = {
/* 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 },
+/* 0x08 */ { "OC_ComputeCharacterVariable", 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_DisableCharacter", 1, kGetValue1, kNone, kNone, kNone, kNone },
@@ -677,7 +677,7 @@ static const OpCode opCodes2[] = {
/* 0x3f */ { "OC_sub18213", 1, kImmediateValue, kNone, kNone, kNone, kNone },
/* 0x40 */ { "OC_sub18252", 1, kGetValue1, kNone, kNone, kNone, kNone },
/* 0x41 */ { "OC_sub18260", 2, kGetValue1, kgetPosFromScript, kNone, kNone, kNone }, // TODO
-/* 0x42 */ { "OC_sub182EC", 4, kGetValue1, kImmediateValue, kImmediateValue, kImmediateValue, kNone },
+/* 0x42 */ { "OC_CharacterVariableAddOrRemoveFlag", 4, kGetValue1, kImmediateValue, kImmediateValue, kImmediateValue, kNone },
/* 0x43 */ { "OC_PaletteFadeOut", 0, kNone, kNone, kNone, kNone, kNone },
/* 0x44 */ { "OC_PaletteFadeIn", 0, kNone, kNone, kNone, kNone, kNone },
/* 0x45 */ { "OC_loadAndDisplayCUBESx_GFX", 1, kImmediateValue, kNone, kNone, kNone, kNone },
@@ -698,7 +698,7 @@ static const OpCode opCodes2[] = {
/* 0x54 */ { "OC_sub184D7", 1, kImmediateValue, kNone, kNone, kNone, kNone }, // TODO
/* 0x55 */ { "OC_displayTitleScreen", 1, kImmediateValue, kNone, kNone, kNone, kNone },
/* 0x56 */ { "OC_sub1853B", 0, kNone, kNone, kNone, kNone, kNone },
-/* 0x57 */ { "OC_sub1864D", 4, kImmediateValue, kImmediateValue, kImmediateValue, kImmediateValue, kNone }, // TODO
+/* 0x57 */ { "OC_sub1864D", 6, kGetValue1, kImmediateValue, kImmediateValue, kImmediateValue, kImmediateValue},
/* 0x58 */ { "OC_initSmallAnim", 11, kImmediateValue, kImmediateValue, kImmediateValue, kImmediateValue, kImmediateValue },
/* 0x59 */ { "OC_sub18678", 4, kGetValue1, kImmediateValue, kImmediateValue, kImmediateValue, kNone },
/* 0x5a */ { "OC_sub18690", 2, kGetValue1, kgetPosFromScript, kNone, kNone, kNone }, //TODO
@@ -1422,8 +1422,8 @@ byte LilliputScript::OC_sub1740A() {
}
}
-byte LilliputScript::OC_compareCharacterId() {
- debugC(1, kDebugScript, "OC_compareCharacterId()");
+byte LilliputScript::OC_compareCharacterVariable() {
+ debugC(1, kDebugScript, "OC_compareCharacterVariable()");
byte *tmpArr = getCharacterVariablePtr();
byte var1 = tmpArr[0];
@@ -2254,8 +2254,8 @@ void LilliputScript::OC_sub17E15_speech2param() {
_currScript->readUint16LE();
}
-void LilliputScript::OC_sub17B03() {
- debugC(1, kDebugScriptTBC, "OC_sub17B03()");
+void LilliputScript::OC_ComputeCharacterVariable() {
+ debugC(1, kDebugScriptTBC, "OC_ComputeCharacterVariable()");
byte *bufPtr = getCharacterVariablePtr();
int oper = _currScript->readUint16LE();
@@ -2933,8 +2933,8 @@ void LilliputScript::OC_sub18260() {
warning("OC_sub18260()");
}
-void LilliputScript::OC_sub182EC() {
- debugC(1, kDebugScriptTBC, "OC_sub182EC()");
+void LilliputScript::OC_CharacterVariableAddOrRemoveFlag() {
+ debugC(1, kDebugScriptTBC, "OC_CharacterVariableAddOrRemoveFlag()");
byte *tmpArr = getCharacterVariablePtr();
@@ -2942,7 +2942,7 @@ void LilliputScript::OC_sub182EC() {
byte var2 = (_currScript->readUint16LE() & 0xFF);
if (var2 == 0)
- tmpArr[0] = (0xFF ^ var1);
+ tmpArr[0] &= ~var1;
else
tmpArr[0] |= var1;
}
diff --git a/engines/lilliput/script.h b/engines/lilliput/script.h
index 05092594ec..08ed9839a4 100644
--- a/engines/lilliput/script.h
+++ b/engines/lilliput/script.h
@@ -149,7 +149,7 @@ private:
byte OC_checkCharacterGoalPos();
byte OC_comparePos();
byte OC_sub1740A();
- byte OC_compareCharacterId();
+ byte OC_compareCharacterVariable();
byte OC_CompareByte16F02With();
byte OC_getRandom();
byte OC_for();
@@ -206,7 +206,7 @@ private:
void OC_sub17DF9_speech1param();
void OC_sub17E07_speech4param();
void OC_sub17E15_speech2param();
- void OC_sub17B03();
+ void OC_ComputeCharacterVariable();
void OC_getRandom_type2();
void OC_setCharacterPosition();
void OC_DisableCharacter();
@@ -265,7 +265,7 @@ private:
void OC_sub18213();
void OC_sub18252();
void OC_sub18260();
- void OC_sub182EC();
+ void OC_CharacterVariableAddOrRemoveFlag();
void OC_PaletteFadeOut();
void OC_PaletteFadeIn();
void OC_loadAndDisplayCUBESx_GFX();