aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorFilippos Karapetis2015-12-23 22:59:59 +0200
committerFilippos Karapetis2015-12-23 22:59:59 +0200
commit70ec11d260d2adcfaaaa12d19213a6f705dde773 (patch)
tree3bb24e8bbafc1792e21467efae8f26472cf70acd /engines
parent10d9d8dee5104736da53a2807f3367b13731ad8f (diff)
downloadscummvm-rg350-70ec11d260d2adcfaaaa12d19213a6f705dde773.tar.gz
scummvm-rg350-70ec11d260d2adcfaaaa12d19213a6f705dde773.tar.bz2
scummvm-rg350-70ec11d260d2adcfaaaa12d19213a6f705dde773.zip
LAB: Change the direction and map door defines into enums
Diffstat (limited to 'engines')
-rw-r--r--engines/lab/engine.cpp18
-rw-r--r--engines/lab/lab.cpp2
-rw-r--r--engines/lab/lab.h11
-rw-r--r--engines/lab/map.cpp48
-rw-r--r--engines/lab/processroom.cpp36
-rw-r--r--engines/lab/processroom.h32
-rw-r--r--engines/lab/resource.cpp24
7 files changed, 86 insertions, 85 deletions
diff --git a/engines/lab/engine.cpp b/engines/lab/engine.cpp
index cbac66e855..0b6ac9cc3e 100644
--- a/engines/lab/engine.cpp
+++ b/engines/lab/engine.cpp
@@ -401,7 +401,7 @@ void LabEngine::mainGameLoop() {
_closeDataPtr = nullptr;
_roomNum = 1;
- _direction = NORTH;
+ _direction = kDirectionNorth;
_resource->readRoomData("LAB:Doors");
if (!(_inventory = _resource->readInventory("LAB:Inventor")))
@@ -1105,7 +1105,7 @@ void LabEngine::go() {
}
int LabEngine::followCrumbs() {
- // NORTH, SOUTH, EAST, WEST
+ // kDirectionNorth, kDirectionSouth, kDirectionEast, kDirectionWest
int movement[4][4] = {
{ VKEY_UPARROW, VKEY_RTARROW, VKEY_RTARROW, VKEY_LTARROW },
{ VKEY_RTARROW, VKEY_UPARROW, VKEY_LTARROW, VKEY_RTARROW },
@@ -1134,14 +1134,14 @@ int LabEngine::followCrumbs() {
int exitDir;
// which direction is last crumb
- if (_breadCrumbs[_numCrumbs]._direction == EAST)
- exitDir = WEST;
- else if (_breadCrumbs[_numCrumbs]._direction == WEST)
- exitDir = EAST;
- else if (_breadCrumbs[_numCrumbs]._direction == NORTH)
- exitDir = SOUTH;
+ if (_breadCrumbs[_numCrumbs]._direction == kDirectionEast)
+ exitDir = kDirectionWest;
+ else if (_breadCrumbs[_numCrumbs]._direction == kDirectionWest)
+ exitDir = kDirectionEast;
+ else if (_breadCrumbs[_numCrumbs]._direction == kDirectionNorth)
+ exitDir = kDirectionSouth;
else
- exitDir = NORTH;
+ exitDir = kDirectionNorth;
int moveDir = movement[_direction][exitDir];
diff --git a/engines/lab/lab.cpp b/engines/lab/lab.cpp
index a1fd4f5c94..ded0e63bdf 100644
--- a/engines/lab/lab.cpp
+++ b/engines/lab/lab.cpp
@@ -56,7 +56,7 @@ LabEngine::LabEngine(OSystem *syst, const ADGameDescription *gameDesc)
_roomNum = -1;
for (int i = 0; i < MAX_CRUMBS; i++) {
_breadCrumbs[i]._roomNum = 0;
- _breadCrumbs[i]._direction = NORTH;
+ _breadCrumbs[i]._direction = kDirectionNorth;
}
_numCrumbs = 0;
diff --git a/engines/lab/lab.h b/engines/lab/lab.h
index 200dd000cb..752cbab0a3 100644
--- a/engines/lab/lab.h
+++ b/engines/lab/lab.h
@@ -90,11 +90,12 @@ struct CrumbData {
typedef CloseData *CloseDataPtr;
typedef Common::List<Rule> RuleList;
-// Direction defines
-#define NORTH 0
-#define SOUTH 1
-#define EAST 2
-#define WEST 3
+enum Direction {
+ kDirectionNorth,
+ kDirectionSouth,
+ kDirectionEast,
+ kDirectionWest
+};
class LabEngine : public Engine {
private:
diff --git a/engines/lab/map.cpp b/engines/lab/map.cpp
index e06fefdd92..082925a3fc 100644
--- a/engines/lab/map.cpp
+++ b/engines/lab/map.cpp
@@ -68,10 +68,10 @@ void LabEngine::loadMapData() {
_imgMaze = new Image(mapImages, this);
_imgHugeMaze = new Image(mapImages, this);
- _imgMapX[NORTH] = new Image(mapImages, this);
- _imgMapX[EAST] = new Image(mapImages, this);
- _imgMapX[SOUTH] = new Image(mapImages, this);
- _imgMapX[WEST] = new Image(mapImages, this);
+ _imgMapX[kDirectionNorth] = new Image(mapImages, this);
+ _imgMapX[kDirectionEast] = new Image(mapImages, this);
+ _imgMapX[kDirectionSouth] = new Image(mapImages, this);
+ _imgMapX[kDirectionWest] = new Image(mapImages, this);
_imgPath = new Image(mapImages, this);
_imgBridge = new Image(mapImages, this);
@@ -187,18 +187,18 @@ void LabEngine::drawRoomMap(uint16 curRoom, bool drawMarkFl) {
offset = (_imgRoom->_width - _imgPath->_width) / 2;
- if ((NORTHDOOR & flags) && (y >= _imgPath->_height))
+ if ((kDoorLeftNorth & flags) && (y >= _imgPath->_height))
_imgPath->drawImage(x + offset, y - _imgPath->_height);
- if (SOUTHDOOR & flags)
+ if (kDoorLeftSouth & flags)
_imgPath->drawImage(x + offset, y + _imgRoom->_height);
offset = (_imgRoom->_height - _imgPath->_height) / 2;
- if (EASTDOOR & flags)
+ if (kDoorLeftEast & flags)
_imgPath->drawImage(x + _imgRoom->_width, y + offset);
- if (WESTDOOR & flags)
+ if (kDoorLeftWest & flags)
_imgPath->drawImage(x - _imgPath->_width, y + offset);
drawX = x + (_imgRoom->_width - _imgMapX[_direction]->_width) / 2;
@@ -219,32 +219,32 @@ void LabEngine::drawRoomMap(uint16 curRoom, bool drawMarkFl) {
offset = (_imgVRoom->_width - _imgPath->_width) / 2;
- if (NORTHDOOR & flags)
+ if (kDoorLeftNorth & flags)
_imgPath->drawImage(x + offset, y - _imgPath->_height);
- if (SOUTHDOOR & flags)
+ if (kDoorLeftSouth & flags)
_imgPath->drawImage(x + offset, y + _imgVRoom->_height);
offset = (_imgRoom->_height - _imgPath->_height) / 2;
- if (EASTDOOR & flags)
+ if (kDoorLeftEast & flags)
_imgPath->drawImage(x + _imgVRoom->_width, y + offset);
- if (WESTDOOR & flags)
+ if (kDoorLeftWest & flags)
_imgPath->drawImage(x - _imgPath->_width, y + offset);
- if (EASTBDOOR & flags)
+ if (kDoorBottomEast & flags)
_imgPath->drawImage(x + _imgVRoom->_width, y - offset - _imgPath->_height + _imgVRoom->_height);
- if (WESTBDOOR & flags)
+ if (kDoorBottomWest & flags)
_imgPath->drawImage(x - _imgPath->_width, y - offset - _imgPath->_height + _imgVRoom->_height);
offset = (_imgVRoom->_height - _imgPath->_height) / 2;
- if (EASTMDOOR & flags)
+ if (kDoorMiddleEast & flags)
_imgPath->drawImage(x + _imgVRoom->_width, y - offset - _imgPath->_height + _imgVRoom->_height);
- if (WESTMDOOR & flags)
+ if (kDoorMiddleWest & flags)
_imgPath->drawImage(x - _imgPath->_width, y - offset - _imgPath->_height + _imgVRoom->_height);
drawX = x + (_imgVRoom->_width - _imgMapX[_direction]->_width) / 2;
@@ -257,32 +257,32 @@ void LabEngine::drawRoomMap(uint16 curRoom, bool drawMarkFl) {
offset = (_imgRoom->_width - _imgPath->_width) / 2;
- if (NORTHDOOR & flags)
+ if (kDoorLeftNorth & flags)
_imgPath->drawImage(x + offset, y - _imgPath->_height);
- if (SOUTHDOOR & flags)
+ if (kDoorLeftSouth & flags)
_imgPath->drawImage(x + offset, y + _imgRoom->_height);
- if (NORTHRDOOR & flags)
+ if (kDoorRightNorth & flags)
_imgPath->drawImage(x - offset - _imgPath->_width + _imgHRoom->_width, y - _imgPath->_height);
- if (SOUTHRDOOR & flags)
+ if (kDoorRightSouth & flags)
_imgPath->drawImage(x - offset - _imgPath->_width + _imgHRoom->_width, y + _imgRoom->_height);
offset = (_imgHRoom->_width - _imgPath->_width) / 2;
- if (NORTHMDOOR & flags)
+ if (kDoorMiddleNorth & flags)
_imgPath->drawImage(x - offset - _imgPath->_width + _imgHRoom->_width, y - _imgPath->_height);
- if (SOUTHMDOOR & flags)
+ if (kDoorMiddleSouth & flags)
_imgPath->drawImage(x - offset - _imgPath->_width + _imgHRoom->_width, y + _imgRoom->_height);
offset = (_imgRoom->_height - _imgPath->_height) / 2;
- if (EASTDOOR & flags)
+ if (kDoorLeftEast & flags)
_imgPath->drawImage(x + _imgHRoom->_width, y + offset);
- if (WESTDOOR & flags)
+ if (kDoorLeftWest & flags)
_imgPath->drawImage(x - _imgPath->_width, y + offset);
drawX = x + (_imgHRoom->_width - _imgMapX[_direction]->_width) / 2;
diff --git a/engines/lab/processroom.cpp b/engines/lab/processroom.cpp
index ad8db8499f..7f0c472684 100644
--- a/engines/lab/processroom.cpp
+++ b/engines/lab/processroom.cpp
@@ -141,13 +141,13 @@ void LabEngine::drawDirection(CloseDataPtr closePtr) {
if (!_rooms[_roomNum]._roomMsg.empty())
message = _rooms[_roomNum]._roomMsg + ", ";
- if (_direction == NORTH)
+ if (_direction == kDirectionNorth)
message += _resource->getStaticText(kTextFacingNorth);
- else if (_direction == EAST)
+ else if (_direction == kDirectionEast)
message += _resource->getStaticText(kTextFacingEast);
- else if (_direction == SOUTH)
+ else if (_direction == kDirectionSouth)
message += _resource->getStaticText(kTextFacingSouth);
- else if (_direction == WEST)
+ else if (_direction == kDirectionWest)
message += _resource->getStaticText(kTextFacingWest);
_graphics->drawMessage(message, false);
@@ -161,23 +161,23 @@ uint16 LabEngine::processArrow(uint16 curDirection, uint16 arrow) {
return curDirection;
} else if (arrow == 0) { // Left
- if (curDirection == NORTH)
- return WEST;
- else if (curDirection == WEST)
- return SOUTH;
- else if (curDirection == SOUTH)
- return EAST;
+ if (curDirection == kDirectionNorth)
+ return kDirectionWest;
+ else if (curDirection == kDirectionWest)
+ return kDirectionSouth;
+ else if (curDirection == kDirectionSouth)
+ return kDirectionEast;
else
- return NORTH;
+ return kDirectionNorth;
} else if (arrow == 2) { // Right
- if (curDirection == NORTH)
- return EAST;
- else if (curDirection == EAST)
- return SOUTH;
- else if (curDirection == SOUTH)
- return WEST;
+ if (curDirection == kDirectionNorth)
+ return kDirectionEast;
+ else if (curDirection == kDirectionEast)
+ return kDirectionSouth;
+ else if (curDirection == kDirectionSouth)
+ return kDirectionWest;
else
- return NORTH;
+ return kDirectionNorth;
}
// Should never reach here!
diff --git a/engines/lab/processroom.h b/engines/lab/processroom.h
index 3726435390..66111b3a04 100644
--- a/engines/lab/processroom.h
+++ b/engines/lab/processroom.h
@@ -145,22 +145,22 @@ struct InventoryData {
// Map Flags
-// Where the doors are; in a corridor, assumed to be left doors
-#define NORTHDOOR 1
-#define EASTDOOR 2
-#define SOUTHDOOR 4
-#define WESTDOOR 8
-
-// Where the doors are in corridors; M means middle, R means right, B means bottom
-#define NORTHMDOOR 16
-#define NORTHRDOOR 32
-#define SOUTHMDOOR 64
-#define SOUTHRDOOR 128
-
-#define EASTMDOOR 16
-#define EASTBDOOR 32
-#define WESTMDOOR 64
-#define WESTBDOOR 128
+enum MapDoors {
+ kDoorLeftNorth = 1,
+ kDoorLeftEast = 2,
+ kDoorLeftSouth = 4,
+ kDoorLeftWest = 8,
+
+ kDoorMiddleNorth = 16,
+ kDoorRightNorth = 32,
+ kDoorMiddleSouth = 64,
+ kDoorRightSouth = 128,
+
+ kDoorMiddleEast = 16,
+ kDoorBottomEast = 32,
+ kDoorMiddleWest = 64,
+ kDoorBottomWest = 128
+};
// Special Map ID's
#define NORMAL 0
diff --git a/engines/lab/resource.cpp b/engines/lab/resource.cpp
index b9239a2068..d1c915f6c2 100644
--- a/engines/lab/resource.cpp
+++ b/engines/lab/resource.cpp
@@ -104,16 +104,16 @@ void Resource::readRoomData(const Common::String fileName) {
for (int i = 1; i <= _vm->_manyRooms; i++) {
RoomData *curRoom = &_vm->_rooms[i];
- curRoom->_doors[NORTH] = dataFile->readUint16LE();
- curRoom->_doors[SOUTH] = dataFile->readUint16LE();
- curRoom->_doors[EAST] = dataFile->readUint16LE();
- curRoom->_doors[WEST] = dataFile->readUint16LE();
+ curRoom->_doors[kDirectionNorth] = dataFile->readUint16LE();
+ curRoom->_doors[kDirectionSouth] = dataFile->readUint16LE();
+ curRoom->_doors[kDirectionEast] = dataFile->readUint16LE();
+ curRoom->_doors[kDirectionWest] = dataFile->readUint16LE();
curRoom->_transitionType = dataFile->readByte();
- curRoom->_view[NORTH] = nullptr;
- curRoom->_view[SOUTH] = nullptr;
- curRoom->_view[EAST] = nullptr;
- curRoom->_view[WEST] = nullptr;
+ curRoom->_view[kDirectionNorth] = nullptr;
+ curRoom->_view[kDirectionSouth] = nullptr;
+ curRoom->_view[kDirectionEast] = nullptr;
+ curRoom->_view[kDirectionWest] = nullptr;
curRoom->_rules = nullptr;
curRoom->_roomMsg = "";
}
@@ -145,10 +145,10 @@ void Resource::readViews(uint16 roomNum) {
RoomData *curRoom = &_vm->_rooms[roomNum];
curRoom->_roomMsg = readString(dataFile);
- curRoom->_view[NORTH] = readView(dataFile);
- curRoom->_view[SOUTH] = readView(dataFile);
- curRoom->_view[EAST] = readView(dataFile);
- curRoom->_view[WEST] = readView(dataFile);
+ curRoom->_view[kDirectionNorth] = readView(dataFile);
+ curRoom->_view[kDirectionSouth] = readView(dataFile);
+ curRoom->_view[kDirectionEast] = readView(dataFile);
+ curRoom->_view[kDirectionWest] = readView(dataFile);
curRoom->_rules = readRule(dataFile);
_vm->updateMusicAndEvents();