diff options
Diffstat (limited to 'engines/dm/gfx.cpp')
-rw-r--r-- | engines/dm/gfx.cpp | 437 |
1 files changed, 227 insertions, 210 deletions
diff --git a/engines/dm/gfx.cpp b/engines/dm/gfx.cpp index 875d3c780c..7481f6c726 100644 --- a/engines/dm/gfx.cpp +++ b/engines/dm/gfx.cpp @@ -41,6 +41,22 @@ #include "dm/text.h" namespace DM { + +DoorFrames::DoorFrames(Frame f1, Frame f2_1, Frame f2_2, Frame f2_3, + Frame f3_1, Frame f3_2, Frame f3_3, + Frame f4_1, Frame f4_2, Frame f4_3) { + _closedOrDestroyed = f1; + _vertical[0] = f2_1; + _vertical[1] = f2_2; + _vertical[2] = f2_3; + _leftHorizontal[0] = f3_1; + _leftHorizontal[1] = f3_2; + _leftHorizontal[2] = f3_3; + _rightHorizontal[0] = f4_1; + _rightHorizontal[1] = f4_2; + _rightHorizontal[2] = f4_3; +} + DisplayMan::DisplayMan(DMEngine *dmEngine) : _vm(dmEngine) { _bitmapScreen = nullptr; _bitmaps = nullptr; @@ -475,7 +491,7 @@ void DisplayMan::setUpScreens(uint16 width, uint16 height) { delete[] _tmpBitmap; delete[] _bitmapScreen; _bitmapScreen = new byte[_screenWidth * _screenHeight]; - fillScreen(k0_ColorBlack); + fillScreen(kDMColorBlack); _tmpBitmap = new byte[_screenWidth * _screenHeight]; } @@ -509,17 +525,17 @@ void DisplayMan::initializeGraphicData() { _derivedBitmaps[i] = nullptr; } - _derivedBitmapByteCount[k0_DerivedBitmapViewport] = 112 * 136; - _derivedBitmapByteCount[k1_DerivedBitmapThievesEyeVisibleArea] = 48 * 95; - _derivedBitmapByteCount[k2_DerivedBitmapDamageToCreatureMedium] = 32 * 37; - _derivedBitmapByteCount[k3_DerivedBitmapDamageToCreatureSmall] = 24 * 37; + _derivedBitmapByteCount[kDMDerivedBitmapViewport] = 112 * 136; + _derivedBitmapByteCount[kDMDerivedBitmapThievesEyeVisibleArea] = 48 * 95; + _derivedBitmapByteCount[kDMDerivedBitmapDamageToCreatureMedium] = 32 * 37; + _derivedBitmapByteCount[kDMDerivedBitmapDamageToCreatureSmall] = 24 * 37; for (int16 doorOrnamentIndex = k15_DoorOrnDestroyedMask; doorOrnamentIndex <= k16_DoorOrnThivesEyeMask; doorOrnamentIndex++) { _currMapDoorOrnInfo[doorOrnamentIndex].nativeIndice = doorOrnamentIndex + (k301_DoorMaskDestroyedIndice - k15_DoorOrnDestroyedMask); _currMapDoorOrnInfo[doorOrnamentIndex].coordinateSet = 1; - _derivedBitmapByteCount[doorOrnamentIndex * 2 + k68_DerivedBitmapFirstDoorOrnament_D3] = 24 * 41; - _derivedBitmapByteCount[doorOrnamentIndex * 2 + k69_DerivedBitmapFirstDoorOrnament_D2] = 32 * 61; + _derivedBitmapByteCount[doorOrnamentIndex * 2 + kDMDerivedBitmapFirstDoorOrnamentD3] = 24 * 41; + _derivedBitmapByteCount[doorOrnamentIndex * 2 + kDMDerivedBitmapFirstDoorOrnamentD2] = 32 * 61; } _currMapFloorOrnInfo[k15_FloorOrnFootprints].nativeIndice = k241_FloorOrn_15_D3L_footprints; @@ -528,7 +544,7 @@ void DisplayMan::initializeGraphicData() { ObjectAspect *objectAspect = _objectAspects209; int16 derivedBitmapIndex; for (int16 objectAspectIndex = 0; objectAspectIndex < k85_ObjAspectCount; ++objectAspectIndex, ++objectAspect) { - derivedBitmapIndex = k104_DerivedBitmapFirstObject + objectAspect->_firstDerivedBitmapRelativeIndex; + derivedBitmapIndex = kDMDerivedBitmapFirstObject + objectAspect->_firstDerivedBitmapRelativeIndex; _derivedBitmapByteCount[derivedBitmapIndex++] = getScaledBitmapByteCount(objectAspect->_byteWidth, objectAspect->_height, k16_Scale_D3); _derivedBitmapByteCount[derivedBitmapIndex++] = getScaledBitmapByteCount(objectAspect->_byteWidth, objectAspect->_height, k20_Scale_D2); @@ -550,7 +566,7 @@ void DisplayMan::initializeGraphicData() { ProjectileAspect *projectileAspect = _projectileAspect; for (int16 projectileAspectIndex = 0; projectileAspectIndex < k14_ProjectileAspectCount; projectileAspectIndex++, projectileAspect++) { if (!getFlag(projectileAspect->_graphicInfo, k0x0100_ProjectileScaleWithKineticEnergyMask)) { - derivedBitmapIndex = k282_DerivedBitmapFirstProjectile + projectileAspect->_firstDerivedBitmapRelativeIndex; + derivedBitmapIndex = kDMDerivedBitmapFirstProjectile + projectileAspect->_firstDerivedBitmapRelativeIndex; for (int16 projectileScaleIndex = 0; projectileScaleIndex < 6; projectileScaleIndex++) { int16 bitmapByteCount = getScaledBitmapByteCount(projectileAspect->_byteWidth, projectileAspect->_height, _projectileScales[projectileScaleIndex]); @@ -570,17 +586,17 @@ void DisplayMan::initializeGraphicData() { _palChangesProjectile[1] = _palChangesFloorOrnD2; _palChangesProjectile[2] = _palChangesProjectile[3] = _palChangesNoChanges; - derivedBitmapIndex = k438_DerivedBitmapFirstExplosion; + derivedBitmapIndex = kDMDerivedBitmapFirstExplosion; ExplosionAspect *expAsp = _explosionAspects; for (uint16 expAspIndex = 0; expAspIndex < k4_ExplosionAspectCount; ++expAspIndex, expAsp++) { for (int16 scale = 4; scale < 32; scale += 2) _derivedBitmapByteCount[derivedBitmapIndex++] = getScaledBitmapByteCount(expAsp->_byteWidth, expAsp->_height, scale); - if (expAspIndex == k3_ExplosionAspectSmoke) + if (expAspIndex == kDMExplosionAspectSmoke) _derivedBitmapByteCount[derivedBitmapIndex++] = expAsp->_byteWidth * expAsp->_height; } - derivedBitmapIndex = k495_DerivedBitmapFirstCreature; + derivedBitmapIndex = kDMDerivedBitmapFirstCreature; CreatureAspect *creatureAsp; for (int16 creatureIndex = 0; creatureIndex < k27_CreatureTypeCount; creatureIndex++) { creatureAsp = &_creatureAspects219[creatureIndex]; @@ -594,22 +610,22 @@ void DisplayMan::initializeGraphicData() { int16 creatureFrontBitmapD2PixelCount = getScaledBitmapByteCount(creatureAsp->_byteWidthFront, creatureAsp->_heightFront, k20_Scale_D2); _derivedBitmapByteCount[derivedBitmapIndex++] = creatureFrontBitmapD2PixelCount; - if (getFlag(creatureGraphicInfo, k0x0008_CreatureInfoGraphicMaskSide)) { + if (getFlag(creatureGraphicInfo, kDMCreatureMaskSide)) { _derivedBitmapByteCount[derivedBitmapIndex++] = getScaledBitmapByteCount(creatureAsp->_byteWidthSide, creatureAsp->_heightSide, k16_Scale_D3); _derivedBitmapByteCount[derivedBitmapIndex++] = getScaledBitmapByteCount(creatureAsp->_byteWidthSide, creatureAsp->_heightSide, k20_Scale_D2); } - if (getFlag(creatureGraphicInfo, k0x0010_CreatureInfoGraphicMaskBack)) { + if (getFlag(creatureGraphicInfo, kDMCreatureMaskBack)) { _derivedBitmapByteCount[derivedBitmapIndex++] = creatureFrontBitmapD3PixelCount; _derivedBitmapByteCount[derivedBitmapIndex++] = creatureFrontBitmapD2PixelCount; } - if (getFlag(creatureGraphicInfo, k0x0020_CreatureInfoGraphicMaskAttack)) { + if (getFlag(creatureGraphicInfo, kDMCreatureMaskAttack)) { _derivedBitmapByteCount[derivedBitmapIndex++] = getScaledBitmapByteCount(creatureAsp->_byteWidthAttack, creatureAsp->_heightAttack, k16_Scale_D3); _derivedBitmapByteCount[derivedBitmapIndex++] = getScaledBitmapByteCount(creatureAsp->_byteWidthAttack, creatureAsp->_heightAttack, k20_Scale_D2); } - int16 additionalFronGraphicCount = getFlag(creatureGraphicInfo, k0x0003_CreatureInfoGraphicMaskAdditional); + int16 additionalFronGraphicCount = getFlag(creatureGraphicInfo, kDMCreatureMaskAdditional); if (additionalFronGraphicCount) { do { _derivedBitmapByteCount[derivedBitmapIndex++] = creatureAsp->_byteWidthFront * creatureAsp->_heightFront; @@ -696,7 +712,7 @@ void DisplayMan::loadFNT1intoBitmap(uint16 index, byte * destBitmap) { for (uint16 i = 0; i < 6; i++) { for (uint16 w = 0; w < 128; ++w) { - *destBitmap++ = k0_ColorBlack; + *destBitmap++ = kDMColorBlack; uint16 nextByte = *data++; for (int16 pixel = 4; pixel >= 0; --pixel) { @@ -717,7 +733,7 @@ void DisplayMan::allocateFlippedWallBitmaps() { void DisplayMan::drawDoorBitmap(Frame* frame) { if (frame->_srcByteWidth) { blitToBitmap(_tmpBitmap, _bitmapViewport, frame->_box, frame->_srcX, frame->_srcY, - frame->_srcByteWidth, k112_byteWidthViewport, k10_ColorFlesh, frame->_srcHeight, k136_heightViewport); + frame->_srcByteWidth, k112_byteWidthViewport, kDMColorFlesh, frame->_srcHeight, k136_heightViewport); } } @@ -725,7 +741,7 @@ void DisplayMan::drawDoorFrameBitmapFlippedHorizontally(byte *bitmap, Frame *fra if (frame->_srcByteWidth) { flipBitmapHorizontal(bitmap, frame->_srcByteWidth, frame->_srcHeight); blitToBitmap(bitmap, _bitmapViewport, frame->_box, frame->_srcX, frame->_srcY, - frame->_srcByteWidth, k112_byteWidthViewport, k10_ColorFlesh, frame->_srcHeight, k136_heightViewport); + frame->_srcByteWidth, k112_byteWidthViewport, kDMColorFlesh, frame->_srcHeight, k136_heightViewport); } } @@ -753,12 +769,12 @@ void DisplayMan::drawDoorButton(int16 doorButtonOrdinal, DoorButton doorButton) if (doorButton == kDMDoorButtonD1C) { bitmap = getNativeBitmapOrGraphic(nativeBitmapIndex); - _vm->_dungeonMan->_dungeonViewClickableBoxes[k5_ViewCellDoorButtonOrWallOrn]._x1 = coordSetRedEagle[0]; - _vm->_dungeonMan->_dungeonViewClickableBoxes[k5_ViewCellDoorButtonOrWallOrn]._x2 = coordSetRedEagle[1]; - _vm->_dungeonMan->_dungeonViewClickableBoxes[k5_ViewCellDoorButtonOrWallOrn]._y1 = coordSetRedEagle[2]; - _vm->_dungeonMan->_dungeonViewClickableBoxes[k5_ViewCellDoorButtonOrWallOrn]._y2 = coordSetRedEagle[3]; + _vm->_dungeonMan->_dungeonViewClickableBoxes[kDMViewCellDoorButtonOrWallOrn]._x1 = coordSetRedEagle[0]; + _vm->_dungeonMan->_dungeonViewClickableBoxes[kDMViewCellDoorButtonOrWallOrn]._x2 = coordSetRedEagle[1]; + _vm->_dungeonMan->_dungeonViewClickableBoxes[kDMViewCellDoorButtonOrWallOrn]._y1 = coordSetRedEagle[2]; + _vm->_dungeonMan->_dungeonViewClickableBoxes[kDMViewCellDoorButtonOrWallOrn]._y2 = coordSetRedEagle[3]; } else { - doorButtonOrdinal = k102_DerivedBitmapFirstDoorButton + (doorButtonOrdinal * 2) + ((doorButton != kDMDoorButtonD3R) ? 0 : (int16)doorButton - 1); + doorButtonOrdinal = kDMDerivedBitmapFirstDoorButton + (doorButtonOrdinal * 2) + ((doorButton != kDMDoorButtonD3R) ? 0 : (int16)doorButton - 1); if (!isDerivedBitmapInCache(doorButtonOrdinal)) { uint16 *coordSetBlueGoat = doorButtonCoordSets[coordSet][kDMDoorButtonD1C]; byte *bitmapNative = getNativeBitmapOrGraphic(nativeBitmapIndex); @@ -774,7 +790,7 @@ void DisplayMan::drawDoorButton(int16 doorButtonOrdinal, DoorButton doorButton) bitmap = getDerivedBitmap(doorButtonOrdinal); } blitToBitmap(bitmap, _bitmapViewport, *(Box *)coordSetRedEagle, 0, 0, - coordSetRedEagle[4], k112_byteWidthViewport, k10_ColorFlesh, coordSetRedEagle[5], k136_heightViewport); + coordSetRedEagle[4], k112_byteWidthViewport, kDMColorFlesh, coordSetRedEagle[5], k136_heightViewport); } } @@ -788,7 +804,7 @@ void DisplayMan::viewportSetPalette(uint16* middleScreenPalette, uint16* topAndB void DisplayMan::viewportBlitToScreen() { Box box(0, 223, 33, 168); - blitToBitmap(_bitmapViewport, _bitmapScreen, box, 0, 0, k112_byteWidthViewport, k160_byteWidthScreen, kM1_ColorNoTransparency, + blitToBitmap(_bitmapViewport, _bitmapScreen, box, 0, 0, k112_byteWidthViewport, k160_byteWidthScreen, kDMColorNoTransparency, k136_heightViewport, k200_heightScreen); } @@ -924,16 +940,16 @@ byte *DisplayMan::getExplosionBitmap(uint16 explosionAspIndex, uint16 scale, int int16 pixelWidth = getScaledDimension(explAsp->_byteWidth, scale); int16 height = getScaledDimension(explAsp->_height, scale); byte *bitmap; - int16 derBitmapIndex = (explosionAspIndex * 14) + scale / 2 + k438_DerivedBitmapFirstExplosion - 2; - if ((scale == 32) && (explosionAspIndex != k3_ExplosionAspectSmoke)) + int16 derBitmapIndex = (explosionAspIndex * 14) + scale / 2 + kDMDerivedBitmapFirstExplosion - 2; + if ((scale == 32) && (explosionAspIndex != kDMExplosionAspectSmoke)) bitmap = getNativeBitmapOrGraphic(explosionAspIndex + k348_FirstExplosionGraphicIndice); else if (isDerivedBitmapInCache(derBitmapIndex)) bitmap = getDerivedBitmap(derBitmapIndex); else { - byte *nativeBitmap = getNativeBitmapOrGraphic(MIN(explosionAspIndex, (uint16)k2_ExplosionAspectPoison) + k348_FirstExplosionGraphicIndice); + byte *nativeBitmap = getNativeBitmapOrGraphic(MIN(explosionAspIndex, (uint16)kDMExplosionAspectPoison) + k348_FirstExplosionGraphicIndice); bitmap = getDerivedBitmap(derBitmapIndex); blitToBitmapShrinkWithPalChange(nativeBitmap, bitmap, explAsp->_byteWidth, explAsp->_height, pixelWidth * 2, height, - (explosionAspIndex == k3_ExplosionAspectSmoke) ? _palChangeSmoke : _palChangesNoChanges); + (explosionAspIndex == kDMExplosionAspectSmoke) ? _palChangeSmoke : _palChangesNoChanges); addDerivedBitmap(derBitmapIndex); } @@ -1073,7 +1089,7 @@ void DisplayMan::drawFloorOrnament(uint16 floorOrnOrdinal, ViewFloor viewFloorIn bitmap = getNativeBitmapOrGraphic(nativeBitmapIndex); blitToBitmap(bitmap, _bitmapViewport, - *(Box *)coordSets, 0, 0, coordSets[4], k112_byteWidthViewport, k10_ColorFlesh, coordSets[5], k136_heightViewport); + *(Box *)coordSets, 0, 0, coordSets[4], k112_byteWidthViewport, kDMColorFlesh, coordSets[5], k136_heightViewport); } if (drawFootprints) @@ -1160,7 +1176,7 @@ void DisplayMan::drawDoorOrnament(int16 doorOrnOrdinal, DoorOrnament doorOrnamen byteWidth = k48_byteWidth; height = 88; } else { - height = k68_DerivedBitmapFirstDoorOrnament_D3 + (height * 2) + doorOrnament; + height = kDMDerivedBitmapFirstDoorOrnamentD3 + (height * 2) + doorOrnament; if (!isDerivedBitmapInCache(height)) { uint16 *coordSetRedEagle = &doorOrnCoordSets[coordSetGreenToad][kDMDoorOrnamentD1LCR][0]; byte *nativeBitmap = getNativeBitmapOrGraphic(nativeBitmapIndex); @@ -1178,7 +1194,7 @@ void DisplayMan::drawDoorOrnament(int16 doorOrnOrdinal, DoorOrnament doorOrnamen } Box box(coordSetOrangeElk[0], coordSetOrangeElk[1], coordSetOrangeElk[2], coordSetOrangeElk[3]); - blitToBitmap(blitBitmap, _tmpBitmap, box, 0, 0, coordSetOrangeElk[4], byteWidth, k9_ColorGold, coordSetOrangeElk[5], height); + blitToBitmap(blitBitmap, _tmpBitmap, box, 0, 0, coordSetOrangeElk[4], byteWidth, kDMColorGold, coordSetOrangeElk[5], height); } void DisplayMan::drawCeilingPit(int16 nativeBitmapIndex, Frame *frame, int16 mapX, int16 mapY, bool flipHorizontal) { @@ -1214,14 +1230,14 @@ void DisplayMan::drawWallSetBitmapWithoutTransparency(byte *bitmap, Frame &f) { if (!f._srcByteWidth) return; - blitToBitmap(bitmap, _bitmapViewport, f._box, f._srcX, f._srcY, f._srcByteWidth, k112_byteWidthViewport, kM1_ColorNoTransparency, f._srcHeight, k136_heightViewport); + blitToBitmap(bitmap, _bitmapViewport, f._box, f._srcX, f._srcY, f._srcByteWidth, k112_byteWidthViewport, kDMColorNoTransparency, f._srcHeight, k136_heightViewport); } void DisplayMan::drawWallSetBitmap(byte *bitmap, Frame &f) { if (!f._srcByteWidth) return; - blitToBitmap(bitmap, _bitmapViewport, f._box, f._srcX, f._srcY, f._srcByteWidth, k112_byteWidthViewport, k10_ColorFlesh, f._srcHeight, k136_heightViewport); + blitToBitmap(bitmap, _bitmapViewport, f._box, f._srcX, f._srcY, f._srcByteWidth, k112_byteWidthViewport, kDMColorFlesh, f._srcHeight, k136_heightViewport); } @@ -1245,7 +1261,7 @@ void DisplayMan::drawSquareD3L(Direction dir, int16 posX, int16 posY) { ); uint16 squareAspect[5]; - int16 order; + CellOrder order; bool skip = false; _vm->_dungeonMan->setSquareAspect(squareAspect, dir, posX, posY); switch (squareAspect[kDMSquareAspectElement]) { @@ -1254,31 +1270,31 @@ void DisplayMan::drawSquareD3L(Direction dir, int16 posX, int16 posY) { drawFloorPitOrStairsBitmap(_stairsNativeBitmapIndexUpFrontD3L, frameStairsUpFrontD3L); else drawFloorPitOrStairsBitmap(_stairsNativeBitmapIndexDownFrontD3L, frameStairsDownFrontD3L); - order = k0x3421_CellOrder_BackLeft_BackRight_FrontLeft_FrontRight; + order = kDMCellOrderBackLeftBackRightFrontLeftFrontRight; /* BUG0_64 Floor ornaments are drawn over open pits. There is no check to prevent drawing floor ornaments over open pits */ drawFloorOrnament(squareAspect[kDMSquareAspectFloorOrn], kDMViewFloorD3L); break; case kDMElementTypeWall: - drawWallSetBitmap(_bitmapWallSetD3LCR, _frameWalls163[k1_ViewSquare_D3L]); + drawWallSetBitmap(_bitmapWallSetD3LCR, _frameWalls163[kDMViewSquareD3L]); isDrawnWallOrnAnAlcove(squareAspect[kDMSquareAspectRightWallOrnOrd], kDMViewWallD3LRight); if (isDrawnWallOrnAnAlcove(squareAspect[kDMSquareFrontWallOrnOrd], kDMViewWallD3LFront)) - order = k0x0000_CellOrder_Alcove; + order = kDMCellOrderAlcove; else return; break; case kDMElementTypeDoorSide: case kDMElementTypeStairsSide: - order = k0x0321_CellOrder_BackLeft_BackRight_FrontRight; + order = kDMCellOrderBackLeftBackRightFrontRight; /* BUG0_64 Floor ornaments are drawn over open pits. There is no check to prevent drawing floor ornaments over open pits */ drawFloorOrnament(squareAspect[kDMSquareAspectFloorOrn], kDMViewFloorD3L); break; case kDMElementTypeDoorFront: drawFloorOrnament(squareAspect[kDMSquareAspectFloorOrn], kDMViewFloorD3L); - drawObjectsCreaturesProjectilesExplosions(Thing(squareAspect[kDMSquareAspectFirstGroupOrObject]), dir, posX, posY, k1_ViewSquare_D3L, k0x0218_CellOrder_DoorPass1_BackLeft_BackRight); + drawObjectsCreaturesProjectilesExplosions(Thing(squareAspect[kDMSquareAspectFirstGroupOrObject]), dir, posX, posY, kDMViewSquareD3L, kDMCellOrderDoorPass1BackLeftBackRight); drawWallSetBitmap(_bitmapWallSetDoorFrameLeftD3L, doorFrameLeftD3L); drawDoor(squareAspect[kDMSquareAspectDoorThingIndex], (DoorState)squareAspect[kDMSquareAspectDoorState], _doorNativeBitmapIndexFrontD3LCR, getBitmapByteCount(48, 41), kDMDoorOrnamentD3LCR, &doorFrameD3L); - order = k0x0349_CellOrder_DoorPass2_FrontLeft_FrontRight; + order = kDMCellOrderDoorPass2FrontLeftFrontRight; break; case kDMElementTypePit: if (!squareAspect[kDMSquareAspectPitInvisible]) @@ -1286,7 +1302,7 @@ void DisplayMan::drawSquareD3L(Direction dir, int16 posX, int16 posY) { // no break on purpose case kDMElementTypeTeleporter: case kDMElementTypeCorridor: - order = k0x3421_CellOrder_BackLeft_BackRight_FrontLeft_FrontRight; + order = kDMCellOrderBackLeftBackRightFrontLeftFrontRight; /* BUG0_64 Floor ornaments are drawn over open pits. There is no check to prevent drawing floor ornaments over open pits */ drawFloorOrnament(squareAspect[kDMSquareAspectFloorOrn], kDMViewFloorD3L); break; @@ -1296,10 +1312,10 @@ void DisplayMan::drawSquareD3L(Direction dir, int16 posX, int16 posY) { } if (!skip) - drawObjectsCreaturesProjectilesExplosions(Thing(squareAspect[kDMSquareAspectFirstGroupOrObject]), dir, posX, posY, k1_ViewSquare_D3L, order); + drawObjectsCreaturesProjectilesExplosions(Thing(squareAspect[kDMSquareAspectFirstGroupOrObject]), dir, posX, posY, kDMViewSquareD3L, order); if ((squareAspect[kDMSquareAspectElement] == kDMElementTypeTeleporter) && squareAspect[kDMSquareAspectTeleporterVisible]) - drawField(&_fieldAspects188[k1_ViewSquare_D3L], _frameWalls163[k1_ViewSquare_D3L]._box); + drawField(&_fieldAspects188[kDMViewSquareD3L], _frameWalls163[kDMViewSquareD3L]._box); } void DisplayMan::drawSquareD3R(Direction dir, int16 posX, int16 posY) { @@ -1321,7 +1337,7 @@ void DisplayMan::drawSquareD3R(Direction dir, int16 posX, int16 posY) { Frame(180, 197, 28, 67, 24, 41, 24, 0) /* Right Horizontal Closed three fourth */ ); - int16 order; + CellOrder order; uint16 squareAspect[5]; bool skip = false; @@ -1333,27 +1349,27 @@ void DisplayMan::drawSquareD3R(Direction dir, int16 posX, int16 posY) { else drawFloorPitOrStairsBitmapFlippedHorizontally(_stairsNativeBitmapIndexDownFrontD3L, frameStairsDownFrontD3R); - order = k0x4312_CellOrder_BackRight_BackLeft_FrontRight_FrontLeft; + order = kDMCellOrderBackRightBackLeftFrontRightFrontLeft; /* BUG0_64 Floor ornaments are drawn over open pits. There is no check to prevent drawing floor ornaments over open pits */ drawFloorOrnament(squareAspect[kDMSquareAspectFloorOrn], kDMViewFloorD3R); break; case kDMElementTypeWall: - drawWallSetBitmap(_bitmapWallSetD3LCR, _frameWalls163[k2_ViewSquare_D3R]); + drawWallSetBitmap(_bitmapWallSetD3LCR, _frameWalls163[kDMViewSquareD3R]); isDrawnWallOrnAnAlcove(squareAspect[kDMSquareAspectLeftWallOrnOrd], kDMViewWallD3RLeft); if (isDrawnWallOrnAnAlcove(squareAspect[kDMSquareFrontWallOrnOrd], kDMViewWallD3RFront)) - order = k0x0000_CellOrder_Alcove; + order = kDMCellOrderAlcove; else return; break; case kDMElementTypeDoorSide: case kDMElementTypeStairsSide: - order = k0x0412_CellOrder_BackRight_BackLeft_FrontLeft; + order = kDMCellOrderBackRightBackLeftFrontLeft; /* BUG0_64 Floor ornaments are drawn over open pits. There is no check to prevent drawing floor ornaments over open pits */ drawFloorOrnament(squareAspect[kDMSquareAspectFloorOrn], kDMViewFloorD3R); break; case kDMElementTypeDoorFront: drawFloorOrnament(squareAspect[kDMSquareAspectFloorOrn], kDMViewFloorD3R); - drawObjectsCreaturesProjectilesExplosions(Thing(squareAspect[kDMSquareAspectFirstGroupOrObject]), dir, posX, posY, k2_ViewSquare_D3R, k0x0128_CellOrder_DoorPass1_BackRight_BackLeft); + drawObjectsCreaturesProjectilesExplosions(Thing(squareAspect[kDMSquareAspectFirstGroupOrObject]), dir, posX, posY, kDMViewSquareD3R, kDMCellOrderDoorPass1BackRightBackLeft); memmove(_tmpBitmap, _bitmapWallSetDoorFrameLeftD3L, 32 * 44); drawDoorFrameBitmapFlippedHorizontally(_tmpBitmap, &doorFrameRightD3R); if (((Door *)_vm->_dungeonMan->_thingData[kDMThingTypeDoor])[squareAspect[kDMSquareAspectDoorThingIndex]].hasButton()) @@ -1369,7 +1385,7 @@ void DisplayMan::drawSquareD3R(Direction dir, int16 posX, int16 posY) { // No break on purpose case kDMElementTypeTeleporter: case kDMElementTypeCorridor: - order = k0x4312_CellOrder_BackRight_BackLeft_FrontRight_FrontLeft; + order = kDMCellOrderBackRightBackLeftFrontRightFrontLeft; /* BUG0_64 Floor ornaments are drawn over open pits. There is no check to prevent drawing floor ornaments over open pits */ drawFloorOrnament(squareAspect[kDMSquareAspectFloorOrn], kDMViewFloorD3R); break; @@ -1379,10 +1395,10 @@ void DisplayMan::drawSquareD3R(Direction dir, int16 posX, int16 posY) { } if (!skip) - drawObjectsCreaturesProjectilesExplosions(Thing(squareAspect[kDMSquareAspectFirstGroupOrObject]), dir, posX, posY, k2_ViewSquare_D3R, order); + drawObjectsCreaturesProjectilesExplosions(Thing(squareAspect[kDMSquareAspectFirstGroupOrObject]), dir, posX, posY, kDMViewSquareD3R, order); if ((squareAspect[kDMSquareAspectElement] == kDMElementTypeTeleporter) && squareAspect[kDMSquareAspectTeleporterVisible]) - drawField(&_fieldAspects188[k2_ViewSquare_D3R], _frameWalls163[k2_ViewSquare_D3R]._box); + drawField(&_fieldAspects188[kDMViewSquareD3R], _frameWalls163[kDMViewSquareD3R]._box); } void DisplayMan::drawSquareD3C(Direction dir, int16 posX, int16 posY) { @@ -1406,7 +1422,7 @@ void DisplayMan::drawSquareD3C(Direction dir, int16 posX, int16 posY) { ); uint16 squareAspect[5]; - int16 order; + CellOrder order; bool skip = false; _vm->_dungeonMan->setSquareAspect(squareAspect, dir, posX, posY); @@ -1417,20 +1433,20 @@ void DisplayMan::drawSquareD3C(Direction dir, int16 posX, int16 posY) { else drawFloorPitOrStairsBitmap(_stairsNativeBitmapIndexDownFrontD3C, frameStairsDownFrontD3C); - order = k0x3421_CellOrder_BackLeft_BackRight_FrontLeft_FrontRight; + order = kDMCellOrderBackLeftBackRightFrontLeftFrontRight; drawFloorOrnament(squareAspect[kDMSquareAspectFloorOrn], kDMViewFloorD3C); /* BUG0_64 Floor ornaments are drawn over open pits. There is no check to prevent drawing floor ornaments over open pits */ break; case kDMElementTypeWall: - drawWallSetBitmapWithoutTransparency(_bitmapWallSetD3LCR, _frameWalls163[k0_ViewSquare_D3C]); + drawWallSetBitmapWithoutTransparency(_bitmapWallSetD3LCR, _frameWalls163[kDMViewSquareD3C]); if (isDrawnWallOrnAnAlcove(squareAspect[kDMSquareFrontWallOrnOrd], kDMViewWallD3CFront)) - order = k0x0000_CellOrder_Alcove; + order = kDMCellOrderAlcove; else return; break; case kDMElementTypeDoorFront: drawFloorOrnament(squareAspect[kDMSquareAspectFloorOrn], kDMViewFloorD3C); - drawObjectsCreaturesProjectilesExplosions(Thing(squareAspect[kDMSquareAspectFirstGroupOrObject]), dir, posX, posY, k0_ViewSquare_D3C, k0x0218_CellOrder_DoorPass1_BackLeft_BackRight); + drawObjectsCreaturesProjectilesExplosions(Thing(squareAspect[kDMSquareAspectFirstGroupOrObject]), dir, posX, posY, kDMViewSquareD3C, kDMCellOrderDoorPass1BackLeftBackRight); drawWallSetBitmap(_bitmapWallSetDoorFrameLeftD3C, doorFrameLeftD3C); memmove(_tmpBitmap, _bitmapWallSetDoorFrameLeftD3C, 32 * 44); drawDoorFrameBitmapFlippedHorizontally(_tmpBitmap, &doorFrameRightD3C); @@ -1439,7 +1455,7 @@ void DisplayMan::drawSquareD3C(Direction dir, int16 posX, int16 posY) { drawDoor(squareAspect[kDMSquareAspectDoorThingIndex], (DoorState)squareAspect[kDMSquareAspectDoorState], _doorNativeBitmapIndexFrontD3LCR, getBitmapByteCount(48, 41), kDMDoorOrnamentD3LCR, &doorFrameD3C); - order = k0x0349_CellOrder_DoorPass2_FrontLeft_FrontRight; + order = kDMCellOrderDoorPass2FrontLeftFrontRight; break; case kDMElementTypePit: if (!squareAspect[kDMSquareAspectPitInvisible]) @@ -1447,7 +1463,7 @@ void DisplayMan::drawSquareD3C(Direction dir, int16 posX, int16 posY) { // No break on purpose case kDMElementTypeTeleporter: case kDMElementTypeCorridor: - order = k0x3421_CellOrder_BackLeft_BackRight_FrontLeft_FrontRight; + order = kDMCellOrderBackLeftBackRightFrontLeftFrontRight; drawFloorOrnament(squareAspect[kDMSquareAspectFloorOrn], kDMViewFloorD3C); /* BUG0_64 Floor ornaments are drawn over open pits. There is no check to prevent drawing floor ornaments over open pits */ break; default: @@ -1456,10 +1472,10 @@ void DisplayMan::drawSquareD3C(Direction dir, int16 posX, int16 posY) { } if (!skip) - drawObjectsCreaturesProjectilesExplosions(Thing(squareAspect[kDMSquareAspectFirstGroupOrObject]), dir, posX, posY, k0_ViewSquare_D3C, order); + drawObjectsCreaturesProjectilesExplosions(Thing(squareAspect[kDMSquareAspectFirstGroupOrObject]), dir, posX, posY, kDMViewSquareD3C, order); if ((squareAspect[kDMSquareAspectElement] == kDMElementTypeTeleporter) && squareAspect[kDMSquareAspectTeleporterVisible]) - drawField(&_fieldAspects188[k0_ViewSquare_D3C], _frameWalls163[k0_ViewSquare_D3C]._box); + drawField(&_fieldAspects188[kDMViewSquareD3C], _frameWalls163[kDMViewSquareD3C]._box); } void DisplayMan::drawSquareD2L(Direction dir, int16 posX, int16 posY) { @@ -1483,7 +1499,7 @@ void DisplayMan::drawSquareD2L(Direction dir, int16 posX, int16 posY) { Frame(40, 63, 24, 82, 32, 61, 32, 0) /* Right Horizontal Closed three fourth */ ); - int16 order; + CellOrder order; uint16 squareAspect[5]; bool skip = false; @@ -1495,14 +1511,14 @@ void DisplayMan::drawSquareD2L(Direction dir, int16 posX, int16 posY) { else drawFloorPitOrStairsBitmap(_stairsNativeBitmapIndexDownFrontD2L, frameStairsDownFrontD2L); - order = k0x3421_CellOrder_BackLeft_BackRight_FrontLeft_FrontRight; + order = kDMCellOrderBackLeftBackRightFrontLeftFrontRight; drawFloorOrnament(squareAspect[kDMSquareAspectFloorOrn], kDMViewFloorD2L); /* BUG0_64 Floor ornaments are drawn over open pits. There is no check to prevent drawing floor ornaments over open pits */ break; case kDMElementTypeWall: - drawWallSetBitmap(_bitmapWallSetD2LCR, _frameWalls163[k4_ViewSquare_D2L]); + drawWallSetBitmap(_bitmapWallSetD2LCR, _frameWalls163[kDMViewSquareD2L]); isDrawnWallOrnAnAlcove(squareAspect[kDMSquareAspectRightWallOrnOrd], kDMViewWallD2LRight); if (isDrawnWallOrnAnAlcove(squareAspect[kDMSquareFrontWallOrnOrd], kDMViewWallD2LFront)) - order = k0x0000_CellOrder_Alcove; + order = kDMCellOrderAlcove; else return; break; @@ -1510,16 +1526,16 @@ void DisplayMan::drawSquareD2L(Direction dir, int16 posX, int16 posY) { drawFloorPitOrStairsBitmap(_stairsNativeBitmapIndexSideD2L, frameStairsSideD2L); // No break on purpose case kDMElementTypeDoorSide: - order = k0x0342_CellOrder_BackRight_FrontLeft_FrontRight; + order = kDMCellOrderBackRightFrontLeftFrontRight; drawFloorOrnament(squareAspect[kDMSquareAspectFloorOrn], kDMViewFloorD2L); /* BUG0_64 Floor ornaments are drawn over open pits. There is no check to prevent drawing floor ornaments over open pits */ break; case kDMElementTypeDoorFront: drawFloorOrnament(squareAspect[kDMSquareAspectFloorOrn], kDMViewFloorD2L); - drawObjectsCreaturesProjectilesExplosions(Thing(squareAspect[kDMSquareAspectFirstGroupOrObject]), dir, posX, posY, k4_ViewSquare_D2L, k0x0218_CellOrder_DoorPass1_BackLeft_BackRight); + drawObjectsCreaturesProjectilesExplosions(Thing(squareAspect[kDMSquareAspectFirstGroupOrObject]), dir, posX, posY, kDMViewSquareD2L, kDMCellOrderDoorPass1BackLeftBackRight); drawWallSetBitmap(_bitmapWallSetDoorFrameTopD2LCR, doorFrameTopD2L); drawDoor(squareAspect[kDMSquareAspectDoorThingIndex], (DoorState)squareAspect[kDMSquareAspectDoorState], _doorNativeBitmapIndexFrontD2LCR, getBitmapByteCount(64, 61), kDMDoorOrnamentD2LCR, &doorFrameD2L); - order = k0x0349_CellOrder_DoorPass2_FrontLeft_FrontRight; + order = kDMCellOrderDoorPass2FrontLeftFrontRight; break; case kDMElementTypePit: drawFloorPitOrStairsBitmap(squareAspect[kDMSquareAspectPitInvisible] ? k57_FloorPir_Invisible_D2L_GraphicIndice : k51_FloorPit_D2L_GraphicIndice, @@ -1527,7 +1543,7 @@ void DisplayMan::drawSquareD2L(Direction dir, int16 posX, int16 posY) { // No break on purpose case kDMElementTypeTeleporter: case kDMElementTypeCorridor: - order = k0x3421_CellOrder_BackLeft_BackRight_FrontLeft_FrontRight; + order = kDMCellOrderBackLeftBackRightFrontLeftFrontRight; drawFloorOrnament(squareAspect[kDMSquareAspectFloorOrn], kDMViewFloorD2L); /* BUG0_64 Floor ornaments are drawn over open pits. There is no check to prevent drawing floor ornaments over open pits */ break; @@ -1538,11 +1554,11 @@ void DisplayMan::drawSquareD2L(Direction dir, int16 posX, int16 posY) { if (!skip) { drawCeilingPit(k63_ceilingPit_D2L_GraphicIndice, &FrameCeilingPitD2L, posX, posY, false); - drawObjectsCreaturesProjectilesExplosions(Thing(squareAspect[kDMSquareAspectFirstGroupOrObject]), dir, posX, posY, k4_ViewSquare_D2L, order); + drawObjectsCreaturesProjectilesExplosions(Thing(squareAspect[kDMSquareAspectFirstGroupOrObject]), dir, posX, posY, kDMViewSquareD2L, order); } if ((squareAspect[kDMSquareAspectElement] == kDMElementTypeTeleporter) && squareAspect[kDMSquareAspectTeleporterVisible]) - drawField(&_fieldAspects188[k4_ViewSquare_D2L], _frameWalls163[k4_ViewSquare_D2L]._box); + drawField(&_fieldAspects188[kDMViewSquareD2L], _frameWalls163[kDMViewSquareD2L]._box); } void DisplayMan::drawSquareD2R(Direction dir, int16 posX, int16 posY) { @@ -1566,7 +1582,7 @@ void DisplayMan::drawSquareD2R(Direction dir, int16 posX, int16 posY) { Frame(200, 223, 24, 82, 32, 61, 32, 0) /* Right Horizontal Closed three fourth */ ); - int16 order; + CellOrder order; uint16 squareAspect[5]; bool skip = false; @@ -1578,16 +1594,16 @@ void DisplayMan::drawSquareD2R(Direction dir, int16 posX, int16 posY) { else drawFloorPitOrStairsBitmapFlippedHorizontally(_stairsNativeBitmapIndexDownFrontD2L, frameStairsDownFrontD2R); - order = k0x4312_CellOrder_BackRight_BackLeft_FrontRight_FrontLeft; + order = kDMCellOrderBackRightBackLeftFrontRightFrontLeft; /* BUG0_64 Floor ornaments are drawn over open pits. There is no check to prevent drawing floor ornaments over open pits */ drawFloorOrnament(squareAspect[kDMSquareAspectFloorOrn], kDMViewFloorD2R); drawCeilingPit(k63_ceilingPit_D2L_GraphicIndice, &frameCeilingPitD2R, posX, posY, true); break; case kDMElementTypeWall: - drawWallSetBitmap(_bitmapWallSetD2LCR, _frameWalls163[k5_ViewSquare_D2R]); + drawWallSetBitmap(_bitmapWallSetD2LCR, _frameWalls163[kDMViewSquareD2R]); isDrawnWallOrnAnAlcove(squareAspect[kDMSquareAspectLeftWallOrnOrd], kDMViewWallD2RLeft); if (isDrawnWallOrnAnAlcove(squareAspect[kDMSquareFrontWallOrnOrd], kDMViewWallD2RFront)) - order = k0x0000_CellOrder_Alcove; + order = kDMCellOrderAlcove; else return; break; @@ -1595,18 +1611,18 @@ void DisplayMan::drawSquareD2R(Direction dir, int16 posX, int16 posY) { drawFloorPitOrStairsBitmapFlippedHorizontally(_stairsNativeBitmapIndexSideD2L, frameStairsSideD2R); // No break on purpose case kDMElementTypeDoorSide: - order = k0x0431_CellOrder_BackLeft_FrontRight_FrontLeft; + order = kDMCellOrderBackLeftFrontRightFrontLeft; /* BUG0_64 Floor ornaments are drawn over open pits. There is no check to prevent drawing floor ornaments over open pits */ drawFloorOrnament(squareAspect[kDMSquareAspectFloorOrn], kDMViewFloorD2R); drawCeilingPit(k63_ceilingPit_D2L_GraphicIndice, &frameCeilingPitD2R, posX, posY, true); break; case kDMElementTypeDoorFront: drawFloorOrnament(squareAspect[kDMSquareAspectFloorOrn], kDMViewFloorD2R); - drawObjectsCreaturesProjectilesExplosions(Thing(squareAspect[kDMSquareAspectFirstGroupOrObject]), dir, posX, posY, k5_ViewSquare_D2R, k0x0128_CellOrder_DoorPass1_BackRight_BackLeft); + drawObjectsCreaturesProjectilesExplosions(Thing(squareAspect[kDMSquareAspectFirstGroupOrObject]), dir, posX, posY, kDMViewSquareD2R, kDMCellOrderDoorPass1BackRightBackLeft); drawWallSetBitmap(_bitmapWallSetDoorFrameTopD2LCR, doorFrameTopD2R); drawDoor(squareAspect[kDMSquareAspectDoorThingIndex], (DoorState)squareAspect[kDMSquareAspectDoorState], _doorNativeBitmapIndexFrontD2LCR, getBitmapByteCount(64, 61), kDMDoorOrnamentD2LCR, &doorFrameD2R); - order = k0x0439_CellOrder_DoorPass2_FrontRight_FrontLeft; + order = kDMCellOrderDoorPass2FrontRightFrontLeft; break; case kDMElementTypePit: drawFloorPitOrStairsBitmapFlippedHorizontally( @@ -1614,7 +1630,7 @@ void DisplayMan::drawSquareD2R(Direction dir, int16 posX, int16 posY) { // No break on purpose case kDMElementTypeTeleporter: case kDMElementTypeCorridor: - order = k0x4312_CellOrder_BackRight_BackLeft_FrontRight_FrontLeft; + order = kDMCellOrderBackRightBackLeftFrontRightFrontLeft; /* BUG0_64 Floor ornaments are drawn over open pits. There is no check to prevent drawing floor ornaments over open pits */ drawFloorOrnament(squareAspect[kDMSquareAspectFloorOrn], kDMViewFloorD2R); drawCeilingPit(k63_ceilingPit_D2L_GraphicIndice, &frameCeilingPitD2R, posX, posY, true); @@ -1625,10 +1641,10 @@ void DisplayMan::drawSquareD2R(Direction dir, int16 posX, int16 posY) { } if (!skip) - drawObjectsCreaturesProjectilesExplosions(Thing(squareAspect[kDMSquareAspectFirstGroupOrObject]), dir, posX, posY, k5_ViewSquare_D2R, order); + drawObjectsCreaturesProjectilesExplosions(Thing(squareAspect[kDMSquareAspectFirstGroupOrObject]), dir, posX, posY, kDMViewSquareD2R, order); if ((squareAspect[kDMSquareAspectElement] == kDMElementTypeTeleporter) && squareAspect[kDMSquareAspectTeleporterVisible]) - drawField(&_fieldAspects188[k5_ViewSquare_D2R], _frameWalls163[k5_ViewSquare_D2R]._box); + drawField(&_fieldAspects188[kDMViewSquareD2R], _frameWalls163[kDMViewSquareD2R]._box); } void DisplayMan::drawSquareD2C(Direction dir, int16 posX, int16 posY) { @@ -1653,7 +1669,7 @@ void DisplayMan::drawSquareD2C(Direction dir, int16 posX, int16 posY) { Frame(120, 143, 24, 82, 32, 61, 32, 0) /* Right Horizontal Closed three fourth */ ); - int16 order; + CellOrder order; uint16 squareAspect[5]; bool skip = false; @@ -1665,21 +1681,21 @@ void DisplayMan::drawSquareD2C(Direction dir, int16 posX, int16 posY) { else drawFloorPitOrStairsBitmap(_stairsNativeBitmapIndexDownFrontD2C, frameStairsDownFrontD2C); - order = k0x3421_CellOrder_BackLeft_BackRight_FrontLeft_FrontRight; + order = kDMCellOrderBackLeftBackRightFrontLeftFrontRight; /* BUG0_64 Floor ornaments are drawn over open pits. There is no check to prevent drawing floor ornaments over open pits */ drawFloorOrnament(squareAspect[kDMSquareAspectFloorOrn], kDMViewFloorD2C); drawCeilingPit(k64_ceilingPitD2C_GraphicIndice, &frameCeilingPitD2C, posX, posY, false); break; case kDMElementTypeWall: - drawWallSetBitmapWithoutTransparency(_bitmapWallSetD2LCR, _frameWalls163[k3_ViewSquare_D2C]); + drawWallSetBitmapWithoutTransparency(_bitmapWallSetD2LCR, _frameWalls163[kDMViewSquareD2C]); if (isDrawnWallOrnAnAlcove(squareAspect[kDMSquareFrontWallOrnOrd], kDMViewWallD2CFront)) - order = k0x0000_CellOrder_Alcove; + order = kDMCellOrderAlcove; else return; break; case kDMElementTypeDoorFront: drawFloorOrnament(squareAspect[kDMSquareAspectFloorOrn], kDMViewFloorD2C); - drawObjectsCreaturesProjectilesExplosions(Thing(squareAspect[kDMSquareAspectFirstGroupOrObject]), dir, posX, posY, k3_ViewSquare_D2C, k0x0218_CellOrder_DoorPass1_BackLeft_BackRight); + drawObjectsCreaturesProjectilesExplosions(Thing(squareAspect[kDMSquareAspectFirstGroupOrObject]), dir, posX, posY, kDMViewSquareD2C, kDMCellOrderDoorPass1BackLeftBackRight); drawWallSetBitmap(_bitmapWallSetDoorFrameTopD2LCR, doorFrameTopD2C); drawWallSetBitmap(_bitmapWallSetDoorFrameLeftD2C, doorFrameLeftD2C); memcpy(_tmpBitmap, _bitmapWallSetDoorFrameLeftD2C, 48 * 65); @@ -1689,14 +1705,14 @@ void DisplayMan::drawSquareD2C(Direction dir, int16 posX, int16 posY) { drawDoor(squareAspect[kDMSquareAspectDoorThingIndex], (DoorState)squareAspect[kDMSquareAspectDoorState], _doorNativeBitmapIndexFrontD2LCR, getBitmapByteCount(64, 61), kDMDoorOrnamentD2LCR, &doorFrameD2C); - order = k0x0349_CellOrder_DoorPass2_FrontLeft_FrontRight; + order = kDMCellOrderDoorPass2FrontLeftFrontRight; break; case kDMElementTypePit: drawFloorPitOrStairsBitmap(squareAspect[kDMSquareAspectPitInvisible] ? k58_FloorPit_invisible_D2C_GraphicIndice : k52_FloorPit_D2C_GraphicIndice, frameFloorPitD2C); // No break on purpose case kDMElementTypeTeleporter: case kDMElementTypeCorridor: - order = k0x3421_CellOrder_BackLeft_BackRight_FrontLeft_FrontRight; + order = kDMCellOrderBackLeftBackRightFrontLeftFrontRight; /* BUG0_64 Floor ornaments are drawn over open pits. There is no check to prevent drawing floor ornaments over open pits */ drawFloorOrnament(squareAspect[kDMSquareAspectFloorOrn], kDMViewFloorD2C); drawCeilingPit(k64_ceilingPitD2C_GraphicIndice, &frameCeilingPitD2C, posX, posY, false); @@ -1707,10 +1723,10 @@ void DisplayMan::drawSquareD2C(Direction dir, int16 posX, int16 posY) { } if (!skip) - drawObjectsCreaturesProjectilesExplosions(Thing(squareAspect[kDMSquareAspectFirstGroupOrObject]), dir, posX, posY, k3_ViewSquare_D2C, order); + drawObjectsCreaturesProjectilesExplosions(Thing(squareAspect[kDMSquareAspectFirstGroupOrObject]), dir, posX, posY, kDMViewSquareD2C, order); if ((squareAspect[kDMSquareAspectElement] == kDMElementTypeTeleporter) && squareAspect[kDMSquareAspectTeleporterVisible]) - drawField(&_fieldAspects188[k3_ViewSquare_D2C], _frameWalls163[k3_ViewSquare_D2C]._box); + drawField(&_fieldAspects188[kDMViewSquareD2C], _frameWalls163[kDMViewSquareD2C]._box); } void DisplayMan::drawSquareD1L(Direction dir, int16 posX, int16 posY) { @@ -1735,7 +1751,7 @@ void DisplayMan::drawSquareD1L(Direction dir, int16 posX, int16 posY) { Frame(0, 31, 17, 102, 48, 88, 52, 0) /* Right Horizontal Closed three fourth */ ); - int16 order; + CellOrder order; uint16 squareAspect[5]; bool skip = false; @@ -1747,13 +1763,13 @@ void DisplayMan::drawSquareD1L(Direction dir, int16 posX, int16 posY) { else drawFloorPitOrStairsBitmap(_stairsNativeBitmapIndexDownFrontD1L, frameStairsDownFrontD1L); - order = k0x0032_CellOrder_BackRight_FrontRight; + order = kDMCellOrderBackRightFrontRight; /* BUG0_64 Floor ornaments are drawn over open pits. There is no check to prevent drawing floor ornaments over open pits */ drawFloorOrnament(squareAspect[kDMSquareAspectFloorOrn], kDMViewFloorD1L); drawCeilingPit(k65_ceilingPitD1L_GraphicIndice, &frameCeilingPitD1L, posX, posY, false); break; case kDMElementTypeWall: - drawWallSetBitmap(_bitmapWallSetD1LCR, _frameWalls163[k7_ViewSquare_D1L]); + drawWallSetBitmap(_bitmapWallSetD1LCR, _frameWalls163[kDMViewSquareD1L]); isDrawnWallOrnAnAlcove(squareAspect[kDMSquareAspectRightWallOrnOrd], kDMViewWallD1LRight); return; case kDMElementTypeStairsSide: @@ -1763,25 +1779,25 @@ void DisplayMan::drawSquareD1L(Direction dir, int16 posX, int16 posY) { drawFloorPitOrStairsBitmap(_stairsNativeBitmapIndexDownSideD1L, frameStairsDownSideD1L); // No break on purpose case kDMElementTypeDoorSide: - order = k0x0032_CellOrder_BackRight_FrontRight; + order = kDMCellOrderBackRightFrontRight; /* BUG0_64 Floor ornaments are drawn over open pits. There is no check to prevent drawing floor ornaments over open pits */ drawFloorOrnament(squareAspect[kDMSquareAspectFloorOrn], kDMViewFloorD1L); drawCeilingPit(k65_ceilingPitD1L_GraphicIndice, &frameCeilingPitD1L, posX, posY, false); break; case kDMElementTypeDoorFront: drawFloorOrnament(squareAspect[kDMSquareAspectFloorOrn], kDMViewFloorD1L); - drawObjectsCreaturesProjectilesExplosions(Thing(squareAspect[kDMSquareAspectFirstGroupOrObject]), dir, posX, posY, k7_ViewSquare_D1L, k0x0028_CellOrder_DoorPass1_BackRight); + drawObjectsCreaturesProjectilesExplosions(Thing(squareAspect[kDMSquareAspectFirstGroupOrObject]), dir, posX, posY, kDMViewSquareD1L, kDMCellOrderDoorPass1BackRight); drawWallSetBitmap(_bitmapWallSetDoorFrameTopD1LCR, doorFrameTopD1L); drawDoor(squareAspect[kDMSquareAspectDoorThingIndex], (DoorState)squareAspect[kDMSquareAspectDoorState], _doorNativeBitmapIndexFrontD1LCR, getBitmapByteCount(96, 88), kDMDoorOrnamentD1LCR, &doorFrameD1L); - order = k0x0039_CellOrder_DoorPass2_FrontRight; + order = kDMCellOrderDoorPass2FrontRight; break; case kDMElementTypePit: drawFloorPitOrStairsBitmap(squareAspect[kDMSquareAspectPitInvisible] ? k59_floorPit_invisible_D1L_GraphicIndice : k53_FloorPit_D1L_GraphicIndice, frameFloorPitD1L); // No break on purpose case kDMElementTypeTeleporter: case kDMElementTypeCorridor: - order = k0x0032_CellOrder_BackRight_FrontRight; + order = kDMCellOrderBackRightFrontRight; /* BUG0_64 Floor ornaments are drawn over open pits. There is no check to prevent drawing floor ornaments over open pits */ drawFloorOrnament(squareAspect[kDMSquareAspectFloorOrn], kDMViewFloorD1L); drawCeilingPit(k65_ceilingPitD1L_GraphicIndice, &frameCeilingPitD1L, posX, posY, false); @@ -1792,10 +1808,10 @@ void DisplayMan::drawSquareD1L(Direction dir, int16 posX, int16 posY) { } if (!skip) - drawObjectsCreaturesProjectilesExplosions(Thing(squareAspect[kDMSquareAspectFirstGroupOrObject]), dir, posX, posY, k7_ViewSquare_D1L, order); + drawObjectsCreaturesProjectilesExplosions(Thing(squareAspect[kDMSquareAspectFirstGroupOrObject]), dir, posX, posY, kDMViewSquareD1L, order); if ((squareAspect[kDMSquareAspectElement] == kDMElementTypeTeleporter) && squareAspect[kDMSquareAspectTeleporterVisible]) - drawField(&_fieldAspects188[k7_ViewSquare_D1L], _frameWalls163[k7_ViewSquare_D1L]._box); + drawField(&_fieldAspects188[kDMViewSquareD1L], _frameWalls163[kDMViewSquareD1L]._box); } void DisplayMan::drawSquareD1R(Direction dir, int16 posX, int16 posY) { @@ -1820,7 +1836,7 @@ void DisplayMan::drawSquareD1R(Direction dir, int16 posX, int16 posY) { Frame(0, 0, 0, 0, 0, 0, 0, 0) /* Right Horizontal Closed three fourth */ ); - int16 order; + CellOrder order; uint16 squareAspect[5]; bool skip = false; @@ -1832,12 +1848,12 @@ void DisplayMan::drawSquareD1R(Direction dir, int16 posX, int16 posY) { else drawFloorPitOrStairsBitmapFlippedHorizontally(_stairsNativeBitmapIndexDownFrontD1L, frameStairsDownFrontD1R); - order = k0x0041_CellOrder_BackLeft_FrontLeft; + order = kDMCellOrderBackLeftFrontLeft; drawFloorOrnament(squareAspect[kDMSquareAspectFloorOrn], kDMViewFloorD1R); /* 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 kDMElementTypeWall: - drawWallSetBitmap(_bitmapWallSetD1LCR, _frameWalls163[k8_ViewSquare_D1R]); + drawWallSetBitmap(_bitmapWallSetD1LCR, _frameWalls163[kDMViewSquareD1R]); isDrawnWallOrnAnAlcove(squareAspect[kDMSquareAspectLeftWallOrnOrd], kDMViewWallD1RLeft); return; case kDMElementTypeStairsSide: @@ -1848,17 +1864,17 @@ void DisplayMan::drawSquareD1R(Direction dir, int16 posX, int16 posY) { // No break on purpose case kDMElementTypeDoorSide: - order = k0x0041_CellOrder_BackLeft_FrontLeft; + order = kDMCellOrderBackLeftFrontLeft; drawFloorOrnament(squareAspect[kDMSquareAspectFloorOrn], kDMViewFloorD1R); /* 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 kDMElementTypeDoorFront: drawFloorOrnament(squareAspect[kDMSquareAspectFloorOrn], kDMViewFloorD1R); - drawObjectsCreaturesProjectilesExplosions(Thing(squareAspect[kDMSquareAspectFirstGroupOrObject]), dir, posX, posY, k8_ViewSquare_D1R, k0x0018_CellOrder_DoorPass1_BackLeft); + drawObjectsCreaturesProjectilesExplosions(Thing(squareAspect[kDMSquareAspectFirstGroupOrObject]), dir, posX, posY, kDMViewSquareD1R, kDMCellOrderDoorPass1BackLeft); drawWallSetBitmap(_bitmapWallSetDoorFrameTopD1LCR, doorFrameTopD1R); drawDoor(squareAspect[kDMSquareAspectDoorThingIndex], (DoorState)squareAspect[kDMSquareAspectDoorState], _doorNativeBitmapIndexFrontD1LCR, getBitmapByteCount(96, 88), kDMDoorOrnamentD1LCR, &doorFrameD1R); - order = k0x0049_CellOrder_DoorPass2_FrontLeft; + order = kDMCellOrderDoorPass2FrontLeft; break; case kDMElementTypePit: drawFloorPitOrStairsBitmapFlippedHorizontally(squareAspect[kDMSquareAspectPitInvisible] ? k59_floorPit_invisible_D1L_GraphicIndice @@ -1866,7 +1882,7 @@ void DisplayMan::drawSquareD1R(Direction dir, int16 posX, int16 posY) { // No break on purpose case kDMElementTypeTeleporter: case kDMElementTypeCorridor: - order = k0x0041_CellOrder_BackLeft_FrontLeft; + order = kDMCellOrderBackLeftFrontLeft; drawFloorOrnament(squareAspect[kDMSquareAspectFloorOrn], kDMViewFloorD1R); /* 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; @@ -1876,10 +1892,10 @@ void DisplayMan::drawSquareD1R(Direction dir, int16 posX, int16 posY) { } if (!skip) - drawObjectsCreaturesProjectilesExplosions(Thing(squareAspect[kDMSquareAspectFirstGroupOrObject]), dir, posX, posY, k8_ViewSquare_D1R, order); + drawObjectsCreaturesProjectilesExplosions(Thing(squareAspect[kDMSquareAspectFirstGroupOrObject]), dir, posX, posY, kDMViewSquareD1R, order); if ((squareAspect[kDMSquareAspectElement] == kDMElementTypeTeleporter) && squareAspect[kDMSquareAspectTeleporterVisible]) - drawField(&_fieldAspects188[k8_ViewSquare_D1R], _frameWalls163[k8_ViewSquare_D1R]._box); + drawField(&_fieldAspects188[kDMViewSquareD1R], _frameWalls163[kDMViewSquareD1R]._box); } void DisplayMan::drawSquareD1C(Direction dir, int16 posX, int16 posY) { @@ -1890,7 +1906,7 @@ void DisplayMan::drawSquareD1C(Direction dir, int16 posX, int16 posY) { static Frame frameCeilingPitD1C = Frame(32, 191, 8, 16, 80, 9, 0, 0); // @ G0156_s_Graphic558_Frame_CeilingPit_D1C static Box boxThievesEyeVisibleArea(0, 95, 0, 94); // @ G0107_s_Graphic558_Box_ThievesEye_VisibleArea - int16 order; + CellOrder order; uint16 squareAspect[5]; bool skip = false; @@ -1902,7 +1918,7 @@ void DisplayMan::drawSquareD1C(Direction dir, int16 posX, int16 posY) { else drawFloorPitOrStairsBitmap(_stairsNativeBitmapIndexDownFrontD1C, frameStairsDownFrontD1C); - order = k0x3421_CellOrder_BackLeft_BackRight_FrontLeft_FrontRight; + order = kDMCellOrderBackLeftBackRightFrontLeftFrontRight; /* BUG0_64 Floor ornaments are drawn over open pits. There is no check to prevent drawing floor ornaments over open pits */ drawFloorOrnament(squareAspect[kDMSquareAspectFloorOrn], kDMViewFloorD1C); drawCeilingPit(k66_ceilingPitD1C_GraphicIndice, &frameCeilingPitD1C, posX, posY, false); @@ -1912,29 +1928,29 @@ void DisplayMan::drawSquareD1C(Direction dir, int16 posX, int16 posY) { _vm->_dungeonMan->_isFacingViAltar = false; _vm->_dungeonMan->_isFacingFountain = false; if (_vm->_championMan->_party._event73Count_ThievesEye) { - isDerivedBitmapInCache(k1_DerivedBitmapThievesEyeVisibleArea); - blitToBitmap(_bitmapViewport, getDerivedBitmap(k1_DerivedBitmapThievesEyeVisibleArea), + isDerivedBitmapInCache(kDMDerivedBitmapThievesEyeVisibleArea); + blitToBitmap(_bitmapViewport, getDerivedBitmap(kDMDerivedBitmapThievesEyeVisibleArea), boxThievesEyeVisibleArea, _boxThievesEyeViewPortVisibleArea._x1, _boxThievesEyeViewPortVisibleArea._y1, - k112_byteWidthViewport, 48, kM1_ColorNoTransparency, 136, 95); + k112_byteWidthViewport, 48, kDMColorNoTransparency, 136, 95); byte *bitmap = getNativeBitmapOrGraphic(k41_holeInWall_GraphicIndice); - blitToBitmap(bitmap, getDerivedBitmap(k1_DerivedBitmapThievesEyeVisibleArea), - boxThievesEyeVisibleArea, 0, 0, 48, 48, k10_ColorFlesh, 95, 95); + blitToBitmap(bitmap, getDerivedBitmap(kDMDerivedBitmapThievesEyeVisibleArea), + boxThievesEyeVisibleArea, 0, 0, 48, 48, kDMColorFlesh, 95, 95); } - drawWallSetBitmapWithoutTransparency(_bitmapWallSetD1LCR, _frameWalls163[k6_ViewSquare_D1C]); + drawWallSetBitmapWithoutTransparency(_bitmapWallSetD1LCR, _frameWalls163[kDMViewSquareD1C]); if (isDrawnWallOrnAnAlcove(squareAspect[kDMSquareFrontWallOrnOrd], kDMViewWallD1CFront)) - drawObjectsCreaturesProjectilesExplosions(Thing(squareAspect[kDMSquareAspectFirstGroupOrObject]), dir, posX, posY, k6_ViewSquare_D1C, k0x0000_CellOrder_Alcove); + drawObjectsCreaturesProjectilesExplosions(Thing(squareAspect[kDMSquareAspectFirstGroupOrObject]), dir, posX, posY, kDMViewSquareD1C, kDMCellOrderAlcove); if (_vm->_championMan->_party._event73Count_ThievesEye) { - blitToBitmap(getDerivedBitmap(k1_DerivedBitmapThievesEyeVisibleArea), + blitToBitmap(getDerivedBitmap(kDMDerivedBitmapThievesEyeVisibleArea), _bitmapViewport, _boxThievesEyeViewPortVisibleArea, 0, 0, - 48, k112_byteWidthViewport, k9_ColorGold, 95, k136_heightViewport); /* BUG0_74 */ - addDerivedBitmap(k1_DerivedBitmapThievesEyeVisibleArea); - releaseBlock(k1_DerivedBitmapThievesEyeVisibleArea | 0x8000); + 48, k112_byteWidthViewport, kDMColorGold, 95, k136_heightViewport); /* BUG0_74 */ + addDerivedBitmap(kDMDerivedBitmapThievesEyeVisibleArea); + releaseBlock(kDMDerivedBitmapThievesEyeVisibleArea | 0x8000); } return; case kDMElementTypeDoorFront: drawFloorOrnament(squareAspect[kDMSquareAspectFloorOrn], kDMViewFloorD1C); - drawObjectsCreaturesProjectilesExplosions(Thing(squareAspect[kDMSquareAspectFirstGroupOrObject]), dir, posX, posY, k6_ViewSquare_D1C, k0x0218_CellOrder_DoorPass1_BackLeft_BackRight); + drawObjectsCreaturesProjectilesExplosions(Thing(squareAspect[kDMSquareAspectFirstGroupOrObject]), dir, posX, posY, kDMViewSquareD1C, kDMCellOrderDoorPass1BackLeftBackRight); drawWallSetBitmap(_bitmapWallSetDoorFrameTopD1LCR, doorFrameTopD1C); drawWallSetBitmap(_bitmapWallSetDoorFrameLeftD1C, _doorFrameLeftD1C); drawWallSetBitmap(_bitmapWallSetDoorFrameRightD1C, _doorFrameRightD1C); @@ -1943,14 +1959,14 @@ void DisplayMan::drawSquareD1C(Direction dir, int16 posX, int16 posY) { drawDoor(squareAspect[kDMSquareAspectDoorThingIndex], (DoorState)squareAspect[kDMSquareAspectDoorState], _doorNativeBitmapIndexFrontD1LCR, getBitmapByteCount(96, 88), kDMDoorOrnamentD1LCR, _doorFrameD1C); - order = k0x0349_CellOrder_DoorPass2_FrontLeft_FrontRight; + order = kDMCellOrderDoorPass2FrontLeftFrontRight; break; case kDMElementTypePit: drawFloorPitOrStairsBitmap(squareAspect[kDMSquareAspectPitInvisible] ? k60_floorPitInvisibleD1C_GraphicIndice : k54_FloorPit_D1C_GraphicIndice, frameFloorPitD1C); // No break on purpose case kDMElementTypeTeleporter: case kDMElementTypeCorridor: - order = k0x3421_CellOrder_BackLeft_BackRight_FrontLeft_FrontRight; + order = kDMCellOrderBackLeftBackRightFrontLeftFrontRight; /* BUG0_64 Floor ornaments are drawn over open pits. There is no check to prevent drawing floor ornaments over open pits */ drawFloorOrnament(squareAspect[kDMSquareAspectFloorOrn], kDMViewFloorD1C); drawCeilingPit(k66_ceilingPitD1C_GraphicIndice, &frameCeilingPitD1C, posX, posY, false); @@ -1961,10 +1977,10 @@ void DisplayMan::drawSquareD1C(Direction dir, int16 posX, int16 posY) { } if (!skip) - drawObjectsCreaturesProjectilesExplosions(Thing(squareAspect[kDMSquareAspectFirstGroupOrObject]), dir, posX, posY, k6_ViewSquare_D1C, order); + drawObjectsCreaturesProjectilesExplosions(Thing(squareAspect[kDMSquareAspectFirstGroupOrObject]), dir, posX, posY, kDMViewSquareD1C, order); if ((squareAspect[kDMSquareAspectElement] == kDMElementTypeTeleporter) && squareAspect[kDMSquareAspectTeleporterVisible]) - drawField(&_fieldAspects188[k6_ViewSquare_D1C], _frameWalls163[k6_ViewSquare_D1C]._box); + drawField(&_fieldAspects188[kDMViewSquareD1C], _frameWalls163[kDMViewSquareD1C]._box); } void DisplayMan::drawSquareD0L(Direction dir, int16 posX, int16 posY) { @@ -1976,12 +1992,12 @@ void DisplayMan::drawSquareD0L(Direction dir, int16 posX, int16 posY) { _vm->_dungeonMan->setSquareAspect(squareAspect, dir, posX, posY); switch (squareAspect[kDMSquareAspectElement]) { case kDMElementTypeWall: - drawWallSetBitmap(bitmapWallSetWallD0L, _frameWalls163[k10_ViewSquare_D0L]); + drawWallSetBitmap(bitmapWallSetWallD0L, _frameWalls163[kDMViewSquareD0L]); break; case kDMElementTypeCorridor: case kDMElementTypeTeleporter: case kDMElementTypeDoorSide: - drawObjectsCreaturesProjectilesExplosions(Thing(squareAspect[kDMSquareAspectFirstGroupOrObject]), dir, posX, posY, k10_ViewSquare_D0L, k0x0002_CellOrder_BackRight); + drawObjectsCreaturesProjectilesExplosions(Thing(squareAspect[kDMSquareAspectFirstGroupOrObject]), dir, posX, posY, kDMViewSquareD0L, kDMCellOrderBackRight); break; case kDMElementTypePit: drawFloorPitOrStairsBitmap(squareAspect[kDMSquareAspectPitInvisible] ? k61_floorPitInvisibleD0L_GraphicIndice : k55_FloorPit_D0L_GraphicIndice, frameFloorPitD0L); @@ -1995,7 +2011,7 @@ void DisplayMan::drawSquareD0L(Direction dir, int16 posX, int16 posY) { drawCeilingPit(k67_ceilingPitD0L_grahicIndice, &frameCeilingPitD0L, posX, posY, false); if ((squareAspect[kDMSquareAspectElement] == kDMElementTypeTeleporter) && squareAspect[kDMSquareAspectTeleporterVisible]) - drawField(&_fieldAspects188[k10_ViewSquare_D0L], _frameWalls163[k10_ViewSquare_D0L]._box); + drawField(&_fieldAspects188[kDMViewSquareD0L], _frameWalls163[kDMViewSquareD0L]._box); } void DisplayMan::drawSquareD0R(Direction dir, int16 posX, int16 posY) { @@ -2017,14 +2033,14 @@ void DisplayMan::drawSquareD0R(Direction dir, int16 posX, int16 posY) { 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); + drawObjectsCreaturesProjectilesExplosions(Thing(squareAspect[kDMSquareAspectFirstGroupOrObject]), dir, posX, posY, kDMViewSquareD0R, kDMCellOrderBackLeft); break; case kDMElementTypeWall: - drawWallSetBitmap(_bitmapWallSetWallD0R, _frameWalls163[k11_ViewSquare_D0R]); + drawWallSetBitmap(_bitmapWallSetWallD0R, _frameWalls163[kDMViewSquareD0R]); return; } if ((squareAspect[kDMSquareAspectElement] == kDMElementTypeTeleporter) && squareAspect[kDMSquareAspectTeleporterVisible]) - drawField(&_fieldAspects188[k11_ViewSquare_D0R], _frameWalls163[k11_ViewSquare_D0R]._box); + drawField(&_fieldAspects188[kDMViewSquareD0R], _frameWalls163[kDMViewSquareD0R]._box); } void DisplayMan::drawSquareD0C(Direction dir, int16 posX, int16 posY) { @@ -2046,7 +2062,7 @@ void DisplayMan::drawSquareD0C(Direction dir, int16 posX, int16 posY) { memmove(_tmpBitmap, _bitmapWallSetDoorFrameFront, 32 * 123); blitToBitmap(getNativeBitmapOrGraphic(k41_holeInWall_GraphicIndice), _tmpBitmap, boxThievesEyeHoleInDoorFrame, doorFrameD0C._box._x1 - _boxThievesEyeViewPortVisibleArea._x1, - 0, 48, 16, k9_ColorGold, 95, 123); + 0, 48, 16, kDMColorGold, 95, 123); drawWallSetBitmap(_tmpBitmap, doorFrameD0C); } else drawWallSetBitmap(_bitmapWallSetDoorFrameFront, doorFrameD0C); @@ -2065,9 +2081,9 @@ void DisplayMan::drawSquareD0C(Direction dir, int16 posX, int16 posY) { break; } drawCeilingPit(k68_ceilingPitD0C_graphicIndice, &frameCeilingPitD0C, posX, posY, false); - drawObjectsCreaturesProjectilesExplosions(Thing(squareAspect[kDMSquareAspectFirstGroupOrObject]), dir, posX, posY, k9_ViewSquare_D0C, k0x0021_CellOrder_BackLeft_BackRight); + drawObjectsCreaturesProjectilesExplosions(Thing(squareAspect[kDMSquareAspectFirstGroupOrObject]), dir, posX, posY, kDMViewSquareD0C, kDMCellOrderBackLeftBackRight); if ((squareAspect[kDMSquareAspectElement] == kDMElementTypeTeleporter) && squareAspect[kDMSquareAspectTeleporterVisible]) - drawField(&_fieldAspects188[k9_ViewSquare_D0C], _frameWalls163[k9_ViewSquare_D0C]._box); + drawField(&_fieldAspects188[kDMViewSquareD0C], _frameWalls163[kDMViewSquareD0C]._box); } void DisplayMan::drawDungeon(Direction dir, int16 posX, int16 posY) { @@ -2111,15 +2127,15 @@ void DisplayMan::drawDungeon(Direction dir, int16 posX, int16 posY) { int16 tmpPosX = posX; int16 tmpPosY = posY; _vm->_dungeonMan->mapCoordsAfterRelMovement(dir, 4, -1, tmpPosX, tmpPosY); - drawObjectsCreaturesProjectilesExplosions(_vm->_dungeonMan->getSquareFirstObject(tmpPosX, tmpPosY), dir, tmpPosX, tmpPosY, kM2_ViewSquare_D4L, k0x0001_CellOrder_BackLeft); + drawObjectsCreaturesProjectilesExplosions(_vm->_dungeonMan->getSquareFirstObject(tmpPosX, tmpPosY), dir, tmpPosX, tmpPosY, kViewSquareD4L, kDMCellOrderBackLeft); tmpPosX = posX; tmpPosY = posY; _vm->_dungeonMan->mapCoordsAfterRelMovement(dir, 4, 1, tmpPosX, tmpPosY); - drawObjectsCreaturesProjectilesExplosions(_vm->_dungeonMan->getSquareFirstObject(tmpPosX, tmpPosY), dir, tmpPosX, tmpPosY, kM1_ViewSquare_D4R, k0x0001_CellOrder_BackLeft); + drawObjectsCreaturesProjectilesExplosions(_vm->_dungeonMan->getSquareFirstObject(tmpPosX, tmpPosY), dir, tmpPosX, tmpPosY, kDMViewSquareD4R, kDMCellOrderBackLeft); tmpPosX = posX; tmpPosY = posY; _vm->_dungeonMan->mapCoordsAfterRelMovement(dir, 4, 0, tmpPosX, tmpPosY); - drawObjectsCreaturesProjectilesExplosions(_vm->_dungeonMan->getSquareFirstObject(tmpPosX, tmpPosY), dir, tmpPosX, tmpPosY, kM3_ViewSquare_D4C, k0x0001_CellOrder_BackLeft); + drawObjectsCreaturesProjectilesExplosions(_vm->_dungeonMan->getSquareFirstObject(tmpPosX, tmpPosY), dir, tmpPosX, tmpPosY, kDMViewSquareD4C, kDMCellOrderBackLeft); tmpPosX = posX; tmpPosY = posY; _vm->_dungeonMan->mapCoordsAfterRelMovement(dir, 3, -1, tmpPosX, tmpPosY); @@ -2181,7 +2197,7 @@ void DisplayMan::drawDungeon(Direction dir, int16 posX, int16 posY) { void DisplayMan::drawFloorAndCeiling() { Box box(0, 223, 0, 36); - fillBoxBitmap(_bitmapViewport, box, k0_ColorBlack, k112_byteWidthViewport, k136_heightViewport); + fillBoxBitmap(_bitmapViewport, box, kDMColorBlack, k112_byteWidthViewport, k136_heightViewport); _drawFloorAndCeilingRequested = false; } @@ -2333,21 +2349,21 @@ void DisplayMan::loadCurrentMapGraphics() { _useByteBoxCoordinates = true; copyBitmapAndFlipHorizontal(_bitmapWallD3LCRNative = _bitmapWallSetD3LCR, _tmpBitmap, - _frameWalls163[k0_ViewSquare_D3C]._srcByteWidth, _frameWalls163[k0_ViewSquare_D3C]._srcHeight); - fillBitmap(_bitmapWallD3LCRFlipped, k10_ColorFlesh, 64, 51); - blitToBitmap(_tmpBitmap, _bitmapWallD3LCRFlipped, boxWallD3LCR, 11, 0, 64, 64, kM1_ColorNoTransparency, 51, 51); + _frameWalls163[kDMViewSquareD3C]._srcByteWidth, _frameWalls163[kDMViewSquareD3C]._srcHeight); + fillBitmap(_bitmapWallD3LCRFlipped, kDMColorFlesh, 64, 51); + blitToBitmap(_tmpBitmap, _bitmapWallD3LCRFlipped, boxWallD3LCR, 11, 0, 64, 64, kDMColorNoTransparency, 51, 51); copyBitmapAndFlipHorizontal(_bitmapWallD2LCRNative = _bitmapWallSetD2LCR, _tmpBitmap, - _frameWalls163[k3_ViewSquare_D2C]._srcByteWidth, _frameWalls163[k3_ViewSquare_D2C]._srcHeight); - fillBitmap(_bitmapWallD2LCRFlipped, k10_ColorFlesh, 72, 71); - blitToBitmap(_tmpBitmap, _bitmapWallD2LCRFlipped, boxWallD2LCR, 8, 0, 72, 72, kM1_ColorNoTransparency, 71, 71); + _frameWalls163[kDMViewSquareD2C]._srcByteWidth, _frameWalls163[kDMViewSquareD2C]._srcHeight); + fillBitmap(_bitmapWallD2LCRFlipped, kDMColorFlesh, 72, 71); + blitToBitmap(_tmpBitmap, _bitmapWallD2LCRFlipped, boxWallD2LCR, 8, 0, 72, 72, kDMColorNoTransparency, 71, 71); copyBitmapAndFlipHorizontal(_bitmapWallD1LCRNative = _bitmapWallSetD1LCR, _bitmapWallD1LCRFlipped, - _frameWalls163[k6_ViewSquare_D1C]._srcByteWidth, _frameWalls163[k6_ViewSquare_D1C]._srcHeight); + _frameWalls163[kDMViewSquareD1C]._srcByteWidth, _frameWalls163[kDMViewSquareD1C]._srcHeight); copyBitmapAndFlipHorizontal(_bitmapWallD0LNative = bitmapWallSetWallD0L, _bitmapWallD0RFlipped, - _frameWalls163[k10_ViewSquare_D0L]._srcByteWidth, _frameWalls163[k10_ViewSquare_D0L]._srcHeight); + _frameWalls163[kDMViewSquareD0L]._srcByteWidth, _frameWalls163[kDMViewSquareD0L]._srcHeight); copyBitmapAndFlipHorizontal(_bitmapWallD0RNative = _bitmapWallSetWallD0R, _bitmapWallD0LFlipped, - _frameWalls163[k10_ViewSquare_D0L]._srcByteWidth, _frameWalls163[k10_ViewSquare_D0L]._srcHeight); + _frameWalls163[kDMViewSquareD0L]._srcByteWidth, _frameWalls163[kDMViewSquareD0L]._srcHeight); int16 val = _vm->_dungeonMan->_currMap->_wallSet * k18_StairsGraphicCount + k90_FirstStairs; _stairsNativeBitmapIndexUpFrontD3L = val++; @@ -2471,14 +2487,14 @@ void DisplayMan::applyCreatureReplColors(int replacedColor, int replacementColor void DisplayMan::drawFloorPitOrStairsBitmap(uint16 nativeIndex, Frame &f) { if (f._srcByteWidth) blitToBitmap(getNativeBitmapOrGraphic(nativeIndex), _bitmapViewport, f._box, f._srcX, f._srcY, - f._srcByteWidth, k112_byteWidthViewport, k10_ColorFlesh, f._srcHeight, k136_heightViewport); + f._srcByteWidth, k112_byteWidthViewport, kDMColorFlesh, f._srcHeight, k136_heightViewport); } void DisplayMan::drawFloorPitOrStairsBitmapFlippedHorizontally(uint16 nativeIndex, Frame &f) { if (f._srcByteWidth) { copyBitmapAndFlipHorizontal(getNativeBitmapOrGraphic(nativeIndex), _tmpBitmap, f._srcByteWidth, f._srcHeight); blitToBitmap(_tmpBitmap, _bitmapViewport, f._box, f._srcX, f._srcY, f._srcByteWidth, - k112_byteWidthViewport, k10_ColorFlesh, f._srcHeight, k136_heightViewport); + k112_byteWidthViewport, kDMColorFlesh, f._srcHeight, k136_heightViewport); } } @@ -2659,7 +2675,7 @@ bool DisplayMan::isDrawnWallOrnAnAlcove(int16 wallOrnOrd, ViewWall viewWallIndex if (viewWallIndex >= kDMViewWallD1LRight) { if (viewWallIndex == kDMViewWallD1CFront) { if (isInscription) { - blitToBitmap(_bitmapWallSetD1LCR, _bitmapViewport, boxWallPatchBehindInscription, 94, 28, _frameWalls163[k6_ViewSquare_D1C]._srcByteWidth, k112_byteWidthViewport, kM1_ColorNoTransparency, _frameWalls163[k6_ViewSquare_D1C]._srcHeight, k136_heightViewport); + blitToBitmap(_bitmapWallSetD1LCR, _bitmapViewport, boxWallPatchBehindInscription, 94, 28, _frameWalls163[kDMViewSquareD1C]._srcByteWidth, k112_byteWidthViewport, kDMColorNoTransparency, _frameWalls163[kDMViewSquareD1C]._srcHeight, k136_heightViewport); byte *inscrString = inscriptionString; byte *L0092_puc_Bitmap = getNativeBitmapOrGraphic(k120_InscriptionFont); int16 textLineIndex = 0; @@ -2673,7 +2689,7 @@ bool DisplayMan::isDrawnWallOrnAnAlcove(int16 wallOrnOrd, ViewWall viewWallIndex blitFrame._box._x2 = (blitFrame._box._x1 = 112 - (characterCount << 2)) + 7; blitFrame._box._y1 = (blitFrame._box._y2 = inscriptionLineY[textLineIndex++]) - 7; while (characterCount--) { - blitToBitmap(L0092_puc_Bitmap, _bitmapViewport, blitFrame._box, *inscrString++ << 3, 0, k144_byteWidth, k112_byteWidthViewport, k10_ColorFlesh, 8, k136_heightViewport); + blitToBitmap(L0092_puc_Bitmap, _bitmapViewport, blitFrame._box, *inscrString++ << 3, 0, k144_byteWidth, k112_byteWidthViewport, kDMColorFlesh, 8, k136_heightViewport); blitFrame._box._x1 += 8; blitFrame._box._x2 += 8; } @@ -2682,7 +2698,7 @@ bool DisplayMan::isDrawnWallOrnAnAlcove(int16 wallOrnOrd, ViewWall viewWallIndex } ornNativeBitmapIndex++; Box tmpBox(ornCoordSet); - _vm->_dungeonMan->_dungeonViewClickableBoxes[k5_ViewCellDoorButtonOrWallOrn] = tmpBox; + _vm->_dungeonMan->_dungeonViewClickableBoxes[kDMViewCellDoorButtonOrWallOrn] = tmpBox; _vm->_dungeonMan->_isFacingAlcove = isAlcove; _vm->_dungeonMan->_isFacingViAltar = (wallOrnamentIndex == _currMapViAltarIndex); @@ -2716,7 +2732,7 @@ bool DisplayMan::isDrawnWallOrnAnAlcove(int16 wallOrnOrd, ViewWall viewWallIndex coordinateSetOffset = -6; } blitPosX = (ornCoordSet + coordinateSetOffset)[1] - (ornCoordSet + coordinateSetOffset)[0]; - if (!isDerivedBitmapInCache(wallOrnamentIndex = k4_DerivedBitmapFirstWallOrnament + (wallOrnamentIndex << 2) + wallOrnDerivedBitmapIndexIncrement[viewWallIndex])) { + if (!isDerivedBitmapInCache(wallOrnamentIndex = kDMDerivedBitmapFirstWallOrnament + (wallOrnamentIndex << 2) + wallOrnDerivedBitmapIndexIncrement[viewWallIndex])) { byte *blitBitmap = getNativeBitmapOrGraphic(ornNativeBitmapIndex); blitToBitmapShrinkWithPalChange(blitBitmap, getDerivedBitmap(wallOrnamentIndex), ornBlitBitmap[4] << 1, ornBlitBitmap[5], ornCoordSet[4] << 1, ornCoordSet[5], (viewWallIndex <= kDMViewWallD3RFront) ? _palChangesDoorButtonAndWallOrnD3 : _palChangesDoorButtonAndWallOrnD2); addDerivedBitmap(wallOrnamentIndex); @@ -2754,12 +2770,12 @@ bool DisplayMan::isDrawnWallOrnAnAlcove(int16 wallOrnOrd, ViewWall viewWallIndex Box tmpBox(ornCoordSet); blitToBitmap(ornBlitBitmap, _bitmapViewport, tmpBox, blitPosX, 0, - ornCoordSet[4], k112_byteWidthViewport, k10_ColorFlesh, ornCoordSet[5], k136_heightViewport); + ornCoordSet[4], k112_byteWidthViewport, kDMColorFlesh, ornCoordSet[5], k136_heightViewport); if ((viewWallIndex == kDMViewWallD1CFront) && _championPortraitOrdinal--) { blitToBitmap(getNativeBitmapOrGraphic(k26_ChampionPortraitsIndice), _bitmapViewport, boxChampionPortraitOnWall, (_championPortraitOrdinal & 0x0007) << 5, (_championPortraitOrdinal >> 3) * 29, - k128_byteWidth, k112_byteWidthViewport, k1_ColorDarkGary, 87, k136_heightViewport); /* A portrait is 32x29 pixels */ + k128_byteWidth, k112_byteWidthViewport, kDMColorDarkGary, 87, k136_heightViewport); /* A portrait is 32x29 pixels */ } return isAlcove; @@ -2812,13 +2828,13 @@ void DisplayMan::drawField(FieldAspect* fieldAspect, Box& box) { } } - isDerivedBitmapInCache(k0_DerivedBitmapViewport); + isDerivedBitmapInCache(kDMDerivedBitmapViewport); byte *bitmap = getNativeBitmapOrGraphic(k73_FieldTeleporterGraphicIndice + fieldAspect->_nativeBitmapRelativeIndex); - blitBoxFilledWithMaskedBitmap(bitmap, _bitmapViewport, bitmapMask, getDerivedBitmap(k0_DerivedBitmapViewport), box, + blitBoxFilledWithMaskedBitmap(bitmap, _bitmapViewport, bitmapMask, getDerivedBitmap(kDMDerivedBitmapViewport), box, _vm->getRandomNumber(2) + fieldAspect->_baseStartUnitIndex, _vm->getRandomNumber(32), k112_byteWidthViewport, (Color)fieldAspect->_transparentColor, fieldAspect->_xPos, 0, 136, fieldAspect->_bitplaneWordCount); - addDerivedBitmap(k0_DerivedBitmapViewport); - releaseBlock(k0_DerivedBitmapViewport | 0x8000); + addDerivedBitmap(kDMDerivedBitmapViewport); + releaseBlock(kDMDerivedBitmapViewport | 0x8000); } int16 DisplayMan::getScaledBitmapByteCount(int16 byteWidth, int16 height, int16 scale) { @@ -2830,7 +2846,7 @@ int16 DisplayMan::getScaledDimension(int16 dimension, int16 scale) { } void DisplayMan::drawObjectsCreaturesProjectilesExplosions(Thing thingParam, Direction directionParam, int16 mapXpos, - int16 mapYpos, int16 viewSquareIndex, uint16 orderedViewCellOrdinals) { + int16 mapYpos, int16 viewSquareIndex, CellOrder cellOrder) { int16 AL_0_creatureIndexRed; #define AL_1_viewSquareExplosionIndex viewSquareIndex int16 L0126_i_Multiple; @@ -3079,13 +3095,14 @@ void DisplayMan::drawObjectsCreaturesProjectilesExplosions(Thing thingParam, Dir if (thingParam == Thing::_endOfList) return; + int16 orderedViewCellOrdinals = cellOrder; Group *group = nullptr; Thing groupThing = Thing::_none; bool squareHasExplosion = drawCreaturesCompleted = false; bool squareHasProjectile = false; cellCounter = 0; firstThingToDraw = thingParam; - if (getFlag(orderedViewCellOrdinals, k0x0008_CellOrder_DoorFront)) { /* If the function call is to draw objects on a door square viewed from the front */ + if (getFlag(orderedViewCellOrdinals, kDMMaskDoorFront)) { /* If the function call is to draw objects on a door square viewed from the front */ doorFrontViewDrawingPass = (orderedViewCellOrdinals & 0x0001) + 1; /* Two function calls are made in that case to draw objects on both sides of the door frame. The door and its frame are drawn between the two calls. This value indicates the drawing pass so that creatures are drawn in the right order and so that Fluxcages are not drawn twice */ orderedViewCellOrdinals >>= 4; /* Remove the first nibble that was used for the door front view pass */ } else @@ -3100,7 +3117,7 @@ void DisplayMan::drawObjectsCreaturesProjectilesExplosions(Thing thingParam, Dir do { /* Draw objects */ if (L0135_B_DrawAlcoveObjects) { - AL_2_viewCell = k4_ViewCellAlcove; /* Index of coordinates to draw objects in alcoves */ + AL_2_viewCell = kDMViewCellAlcove; /* Index of coordinates to draw objects in alcoves */ cellYellowBear = _vm->returnOppositeDir(directionParam); /* Alcove is on the opposite direction of the viewing direction */ objectShiftIndex = 2; } else { @@ -3131,7 +3148,7 @@ void DisplayMan::drawObjectsCreaturesProjectilesExplosions(Thing thingParam, Dir continue; } - if ((viewSquareIndex >= k0_ViewSquare_D3C) && (viewSquareIndex <= k9_ViewSquare_D0C) && (thingParam.getCell() == cellYellowBear)) { /* Square where objects are visible and object is located on cell being processed */ + if ((viewSquareIndex >= kDMViewSquareD3C) && (viewSquareIndex <= kDMViewSquareD0C) && (thingParam.getCell() == cellYellowBear)) { /* Square where objects are visible and object is located on cell being processed */ objectAspect = &(_objectAspects209[_vm->_dungeonMan->_objectInfos[_vm->_dungeonMan->getObjectInfoIndex(thingParam)]._objectAspectIndex]); AL_4_nativeBitmapIndex = k360_FirstObjectGraphicIndice + objectAspect->_firstNativeBitmapRelativeIndex; useAlcoveObjectImage = (L0135_B_DrawAlcoveObjects && getFlag(objectAspect->_graphicInfo, k0x0010_ObjectAlcoveMask) && (viewLane == kDMViewLaneCenter)); @@ -3144,11 +3161,11 @@ void DisplayMan::drawObjectsCreaturesProjectilesExplosions(Thing thingParam, Dir T0115015_DrawProjectileAsObject: flipHorizontal = getFlag(objectAspect->_graphicInfo, k0x0001_ObjectFlipOnRightMask) && !useAlcoveObjectImage && - ((viewLane == kDMViewLaneRight) || ((viewLane == kDMViewLaneCenter) && ((AL_2_viewCell == k1_ViewCellFrontRight) || (AL_2_viewCell == k2_ViewCellBackRight)))); + ((viewLane == kDMViewLaneRight) || ((viewLane == kDMViewLaneCenter) && ((AL_2_viewCell == kDMViewCellFrontRight) || (AL_2_viewCell == kDMViewCellBackRight)))); /* Flip horizontally if object graphic requires it and is not being drawn in an alcove and the object is either on the right lane or on the right column of the center lane */ paddingPixelCount = 0; - if ((viewSquareIndex == k9_ViewSquare_D0C) || ((viewSquareIndex >= k6_ViewSquare_D1C) && (AL_2_viewCell >= k2_ViewCellBackRight))) { + if ((viewSquareIndex == kDMViewSquareD0C) || ((viewSquareIndex >= kDMViewSquareD1C) && (AL_2_viewCell >= kDMViewCellBackRight))) { drawingGrabbableObject = ((viewLane == kDMViewLaneCenter) && !drawProjectileAsObject); /* If object is in the center lane (only D0C or D1C with condition above) and is not a projectile */ AL_8_shiftSetIndex = k0_ShiftSet_D0BackD1Front; bitmapRedBanana = getNativeBitmapOrGraphic(AL_4_nativeBitmapIndex); /* Use base graphic, no resizing */ @@ -3160,9 +3177,9 @@ T0115015_DrawProjectileAsObject: } } else { drawingGrabbableObject = false; - derivedBitmapIndex = k104_DerivedBitmapFirstObject + objectAspect->_firstDerivedBitmapRelativeIndex; + derivedBitmapIndex = kDMDerivedBitmapFirstObject + objectAspect->_firstDerivedBitmapRelativeIndex; byte* paletteChanges; - if ((viewSquareIndex >= k6_ViewSquare_D1C) || ((viewSquareIndex >= k3_ViewSquare_D2C) && (AL_2_viewCell >= k2_ViewCellBackRight))) { + if ((viewSquareIndex >= kDMViewSquareD1C) || ((viewSquareIndex >= kDMViewSquareD2C) && (AL_2_viewCell >= kDMViewCellBackRight))) { derivedBitmapIndex++; AL_8_shiftSetIndex = k1_ShiftSet_D1BackD2Front; byteWidth = getScaledDimension(objectAspect->_byteWidth, k20_Scale_D2); @@ -3239,17 +3256,17 @@ T0115015_DrawProjectileAsObject: bitmapRedBanana = bitmapGreenAnt; _vm->_dungeonMan->_pileTopObject[AL_2_viewCell] = thingParam; /* The object is at the top of the pile */ } - blitToBitmap(bitmapRedBanana, _bitmapViewport, boxByteGreen, AL_4_xPos, 0, getNormalizedByteWidth(byteWidth), k112_byteWidthViewport, k10_ColorFlesh, heightRedEagle, k136_heightViewport); + blitToBitmap(bitmapRedBanana, _bitmapViewport, boxByteGreen, AL_4_xPos, 0, getNormalizedByteWidth(byteWidth), k112_byteWidthViewport, kDMColorFlesh, heightRedEagle, k136_heightViewport); if (drawProjectileAsObject) goto T0115171_BackFromT0115015_DrawProjectileAsObject; } } while ((thingParam = _vm->_dungeonMan->getNextThing(thingParam)) != Thing::_endOfList); - if (AL_2_viewCell == k4_ViewCellAlcove) + if (AL_2_viewCell == kDMViewCellAlcove) break; /* End of processing when drawing objects in an alcove */ - if (viewSquareIndex < k0_ViewSquare_D3C) + if (viewSquareIndex < kDMViewSquareD3C) break; /* End of processing if square is too far away at D4 */ /* Draw creatures */ - drawingLastBackRowCell = ((AL_2_viewCell <= k1_ViewCellFrontRight) || (cellCounter == 1)) && (!remainingViewCellOrdinalsToProcess || ((remainingViewCellOrdinalsToProcess & 0x0000000F) >= 3)); /* If (draw cell on the back row or second cell being processed) and (no more cells to draw or next cell to draw is a cell on the front row) */ + drawingLastBackRowCell = ((AL_2_viewCell <= kDMViewCellFrontRight) || (cellCounter == 1)) && (!remainingViewCellOrdinalsToProcess || ((remainingViewCellOrdinalsToProcess & 0x0000000F) >= 3)); /* If (draw cell on the back row or second cell being processed) and (no more cells to draw or next cell to draw is a cell on the front row) */ if ((groupThing == Thing::_none) || drawCreaturesCompleted) goto T0115129_DrawProjectiles; /* Skip code to draw creatures */ @@ -3314,7 +3331,7 @@ T0115015_DrawProjectileAsObject: goto T0115129_DrawProjectiles; creatureAspectInt = activeGroup->_aspect[creatureIndexGreen]; - if (viewSquareIndex > k9_ViewSquare_D0C) + if (viewSquareIndex > kDMViewSquareD0C) viewSquareIndex--; T0115077_DrawSecondHalfSquareCreature: @@ -3326,7 +3343,7 @@ T0115077_DrawSecondHalfSquareCreature: derivedBitmapIndex = ((CreatureAspect *)objectAspect)->_firstDerivedBitmapIndex; int16 sourceByteWidth; int16 sourceHeight; - useCreatureSideBitmap = getFlag(creatureGraphicInfoRed, k0x0008_CreatureInfoGraphicMaskSide) && (creatureDirectionDelta & 0x0001); + useCreatureSideBitmap = getFlag(creatureGraphicInfoRed, kDMCreatureMaskSide) && (creatureDirectionDelta & 0x0001); if (useCreatureSideBitmap) { useCreatureAttackBitmap = useFlippedHorizontallyCreatureFrontImage = useCreatureBackBitmap = false; AL_4_nativeBitmapIndex++; /* Skip the front image. Side image is right after the front image */ @@ -3334,20 +3351,20 @@ T0115077_DrawSecondHalfSquareCreature: sourceByteWidth = byteWidth = ((CreatureAspect *)objectAspect)->_byteWidthSide; sourceHeight = heightRedEagle = ((CreatureAspect *)objectAspect)->_heightSide; } else { - useCreatureBackBitmap = getFlag(creatureGraphicInfoRed, k0x0010_CreatureInfoGraphicMaskBack) && (creatureDirectionDelta == 0); + useCreatureBackBitmap = getFlag(creatureGraphicInfoRed, kDMCreatureMaskBack) && (creatureDirectionDelta == 0); useCreatureAttackBitmap = !useCreatureBackBitmap; - if (useCreatureAttackBitmap && getFlag(creatureAspectInt, k0x0080_MaskActiveGroupIsAttacking) && getFlag(creatureGraphicInfoRed, k0x0020_CreatureInfoGraphicMaskAttack)) { + if (useCreatureAttackBitmap && getFlag(creatureAspectInt, k0x0080_MaskActiveGroupIsAttacking) && getFlag(creatureGraphicInfoRed, kDMCreatureMaskAttack)) { useFlippedHorizontallyCreatureFrontImage = false; sourceByteWidth = byteWidth = ((CreatureAspect *)objectAspect)->_byteWidthAttack; sourceHeight = heightRedEagle = ((CreatureAspect *)objectAspect)->_heightAttack; AL_4_nativeBitmapIndex++; /* Skip the front image */ derivedBitmapIndex += 2; - if (getFlag(creatureGraphicInfoRed, k0x0008_CreatureInfoGraphicMaskSide)) { + if (getFlag(creatureGraphicInfoRed, kDMCreatureMaskSide)) { AL_4_nativeBitmapIndex++; /* If the creature has a side image, it preceeds the attack image */ derivedBitmapIndex += 2; } - if (getFlag(creatureGraphicInfoRed, k0x0010_CreatureInfoGraphicMaskBack)) { + if (getFlag(creatureGraphicInfoRed, kDMCreatureMaskBack)) { AL_4_nativeBitmapIndex++; /* If the creature has a back image, it preceeds the attack image */ derivedBitmapIndex += 2; } @@ -3356,7 +3373,7 @@ T0115077_DrawSecondHalfSquareCreature: sourceHeight = heightRedEagle = ((CreatureAspect *)objectAspect)->_heightFront; if (useCreatureBackBitmap) { useFlippedHorizontallyCreatureFrontImage = false; - if (getFlag(creatureGraphicInfoRed, k0x0008_CreatureInfoGraphicMaskSide)) { + if (getFlag(creatureGraphicInfoRed, kDMCreatureMaskSide)) { AL_4_nativeBitmapIndex += 2; /* If the creature has a side image, it preceeds the back image */ derivedBitmapIndex += 4; } else { @@ -3364,16 +3381,16 @@ T0115077_DrawSecondHalfSquareCreature: derivedBitmapIndex += 2; } } else { - useFlippedHorizontallyCreatureFrontImage = getFlag(creatureGraphicInfoRed, k0x0004_CreatureInfoGraphicMaskFlipNonAttack) && getFlag(creatureAspectInt, k0x0040_MaskActiveGroupFlipBitmap); + useFlippedHorizontallyCreatureFrontImage = getFlag(creatureGraphicInfoRed, kDMCreatureMaskFlipNonAttack) && getFlag(creatureAspectInt, k0x0040_MaskActiveGroupFlipBitmap); if (useFlippedHorizontallyCreatureFrontImage) { derivedBitmapIndex += 2; - if (getFlag(creatureGraphicInfoRed, k0x0008_CreatureInfoGraphicMaskSide)) + if (getFlag(creatureGraphicInfoRed, kDMCreatureMaskSide)) derivedBitmapIndex += 2; - if (getFlag(creatureGraphicInfoRed, k0x0010_CreatureInfoGraphicMaskBack)) + if (getFlag(creatureGraphicInfoRed, kDMCreatureMaskBack)) derivedBitmapIndex += 2; - if (getFlag(creatureGraphicInfoRed, k0x0020_CreatureInfoGraphicMaskAttack)) + if (getFlag(creatureGraphicInfoRed, kDMCreatureMaskAttack)) derivedBitmapIndex += 2; } } @@ -3381,7 +3398,7 @@ T0115077_DrawSecondHalfSquareCreature: } int16 scale; - if (viewSquareIndex >= k6_ViewSquare_D1C) { /* Creature is on D1 */ + if (viewSquareIndex >= kDMViewSquareD1C) { /* Creature is on D1 */ creaturePaddingPixelCount = 0; AL_8_shiftSetIndex = k0_ShiftSet_D0BackD1Front; transparentColor = ((CreatureAspect *)objectAspect)->getTranspColour(); @@ -3401,7 +3418,7 @@ T0115077_DrawSecondHalfSquareCreature: bitmapRedBanana = getDerivedBitmap(derivedBitmapIndex); else { bitmapGreenAnt = getNativeBitmapOrGraphic(AL_4_nativeBitmapIndex); - if (getFlag(creatureGraphicInfoRed, k0x0004_CreatureInfoGraphicMaskFlipNonAttack)) + if (getFlag(creatureGraphicInfoRed, kDMCreatureMaskFlipNonAttack)) copyBitmapAndFlipHorizontal(bitmapGreenAnt, bitmapRedBanana = getDerivedBitmap(derivedBitmapIndex), byteWidth, heightRedEagle); addDerivedBitmap(derivedBitmapIndex); @@ -3411,10 +3428,10 @@ T0115077_DrawSecondHalfSquareCreature: derivedBitmapIndex++; /* Skip front D1 image in additional graphics */ byte* paletteChanges; - if (viewSquareIndex >= k3_ViewSquare_D2C) { /* Creature is on D2 */ + if (viewSquareIndex >= kDMViewSquareD2C) { /* Creature is on D2 */ derivedBitmapIndex++; /* Skip front D3 image in additional graphics */ AL_8_shiftSetIndex = k1_ShiftSet_D1BackD2Front; - useCreatureSpecialD2FrontBitmap = getFlag(creatureGraphicInfoRed, k0x0080_CreatureInfoGraphicMaskSpecialD2Front) && !useCreatureSideBitmap && !useCreatureBackBitmap && !useCreatureAttackBitmap; + useCreatureSpecialD2FrontBitmap = getFlag(creatureGraphicInfoRed, kDMCreatureMaskSpecialD2Front) && !useCreatureSideBitmap && !useCreatureBackBitmap && !useCreatureAttackBitmap; paletteChanges = _palChangesCreatureD2; scale = k20_Scale_D2; } else { /* Creature is on D3 */ @@ -3438,8 +3455,8 @@ T0115077_DrawSecondHalfSquareCreature: } if ((useCreatureSideBitmap && (creatureDirectionDelta == 1)) || /* If creature is viewed from the right, the side view must be flipped */ (useCreatureAttackBitmap && getFlag(creatureAspectInt, k0x0040_MaskActiveGroupFlipBitmap)) || - (useCreatureSpecialD2FrontBitmap && getFlag(creatureGraphicInfoRed, k0x0100_CreatureInfoGraphicMaskSpecialD2FrontIsFlipped)) || - (useFlippedHorizontallyCreatureFrontImage && getFlag(creatureGraphicInfoRed, k0x0004_CreatureInfoGraphicMaskFlipNonAttack))) { /* If the graphic should be flipped */ + (useCreatureSpecialD2FrontBitmap && getFlag(creatureGraphicInfoRed, kDMCreatureMaskSpecialD2FrontIsFlipped)) || + (useFlippedHorizontallyCreatureFrontImage && getFlag(creatureGraphicInfoRed, kDMCreatureMaskFlipNonAttack))) { /* If the graphic should be flipped */ if (!useFlippedHorizontallyCreatureFrontImage || !derivedBitmapInCache) { AL_4_normalizdByteWidth = getNormalizedByteWidth(byteWidth); if (!useFlippedHorizontallyCreatureFrontImage) { @@ -3495,7 +3512,7 @@ T0115129_DrawProjectiles: if (!squareHasProjectile) continue; viewSquareIndex = AL_10_viewSquareIndexBackup; - if (viewSquareIndex > k9_ViewSquare_D0C) + if (viewSquareIndex > kDMViewSquareD0C) continue; AL_2_viewCell = currentViewCellToDraw; projectilePosX = objectCoordinateSets[0][viewSquareIndex][AL_2_viewCell][0]; @@ -3512,7 +3529,7 @@ T0115129_DrawProjectiles: projectileAspectType = getFlag(((ProjectileAspect *)objectAspect)->_graphicInfo, k0x0003_ProjectileAspectTypeMask); bool doNotScaleWithKineticEnergy = !getFlag(((ProjectileAspect *)objectAspect)->_graphicInfo, k0x0100_ProjectileScaleWithKineticEnergyMask); - if ((doNotScaleWithKineticEnergy || (projectile->_kineticEnergy == 255)) && (viewSquareIndex == k9_ViewSquare_D0C)) { + if ((doNotScaleWithKineticEnergy || (projectile->_kineticEnergy == 255)) && (viewSquareIndex == kDMViewSquareD0C)) { scale = 0; /* Use native bitmap without resizing */ byteWidth = ((ProjectileAspect *)objectAspect)->_byteWidth; heightRedEagle = ((ProjectileAspect *)objectAspect)->_height; @@ -3540,7 +3557,7 @@ T0115129_DrawProjectiles: projectileBitmapIndexDelta = 2; if (projectileAspectTypeHasBackGraphicAndRotation) { - flipHorizontal = (AL_2_viewCell == k0_ViewCellFronLeft) || (AL_2_viewCell == k3_ViewCellBackLeft); + flipHorizontal = (AL_2_viewCell == kDMViewCellFronLeft) || (AL_2_viewCell == kDMViewCellBackLeft); if (!(flipVertical = projectileFlipVertical)) flipHorizontal = !flipHorizontal; } else { @@ -3553,8 +3570,8 @@ T0115129_DrawProjectiles: else projectileBitmapIndexDelta = 1; - flipVertical = projectileAspectTypeHasBackGraphicAndRotation && (AL_2_viewCell < k2_ViewCellBackRight); - flipHorizontal = getFlag(((ProjectileAspect *)objectAspect)->_graphicInfo, k0x0010_ProjectileSideMask) && !((viewLane == kDMViewLaneRight) || ((viewLane == kDMViewLaneCenter) && ((AL_2_viewCell == k1_ViewCellFrontRight) || (AL_2_viewCell == k2_ViewCellBackRight)))); + flipVertical = projectileAspectTypeHasBackGraphicAndRotation && (AL_2_viewCell < kDMViewCellBackRight); + flipHorizontal = getFlag(((ProjectileAspect *)objectAspect)->_graphicInfo, k0x0010_ProjectileSideMask) && !((viewLane == kDMViewLaneRight) || ((viewLane == kDMViewLaneCenter) && ((AL_2_viewCell == kDMViewCellFrontRight) || (AL_2_viewCell == kDMViewCellBackRight)))); } AL_4_nativeBitmapIndex += projectileBitmapIndexDelta; @@ -3565,7 +3582,7 @@ T0115129_DrawProjectiles: if (flipHorizontal) paddingPixelCount = (7 - ((byteWidth - 1) & 0x0007)) << 1; - if (doNotScaleWithKineticEnergy && isDerivedBitmapInCache(derivedBitmapIndex = k282_DerivedBitmapFirstProjectile + ((ProjectileAspect *)objectAspect)->_firstDerivedBitmapRelativeIndex + (projectileBitmapIndexDelta * 6) + AL_8_projectileScaleIndex)) { + if (doNotScaleWithKineticEnergy && isDerivedBitmapInCache(derivedBitmapIndex = kDMDerivedBitmapFirstProjectile + ((ProjectileAspect *)objectAspect)->_firstDerivedBitmapRelativeIndex + (projectileBitmapIndexDelta * 6) + AL_8_projectileScaleIndex)) { bitmapRedBanana = getDerivedBitmap(derivedBitmapIndex); } else { bitmapGreenAnt = getNativeBitmapOrGraphic(AL_4_nativeBitmapIndex); @@ -3604,7 +3621,7 @@ T0115129_DrawProjectiles: } else AL_4_xPos = MAX(paddingPixelCount, int16(byteWidth - projectilePosX - 1)); /* BUG0_06 Graphical glitch when drawing projectiles or explosions. If a projectile or explosion bitmap is cropped because it is only partly visible on the left side of the viewport (boxByteGreen.X1 = 0) and the bitmap is flipped horizontally (flipHorizontal = true) then a wrong part of the bitmap is drawn on screen. To fix this bug, "+ paddingPixelCount" must be added to the second parameter of this function call */ - blitToBitmap(bitmapRedBanana, _bitmapViewport, boxByteGreen, AL_4_xPos, 0, getNormalizedByteWidth(byteWidth), k112_byteWidthViewport, k10_ColorFlesh, heightRedEagle, k136_heightViewport); + blitToBitmap(bitmapRedBanana, _bitmapViewport, boxByteGreen, AL_4_xPos, 0, getNormalizedByteWidth(byteWidth), k112_byteWidthViewport, kDMColorFlesh, heightRedEagle, k136_heightViewport); } else { /* Positive value: projectile aspect is the index of a OBJECT_ASPECT */ useAlcoveObjectImage = false; byte projectileCoordinates[2]; @@ -3636,17 +3653,17 @@ T0115171_BackFromT0115015_DrawProjectileAsObject:; AL_2_cellPurpleMan = thingParam.getCell(); Explosion *explosion = (Explosion *)_vm->_dungeonMan->getThingData(thingParam); bool rebirthExplosion = ((uint16)(AL_4_explosionType = explosion->getType()) >= kDMExplosionTypeRebirthStep1); - if (rebirthExplosion && ((AL_1_viewSquareExplosionIndex < k3_ViewSquare_D3C_Explosion) || (AL_1_viewSquareExplosionIndex > k9_ViewSquare_D1C_Explosion) || (AL_2_cellPurpleMan != cellYellowBear))) /* If explosion is rebirth and is not visible */ + if (rebirthExplosion && ((AL_1_viewSquareExplosionIndex < kDMViewSquareD3CExplosion) || (AL_1_viewSquareExplosionIndex > kDMViewSquareD1CExplosion) || (AL_2_cellPurpleMan != cellYellowBear))) /* If explosion is rebirth and is not visible */ continue; bool smoke = false; if ((AL_4_explosionType == kDMExplosionTypeFireball) || (AL_4_explosionType == kDMExplosionTypeLightningBolt) || (AL_4_explosionType == kDMExplosionTypeRebirthStep2)) { AL_4_explosionAspectIndex = kDMExplosionAspectFire; } else { if ((AL_4_explosionType == kDMExplosionTypePoisonBolt) || (AL_4_explosionType == kDMExplosionTypePoisonCloud)) { - AL_4_explosionAspectIndex = k2_ExplosionAspectPoison; + AL_4_explosionAspectIndex = kDMExplosionAspectPoison; } else if (AL_4_explosionType == kDMExplosionTypeSmoke) { smoke = true; - AL_4_explosionAspectIndex = k3_ExplosionAspectSmoke; + AL_4_explosionAspectIndex = kDMExplosionAspectSmoke; } else { if (AL_4_explosionType == kDMExplosionTypeRebirthStep1) { objectAspect = (ObjectAspect *)&_projectileAspect[_vm->ordinalToIndex(-_vm->_dungeonMan->getProjectileAspect(Thing::_explLightningBolt))]; @@ -3654,21 +3671,21 @@ T0115171_BackFromT0115015_DrawProjectileAsObject:; explosionCoordinates = rebirthStep1ExplosionCoordinates[AL_1_viewSquareExplosionIndex - 3]; byteWidth = getScaledDimension((((ProjectileAspect *)objectAspect)->_byteWidth), explosionCoordinates[2]); heightRedEagle = getScaledDimension((((ProjectileAspect *)objectAspect)->_height), explosionCoordinates[2]); - if (AL_1_viewSquareExplosionIndex != k9_ViewSquare_D1C_Explosion) { + if (AL_1_viewSquareExplosionIndex != kDMViewSquareD1CExplosion) { blitToBitmapShrinkWithPalChange(bitmapRedBanana, _tmpBitmap, ((ProjectileAspect *)objectAspect)->_byteWidth << 1, ((ProjectileAspect *)objectAspect)->_height, byteWidth << 1, heightRedEagle, _palChangesNoChanges); bitmapRedBanana = _tmpBitmap; } goto T0115200_DrawExplosion; } if (AL_4_explosionType == kDMExplosionTypeFluxcage) { - if (AL_1_viewSquareExplosionIndex >= k4_ViewSquare_D3L_Explosion) + if (AL_1_viewSquareExplosionIndex >= kDMViewSquareD3LExplosion) fluxcageExplosion = explosion; continue; } AL_4_explosionAspectIndex = kDMExplosionAspectSpell; } } - if (AL_1_viewSquareExplosionIndex == k12_ViewSquare_D0C_Explosion) { + if (AL_1_viewSquareExplosionIndex == kDMViewSquareD0CExplosion) { if (smoke) AL_4_explosionAspectIndex--; /* Smoke uses the same graphics as Poison Cloud, but with palette changes */ @@ -3679,14 +3696,14 @@ T0115171_BackFromT0115015_DrawProjectileAsObject:; if (AL_2_explosionSize > 3) AL_4_explosionAspectIndex++; /* Use third graphic in the pattern for large explosion attack */ } - isDerivedBitmapInCache(k0_DerivedBitmapViewport); + isDerivedBitmapInCache(kDMDerivedBitmapViewport); bitmapRedBanana = getNativeBitmapOrGraphic(AL_4_explosionAspectIndex + k351_FirstExplosionPatternGraphicIndice); if (smoke) { blitToBitmapShrinkWithPalChange(bitmapRedBanana, _tmpBitmap, 48, 32, 48, 32, _palChangeSmoke); bitmapRedBanana = _tmpBitmap; } - blitBoxFilledWithMaskedBitmap(bitmapRedBanana, _bitmapViewport, 0, getDerivedBitmap(k0_DerivedBitmapViewport), boxExplosionPatternD0C, _vm->getRandomNumber(4) + 87, _vm->getRandomNumber(64), k112_byteWidthViewport, Color(k0x0080_BlitDoNotUseMask | k10_ColorFlesh), 0, 0, 136, 93); - addDerivedBitmap(k0_DerivedBitmapViewport); + blitBoxFilledWithMaskedBitmap(bitmapRedBanana, _bitmapViewport, 0, getDerivedBitmap(kDMDerivedBitmapViewport), boxExplosionPatternD0C, _vm->getRandomNumber(4) + 87, _vm->getRandomNumber(64), k112_byteWidthViewport, Color(k0x0080_BlitDoNotUseMask | kDMColorFlesh), 0, 0, 136, 93); + addDerivedBitmap(kDMDerivedBitmapViewport); warning("DISABLED CODE: f480_releaseBlock in drawObjectsCreaturesProjectilesExplosions"); //f480_releaseBlock(k0_DerivedBitmapViewport | 0x8000); } else { @@ -3699,9 +3716,9 @@ T0115171_BackFromT0115015_DrawProjectileAsObject:; explosionCoordinates = centeredExplosionCoordinates[AL_1_viewSquareExplosionIndex]; } else { if ((AL_2_cellPurpleMan == directionParam) || (AL_2_cellPurpleMan == _vm->turnDirLeft(directionParam))) - AL_2_viewCell = k0_ViewCellFronLeft; + AL_2_viewCell = kDMViewCellFronLeft; else - AL_2_viewCell = k1_ViewCellFrontRight; + AL_2_viewCell = kDMViewCellFrontRight; explosionCoordinates = explosionCoordinatesArray[AL_1_viewSquareExplosionIndex][AL_2_viewCell]; } @@ -3750,7 +3767,7 @@ T0115200_DrawExplosion: if (flipVertical) flipBitmapVertical(bitmapRedBanana, byteWidth, heightRedEagle); - blitToBitmap(bitmapRedBanana, _bitmapViewport, boxByteGreen, AL_4_xPos, 0, byteWidth, k112_byteWidthViewport, k10_ColorFlesh, heightRedEagle, k136_heightViewport); + blitToBitmap(bitmapRedBanana, _bitmapViewport, boxByteGreen, AL_4_xPos, 0, byteWidth, k112_byteWidthViewport, kDMColorFlesh, heightRedEagle, k136_heightViewport); } } } while ((thingParam = _vm->_dungeonMan->getNextThing(thingParam))!= Thing::_endOfList); |