diff options
Diffstat (limited to 'engines')
-rw-r--r-- | engines/dm/champion.cpp | 4 | ||||
-rw-r--r-- | engines/dm/champion.h | 1 | ||||
-rw-r--r-- | engines/dm/dm.cpp | 6 | ||||
-rw-r--r-- | engines/dm/dm.h | 3 | ||||
-rw-r--r-- | engines/dm/dungeonman.cpp | 102 | ||||
-rw-r--r-- | engines/dm/dungeonman.h | 63 | ||||
-rw-r--r-- | engines/dm/eventman.cpp | 16 | ||||
-rw-r--r-- | engines/dm/gfx.cpp | 64 | ||||
-rw-r--r-- | engines/dm/group.cpp | 32 | ||||
-rw-r--r-- | engines/dm/inventory.cpp | 2 | ||||
-rw-r--r-- | engines/dm/menus.cpp | 4 | ||||
-rw-r--r-- | engines/dm/movesens.cpp | 22 | ||||
-rw-r--r-- | engines/dm/projexpl.cpp | 24 | ||||
-rw-r--r-- | engines/dm/timeline.cpp | 18 |
14 files changed, 173 insertions, 188 deletions
diff --git a/engines/dm/champion.cpp b/engines/dm/champion.cpp index fc3131f885..27dca5af38 100644 --- a/engines/dm/champion.cpp +++ b/engines/dm/champion.cpp @@ -1468,7 +1468,7 @@ void ChampionMan::championKill(uint16 champIndex) { _vm->_inventoryMan->toggleInventory(kDMChampionCloseInventory); } dropAllObjects(champIndex); - Thing unusedThing = _vm->_dungeonMan->getUnusedThing(k0x8000_championBones | kDMThingTypeJunk); + Thing unusedThing = _vm->_dungeonMan->getUnusedThing(kDMMaskChampionBones | kDMThingTypeJunk); uint16 curCell = 0; if (unusedThing != Thing::_none) { Junk *L0966_ps_Junk = (Junk *)_vm->_dungeonMan->getThingData(unusedThing); @@ -1898,7 +1898,7 @@ void ChampionMan::addCandidateChampionToParty(uint16 championPortraitIndex) { char L0807_ac_DecodedChampionText[77]; char *decodedStringPtr = L0807_ac_DecodedChampionText; - _vm->_dungeonMan->decodeText(decodedStringPtr, curThing, (TextType)(kDMTextTypeScroll | k0x8000_DecodeEvenIfInvisible)); + _vm->_dungeonMan->decodeText(decodedStringPtr, curThing, (TextType)(kDMTextTypeScroll | kDMMaskDecodeEvenIfInvisible)); uint16 charIdx = 0; char tmpChar; diff --git a/engines/dm/champion.h b/engines/dm/champion.h index 2eb4d28299..fe565123fa 100644 --- a/engines/dm/champion.h +++ b/engines/dm/champion.h @@ -387,7 +387,6 @@ enum SpellType { #define kDMMaskNoSharpDefense 0x0000 // @ MASK0x0000_DO_NOT_USE_SHARP_DEFENSE #define kDMMaskSharpDefense 0x8000 // @ MASK0x8000_USE_SHARP_DEFENSE -#define kDMMaskMergeCycles 0x8000 // @ MASK0x8000_MERGE_CYCLES class Skill { public: diff --git a/engines/dm/dm.cpp b/engines/dm/dm.cpp index 1eefd01399..d45673ec46 100644 --- a/engines/dm/dm.cpp +++ b/engines/dm/dm.cpp @@ -754,9 +754,9 @@ void DMEngine::drawEntrance() { for (int16 idx = 0; idx < 5; idx++) { microDungeonCurrentMapData[idx] = (byte*)µDungeonSquares[idx * 5]; - microDungeonSquares[idx + 10] = Square(k1_CorridorElemType, 0); + microDungeonSquares[idx + 10] = Square(kDMElementTypeCorridor, 0); } - microDungeonSquares[7] = Square(k1_CorridorElemType, 0); + microDungeonSquares[7] = Square(kDMElementTypeCorridor, 0); _displayMan->startEndFadeToPalette(_displayMan->_blankBuffer); // note, a global variable is used here in the original @@ -986,7 +986,7 @@ void DMEngine::fuseSequence() { while (textStringThingCount--) { for (int16 idx = 0; idx < maxCount; idx++) { char decodedString[200]; - _dungeonMan->decodeText(decodedString, textStringThings[idx], (TextType)(kDMTextTypeMessage | k0x8000_DecodeEvenIfInvisible)); + _dungeonMan->decodeText(decodedString, textStringThings[idx], (TextType)(kDMTextTypeMessage | kDMMaskDecodeEvenIfInvisible)); if (decodedString[1] == textFirstChar) { _textMan->clearAllRows(); decodedString[1] = '\n'; /* New line */ diff --git a/engines/dm/dm.h b/engines/dm/dm.h index 6dfc2d4f97..0a73c05ff0 100644 --- a/engines/dm/dm.h +++ b/engines/dm/dm.h @@ -145,6 +145,9 @@ enum MapIndice { kDMMapIndexEntrance = 255 // @ C255_MAP_INDEX_ENTRANCE }; +#define kDMMaskDecodeEvenIfInvisible 0x8000 // @ MASK0x8000_DECODE_EVEN_IF_INVISIBLE +#define kDMMaskMergeCycles 0x8000 // @ MASK0x8000_MERGE_CYCLES + struct DMADGameDescription { ADGameDescription _desc; diff --git a/engines/dm/dungeonman.cpp b/engines/dm/dungeonman.cpp index 6dc5a73048..f6cd250f6d 100644 --- a/engines/dm/dungeonman.cpp +++ b/engines/dm/dungeonman.cpp @@ -801,21 +801,21 @@ Square DungeonMan::getSquare(int16 mapX, int16 mapY) { return Square(_currMapData[mapX][mapY]); if (isMapYInBounds) { - SquareType squareType = Square(_currMapData[0][mapY]).getType(); - if (((mapX == -1) && (squareType == k1_CorridorElemType)) || (squareType == k2_PitElemType)) - return Square(kDMElementTypeWall, k0x0004_WallEastRandOrnAllowed); + ElementType squareType = Square(_currMapData[0][mapY]).getType(); + if (((mapX == -1) && (squareType == kDMElementTypeCorridor)) || (squareType == kDMElementTypePit)) + return Square(kDMElementTypeWall, kDMSquareMaskWallEastRandOrnament); squareType = Square(_currMapData[_currMapWidth - 1][mapY]).getType(); - if (((mapX == _currMapWidth) && (squareType == k1_CorridorElemType)) || (squareType == k2_PitElemType)) - return Square(kDMElementTypeWall, k0x0001_WallWestRandOrnAllowed); + if (((mapX == _currMapWidth) && (squareType == kDMElementTypeCorridor)) || (squareType == kDMElementTypePit)) + return Square(kDMElementTypeWall, kDMSquareMaskWallWestRandOrnament); } else if (isMapXInBounds) { - SquareType squareType = Square(_currMapData[mapX][0]).getType(); - if (((mapY == -1) && (squareType == k1_CorridorElemType)) || (squareType == k2_PitElemType)) - return Square(kDMElementTypeWall, k0x0002_WallSouthRandOrnAllowed); + ElementType squareType = Square(_currMapData[mapX][0]).getType(); + if (((mapY == -1) && (squareType == kDMElementTypeCorridor)) || (squareType == kDMElementTypePit)) + return Square(kDMElementTypeWall, kDMSquareMaslWallSouthRandOrnament); squareType = Square(_currMapData[mapX][_currMapHeight - 1]).getType(); - if (((mapY == _currMapHeight) && (squareType == k1_CorridorElemType)) || (squareType == k2_PitElemType)) - return Square(kDMElementTypeWall, k0x0008_WallNorthRandOrnAllowed); + if (((mapY == _currMapHeight) && (squareType == kDMElementTypeCorridor)) || (squareType == kDMElementTypePit)) + return Square(kDMElementTypeWall, kDMSquareMaskWallNorthRandOrnament); } return Square(kDMElementTypeWall, 0); } @@ -827,13 +827,13 @@ Square DungeonMan::getRelSquare(Direction dir, int16 stepsForward, int16 stepsRi int16 DungeonMan::getSquareFirstThingIndex(int16 mapX, int16 mapY) { unsigned char *curSquare = _currMapData[mapX]; - if ((mapX < 0) || (mapX >= _currMapWidth) || (mapY < 0) || (mapY >= _currMapHeight) || !getFlag(curSquare[mapY], k0x0010_ThingListPresent)) + if ((mapX < 0) || (mapX >= _currMapWidth) || (mapY < 0) || (mapY >= _currMapHeight) || !getFlag(curSquare[mapY], kDMSquareMaskThingListPresent)) return -1; int16 curMapY = 0; uint16 thingIndex = _currMapColCumulativeSquareFirstThingCount[mapX]; while (curMapY++ != mapY) { - if (getFlag(*curSquare++, k0x0010_ThingListPresent)) + if (getFlag(*curSquare++, kDMSquareMaskThingListPresent)) thingIndex++; } return thingIndex; @@ -867,24 +867,24 @@ void DungeonMan::setSquareAspect(uint16 *aspectArray, Direction dir, int16 mapX, case kDMElementTypeWall: switch (dir) { case kDMDirNorth: - leftRandomWallOrnamentAllowed = getFlag(AL0307_uc_Square, k0x0004_WallEastRandOrnAllowed); - frontRandomWallOrnamentAllowed = getFlag(AL0307_uc_Square, k0x0002_WallSouthRandOrnAllowed); - rightRandomWallOrnamentAllowed = getFlag(AL0307_uc_Square, k0x0001_WallWestRandOrnAllowed); + leftRandomWallOrnamentAllowed = getFlag(AL0307_uc_Square, kDMSquareMaskWallEastRandOrnament); + frontRandomWallOrnamentAllowed = getFlag(AL0307_uc_Square, kDMSquareMaslWallSouthRandOrnament); + rightRandomWallOrnamentAllowed = getFlag(AL0307_uc_Square, kDMSquareMaskWallWestRandOrnament); break; case kDMDirEast: - leftRandomWallOrnamentAllowed = getFlag(AL0307_uc_Square, k0x0002_WallSouthRandOrnAllowed); - frontRandomWallOrnamentAllowed = getFlag(AL0307_uc_Square, k0x0001_WallWestRandOrnAllowed); - rightRandomWallOrnamentAllowed = getFlag(AL0307_uc_Square, k0x0008_WallNorthRandOrnAllowed); + leftRandomWallOrnamentAllowed = getFlag(AL0307_uc_Square, kDMSquareMaslWallSouthRandOrnament); + frontRandomWallOrnamentAllowed = getFlag(AL0307_uc_Square, kDMSquareMaskWallWestRandOrnament); + rightRandomWallOrnamentAllowed = getFlag(AL0307_uc_Square, kDMSquareMaskWallNorthRandOrnament); break; case kDMDirSouth: - leftRandomWallOrnamentAllowed = getFlag(AL0307_uc_Square, k0x0001_WallWestRandOrnAllowed); - frontRandomWallOrnamentAllowed = getFlag(AL0307_uc_Square, k0x0008_WallNorthRandOrnAllowed); - rightRandomWallOrnamentAllowed = getFlag(AL0307_uc_Square, k0x0004_WallEastRandOrnAllowed); + leftRandomWallOrnamentAllowed = getFlag(AL0307_uc_Square, kDMSquareMaskWallWestRandOrnament); + frontRandomWallOrnamentAllowed = getFlag(AL0307_uc_Square, kDMSquareMaskWallNorthRandOrnament); + rightRandomWallOrnamentAllowed = getFlag(AL0307_uc_Square, kDMSquareMaskWallEastRandOrnament); break; case kDMDirWest: - leftRandomWallOrnamentAllowed = getFlag(AL0307_uc_Square, k0x0008_WallNorthRandOrnAllowed); - frontRandomWallOrnamentAllowed = getFlag(AL0307_uc_Square, k0x0004_WallEastRandOrnAllowed); - rightRandomWallOrnamentAllowed = getFlag(AL0307_uc_Square, k0x0002_WallSouthRandOrnAllowed); + leftRandomWallOrnamentAllowed = getFlag(AL0307_uc_Square, kDMSquareMaskWallNorthRandOrnament); + frontRandomWallOrnamentAllowed = getFlag(AL0307_uc_Square, kDMSquareMaskWallEastRandOrnament); + rightRandomWallOrnamentAllowed = getFlag(AL0307_uc_Square, kDMSquareMaslWallSouthRandOrnament); break; default: assert(false); @@ -918,31 +918,31 @@ T0172010_ClosedFakeWall: } break; case kDMElementTypeFakeWall: - if (!getFlag(AL0307_uc_Square, k0x0004_FakeWallOpen)) { + if (!getFlag(AL0307_uc_Square, kDMSquareMaskFakeWallOpen)) { aspectArray[kDMSquareAspectElement] = kDMElementTypeWall; - leftRandomWallOrnamentAllowed = rightRandomWallOrnamentAllowed = frontRandomWallOrnamentAllowed = getFlag(AL0307_uc_Square, k0x0008_FakeWallRandOrnOrFootPAllowed); + leftRandomWallOrnamentAllowed = rightRandomWallOrnamentAllowed = frontRandomWallOrnamentAllowed = getFlag(AL0307_uc_Square, kDMSquareMaskFakeWallRandOrnamentOrFootprintsAllowed); squareIsFakeWall = true; goto T0172010_ClosedFakeWall; } - aspectArray[kDMSquareAspectElement] = k1_CorridorElemType; - AL0307_uc_FootprintsAllowed = getFlag(AL0307_uc_Square, k0x0008_FakeWallRandOrnOrFootPAllowed) ? 8 : 0; + aspectArray[kDMSquareAspectElement] = kDMElementTypeCorridor; + AL0307_uc_FootprintsAllowed = getFlag(AL0307_uc_Square, kDMSquareMaskFakeWallRandOrnamentOrFootprintsAllowed) ? 8 : 0; // No break on purpose - case k1_CorridorElemType: + case kDMElementTypeCorridor: case kDMElementTypePit: case kDMElementTypeTeleporter: - if (aspectArray[kDMSquareAspectElement] == k1_CorridorElemType) { - aspectArray[kDMSquareAspectFloorOrn] = getRandomOrnOrdinal(getFlag(AL0307_uc_Square, k0x0008_CorridorRandOrnAllowed), _currMap->_randFloorOrnCount, mapX, mapY, 30); + if (aspectArray[kDMSquareAspectElement] == kDMElementTypeCorridor) { + aspectArray[kDMSquareAspectFloorOrn] = getRandomOrnOrdinal(getFlag(AL0307_uc_Square, kDMSquareMaskCorridorRandOrnament), _currMap->_randFloorOrnCount, mapX, mapY, 30); AL0307_uc_FootprintsAllowed = true; } else if (aspectArray[kDMSquareAspectElement] == kDMElementTypePit) { - if (getFlag(AL0307_uc_Square, k0x0008_PitOpen)) { - aspectArray[kDMSquareAspectPitInvisible] = getFlag(AL0307_uc_Square, k0x0004_PitInvisible); + if (getFlag(AL0307_uc_Square, kDMSquareMaskPitOpen)) { + aspectArray[kDMSquareAspectPitInvisible] = getFlag(AL0307_uc_Square, kDMSquareMaskPitInvisible); AL0307_uc_FootprintsAllowed &= 0x0001; } else { - aspectArray[kDMSquareAspectElement] = k1_CorridorElemType; + aspectArray[kDMSquareAspectElement] = kDMElementTypeCorridor; AL0307_uc_FootprintsAllowed = true; } } else { // k5_ElementTypeTeleporter - aspectArray[kDMSquareAspectTeleporterVisible] = getFlag(AL0307_uc_Square, k0x0008_TeleporterOpen) && getFlag(AL0307_uc_Square, k0x0004_TeleporterVisible); + aspectArray[kDMSquareAspectTeleporterVisible] = getFlag(AL0307_uc_Square, kDMSquareMaskTeleporterOpen) && getFlag(AL0307_uc_Square, kDMSquareMaskTeleporterVisible); AL0307_uc_FootprintsAllowed = true; } @@ -960,17 +960,17 @@ T0172010_ClosedFakeWall: break; case kDMElementTypeStairs: - aspectArray[kDMSquareAspectElement] = (bool((getFlag(AL0307_uc_Square, k0x0008_StairsNorthSouthOrient) >> 3)) == _vm->isOrientedWestEast(dir)) ? kDMElementTypeStairsSide : kDMElementTypeStairsFront; - aspectArray[kDMSquareAspectStairsUp] = getFlag(AL0307_uc_Square, k0x0004_StairsUp); + aspectArray[kDMSquareAspectElement] = (bool((getFlag(AL0307_uc_Square, kDMSquareMaskStairsNorthSouth) >> 3)) == _vm->isOrientedWestEast(dir)) ? kDMElementTypeStairsSide : kDMElementTypeStairsFront; + aspectArray[kDMSquareAspectStairsUp] = getFlag(AL0307_uc_Square, kDMSquareMaskStairsUp); AL0307_uc_FootprintsAllowed = false; while ((curThing != Thing::_endOfList) && (curThing.getType() <= kDMThingTypeSensor)) curThing = getNextThing(curThing); break; - case k4_DoorElemType: - if (bool((getFlag(AL0307_uc_Square, (byte) k0x0008_DoorNorthSouthOrient) >> 3)) == _vm->isOrientedWestEast(dir)) { - aspectArray[kDMSquareAspectElement] = k16_DoorSideElemType; + case kDMElementTypeDoor: + if (bool((getFlag(AL0307_uc_Square, (byte) kDMSquareMaskDoorNorthSouth) >> 3)) == _vm->isOrientedWestEast(dir)) { + aspectArray[kDMSquareAspectElement] = kDMElementTypeDoorSide; } else { - aspectArray[kDMSquareAspectElement] = k17_DoorFrontElemType; + aspectArray[kDMSquareAspectElement] = kDMElementTypeDoorFront; aspectArray[kDMSquareAspectDoorState] = Square(AL0307_uc_Square).getDoorState(); aspectArray[kDMSquareAspectDoorThingIndex] = getSquareFirstThing(mapX, mapY).getIndex(); } @@ -1118,8 +1118,8 @@ void DungeonMan::decodeText(char *destString, Thing thing, TextType type) { }; TextString textString(_thingData[kDMstringTypeText] + thing.getIndex() * _thingDataWordCount[kDMstringTypeText]); - if ((textString.isVisible()) || (type & k0x8000_DecodeEvenIfInvisible)) { - type = (TextType)(type & ~k0x8000_DecodeEvenIfInvisible); + if ((textString.isVisible()) || (type & kDMMaskDecodeEvenIfInvisible)) { + type = (TextType)(type & ~kDMMaskDecodeEvenIfInvisible); char sepChar; if (type == kDMTextTypeMessage) { *destString++ = '\n'; @@ -1181,8 +1181,8 @@ void DungeonMan::decodeText(char *destString, Thing thing, TextType type) { } Thing DungeonMan::getUnusedThing(uint16 thingType) { - int16 thingCount = _dungeonFileHeader._thingCounts[getFlag(thingType, k0x7FFF_thingType)]; - if (thingType == (k0x8000_championBones | kDMThingTypeJunk)) { + int16 thingCount = _dungeonFileHeader._thingCounts[getFlag(thingType, kDMMaskThingType)]; + if (thingType == (kDMMaskChampionBones | kDMThingTypeJunk)) { thingType = kDMThingTypeJunk; } else if (thingType == kDMThingTypeJunk) thingCount -= 3; /* Always keep 3 unused JUNK things for the bones of dead champions */ @@ -1314,10 +1314,10 @@ void DungeonMan::linkThingToList(Thing thingToLink, Thing thingInList, int16 map /* If mapX >= 0 then the thing is linked to the list of things on the specified square else it is linked at the end of the specified thing list */ if (mapX >= 0) { byte *currSquare = &_currMapData[mapX][mapY]; - if (getFlag(*currSquare, k0x0010_ThingListPresent)) { + if (getFlag(*currSquare, kDMSquareMaskThingListPresent)) { thingInList = getSquareFirstThing(mapX, mapY); } else { - setFlag(*currSquare, k0x0010_ThingListPresent); + setFlag(*currSquare, kDMSquareMaskThingListPresent); uint16 *tmp = _currMapColCumulativeSquareFirstThingCount + mapX + 1; uint16 currColumn = _dungeonColumCount - (_dungeonMapsFirstColumnIndex[_currMapIndex] + mapX) - 1; while (currColumn--) { /* For each column starting from and after the column containing the square where the thing is added */ @@ -1327,7 +1327,7 @@ void DungeonMan::linkThingToList(Thing thingToLink, Thing thingInList, int16 map currSquare -= mapY; uint16 currSquareFirstThingIndex = _currMapColCumulativeSquareFirstThingCount[mapX]; while (currMapY++ != mapY) { - if (getFlag(*currSquare++, k0x0010_ThingListPresent)) + if (getFlag(*currSquare++, kDMSquareMaskThingListPresent)) currSquareFirstThingIndex++; } Thing *currThing = &_squareFirstThings[currSquareFirstThingIndex]; @@ -1435,7 +1435,7 @@ Thing DungeonMan::getDiscardThing(uint16 thingType) { for (int16 currMapX = 0; currMapX <= mapWidth; currMapX++) { for (int16 currMapY = 0; currMapY <= mapHeight; currMapY++) { - if (getFlag(*currSquare++, k0x0010_ThingListPresent)) { + if (getFlag(*currSquare++, kDMSquareMaskThingListPresent)) { Thing squareThing = *squareFirstThing++; if ((mapIndex == _partyMapIndex) && ((currMapX - _partyMapX + 5) <= 10) && ((currMapY - _partyMapY + 5) <= 10)) /* If square is too close to the party */ continue; @@ -1559,7 +1559,7 @@ void DungeonMan::unlinkThingFromList(Thing thingToUnlink, Thing thingInList, int uint16 firstThingIndex = getSquareFirstThingIndex(mapX, mapY); Thing *currThing = &_squareFirstThings[firstThingIndex]; /* BUG0_01 Coding error without consequence. The engine does not check that there are things at the specified square coordinates. f160_getSquareFirstThingIndex would return -1 for an empty square. No consequence as the function is never called with the coordinates of an empty square (except in the case of BUG0_59) */ if ((*thingPtr == Thing::_endOfList) && (((Thing *)currThing)->getTypeAndIndex() == thingToUnlink.toUint16())) { /* If the thing to unlink is the last thing on the square */ - clearFlag(_currMapData[mapX][mapY], k0x0010_ThingListPresent); + clearFlag(_currMapData[mapX][mapY], kDMSquareMaskThingListPresent); uint16 squareFirstThingIdx = _dungeonFileHeader._squareFirstThingCount - 1; for (uint16 i = 0; i < squareFirstThingIdx - firstThingIndex; ++i) currThing[i] = currThing[i + 1]; @@ -1597,7 +1597,7 @@ void DungeonMan::unlinkThingFromList(Thing thingToUnlink, Thing thingInList, int } int16 DungeonMan::getStairsExitDirection(int16 mapX, int16 mapY) { - bool northSouthOrientedStairs = !getFlag(getSquare(mapX, mapY).toByte(), k0x0008_StairsNorthSouthOrient); + bool northSouthOrientedStairs = !getFlag(getSquare(mapX, mapY).toByte(), kDMSquareMaskStairsNorthSouth); if (northSouthOrientedStairs) { mapX = mapX + _vm->_dirIntoStepCountEast[kDMDirEast]; diff --git a/engines/dm/dungeonman.h b/engines/dm/dungeonman.h index 985897a8bb..37d72294bd 100644 --- a/engines/dm/dungeonman.h +++ b/engines/dm/dungeonman.h @@ -229,44 +229,27 @@ enum ExplosionType { }; enum SquareMask { - k0x0001_WallWestRandOrnAllowed = 0x1, // @ MASK0x0001_WALL_WEST_RANDOM_ORNAMENT_ALLOWED - k0x0002_WallSouthRandOrnAllowed = 0x2, // @ MASK0x0002_WALL_SOUTH_RANDOM_ORNAMENT_ALLOWED - k0x0004_WallEastRandOrnAllowed = 0x4, // @ MASK0x0004_WALL_EAST_RANDOM_ORNAMENT_ALLOWED - k0x0008_WallNorthRandOrnAllowed = 0x8, // @ MASK0x0008_WALL_NORTH_RANDOM_ORNAMENT_ALLOWED - k0x0008_CorridorRandOrnAllowed = 0x8, // @ MASK0x0008_CORRIDOR_RANDOM_ORNAMENT_ALLOWED - k0x0001_PitImaginary = 0x1, // @ MASK0x0001_PIT_IMAGINARY - k0x0004_PitInvisible = 0x4, // @ MASK0x0004_PIT_INVISIBLE - k0x0008_PitOpen = 0x8, // @ MASK0x0008_PIT_OPEN - k0x0004_StairsUp = 0x4, // @ MASK0x0004_STAIRS_UP - k0x0008_StairsNorthSouthOrient = 0x8, // @ MASK0x0008_STAIRS_NORTH_SOUTH_ORIENTATION - k0x0008_DoorNorthSouthOrient = 0x8, // @ MASK0x0008_DOOR_NORTH_SOUTH_ORIENTATION - k0x0004_TeleporterVisible = 0x4, // @ MASK0x0004_TELEPORTER_VISIBLE - k0x0008_TeleporterOpen = 0x8, // @ MASK0x0008_TELEPORTER_OPEN - k0x0001_FakeWallImaginary = 0x1, // @ MASK0x0001_FAKEWALL_IMAGINARY - k0x0004_FakeWallOpen = 0x4, // @ MASK0x0004_FAKEWALL_OPEN - k0x0008_FakeWallRandOrnOrFootPAllowed = 0x8, // @ MASK0x0008_FAKEWALL_RANDOM_ORNAMENT_OR_FOOTPRINTS_ALLOWED - k0x0010_ThingListPresent = 0x10, // @ MASK0x0010_THING_LIST_PRESENT - k0x8000_DecodeEvenIfInvisible = 0x8000 // @ MASK0x8000_DECODE_EVEN_IF_INVISIBLE + kDMSquareMaskWallWestRandOrnament = 0x1, // @ MASK0x0001_WALL_WEST_RANDOM_ORNAMENT_ALLOWED + kDMSquareMaslWallSouthRandOrnament = 0x2, // @ MASK0x0002_WALL_SOUTH_RANDOM_ORNAMENT_ALLOWED + kDMSquareMaskWallEastRandOrnament = 0x4, // @ MASK0x0004_WALL_EAST_RANDOM_ORNAMENT_ALLOWED + kDMSquareMaskWallNorthRandOrnament = 0x8, // @ MASK0x0008_WALL_NORTH_RANDOM_ORNAMENT_ALLOWED + kDMSquareMaskCorridorRandOrnament = 0x8, // @ MASK0x0008_CORRIDOR_RANDOM_ORNAMENT_ALLOWED + kDMSquareMaskPitImaginary = 0x1, // @ MASK0x0001_PIT_IMAGINARY + kDMSquareMaskPitInvisible = 0x4, // @ MASK0x0004_PIT_INVISIBLE + kDMSquareMaskPitOpen = 0x8, // @ MASK0x0008_PIT_OPEN + kDMSquareMaskStairsUp = 0x4, // @ MASK0x0004_STAIRS_UP + kDMSquareMaskStairsNorthSouth = 0x8, // @ MASK0x0008_STAIRS_NORTH_SOUTH_ORIENTATION + kDMSquareMaskDoorNorthSouth = 0x8, // @ MASK0x0008_DOOR_NORTH_SOUTH_ORIENTATION + kDMSquareMaskTeleporterVisible = 0x4, // @ MASK0x0004_TELEPORTER_VISIBLE + kDMSquareMaskTeleporterOpen = 0x8, // @ MASK0x0008_TELEPORTER_OPEN + kDMSquareMaskFakeWallImaginary = 0x1, // @ MASK0x0001_FAKEWALL_IMAGINARY + kDMSquareMaskFakeWallOpen = 0x4, // @ MASK0x0004_FAKEWALL_OPEN + kDMSquareMaskFakeWallRandOrnamentOrFootprintsAllowed = 0x8, // @ MASK0x0008_FAKEWALL_RANDOM_ORNAMENT_OR_FOOTPRINTS_ALLOWED + kDMSquareMaskThingListPresent = 0x10 // @ MASK0x0010_THING_LIST_PRESENT }; -enum SquareType { - kM2_ChampionElemType = -2, // @ CM2_ELEMENT_CHAMPION - kM1_CreatureElemType = -1, // @ CM1_ELEMENT_CREATURE - k0_WallElemType = 0, // @ C00_ELEMENT_WALL - k1_CorridorElemType = 1, // @ C01_ELEMENT_CORRIDOR - k2_PitElemType = 2, // @ C02_ELEMENT_PIT - k3_StairsElemType = 3, // @ C03_ELEMENT_STAIRS - k4_DoorElemType = 4, // @ C04_ELEMENT_DOOR - k5_TeleporterElemType = 5, // @ C05_ELEMENT_TELEPORTER - k6_FakeWallElemType = 6, // @ C06_ELEMENT_FAKEWALL - k16_DoorSideElemType = 16, // @ C16_ELEMENT_DOOR_SIDE - k17_DoorFrontElemType = 17, // @ C17_ELEMENT_DOOR_FRONT - k18_StairsSideElemType = 18, // @ C18_ELEMENT_STAIRS_SIDE - k19_StairsFrontElemType = 19 // @ C19_ELEMENT_STAIRS_FRONT -}; // @ C[-2..19]_ELEMENT_... - -#define k0x8000_championBones 0x8000 // @ MASK0x8000_CHAMPION_BONES -#define k0x7FFF_thingType 0x7FFF // @ MASK0x7FFF_THING_TYPE +#define kDMMaskChampionBones 0x8000 // @ MASK0x8000_CHAMPION_BONES +#define kDMMaskThingType 0x7FFF // @ MASK0x7FFF_THING_TYPE class ObjectInfoIndex { public: @@ -567,15 +550,15 @@ class Square { byte _data; public: explicit Square(byte dat = 0) : _data(dat) {} - explicit Square(SquareType type) { setType(type); } + explicit Square(ElementType type) { setType(type); } explicit Square(byte element, byte mask) : _data((element << 5) | mask) {} Square &set(byte dat) { this->_data = dat; return *this; } Square &set(SquareMask mask) { _data |= mask; return *this; } byte get(SquareMask mask) { return _data & mask; } byte getDoorState() { return _data & 0x7; } // @ M36_DOOR_STATE void setDoorState(byte state) { _data = ((_data & ~0x7) | state); } // @ M37_SET_DOOR_STATE - SquareType getType() { return (SquareType)(_data >> 5); } // @ M34_SQUARE_TYPE - void setType(SquareType type) { _data = (_data & 0x1F) | type << 5; } + ElementType getType() { return (ElementType)(_data >> 5); } // @ M34_SQUARE_TYPE + void setType(ElementType type) { _data = (_data & 0x1F) | type << 5; } byte toByte() { return _data; } // I don't like 'em casts }; // wrapper for bytes which are used as squares @@ -655,7 +638,7 @@ public: bool isWallOrnAnAlcove(int16 wallOrnIndex); // @ F0149_DUNGEON_IsWallOrnamentAnAlcove void mapCoordsAfterRelMovement(Direction dir, int16 stepsForward, int16 stepsRight, int16 &posX, int16 &posY); // @ F0150_DUNGEON_UpdateMapCoordinatesAfterRelativeMovement - SquareType getRelSquareType(Direction dir, int16 stepsForward, int16 stepsRight, int16 posX, int16 posY) { + ElementType getRelSquareType(Direction dir, int16 stepsForward, int16 stepsRight, int16 posX, int16 posY) { return Square(getRelSquare(dir, stepsForward, stepsRight, posX, posY)).getType(); } // @ F0153_DUNGEON_GetRelativeSquareType void setSquareAspect(uint16 *aspectArray, Direction dir, int16 mapX, int16 mapY); // @ F0172_DUNGEON_SetSquareAspect diff --git a/engines/dm/eventman.cpp b/engines/dm/eventman.cpp index 4cbcff3965..d791a9e9b6 100644 --- a/engines/dm/eventman.cpp +++ b/engines/dm/eventman.cpp @@ -935,8 +935,8 @@ void EventManager::commandTurnParty(CommandType cmdType) { commandHighlightBoxEnable(291, 318, 125, 145); uint16 partySquare = _vm->_dungeonMan->getSquare(_vm->_dungeonMan->_partyMapX, _vm->_dungeonMan->_partyMapY).toByte(); - if (Square(partySquare).getType() == k3_StairsElemType) { - commandTakeStairs(getFlag(partySquare, k0x0004_StairsUp)); + if (Square(partySquare).getType() == kDMElementTypeStairs) { + commandTakeStairs(getFlag(partySquare, kDMSquareMaskStairsUp)); return; } @@ -981,9 +981,9 @@ void EventManager::commandMoveParty(CommandType cmdType) { int16 partyMapY = _vm->_dungeonMan->_partyMapY; Square curSquare = _vm->_dungeonMan->getSquare(partyMapX, partyMapY); - bool isStairsSquare = (curSquare.getType() == k3_StairsElemType); + bool isStairsSquare = (curSquare.getType() == kDMElementTypeStairs); if (isStairsSquare && (movementArrowIdx == 2)) { /* If moving backward while in stairs */ - commandTakeStairs(getFlag(curSquare.toByte(), k0x0004_StairsUp)); + commandTakeStairs(getFlag(curSquare.toByte(), kDMSquareMaskStairsUp)); return; } @@ -991,7 +991,7 @@ void EventManager::commandMoveParty(CommandType cmdType) { curSquare = _vm->_dungeonMan->getSquare(partyMapX, partyMapY); bool isMovementBlocked = false; - SquareType partySquareType = curSquare.getType(); + ElementType partySquareType = curSquare.getType(); switch (partySquareType){ case kDMElementTypeWall: isMovementBlocked = true; @@ -1001,17 +1001,17 @@ void EventManager::commandMoveParty(CommandType cmdType) { _vm->_dungeonMan->_partyMapX = partyMapX; _vm->_dungeonMan->_partyMapY = partyMapY; byte stairState = curSquare.toByte(); - commandTakeStairs(getFlag(stairState, k0x0004_StairsUp)); + commandTakeStairs(getFlag(stairState, kDMSquareMaskStairsUp)); return; } - case k4_DoorElemType: { + case kDMElementTypeDoor: { byte doorState = curSquare.getDoorState(); isMovementBlocked = (doorState != k0_doorState_OPEN) && (doorState != k1_doorState_FOURTH) && (doorState != k5_doorState_DESTROYED); } break; case kDMElementTypeFakeWall: { byte wallState = curSquare.toByte(); - isMovementBlocked = (!getFlag(wallState, k0x0004_FakeWallOpen) && !getFlag(wallState, k0x0001_FakeWallImaginary)); + isMovementBlocked = (!getFlag(wallState, kDMSquareMaskFakeWallOpen) && !getFlag(wallState, kDMSquareMaskFakeWallImaginary)); } break; default: diff --git a/engines/dm/gfx.cpp b/engines/dm/gfx.cpp index 800ab41030..87c4165903 100644 --- a/engines/dm/gfx.cpp +++ b/engines/dm/gfx.cpp @@ -1184,7 +1184,7 @@ void DisplayMan::drawCeilingPit(int16 nativeBitmapIndex, Frame *frame, int16 map return; int16 mapSquare = _vm->_dungeonMan->_dungeonMapData[mapIndex][mapX][mapY]; - if ((Square(mapSquare).getType() == k2_PitElemType) && getFlag(mapSquare, k0x0008_PitOpen)) { + if ((Square(mapSquare).getType() == kDMElementTypePit) && getFlag(mapSquare, kDMSquareMaskPitOpen)) { if (flipHorizontal) drawFloorPitOrStairsBitmapFlippedHorizontally(nativeBitmapIndex, *frame); else @@ -1245,7 +1245,7 @@ void DisplayMan::drawSquareD3L(Direction dir, int16 posX, int16 posY) { bool skip = false; _vm->_dungeonMan->setSquareAspect(squareAspect, dir, posX, posY); switch (squareAspect[kDMSquareAspectElement]) { - case k19_StairsFrontElemType: + case kDMElementTypeStairsFront: if (squareAspect[kDMSquareAspectStairsUp]) drawFloorPitOrStairsBitmap(_stairsNativeBitmapIndexUpFrontD3L, frameStairsUpFrontD3L); else @@ -1254,7 +1254,7 @@ void DisplayMan::drawSquareD3L(Direction dir, int16 posX, int16 posY) { /* BUG0_64 Floor ornaments are drawn over open pits. There is no check to prevent drawing floor ornaments over open pits */ drawFloorOrnament(squareAspect[kDMSquareAspectFloorOrn], k0_viewFloor_D3L); break; - case k0_WallElemType: + case kDMElementTypeWall: drawWallSetBitmap(_bitmapWallSetD3LCR, _frameWalls163[k1_ViewSquare_D3L]); isDrawnWallOrnAnAlcove(squareAspect[kDMSquareAspectRightWallOrnOrd], k0_ViewWall_D3L_RIGHT); if (isDrawnWallOrnAnAlcove(squareAspect[kDMSquareFrontWallOrnOrd], k2_ViewWall_D3L_FRONT)) @@ -1424,7 +1424,7 @@ void DisplayMan::drawSquareD3C(Direction dir, int16 posX, int16 posY) { return; break; - case k17_DoorFrontElemType: + case kDMElementTypeDoorFront: drawFloorOrnament(squareAspect[kDMSquareAspectFloorOrn], k1_viewFloor_D3C); drawObjectsCreaturesProjectilesExplosions(Thing(squareAspect[kDMSquareAspectFirstGroupOrObject]), dir, posX, posY, k0_ViewSquare_D3C, k0x0218_CellOrder_DoorPass1_BackLeft_BackRight); drawWallSetBitmap(_bitmapWallSetDoorFrameLeftD3C, doorFrameLeftD3C); @@ -1442,7 +1442,7 @@ void DisplayMan::drawSquareD3C(Direction dir, int16 posX, int16 posY) { drawFloorPitOrStairsBitmap(k50_FloorPit_D3C_GraphicIndice, frameFloorPitD3C); // No break on purpose case kDMElementTypeTeleporter: - case k1_CorridorElemType: + case kDMElementTypeCorridor: order = k0x3421_CellOrder_BackLeft_BackRight_FrontLeft_FrontRight; drawFloorOrnament(squareAspect[kDMSquareAspectFloorOrn], k1_viewFloor_D3C); /* BUG0_64 Floor ornaments are drawn over open pits. There is no check to prevent drawing floor ornaments over open pits */ break; @@ -1505,11 +1505,11 @@ void DisplayMan::drawSquareD2L(Direction dir, int16 posX, int16 posY) { case kDMElementTypeStairsSide: drawFloorPitOrStairsBitmap(_stairsNativeBitmapIndexSideD2L, frameStairsSideD2L); // No break on purpose - case k16_DoorSideElemType: + case kDMElementTypeDoorSide: order = k0x0342_CellOrder_BackRight_FrontLeft_FrontRight; drawFloorOrnament(squareAspect[kDMSquareAspectFloorOrn], k3_viewFloor_D2L); /* BUG0_64 Floor ornaments are drawn over open pits. There is no check to prevent drawing floor ornaments over open pits */ break; - case k17_DoorFrontElemType: + case kDMElementTypeDoorFront: drawFloorOrnament(squareAspect[kDMSquareAspectFloorOrn], k3_viewFloor_D2L); drawObjectsCreaturesProjectilesExplosions(Thing(squareAspect[kDMSquareAspectFirstGroupOrObject]), dir, posX, posY, k4_ViewSquare_D2L, k0x0218_CellOrder_DoorPass1_BackLeft_BackRight); drawWallSetBitmap(_bitmapWallSetDoorFrameTopD2LCR, doorFrameTopD2L); @@ -1522,7 +1522,7 @@ void DisplayMan::drawSquareD2L(Direction dir, int16 posX, int16 posY) { frameFloorPitD2L); // No break on purpose case kDMElementTypeTeleporter: - case k1_CorridorElemType: + case kDMElementTypeCorridor: order = k0x3421_CellOrder_BackLeft_BackRight_FrontLeft_FrontRight; drawFloorOrnament(squareAspect[kDMSquareAspectFloorOrn], k3_viewFloor_D2L); /* BUG0_64 Floor ornaments are drawn over open pits. There is no check to prevent drawing floor ornaments over open pits */ break; @@ -1590,13 +1590,13 @@ void DisplayMan::drawSquareD2R(Direction dir, int16 posX, int16 posY) { case kDMElementTypeStairsSide: drawFloorPitOrStairsBitmapFlippedHorizontally(_stairsNativeBitmapIndexSideD2L, frameStairsSideD2R); // No break on purpose - case k16_DoorSideElemType: + case kDMElementTypeDoorSide: order = k0x0431_CellOrder_BackLeft_FrontRight_FrontLeft; /* BUG0_64 Floor ornaments are drawn over open pits. There is no check to prevent drawing floor ornaments over open pits */ drawFloorOrnament(squareAspect[kDMSquareAspectFloorOrn], k5_viewFloor_D2R); drawCeilingPit(k63_ceilingPit_D2L_GraphicIndice, &frameCeilingPitD2R, posX, posY, true); break; - case k17_DoorFrontElemType: + case kDMElementTypeDoorFront: drawFloorOrnament(squareAspect[kDMSquareAspectFloorOrn], k5_ViewSquare_D2R); drawObjectsCreaturesProjectilesExplosions(Thing(squareAspect[kDMSquareAspectFirstGroupOrObject]), dir, posX, posY, k5_ViewSquare_D2R, k0x0128_CellOrder_DoorPass1_BackRight_BackLeft); drawWallSetBitmap(_bitmapWallSetDoorFrameTopD2LCR, doorFrameTopD2R); @@ -1609,7 +1609,7 @@ void DisplayMan::drawSquareD2R(Direction dir, int16 posX, int16 posY) { squareAspect[kDMSquareAspectPitInvisible] ? k57_FloorPir_Invisible_D2L_GraphicIndice : k51_FloorPit_D2L_GraphicIndice, frameFloorPitD2R); // No break on purpose case kDMElementTypeTeleporter: - case k1_CorridorElemType: + case kDMElementTypeCorridor: order = k0x4312_CellOrder_BackRight_BackLeft_FrontRight_FrontLeft; /* BUG0_64 Floor ornaments are drawn over open pits. There is no check to prevent drawing floor ornaments over open pits */ drawFloorOrnament(squareAspect[kDMSquareAspectFloorOrn], k5_viewFloor_D2R); @@ -1673,7 +1673,7 @@ void DisplayMan::drawSquareD2C(Direction dir, int16 posX, int16 posY) { else return; break; - case k17_DoorFrontElemType: + case kDMElementTypeDoorFront: drawFloorOrnament(squareAspect[kDMSquareAspectFloorOrn], k4_viewFloor_D2C); drawObjectsCreaturesProjectilesExplosions(Thing(squareAspect[kDMSquareAspectFirstGroupOrObject]), dir, posX, posY, k3_ViewSquare_D2C, k0x0218_CellOrder_DoorPass1_BackLeft_BackRight); drawWallSetBitmap(_bitmapWallSetDoorFrameTopD2LCR, doorFrameTopD2C); @@ -1691,7 +1691,7 @@ void DisplayMan::drawSquareD2C(Direction dir, int16 posX, int16 posY) { drawFloorPitOrStairsBitmap(squareAspect[kDMSquareAspectPitInvisible] ? k58_FloorPit_invisible_D2C_GraphicIndice : k52_FloorPit_D2C_GraphicIndice, frameFloorPitD2C); // No break on purpose case kDMElementTypeTeleporter: - case k1_CorridorElemType: + case kDMElementTypeCorridor: order = k0x3421_CellOrder_BackLeft_BackRight_FrontLeft_FrontRight; /* BUG0_64 Floor ornaments are drawn over open pits. There is no check to prevent drawing floor ornaments over open pits */ drawFloorOrnament(squareAspect[kDMSquareAspectFloorOrn], k4_viewFloor_D2C); @@ -1758,13 +1758,13 @@ void DisplayMan::drawSquareD1L(Direction dir, int16 posX, int16 posY) { else drawFloorPitOrStairsBitmap(_stairsNativeBitmapIndexDownSideD1L, frameStairsDownSideD1L); // No break on purpose - case k16_DoorSideElemType: + case kDMElementTypeDoorSide: order = k0x0032_CellOrder_BackRight_FrontRight; /* BUG0_64 Floor ornaments are drawn over open pits. There is no check to prevent drawing floor ornaments over open pits */ drawFloorOrnament(squareAspect[kDMSquareAspectFloorOrn], k6_viewFloor_D1L); drawCeilingPit(k65_ceilingPitD1L_GraphicIndice, &frameCeilingPitD1L, posX, posY, false); break; - case k17_DoorFrontElemType: + case kDMElementTypeDoorFront: drawFloorOrnament(squareAspect[kDMSquareAspectFloorOrn], k6_viewFloor_D1L); drawObjectsCreaturesProjectilesExplosions(Thing(squareAspect[kDMSquareAspectFirstGroupOrObject]), dir, posX, posY, k7_ViewSquare_D1L, k0x0028_CellOrder_DoorPass1_BackRight); drawWallSetBitmap(_bitmapWallSetDoorFrameTopD1LCR, doorFrameTopD1L); @@ -1776,7 +1776,7 @@ void DisplayMan::drawSquareD1L(Direction dir, int16 posX, int16 posY) { drawFloorPitOrStairsBitmap(squareAspect[kDMSquareAspectPitInvisible] ? k59_floorPit_invisible_D1L_GraphicIndice : k53_FloorPit_D1L_GraphicIndice, frameFloorPitD1L); // No break on purpose case kDMElementTypeTeleporter: - case k1_CorridorElemType: + case kDMElementTypeCorridor: order = k0x0032_CellOrder_BackRight_FrontRight; /* BUG0_64 Floor ornaments are drawn over open pits. There is no check to prevent drawing floor ornaments over open pits */ drawFloorOrnament(squareAspect[kDMSquareAspectFloorOrn], k6_viewFloor_D1L); @@ -1843,12 +1843,12 @@ void DisplayMan::drawSquareD1R(Direction dir, int16 posX, int16 posY) { drawFloorPitOrStairsBitmapFlippedHorizontally(_stairsNativeBitmapIndexDownSideD1L, frameStairsDownSideD1R); // No break on purpose - case k16_DoorSideElemType: + case kDMElementTypeDoorSide: order = k0x0041_CellOrder_BackLeft_FrontLeft; drawFloorOrnament(squareAspect[kDMSquareAspectFloorOrn], k8_viewFloor_D1R); /* BUG0_64 Floor ornaments are drawn over open pits. There is no check to prevent drawing floor ornaments over open pits */ drawCeilingPit(k65_ceilingPitD1L_GraphicIndice, &frameCeilingPitD1R, posX, posY, true); break; - case k17_DoorFrontElemType: + case kDMElementTypeDoorFront: drawFloorOrnament(squareAspect[kDMSquareAspectFloorOrn], k8_viewFloor_D1R); drawObjectsCreaturesProjectilesExplosions(Thing(squareAspect[kDMSquareAspectFirstGroupOrObject]), dir, posX, posY, k8_ViewSquare_D1R, k0x0018_CellOrder_DoorPass1_BackLeft); drawWallSetBitmap(_bitmapWallSetDoorFrameTopD1LCR, doorFrameTopD1R); @@ -1861,7 +1861,7 @@ void DisplayMan::drawSquareD1R(Direction dir, int16 posX, int16 posY) { : k53_FloorPit_D1L_GraphicIndice, frameFloorPitD1R); // No break on purpose case kDMElementTypeTeleporter: - case k1_CorridorElemType: + case kDMElementTypeCorridor: order = k0x0041_CellOrder_BackLeft_FrontLeft; drawFloorOrnament(squareAspect[kDMSquareAspectFloorOrn], k8_viewFloor_D1R); /* BUG0_64 Floor ornaments are drawn over open pits. There is no check to prevent drawing floor ornaments over open pits */ drawCeilingPit(k65_ceilingPitD1L_GraphicIndice, &frameCeilingPitD1R, posX, posY, true); @@ -1928,7 +1928,7 @@ void DisplayMan::drawSquareD1C(Direction dir, int16 posX, int16 posY) { releaseBlock(k1_DerivedBitmapThievesEyeVisibleArea | 0x8000); } return; - case k17_DoorFrontElemType: + case kDMElementTypeDoorFront: drawFloorOrnament(squareAspect[kDMSquareAspectFloorOrn], k7_viewFloor_D1C); drawObjectsCreaturesProjectilesExplosions(Thing(squareAspect[kDMSquareAspectFirstGroupOrObject]), dir, posX, posY, k6_ViewSquare_D1C, k0x0218_CellOrder_DoorPass1_BackLeft_BackRight); drawWallSetBitmap(_bitmapWallSetDoorFrameTopD1LCR, doorFrameTopD1C); @@ -1945,7 +1945,7 @@ void DisplayMan::drawSquareD1C(Direction dir, int16 posX, int16 posY) { drawFloorPitOrStairsBitmap(squareAspect[kDMSquareAspectPitInvisible] ? k60_floorPitInvisibleD1C_GraphicIndice : k54_FloorPit_D1C_GraphicIndice, frameFloorPitD1C); // No break on purpose case kDMElementTypeTeleporter: - case k1_CorridorElemType: + case kDMElementTypeCorridor: order = k0x3421_CellOrder_BackLeft_BackRight_FrontLeft_FrontRight; /* BUG0_64 Floor ornaments are drawn over open pits. There is no check to prevent drawing floor ornaments over open pits */ drawFloorOrnament(squareAspect[kDMSquareAspectFloorOrn], k7_viewFloor_D1C); @@ -1971,17 +1971,17 @@ void DisplayMan::drawSquareD0L(Direction dir, int16 posX, int16 posY) { uint16 squareAspect[5]; _vm->_dungeonMan->setSquareAspect(squareAspect, dir, posX, posY); switch (squareAspect[kDMSquareAspectElement]) { - case k0_WallElemType: + case kDMElementTypeWall: drawWallSetBitmap(bitmapWallSetWallD0L, _frameWalls163[k10_ViewSquare_D0L]); break; - case k1_CorridorElemType: - case k5_TeleporterElemType: - case k16_DoorSideElemType: + case kDMElementTypeCorridor: + case kDMElementTypeTeleporter: + case kDMElementTypeDoorSide: drawObjectsCreaturesProjectilesExplosions(Thing(squareAspect[kDMSquareAspectFirstGroupOrObject]), dir, posX, posY, k10_ViewSquare_D0L, k0x0002_CellOrder_BackRight); break; - case k2_PitElemType: + case kDMElementTypePit: drawFloorPitOrStairsBitmap(squareAspect[kDMSquareAspectPitInvisible] ? k61_floorPitInvisibleD0L_GraphicIndice : k55_FloorPit_D0L_GraphicIndice, frameFloorPitD0L); - case k18_StairsSideElemType: + case kDMElementTypeStairsSide: if (squareAspect[kDMSquareAspectStairsUp]) drawFloorPitOrStairsBitmap(_stairsNativeBitmapIndexSideD0L, frameStairsSideD0L); break; @@ -2009,8 +2009,8 @@ void DisplayMan::drawSquareD0R(Direction dir, int16 posX, int16 posY) { case kDMElementTypePit: drawFloorPitOrStairsBitmapFlippedHorizontally(squareAspect[kDMSquareAspectPitInvisible] ? k61_floorPitInvisibleD0L_GraphicIndice : k55_FloorPit_D0L_GraphicIndice, frameFloorPitD0R); - case k1_CorridorElemType: - case k16_DoorSideElemType: + case kDMElementTypeCorridor: + case kDMElementTypeDoorSide: case kDMElementTypeTeleporter: drawCeilingPit(k67_ceilingPitD0L_grahicIndice, &frameCeilingPitD0R, posX, posY, true); drawObjectsCreaturesProjectilesExplosions(Thing(squareAspect[kDMSquareAspectFirstGroupOrObject]), dir, posX, posY, k11_ViewSquare_D0R, k0x0001_CellOrder_BackLeft); @@ -2037,7 +2037,7 @@ void DisplayMan::drawSquareD0C(Direction dir, int16 posX, int16 posY) { _vm->_dungeonMan->setSquareAspect(squareAspect, dir, posX, posY); switch (squareAspect[kDMSquareAspectElement]) { - case k16_DoorSideElemType: + case kDMElementTypeDoorSide: if (_vm->_championMan->_party._event73Count_ThievesEye) { memmove(_tmpBitmap, _bitmapWallSetDoorFrameFront, 32 * 123); blitToBitmap(getNativeBitmapOrGraphic(k41_holeInWall_GraphicIndice), @@ -2098,10 +2098,10 @@ void DisplayMan::drawDungeon(Direction dir, int16 posX, int16 posY) { drawWallSetBitmap(_bitmapFloor, floorFrame); } - if (_vm->_dungeonMan->getRelSquareType(dir, 3, -2, posX, posY) == k0_WallElemType) + if (_vm->_dungeonMan->getRelSquareType(dir, 3, -2, posX, posY) == kDMElementTypeWall) drawWallSetBitmap(_bitmapWallSetD3L2, frameWallD3L2); - if (_vm->_dungeonMan->getRelSquareType(dir, 3, 2, posX, posY) == k0_WallElemType) + if (_vm->_dungeonMan->getRelSquareType(dir, 3, 2, posX, posY) == kDMElementTypeWall) drawWallSetBitmap(_bitmapWallSetD3R2, _frameWallD3R2); int16 tmpPosX = posX; diff --git a/engines/dm/group.cpp b/engines/dm/group.cpp index 5289caf301..2bd3bc5351 100644 --- a/engines/dm/group.cpp +++ b/engines/dm/group.cpp @@ -968,7 +968,7 @@ T0209096_SetBehavior0_Wander: } /* If 1/8 chance and the creature is not adjacent to the party and is a quarter square sized creature then process projectile impacts and update the creature cell if still alive. When the creature is not in front of the party, it has 7/8 chances of dodging a projectile by moving to another cell or staying in the center of the square */ if (!(AL0446_i_GroupCellsCriteria & 0x0038) && (distanceToVisibleParty != 1) && (creatureSize == k0_MaskCreatureSizeQuarter)) { - if (_vm->_projexpl->projectileGetImpactCount(kM1_CreatureElemType, eventMapX, eventMapY, activeGroup->_cells) && (_vm->_projexpl->_creatureDamageOutcome == k2_outcomeKilledAllCreaturesInGroup)) /* This call to F0218_PROJECTILE_GetImpactCount works fine because there is a single creature in the group so L0445_ps_ActiveGroup->Cells contains only one cell index */ + if (_vm->_projexpl->projectileGetImpactCount(kDMElementTypeCreature, eventMapX, eventMapY, activeGroup->_cells) && (_vm->_projexpl->_creatureDamageOutcome == k2_outcomeKilledAllCreaturesInGroup)) /* This call to F0218_PROJECTILE_GetImpactCount works fine because there is a single creature in the group so L0445_ps_ActiveGroup->Cells contains only one cell index */ return; activeGroup->_cells = _vm->normalizeModulo4(AL0446_i_GroupCellsCriteria); } @@ -998,7 +998,7 @@ T0209096_SetBehavior0_Wander: AL0446_i_Cell = _vm->normalizeModulo4(AL0446_i_Cell); if (!getCreatureOrdinalInCell(curGroup, AL0446_i_Cell) || (_vm->getRandomNumber(2) && !getCreatureOrdinalInCell(curGroup, AL0446_i_Cell = _vm->returnOppositeDir((Direction)AL0446_i_Cell)))) { /* If the selected cell (or the opposite cell) is not already occupied by a creature */ - if (_vm->_projexpl->projectileGetImpactCount(kM1_CreatureElemType, eventMapX, eventMapY, activeGroup->_cells) && (_vm->_projexpl->_creatureDamageOutcome == k2_outcomeKilledAllCreaturesInGroup)) /* BUG0_70 A projectile impact on a creature may be ignored. The function F0218_PROJECTILE_GetImpactCount to detect projectile impacts when a quarter square sized creature moves inside a group (to another cell on the same square) may fail if there are several creatures in the group because the function expects a single cell index for its last parameter. The function should be called once for each cell where there is a creature */ + if (_vm->_projexpl->projectileGetImpactCount(kDMElementTypeCreature, eventMapX, eventMapY, activeGroup->_cells) && (_vm->_projexpl->_creatureDamageOutcome == k2_outcomeKilledAllCreaturesInGroup)) /* BUG0_70 A projectile impact on a creature may be ignored. The function F0218_PROJECTILE_GetImpactCount to detect projectile impacts when a quarter square sized creature moves inside a group (to another cell on the same square) may fail if there are several creatures in the group because the function expects a single cell index for its last parameter. The function should be called once for each cell where there is a creature */ return; if (_vm->_projexpl->_creatureDamageOutcome != k1_outcomeKilledSomeCreaturesInGroup) { activeGroup->_cells = getGroupValueUpdatedWithCreatureValue(activeGroup->_cells, AL0447_i_CreatureIndex, AL0446_i_Cell); @@ -1071,8 +1071,8 @@ bool GroupMan::isMovementPossible(CreatureInfo *creatureInfo, int16 mapX, int16 ((mapY >= 0) && (mapY < _vm->_dungeonMan->_currMapHeight)) && (curSquareType != kDMElementTypeWall) && (curSquareType != kDMElementTypeStairs) && - ((curSquareType != kDMElementTypePit) || (getFlag(curSquare, k0x0001_PitImaginary) && allowMovementOverImaginaryPitsAndFakeWalls) || !getFlag(curSquare, k0x0008_PitOpen) || getFlag(creatureInfo->_attributes, k0x0020_MaskCreatureInfo_levitation)) && - ((curSquareType != kDMElementTypeFakeWall) || getFlag(curSquare, k0x0004_FakeWallOpen) || (getFlag(curSquare, k0x0001_FakeWallImaginary) && allowMovementOverImaginaryPitsAndFakeWalls))); + ((curSquareType != kDMElementTypePit) || (getFlag(curSquare, kDMSquareMaskPitImaginary) && allowMovementOverImaginaryPitsAndFakeWalls) || !getFlag(curSquare, kDMSquareMaskPitOpen) || getFlag(creatureInfo->_attributes, k0x0020_MaskCreatureInfo_levitation)) && + ((curSquareType != kDMElementTypeFakeWall) || getFlag(curSquare, kDMSquareMaskFakeWallOpen) || (getFlag(curSquare, kDMSquareMaskFakeWallImaginary) && allowMovementOverImaginaryPitsAndFakeWalls))); if (_groupMovBlockedByWallStairsPitFakeWalFluxCageTeleporter) return false; @@ -1092,7 +1092,7 @@ bool GroupMan::isMovementPossible(CreatureInfo *creatureInfo, int16 mapX, int16 curThing = _vm->_dungeonMan->getNextThing(curThing); } } - if ((curSquareType == kDMElementTypeTeleporter) && getFlag(curSquare, k0x0008_TeleporterOpen) && (creatureInfo->getWariness() >= 10)) { + if ((curSquareType == kDMElementTypeTeleporter) && getFlag(curSquare, kDMSquareMaskTeleporterOpen) && (creatureInfo->getWariness() >= 10)) { Teleporter *curTeleporter = (Teleporter *)_vm->_dungeonMan->getSquareFirstThingData(mapX, mapY); if (getFlag(curTeleporter->getScope(), kDMTeleporterScopeCreatures) && !_vm->_dungeonMan->isCreatureAllowedOnMap(_currGroupThing, curTeleporter->getTargetMapIndex())) { _groupMovBlockedByWallStairsPitFakeWalFluxCageTeleporter = true; @@ -1104,7 +1104,7 @@ bool GroupMan::isMovementPossible(CreatureInfo *creatureInfo, int16 mapX, int16 if (_groupMovementBlockedByParty) return false; - if (curSquareType == k4_DoorElemType) { + if (curSquareType == kDMElementTypeDoor) { Teleporter *curTeleporter = (Teleporter *)_vm->_dungeonMan->getSquareFirstThingData(mapX, mapY); if (((Square(curSquare).getDoorState()) > (((Door *)curTeleporter)->opensVertically() ? CreatureInfo::getHeight(creatureInfo->_attributes) : 1)) && ((Square(curSquare).getDoorState()) != k5_doorState_DESTROYED) && !getFlag(creatureInfo->_attributes, k0x0040_MaskCreatureInfo_nonMaterial)) { _groupMovementBlockedByDoor = true; @@ -1234,12 +1234,12 @@ int16 GroupMan::getDistanceBetweenUnblockedSquares(int16 srcMapX, int16 srcMapY, bool GroupMan::isViewPartyBlocked(uint16 mapX, uint16 mapY) { uint16 curSquare = _vm->_dungeonMan->_currMapData[mapX][mapY]; int16 curSquareType = Square(curSquare).getType(); - if (curSquareType == k4_DoorElemType) { + if (curSquareType == kDMElementTypeDoor) { Door *curDoor = (Door *)_vm->_dungeonMan->getSquareFirstThingData(mapX, mapY); int16 curDoorState = Square(curSquare).getDoorState(); return ((curDoorState == k3_doorState_FOURTH) || (curDoorState == k4_doorState_CLOSED)) && !getFlag(_vm->_dungeonMan->_currMapDoorInfo[curDoor->getType()]._attributes, k0x0001_MaskDoorInfo_CraturesCanSeeThrough); } - return (curSquareType == kDMElementTypeWall) || ((curSquareType == kDMElementTypeFakeWall) && !getFlag(curSquare, k0x0004_FakeWallOpen)); + return (curSquareType == kDMElementTypeWall) || ((curSquareType == kDMElementTypeFakeWall) && !getFlag(curSquare, kDMSquareMaskFakeWallOpen)); } int32 GroupMan::getCreatureAspectUpdateTime(ActiveGroup *activeGroup, int16 creatureIndex, bool isAttacking) { @@ -1369,7 +1369,7 @@ bool GroupMan::isSmellPartyBlocked(uint16 mapX, uint16 mapY) { int16 squareType = Square(square).getType(); return ( (squareType) == kDMElementTypeWall) || ((squareType == kDMElementTypeFakeWall) - && !getFlag(square, k0x0004_FakeWallOpen)); + && !getFlag(square, kDMSquareMaskFakeWallOpen)); } int16 GroupMan::getFirstPossibleMovementDirOrdinal(CreatureInfo *info, int16 mapX, int16 mapY, bool allowMovementOverImaginaryPitsAndFakeWalls) { @@ -1708,7 +1708,7 @@ void GroupMan::addAllActiveGroups() { Thing *squareCurThing = &_vm->_dungeonMan->_squareFirstThings[_vm->_dungeonMan->_currMapColCumulativeSquareFirstThingCount[0]]; for (uint16 mapX = 0; mapX < _vm->_dungeonMan->_currMapWidth; mapX++) { for (uint16 mapY = 0; mapY < _vm->_dungeonMan->_currMapHeight; mapY++) { - if (getFlag(*curSquare++, k0x0010_ThingListPresent)) { + if (getFlag(*curSquare++, kDMSquareMaskThingListPresent)) { Thing curThing = *squareCurThing++; do { if (curThing.getType() == kDMThingTypeGroup) { @@ -1770,8 +1770,8 @@ Thing GroupMan::groupGetGenerated(int16 creatureType, int16 healthMultiplier, ui bool GroupMan::isSquareACorridorTeleporterPitOrDoor(int16 mapX, int16 mapY) { int16 squareType = Square(_vm->_dungeonMan->getSquare(mapX, mapY)).getType(); - return ((squareType == k1_CorridorElemType) || (squareType == kDMElementTypeTeleporter) - || (squareType == kDMElementTypePit) || (squareType == k4_DoorElemType)); + return ((squareType == kDMElementTypeCorridor) || (squareType == kDMElementTypeTeleporter) + || (squareType == kDMElementTypePit) || (squareType == kDMElementTypeDoor)); } int16 GroupMan::getMeleeTargetCreatureOrdinal(int16 groupX, int16 groupY, int16 partyX, int16 partyY, uint16 champCell) { @@ -1876,8 +1876,8 @@ T0231016: } void GroupMan::fluxCageAction(int16 mapX, int16 mapY) { - SquareType squareType = _vm->_dungeonMan->getSquare(mapX, mapY).getType(); - if ((squareType == k0_WallElemType) || (squareType == k3_StairsElemType)) + ElementType squareType = _vm->_dungeonMan->getSquare(mapX, mapY).getType(); + if ((squareType == kDMElementTypeWall) || (squareType == kDMElementTypeStairs)) return; Thing unusedThing = _vm->_dungeonMan->getUnusedThing(kDMThingTypeExplosion); @@ -1932,8 +1932,8 @@ uint16 GroupMan::isLordChaosOnSquare(int16 mapX, int16 mapY) { } bool GroupMan::isFluxcageOnSquare(int16 mapX, int16 mapY) { - SquareType squareType = _vm->_dungeonMan->getSquare(mapX, mapY).getType(); - if ((squareType == k0_WallElemType) || (squareType == k3_StairsElemType)) + ElementType squareType = _vm->_dungeonMan->getSquare(mapX, mapY).getType(); + if ((squareType == kDMElementTypeWall) || (squareType == kDMElementTypeStairs)) return false; Thing thing = _vm->_dungeonMan->getSquareFirstThing(mapX, mapY); diff --git a/engines/dm/inventory.cpp b/engines/dm/inventory.cpp index 31d3436b1b..6b39a153df 100644 --- a/engines/dm/inventory.cpp +++ b/engines/dm/inventory.cpp @@ -309,7 +309,7 @@ void InventoryMan::drawPanelScroll(Scroll *scroll) { DisplayMan &dispMan = *_vm->_displayMan; char stringFirstLine[300]; - _vm->_dungeonMan->decodeText(stringFirstLine, Thing(scroll->getTextStringThingIndex()), (TextType)(kDMTextTypeScroll | k0x8000_DecodeEvenIfInvisible)); + _vm->_dungeonMan->decodeText(stringFirstLine, Thing(scroll->getTextStringThingIndex()), (TextType)(kDMTextTypeScroll | kDMMaskDecodeEvenIfInvisible)); char *charRed = stringFirstLine; while (*charRed && (*charRed != '\n')) charRed++; diff --git a/engines/dm/menus.cpp b/engines/dm/menus.cpp index abf0d0a358..e06aae8e26 100644 --- a/engines/dm/menus.cpp +++ b/engines/dm/menus.cpp @@ -1105,7 +1105,7 @@ bool MenuMan::isActionPerformed(uint16 champIndex, int16 actionIndex) { case kDMActionKick: case kDMActionSwing: case kDMActionChop: - if ((Square(targetSquare).getType() == k4_DoorElemType) && (Square(targetSquare).getDoorState() == k4_doorState_CLOSED)) { + if ((Square(targetSquare).getType() == kDMElementTypeDoor) && (Square(targetSquare).getDoorState() == k4_doorState_CLOSED)) { _vm->_sound->requestPlay(k16_soundCOMBAT_ATTACK_SKELETON_ANIMATED_ARMOUR_DETH_KNIGHT, _vm->_dungeonMan->_partyMapX, _vm->_dungeonMan->_partyMapY, kDMSoundModePlayIfPrioritized); actionDisabledTicks = 6; _vm->_groupMan->groupIsDoorDestoryedByAttack(nextMapX, nextMapY, _vm->_championMan->getStrength(champIndex, kDMSlotActionHand), false, 2); @@ -1287,7 +1287,7 @@ bool MenuMan::isActionPerformed(uint16 champIndex, int16 actionIndex) { nextMapX += _vm->_dirIntoStepCountEast[_vm->_dungeonMan->_partyDir]; nextMapY += _vm->_dirIntoStepCountNorth[_vm->_dungeonMan->_partyDir]; /* CHANGE6_00_FIX The presence of a group over the pit is checked so that you cannot climb down a pit with the rope if there is a group levitating over it */ - if ((_vm->_dungeonMan->getSquare(nextMapX, nextMapY).getType() == k2_PitElemType) && (_vm->_groupMan->groupGetThing(nextMapX, nextMapY) == Thing::_endOfList)) { + if ((_vm->_dungeonMan->getSquare(nextMapX, nextMapY).getType() == kDMElementTypePit) && (_vm->_groupMan->groupGetThing(nextMapX, nextMapY) == Thing::_endOfList)) { /* BUG0_77 The party moves forward when using the rope in front of a closed pit. The engine does not check whether the pit is open before moving the party over the pit. This is not consistent with the behavior when using the rope in front of a corridor where nothing happens */ diff --git a/engines/dm/movesens.cpp b/engines/dm/movesens.cpp index d61a43e850..8ff604ab78 100644 --- a/engines/dm/movesens.cpp +++ b/engines/dm/movesens.cpp @@ -258,9 +258,9 @@ bool MovesensMan::getMoveResult(Thing thing, int16 mapX, int16 mapY, int16 destM /* No more than 1000 chained moves at once (in a chain of teleporters and pits for example) */ for (int16 chainedMoveCount = 1000; --chainedMoveCount; ) { destinationSquareData = _vm->_dungeonMan->_currMapData[destMapX][destMapY]; - SquareType destinationSquareType = Square(destinationSquareData).getType(); + ElementType destinationSquareType = Square(destinationSquareData).getType(); if (destinationSquareType == (int)kDMElementTypeTeleporter) { - if (!getFlag(destinationSquareData, k0x0008_TeleporterOpen)) + if (!getFlag(destinationSquareData, kDMSquareMaskTeleporterOpen)) break; Teleporter *teleporter = (Teleporter *)_vm->_dungeonMan->getSquareFirstThingData(destMapX, destMapY); @@ -302,7 +302,7 @@ bool MovesensMan::getMoveResult(Thing thing, int16 mapX, int16 mapY, int16 destM if (destinationIsTeleporterTarget) break; } else { - if ((destinationSquareType == (int)kDMElementTypePit) && !thingLevitates && getFlag(destinationSquareData, k0x0008_PitOpen) && !getFlag(destinationSquareData, k0x0001_PitImaginary)) { + if ((destinationSquareType == (int)kDMElementTypePit) && !thingLevitates && getFlag(destinationSquareData, kDMSquareMaskPitOpen) && !getFlag(destinationSquareData, kDMSquareMaskPitImaginary)) { if (drawDungeonViewWhileFalling && !_useRopeToClimbDownPit) { drawDungeonViewWhileFalling = true; if (traversedPitCount) { @@ -342,7 +342,7 @@ bool MovesensMan::getMoveResult(Thing thing, int16 mapX, int16 mapY, int16 destM _vm->_groupMan->dropMovingCreatureFixedPossession(thing, destMapX, destMapY); } } else if ((destinationSquareType == (int)kDMElementTypeStairs) && (thing != Thing::_party) && (thingType != kDMThingTypeProjectile)) { - if (!getFlag(destinationSquareData, k0x0004_StairsUp)) { + if (!getFlag(destinationSquareData, kDMSquareMaskStairsUp)) { mapIndexDestination = _vm->_dungeonMan->getLocationAfterLevelChange(mapIndexDestination, 1, &destMapX, &destMapY); _vm->_dungeonMan->setCurrentMap(mapIndexDestination); } @@ -513,15 +513,15 @@ bool MovesensMan::moveIsKilledByProjectileImpact(int16 srcMapX, int16 srcMapY, i for (int16 i = 0; i < 4; ++i) championOrCreatureOrdinalInCell[i] = 0; - SquareType impactType; + ElementType impactType; if (thing == Thing::_party) { - impactType = kM2_ChampionElemType; + impactType = kDMElementTypeChampion; for (uint16 cellIdx = kDMCellNorthWest; cellIdx < kDMCellSouthWest + 1; cellIdx++) { if (_vm->_championMan->getIndexInCell((ViewCell)cellIdx) >= 0) championOrCreatureOrdinalInCell[cellIdx] = _vm->indexToOrdinal(cellIdx); } } else { - impactType = kM1_CreatureElemType; + impactType = kDMElementTypeCreature; Group *curGroup = (Group *)_vm->_dungeonMan->getThingData(thing); int16 creatureAlive = 0; for (uint16 cellIdx = kDMCellNorthWest; cellIdx < kDMCellSouthWest + 1; cellIdx++) { @@ -707,7 +707,7 @@ void MovesensMan::processThingAdditionOrRemoval(uint16 mapX, uint16 mapY, Thing Square curSquare = Square(_vm->_dungeonMan->_currMapData[mapX][mapY]); int16 sensorTriggeredCell; - if (curSquare.getType() == k0_WallElemType) + if (curSquare.getType() == kDMElementTypeWall) sensorTriggeredCell = thing.getCell(); else sensorTriggeredCell = kDMCellAny; // this will wrap around @@ -781,7 +781,7 @@ void MovesensMan::processThingAdditionOrRemoval(uint16 mapX, uint16 mapY, Thing continue; break; case kDMSensorFloorPartyOnStairs: - if ((thingType != kDMThingTypeParty) || (curSquare.getType() != k3_StairsElemType)) + if ((thingType != kDMThingTypeParty) || (curSquare.getType() != kDMElementTypeStairs)) continue; break; case kDMSensorFloorGroupGenerator: @@ -909,9 +909,9 @@ void MovesensMan::triggerEffect(Sensor *sensor, SensorEffect effect, int16 mapX, else { int16 targetMapX = sensor->getActionTargetMapX(); int16 targetMapY = sensor->getActionTargetMapY(); - SquareType curSquareType = Square(_vm->_dungeonMan->_currMapData[targetMapX][targetMapY]).getType(); + ElementType curSquareType = Square(_vm->_dungeonMan->_currMapData[targetMapX][targetMapY]).getType(); Cell targetCell; - if (curSquareType == k0_WallElemType) + if (curSquareType == kDMElementTypeWall) targetCell = sensor->getActionTargetCell(); else targetCell = kDMCellNorthWest; diff --git a/engines/dm/projexpl.cpp b/engines/dm/projexpl.cpp index 850873525f..73bf1ace1b 100644 --- a/engines/dm/projexpl.cpp +++ b/engines/dm/projexpl.cpp @@ -112,7 +112,7 @@ bool ProjExpl::hasProjectileImpactOccurred(int16 impactType, int16 mapXCombo, in int16 attack = 0; int16 championIndex = 0; switch (impactType) { - case k4_DoorElemType: { + case kDMElementTypeDoor: { byte curSquare = _vm->_dungeonMan->_currMapData[projectileTargetMapX][projectileTargetMapY]; int16 curDoorState = Square(curSquare).getDoorState(); Door *curDoor = (Door *)_vm->_dungeonMan->getSquareFirstThingData(projectileTargetMapX, projectileTargetMapY); @@ -149,14 +149,14 @@ bool ProjExpl::hasProjectileImpactOccurred(int16 impactType, int16 mapXCombo, in _vm->_groupMan->groupIsDoorDestoryedByAttack(projectileTargetMapX, projectileTargetMapY, attack + _vm->getRandomNumber(attack), false, 0); } break; - case kM2_ChampionElemType: + case kDMElementTypeChampion: championIndex = _vm->_championMan->getIndexInCell(cell); if (championIndex < 0) return false; championAttack = attack = getProjectileImpactAttack(projectileThingData, projectileAssociatedThing); break; - case kM1_CreatureElemType: { + case kDMElementTypeCreature: { Group *curGroup = (Group *)_vm->_dungeonMan->getThingData(_vm->_groupMan->groupGetThing(projectileTargetMapX, projectileTargetMapY)); uint16 curCreatureIndex = _vm->_groupMan->getCreatureOrdinalInCell(curGroup, cell); if (!curCreatureIndex) @@ -356,7 +356,7 @@ int16 ProjExpl::projectileGetImpactCount(int16 impactType, int16 mapX, int16 map hasProjectileImpactOccurred(impactType, mapX, mapY, cell, curThing)) { projectileDeleteEvent(curThing); impactCount++; - if ((impactType == kM1_CreatureElemType) && (_creatureDamageOutcome == k2_outcomeKilledAllCreaturesInGroup)) + if ((impactType == kDMElementTypeCreature) && (_creatureDamageOutcome == k2_outcomeKilledAllCreaturesInGroup)) break; curThing = _vm->_dungeonMan->getSquareFirstThing(mapX, mapY); @@ -404,10 +404,10 @@ void ProjExpl::processEvents48To49(TimelineEvent *event) { curEvent->_type = k49_TMEventTypeMoveProjectile; else { uint16 projectileCurCell = projectileThingNewCell.getCell(); - if ((_vm->_dungeonMan->_currMapIndex == _vm->_dungeonMan->_partyMapIndex) && (destinationMapX == _vm->_dungeonMan->_partyMapX) && (destinationMapY == _vm->_dungeonMan->_partyMapY) && hasProjectileImpactOccurred(kM2_ChampionElemType, destinationMapX, destinationMapY, projectileCurCell, projectileThingNewCell)) + if ((_vm->_dungeonMan->_currMapIndex == _vm->_dungeonMan->_partyMapIndex) && (destinationMapX == _vm->_dungeonMan->_partyMapX) && (destinationMapY == _vm->_dungeonMan->_partyMapY) && hasProjectileImpactOccurred(kDMElementTypeChampion, destinationMapX, destinationMapY, projectileCurCell, projectileThingNewCell)) return; - if ((_vm->_groupMan->groupGetThing(destinationMapX, destinationMapY) != Thing::_endOfList) && hasProjectileImpactOccurred(kM1_CreatureElemType, destinationMapX, destinationMapY, projectileCurCell, projectileThing)) + if ((_vm->_groupMan->groupGetThing(destinationMapX, destinationMapY) != Thing::_endOfList) && hasProjectileImpactOccurred(kDMElementTypeCreature, destinationMapX, destinationMapY, projectileCurCell, projectileThing)) return; uint16 stepEnergy = curEvent->_Cu._projectile.getStepEnergy(); @@ -431,10 +431,10 @@ void ProjExpl::processEvents48To49(TimelineEvent *event) { sourceMapY = destinationMapY; destinationMapX += _vm->_dirIntoStepCountEast[projectileDirection], destinationMapY += _vm->_dirIntoStepCountNorth[projectileDirection]; Square destSquare = _vm->_dungeonMan->getSquare(destinationMapX, destinationMapY); - SquareType destSquareType = destSquare.getType(); - if ((destSquareType == k0_WallElemType) || - ((destSquareType == k6_FakeWallElemType) && !getFlag(destSquare.toByte(), (k0x0001_FakeWallImaginary | k0x0004_FakeWallOpen))) || - ((destSquareType == k3_StairsElemType) && (Square(_vm->_dungeonMan->_currMapData[sourceMapX][sourceMapY]).getType() == k3_StairsElemType))) { + ElementType destSquareType = destSquare.getType(); + if ((destSquareType == kDMElementTypeWall) || + ((destSquareType == kDMElementTypeFakeWall) && !getFlag(destSquare.toByte(), (kDMSquareMaskFakeWallImaginary | kDMSquareMaskFakeWallOpen))) || + ((destSquareType == kDMElementTypeStairs) && (Square(_vm->_dungeonMan->_currMapData[sourceMapX][sourceMapY]).getType() == kDMElementTypeStairs))) { if (hasProjectileImpactOccurred(destSquare.getType(), sourceMapX, sourceMapY, projectileNewCell, projectileThingNewCell)) { return; } @@ -455,7 +455,7 @@ void ProjExpl::processEvents48To49(TimelineEvent *event) { projectileThingNewCell = _vm->thingWithNewCell(projectileThingNewCell, _vm->_moveSens->_moveResultCell); M31_setMap(curEvent->_mapTime, _vm->_moveSens->_moveResultMapIndex); } else { - if ((Square(_vm->_dungeonMan->getSquare(destinationMapX, destinationMapY)).getType() == k4_DoorElemType) && hasProjectileImpactOccurred(k4_DoorElemType, destinationMapX, destinationMapY, projectileNewCell, projectileThing)) + if ((Square(_vm->_dungeonMan->getSquare(destinationMapX, destinationMapY)).getType() == kDMElementTypeDoor) && hasProjectileImpactOccurred(kDMElementTypeDoor, destinationMapX, destinationMapY, projectileNewCell, projectileThing)) return; _vm->_dungeonMan->unlinkThingFromList(projectileThingNewCell, Thing(0), destinationMapX, destinationMapY); @@ -503,7 +503,7 @@ void ProjExpl::processEvent25(TimelineEvent *event) { if (!(attack >>= 1)) break; case 0xFF80: - if (curSquareType == k4_DoorElemType) + if (curSquareType == kDMElementTypeDoor) _vm->_groupMan->groupIsDoorDestoryedByAttack(mapX, mapY, attack, true, 0); break; diff --git a/engines/dm/timeline.cpp b/engines/dm/timeline.cpp index 0e61a87000..7a032f12d7 100644 --- a/engines/dm/timeline.cpp +++ b/engines/dm/timeline.cpp @@ -449,7 +449,7 @@ void Timeline::processEventSquareFakewall(TimelineEvent *event) { byte *curSquare = &_vm->_dungeonMan->_currMapData[mapX][mapY]; int16 effect = event->_Cu.A._effect; if (effect == kDMSensorEffectToggle) - effect = getFlag(*curSquare, k0x0004_FakeWallOpen) ? kDMSensorEffectClear : kDMSensorEffectSet; + effect = getFlag(*curSquare, kDMSquareMaskFakeWallOpen) ? kDMSensorEffectClear : kDMSensorEffectSet; if (effect == kDMSensorEffectClear) { if ((_vm->_dungeonMan->_currMapIndex == _vm->_dungeonMan->_partyMapIndex) && (mapX == _vm->_dungeonMan->_partyMapX) && (mapY == _vm->_dungeonMan->_partyMapY)) { @@ -461,10 +461,10 @@ void Timeline::processEventSquareFakewall(TimelineEvent *event) { event->_mapTime++; addEventGetEventIndex(event); } else - clearFlag(*curSquare, k0x0004_FakeWallOpen); + clearFlag(*curSquare, kDMSquareMaskFakeWallOpen); } } else - setFlag(*curSquare, k0x0004_FakeWallOpen); + setFlag(*curSquare, kDMSquareMaskFakeWallOpen); } void Timeline::processEventDoorDestruction(TimelineEvent *event) { @@ -493,13 +493,13 @@ void Timeline::processEventSquarePit(TimelineEvent *event) { byte *square = &_vm->_dungeonMan->_currMapData[mapX][mapY]; if (event->_Cu.A._effect == kDMSensorEffectToggle) - event->_Cu.A._effect = getFlag(*square, k0x0008_PitOpen) ? kDMSensorEffectClear : kDMSensorEffectSet; + event->_Cu.A._effect = getFlag(*square, kDMSquareMaskPitOpen) ? kDMSensorEffectClear : kDMSensorEffectSet; if (event->_Cu.A._effect == kDMSensorEffectSet) { - setFlag(*square, k0x0008_PitOpen); + setFlag(*square, kDMSquareMaskPitOpen); moveTeleporterOrPitSquareThings(mapX, mapY); } else - clearFlag(*square, k0x0008_PitOpen); + clearFlag(*square, kDMSquareMaskPitOpen); } void Timeline::moveTeleporterOrPitSquareThings(uint16 mapX, uint16 mapY) { @@ -560,13 +560,13 @@ void Timeline::processEventSquareTeleporter(TimelineEvent *event) { byte *curSquare = &_vm->_dungeonMan->_currMapData[mapX][mapY]; if (event->_Cu.A._effect == kDMSensorEffectToggle) - event->_Cu.A._effect = getFlag(*curSquare, k0x0008_TeleporterOpen) ? kDMSensorEffectClear : kDMSensorEffectSet; + event->_Cu.A._effect = getFlag(*curSquare, kDMSquareMaskTeleporterOpen) ? kDMSensorEffectClear : kDMSensorEffectSet; if (event->_Cu.A._effect == kDMSensorEffectSet) { - setFlag(*curSquare, k0x0008_TeleporterOpen); + setFlag(*curSquare, kDMSquareMaskTeleporterOpen); moveTeleporterOrPitSquareThings(mapX, mapY); } else - clearFlag(*curSquare, k0x0008_TeleporterOpen); + clearFlag(*curSquare, kDMSquareMaskTeleporterOpen); } void Timeline::processEventSquareWall(TimelineEvent *event) { |