diff options
author | Strangerke | 2016-09-14 21:58:22 +0200 |
---|---|---|
committer | Strangerke | 2016-09-14 21:59:39 +0200 |
commit | 535ded7e553404cfe57a11fd715ad0f04117b95c (patch) | |
tree | 6879a25a5d88437a36f0c3eaa1c4f70ddafe354f | |
parent | 58d302b6411620e73e01da6cdccdb5a036b43890 (diff) | |
download | scummvm-rg350-535ded7e553404cfe57a11fd715ad0f04117b95c.tar.gz scummvm-rg350-535ded7e553404cfe57a11fd715ad0f04117b95c.tar.bz2 scummvm-rg350-535ded7e553404cfe57a11fd715ad0f04117b95c.zip |
DM: Add DoorOrnament enum, some refactoring in drawDoorOrnament to make use of it
-rw-r--r-- | engines/dm/gfx.cpp | 44 | ||||
-rw-r--r-- | engines/dm/gfx.h | 12 |
2 files changed, 29 insertions, 27 deletions
diff --git a/engines/dm/gfx.cpp b/engines/dm/gfx.cpp index f1d5fe22e4..72e9a4959d 100644 --- a/engines/dm/gfx.cpp +++ b/engines/dm/gfx.cpp @@ -1076,7 +1076,7 @@ void DisplayMan::drawFloorOrnament(uint16 floorOrnOrdinal, ViewFloor viewFloorIn drawFloorOrnament(_vm->indexToOrdinal(k15_FloorOrnFootprints), viewFloorIndex); } -void DisplayMan::drawDoor(uint16 doorThingIndex, DoorState doorState, int16* doorNativeBitmapIndices, int16 byteCount, int16 viewDoorOrnIndex, DoorFrames* doorFrames) { +void DisplayMan::drawDoor(uint16 doorThingIndex, DoorState doorState, int16* doorNativeBitmapIndices, int16 byteCount, DoorOrnament doorOrnament, DoorFrames* doorFrames) { if (doorState == kDMDoorStateOpen) return; @@ -1084,7 +1084,7 @@ void DisplayMan::drawDoor(uint16 doorThingIndex, DoorState doorState, int16* doo Door *door = (Door *)(_vm->_dungeonMan->_thingData[kDMThingTypeDoor]) + doorThingIndex; uint16 doorType = door->getType(); memmove(_tmpBitmap, getNativeBitmapOrGraphic(doorNativeBitmapIndices[doorType]), byteCount * 2); - drawDoorOrnament(door->getOrnOrdinal(), viewDoorOrnIndex); + drawDoorOrnament(door->getOrnOrdinal(), doorOrnament); if (getFlag(_vm->_dungeonMan->_currMapDoorInfo[doorType]._attributes, k0x0004_MaskDoorInfo_Animated)) { if (_vm->getRandomNumber(2)) flipBitmapHorizontal(_tmpBitmap, doorFramesTemp->_closedOrDestroyed._srcByteWidth, doorFramesTemp->_closedOrDestroyed._srcHeight); @@ -1094,12 +1094,12 @@ void DisplayMan::drawDoor(uint16 doorThingIndex, DoorState doorState, int16* doo } if ((doorFramesTemp == _doorFrameD1C) && _vm->_championMan->_party._event73Count_ThievesEye) - drawDoorOrnament(_vm->indexToOrdinal(k16_DoorOrnThivesEyeMask), k2_ViewDoorOrnament_D1LCR); + drawDoorOrnament(_vm->indexToOrdinal(k16_DoorOrnThivesEyeMask), kDMDoorOrnamentD1LCR); if (doorState == kDMDoorStateClosed) drawDoorBitmap(&doorFramesTemp->_closedOrDestroyed); else if (doorState == kDMDoorStateDestroyed) { - drawDoorOrnament(_vm->indexToOrdinal(k15_DoorOrnDestroyedMask), viewDoorOrnIndex); + drawDoorOrnament(_vm->indexToOrdinal(k15_DoorOrnDestroyedMask), doorOrnament); drawDoorBitmap(&doorFramesTemp->_closedOrDestroyed); } else { int16 idx = doorState - 1; @@ -1112,7 +1112,7 @@ void DisplayMan::drawDoor(uint16 doorThingIndex, DoorState doorState, int16* doo } } -void DisplayMan::drawDoorOrnament(int16 doorOrnOrdinal, int16 viewDoorOrnIndex) { +void DisplayMan::drawDoorOrnament(int16 doorOrnOrdinal, DoorOrnament doorOrnament) { static byte palChangesDoorOrnD3[16] = {0, 120, 10, 30, 40, 30, 0, 60, 30, 90, 100, 110, 0, 20, 0, 130}; // @ G0200_auc_Graphic558_PaletteChanges_DoorOrnament_D3 static byte palChangesDoorOrnd2[16] = {0, 10, 20, 30, 40, 30, 60, 70, 50, 90, 100, 110, 120, 130, 140, 150}; // @ G0201_auc_Graphic558_PaletteChanges_DoorOrnament_D2 static uint16 doorOrnCoordSets[4][3][6] = { // @ G0207_aaauc_Graphic558_DoorOrnamentCoordinateSets @@ -1144,27 +1144,27 @@ void DisplayMan::drawDoorOrnament(int16 doorOrnOrdinal, int16 viewDoorOrnIndex) if (!height) return; - int16 byteWidth = viewDoorOrnIndex; + int16 byteWidth; height--; int16 nativeBitmapIndex = _currMapDoorOrnInfo[height][k0_NativeBitmapIndex]; int16 coordSetGreenToad = _currMapDoorOrnInfo[height][k1_CoordinateSet]; - uint16 *coordSetOrangeElk = &doorOrnCoordSets[coordSetGreenToad][byteWidth][0]; + uint16 *coordSetOrangeElk = &doorOrnCoordSets[coordSetGreenToad][doorOrnament][0]; byte *blitBitmap; - if (byteWidth == k2_ViewDoorOrnament_D1LCR) { + if (doorOrnament == kDMDoorOrnamentD1LCR) { blitBitmap = getNativeBitmapOrGraphic(nativeBitmapIndex); byteWidth = k48_byteWidth; height = 88; } else { - height = k68_DerivedBitmapFirstDoorOrnament_D3 + (height * 2) + byteWidth; + height = k68_DerivedBitmapFirstDoorOrnament_D3 + (height * 2) + doorOrnament; if (!isDerivedBitmapInCache(height)) { - uint16 *coordSetRedEagle = &doorOrnCoordSets[coordSetGreenToad][k2_ViewDoorOrnament_D1LCR][0]; + uint16 *coordSetRedEagle = &doorOrnCoordSets[coordSetGreenToad][kDMDoorOrnamentD1LCR][0]; byte *nativeBitmap = getNativeBitmapOrGraphic(nativeBitmapIndex); - blitToBitmapShrinkWithPalChange(nativeBitmap, getDerivedBitmap(height), coordSetRedEagle[4] << 1, coordSetRedEagle[5], coordSetOrangeElk[1] - coordSetOrangeElk[0] + 1, coordSetOrangeElk[5], (byteWidth == k0_ViewDoorOrnament_D3LCR) ? palChangesDoorOrnD3 : palChangesDoorOrnd2); + blitToBitmapShrinkWithPalChange(nativeBitmap, getDerivedBitmap(height), coordSetRedEagle[4] << 1, coordSetRedEagle[5], coordSetOrangeElk[1] - coordSetOrangeElk[0] + 1, coordSetOrangeElk[5], (doorOrnament == kDMDoorOrnamentD3LCR) ? palChangesDoorOrnD3 : palChangesDoorOrnd2); addDerivedBitmap(height); } blitBitmap = getDerivedBitmap(height); - if (byteWidth == k0_ViewDoorOrnament_D3LCR) { + if (doorOrnament == kDMDoorOrnamentD3LCR) { byteWidth = k24_byteWidth; height = 41; } else { @@ -1273,7 +1273,7 @@ void DisplayMan::drawSquareD3L(Direction dir, int16 posX, int16 posY) { drawObjectsCreaturesProjectilesExplosions(Thing(squareAspect[kDMSquareAspectFirstGroupOrObject]), dir, posX, posY, k1_ViewSquare_D3L, k0x0218_CellOrder_DoorPass1_BackLeft_BackRight); drawWallSetBitmap(_bitmapWallSetDoorFrameLeftD3L, doorFrameLeftD3L); drawDoor(squareAspect[kDMSquareAspectDoorThingIndex], (DoorState)squareAspect[kDMSquareAspectDoorState], - _doorNativeBitmapIndexFrontD3LCR, getBitmapByteCount(48, 41), k0_ViewDoorOrnament_D3LCR, &doorFrameD3L); + _doorNativeBitmapIndexFrontD3LCR, getBitmapByteCount(48, 41), kDMDoorOrnamentD3LCR, &doorFrameD3L); order = k0x0349_CellOrder_DoorPass2_FrontLeft_FrontRight; break; case kDMElementTypePit: @@ -1357,7 +1357,7 @@ void DisplayMan::drawSquareD3R(Direction dir, int16 posX, int16 posY) { drawDoor(squareAspect[kDMSquareAspectDoorThingIndex], (DoorState)squareAspect[kDMSquareAspectDoorState], _doorNativeBitmapIndexFrontD3LCR, - getBitmapByteCount(48, 41), k0_ViewDoorOrnament_D3LCR, &doorFrameD3R); + getBitmapByteCount(48, 41), kDMDoorOrnamentD3LCR, &doorFrameD3R); break;; case kDMElementTypePit: if (!squareAspect[kDMSquareAspectPitInvisible]) @@ -1431,10 +1431,10 @@ void DisplayMan::drawSquareD3C(Direction dir, int16 posX, int16 posY) { memmove(_tmpBitmap, _bitmapWallSetDoorFrameLeftD3C, 32 * 44); drawDoorFrameBitmapFlippedHorizontally(_tmpBitmap, &doorFrameRightD3C); if (((Door *)_vm->_dungeonMan->_thingData[kDMThingTypeDoor])[squareAspect[kDMSquareAspectDoorThingIndex]].hasButton()) - drawDoorButton(_vm->indexToOrdinal(k0_DoorButton), k1_ViewDoorOrnament_D2LCR); + drawDoorButton(_vm->indexToOrdinal(k0_DoorButton), kDMDoorOrnamentD2LCR); drawDoor(squareAspect[kDMSquareAspectDoorThingIndex], (DoorState)squareAspect[kDMSquareAspectDoorState], - _doorNativeBitmapIndexFrontD3LCR, getBitmapByteCount(48, 41), k0_ViewDoorOrnament_D3LCR, &doorFrameD3C); + _doorNativeBitmapIndexFrontD3LCR, getBitmapByteCount(48, 41), kDMDoorOrnamentD3LCR, &doorFrameD3C); order = k0x0349_CellOrder_DoorPass2_FrontLeft_FrontRight; break; case kDMElementTypePit: @@ -1514,7 +1514,7 @@ void DisplayMan::drawSquareD2L(Direction dir, int16 posX, int16 posY) { drawObjectsCreaturesProjectilesExplosions(Thing(squareAspect[kDMSquareAspectFirstGroupOrObject]), dir, posX, posY, k4_ViewSquare_D2L, k0x0218_CellOrder_DoorPass1_BackLeft_BackRight); drawWallSetBitmap(_bitmapWallSetDoorFrameTopD2LCR, doorFrameTopD2L); drawDoor(squareAspect[kDMSquareAspectDoorThingIndex], (DoorState)squareAspect[kDMSquareAspectDoorState], _doorNativeBitmapIndexFrontD2LCR, - getBitmapByteCount(64, 61), k1_ViewDoorOrnament_D2LCR, &doorFrameD2L); + getBitmapByteCount(64, 61), kDMDoorOrnamentD2LCR, &doorFrameD2L); order = k0x0349_CellOrder_DoorPass2_FrontLeft_FrontRight; break; case kDMElementTypePit: @@ -1601,7 +1601,7 @@ void DisplayMan::drawSquareD2R(Direction dir, int16 posX, int16 posY) { drawObjectsCreaturesProjectilesExplosions(Thing(squareAspect[kDMSquareAspectFirstGroupOrObject]), dir, posX, posY, k5_ViewSquare_D2R, k0x0128_CellOrder_DoorPass1_BackRight_BackLeft); drawWallSetBitmap(_bitmapWallSetDoorFrameTopD2LCR, doorFrameTopD2R); drawDoor(squareAspect[kDMSquareAspectDoorThingIndex], (DoorState)squareAspect[kDMSquareAspectDoorState], - _doorNativeBitmapIndexFrontD2LCR, getBitmapByteCount(64, 61), k1_ViewDoorOrnament_D2LCR, &doorFrameD2R); + _doorNativeBitmapIndexFrontD2LCR, getBitmapByteCount(64, 61), kDMDoorOrnamentD2LCR, &doorFrameD2R); order = k0x0439_CellOrder_DoorPass2_FrontRight_FrontLeft; break; case kDMElementTypePit: @@ -1684,7 +1684,7 @@ void DisplayMan::drawSquareD2C(Direction dir, int16 posX, int16 posY) { drawDoorButton(_vm->indexToOrdinal(k0_DoorButton), k2_viewDoorButton_D2C); drawDoor(squareAspect[kDMSquareAspectDoorThingIndex], (DoorState)squareAspect[kDMSquareAspectDoorState], - _doorNativeBitmapIndexFrontD2LCR, getBitmapByteCount(64, 61), k1_ViewDoorOrnament_D2LCR, &doorFrameD2C); + _doorNativeBitmapIndexFrontD2LCR, getBitmapByteCount(64, 61), kDMDoorOrnamentD2LCR, &doorFrameD2C); order = k0x0349_CellOrder_DoorPass2_FrontLeft_FrontRight; break; case kDMElementTypePit: @@ -1769,7 +1769,7 @@ void DisplayMan::drawSquareD1L(Direction dir, int16 posX, int16 posY) { drawObjectsCreaturesProjectilesExplosions(Thing(squareAspect[kDMSquareAspectFirstGroupOrObject]), dir, posX, posY, k7_ViewSquare_D1L, k0x0028_CellOrder_DoorPass1_BackRight); drawWallSetBitmap(_bitmapWallSetDoorFrameTopD1LCR, doorFrameTopD1L); drawDoor(squareAspect[kDMSquareAspectDoorThingIndex], (DoorState)squareAspect[kDMSquareAspectDoorState], - _doorNativeBitmapIndexFrontD1LCR, getBitmapByteCount(96, 88), k2_ViewDoorOrnament_D1LCR, &doorFrameD1L); + _doorNativeBitmapIndexFrontD1LCR, getBitmapByteCount(96, 88), kDMDoorOrnamentD1LCR, &doorFrameD1L); order = k0x0039_CellOrder_DoorPass2_FrontRight; break; case kDMElementTypePit: @@ -1853,7 +1853,7 @@ void DisplayMan::drawSquareD1R(Direction dir, int16 posX, int16 posY) { drawObjectsCreaturesProjectilesExplosions(Thing(squareAspect[kDMSquareAspectFirstGroupOrObject]), dir, posX, posY, k8_ViewSquare_D1R, k0x0018_CellOrder_DoorPass1_BackLeft); drawWallSetBitmap(_bitmapWallSetDoorFrameTopD1LCR, doorFrameTopD1R); drawDoor(squareAspect[kDMSquareAspectDoorThingIndex], (DoorState)squareAspect[kDMSquareAspectDoorState], - _doorNativeBitmapIndexFrontD1LCR, getBitmapByteCount(96, 88), k2_ViewDoorOrnament_D1LCR, &doorFrameD1R); + _doorNativeBitmapIndexFrontD1LCR, getBitmapByteCount(96, 88), kDMDoorOrnamentD1LCR, &doorFrameD1R); order = k0x0049_CellOrder_DoorPass2_FrontLeft; break; case kDMElementTypePit: @@ -1938,7 +1938,7 @@ void DisplayMan::drawSquareD1C(Direction dir, int16 posX, int16 posY) { drawDoorButton(_vm->indexToOrdinal(k0_DoorButton), k3_viewDoorButton_D1C); drawDoor(squareAspect[kDMSquareAspectDoorThingIndex], (DoorState)squareAspect[kDMSquareAspectDoorState], - _doorNativeBitmapIndexFrontD1LCR, getBitmapByteCount(96, 88), k2_ViewDoorOrnament_D1LCR, _doorFrameD1C); + _doorNativeBitmapIndexFrontD1LCR, getBitmapByteCount(96, 88), kDMDoorOrnamentD1LCR, _doorFrameD1C); order = k0x0349_CellOrder_DoorPass2_FrontLeft_FrontRight; break; case kDMElementTypePit: diff --git a/engines/dm/gfx.h b/engines/dm/gfx.h index 63dab05f1f..656e6d065a 100644 --- a/engines/dm/gfx.h +++ b/engines/dm/gfx.h @@ -58,9 +58,11 @@ enum DoorState { kDMDoorStateDestroyed = 5 // @ C5_DOOR_STATE_DESTROYED }; -#define k0_ViewDoorOrnament_D3LCR 0 // @ C0_VIEW_DOOR_ORNAMENT_D3LCR -#define k1_ViewDoorOrnament_D2LCR 1 // @ C1_VIEW_DOOR_ORNAMENT_D2LCR -#define k2_ViewDoorOrnament_D1LCR 2 // @ C2_VIEW_DOOR_ORNAMENT_D1LCR +enum DoorOrnament { + kDMDoorOrnamentD3LCR = 0, // @ C0_VIEW_DOOR_ORNAMENT_D3LCR + kDMDoorOrnamentD2LCR = 1, // @ C1_VIEW_DOOR_ORNAMENT_D2LCR + kDMDoorOrnamentD1LCR = 2 // @ C2_VIEW_DOOR_ORNAMENT_D1LCR +}; #define k0_viewDoorButton_D3R 0 // @ C0_VIEW_DOOR_BUTTON_D3R #define k1_viewDoorButton_D3C 1 // @ C1_VIEW_DOOR_BUTTON_D3C @@ -725,8 +727,8 @@ public: void copyBitmapAndFlipHorizontal(byte *srcBitmap, byte *destBitmap, uint16 byteWidth, uint16 height); // @ F0099_DUNGEONVIEW_CopyBitmapAndFlipHorizontal void drawFloorOrnament(uint16 floorOrnOrdinal, ViewFloor viewFloorIndex); // @ F0108_DUNGEONVIEW_DrawFloorOrnament void drawDoor(uint16 doorThingIndex, DoorState doorState, int16 *doorNativeBitmapIndices, int16 byteCount, - int16 viewDoorOrnIndex, DoorFrames *doorFrames); // @ F0111_DUNGEONVIEW_DrawDoor - void drawDoorOrnament(int16 doorOrnOdinal, int16 viewDoorOrnIndex); // @ F0109_DUNGEONVIEW_DrawDoorOrnament + DoorOrnament doorOrnament, DoorFrames *doorFrames); // @ F0111_DUNGEONVIEW_DrawDoor + void drawDoorOrnament(int16 doorOrnOdinal, DoorOrnament doorOrnament); // @ F0109_DUNGEONVIEW_DrawDoorOrnament void drawCeilingPit(int16 nativeBitmapIndex, Frame *frame, int16 mapX, int16 mapY, bool flipHorizontal); // @ F0112_DUNGEONVIEW_DrawCeilingPit void blitToViewport(byte *bitmap, Box &box, int16 byteWidth, Color transparent, int16 height); // @ F0020_MAIN_BlitToViewport |