diff options
Diffstat (limited to 'engines/dm/gfx.cpp')
-rw-r--r-- | engines/dm/gfx.cpp | 650 |
1 files changed, 341 insertions, 309 deletions
diff --git a/engines/dm/gfx.cpp b/engines/dm/gfx.cpp index 875d3c780c..a629c56cd9 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; @@ -691,12 +707,12 @@ void DisplayMan::unpackGraphics() { loadFNT1intoBitmap(k557_FontGraphicIndice, _bitmaps[k557_FontGraphicIndice]); } -void DisplayMan::loadFNT1intoBitmap(uint16 index, byte * destBitmap) { +void DisplayMan::loadFNT1intoBitmap(uint16 index, byte *destBitmap) { uint8 *data = _packedBitmaps + _packedItemPos[index]; 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) { @@ -714,10 +730,10 @@ void DisplayMan::allocateFlippedWallBitmaps() { _bitmapWallD0RFlipped = new byte[32 * 136]; } -void DisplayMan::drawDoorBitmap(Frame* frame) { +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]._rect.left = coordSetRedEagle[0]; + _vm->_dungeonMan->_dungeonViewClickableBoxes[kDMViewCellDoorButtonOrWallOrn]._rect.right = coordSetRedEagle[1]; + _vm->_dungeonMan->_dungeonViewClickableBoxes[kDMViewCellDoorButtonOrWallOrn]._rect.top = coordSetRedEagle[2]; + _vm->_dungeonMan->_dungeonViewClickableBoxes[kDMViewCellDoorButtonOrWallOrn]._rect.bottom = 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); @@ -773,12 +789,13 @@ 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); + Box blitBox(coordSetRedEagle[0], coordSetRedEagle[1], coordSetRedEagle[2], coordSetRedEagle[3]); + blitToBitmap(bitmap, _bitmapViewport, blitBox, 0, 0, + coordSetRedEagle[4], k112_byteWidthViewport, kDMColorFlesh, coordSetRedEagle[5], k136_heightViewport); } } -void DisplayMan::viewportSetPalette(uint16* middleScreenPalette, uint16* topAndBottomScreen) { +void DisplayMan::viewportSetPalette(uint16 *middleScreenPalette, uint16 *topAndBottomScreen) { if (middleScreenPalette && topAndBottomScreen) buildPaletteChangeCopperList(middleScreenPalette, topAndBottomScreen); @@ -788,7 +805,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); } @@ -846,27 +863,27 @@ void DisplayMan::blitToBitmap(byte *srcBitmap, byte *destBitmap, const Box &box, uint16 destByteWidth, Color transparent, int16 srcHeight, int16 destHight) { uint16 srcWidth = srcByteWidth * 2; uint16 destWidth = destByteWidth * 2; - for (uint16 y = 0; y < box._y2 + 1 - box._y1; ++y) { // + 1 for inclusive boundaries - for (uint16 x = 0; x < box._x2 + 1 - box._x1; ++x) { // + 1 for inclusive boundaries + for (uint16 y = 0; y < box._rect.bottom + 1 - box._rect.top; ++y) { // + 1 for inclusive boundaries + for (uint16 x = 0; x < box._rect.right + 1 - box._rect.left; ++x) { // + 1 for inclusive boundaries if (srcX + x < srcWidth && y + srcY < srcHeight - && box._x1 + x < destWidth && y + box._y1 < destHight) { + && box._rect.left + x < destWidth && y + box._rect.top < destHight) { byte srcPixel = srcBitmap[srcWidth * (y + srcY) + srcX + x]; if (srcPixel != transparent) - destBitmap[destWidth * (y + box._y1) + box._x1 + x] = srcPixel; + destBitmap[destWidth * (y + box._rect.top) + box._rect.left + x] = srcPixel; } } } } void DisplayMan::fillScreenBox(Box &box, Color color) { - uint16 width = box._x2 + 1 - box._x1; // + 1 for inclusive boundaries - for (int16 y = box._y1; y < box._y2 + 1; ++y) // + 1 for inclusive boundaries - memset(_bitmapScreen + y * _screenWidth + box._x1, color, sizeof(byte) * width); + uint16 width = box._rect.right + 1 - box._rect.left; // + 1 for inclusive boundaries + for (int16 y = box._rect.top; y < box._rect.bottom + 1; ++y) // + 1 for inclusive boundaries + memset(_bitmapScreen + y * _screenWidth + box._rect.left, color, sizeof(byte) * width); } void DisplayMan::fillBoxBitmap(byte *destBitmap, Box &box, Color color, int16 byteWidth, int16 height) { - for (int16 y = box._y1; y < box._y2 + 1; ++y) // + 1 for inclusive boundaries - memset(destBitmap + y * byteWidth * 2 + box._x1, color, sizeof(byte) * (box._x2 - box._x1 + 1)); // + 1 for inclusive boundaries + for (int16 y = box._rect.top; y < box._rect.bottom + 1; ++y) // + 1 for inclusive boundaries + memset(destBitmap + y * byteWidth * 2 + box._rect.left, color, sizeof(byte) * (box._rect.right - box._rect.left + 1)); // + 1 for inclusive boundaries } void DisplayMan::blitBoxFilledWithMaskedBitmap(byte *src, byte *dest, byte *mask, byte *tmp, Box& box, @@ -878,8 +895,8 @@ void DisplayMan::blitBoxFilledWithMaskedBitmap(byte *src, byte *dest, byte *mask byte nextUnitIndex = firstUnitIndex; bool useMask = !(transparent & k0x0080_BlitDoNotUseMask); transparent = (Color)(transparent & ~(k0x0080_BlitDoNotUseMask)); // clear flag 0x0080 - for (byte next_y = box._y1; next_y <= box._y2; next_y++) { // '<=' for inclusive boundaries - for (byte next_x = box._x1; next_x <= box._x2; next_x++) { // '<=' for inclusive boundaries + for (byte next_y = box._rect.top; next_y <= box._rect.bottom; next_y++) { // '<=' for inclusive boundaries + for (byte next_x = box._rect.left; next_x <= box._rect.right; next_x++) { // '<=' for inclusive boundaries byte *nextDestPixel = dest + next_y * destByteWidth * 2 + next_x; byte nextSrcPixel = src[nextUnitIndex]; @@ -924,16 +941,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); } @@ -1072,15 +1089,15 @@ void DisplayMan::drawFloorOrnament(uint16 floorOrnOrdinal, ViewFloor viewFloorIn } else bitmap = getNativeBitmapOrGraphic(nativeBitmapIndex); - blitToBitmap(bitmap, _bitmapViewport, - *(Box *)coordSets, 0, 0, coordSets[4], k112_byteWidthViewport, k10_ColorFlesh, coordSets[5], k136_heightViewport); + Box blitBox(coordSets[0], coordSets[1], coordSets[2], coordSets[3]); + blitToBitmap(bitmap, _bitmapViewport, blitBox, 0, 0, coordSets[4], k112_byteWidthViewport, kDMColorFlesh, coordSets[5], k136_heightViewport); } if (drawFootprints) drawFloorOrnament(_vm->indexToOrdinal(k15_FloorOrnFootprints), viewFloorIndex); } -void DisplayMan::drawDoor(uint16 doorThingIndex, DoorState doorState, int16* doorNativeBitmapIndices, int16 byteCount, DoorOrnament doorOrnament, DoorFrames* doorFrames) { +void DisplayMan::drawDoor(uint16 doorThingIndex, DoorState doorState, int16 *doorNativeBitmapIndices, int16 byteCount, DoorOrnament doorOrnament, DoorFrames *doorFrames) { if (doorState == kDMDoorStateOpen) return; @@ -1160,7 +1177,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 +1195,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 +1231,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 +1262,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 +1271,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 +1303,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 +1313,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 +1338,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 = kDMCellOrderNone; uint16 squareAspect[5]; bool skip = false; @@ -1333,27 +1350,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 +1386,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 +1396,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 +1423,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 +1434,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 +1456,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 +1464,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 +1473,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 +1500,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 +1512,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 +1527,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 +1544,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 +1555,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) { @@ -1563,10 +1580,10 @@ void DisplayMan::drawSquareD2R(Direction dir, int16 posX, int16 posY) { Frame(160, 183, 24, 82, 32, 61, 8, 0), /* Left Horizontal Closed three fourth */ Frame(216, 223, 24, 82, 32, 61, 32, 0), /* Right Horizontal Closed one fourth */ Frame(208, 223, 24, 82, 32, 61, 32, 0), /* Right Horizontal Closed half */ - Frame(200, 223, 24, 82, 32, 61, 32, 0) /* Right Horizontal Closed three fourth */ + 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 +1595,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 +1612,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 +1631,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 +1642,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 +1670,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 +1682,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 +1706,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 +1724,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 +1752,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 +1764,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 +1780,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 +1809,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 +1837,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 +1849,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 +1865,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 +1883,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 +1893,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 +1907,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 +1919,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 +1929,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), - boxThievesEyeVisibleArea, _boxThievesEyeViewPortVisibleArea._x1, _boxThievesEyeViewPortVisibleArea._y1, - k112_byteWidthViewport, 48, kM1_ColorNoTransparency, 136, 95); + isDerivedBitmapInCache(kDMDerivedBitmapThievesEyeVisibleArea); + blitToBitmap(_bitmapViewport, getDerivedBitmap(kDMDerivedBitmapThievesEyeVisibleArea), + boxThievesEyeVisibleArea, _boxThievesEyeViewPortVisibleArea._rect.left, _boxThievesEyeViewPortVisibleArea._rect.top, + 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 +1960,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 +1978,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 +1993,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 +2012,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 +2034,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) { @@ -2045,8 +2062,8 @@ void DisplayMan::drawSquareD0C(Direction dir, int16 posX, int16 posY) { if (_vm->_championMan->_party._event73Count_ThievesEye) { memmove(_tmpBitmap, _bitmapWallSetDoorFrameFront, 32 * 123); blitToBitmap(getNativeBitmapOrGraphic(k41_holeInWall_GraphicIndice), - _tmpBitmap, boxThievesEyeHoleInDoorFrame, doorFrameD0C._box._x1 - _boxThievesEyeViewPortVisibleArea._x1, - 0, 48, 16, k9_ColorGold, 95, 123); + _tmpBitmap, boxThievesEyeHoleInDoorFrame, doorFrameD0C._box._rect.left - _boxThievesEyeViewPortVisibleArea._rect.left, + 0, 48, 16, kDMColorGold, 95, 123); drawWallSetBitmap(_tmpBitmap, doorFrameD0C); } else drawWallSetBitmap(_bitmapWallSetDoorFrameFront, doorFrameD0C); @@ -2065,9 +2082,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) { @@ -2083,7 +2100,7 @@ void DisplayMan::drawDungeon(Direction dir, int16 posX, int16 posY) { _vm->_dungeonMan->_dungeonViewClickableBoxes[i].setToZero(); for (uint16 i = 0; i < 6; ++i) - _vm->_dungeonMan->_dungeonViewClickableBoxes[i]._x1 = 255; + _vm->_dungeonMan->_dungeonViewClickableBoxes[i]._rect.left = 255; _useFlippedWallAndFootprintsBitmap = (posX + posY + dir) & 1; if (_useFlippedWallAndFootprintsBitmap) { @@ -2111,15 +2128,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 +2198,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 +2350,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 +2488,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); } } @@ -2514,7 +2531,7 @@ bool DisplayMan::isDrawnWallOrnAnAlcove(int16 wallOrnOrd, ViewWall viewWallIndex 46, 57, 68 /* D1L Right, D1R Left */ }; - static byte g205_WallOrnCoordSets[8][13][6] = { // @ G0205_aaauc_Graphic558_WallOrnamentCoordinateSets + static byte wallOrnamentCoordSets[8][13][6] = { // @ G0205_aaauc_Graphic558_WallOrnamentCoordinateSets /* { X1, X2, Y1, Y2, ByteWidth, Height } */ { {80, 83, 41, 45, 8, 5}, /* D3L */ @@ -2646,7 +2663,7 @@ bool DisplayMan::isDrawnWallOrnAnAlcove(int16 wallOrnOrd, ViewWall viewWallIndex int16 wallOrnamentIndex = wallOrnOrd; int16 ornNativeBitmapIndex = _currMapWallOrnInfo[wallOrnamentIndex].nativeIndice; int16 wallOrnamentCoordinateSetIndex = _currMapWallOrnInfo[wallOrnamentIndex].coordinateSet; - byte *ornCoordSet = g205_WallOrnCoordSets[wallOrnamentCoordinateSetIndex][viewWallIndex]; + byte *ornCoordSet = wallOrnamentCoordSets[wallOrnamentCoordinateSetIndex][viewWallIndex]; bool isAlcove = _vm->_dungeonMan->isWallOrnAnAlcove(wallOrnamentIndex); unsigned char inscriptionString[70]; bool isInscription = (wallOrnamentIndex == _vm->_dungeonMan->_currMapInscriptionWallOrnIndex); @@ -2659,7 +2676,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; @@ -2670,19 +2687,21 @@ bool DisplayMan::isDrawnWallOrnAnAlcove(int16 wallOrnOrd, ViewWall viewWallIndex characterCount++; } Frame blitFrame; - blitFrame._box._x2 = (blitFrame._box._x1 = 112 - (characterCount << 2)) + 7; - blitFrame._box._y1 = (blitFrame._box._y2 = inscriptionLineY[textLineIndex++]) - 7; + blitFrame._box._rect.left = 112 - (characterCount << 2); + blitFrame._box._rect.right = blitFrame._box._rect.left + 7; + blitFrame._box._rect.bottom = inscriptionLineY[textLineIndex++]; + blitFrame._box._rect.top = blitFrame._box._rect.bottom - 7; while (characterCount--) { - blitToBitmap(L0092_puc_Bitmap, _bitmapViewport, blitFrame._box, *inscrString++ << 3, 0, k144_byteWidth, k112_byteWidthViewport, k10_ColorFlesh, 8, k136_heightViewport); - blitFrame._box._x1 += 8; - blitFrame._box._x2 += 8; + blitToBitmap(L0092_puc_Bitmap, _bitmapViewport, blitFrame._box, *inscrString++ << 3, 0, k144_byteWidth, k112_byteWidthViewport, kDMColorFlesh, 8, k136_heightViewport); + blitFrame._box._rect.left += 8; + blitFrame._box._rect.right += 8; } } while (*inscrString++ != 129); /* Hexadecimal: 0x81 (Megamax C does not support hexadecimal character constants) */ return isAlcove; } ornNativeBitmapIndex++; - Box tmpBox(ornCoordSet); - _vm->_dungeonMan->_dungeonViewClickableBoxes[k5_ViewCellDoorButtonOrWallOrn] = tmpBox; + Box tmpBox(ornCoordSet[0], ornCoordSet[1], ornCoordSet[2], ornCoordSet[3]); + _vm->_dungeonMan->_dungeonViewClickableBoxes[kDMViewCellDoorButtonOrWallOrn] = tmpBox; _vm->_dungeonMan->_isFacingAlcove = isAlcove; _vm->_dungeonMan->_isFacingViAltar = (wallOrnamentIndex == _currMapViAltarIndex); @@ -2704,19 +2723,20 @@ bool DisplayMan::isDrawnWallOrnAnAlcove(int16 wallOrnOrd, ViewWall viewWallIndex int16 coordinateSetOffset = 0; bool flipHorizontal = (viewWallIndex == kDMViewWallD2RLeft) || (viewWallIndex == kDMViewWallD3RLeft); if (flipHorizontal) - ornBlitBitmap = g205_WallOrnCoordSets[wallOrnamentCoordinateSetIndex][kDMViewWallD1RLeft]; + ornBlitBitmap = wallOrnamentCoordSets[wallOrnamentCoordinateSetIndex][kDMViewWallD1RLeft]; else if ((viewWallIndex == kDMViewWallD2LRight) || (viewWallIndex == kDMViewWallD3LRight)) - ornBlitBitmap = g205_WallOrnCoordSets[wallOrnamentCoordinateSetIndex][kDMViewWallD1LRight]; + ornBlitBitmap = wallOrnamentCoordSets[wallOrnamentCoordinateSetIndex][kDMViewWallD1LRight]; else { ornNativeBitmapIndex++; - ornBlitBitmap = g205_WallOrnCoordSets[wallOrnamentCoordinateSetIndex][kDMViewWallD1CFront]; + ornBlitBitmap = wallOrnamentCoordSets[wallOrnamentCoordinateSetIndex][kDMViewWallD1CFront]; if (viewWallIndex == kDMViewWallD2LFront) coordinateSetOffset = 6; else if (viewWallIndex == kDMViewWallD2RFront) coordinateSetOffset = -6; } blitPosX = (ornCoordSet + coordinateSetOffset)[1] - (ornCoordSet + coordinateSetOffset)[0]; - if (!isDerivedBitmapInCache(wallOrnamentIndex = k4_DerivedBitmapFirstWallOrnament + (wallOrnamentIndex << 2) + wallOrnDerivedBitmapIndexIncrement[viewWallIndex])) { + wallOrnamentIndex = kDMDerivedBitmapFirstWallOrnament + (wallOrnamentIndex << 2) + wallOrnDerivedBitmapIndexIncrement[viewWallIndex]; + if (!isDerivedBitmapInCache(wallOrnamentIndex)) { byte *blitBitmap = getNativeBitmapOrGraphic(ornNativeBitmapIndex); blitToBitmapShrinkWithPalChange(blitBitmap, getDerivedBitmap(wallOrnamentIndex), ornBlitBitmap[4] << 1, ornBlitBitmap[5], ornCoordSet[4] << 1, ornCoordSet[5], (viewWallIndex <= kDMViewWallD3RFront) ? _palChangesDoorButtonAndWallOrnD3 : _palChangesDoorButtonAndWallOrnD2); addDerivedBitmap(wallOrnamentIndex); @@ -2751,15 +2771,14 @@ 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); + Box tmpBox(ornCoordSet[0], ornCoordSet[1], ornCoordSet[2], ornCoordSet[3]); + blitToBitmap(ornBlitBitmap, _bitmapViewport, tmpBox, blitPosX, 0, + 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; @@ -2800,7 +2819,7 @@ uint32 DisplayMan::getCompressedDataSize(uint16 index) { return _packedItemPos[index + 1] - _packedItemPos[index]; } -void DisplayMan::drawField(FieldAspect* fieldAspect, Box& box) { +void DisplayMan::drawField(FieldAspect *fieldAspect, Box& box) { byte *bitmapMask = nullptr; if (fieldAspect->_mask != kMaskFieldAspectNoMask) { @@ -2812,13 +2831,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 +2849,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; @@ -2847,7 +2866,7 @@ void DisplayMan::drawObjectsCreaturesProjectilesExplosions(Thing thingParam, Dir #define AL_4_projectileAspect L0127_i_Multiple #define AL_4_explosionType L0127_i_Multiple #define AL_4_explosionAspectIndex L0127_i_Multiple - ObjectAspect* objectAspect; + ObjectAspect *objectAspect; uint32 remainingViewCellOrdinalsToProcess; byte *coordinateSet; int16 derivedBitmapIndex = -1; @@ -2871,10 +2890,10 @@ void DisplayMan::drawObjectsCreaturesProjectilesExplosions(Thing thingParam, Dir uint16 L0150_ui_Multiple = 0; #define AL_8_shiftSetIndex L0150_ui_Multiple #define AL_8_projectileScaleIndex L0150_ui_Multiple - CreatureAspect* creatureAspectStruct; - int16 creatureSize; + CreatureAspect *creatureAspectStruct = nullptr; + int16 creatureSize = 0; int16 creatureDirectionDelta; - int16 creatureGraphicInfoGreen; + int16 creatureGraphicInfoGreen = 0; int16 creatureGraphicInfoRed; int16 creatureAspectInt; int16 creatureIndexGreen; @@ -2888,7 +2907,7 @@ void DisplayMan::drawObjectsCreaturesProjectilesExplosions(Thing thingParam, Dir bool useFlippedHorizontallyCreatureFrontImage; bool drawCreaturesCompleted; /* Set to true when the last creature that the function should draw is being drawn. This is used to avoid processing the code to draw creatures for the remaining square cells */ int16 doorFrontViewDrawingPass; /* Value 0, 1 or 2 */ - int16 projectilePosX; + int16 projectilePosX = 0; int16 projectileDirection; int16 projectileAspectType; int16 projectileBitmapIndexDelta; @@ -3079,28 +3098,30 @@ 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 doorFrontViewDrawingPass = 0; /* The function call is not to draw objects on a door square viewed from the front */ - L0135_B_DrawAlcoveObjects = !(remainingViewCellOrdinalsToProcess = orderedViewCellOrdinals); + remainingViewCellOrdinalsToProcess = orderedViewCellOrdinals; + L0135_B_DrawAlcoveObjects = !(remainingViewCellOrdinalsToProcess); AL_10_viewSquareIndexBackup = viewSquareIndex; viewLane = (ViewLane)((viewSquareIndex + 3) % 3); bool twoHalfSquareCreaturesFrontView; - byte *bitmapRedBanana; - byte *bitmapGreenAnt; + byte *bitmapRedBanana = nullptr; + byte *bitmapGreenAnt = nullptr; 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 { @@ -3116,7 +3137,8 @@ void DisplayMan::drawObjectsCreaturesProjectilesExplosions(Thing thingParam, Dir objectShiftIndex += (cellYellowBear & 0x0001) << 3; drawProjectileAsObject = false; do { - if ((AL_4_thingType = thingParam.getType()) == kDMThingTypeGroup) { + AL_4_thingType = thingParam.getType(); + if (AL_4_thingType == kDMThingTypeGroup) { groupThing = thingParam; continue; } @@ -3131,7 +3153,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 +3166,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 +3182,9 @@ T0115015_DrawProjectileAsObject: } } else { drawingGrabbableObject = false; - derivedBitmapIndex = k104_DerivedBitmapFirstObject + objectAspect->_firstDerivedBitmapRelativeIndex; - byte* paletteChanges; - if ((viewSquareIndex >= k6_ViewSquare_D1C) || ((viewSquareIndex >= k3_ViewSquare_D2C) && (AL_2_viewCell >= k2_ViewCellBackRight))) { + derivedBitmapIndex = kDMDerivedBitmapFirstObject + objectAspect->_firstDerivedBitmapRelativeIndex; + byte *paletteChanges; + if ((viewSquareIndex >= kDMViewSquareD1C) || ((viewSquareIndex >= kDMViewSquareD2C) && (AL_2_viewCell >= kDMViewCellBackRight))) { derivedBitmapIndex++; AL_8_shiftSetIndex = k1_ShiftSet_D1BackD2Front; byteWidth = getScaledDimension(objectAspect->_byteWidth, k20_Scale_D2); @@ -3184,7 +3206,8 @@ T0115015_DrawProjectileAsObject: bitmapRedBanana = getDerivedBitmap(derivedBitmapIndex); else { bitmapGreenAnt = getNativeBitmapOrGraphic(AL_4_nativeBitmapIndex); - blitToBitmapShrinkWithPalChange(bitmapGreenAnt, bitmapRedBanana = getDerivedBitmap(derivedBitmapIndex), objectAspect->_byteWidth << 1, objectAspect->_height, byteWidth << 1, heightRedEagle, paletteChanges); + bitmapRedBanana = getDerivedBitmap(derivedBitmapIndex); + blitToBitmapShrinkWithPalChange(bitmapGreenAnt, bitmapRedBanana, objectAspect->_byteWidth << 1, objectAspect->_height, byteWidth << 1, heightRedEagle, paletteChanges); if (flipHorizontal) flipBitmapHorizontal(bitmapRedBanana, getNormalizedByteWidth(byteWidth), heightRedEagle); @@ -3192,10 +3215,10 @@ T0115015_DrawProjectileAsObject: } } AL_4_xPos = coordinateSet[0]; - boxByteGreen._y2 = coordinateSet[1]; + boxByteGreen._rect.bottom = coordinateSet[1]; if (!drawProjectileAsObject) { /* If drawing an object that is not a projectile */ AL_4_xPos += shiftSets[AL_8_shiftSetIndex][objectPileShiftSetIndices[objectShiftIndex][0]]; - boxByteGreen._y2 += shiftSets[AL_8_shiftSetIndex][objectPileShiftSetIndices[objectShiftIndex][1]]; + boxByteGreen._rect.bottom += shiftSets[AL_8_shiftSetIndex][objectPileShiftSetIndices[objectShiftIndex][1]]; objectShiftIndex++; /* The next object drawn will use the next shift values */ if (L0135_B_DrawAlcoveObjects) { if (objectShiftIndex >= 14) @@ -3203,13 +3226,13 @@ T0115015_DrawProjectileAsObject: } else objectShiftIndex &= 0x000F; } - boxByteGreen._y1 = boxByteGreen._y2 - (heightRedEagle - 1); - if (boxByteGreen._y2 > 135) - boxByteGreen._y2 = 135; + boxByteGreen._rect.top = boxByteGreen._rect.bottom - (heightRedEagle - 1); + if (boxByteGreen._rect.bottom > 135) + boxByteGreen._rect.bottom = 135; - boxByteGreen._x2 = MIN(223, AL_4_xPos + byteWidth); - boxByteGreen._x1 = MAX(0, AL_4_xPos - byteWidth + 1); - if (boxByteGreen._x1) { + boxByteGreen._rect.right = MIN(223, AL_4_xPos + byteWidth); + boxByteGreen._rect.left = MAX(0, AL_4_xPos - byteWidth + 1); + if (boxByteGreen._rect.left) { if (flipHorizontal) AL_4_xPos = paddingPixelCount; else @@ -3222,34 +3245,35 @@ T0115015_DrawProjectileAsObject: Box *AL_6_box = &_vm->_dungeonMan->_dungeonViewClickableBoxes[AL_2_viewCell]; - if (AL_6_box->_x1 == 255) { /* If the grabbable object is the first */ + if (AL_6_box->_rect.left == 255) { /* If the grabbable object is the first */ *AL_6_box = boxByteGreen; - if ((heightGreenGoat = AL_6_box->_y2 - AL_6_box->_y1) < 14) { /* If the box is too small then enlarge it a little */ + heightGreenGoat = AL_6_box->_rect.bottom - AL_6_box->_rect.top; + if (heightGreenGoat < 14) { /* If the box is too small then enlarge it a little */ heightGreenGoat = heightGreenGoat >> 1; - AL_6_box->_y1 += heightGreenGoat - 7; + AL_6_box->_rect.top += heightGreenGoat - 7; if (heightGreenGoat < 4) - AL_6_box->_y2 -= heightGreenGoat - 3; + AL_6_box->_rect.bottom -= heightGreenGoat - 3; } } else { /* If there are several grabbable objects then enlarge the box so it includes all objects */ - AL_6_box->_x1 = MIN(AL_6_box->_x1, boxByteGreen._x1); - AL_6_box->_x2 = MAX(AL_6_box->_x2, boxByteGreen._x2); - AL_6_box->_y1 = MIN(AL_6_box->_y1, boxByteGreen._y1); - AL_6_box->_y2 = MAX(AL_6_box->_y2, boxByteGreen._y2); + AL_6_box->_rect.left = MIN(AL_6_box->_rect.left, boxByteGreen._rect.left); + AL_6_box->_rect.right = MAX(AL_6_box->_rect.right, boxByteGreen._rect.right); + AL_6_box->_rect.top = MIN(AL_6_box->_rect.top, boxByteGreen._rect.top); + AL_6_box->_rect.bottom = MAX(AL_6_box->_rect.bottom, boxByteGreen._rect.bottom); } 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 */ @@ -3259,7 +3283,7 @@ T0115015_DrawProjectileAsObject: activeGroup = &_vm->_groupMan->_activeGroups[group->getActiveGroupIndex()]; CreatureInfo *creatureInfo = &_vm->_dungeonMan->_creatureInfos[group->_type]; creatureAspectStruct = &_creatureAspects219[creatureInfo->_creatureAspectIndex]; - creatureSize = getFlag(creatureInfo->_attributes, k0x0003_MaskCreatureInfo_size); + creatureSize = getFlag(creatureInfo->_attributes, kDMCreatureMaskSize); creatureGraphicInfoGreen = creatureInfo->_graphicInfo; } objectAspect = (ObjectAspect *)creatureAspectStruct; @@ -3268,7 +3292,7 @@ T0115015_DrawProjectileAsObject: if (AL_0_creatureIndexRed) { /* If there is a creature on the cell being processed */ AL_0_creatureIndexRed--; /* Convert ordinal to index */ creatureIndexGreen = AL_0_creatureIndexRed; - } else if (creatureSize == k1_MaskCreatureSizeHalf) { + } else if (creatureSize == kDMCreatureSizeHalf) { AL_0_creatureIndexRed = 0; creatureIndexGreen = -1; } else @@ -3276,16 +3300,17 @@ T0115015_DrawProjectileAsObject: creatureDirectionDelta = _vm->normalizeModulo4(directionParam - _vm->_groupMan->getCreatureValue(activeGroup->_directions, AL_0_creatureIndexRed)); twoHalfSquareCreaturesFrontView = false; - if ((AL_4_groupCells = activeGroup->_cells) == k255_CreatureTypeSingleCenteredCreature) { /* If there is a single centered creature in the group */ + AL_4_groupCells = activeGroup->_cells; + if (AL_4_groupCells == kDMCreatureTypeSingleCenteredCreature) { /* If there is a single centered creature in the group */ if (remainingViewCellOrdinalsToProcess || (doorFrontViewDrawingPass == 1)) goto T0115129_DrawProjectiles; /* Do not draw a single centered creature now, wait until second pass (for a front view door) or until all cells have been drawn so the creature is drawn over all the objects on the floor */ drawCreaturesCompleted = true; - if ((creatureSize == k1_MaskCreatureSizeHalf) && (creatureDirectionDelta & 0x0001)) /* Side view of half square creature */ + if ((creatureSize == kDMCreatureSizeHalf) && (creatureDirectionDelta & 0x0001)) /* Side view of half square creature */ AL_2_viewCell = k3_HalfSizedViewCell_CenterColumn; else AL_2_viewCell = k4_HalfSizedViewCell_FrontRow; - } else if ((creatureSize == k1_MaskCreatureSizeHalf) && (drawingLastBackRowCell || !remainingViewCellOrdinalsToProcess || (creatureIndexGreen < 0))) { + } else if ((creatureSize == kDMCreatureSizeHalf) && (drawingLastBackRowCell || !remainingViewCellOrdinalsToProcess || (creatureIndexGreen < 0))) { if (drawingLastBackRowCell && (doorFrontViewDrawingPass != 2)) { if ((creatureIndexGreen >= 0) && (creatureDirectionDelta & 0x0001)) AL_2_viewCell = k2_HalfSizedViewCell_BackRow; /* Side view of a half square creature on the back row. Drawn during pass 1 for a door square */ @@ -3303,18 +3328,19 @@ T0115015_DrawProjectileAsObject: creatureIndexGreen = 0; twoHalfSquareCreaturesFrontView = group->getCount(); - if (((AL_4_groupCells = _vm->_groupMan->getCreatureValue(AL_4_groupCells, AL_0_creatureIndexRed)) == directionParam) || (AL_4_groupCells == _vm->turnDirLeft(directionParam))) + AL_4_groupCells = _vm->_groupMan->getCreatureValue(AL_4_groupCells, AL_0_creatureIndexRed); + if ((AL_4_groupCells == directionParam) || (AL_4_groupCells == _vm->turnDirLeft(directionParam))) AL_2_viewCell = k0_HalfSizedViewCell_LeftColumn; else AL_2_viewCell = k1_HalfSizedViewCell_RightColumn; } } else goto T0115129_DrawProjectiles; - } else if (creatureSize != k0_MaskCreatureSizeQuarter) + } else if (creatureSize != kDMCreatureSizeQuarter) goto T0115129_DrawProjectiles; creatureAspectInt = activeGroup->_aspect[creatureIndexGreen]; - if (viewSquareIndex > k9_ViewSquare_D0C) + if (viewSquareIndex > kDMViewSquareD0C) viewSquareIndex--; T0115077_DrawSecondHalfSquareCreature: @@ -3326,7 +3352,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 +3360,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, kDMAspectMaskActiveGroupIsAttacking) && 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 +3382,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 +3390,16 @@ T0115077_DrawSecondHalfSquareCreature: derivedBitmapIndex += 2; } } else { - useFlippedHorizontallyCreatureFrontImage = getFlag(creatureGraphicInfoRed, k0x0004_CreatureInfoGraphicMaskFlipNonAttack) && getFlag(creatureAspectInt, k0x0040_MaskActiveGroupFlipBitmap); + useFlippedHorizontallyCreatureFrontImage = getFlag(creatureGraphicInfoRed, kDMCreatureMaskFlipNonAttack) && getFlag(creatureAspectInt, kDMAspectMaskActiveGroupFlipBitmap); 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 +3407,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(); @@ -3393,7 +3419,7 @@ T0115077_DrawSecondHalfSquareCreature: } } else if (useCreatureBackBitmap || !useFlippedHorizontallyCreatureFrontImage) { bitmapRedBanana = getNativeBitmapOrGraphic(AL_4_nativeBitmapIndex); - if (useCreatureAttackBitmap && getFlag(creatureAspectInt, k0x0040_MaskActiveGroupFlipBitmap)) { + if (useCreatureAttackBitmap && getFlag(creatureAspectInt, kDMAspectMaskActiveGroupFlipBitmap)) { copyBitmapAndFlipHorizontal(bitmapRedBanana, _tmpBitmap, byteWidth, heightRedEagle); bitmapRedBanana = _tmpBitmap; } @@ -3401,20 +3427,21 @@ T0115077_DrawSecondHalfSquareCreature: bitmapRedBanana = getDerivedBitmap(derivedBitmapIndex); else { bitmapGreenAnt = getNativeBitmapOrGraphic(AL_4_nativeBitmapIndex); - if (getFlag(creatureGraphicInfoRed, k0x0004_CreatureInfoGraphicMaskFlipNonAttack)) - copyBitmapAndFlipHorizontal(bitmapGreenAnt, bitmapRedBanana = getDerivedBitmap(derivedBitmapIndex), byteWidth, heightRedEagle); - + if (getFlag(creatureGraphicInfoRed, kDMCreatureMaskFlipNonAttack)) { + bitmapRedBanana = getDerivedBitmap(derivedBitmapIndex); + copyBitmapAndFlipHorizontal(bitmapGreenAnt, bitmapRedBanana, byteWidth, heightRedEagle); + } addDerivedBitmap(derivedBitmapIndex); } } else { /* Creature is on D2 or D3 */ if (useFlippedHorizontallyCreatureFrontImage) derivedBitmapIndex++; /* Skip front D1 image in additional graphics */ - byte* paletteChanges; - if (viewSquareIndex >= k3_ViewSquare_D2C) { /* Creature is on D2 */ + byte *paletteChanges; + 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 */ @@ -3433,13 +3460,14 @@ T0115077_DrawSecondHalfSquareCreature: bitmapRedBanana = getDerivedBitmap(derivedBitmapIndex); else { bitmapGreenAnt = getNativeBitmapOrGraphic(AL_4_nativeBitmapIndex); - blitToBitmapShrinkWithPalChange(bitmapGreenAnt, bitmapRedBanana = getDerivedBitmap(derivedBitmapIndex), sourceByteWidth << 1, sourceHeight, byteWidth << 1, heightRedEagle, paletteChanges); + bitmapRedBanana = getDerivedBitmap(derivedBitmapIndex); + blitToBitmapShrinkWithPalChange(bitmapGreenAnt, bitmapRedBanana, sourceByteWidth << 1, sourceHeight, byteWidth << 1, heightRedEagle, paletteChanges); addDerivedBitmap(derivedBitmapIndex); } 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 */ + (useCreatureAttackBitmap && getFlag(creatureAspectInt, kDMAspectMaskActiveGroupFlipBitmap)) || + (useCreatureSpecialD2FrontBitmap && getFlag(creatureGraphicInfoRed, kDMCreatureMaskSpecialD2FrontIsFlipped)) || + (useFlippedHorizontallyCreatureFrontImage && getFlag(creatureGraphicInfoRed, kDMCreatureMaskFlipNonAttack))) { /* If the graphic should be flipped */ if (!useFlippedHorizontallyCreatureFrontImage || !derivedBitmapInCache) { AL_4_normalizdByteWidth = getNormalizedByteWidth(byteWidth); if (!useFlippedHorizontallyCreatureFrontImage) { @@ -3454,8 +3482,8 @@ T0115077_DrawSecondHalfSquareCreature: } AL_4_yPos = coordinateSet[1]; AL_4_yPos += shiftSets[AL_8_shiftSetIndex][getVerticalOffsetM23(creatureAspectInt)]; - boxByteGreen._y2 = MIN(AL_4_yPos, (int16)135); - boxByteGreen._y1 = MAX(0, AL_4_yPos - (heightRedEagle - 1)); + boxByteGreen._rect.bottom = MIN(AL_4_yPos, (int16)135); + boxByteGreen._rect.top = MAX(0, AL_4_yPos - (heightRedEagle - 1)); AL_4_xPos = coordinateSet[0]; AL_4_xPos += shiftSets[AL_8_shiftSetIndex][getHorizontalOffsetM22(creatureAspectInt)]; @@ -3464,14 +3492,14 @@ T0115077_DrawSecondHalfSquareCreature: else if (viewLane != kDMViewLaneCenter) /* Lane right */ AL_4_xPos += 100; - boxByteGreen._x2 = CLIP(0, AL_4_xPos + byteWidth, 223); + boxByteGreen._rect.right = CLIP(0, AL_4_xPos + byteWidth, 223); - if (!boxByteGreen._x2) + if (!boxByteGreen._rect.right) goto T0115126_CreatureNotVisible; int16 AL_0_creaturePosX; - boxByteGreen._x1 = CLIP(0, AL_4_xPos - byteWidth + 1, 223); - if (boxByteGreen._x1) { - if (boxByteGreen._x1 == 223) + boxByteGreen._rect.left = CLIP(0, AL_4_xPos - byteWidth + 1, 223); + if (boxByteGreen._rect.left) { + if (boxByteGreen._rect.left == 223) goto T0115126_CreatureNotVisible; AL_0_creaturePosX = creaturePaddingPixelCount; } else @@ -3495,7 +3523,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]; @@ -3506,13 +3534,14 @@ T0115129_DrawProjectiles: do { if ((thingParam.getType() == kDMThingTypeProjectile) && (thingParam.getCell() == cellYellowBear)) { Projectile *projectile = (Projectile *)_vm->_dungeonMan->getThingData(thingParam); - if ((AL_4_projectileAspect = _vm->_dungeonMan->getProjectileAspect(projectile->_slot)) < 0) { /* Negative value: projectile aspect is the ordinal of a PROJECTIL_ASPECT */ + AL_4_projectileAspect = _vm->_dungeonMan->getProjectileAspect(projectile->_slot); + if (AL_4_projectileAspect < 0) { /* Negative value: projectile aspect is the ordinal of a PROJECTIL_ASPECT */ objectAspect = (ObjectAspect *)&_projectileAspect[_vm->ordinalToIndex(-AL_4_projectileAspect)]; AL_4_nativeBitmapIndex = ((ProjectileAspect *)objectAspect)->_firstNativeBitmapRelativeIndex + k316_FirstProjectileGraphicIndice; 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,8 +3569,9 @@ T0115129_DrawProjectiles: projectileBitmapIndexDelta = 2; if (projectileAspectTypeHasBackGraphicAndRotation) { - flipHorizontal = (AL_2_viewCell == k0_ViewCellFronLeft) || (AL_2_viewCell == k3_ViewCellBackLeft); - if (!(flipVertical = projectileFlipVertical)) + flipHorizontal = (AL_2_viewCell == kDMViewCellFronLeft) || (AL_2_viewCell == kDMViewCellBackLeft); + flipVertical = projectileFlipVertical; + if (!flipVertical) flipHorizontal = !flipHorizontal; } else { flipVertical = false; @@ -3553,8 +3583,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 +3595,8 @@ T0115129_DrawProjectiles: if (flipHorizontal) paddingPixelCount = (7 - ((byteWidth - 1) & 0x0007)) << 1; - if (doNotScaleWithKineticEnergy && isDerivedBitmapInCache(derivedBitmapIndex = k282_DerivedBitmapFirstProjectile + ((ProjectileAspect *)objectAspect)->_firstDerivedBitmapRelativeIndex + (projectileBitmapIndexDelta * 6) + AL_8_projectileScaleIndex)) { + derivedBitmapIndex = kDMDerivedBitmapFirstProjectile + ((ProjectileAspect *)objectAspect)->_firstDerivedBitmapRelativeIndex + (projectileBitmapIndexDelta * 6) + AL_8_projectileScaleIndex; + if (doNotScaleWithKineticEnergy && isDerivedBitmapInCache(derivedBitmapIndex)) { bitmapRedBanana = getDerivedBitmap(derivedBitmapIndex); } else { bitmapGreenAnt = getNativeBitmapOrGraphic(AL_4_nativeBitmapIndex); @@ -3592,11 +3623,11 @@ T0115129_DrawProjectiles: if (flipHorizontal) flipBitmapHorizontal(bitmapRedBanana, AL_4_normalizdByteWidth, heightRedEagle); } - boxByteGreen._y2 = (heightRedEagle >> 1) + 47; - boxByteGreen._y1 = 47 - (heightRedEagle >> 1) + !(heightRedEagle & 0x0001); - boxByteGreen._x2 = MIN(223, projectilePosX + byteWidth); - boxByteGreen._x1 = MAX(0, projectilePosX - byteWidth + 1); - if (boxByteGreen._x1) { + boxByteGreen._rect.bottom = (heightRedEagle >> 1) + 47; + boxByteGreen._rect.top = 47 - (heightRedEagle >> 1) + !(heightRedEagle & 0x0001); + boxByteGreen._rect.right = MIN(223, projectilePosX + byteWidth); + boxByteGreen._rect.left = MAX(0, projectilePosX - byteWidth + 1); + if (boxByteGreen._rect.left) { if (flipHorizontal) AL_4_xPos = paddingPixelCount; else @@ -3604,7 +3635,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]; @@ -3635,18 +3666,19 @@ T0115171_BackFromT0115015_DrawProjectileAsObject:; if (thingParam.getType() == kDMThingTypeExplosion) { 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 */ + AL_4_explosionType = explosion->getType(); + bool rebirthExplosion = ((uint16)AL_4_explosionType >= kDMExplosionTypeRebirthStep1); + 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 +3686,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 +3711,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 +3731,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]; } @@ -3715,19 +3747,19 @@ T0115200_DrawExplosion: if (flipHorizontal) paddingPixelCount = (7 - ((byteWidth - 1) & 0x0007)) << 1; /* Number of unused pixels in the units on the right of the bitmap */ - boxByteGreen._y2 = MIN(135, explosionCoordinates[1] + (heightRedEagle >> 1)); + boxByteGreen._rect.bottom = MIN(135, explosionCoordinates[1] + (heightRedEagle >> 1)); AL_4_yPos = MAX(0, explosionCoordinates[1] - (heightRedEagle >> 1) + !(heightRedEagle & 0x0001)); if (AL_4_yPos >= 136) continue; - boxByteGreen._y1 = AL_4_yPos; + boxByteGreen._rect.top = AL_4_yPos; AL_4_xPos = MIN(223, explosionCoordinates[0] + byteWidth); if (AL_4_xPos < 0) continue; - boxByteGreen._x2 = AL_4_xPos; + boxByteGreen._rect.right = AL_4_xPos; AL_4_xPos = explosionCoordinates[0]; - boxByteGreen._x1 = CLIP(0, AL_4_xPos - byteWidth + 1, 223); + boxByteGreen._rect.left = CLIP(0, AL_4_xPos - byteWidth + 1, 223); - if (boxByteGreen._x1) + if (boxByteGreen._rect.left) AL_4_xPos = paddingPixelCount; else { AL_4_xPos = MAX(paddingPixelCount, int16(byteWidth - AL_4_xPos - 1)); /* BUG0_07 Graphical glitch when drawing explosions. If an explosion bitmap is cropped because it is only partly visible on the left side of the viewport (boxByteGreen.X1 = 0) and the bitmap is not flipped horizontally (flipHorizontal = false) then the variable paddingPixelCount is not set before being used here. Its previous value (defined while drawing something else) is used and may cause an incorrect bitmap to be drawn */ @@ -3735,7 +3767,7 @@ T0115200_DrawExplosion: /* 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 */ } - if (boxByteGreen._x2 <= boxByteGreen._x1) + if (boxByteGreen._rect.right <= boxByteGreen._rect.left) continue; byteWidth = getNormalizedByteWidth(byteWidth); @@ -3750,7 +3782,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); @@ -3785,7 +3817,7 @@ bool DisplayMan::isDerivedBitmapInCache(int16 derivedBitmapIndex) { return true; } -byte* DisplayMan::getDerivedBitmap(int16 derivedBitmapIndex) { +byte *DisplayMan::getDerivedBitmap(int16 derivedBitmapIndex) { return _derivedBitmaps[derivedBitmapIndex]; } @@ -3810,7 +3842,7 @@ uint16 DisplayMan::getDarkenedColor(uint16 RGBcolor) { return RGBcolor; } -void DisplayMan::startEndFadeToPalette(uint16* P0849_pui_Palette) { +void DisplayMan::startEndFadeToPalette(uint16 *P0849_pui_Palette) { uint16 *paletteRegister = _paletteFadeTemporary; for (int16 i = 0; i < 16; i++) @@ -3865,7 +3897,7 @@ void DisplayMan::startEndFadeToPalette(uint16* P0849_pui_Palette) { } } -void DisplayMan::buildPaletteChangeCopperList(uint16* middleScreen, uint16* topAndBottom) { +void DisplayMan::buildPaletteChangeCopperList(uint16 *middleScreen, uint16 *topAndBottom) { _paletteFadeFrom = topAndBottom; byte colorPalette[32 * 3]; for (int i = 0; i < 16; ++i) { |