From 2bad773046f530f3b58c44ba8879bd4f562c2078 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 27 Dec 2015 01:05:43 +0100 Subject: LAB: Use an enum for special room ids --- engines/lab/map.cpp | 30 +++++++++++++++--------------- engines/lab/processroom.h | 24 ++++++++++++++++-------- 2 files changed, 31 insertions(+), 23 deletions(-) diff --git a/engines/lab/map.cpp b/engines/lab/map.cpp index 6bd91c197d..f7b2cfe9ea 100644 --- a/engines/lab/map.cpp +++ b/engines/lab/map.cpp @@ -90,7 +90,7 @@ void LabEngine::loadMapData() { _maps[i]._x = mapFile->readUint16LE(); _maps[i]._y = mapFile->readUint16LE(); _maps[i]._pageNumber = mapFile->readUint16LE(); - _maps[i]._specialID = mapFile->readUint16LE(); + _maps[i]._specialID = (SpecialRoom) mapFile->readUint16LE(); _maps[i]._mapFlags = mapFile->readUint32LE(); } @@ -133,18 +133,18 @@ Common::Rect LabEngine::roomCoords(uint16 curRoom) { Image *curRoomImg = nullptr; switch (_maps[curRoom]._specialID) { - case NORMAL: - case UPARROWROOM: - case DOWNARROWROOM: + case kNormalRoom: + case kUpArrowRoom: + case kDownArrowRoom: curRoomImg = _imgRoom; break; - case BRIDGEROOM: + case kBridgeRoom: curRoomImg = _imgBridge; break; - case VCORRIDOR: + case kVerticalCorridor: curRoomImg = _imgVRoom; break; - case HCORRIDOR: + case kHorizontalCorridor: curRoomImg = _imgHRoom; break; default: @@ -173,12 +173,12 @@ void LabEngine::drawRoomMap(uint16 curRoom, bool drawMarkFl) { uint32 flags = _maps[curRoom]._mapFlags; switch (_maps[curRoom]._specialID) { - case NORMAL: - case UPARROWROOM: - case DOWNARROWROOM: - if (_maps[curRoom]._specialID == NORMAL) + case kNormalRoom: + case kUpArrowRoom: + case kDownArrowRoom: + if (_maps[curRoom]._specialID == kNormalRoom) _imgRoom->drawImage(x, y); - else if (_maps[curRoom]._specialID == DOWNARROWROOM) + else if (_maps[curRoom]._specialID == kDownArrowRoom) _imgDownArrowRoom->drawImage(x, y); else _imgUpArrowRoom->drawImage(x, y); @@ -204,7 +204,7 @@ void LabEngine::drawRoomMap(uint16 curRoom, bool drawMarkFl) { break; - case BRIDGEROOM: + case kBridgeRoom: _imgBridge->drawImage(x, y); drawX = x + (_imgBridge->_width - _imgMapX[_direction]->_width) / 2; @@ -212,7 +212,7 @@ void LabEngine::drawRoomMap(uint16 curRoom, bool drawMarkFl) { break; - case VCORRIDOR: + case kVerticalCorridor: _imgVRoom->drawImage(x, y); offset = (_imgVRoom->_width - _imgPath->_width) / 2; @@ -250,7 +250,7 @@ void LabEngine::drawRoomMap(uint16 curRoom, bool drawMarkFl) { break; - case HCORRIDOR: + case kHorizontalCorridor: _imgHRoom->drawImage(x, y); offset = (_imgRoom->_width - _imgPath->_width) / 2; diff --git a/engines/lab/processroom.h b/engines/lab/processroom.h index ee8a9735f7..8ddf5ad1aa 100644 --- a/engines/lab/processroom.h +++ b/engines/lab/processroom.h @@ -119,13 +119,20 @@ enum MapDoors { kDoorBottomWest = 128 }; -// Special Map ID's -#define NORMAL 0 -#define UPARROWROOM 1 -#define DOWNARROWROOM 2 -#define BRIDGEROOM 3 -#define VCORRIDOR 4 -#define HCORRIDOR 5 +enum SpecialRoom { + kNormalRoom = 0, + kUpArrowRoom, + kDownArrowRoom, + kBridgeRoom, + kVerticalCorridor, + kHorizontalCorridor, + kMedMaze, + kHedgeMaze, + kSurMaze, + kMultiMazeF1, + kMultiMazeF2, + kMultiMazeF3 +}; #if defined(WIN32) #pragma pack(push, 1) @@ -177,7 +184,8 @@ struct InventoryData { }; struct MapData { - uint16 _x, _y, _pageNumber, _specialID; + uint16 _x, _y, _pageNumber; + SpecialRoom _specialID; uint32 _mapFlags; }; -- cgit v1.2.3