diff options
Diffstat (limited to 'engines')
-rw-r--r-- | engines/gob/goblin.cpp | 78 | ||||
-rw-r--r-- | engines/gob/goblin_v2.cpp | 40 | ||||
-rw-r--r-- | engines/gob/goblin_v4.cpp | 28 | ||||
-rw-r--r-- | engines/gob/inter_v1.cpp | 10 | ||||
-rw-r--r-- | engines/gob/inter_v2.cpp | 18 | ||||
-rw-r--r-- | engines/gob/map.cpp | 33 | ||||
-rw-r--r-- | engines/gob/map.h | 40 |
7 files changed, 144 insertions, 103 deletions
diff --git a/engines/gob/goblin.cpp b/engines/gob/goblin.cpp index a516c844e4..88827e7fcf 100644 --- a/engines/gob/goblin.cpp +++ b/engines/gob/goblin.cpp @@ -669,11 +669,11 @@ void Goblin::adjustDest(int16 posX, int16 posY) { resDelta = i; } - for (i = 1; ((i + _pressedMapX) < _vm->_map->_mapWidth) && + for (i = 1; ((i + _pressedMapX) < _vm->_map->getMapWidth()) && (_vm->_map->getPass(_pressedMapX + i, _pressedMapY) == 0); i++) ; - if ((_pressedMapX + i) < _vm->_map->_mapWidth) { + if ((_pressedMapX + i) < _vm->_map->getMapWidth()) { deltaPix = (i * 12) - (posX % 12); if ((resDelta == -1) || (deltaPix < resDeltaPix)) { resDeltaPix = deltaPix; @@ -682,11 +682,11 @@ void Goblin::adjustDest(int16 posX, int16 posY) { } } - for (i = 1; ((i + _pressedMapY) < _vm->_map->_mapHeight) && + for (i = 1; ((i + _pressedMapY) < _vm->_map->getMapHeight()) && (_vm->_map->getPass(_pressedMapX, _pressedMapY + i) == 0); i++) ; - if ((_pressedMapY + i) < _vm->_map->_mapHeight) { + if ((_pressedMapY + i) < _vm->_map->getMapHeight()) { deltaPix = (i * 6) - (posY % 6); if ((resDelta == -1) || (deltaPix < resDeltaPix)) { resDeltaPix = deltaPix; @@ -727,8 +727,8 @@ void Goblin::adjustDest(int16 posX, int16 posY) { } } - _pressedMapX = CLIP((int) _pressedMapX, 0, _vm->_map->_mapWidth - 1); - _pressedMapY = CLIP((int) _pressedMapY, 0, _vm->_map->_mapHeight - 1); + _pressedMapX = CLIP((int) _pressedMapX, 0, _vm->_map->getMapWidth() - 1); + _pressedMapY = CLIP((int) _pressedMapY, 0, _vm->_map->getMapHeight() - 1); } void Goblin::adjustTarget() { @@ -738,18 +738,18 @@ void Goblin::adjustTarget() { if ((_pressedMapY > 0) && (_vm->_map->getItem(_pressedMapX, _pressedMapY - 1) != 0)) { _pressedMapY--; - } else if ((_pressedMapX < (_vm->_map->_mapWidth - 1)) && + } else if ((_pressedMapX < (_vm->_map->getMapWidth() - 1)) && (_vm->_map->getItem(_pressedMapX + 1, _pressedMapY) != 0)) { _pressedMapX++; - } else if ((_pressedMapX < (_vm->_map->_mapWidth - 1)) && + } else if ((_pressedMapX < (_vm->_map->getMapWidth() - 1)) && (_pressedMapY > 0) && (_vm->_map->getItem(_pressedMapX + 1, _pressedMapY - 1) != 0)) { _pressedMapY--; _pressedMapX++; } } - _pressedMapX = CLIP((int) _pressedMapX, 0, _vm->_map->_mapWidth - 1); - _pressedMapY = CLIP((int) _pressedMapY, 0, _vm->_map->_mapHeight - 1); + _pressedMapX = CLIP((int) _pressedMapX, 0, _vm->_map->getMapWidth() - 1); + _pressedMapY = CLIP((int) _pressedMapY, 0, _vm->_map->getMapHeight() - 1); } void Goblin::targetDummyItem(Gob_Object *gobDesc) { @@ -848,7 +848,7 @@ void Goblin::targetItem() { } } - if (_pressedMapY < (_vm->_map->_mapHeight-1)) { + if (_pressedMapY < (_vm->_map->getMapHeight()-1)) { if ((_vm->_map->getItem(_pressedMapX, _pressedMapY + 1)) == (_vm->_map->getItem(_pressedMapX, _pressedMapY))) { _pressedMapY++; @@ -899,8 +899,8 @@ void Goblin::targetItem() { } } } - _pressedMapX = CLIP((int) _pressedMapX, 0, _vm->_map->_mapWidth - 1); - _pressedMapY = CLIP((int) _pressedMapY, 0, _vm->_map->_mapHeight - 1); + _pressedMapX = CLIP((int) _pressedMapX, 0, _vm->_map->getMapWidth() - 1); + _pressedMapY = CLIP((int) _pressedMapY, 0, _vm->_map->getMapHeight() - 1); } void Goblin::moveFindItem(int16 posX, int16 posY) { @@ -934,23 +934,23 @@ void Goblin::moveFindItem(int16 posX, int16 posY) { break; } - _pressedMapX = CLIP(posX / 12, 0, _vm->_map->_mapWidth - 1); - _pressedMapY = CLIP(posY / 6, 0, _vm->_map->_mapHeight - 1); + _pressedMapX = CLIP(posX / 12, 0, _vm->_map->getMapWidth() - 1); + _pressedMapY = CLIP(posY / 6, 0, _vm->_map->getMapHeight() - 1); if ((_vm->_map->getItem(_pressedMapX, _pressedMapY) == 0) && (i < 20)) { - if ((_pressedMapY < (_vm->_map->_mapHeight - 1)) && + if ((_pressedMapY < (_vm->_map->getMapHeight() - 1)) && (_vm->_map->getItem(_pressedMapX, _pressedMapY + 1) != 0)) { _pressedMapY++; - } else if ((_pressedMapX < (_vm->_map->_mapWidth - 1)) && - (_pressedMapY < (_vm->_map->_mapHeight - 1)) && + } else if ((_pressedMapX < (_vm->_map->getMapWidth() - 1)) && + (_pressedMapY < (_vm->_map->getMapHeight() - 1)) && (_vm->_map->getItem(_pressedMapX + 1, _pressedMapY + 1) != 0)) { _pressedMapX++; _pressedMapY++; - } else if ((_pressedMapX < (_vm->_map->_mapWidth - 1)) && + } else if ((_pressedMapX < (_vm->_map->getMapWidth() - 1)) && (_vm->_map->getItem(_pressedMapX + 1, _pressedMapY) != 0)) { _pressedMapX++; - } else if ((_pressedMapX < (_vm->_map->_mapWidth - 1)) && + } else if ((_pressedMapX < (_vm->_map->getMapWidth() - 1)) && (_pressedMapY > 0) && (_vm->_map->getItem(_pressedMapX + 1, _pressedMapY - 1) != 0)) { _pressedMapX++; @@ -966,15 +966,15 @@ void Goblin::moveFindItem(int16 posX, int16 posY) { (_vm->_map->getItem(_pressedMapX - 1, _pressedMapY) != 0)) { _pressedMapX--; } else if ((_pressedMapX > 0) && - (_pressedMapY < (_vm->_map->_mapHeight - 1)) && + (_pressedMapY < (_vm->_map->getMapHeight() - 1)) && (_vm->_map->getItem(_pressedMapX - 1, _pressedMapY + 1) != 0)) { _pressedMapX--; _pressedMapY++; } } } else { - _pressedMapX = CLIP(posX / 12, 0, _vm->_map->_mapWidth - 1); - _pressedMapY = CLIP(posY / 6, 0, _vm->_map->_mapHeight - 1); + _pressedMapX = CLIP(posX / 12, 0, _vm->_map->getMapWidth() - 1); + _pressedMapY = CLIP(posY / 6, 0, _vm->_map->getMapHeight() - 1); } } @@ -1387,8 +1387,8 @@ void Goblin::pickItem(int16 indexToPocket, int16 idToPocket) { _itemIndInPocket = indexToPocket; _itemIdInPocket = idToPocket; - for (int y = 0; y < _vm->_map->_mapHeight; y++) { - for (int x = 0; x < _vm->_map->_mapWidth; x++) { + for (int y = 0; y < _vm->_map->getMapHeight(); y++) { + for (int x = 0; x < _vm->_map->getMapWidth(); x++) { if (_itemByteFlag == 1) { if (((_vm->_map->getItem(x, y) & 0xFF00) >> 8) == idToPocket) _vm->_map->setItem(x, y, _vm->_map->getItem(x, y) & 0xFF); @@ -1451,7 +1451,7 @@ void Goblin::placeItem(int16 indexInPocket, int16 idInPocket) { _vm->_map->placeItem(xPos, yPos - 1, idInPocket); if (lookDir == 4) { - if (xPos < _vm->_map->_mapWidth - 1) { + if (xPos < _vm->_map->getMapWidth() - 1) { _vm->_map->placeItem(xPos + 1, yPos, idInPocket); if (yPos > 0) @@ -1498,16 +1498,16 @@ void Goblin::swapItems(int16 indexToPick, int16 idToPick) { _itemIdInPocket = idToPick; if (_itemByteFlag == 0) { - for (y = 0; y < _vm->_map->_mapHeight; y++) { - for (x = 0; x < _vm->_map->_mapWidth; x++) { + for (y = 0; y < _vm->_map->getMapHeight(); y++) { + for (x = 0; x < _vm->_map->getMapWidth(); x++) { if ((_vm->_map->getItem(x, y) & 0xFF) == idToPick) _vm->_map->setItem(x, y, (_vm->_map->getItem(x, y) & 0xFF00) + idToPlace); } } } else { - for (y = 0; y < _vm->_map->_mapHeight; y++) { - for (x = 0; x < _vm->_map->_mapWidth; x++) { + for (y = 0; y < _vm->_map->getMapHeight(); y++) { + for (x = 0; x < _vm->_map->getMapWidth(); x++) { if (((_vm->_map->getItem(x, y) & 0xFF00) >> 8) == idToPick) _vm->_map->setItem(x, y, (_vm->_map->getItem(x, y) & 0xFF) + (idToPlace << 8)); } @@ -1705,15 +1705,15 @@ void Goblin::setState(int16 index, int16 state) { animData->newCycle = _vm->_scenery->getAnimLayer(animation, layer)->framesCount; _vm->_scenery->updateAnim(layer, 0, animation, 0, *obj->pPosX, *obj->pPosY, 1); - if (_vm->_map->_bigTiles) { - *obj->pPosY = ((obj->goblinY + 1) * _vm->_map->_tilesHeight) - + if (_vm->_map->hasBigTiles()) { + *obj->pPosY = ((obj->goblinY + 1) * _vm->_map->getTilesHeight()) - (_vm->_scenery->_animBottom - _vm->_scenery->_animTop) - (obj->goblinY + 1) / 2; } else { - *obj->pPosY = (obj->goblinY + 1) * _vm->_map->_tilesHeight - + *obj->pPosY = (obj->goblinY + 1) * _vm->_map->getTilesHeight() - (_vm->_scenery->_animBottom - _vm->_scenery->_animTop); } - *obj->pPosX = obj->goblinX * _vm->_map->_tilesWidth; + *obj->pPosX = obj->goblinX * _vm->_map->getTilesWidth(); } void Goblin::animate(Mult::Mult_Object *obj) { @@ -1795,11 +1795,11 @@ void Goblin::move(int16 destX, int16 destY, int16 objIndex) { int16 mouseX = _vm->_global->_inter_mouseX; int16 mouseY = _vm->_global->_inter_mouseY; - if (_vm->_map->_bigTiles) - mouseY += ((_vm->_global->_inter_mouseY / _vm->_map->_tilesHeight) + 1) / 2; + if (_vm->_map->hasBigTiles()) + mouseY += ((_vm->_global->_inter_mouseY / _vm->_map->getTilesHeight()) + 1) / 2; - int16 gobDestX = mouseX / _vm->_map->_tilesWidth; - int16 gobDestY = mouseY / _vm->_map->_tilesHeight; + int16 gobDestX = mouseX / _vm->_map->getTilesWidth(); + int16 gobDestY = mouseY / _vm->_map->getTilesHeight(); if (_vm->_map->getPass(gobDestX, gobDestY) == 0) _vm->_map->findNearestWalkable(gobDestX, gobDestY, mouseX, mouseY); @@ -1818,7 +1818,7 @@ void Goblin::move(int16 destX, int16 destY, int16 objIndex) { // Prevent continous walking on wide stairs if (passType == 11) { - if (_vm->_map->_screenWidth == 640) { + if (_vm->_map->getScreenWidth() == 640) { obj->gobDestY++; animData->destY++; } diff --git a/engines/gob/goblin_v2.cpp b/engines/gob/goblin_v2.cpp index 81888f7c02..503377c19b 100644 --- a/engines/gob/goblin_v2.cpp +++ b/engines/gob/goblin_v2.cpp @@ -80,13 +80,13 @@ void Goblin_v2::placeObject(Gob_Object *objDesc, char animated, objAnim->newCycle = 0; _vm->_scenery->updateAnim(objAnim->layer, 0, objAnim->animation, 0, *obj->pPosX, *obj->pPosY, 0); - if (!_vm->_map->_bigTiles) - *obj->pPosY = (y + 1) * _vm->_map->_tilesHeight + if (!_vm->_map->hasBigTiles()) + *obj->pPosY = (y + 1) * _vm->_map->getTilesHeight() - (_vm->_scenery->_animBottom - _vm->_scenery->_animTop); else - *obj->pPosY = ((y + 1) * _vm->_map->_tilesHeight) - + *obj->pPosY = ((y + 1) * _vm->_map->getTilesHeight()) - (_vm->_scenery->_animBottom - _vm->_scenery->_animTop) - (y + 1) / 2; - *obj->pPosX = x * _vm->_map->_tilesWidth; + *obj->pPosX = x * _vm->_map->getTilesWidth(); } else { if ((obj->goblinStates != 0) && (obj->goblinStates[state] != 0)) { layer = obj->goblinStates[state][0].layer; @@ -99,13 +99,13 @@ void Goblin_v2::placeObject(Gob_Object *objDesc, char animated, objAnim->isStatic = 0; objAnim->newCycle = _vm->_scenery->getAnimLayer(animation, layer)->framesCount; _vm->_scenery->updateAnim(layer, 0, animation, 0, *obj->pPosX, *obj->pPosY, 0); - if (!_vm->_map->_bigTiles) - *obj->pPosY = (y + 1) * _vm->_map->_tilesHeight + if (!_vm->_map->hasBigTiles()) + *obj->pPosY = (y + 1) * _vm->_map->getTilesHeight() - (_vm->_scenery->_animBottom - _vm->_scenery->_animTop); else - *obj->pPosY = ((y + 1) * _vm->_map->_tilesHeight) - + *obj->pPosY = ((y + 1) * _vm->_map->getTilesHeight()) - (_vm->_scenery->_animBottom - _vm->_scenery->_animTop) - (y + 1) / 2; - *obj->pPosX = x * _vm->_map->_tilesWidth; + *obj->pPosX = x * _vm->_map->getTilesWidth(); initiateMove(obj); } else initiateMove(obj); @@ -234,7 +234,7 @@ void Goblin_v2::movePathFind(Mult::Mult_Object *obj, Gob_Object *gobDesc, int16 switch (dir) { case kDirNW: animData->nextState = 1; - if (_vm->_map->_screenWidth == 640) { + if (_vm->_map->getScreenWidth() == 640) { if (_vm->_map->getPass(obj->goblinX, obj->goblinY) == 10) animData->nextState = 40; if (_vm->_map->getPass(obj->goblinX - 1, obj->goblinY - 2) != 10) @@ -245,7 +245,7 @@ void Goblin_v2::movePathFind(Mult::Mult_Object *obj, Gob_Object *gobDesc, int16 case kDirN: animData->nextState = (animData->curLookDir == 2) ? 2 : rotateState(animData->curLookDir, 2); - if (_vm->_map->_screenWidth == 640) { + if (_vm->_map->getScreenWidth() == 640) { if (_vm->_map->getPass(obj->goblinX, obj->goblinY) == 10) { if (_vm->_map->getPass(obj->goblinX - 1, obj->goblinY - 2) == 10) animData->nextState = 40; @@ -264,7 +264,7 @@ void Goblin_v2::movePathFind(Mult::Mult_Object *obj, Gob_Object *gobDesc, int16 case kDirNE: animData->nextState = 3; - if (_vm->_map->_screenWidth == 640) { + if (_vm->_map->getScreenWidth() == 640) { if (_vm->_map->getPass(obj->goblinX, obj->goblinY) == 10) animData->nextState = 42; if (_vm->_map->getPass(obj->goblinX + 1, obj->goblinY - 2) != 10) @@ -282,7 +282,7 @@ void Goblin_v2::movePathFind(Mult::Mult_Object *obj, Gob_Object *gobDesc, int16 case kDirSW: animData->nextState = 7; - if (_vm->_map->_screenWidth == 640) { + if (_vm->_map->getScreenWidth() == 640) { if (_vm->_map->getPass(obj->goblinX, obj->goblinY) == 10) animData->nextState = 41; if (_vm->_map->getPass(obj->goblinX - 1, obj->goblinY + 2) != 10) @@ -293,7 +293,7 @@ void Goblin_v2::movePathFind(Mult::Mult_Object *obj, Gob_Object *gobDesc, int16 case kDirS: animData->nextState = (animData->curLookDir == 6) ? 6 : rotateState(animData->curLookDir, 6); - if (_vm->_map->_screenWidth == 640) { + if (_vm->_map->getScreenWidth() == 640) { if (_vm->_map->getPass(obj->goblinX, obj->goblinY) == 20) animData->nextState = 39; if (_vm->_map->getPass(obj->goblinX, obj->goblinY) == 19) @@ -303,7 +303,7 @@ void Goblin_v2::movePathFind(Mult::Mult_Object *obj, Gob_Object *gobDesc, int16 case kDirSE: animData->nextState = 5; - if (_vm->_map->_screenWidth == 640) { + if (_vm->_map->getScreenWidth() == 640) { if (_vm->_map->getPass(obj->goblinX, obj->goblinY) == 10) animData->nextState = 43; if (_vm->_map->getPass(obj->goblinX + 1, obj->goblinY + 2) != 10) @@ -449,11 +449,11 @@ void Goblin_v2::moveAdvance(Mult::Mult_Object *obj, Gob_Object *gobDesc, animData->state = state; _vm->_scenery->updateAnim(layer, 0, animation, 0, *obj->pPosX, *obj->pPosY, 0); - uint32 gobPosX = gobX * _vm->_map->_tilesWidth; - uint32 gobPosY = (gobY * _vm->_map->_tilesHeight) - + uint32 gobPosX = gobX * _vm->_map->getTilesWidth(); + uint32 gobPosY = (gobY * _vm->_map->getTilesHeight()) - (_vm->_scenery->_animBottom - _vm->_scenery->_animTop); - if (_vm->_map->_bigTiles) + if (_vm->_map->hasBigTiles()) gobPosY -= gobY / 2; *obj->pPosX = gobPosX; @@ -480,11 +480,11 @@ void Goblin_v2::moveAdvance(Mult::Mult_Object *obj, Gob_Object *gobDesc, advMovement(obj, state); _vm->_scenery->updateAnim(layer, 0, animation, 0, *obj->pPosX, *obj->pPosY, 0); - uint32 gobPosX = gobX * _vm->_map->_tilesWidth; - uint32 gobPosY = (gobY * _vm->_map->_tilesHeight) - + uint32 gobPosX = gobX * _vm->_map->getTilesWidth(); + uint32 gobPosY = (gobY * _vm->_map->getTilesHeight()) - (_vm->_scenery->_animBottom - _vm->_scenery->_animTop); - if (_vm->_map->_bigTiles) + if (_vm->_map->hasBigTiles()) gobPosY -= gobY / 2; *obj->pPosX = gobPosX; diff --git a/engines/gob/goblin_v4.cpp b/engines/gob/goblin_v4.cpp index 0b0ff0e4f9..523357aab1 100644 --- a/engines/gob/goblin_v4.cpp +++ b/engines/gob/goblin_v4.cpp @@ -274,7 +274,7 @@ void Goblin_v4::movePathFind(Mult::Mult_Object *obj, Gob_Object *gobDesc, int16 switch (dir) { case kDirNW: animData->nextState = 1; - if (_vm->_map->_screenWidth == 640) { + if (_vm->_map->getScreenWidth() == 640) { if (_vm->_map->getPass(obj->goblinX, obj->goblinY) == 10) animData->nextState = 40; if (_vm->_map->getPass(obj->goblinX - 1, obj->goblinY - 2) != 10) @@ -285,7 +285,7 @@ void Goblin_v4::movePathFind(Mult::Mult_Object *obj, Gob_Object *gobDesc, int16 case kDirN: animData->nextState = (animData->curLookDir == 2) ? 2 : rotateState(animData->curLookDir, 2); - if (_vm->_map->_screenWidth == 640) { + if (_vm->_map->getScreenWidth() == 640) { if (_vm->_map->getPass(obj->goblinX, obj->goblinY) == 10) { if (_vm->_map->getPass(obj->goblinX - 1, obj->goblinY - 2) != 10) { if (_vm->_map->getPass(obj->goblinX + 1, obj->goblinY - 2) == 10) @@ -303,7 +303,7 @@ void Goblin_v4::movePathFind(Mult::Mult_Object *obj, Gob_Object *gobDesc, int16 case kDirNE: animData->nextState = 3; - if (_vm->_map->_screenWidth == 640) { + if (_vm->_map->getScreenWidth() == 640) { if (_vm->_map->getPass(obj->goblinX, obj->goblinY) == 10) animData->nextState = 42; if (_vm->_map->getPass(obj->goblinX + 1, obj->goblinY - 2) != 10) @@ -321,7 +321,7 @@ void Goblin_v4::movePathFind(Mult::Mult_Object *obj, Gob_Object *gobDesc, int16 case kDirSW: animData->nextState = 7; - if (_vm->_map->_screenWidth == 640) { + if (_vm->_map->getScreenWidth() == 640) { if (_vm->_map->getPass(obj->goblinX, obj->goblinY) == 10) animData->nextState = 41; if (_vm->_map->getPass(obj->goblinX - 1, obj->goblinY + 2) != 10) @@ -332,7 +332,7 @@ void Goblin_v4::movePathFind(Mult::Mult_Object *obj, Gob_Object *gobDesc, int16 case kDirS: animData->nextState = (animData->curLookDir == 6) ? 6 : rotateState(animData->curLookDir, 6); - if (_vm->_map->_screenWidth == 640) { + if (_vm->_map->getScreenWidth() == 640) { if (_vm->_map->getPass(obj->goblinX, obj->goblinY) == 20) animData->nextState = 39; else if (_vm->_map->getPass(obj->goblinX, obj->goblinY) == 19) @@ -342,7 +342,7 @@ void Goblin_v4::movePathFind(Mult::Mult_Object *obj, Gob_Object *gobDesc, int16 case kDirSE: animData->nextState = 5; - if (_vm->_map->_screenWidth == 640) { + if (_vm->_map->getScreenWidth() == 640) { if (_vm->_map->getPass(obj->goblinX, obj->goblinY) == 10) animData->nextState = 43; if (_vm->_map->getPass(obj->goblinX + 1, obj->goblinY + 2) != 10) @@ -508,13 +508,13 @@ void Goblin_v4::moveAdvance(Mult::Mult_Object *obj, Gob_Object *gobDesc, animData->frame = 0; animData->state = state; _vm->_scenery->updateAnim(layer, 0, animation, 0, *obj->pPosX, *obj->pPosY, 0); - if (_vm->_map->_bigTiles) - *obj->pPosY = ((gobY + 1) * _vm->_map->_tilesHeight) - + if (_vm->_map->hasBigTiles()) + *obj->pPosY = ((gobY + 1) * _vm->_map->getTilesHeight()) - (_vm->_scenery->_animBottom - _vm->_scenery->_animTop) - (gobY + 1) / 2; else - *obj->pPosY = ((gobY + 1) * _vm->_map->_tilesHeight) - + *obj->pPosY = ((gobY + 1) * _vm->_map->getTilesHeight()) - (_vm->_scenery->_animBottom - _vm->_scenery->_animTop); - *obj->pPosX = gobX * _vm->_map->_tilesWidth; + *obj->pPosX = gobX * _vm->_map->getTilesWidth(); } } } @@ -533,13 +533,13 @@ void Goblin_v4::moveAdvance(Mult::Mult_Object *obj, Gob_Object *gobDesc, advMovement(obj, state); _vm->_scenery->updateAnim(layer, 0, animation, 0, *obj->pPosX, *obj->pPosY, 0); - if (_vm->_map->_bigTiles) - *obj->pPosY = ((gobY + 1) * _vm->_map->_tilesHeight) - + if (_vm->_map->hasBigTiles()) + *obj->pPosY = ((gobY + 1) * _vm->_map->getTilesHeight()) - (_vm->_scenery->_animBottom - _vm->_scenery->_animTop) - (gobY + 1) / 2; else - *obj->pPosY = ((gobY + 1) * _vm->_map->_tilesHeight) - + *obj->pPosY = ((gobY + 1) * _vm->_map->getTilesHeight()) - (_vm->_scenery->_animBottom - _vm->_scenery->_animTop); - *obj->pPosX = gobX * _vm->_map->_tilesWidth; + *obj->pPosX = gobX * _vm->_map->getTilesWidth(); } } } diff --git a/engines/gob/inter_v1.cpp b/engines/gob/inter_v1.cpp index 0c2b3d2cea..6dab8161d0 100644 --- a/engines/gob/inter_v1.cpp +++ b/engines/gob/inter_v1.cpp @@ -2562,8 +2562,8 @@ void Inter_v1::animPalette() { } void Inter_v1::manipulateMap(int16 xPos, int16 yPos, int16 item) { - for (int y = 0; y < _vm->_map->_mapHeight; y++) { - for (int x = 0; x < _vm->_map->_mapWidth; x++) { + for (int y = 0; y < _vm->_map->getMapHeight(); y++) { + for (int x = 0; x < _vm->_map->getMapWidth(); x++) { if ((_vm->_map->getItem(x, y) & 0xFF) == item) _vm->_map->setItem(x, y, _vm->_map->getItem(x, y) & 0xFF00); else if (((_vm->_map->getItem(x, y) & 0xFF00) >> 8) == item) @@ -2571,7 +2571,7 @@ void Inter_v1::manipulateMap(int16 xPos, int16 yPos, int16 item) { } } - if (xPos < _vm->_map->_mapWidth - 1) { + if (xPos < _vm->_map->getMapWidth() - 1) { if (yPos > 0) { if (((_vm->_map->getItem(xPos, yPos) & 0xFF00) != 0) || ((_vm->_map->getItem(xPos, yPos - 1) & 0xFF00) != 0) || @@ -2660,7 +2660,7 @@ void Inter_v1::manipulateMap(int16 xPos, int16 yPos, int16 item) { return; } - if ((xPos < _vm->_map->_mapWidth - 2) && + if ((xPos < _vm->_map->getMapWidth() - 2) && (_vm->_map->getPass(xPos + 2, yPos) == 1)) { _vm->_map->_itemPoses[item].x = xPos + 2; _vm->_map->_itemPoses[item].y = yPos; @@ -2668,7 +2668,7 @@ void Inter_v1::manipulateMap(int16 xPos, int16 yPos, int16 item) { return; } - if ((xPos < _vm->_map->_mapWidth - 1) && + if ((xPos < _vm->_map->getMapWidth() - 1) && (_vm->_map->getPass(xPos + 1, yPos) == 1)) { _vm->_map->_itemPoses[item].x = xPos + 1; _vm->_map->_itemPoses[item].y = yPos; diff --git a/engines/gob/inter_v2.cpp b/engines/gob/inter_v2.cpp index 100a3572aa..2cb430ff9b 100644 --- a/engines/gob/inter_v2.cpp +++ b/engines/gob/inter_v2.cpp @@ -432,7 +432,7 @@ void Inter_v2::o2_loadMultObject() { obj.gobDestY = val; obj.goblinY = val; - *(obj.pPosX) *= _vm->_map->_tilesWidth; + *(obj.pPosX) *= _vm->_map->getTilesWidth(); layer = objAnim.layer; animation = obj.goblinStates[layer][0].animation; @@ -447,14 +447,14 @@ void Inter_v2::o2_loadMultObject() { _vm->_scenery->updateAnim(layer, 0, animation, 0, *(obj.pPosX), *(obj.pPosY), 0); - if (!_vm->_map->_bigTiles) - *(obj.pPosY) = (obj.goblinY + 1) * _vm->_map->_tilesHeight + if (!_vm->_map->hasBigTiles()) + *(obj.pPosY) = (obj.goblinY + 1) * _vm->_map->getTilesHeight() - (_vm->_scenery->_animBottom - _vm->_scenery->_animTop); else - *(obj.pPosY) = ((obj.goblinY + 1) * _vm->_map->_tilesHeight) - + *(obj.pPosY) = ((obj.goblinY + 1) * _vm->_map->getTilesHeight()) - (_vm->_scenery->_animBottom - _vm->_scenery->_animTop) - ((obj.goblinY + 1) / 2); - *(obj.pPosX) = obj.goblinX * _vm->_map->_tilesWidth; + *(obj.pPosX) = obj.goblinX * _vm->_map->getTilesWidth(); } else if ((objAnim.animType == 101) && (objIndex < _vm->_goblin->_gobsCount)) { @@ -778,14 +778,14 @@ void Inter_v2::o2_setGoblinState() { _vm->_scenery->updateAnim(layer, 0, animation, 0, *(obj.pPosX), *(obj.pPosY), 0); - if (_vm->_map->_bigTiles) - *(obj.pPosY) = ((obj.goblinY + 1) * _vm->_map->_tilesHeight) - + if (_vm->_map->hasBigTiles()) + *(obj.pPosY) = ((obj.goblinY + 1) * _vm->_map->getTilesHeight()) - (_vm->_scenery->_animBottom - _vm->_scenery->_animTop) - ((obj.goblinY + 1) / 2); else - *(obj.pPosY) = ((obj.goblinY + 1) * _vm->_map->_tilesHeight) - + *(obj.pPosY) = ((obj.goblinY + 1) * _vm->_map->getTilesHeight()) - (_vm->_scenery->_animBottom - _vm->_scenery->_animTop); - *(obj.pPosX) = obj.goblinX * _vm->_map->_tilesWidth; + *(obj.pPosX) = obj.goblinX * _vm->_map->getTilesWidth(); break; } } diff --git a/engines/gob/map.cpp b/engines/gob/map.cpp index 95b4c1b318..3efa18c264 100644 --- a/engines/gob/map.cpp +++ b/engines/gob/map.cpp @@ -41,8 +41,9 @@ Map::Map(GobEngine *vm) : _vm(vm) { _screenWidth = 0; _screenHeight = 0; - _tilesWidth = 0; - _tilesHeight = 0; + + _tilesWidth = 0; + _tilesHeight = 0; _bigTiles = false; @@ -86,6 +87,34 @@ uint8 Map::getVersion() const { return _mapVersion; } +int16 Map::getMapWidth() const { + return _mapWidth; +} + +int16 Map::getMapHeight() const { + return _mapHeight; +} + +int16 Map::getScreenWidth() const { + return _screenWidth; +} + +int16 Map::getScreenHeight() const { + return _screenHeight; +} + +int16 Map::getTilesWidth() const { + return _tilesWidth; +} + +int16 Map::getTilesHeight() const { + return _tilesHeight; +} + +bool Map::hasBigTiles() const { + return _bigTiles; +} + int8 Map::getPass(int x, int y, int width) const { if (!_passMap) return 0; diff --git a/engines/gob/map.h b/engines/gob/map.h index f8e16210ee..4866b9b7f8 100644 --- a/engines/gob/map.h +++ b/engines/gob/map.h @@ -72,23 +72,9 @@ struct ItemPos { class Map { public: - int16 _mapWidth; - int16 _mapHeight; - - int16 _screenWidth; - int16 _screenHeight; - int16 _tilesWidth; - int16 _tilesHeight; - - bool _bigTiles; - - bool _mapUnknownBool; - int16 _nearestWayPoint; int16 _nearestDest; - int16 **_itemsMap; // [y][x] - int16 _curGoblinX; int16 _curGoblinY; int16 _destX; @@ -102,6 +88,17 @@ public: uint8 getVersion() const; + int16 getMapWidth() const; + int16 getMapHeight() const; + + int16 getScreenWidth() const; + int16 getScreenHeight() const; + + int16 getTilesWidth() const; + int16 getTilesHeight() const; + + bool hasBigTiles() const; + int8 getPass(int x, int y, int width = -1) const; void setPass(int x, int y, int8 pass, int width = -1); @@ -136,12 +133,27 @@ protected: uint8 _mapVersion; + int16 _mapWidth; + int16 _mapHeight; + + int16 _screenWidth; + int16 _screenHeight; + + int16 _tilesWidth; + int16 _tilesHeight; + + bool _bigTiles; + + bool _mapUnknownBool; + int16 _passWidth; int8 *_passMap; // [y * _mapWidth + x], getPass(x, y); int16 _wayPointCount; WayPoint *_wayPoints; + int16 **_itemsMap; // [y][x] + int16 findNearestWayPoint(int16 x, int16 y); private: |