aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStrangerke2016-08-09 22:58:23 +0200
committerBendegúz Nagy2016-08-26 23:02:22 +0200
commit69c5b01e127c5f2c63469ea04fcb51fc6dd0ee37 (patch)
tree3a21ed64d4e2946aa861ad2a11cad87a8d009f48
parent6885cf6e593d1739ae2e864d3f568bb5ccb77222 (diff)
downloadscummvm-rg350-69c5b01e127c5f2c63469ea04fcb51fc6dd0ee37.tar.gz
scummvm-rg350-69c5b01e127c5f2c63469ea04fcb51fc6dd0ee37.tar.bz2
scummvm-rg350-69c5b01e127c5f2c63469ea04fcb51fc6dd0ee37.zip
DM: Refactor f155_getStairsExitDirection
-rw-r--r--engines/dm/dungeonman.cpp13
1 files changed, 8 insertions, 5 deletions
diff --git a/engines/dm/dungeonman.cpp b/engines/dm/dungeonman.cpp
index 8816ed7d71..0da7ccd310 100644
--- a/engines/dm/dungeonman.cpp
+++ b/engines/dm/dungeonman.cpp
@@ -1568,19 +1568,22 @@ void DungeonMan::f164_unlinkThingFromList(Thing thingToUnlink, Thing thingInList
}
int16 DungeonMan::f155_getStairsExitDirection(int16 mapX, int16 mapY) {
- int16 L0256_i_SquareType;
- bool L0257_B_NorthSouthOrientedStairs;
+ bool northSouthOrientedStairs = !getFlag(f151_getSquare(mapX, mapY).toByte(), k0x0008_StairsNorthSouthOrient);
-
- if (L0257_B_NorthSouthOrientedStairs = !getFlag(f151_getSquare(mapX, mapY).toByte(), k0x0008_StairsNorthSouthOrient)) {
+ if (northSouthOrientedStairs) {
mapX = mapX + _vm->_dirIntoStepCountEast[kDirEast];
mapY = mapY + _vm->_dirIntoStepCountNorth[kDirEast];
} else {
mapX = mapX + _vm->_dirIntoStepCountEast[kDirNorth];
mapY = mapY + _vm->_dirIntoStepCountNorth[kDirNorth];
}
- return ((((L0256_i_SquareType = Square(f151_getSquare(mapX, mapY)).getType()) == k0_ElementTypeWall) || (L0256_i_SquareType == k3_ElementTypeStairs)) << 1) + L0257_B_NorthSouthOrientedStairs;
+ int16 squareType = Square(f151_getSquare(mapX, mapY)).getType();
+
+ int16 retval = ((squareType == k0_ElementTypeWall) || (squareType == k3_ElementTypeStairs)) ? 1 : 0;
+ retval <<= 1;
+ retval += (northSouthOrientedStairs ? 1 : 0);
+ return retval;
}
Thing DungeonMan::f167_getObjForProjectileLaucherOrObjGen(uint16 iconIndex) {