diff options
-rw-r--r-- | engines/lilliput/lilliput.cpp | 62 | ||||
-rw-r--r-- | engines/lilliput/lilliput.h | 12 | ||||
-rw-r--r-- | engines/lilliput/script.cpp | 30 | ||||
-rw-r--r-- | engines/lilliput/script.h | 6 |
4 files changed, 54 insertions, 56 deletions
diff --git a/engines/lilliput/lilliput.cpp b/engines/lilliput/lilliput.cpp index af95ed9696..5aee74f56b 100644 --- a/engines/lilliput/lilliput.cpp +++ b/engines/lilliput/lilliput.cpp @@ -674,7 +674,7 @@ void LilliputEngine::prepareGameArea() { for (int posX = 0; posX < 8; posX++) { if (map[1] != 0xFF) { int var1 = map[1]; - if ((_rulesChunk9[var1] & 128) != 0) + if ((_cubeFlags[var1] & 128) != 0) var1 += _animationTick; displayIsometricBlock(_savedSurfaceGameArea1, var1, posX, posY, 1 << 8); } @@ -682,7 +682,7 @@ void LilliputEngine::prepareGameArea() { if (map[2] != 0xFF) { int var1 = map[2]; - if ((_rulesChunk9[var1] & 128) != 0) + if ((_cubeFlags[var1] & 128) != 0) var1 += _animationTick; displayIsometricBlock(_savedSurfaceGameArea1, var1, posX, posY, 2 << 8); } @@ -1195,7 +1195,7 @@ void LilliputEngine::renderCharacters(byte *buf, Common::Point pos) { if (buf[1] != 0xFF) { int tmpIndex = buf[1]; - if ((_rulesChunk9[tmpIndex] & 16) == 0) + if ((_cubeFlags[tmpIndex] & 16) == 0) ++_byte16552; } @@ -1422,7 +1422,7 @@ void LilliputEngine::homeInChooseDirection(int index) { } int tmpVal = ((_characterMobility[index] & 7) ^ 7); - retVal = _rulesChunk9[_bufferIsoMap[mapIndex + mapIndexDiff]]; + retVal = _cubeFlags[_bufferIsoMap[mapIndex + mapIndexDiff]]; tmpVal &= retVal; if (tmpVal == 0) continue; @@ -2118,7 +2118,7 @@ void LilliputEngine::checkCollision(int index, Common::Point pos, int direction) var1 &= 7; var1 ^= 7; - if ((var1 & _rulesChunk9[_bufferIsoMap[mapIndex]]) != 0) + if ((var1 & _cubeFlags[_bufferIsoMap[mapIndex]]) != 0) return; _characterPos[index] = pos; @@ -2147,7 +2147,7 @@ void LilliputEngine::signalDispatcher(byte type, byte index, int var4) { } void LilliputEngine::sendMessageToCharacter(byte index, int var4) { - debugC(2, kDebugEngine, "sub17264(%d, %d)", index, var4); + debugC(2, kDebugEngine, "sendMessageToCharacter(%d, %d)", index, var4); if (_characterSignals[index] != -1) { _signalArr[index] = var4; @@ -2208,10 +2208,10 @@ void LilliputEngine::checkInterfaceActivationDelay() { void LilliputEngine::displayHeroismIndicator() { debugC(2, kDebugEngine, "displayHeroismIndicator()"); - if (_scriptHandler->_savedBuffer215Ptr == NULL) + if (_scriptHandler->_barAttrPtr == NULL) return; - int var1 = (_scriptHandler->_savedBuffer215Ptr[0] * 25) >> 8; + int var1 = (_scriptHandler->_barAttrPtr[0] * 25) >> 8; if (var1 == _scriptHandler->_heroismLevel) return; @@ -2230,7 +2230,6 @@ void LilliputEngine::displayHeroismIndicator() { var2 = _scriptHandler->_heroismLevel & 0xFF; if (var2 != 0) { -// sub16064(var1, _scriptHandler->_byte15FFA); for (int i = 0; i < (var2 << 2); i++) { ((byte *)_mainSurface->getPixels())[index] = var1; ((byte *)_mainSurface->getPixels())[index + 1] = var1; @@ -2240,7 +2239,6 @@ void LilliputEngine::displayHeroismIndicator() { } if (25 - _scriptHandler->_heroismLevel != 0) { -// sub16064(23, 25 - _scriptHandler->_byte15FFA); var2 = (25 - _scriptHandler->_heroismLevel) << 2; for (int i = 0; i < var2; i++) { ((byte *)_mainSurface->getPixels())[index] = 23; @@ -2419,13 +2417,13 @@ void LilliputEngine::loadRules() { _word10800_ERULES = f.readUint16LE(); - // Chunk 1 + // Chunk 1 : Sequences int size = f.readUint16LE(); - _rulesChunk1 = (byte *)malloc(sizeof(byte) * size); + _sequencesArr = (byte *)malloc(sizeof(byte) * size); for (int i = 0; i < size; ++i) - _rulesChunk1[i] = f.readByte(); + _sequencesArr[i] = f.readByte(); - // Chunk 2 + // Chunk 2 : Characters _numCharacters = (f.readUint16LE() & 0xFF); assert(_numCharacters <= 40); @@ -2500,25 +2498,25 @@ void LilliputEngine::loadRules() { for (int i = 0; i < curWord; ++i) _arrayGameScripts[i] = f.readByte(); - // Chunk 9 + // Chunk 9 : Cube flags for (int i = 0; i < 60; i++) - _rulesChunk9[i] = f.readByte(); + _cubeFlags[i] = f.readByte(); - // Chunk 10 & 11 - _rulesChunk10_size = f.readByte(); - assert(_rulesChunk10_size <= 20); + // Chunk 10 & 11 : Lists + _listNumb = f.readByte(); + assert(_listNumb <= 20); - if (_rulesChunk10_size != 0) { - _rulesChunk10 = (int16 *)malloc(sizeof(int16) * _rulesChunk10_size); + if (_listNumb != 0) { + _listIndex = (int16 *)malloc(sizeof(int16) * _listNumb); int totalSize = 0; - for (int i = 0; i < _rulesChunk10_size; ++i) { - _rulesChunk10[i] = totalSize; + for (int i = 0; i < _listNumb; ++i) { + _listIndex[i] = totalSize; totalSize += f.readByte(); } if (totalSize != 0) { - _rulesChunk11 = (byte *)malloc(sizeof(byte) * totalSize); + _listArr = (byte *)malloc(sizeof(byte) * totalSize); for (int i = 0; i < totalSize; i++) - _rulesChunk11[i] = f.readByte(); + _listArr[i] = f.readByte(); } } @@ -2534,7 +2532,7 @@ void LilliputEngine::loadRules() { int16 tmpValY = (int16)f.readByte(); int16 tmpValX = (int16)f.readByte(); - _rulesBuffer12Pos3[i] = Common::Point(tmpValX, tmpValY); + _keyPos[i] = Common::Point(tmpValX, tmpValY); tmpValY = (int16)f.readByte(); tmpValX = (int16)f.readByte(); @@ -2586,13 +2584,13 @@ void LilliputEngine::fixPaletteEntries(uint8 *palette, int num) { debugC(1, kDebugEngine, "fixPaletteEntries(palette, %d)", num); // Color values are coded on 6bits (for old 6bits DAC) for (int32 i = 0; i < num * 3; i++) { - int32 a = palette[i]; - assert(a < 64); + int32 col = palette[i]; + assert(col < 64); - a = (a << 2) | (a >> 4); - if (a > 255) - a = 255; - palette[i] = a; + col = (col << 2) | (col >> 4); + if (col > 255) + col = 255; + palette[i] = col; } } diff --git a/engines/lilliput/lilliput.h b/engines/lilliput/lilliput.h index cd28d3986c..6d67021b55 100644 --- a/engines/lilliput/lilliput.h +++ b/engines/lilliput/lilliput.h @@ -168,7 +168,7 @@ public: int16 _signalArr[40]; int16 _signalArray[30]; - byte *_rulesChunk1; + byte *_sequencesArr; int16 _currentScriptCharacter; Common::Point _characterPos[40]; int8 _characterPosAltitude[40]; @@ -195,14 +195,14 @@ public: int *_arrayGameScriptIndex; int _gameScriptIndexSize; byte *_arrayGameScripts; - byte _rulesChunk9[60]; - byte _rulesChunk10_size; - int16 *_rulesChunk10; - byte *_rulesChunk11; + byte _cubeFlags[60]; + byte _listNumb; + int16 *_listIndex; + byte *_listArr; int16 _rectNumb; MinMax _rectXMinMax[40]; MinMax _rectYMinMax[40]; - Common::Point _rulesBuffer12Pos3[40]; + Common::Point _keyPos[40]; Common::Point _portalPos[40]; int _interfaceHotspotNumb; byte _interfaceTwoStepAction[20]; diff --git a/engines/lilliput/script.cpp b/engines/lilliput/script.cpp index d1426c3bcb..fb6a4b0d10 100644 --- a/engines/lilliput/script.cpp +++ b/engines/lilliput/script.cpp @@ -48,7 +48,7 @@ LilliputScript::LilliputScript(LilliputEngine *vm) : _vm(vm), _currScript(NULL) _monitoredAttr[1] = 1; _monitoredAttr[2] = 2; _monitoredAttr[3] = 3; - _savedBuffer215Ptr = NULL; + _barAttrPtr = NULL; _word1825E = Common::Point(0, 0); for (int i = 0; i < 20; i++) { @@ -368,10 +368,10 @@ void LilliputScript::handleOpcodeType2(int curWord) { OC_changeCurrentCharacterSprite(); break; case 0x29: - OC_sub17E99(); + OC_getList(); break; case 0x2A: - OC_sub17EC5(); + OC_setList(); break; case 0x2B: OC_setCharacterDirectionTowardsPos(); @@ -652,8 +652,8 @@ static const OpCode opCodes2[] = { /* 0x26 */ { "OC_setCurrentCharacterPos", 2, kImmediateValue, kgetPosFromScript, kNone, kNone, kNone }, /* 0x27 */ { "OC_setCurrentCharacterBehavior", 1, kImmediateValue, kNone, kNone, kNone, kNone }, /* 0x28 */ { "OC_changeCurrentCharacterSprite", 2, kImmediateValue, kImmediateValue, kNone, kNone, kNone }, -/* 0x29 */ { "OC_sub17E99", 4, kImmediateValue, kImmediateValue, kImmediateValue, kImmediateValue, kNone }, -/* 0x2a */ { "OC_sub17EC5", 4, kImmediateValue, kImmediateValue, kImmediateValue, kImmediateValue, kNone }, +/* 0x29 */ { "OC_getList", 4, kImmediateValue, kImmediateValue, kImmediateValue, kImmediateValue, kNone }, +/* 0x2a */ { "OC_setList", 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_setSeek", 1, kGetValue1, kNone, kNone, kNone, kNone }, @@ -1057,7 +1057,7 @@ void LilliputScript::setSequence(int charIdx, int8 seqIdx) { assert(charIdx < 40); _characterLastSequence[charIdx] = seqIdx; - byte *buf = _vm->_rulesChunk1; + byte *buf = _vm->_sequencesArr; if (seqIdx != 0) { int count = 0; while (count < seqIdx) { @@ -1328,7 +1328,7 @@ Common::Point LilliputScript::getPosFromScript() { case 0xF8: { int8 index = curWord & 0xFF; assert((index >= 0) && (index < 40)); - return _vm->_rulesBuffer12Pos3[index]; + return _vm->_keyPos[index]; } case 0xF7: { int8 index = _vm->_currentCharacterAttributes[6]; @@ -2571,8 +2571,8 @@ byte *LilliputScript::getCurrentCharacterVarFromScript() { return &_vm->_currentCharacterAttributes[index]; } -void LilliputScript::OC_sub17E99() { - debugC(1, kDebugScript, "OC_sub17E99()"); +void LilliputScript::OC_getList() { + debugC(1, kDebugScript, "OC_getList()"); byte *compBuf = getCurrentCharacterVarFromScript(); uint16 oper = _currScript->readUint16LE(); @@ -2580,25 +2580,25 @@ void LilliputScript::OC_sub17E99() { byte *buf = getCurrentCharacterVarFromScript(); byte var1 = buf[0]; - byte var3 = _vm->_rulesChunk11[var1 + _vm->_rulesChunk10[index]]; + byte var3 = _vm->_listArr[var1 + _vm->_listIndex[index]]; computeOperation(compBuf, oper, var3); } -void LilliputScript::OC_sub17EC5() { - debugC(1, kDebugScriptTBC, "OC_sub17EC5()"); +void LilliputScript::OC_setList() { + debugC(1, kDebugScript, "OC_setList()"); int indexChunk10 = _currScript->readUint16LE(); byte *compBuf = getCurrentCharacterVarFromScript(); - int indexChunk11 = _vm->_rulesChunk10[indexChunk10] + compBuf[0]; + int indexChunk11 = _vm->_listIndex[indexChunk10] + compBuf[0]; uint16 oper = _currScript->readUint16LE(); byte *tmpBuf = getCurrentCharacterVarFromScript(); int16 var3 = tmpBuf[0]; - computeOperation(&_vm->_rulesChunk11[indexChunk11], oper, var3); + computeOperation(&_vm->_listArr[indexChunk11], oper, var3); } Common::Point LilliputScript::getCharacterTilePos(int index) { @@ -3244,7 +3244,7 @@ void LilliputScript::OC_initSmallAnim() { void LilliputScript::OC_setCharacterHeroismBar() { debugC(1, kDebugScript, "OC_setCharacterHeroismBar()"); - _savedBuffer215Ptr = getCharacterAttributesPtr(); + _barAttrPtr = getCharacterAttributesPtr(); _heroismBarX = _currScript->readUint16LE(); _heroismBarBottomY = _currScript->readUint16LE(); } diff --git a/engines/lilliput/script.h b/engines/lilliput/script.h index c711ceb901..d75d24e3cf 100644 --- a/engines/lilliput/script.h +++ b/engines/lilliput/script.h @@ -83,7 +83,7 @@ public: byte _characterSeek[40]; int16 _interactions[40 * 40]; - byte *_savedBuffer215Ptr; + byte *_barAttrPtr; Common::Point _viewportPos; int16 _viewportCharacterTarget; @@ -247,8 +247,8 @@ private: void OC_setCurrentCharacterPos(); void OC_setCurrentCharacterBehavior(); void OC_changeCurrentCharacterSprite(); - void OC_sub17E99(); - void OC_sub17EC5(); + void OC_getList(); + void OC_setList(); void OC_setCharacterDirectionTowardsPos(); void OC_turnCharacterTowardsAnother(); void OC_setSeek(); |