diff options
-rw-r--r-- | engines/xeen/map.cpp | 20 | ||||
-rw-r--r-- | engines/xeen/scripts.cpp | 8 |
2 files changed, 12 insertions, 16 deletions
diff --git a/engines/xeen/map.cpp b/engines/xeen/map.cpp index a459b56ae4..b9b674cbdd 100644 --- a/engines/xeen/map.cpp +++ b/engines/xeen/map.cpp @@ -987,7 +987,7 @@ void Map::load(int mapId) { if (isDarkCc && mapId == 50) mazeDataP->setAllTilesStepped(); - if (!isDarkCc && _vm->_party->_gameFlags[25] && + if (!isDarkCc && _vm->_party->_gameFlags[0][25] && (mapId == 42 || mapId == 43 || mapId == 4)) { mazeDataP->clearCellSurfaces(); } @@ -1061,7 +1061,7 @@ void Map::load(int mapId) { _mobData._objects[29]._spriteId = 0; _mobData._objects[29]._id = 8; _mobData._objectSprites[i]._sprites.clear(); - } else if (mapId == 12 && _vm->_party->_gameFlags[43] && + } else if (mapId == 12 && _vm->_party->_gameFlags[0][43] && _mobData._objectSprites[i]._spriteId == 118 && !isDarkCc) { filename = "085.obj"; _mobData._objectSprites[0]._spriteId = 85; @@ -1451,11 +1451,11 @@ int Map::getCell(int idx) { _currentWall = INVALID_CELL; return INVALID_CELL; } - - _mazeDataIndex = 0; - while (_mazeData[_mazeDataIndex]._mazeId != mapId) - ++_mazeDataIndex; } + + _mazeDataIndex = 0; + while (_mazeData[_mazeDataIndex]._mazeId != mapId) + ++_mazeDataIndex; } if (pt.x & 16) { @@ -1494,10 +1494,10 @@ int Map::getCell(int idx) { ++_mazeDataIndex; } + assert(ABS(pt.x) < 16 && ABS(pt.y) < 16); int wallData = _mazeData[_mazeDataIndex]._wallData[pt.y][pt.x]._data; if (_isOutdoors) { if (mapId) { - // TODO: tile is set to word of (wallLayers >> 8) && 0xff? Makes no sense _currentTile = (wallData >> 8) & 0xFF; _currentWall = (wallData >> 4) & 0xF; _currentSurfaceId = wallData & 0xF; @@ -1510,11 +1510,7 @@ int Map::getCell(int idx) { if (!mapId) return 0; - if (pt.x > 31 || pt.y > 31) - _currentSurfaceId = 7; - else - _currentSurfaceId = _mazeData[_mazeDataIndex]._cells[pt.y][pt.x]._surfaceId; - + _currentSurfaceId = _mazeData[_mazeDataIndex]._cells[pt.y][pt.x]._surfaceId; _currentWall = wallData; return (_currentWall >> Res.WALL_SHIFTS[dir][idx]) & 0xF; } diff --git a/engines/xeen/scripts.cpp b/engines/xeen/scripts.cpp index d1bd1f21f2..ea4fc1cc06 100644 --- a/engines/xeen/scripts.cpp +++ b/engines/xeen/scripts.cpp @@ -1446,9 +1446,9 @@ bool Scripts::ifProc(int action, uint32 mask, int mode, int charIndex) { } case 20: if (_vm->_files->_isDarkCc) - mask += 0x100; - assert(mask < 0x200); - v = party._gameFlags[mask] ? mask : 0xffffffff; + mask += 256; + assert(mask < 512); + v = party._gameFlags[mask / 256][mask % 256] ? mask : 0xffffffff; break; case 21: // Scans inventories for given item number @@ -1480,7 +1480,7 @@ bool Scripts::ifProc(int action, uint32 mask, int mode, int charIndex) { } else { int baseFlag = 8 * (6 + mask); for (int idx = 0; idx < 8; ++idx) { - if (party._gameFlags[baseFlag + idx]) { + if (party._gameFlags[0][baseFlag + idx]) { v = mask; break; } |