aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStrangerke2012-05-21 07:51:05 +0200
committerEugene Sandulenko2018-03-28 17:36:57 +0200
commit2ea4cc178b47b5d49c5236dc91ddeccf60bfbefc (patch)
treea46907501b3d01614bc3d92991275f0998afd707
parent742425f9a925ca985c39b327f0540c7598a39050 (diff)
downloadscummvm-rg350-2ea4cc178b47b5d49c5236dc91ddeccf60bfbefc.tar.gz
scummvm-rg350-2ea4cc178b47b5d49c5236dc91ddeccf60bfbefc.tar.bz2
scummvm-rg350-2ea4cc178b47b5d49c5236dc91ddeccf60bfbefc.zip
LILLIPUT: Verifications and renaming
-rw-r--r--engines/lilliput/lilliput.cpp20
-rw-r--r--engines/lilliput/lilliput.h4
-rw-r--r--engines/lilliput/script.cpp41
3 files changed, 34 insertions, 31 deletions
diff --git a/engines/lilliput/lilliput.cpp b/engines/lilliput/lilliput.cpp
index c0c18ef479..9a66fea712 100644
--- a/engines/lilliput/lilliput.cpp
+++ b/engines/lilliput/lilliput.cpp
@@ -1818,7 +1818,7 @@ byte LilliputEngine::sub1675D(int index, Common::Point var1) {
}
void LilliputEngine::sub16EBC() {
- debugC(2, kDebugEngineTBC, "sub16EBC()");
+ debugC(2, kDebugEngine, "sub16EBC()");
int index2 = 3;
@@ -1836,7 +1836,7 @@ void LilliputEngine::sub16EBC() {
}
void LilliputEngine::sub12F37() {
- debugC(2, kDebugEngineTBC, "sub12F37()");
+ debugC(2, kDebugEngine, "sub12F37()");
int index1 = _animationTick + 2;
int index2 = 0;
@@ -2171,7 +2171,7 @@ void LilliputEngine::sub16B8F_moveCharacter(int index, Common::Point pos, int di
}
void LilliputEngine::sub17224(int var1, int var4) {
- debugC(2, kDebugEngineTBC, "sub17224(%d, %d)", var1, var4);
+ debugC(2, kDebugEngine, "sub17224(%d, %d)", var1, var4);
byte type = (var1 >> 8);
if (type == 0) {
@@ -2187,16 +2187,16 @@ void LilliputEngine::sub17224(int var1, int var4) {
int index = var4 & 0xFF;
for (int i = 0; i < _numCharacters; i++) {
- if (_scriptHandler->_array10B51[index] >= type)
+ if ((_scriptHandler->_array10B51[index] & 0xFF) >= type)
sub17264(i, var4);
index += 40;
}
}
void LilliputEngine::sub17264(int index, int var4) {
- debugC(2, kDebugEngineTBC, "sub17264(%d, %d)", index, var4);
+ debugC(2, kDebugEngine, "sub17264(%d, %d)", index, var4);
- if (_array11D49[index] != 0xFFFF) {
+ if (_array11D49[index] != -1) {
_array1289F[index] = var4;
} else {
_scriptHandler->_characterScriptEnabled[index] = 1;
@@ -2205,12 +2205,12 @@ void LilliputEngine::sub17264(int index, int var4) {
}
void LilliputEngine::sub171CF() {
- debugC(2, kDebugEngineTBC, "sub171CF()");
+ debugC(2, kDebugEngine, "sub171CF()");
for (int i = 0; i < _numCharacters; i++) {
- if (_array1289F[i] != 0xFFFF) {
+ if (_array1289F[i] != -1) {
_array11D49[i] = _array1289F[i];
- _array1289F[i] = 0xFFFF;
+ _array1289F[i] = -1;
_scriptHandler->_characterScriptEnabled[i] = 1;
}
}
@@ -2229,7 +2229,7 @@ void LilliputEngine::sub171CF() {
}
void LilliputEngine::sub12FE5() {
- debugC(2, kDebugEngineTBC, "sub12FE5()");
+ debugC(2, kDebugEngine, "sub12FE5()");
if (_animationTick != 1)
return;
diff --git a/engines/lilliput/lilliput.h b/engines/lilliput/lilliput.h
index 09c96145b8..a06890ac6d 100644
--- a/engines/lilliput/lilliput.h
+++ b/engines/lilliput/lilliput.h
@@ -150,8 +150,8 @@ public:
short _word15E5D[40];
byte _byte15E35[40];
- int _array11D49[40];
- int _array1289F[40];
+ int16 _array11D49[40];
+ int16 _array1289F[40];
int16 _array12861[30];
byte *_rulesChunk1;
diff --git a/engines/lilliput/script.cpp b/engines/lilliput/script.cpp
index d18abd7824..22f11f64f8 100644
--- a/engines/lilliput/script.cpp
+++ b/engines/lilliput/script.cpp
@@ -1057,7 +1057,7 @@ void LilliputScript::sub17B6C(int var1) {
}
void LilliputScript::sub16C86(int index, byte *buf) {
- debugC(1, kDebugScriptTBC, "sub16C86()");
+ debugC(1, kDebugScript, "sub16C86()");
_array12811[index] = 0;
@@ -1399,10 +1399,10 @@ byte LilliputScript::OC_sub1740A() {
}
byte *isoMapBuf = getMapPtr(var);
- int var2 = isoMapBuf[3];
+ uint16 var2 = isoMapBuf[3];
- int var3 = _currScript->readUint16LE();
- int var4 = 8 >> var3;
+ int16 var3 = _currScript->readUint16LE();
+ uint16 var4 = 8 >> var3;
if (var2 & var4) {
return 1;
@@ -1444,7 +1444,7 @@ byte LilliputScript::OC_getRandom() {
}
byte LilliputScript::OC_for() {
- debugC(1, kDebugScriptTBC, "OC_for()");
+ debugC(1, kDebugScript, "OC_for()");
int var1 = _currScript->readUint16LE();
int tmpVal = _currScript->readUint16LE() + 1;
@@ -1560,24 +1560,27 @@ byte LilliputScript::OC_compareCoords_2() {
}
byte LilliputScript::OC_CompareDistanceFromCharacterToPositionWith() {
- debugC(1, kDebugScriptTBC, "OC_CompareDistanceFromCharacterToPositionWith()");
+ debugC(1, kDebugScript, "OC_CompareDistanceFromCharacterToPositionWith()");
Common::Point var1 = getPosFromScript();
Common::Point pos = _vm->_currentScriptCharacterPos;
int dx = var1.x - pos.x;
- if (dx < 0) dx = -dx;
+ if (dx < 0)
+ dx = -dx;
int dy = var1.y - pos.y;
- if (dy < 0) dy = -dy;
+ if (dy < 0)
+ dy = -dy;
- int dist = dx + dy;
+ int16 dist = dx + dy;
uint16 operation = _currScript->readUint16LE();
int16 var2 = _currScript->readSint16LE();
return compareValues(dist, operation, var2);
}
+
byte LilliputScript::OC_compareRandomCharacterId() {
debugC(1, kDebugScriptTBC, "OC_compareRandomCharacterId()");
@@ -1761,13 +1764,13 @@ byte LilliputScript::OC_sub17782() {
}
byte *LilliputScript::getMapPtr(Common::Point val) {
- debugC(1, kDebugScriptTBC, "getMapPtr(%d %d)", val.x, val.y);
+ debugC(1, kDebugScript, "getMapPtr(%d %d)", val.x, val.y);
return &_vm->_bufferIsoMap[(val.y * 64 + val.x) << 2];
}
byte LilliputScript::OC_CompareMapValueWith() {
- debugC(1, kDebugScriptTBC, "OC_CompareMapValueWith()");
+ debugC(1, kDebugScript, "OC_CompareMapValueWith()");
Common::Point tmpVal = getPosFromScript();
@@ -1775,11 +1778,11 @@ byte LilliputScript::OC_CompareMapValueWith() {
_currScript->seek(_currScript->pos() + 6);
return 0;
}
- int var2 = _currScript->readUint16LE();
+ int16 var2 = _currScript->readUint16LE();
byte *buf = getMapPtr(tmpVal);
- byte var1 = buf[var2];
- int oper = _currScript->readUint16LE();
- var2 = _currScript->readUint16LE();
+ int16 var1 = buf[var2];
+ uint16 oper = _currScript->readUint16LE();
+ var2 = _currScript->readSint16LE();
return compareValues(var1, oper, var2);
}
@@ -2553,10 +2556,10 @@ void LilliputScript::OC_sub17E6D() {
}
void LilliputScript::OC_changeCurrentCharacterSprite() {
- debugC(2, kDebugScriptTBC, "OC_changeCurrentCharacterSprite()");
+ debugC(2, kDebugScript, "OC_changeCurrentCharacterSprite()");
- int var1 = _currScript->readUint16LE();
- int var2 = _currScript->readUint16LE();
+ int16 var1 = _currScript->readSint16LE();
+ byte var2 = (_currScript->readUint16LE() & 0xFF);
_vm->_characterFrameArray[_vm->_currentScriptCharacter] = var1;
_vm->_spriteSizeArray[_vm->_currentScriptCharacter] = var2;
@@ -2919,7 +2922,7 @@ void LilliputScript::OC_sub18260() {
}
void LilliputScript::OC_CharacterVariableAddOrRemoveFlag() {
- debugC(1, kDebugScriptTBC, "OC_CharacterVariableAddOrRemoveFlag()");
+ debugC(1, kDebugScript, "OC_CharacterVariableAddOrRemoveFlag()");
byte *tmpArr = getCharacterVariablePtr();