diff options
author | Filippos Karapetis | 2015-12-13 20:29:58 +0200 |
---|---|---|
committer | Willem Jan Palenstijn | 2015-12-23 21:34:03 +0100 |
commit | 99e09b2ca2615d9f5bbb682eb17920c8205af405 (patch) | |
tree | 738a8557ac2a7a51cf9b70a65b38b7b6574ec9a9 /engines/lab | |
parent | 2e099750868fa3b6129f0212d7f8d8a24f6aaa50 (diff) | |
download | scummvm-rg350-99e09b2ca2615d9f5bbb682eb17920c8205af405.tar.gz scummvm-rg350-99e09b2ca2615d9f5bbb682eb17920c8205af405.tar.bz2 scummvm-rg350-99e09b2ca2615d9f5bbb682eb17920c8205af405.zip |
LAB: Merge the different X image maps
Diffstat (limited to 'engines/lab')
-rw-r--r-- | engines/lab/lab.cpp | 7 | ||||
-rw-r--r-- | engines/lab/lab.h | 4 | ||||
-rw-r--r-- | engines/lab/map.cpp | 50 |
3 files changed, 21 insertions, 40 deletions
diff --git a/engines/lab/lab.cpp b/engines/lab/lab.cpp index 0c54e9c494..9ff0cdabe1 100644 --- a/engines/lab/lab.cpp +++ b/engines/lab/lab.cpp @@ -118,11 +118,8 @@ LabEngine::LabEngine(OSystem *syst, const ADGameDescription *gameDesc) _imgMaze = nullptr; _imgHugeMaze = nullptr; _imgPath = nullptr; - _imgMapNorth = nullptr; - _imgMapEast = nullptr; - _imgMapSouth = nullptr; - _imgMapWest = nullptr; - _imgXMark = nullptr; + for (int i = 0; i < 4; i++) + _imgMapX[i] = nullptr; _maps = nullptr; _blankJournal = nullptr; diff --git a/engines/lab/lab.h b/engines/lab/lab.h index 0f6fbacb07..37cd93f3bb 100644 --- a/engines/lab/lab.h +++ b/engines/lab/lab.h @@ -118,8 +118,8 @@ private: ButtonList _journalButtonList; ButtonList _mapButtonList; Image *_imgMap, *_imgRoom, *_imgUpArrowRoom, *_imgDownArrowRoom, *_imgBridge; - Image *_imgHRoom, *_imgVRoom, *_imgMaze, *_imgHugeMaze, *_imgPath, *_imgMapNorth; - Image *_imgMapEast, *_imgMapSouth, *_imgMapWest, *_imgXMark; + Image *_imgHRoom, *_imgVRoom, *_imgMaze, *_imgHugeMaze, *_imgPath; + Image *_imgMapX[4]; InventoryData *_inventory; MapData *_maps; byte *_blankJournal; diff --git a/engines/lab/map.cpp b/engines/lab/map.cpp index 2258775c79..1861ccc6a0 100644 --- a/engines/lab/map.cpp +++ b/engines/lab/map.cpp @@ -71,10 +71,10 @@ void LabEngine::loadMapData() { _imgMaze = new Image(mapImages); _imgHugeMaze = new Image(mapImages); - _imgMapNorth = new Image(mapImages); - _imgMapEast = new Image(mapImages); - _imgMapSouth = new Image(mapImages); - _imgMapWest = new Image(mapImages); + _imgMapX[NORTH] = new Image(mapImages); + _imgMapX[EAST] = new Image(mapImages); + _imgMapX[SOUTH] = new Image(mapImages); + _imgMapX[WEST] = new Image(mapImages); _imgPath = new Image(mapImages); _imgBridge = new Image(mapImages); @@ -115,11 +115,8 @@ void LabEngine::freeMapData() { delete _imgMaze; delete _imgHugeMaze; delete _imgPath; - delete _imgMapNorth; - delete _imgMapEast; - delete _imgMapSouth; - delete _imgMapWest; - // _imgXMark is a pointer to one of the four buffers above + for (int i = 0; i < 4; i++) + delete _imgMapX[i]; delete[] _maps; _imgMap = nullptr; @@ -132,11 +129,8 @@ void LabEngine::freeMapData() { _imgMaze = nullptr; _imgHugeMaze = nullptr; _imgPath = nullptr; - _imgMapNorth = nullptr; - _imgMapEast = nullptr; - _imgMapSouth = nullptr; - _imgMapWest = nullptr; - _imgXMark = nullptr; + for (int i = 0; i < 4; i++) + _imgMapX[i] = nullptr; _maps = nullptr; } @@ -216,16 +210,16 @@ void LabEngine::drawRoomMap(uint16 curRoom, bool drawMarkFl) { if (WESTDOOR & flags) _imgPath->drawImage(x - _imgPath->_width, y + offset); - drawX = x + (_imgRoom->_width - _imgXMark->_width) / 2; - drawY = y + (_imgRoom->_height - _imgXMark->_height) / 2; + drawX = x + (_imgRoom->_width - _imgMapX[_direction]->_width) / 2; + drawY = y + (_imgRoom->_height - _imgMapX[_direction]->_height) / 2; break; case BRIDGEROOM: _imgBridge->drawImage(x, y); - drawX = x + (_imgBridge->_width - _imgXMark->_width) / 2; - drawY = y + (_imgBridge->_height - _imgXMark->_height) / 2; + drawX = x + (_imgBridge->_width - _imgMapX[_direction]->_width) / 2; + drawY = y + (_imgBridge->_height - _imgMapX[_direction]->_height) / 2; break; @@ -262,8 +256,8 @@ void LabEngine::drawRoomMap(uint16 curRoom, bool drawMarkFl) { if (WESTMDOOR & flags) _imgPath->drawImage(x - _imgPath->_width, y - offset - _imgPath->_height + _imgVRoom->_height); - drawX = x + (_imgVRoom->_width - _imgXMark->_width) / 2; - drawY = y + (_imgVRoom->_height - _imgXMark->_height) / 2; + drawX = x + (_imgVRoom->_width - _imgMapX[_direction]->_width) / 2; + drawY = y + (_imgVRoom->_height - _imgMapX[_direction]->_height) / 2; break; @@ -300,8 +294,8 @@ void LabEngine::drawRoomMap(uint16 curRoom, bool drawMarkFl) { if (WESTDOOR & flags) _imgPath->drawImage(x - _imgPath->_width, y + offset); - drawX = x + (_imgHRoom->_width - _imgXMark->_width) / 2; - drawY = y + (_imgHRoom->_height - _imgXMark->_height) / 2; + drawX = x + (_imgHRoom->_width - _imgMapX[_direction]->_width) / 2; + drawY = y + (_imgHRoom->_height - _imgMapX[_direction]->_height) / 2; break; @@ -310,7 +304,7 @@ void LabEngine::drawRoomMap(uint16 curRoom, bool drawMarkFl) { } if (drawMarkFl) - _imgXMark->drawImage(drawX, drawY); + _imgMapX[_direction]->drawImage(drawX, drawY); } /** @@ -603,16 +597,6 @@ void LabEngine::doMap(uint16 curRoom) { _music->updateMusic(); loadMapData(); _graphics->blackAllScreen(); - - if (_direction == NORTH) - _imgXMark = _imgMapNorth; - else if (_direction == SOUTH) - _imgXMark = _imgMapSouth; - else if (_direction == EAST) - _imgXMark = _imgMapEast; - else if (_direction == WEST) - _imgXMark = _imgMapWest; - _event->attachButtonList(&_mapButtonList); drawMap(curRoom, curRoom, _maps[curRoom]._pageNumber, false, true); _event->mouseShow(); |