From 2a22b9bcc6758d589ffe6af361ee53e8c1a6841e Mon Sep 17 00:00:00 2001 From: Florian Kagerer Date: Mon, 19 Jan 2009 07:31:34 +0000 Subject: LOL: some renaming svn-id: r35919 --- engines/kyra/lol.cpp | 16 ++-- engines/kyra/lol.h | 27 ++++--- engines/kyra/scene_lol.cpp | 185 +++++++++++++++++++++++--------------------- engines/kyra/script_lol.cpp | 12 +-- 4 files changed, 127 insertions(+), 113 deletions(-) diff --git a/engines/kyra/lol.cpp b/engines/kyra/lol.cpp index f6ada2ef69..e9365ce75e 100644 --- a/engines/kyra/lol.cpp +++ b/engines/kyra/lol.cpp @@ -100,10 +100,10 @@ LoLEngine::LoLEngine(OSystem *system, const GameFlags &flags) : KyraEngine_v1(sy _currentBlock = 0; memset(_scriptExecutedFuncs, 0, 18 * sizeof(uint16)); - _wllVmpMap = _wllBuffer3 = _wllBuffer4 = _wllBuffer5 = 0; + _wllVmpMap = _wllBuffer3 = _wllBuffer4 = _wllWallFlags = 0; _wllShapeMap = 0; _lvlShapeTop = _lvlShapeBottom = _lvlShapeLeftRight = 0; - _cmzBuffer = 0; + _levelBlockProperties = 0; _lvlBuffer = 0; _lvl415 = 0; _lvlBlockIndex = _lvlShapeIndex = 0; @@ -224,13 +224,13 @@ LoLEngine::~LoLEngine() { delete[] _wllShapeMap; delete[] _wllBuffer3; delete[] _wllBuffer4; - delete[] _wllBuffer5; + delete[] _wllWallFlags; delete[] _lvlShapeTop; delete[] _lvlShapeBottom; delete[] _lvlShapeLeftRight; delete[] _tempBuffer5120; delete[] _lvlBuffer; - delete[] _cmzBuffer; + delete[] _levelBlockProperties; delete[] _lvl415; delete[] _lvlShpHeader; @@ -301,8 +301,8 @@ Common::Error LoLEngine::init() { memset(_wllBuffer3, 0, 80); _wllBuffer4 = new uint8[80]; memset(_wllBuffer4, 0, 80); - _wllBuffer5 = new uint8[80]; - memset(_wllBuffer5, 0, 80); + _wllWallFlags = new uint8[80]; + memset(_wllWallFlags, 0, 80); _lvlShapeTop = new int16[18]; memset(_lvlShapeTop, 0, 18 * sizeof(int16)); _lvlShapeBottom = new int16[18]; @@ -318,8 +318,8 @@ Common::Error LoLEngine::init() { _sceneWindowBuffer = new uint8[21120]; memset(_sceneWindowBuffer, 0, 21120); - _cmzBuffer = new CMZ[1025]; - memset(_cmzBuffer, 0, 1025 * sizeof(CMZ)); + _levelBlockProperties = new LevelBlockProperty[1025]; + memset(_levelBlockProperties, 0, 1025 * sizeof(LevelBlockProperty)); _lvlBuffer = new LVL[30]; memset(_lvlBuffer, 0, 30 * sizeof(LVL)); _lvl415 = new uint8[415]; diff --git a/engines/kyra/lol.h b/engines/kyra/lol.h index 85a5b2ce4f..61529ba5da 100644 --- a/engines/kyra/lol.h +++ b/engines/kyra/lol.h @@ -98,8 +98,8 @@ struct SpellProperty { uint16 field_1A; }; -struct CMZ { - uint8 unk[4]; +struct LevelBlockProperty { + uint8 walls[4]; uint16 itemIndex; uint8 field_6; uint8 field_7; @@ -113,7 +113,7 @@ struct LVL { uint8 field_2; uint8 field_3; uint8 field_4; - uint16 cmzIndex; + uint16 blockPropertyIndex; uint16 p_1a; uint16 p_1b; uint8 field_B; @@ -440,10 +440,10 @@ private: void cmzS6(uint16 &itemIndex, int a); void cmzS7(int itemIndex, int a); void loadLevelWLL(int index, bool mapShapes); - void moveItemToCMZ(uint16 *cmzItemIndex, uint16 item); + void moveItemToBlock(uint16 *cmzItemIndex, uint16 item); int assignLevelShapes(int index); uint8 *getLevelShapes(int index); - void loadLevelCMZ(int index); + void loadLevelCmzFile(int index); void loadCMZ_Sub(int index1, int index2); void loadCmzFile(const char *file); void loadMonsterShapes(const char *file, int monsterIndex, int b); @@ -453,11 +453,11 @@ private: void drawScene(int pageNum); - void generateBlockDrawingBuffer(int block, int b); + void generateBlockDrawingBuffer(int block, int direction); void generateBlockDrawingBufferF0(int16 wllOffset, uint8 wllIndex, uint8 wllVmpIndex, int16 vmpOffset, uint8 len, uint8 numEntries); void generateBlockDrawingBufferF1(int16 wllOffset, uint8 wllIndex, uint8 wllVmpIndex, int16 vmpOffset, uint8 len, uint8 numEntries); - bool testWllBuffer5Value(int index); - void assignBlockCaps(int a, int b); + bool hasWall(int index); + void assignBlockCaps(int block, int direction); void drawVcnBlocks(uint8 *vcnBlocks, uint16 *blockDrawingBuffer, uint8 *vcnShift, int pageNum); void drawSceneShapes(); @@ -475,6 +475,9 @@ private: void turnOnLamp(); void updateLampStatus(); + void moveParty(uint16 direction, int unk1, int unk2, int unk3); + uint16 calcNewBlockPostion(uint16 curBlock, uint16 direction); + void setLF1(uint16 & a, uint16 & b, int block, uint16 d, uint16 e); void setLF2(int block); @@ -519,14 +522,14 @@ private: int8 *_wllShapeMap; uint8 *_wllBuffer3; uint8 *_wllBuffer4; - uint8 *_wllBuffer5; + uint8 *_wllWallFlags; int16 *_lvlShapeTop; int16 *_lvlShapeBottom; int16 *_lvlShapeLeftRight; - CMZ *_cmzBuffer; - CMZ *_curBlockCaps[18]; + LevelBlockProperty *_levelBlockProperties; + LevelBlockProperty *_curBlockCaps[18]; LVL *_lvlBuffer; uint8 *_lvl415; @@ -605,7 +608,7 @@ private: uint16 itemIndexUnk; uint8 unk2; uint16 unk3; - uint16 cmzIndex; + uint16 blockPropertyIndex; uint16 unk7; uint16 anonymous_4; int8 level; diff --git a/engines/kyra/scene_lol.cpp b/engines/kyra/scene_lol.cpp index 207874cd7b..7523b5d6a1 100644 --- a/engines/kyra/scene_lol.cpp +++ b/engines/kyra/scene_lol.cpp @@ -67,7 +67,7 @@ void LoLEngine::loadLevel(int index) { runInitScript(filename, f ? 0 : 1); if (f) - loadLevelCMZ(index); + loadLevelCmzFile(index); sprintf(filename, "LEVEL%d.INF", index); runInfScript(filename); @@ -93,15 +93,15 @@ void LoLEngine::addLevelItems() { if (_itemsInPlay[i].level != _currentLevel) continue; - moveItemToCMZ(&_cmzBuffer[_itemsInPlay[i].cmzIndex].itemIndex, i); + moveItemToBlock(&_levelBlockProperties[_itemsInPlay[i].blockPropertyIndex].itemIndex, i); - _cmzBuffer[_itemsInPlay[i].cmzIndex].field_8 = 5; + _levelBlockProperties[_itemsInPlay[i].blockPropertyIndex].field_8 = 5; _itemsInPlay[i].unk2 = 0; } } int LoLEngine::initCmzWithScript(int block) { - int i = _cmzBuffer[block].itemIndex; + int i = _levelBlockProperties[block].itemIndex; int cnt = 0; while (i) { @@ -116,7 +116,7 @@ int LoLEngine::initCmzWithScript(int block) { cnt++; initCMZ1(l, 14); - checkScriptUnk(l->cmzIndex); + checkScriptUnk(l->blockPropertyIndex); initCMZ2(l, 0, 0); } @@ -152,7 +152,7 @@ void LoLEngine::initCMZ1(LVL *l, int a) { if (_currentLevel != 29) initCMZ1(l, 14); runResidentScriptCustom(0x404, -1, l->field_16, l->field_16, 0, 0); - checkScriptUnk(l->cmzIndex); + checkScriptUnk(l->blockPropertyIndex); if (l->field_14 == 14) initCMZ2(l, 0, 0); } @@ -162,16 +162,16 @@ void LoLEngine::initCMZ1(LVL *l, int a) { void LoLEngine::initCMZ2(LVL *l, uint16 a, uint16 b) { bool cont = true; - int t = l->cmzIndex; - if (l->cmzIndex) { - cmzS4(_cmzBuffer[l->cmzIndex].itemIndex, ((uint16)l->field_16) | 0x8000); - _cmzBuffer[l->cmzIndex].field_8 = 5; - checkScriptUnk(l->cmzIndex); + int t = l->blockPropertyIndex; + if (l->blockPropertyIndex) { + cmzS4(_levelBlockProperties[l->blockPropertyIndex].itemIndex, ((uint16)l->field_16) | 0x8000); + _levelBlockProperties[l->blockPropertyIndex].field_8 = 5; + checkScriptUnk(l->blockPropertyIndex); } else { cont = false; } - l->cmzIndex = cmzS5(a, b); + l->blockPropertyIndex = cmzS5(a, b); if (l->p_1a != a || l->p_1b != b) { l->p_1a = a; @@ -179,27 +179,27 @@ void LoLEngine::initCMZ2(LVL *l, uint16 a, uint16 b) { l->field_13 = (++l->field_13) & 3; } - if (l->cmzIndex == 0) + if (l->blockPropertyIndex == 0) return; - cmzS6(_cmzBuffer[l->cmzIndex].itemIndex, ((uint16)l->field_16) | 0x8000); - _cmzBuffer[l->cmzIndex].field_8 = 5; - checkScriptUnk(l->cmzIndex); + cmzS6(_levelBlockProperties[l->blockPropertyIndex].itemIndex, ((uint16)l->field_16) | 0x8000); + _levelBlockProperties[l->blockPropertyIndex].field_8 = 5; + checkScriptUnk(l->blockPropertyIndex); uint8 *v = l->offs_lvl415; if (v[80] == 0 || cont == false) return; - if ((!(READ_LE_UINT16(&v[62]) & 0x100) || ((l->field_13 & 1) == 0)) && l->cmzIndex == t) + if ((!(READ_LE_UINT16(&v[62]) & 0x100) || ((l->field_13 & 1) == 0)) && l->blockPropertyIndex == t) return; - if (l->cmzIndex != t) - runResidentScriptCustom(l->cmzIndex, 0x800, -1, l->field_16, 0, 0); + if (l->blockPropertyIndex != t) + runResidentScriptCustom(l->blockPropertyIndex, 0x800, -1, l->field_16, 0, 0); if (_charFlagUnk & 1) return; - cmzS7(l->offs_lvl415[50], l->cmzIndex); + cmzS7(l->offs_lvl415[50], l->blockPropertyIndex); } int LoLEngine::cmzS1(uint16 a, uint16 b, uint16 c, uint16 d) { @@ -236,7 +236,7 @@ void LoLEngine::cmzS7(int itemIndex, int a) { // TODO } -void LoLEngine::moveItemToCMZ(uint16 *cmzItemIndex, uint16 item) { +void LoLEngine::moveItemToBlock(uint16 *cmzItemIndex, uint16 item) { uint16 *tmp = 0; while (*cmzItemIndex & 0x8000) { tmp = (uint16*) cmzGetItemOffset(*cmzItemIndex); @@ -287,7 +287,7 @@ void LoLEngine::loadLevelWLL(int index, bool mapShapes) { d += 2; _wllBuffer3[c] = *d; d += 2; - _wllBuffer5[c] = *d; + _wllWallFlags[c] = *d; d += 2; _wllBuffer4[c] = *d; d += 2; @@ -351,7 +351,7 @@ uint8 *LoLEngine::getLevelShapes(int shapeIndex) { return res; } -void LoLEngine::loadLevelCMZ(int index) { +void LoLEngine::loadLevelCmzFile(int index) { //char filename[16]; //sprintf(filename, "_LEVEL%d.TMP", index); // TODO ??? @@ -371,22 +371,22 @@ void LoLEngine::loadLevelCMZ(int index) { for (int i = 0; i < 1024; i++) memcpy(&cmzdata[i << 2], &p[i * len + 6], 4); - memset(_cmzBuffer, 0, 1024 * sizeof(CMZ)); + memset(_levelBlockProperties, 0, 1024 * sizeof(LevelBlockProperty)); uint8 *c = cmzdata; uint8 *t = _tempBuffer5120; for (int i = 0; i < 1024; i++) { for (int ii = 0; ii < 4; ii++) - _cmzBuffer[i].unk[ii] = *c++ ^ *t++; + _levelBlockProperties[i].walls[ii] = *c++ ^ *t++; } for (int i = 0; i < 1024; i++) - _cmzBuffer[i].flags = *t++; + _levelBlockProperties[i].flags = *t++; for (int i = 0; i < 30; i++) { - if (_lvlBuffer[i].cmzIndex) { - _lvlBuffer[i].cmzIndex = 0; + if (_lvlBuffer[i].blockPropertyIndex) { + _lvlBuffer[i].blockPropertyIndex = 0; _lvlBuffer[i].offs_lvl415 = _lvl415 + _lvlBuffer[i].field_20; initCMZ2(&_lvlBuffer[i], _lvlBuffer[i].p_1a, _lvlBuffer[i].p_1b); } @@ -404,7 +404,7 @@ void LoLEngine::loadCMZ_Sub(int index1, int index2) { //int r = 0; for (int i = 0; i < 30; i++) { - if (_lvlBuffer[i].field_14 >= 14 || _lvlBuffer[i].cmzIndex == 0 || _lvlBuffer[i].field_1D <= 0) + if (_lvlBuffer[i].field_14 >= 14 || _lvlBuffer[i].blockPropertyIndex == 0 || _lvlBuffer[i].field_1D <= 0) continue; int t = (val * _lvlBuffer[i].field_1D) >> 8; @@ -417,7 +417,7 @@ void LoLEngine::loadCMZ_Sub(int index1, int index2) { } void LoLEngine::loadCmzFile(const char *file) { - memset(_cmzBuffer, 0, 1024 * sizeof(CMZ)); + memset(_levelBlockProperties, 0, 1024 * sizeof(LevelBlockProperty)); _screen->loadBitmap(file, 2, 2, 0); const uint8 *h = _screen->getCPagePtr(2); uint16 len = READ_LE_UINT16(&h[4]); @@ -425,13 +425,13 @@ void LoLEngine::loadCmzFile(const char *file) { for (int i = 0; i < 1024; i++) { for (int ii = 0; ii < 4; ii++) - _cmzBuffer[i].unk[ii] = p[i * len + ii]; + _levelBlockProperties[i].walls[ii] = p[i * len + ii]; - _cmzBuffer[i].field_8 = 5; + _levelBlockProperties[i].field_8 = 5; - if (_wllBuffer4[_cmzBuffer[i].unk[0]] == 17) { - _cmzBuffer[i].flags &= 0xef; - _cmzBuffer[i].flags |= 0x20; + if (_wllBuffer4[_levelBlockProperties[i].walls[0]] == 17) { + _levelBlockProperties[i].flags &= 0xef; + _levelBlockProperties[i].flags |= 0x20; } } } @@ -731,6 +731,17 @@ void LoLEngine::updateLampStatus() { _lampOilStatus = newLampOilStatus; } +void LoLEngine::moveParty(uint16 direction, int unk1, int unk2, int unk3) { + // TODO + _currentBlock = calcNewBlockPostion(_currentBlock, direction); + // XXXX +} + +uint16 LoLEngine::calcNewBlockPostion(uint16 curBlock, uint16 direction) { + static const int16 blockPosTable[] = { -32, 1, 32, -1, 1, -1, 3, 2, -1, 0, -1, 0, 1, -32, 0, 32 }; + return (curBlock + blockPosTable[direction]) & 0x3ff; +} + void LoLEngine::setLF1(uint16 & a, uint16 & b, int block, uint16 d, uint16 e) { a = block & 0x1f; a = ((a >> 8) | ((a & 0xff) << 8)) | d; @@ -740,7 +751,7 @@ void LoLEngine::setLF1(uint16 & a, uint16 & b, int block, uint16 d, uint16 e) { void LoLEngine::setLF2(int block) { if (!(_screen->_drawGuiFlag & 0x1000)) return; - _cmzBuffer[block].flags |= 7; + _levelBlockProperties[block].flags |= 7; // TODO } @@ -783,7 +794,7 @@ void LoLEngine::updateSceneWindow() { _screen->showMouse(); } -void LoLEngine::generateBlockDrawingBuffer(int block, int b) { +void LoLEngine::generateBlockDrawingBuffer(int block, int direction) { _sceneDrawVar1 = _dscBlockMap[_currentDirection]; _sceneDrawVar2 = _dscBlockMap[_currentDirection + 4]; _sceneDrawVar3 = _dscBlockMap[_currentDirection + 8]; @@ -797,110 +808,110 @@ void LoLEngine::generateBlockDrawingBuffer(int block, int b) { else generateBlockDrawingBufferF0(0, 15, 1, -330, 22, 15); - assignBlockCaps(block, b); + assignBlockCaps(block, direction); - uint8 t = _curBlockCaps[0]->unk[_sceneDrawVar2]; + uint8 t = _curBlockCaps[0]->walls[_sceneDrawVar2]; if (t) generateBlockDrawingBufferF0(-2, 3, t, 102, 3, 5); - t = _curBlockCaps[6]->unk[_sceneDrawVar3]; + t = _curBlockCaps[6]->walls[_sceneDrawVar3]; if (t) generateBlockDrawingBufferF1(21, 3, t, 102, 3, 5); - t = _curBlockCaps[1]->unk[_sceneDrawVar2]; - uint8 t2 = _curBlockCaps[2]->unk[_sceneDrawVar1]; + t = _curBlockCaps[1]->walls[_sceneDrawVar2]; + uint8 t2 = _curBlockCaps[2]->walls[_sceneDrawVar1]; - if (testWllBuffer5Value(t) && !(_wllBuffer5[t2] & 8)) + if (hasWall(t) && !(_wllWallFlags[t2] & 8)) generateBlockDrawingBufferF0(2, 3, t, 102, 3, 5); - else if (t && (_wllBuffer5[t2] & 8)) + else if (t && (_wllWallFlags[t2] & 8)) generateBlockDrawingBufferF0(2, 3, t2, 102, 3, 5); - t = _curBlockCaps[5]->unk[_sceneDrawVar3]; - t2 = _curBlockCaps[4]->unk[_sceneDrawVar1]; + t = _curBlockCaps[5]->walls[_sceneDrawVar3]; + t2 = _curBlockCaps[4]->walls[_sceneDrawVar1]; - if (testWllBuffer5Value(t) && !(_wllBuffer5[t2] & 8)) + if (hasWall(t) && !(_wllWallFlags[t2] & 8)) generateBlockDrawingBufferF1(17, 3, t, 102, 3, 5); - else if(t && (_wllBuffer5[t2] & 8)) + else if(t && (_wllWallFlags[t2] & 8)) generateBlockDrawingBufferF1(17, 3, t2, 102, 3, 5); - t = _curBlockCaps[2]->unk[_sceneDrawVar2]; + t = _curBlockCaps[2]->walls[_sceneDrawVar2]; if (t) generateBlockDrawingBufferF0(8, 3, t, 97, 1, 5); - t = _curBlockCaps[4]->unk[_sceneDrawVar3]; + t = _curBlockCaps[4]->walls[_sceneDrawVar3]; if (t) generateBlockDrawingBufferF1(13, 3, t, 97, 1, 5); - t = _curBlockCaps[1]->unk[_sceneDrawVar1]; - if (testWllBuffer5Value(t)) + t = _curBlockCaps[1]->walls[_sceneDrawVar1]; + if (hasWall(t)) generateBlockDrawingBufferF0(-4, 3, t, 129, 6, 5); - t = _curBlockCaps[5]->unk[_sceneDrawVar1]; - if (testWllBuffer5Value(t)) + t = _curBlockCaps[5]->walls[_sceneDrawVar1]; + if (hasWall(t)) generateBlockDrawingBufferF0(20, 3, t, 129, 6, 5); - t = _curBlockCaps[2]->unk[_sceneDrawVar1]; - if (testWllBuffer5Value(t)) + t = _curBlockCaps[2]->walls[_sceneDrawVar1]; + if (hasWall(t)) generateBlockDrawingBufferF0(2, 3, t, 129, 6, 5); - t = _curBlockCaps[4]->unk[_sceneDrawVar1]; - if (testWllBuffer5Value(t)) + t = _curBlockCaps[4]->walls[_sceneDrawVar1]; + if (hasWall(t)) generateBlockDrawingBufferF0(14, 3, t, 129, 6, 5); - t = _curBlockCaps[3]->unk[_sceneDrawVar1]; + t = _curBlockCaps[3]->walls[_sceneDrawVar1]; if (t) generateBlockDrawingBufferF0(8, 3, t, 129, 6, 5); - t = _curBlockCaps[7]->unk[_sceneDrawVar2]; + t = _curBlockCaps[7]->walls[_sceneDrawVar2]; if (t) generateBlockDrawingBufferF0(0, 3, t, 117, 2, 6); - t = _curBlockCaps[11]->unk[_sceneDrawVar3]; + t = _curBlockCaps[11]->walls[_sceneDrawVar3]; if (t) generateBlockDrawingBufferF1(20, 3, t, 117, 2, 6); - t = _curBlockCaps[8]->unk[_sceneDrawVar2]; + t = _curBlockCaps[8]->walls[_sceneDrawVar2]; if (t) generateBlockDrawingBufferF0(6, 2, t, 81, 2, 8); - t = _curBlockCaps[10]->unk[_sceneDrawVar3]; + t = _curBlockCaps[10]->walls[_sceneDrawVar3]; if (t) generateBlockDrawingBufferF1(14, 2, t, 81, 2, 8); - t = _curBlockCaps[8]->unk[_sceneDrawVar1]; - if (testWllBuffer5Value(t)) + t = _curBlockCaps[8]->walls[_sceneDrawVar1]; + if (hasWall(t)) generateBlockDrawingBufferF0(-4, 2, t, 159, 10, 8); - t = _curBlockCaps[10]->unk[_sceneDrawVar1]; - if (testWllBuffer5Value(t)) + t = _curBlockCaps[10]->walls[_sceneDrawVar1]; + if (hasWall(t)) generateBlockDrawingBufferF0(16, 2, t, 159, 10, 8); - t = _curBlockCaps[9]->unk[_sceneDrawVar1]; + t = _curBlockCaps[9]->walls[_sceneDrawVar1]; if (t) generateBlockDrawingBufferF0(6, 2, t, 159, 10, 8); - t = _curBlockCaps[12]->unk[_sceneDrawVar2]; + t = _curBlockCaps[12]->walls[_sceneDrawVar2]; if (t) generateBlockDrawingBufferF0(3, 1, t, 45, 3, 12); - t = _curBlockCaps[14]->unk[_sceneDrawVar3]; + t = _curBlockCaps[14]->walls[_sceneDrawVar3]; if (t) generateBlockDrawingBufferF1(16, 1, t, 45, 3, 12); - t = _curBlockCaps[12]->unk[_sceneDrawVar1]; - if (!(_wllBuffer5[t] & 8)) + t = _curBlockCaps[12]->walls[_sceneDrawVar1]; + if (!(_wllWallFlags[t] & 8)) generateBlockDrawingBufferF0(-13, 1, t, 239, 16, 12); - t = _curBlockCaps[14]->unk[_sceneDrawVar1]; - if (!(_wllBuffer5[t] & 8)) + t = _curBlockCaps[14]->walls[_sceneDrawVar1]; + if (!(_wllWallFlags[t] & 8)) generateBlockDrawingBufferF0(19, 1, t, 239, 16, 12); - t = _curBlockCaps[13]->unk[_sceneDrawVar1]; + t = _curBlockCaps[13]->walls[_sceneDrawVar1]; if (t) generateBlockDrawingBufferF0(3, 1, t, 239, 16, 12); - t = _curBlockCaps[15]->unk[_sceneDrawVar2]; - t2 = _curBlockCaps[17]->unk[_sceneDrawVar3]; + t = _curBlockCaps[15]->walls[_sceneDrawVar2]; + t2 = _curBlockCaps[17]->walls[_sceneDrawVar3]; if (t) generateBlockDrawingBufferF0(0, 0, t, 0, 3, 15); if (t2) @@ -947,18 +958,18 @@ void LoLEngine::generateBlockDrawingBufferF1(int16 wllOffset, uint8 wllIndex, ui } } -bool LoLEngine::testWllBuffer5Value(int index) { - if (!index || (_wllBuffer5[index] & 8)) +bool LoLEngine::hasWall(int index) { + if (!index || (_wllWallFlags[index] & 8)) return false; return true; } -void LoLEngine::assignBlockCaps(int a, int b) { +void LoLEngine::assignBlockCaps(int block, int direction) { for (int i = 0; i < 18; i++) { - uint16 t = (a + _dscBlockIndex[b * 18 + i]) & 0x3ff; + uint16 t = (block + _dscBlockIndex[direction * 18 + i]) & 0x3ff; _scriptExecutedFuncs[i] = t; - _curBlockCaps[i] = &_cmzBuffer[t]; + _curBlockCaps[i] = &_levelBlockProperties[t]; _lvlShapeLeftRight[i] = _lvlShapeLeftRight[18 + i] = -1; } } @@ -1074,7 +1085,7 @@ void LoLEngine::drawVcnBlocks(uint8 *vcnBlocks, uint16 *blockDrawingBuffer, uint void LoLEngine::drawSceneShapes() { for (int i = 0; i < 18; i++) { uint8 t = _dscTileIndex[i]; - uint8 s = _curBlockCaps[t]->unk[_sceneDrawVar1]; + uint8 s = _curBlockCaps[t]->walls[_sceneDrawVar1]; int16 x1 = 0; int16 x2 = 0; @@ -1089,7 +1100,7 @@ void LoLEngine::drawSceneShapes() { drawDecorations(t); - uint16 w = _wllBuffer5[s]; + uint16 w = _wllWallFlags[s]; if (i == 16) w |= 0x80; @@ -1123,8 +1134,8 @@ void LoLEngine::setLevelShapesDim(int index, int16 &x1, int16 &x2, int dim) { int m = index * 18; for (int i = 0; i < 18; i++) { - uint8 d = _curBlockCaps[i]->unk[_sceneDrawVar1]; - uint8 a = _wllBuffer5[d]; + uint8 d = _curBlockCaps[i]->walls[_sceneDrawVar1]; + uint8 a = _wllWallFlags[d]; if (a & 8) { int t = _dscDim2[(m + i) << 1]; @@ -1219,7 +1230,7 @@ void LoLEngine::drawDecorations(int index) { continue; uint8 d = (_currentDirection + _dscUnk1[s]) & 3; - int8 l = _wllShapeMap[_curBlockCaps[index]->unk[d]]; + int8 l = _wllShapeMap[_curBlockCaps[index]->walls[d]]; uint8 *shapeData = 0; diff --git a/engines/kyra/script_lol.cpp b/engines/kyra/script_lol.cpp index 93a88daba2..c5ca834e76 100644 --- a/engines/kyra/script_lol.cpp +++ b/engines/kyra/script_lol.cpp @@ -180,7 +180,7 @@ int LoLEngine::o2_getItemPara(EMCState *script) { switch(stackPos(1)) { case 0: - return i->cmzIndex; + return i->blockPropertyIndex; case 1: return i->unk7; case 2: @@ -333,22 +333,22 @@ int LoLEngine::o2_loadDoorShapes(EMCState *script) { _doorShapes[1] = _screen->makeShapeCopy(p, stackPos(2)); for (int i = 0; i < 20; i++) { - _wllBuffer5[i + 3] |= 7; + _wllWallFlags[i + 3] |= 7; int t = i % 5; if (t == 4) - _wllBuffer5[i + 3] &= 0xf8; + _wllWallFlags[i + 3] &= 0xf8; if (t == 3) - _wllBuffer5[i + 3] &= 0xfd; + _wllWallFlags[i + 3] &= 0xfd; } if (stackPos(3)) { for (int i = 3; i < 13; i++) - _wllBuffer5[i] &= 0xfd; + _wllWallFlags[i] &= 0xfd; } if (stackPos(4)) { for (int i = 13; i < 23; i++) - _wllBuffer5[i] &= 0xfd; + _wllWallFlags[i] &= 0xfd; } return 1; -- cgit v1.2.3