aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorStrangerke2018-03-27 00:18:36 +0200
committerEugene Sandulenko2018-03-28 17:36:57 +0200
commit96f35b1740138739189358f4cbbca4690ae55ab4 (patch)
tree8d6673ec11f4d20cdc931af0a214c2affac64233 /engines
parent5bc90c0a4beb9dddb09f6893f13ffe310585b61b (diff)
downloadscummvm-rg350-96f35b1740138739189358f4cbbca4690ae55ab4.tar.gz
scummvm-rg350-96f35b1740138739189358f4cbbca4690ae55ab4.tar.bz2
scummvm-rg350-96f35b1740138739189358f4cbbca4690ae55ab4.zip
LILLIPUT: Some more renaming, use CLIP in OC_scrollAwayFromCharacter
Diffstat (limited to 'engines')
-rw-r--r--engines/lilliput/lilliput.cpp8
-rw-r--r--engines/lilliput/lilliput.h2
-rw-r--r--engines/lilliput/script.cpp48
-rw-r--r--engines/lilliput/script.h10
4 files changed, 29 insertions, 39 deletions
diff --git a/engines/lilliput/lilliput.cpp b/engines/lilliput/lilliput.cpp
index 663bda43fa..598452f807 100644
--- a/engines/lilliput/lilliput.cpp
+++ b/engines/lilliput/lilliput.cpp
@@ -1252,7 +1252,7 @@ void LilliputEngine::renderCharacters(byte *buf, Common::Point pos) {
int16 frame = _characterFrameArray[index];
if (frame != -1) {
- frame += _scriptHandler->_array10AB1[index];
+ frame += _scriptHandler->_characterPose[index];
if ((flag & 1) == 1)
frame += _spriteSizeArray[index];
@@ -1746,7 +1746,7 @@ byte LilliputEngine::sub16729(int index, Common::Point var1) {
byte LilliputEngine::sub1675D(int index, Common::Point var1) {
debugC(2, kDebugEngine, "sub1675D(%d, %d - %d)", index, var1.x, var1.y);
- int charIndex = _scriptHandler->_array10A39[index];
+ int charIndex = _scriptHandler->_characterSeek[index];
Common::Point charPos = Common::Point(_scriptHandler->_characterTilePosX[charIndex], _scriptHandler->_characterTilePosY[charIndex]);
if ((_characterSubTargetPosX[index] != -1) && (_characterSubTargetPosX[index] == _characterTargetPosX[index]) && (_characterSubTargetPosY[index] == _characterTargetPosY[index])) {
@@ -2033,7 +2033,7 @@ void LilliputEngine::sub16685(int idx, Common::Point var1) {
debugC(2, kDebugEngine, "sub16685(%d, %d - %d)", idx, var1.x, var1.y);
int index = (idx * 32) + var1.y;
- _scriptHandler->_array10AB1[idx] = _rulesBuffer2_16[index];
+ _scriptHandler->_characterPose[idx] = _poseArray[index];
}
byte LilliputEngine::sub16675_moveCharacter(int idx, Common::Point var1) {
@@ -2535,7 +2535,7 @@ void LilliputEngine::loadRules() {
_characterVariables[(j * 32) + k] = f.readByte();
for (int k = 0; k < 32; k++)
- _rulesBuffer2_16[(j * 32) + k] = f.readByte();
+ _poseArray[(j * 32) + k] = f.readByte();
}
// Chunk 3 & 4 : Packed strings & associated indexes
diff --git a/engines/lilliput/lilliput.h b/engines/lilliput/lilliput.h
index fd71630dba..6c30fe8c57 100644
--- a/engines/lilliput/lilliput.h
+++ b/engines/lilliput/lilliput.h
@@ -183,7 +183,7 @@ public:
byte _rulesBuffer2_14_posY[40];
byte _characterVariables[1400 + 3120];
byte *_currentCharacterAttributes;
- byte _rulesBuffer2_16[40 * 32];
+ byte _poseArray[40 * 32];
int *_packedStringIndex;
int _packedStringNumb;
char *_packedStrings;
diff --git a/engines/lilliput/script.cpp b/engines/lilliput/script.cpp
index 95b8f4cdf6..b93000d6f8 100644
--- a/engines/lilliput/script.cpp
+++ b/engines/lilliput/script.cpp
@@ -63,7 +63,7 @@ LilliputScript::LilliputScript(LilliputEngine *vm) : _vm(vm), _currScript(NULL)
for (int i = 0; i < 40; i++) {
_characterScriptEnabled[i] = 1;
_characterMapPixelColor[i] = 15;
- _array10AB1[i] = 0;
+ _characterPose[i] = 0;
_characterNextSequence[i] = 16;
_characterLastSequence[i] = -1;
_characterTilePosX[i] = 0;
@@ -380,7 +380,7 @@ void LilliputScript::handleOpcodeType2(int curWord) {
OC_turnCharacterTowardsAnother();
break;
case 0x2D:
- OC_sub17F4F();
+ OC_setSeek();
break;
case 0x2E:
OC_scrollAwayFromCharacter();
@@ -389,10 +389,10 @@ void LilliputScript::handleOpcodeType2(int curWord) {
OC_skipNextVal();
break;
case 0x30:
- OC_setCurrentCharacterVar6();
+ OC_setCurrentCharacterAttr6();
break;
case 0x31:
- OC_sub17FDD();
+ OC_setCurrentCharacterPose();
break;
case 0x32:
OC_setCharacterScriptEnabled();
@@ -656,11 +656,11 @@ static const OpCode opCodes2[] = {
/* 0x2a */ { "OC_sub17EC5", 4, kImmediateValue, kImmediateValue, kImmediateValue, kImmediateValue, kNone },
/* 0x2b */ { "OC_setCharacterDirectionTowardsPos", 1, kgetPosFromScript, kNone, kNone, kNone, kNone },
/* 0x2c */ { "OC_turnCharacterTowardsAnother", 1, kGetValue1, kNone, kNone, kNone, kNone },
-/* 0x2d */ { "OC_sub17F4F", 1, kGetValue1, kNone, kNone, kNone, kNone },
+/* 0x2d */ { "OC_setSeek", 1, kGetValue1, kNone, kNone, kNone, kNone },
/* 0x2e */ { "OC_scrollAwayFromCharacter", 0, kNone, kNone, kNone, kNone, kNone },
/* 0x2f */ { "OC_skipNextVal", 1, kImmediateValue, kNone, kNone, kNone, kNone },
-/* 0x30 */ { "OC_setCurrentCharacterVar6", 1, kGetValue1, kNone, kNone, kNone, kNone },
-/* 0x31 */ { "OC_sub17FDD", 1, kImmediateValue, kNone, kNone, kNone, kNone },
+/* 0x30 */ { "OC_setCurrentCharacterAttr6", 1, kGetValue1, kNone, kNone, kNone, kNone },
+/* 0x31 */ { "OC_setCurrentCharacterPose", 1, kImmediateValue, kNone, kNone, kNone, kNone },
/* 0x32 */ { "OC_setCharacterScriptEnabled", 1, kGetValue1, kNone, kNone, kNone, kNone },
/* 0x33 */ { "OC_setCurrentCharacterVar2", 1, kImmediateValue, kNone, kNone, kNone, kNone },
/* 0x34 */ { "OC_setCurrentCharacterVar2ToZero", 0, kNone, kNone, kNone, kNone, kNone },
@@ -2656,12 +2656,12 @@ void LilliputScript::OC_turnCharacterTowardsAnother() {
_vm->_characterDirectionArray[_vm->_currentScriptCharacter] = _directionsArray[flag];
}
-void LilliputScript::OC_sub17F4F() {
- debugC(1, kDebugScript, "OC_sub17F4F()");
+void LilliputScript::OC_setSeek() {
+ debugC(1, kDebugScript, "OC_setSeek()");
int16 var = getValue1();
- _array10A39[_vm->_currentScriptCharacter] = (byte)(var & 0xFF);
- warning("debug - OC_sub17F4F: _array10A39[%d] = %d", _vm->_currentScriptCharacter, var);
+ _characterSeek[_vm->_currentScriptCharacter] = (byte)(var & 0xFF);
+ warning("debug - OC_setSeek: _characterSeek[%d] = %d", _vm->_currentScriptCharacter, var);
_vm->_characterSubTargetPosX[_vm->_currentScriptCharacter] = -1;
}
@@ -2682,17 +2682,8 @@ void LilliputScript::OC_scrollAwayFromCharacter() {
int newPosX = pos.x + cx;
int newPosY = pos.y + cy;
- if (newPosX < 0)
- newPosX = 0;
-
- if (newPosX > 56)
- newPosX = 56;
-
- if (newPosY < 0)
- newPosY = 0;
-
- if (newPosY > 56)
- newPosY = 56;
+ newPosX = CLIP(newPosX, 0, 56);
+ newPosY = CLIP(newPosY, 0, 56);
_vm->_refreshScreenFlag = true;
_vm->viewportScrollTo(Common::Point(newPosX, newPosY));
@@ -2706,22 +2697,21 @@ void LilliputScript::OC_skipNextVal() {
_currScript->readUint16LE();
}
-void LilliputScript::OC_setCurrentCharacterVar6() {
- debugC(1, kDebugScript, "OC_setCurrentCharacterVar6()");
+void LilliputScript::OC_setCurrentCharacterAttr6() {
+ debugC(1, kDebugScript, "OC_setCurrentCharacterAttr6()");
uint16 var1 = (uint16)getValue1();
- warning("debug - OC_setCurrentCharacterVar6 %d", var1);
_vm->_currentCharacterAttributes[6] = var1 & 0xFF;
}
-void LilliputScript::OC_sub17FDD() {
- debugC(1, kDebugScript, "OC_sub17FDD()");
+void LilliputScript::OC_setCurrentCharacterPose() {
+ debugC(1, kDebugScript, "OC_setCurrentCharacterPose()");
int index = _currScript->readUint16LE();
int tmpVal = (_vm->_currentScriptCharacter * 32) + index;
assert (tmpVal < 40 * 32);
- _array10AB1[_vm->_currentScriptCharacter] = _vm->_rulesBuffer2_16[tmpVal];
+ _characterPose[_vm->_currentScriptCharacter] = _vm->_poseArray[tmpVal];
_characterNextSequence[_vm->_currentScriptCharacter] = 16;
}
@@ -2778,7 +2768,7 @@ void LilliputScript::OC_sub18074() {
int var2 = _currScript->readUint16LE();
byte var1 = (_currScript->readUint16LE() & 0xFF);
- _vm->_rulesBuffer2_16[(_vm->_currentScriptCharacter * 32) + var2] = var1;
+ _vm->_poseArray[(_vm->_currentScriptCharacter * 32) + var2] = var1;
}
void LilliputScript::OC_setCurrentCharacterDirection() {
diff --git a/engines/lilliput/script.h b/engines/lilliput/script.h
index 35aa734ab6..5ec3ba8c4c 100644
--- a/engines/lilliput/script.h
+++ b/engines/lilliput/script.h
@@ -74,10 +74,10 @@ public:
int8 _characterTilePosX[40];
int8 _characterTilePosY[40];
int8 _characterNextSequence[40];
- int8 _array10AB1[40];
+ int8 _characterPose[40];
byte _interfaceButtonActivationDelay[20];
byte _array122C1[40];
- byte _array10A39[40];
+ byte _characterSeek[40];
int16 _interactions[40 * 40];
byte *_savedBuffer215Ptr;
@@ -249,11 +249,11 @@ private:
void OC_sub17EC5();
void OC_setCharacterDirectionTowardsPos();
void OC_turnCharacterTowardsAnother();
- void OC_sub17F4F();
+ void OC_setSeek();
void OC_scrollAwayFromCharacter();
void OC_skipNextVal();
- void OC_setCurrentCharacterVar6();
- void OC_sub17FDD();
+ void OC_setCurrentCharacterAttr6();
+ void OC_setCurrentCharacterPose();
void OC_setCharacterScriptEnabled();
void OC_setCurrentCharacterVar2();
void OC_SetCurrentCharacterVar2ToZero();