aboutsummaryrefslogtreecommitdiff
path: root/engines/dm
diff options
context:
space:
mode:
authorStrangerke2016-09-14 22:25:27 +0200
committerStrangerke2016-09-14 22:25:27 +0200
commit1fa2519a1214cb7ed7ba70664a8afd1fbd4e2d2b (patch)
tree83c447b341689ce282d656f7739b46b6361a30ec /engines/dm
parent535ded7e553404cfe57a11fd715ad0f04117b95c (diff)
downloadscummvm-rg350-1fa2519a1214cb7ed7ba70664a8afd1fbd4e2d2b.tar.gz
scummvm-rg350-1fa2519a1214cb7ed7ba70664a8afd1fbd4e2d2b.tar.bz2
scummvm-rg350-1fa2519a1214cb7ed7ba70664a8afd1fbd4e2d2b.zip
DM: Add DoorButton enum, fix a bug in drawSquareD3C
Diffstat (limited to 'engines/dm')
-rw-r--r--engines/dm/gfx.cpp20
-rw-r--r--engines/dm/gfx.h26
2 files changed, 24 insertions, 22 deletions
diff --git a/engines/dm/gfx.cpp b/engines/dm/gfx.cpp
index 72e9a4959d..2bc40fcb6a 100644
--- a/engines/dm/gfx.cpp
+++ b/engines/dm/gfx.cpp
@@ -725,7 +725,7 @@ void DisplayMan::drawDoorFrameBitmapFlippedHorizontally(byte *bitmap, Frame *fra
}
}
-void DisplayMan::drawDoorButton(int16 doorButtonOrdinal, int16 viewDoorButtonIndex) {
+void DisplayMan::drawDoorButton(int16 doorButtonOrdinal, DoorButton doorButton) {
static byte doorButtonCoordSet[1] = {0}; // @ G0197_auc_Graphic558_DoorButtonCoordinateSet
static uint16 doorButtonCoordSets[1][4][6] = { // @ G0208_aaauc_Graphic558_DoorButtonCoordinateSets
// X1, X2, Y1, Y2, ByteWidth, Height
@@ -743,10 +743,10 @@ void DisplayMan::drawDoorButton(int16 doorButtonOrdinal, int16 viewDoorButtonInd
int16 nativeBitmapIndex = doorButtonOrdinal + k315_firstDoorButton_GraphicIndice;
int coordSet = doorButtonCoordSet[doorButtonOrdinal];
- uint16 *coordSetRedEagle = doorButtonCoordSets[coordSet][viewDoorButtonIndex];
+ uint16 *coordSetRedEagle = doorButtonCoordSets[coordSet][doorButton];
byte *bitmap = nullptr;
- if (viewDoorButtonIndex == k3_viewDoorButton_D1C) {
+ if (doorButton == kDMDoorButtonD1C) {
bitmap = getNativeBitmapOrGraphic(nativeBitmapIndex);
_vm->_dungeonMan->_dungeonViewClickableBoxes[k5_ViewCellDoorButtonOrWallOrn]._x1 = coordSetRedEagle[0];
@@ -754,16 +754,16 @@ void DisplayMan::drawDoorButton(int16 doorButtonOrdinal, int16 viewDoorButtonInd
_vm->_dungeonMan->_dungeonViewClickableBoxes[k5_ViewCellDoorButtonOrWallOrn]._y1 = coordSetRedEagle[2];
_vm->_dungeonMan->_dungeonViewClickableBoxes[k5_ViewCellDoorButtonOrWallOrn]._y2 = coordSetRedEagle[3];
} else {
- doorButtonOrdinal = k102_DerivedBitmapFirstDoorButton + (doorButtonOrdinal * 2) + ((!viewDoorButtonIndex) ? 0 : viewDoorButtonIndex - 1);
+ doorButtonOrdinal = k102_DerivedBitmapFirstDoorButton + (doorButtonOrdinal * 2) + ((doorButton != kDMDoorButtonD3R) ? 0 : (int16)doorButton - 1);
if (!isDerivedBitmapInCache(doorButtonOrdinal)) {
- uint16 *coordSetBlueGoat = doorButtonCoordSets[coordSet][k3_viewDoorButton_D1C];
+ uint16 *coordSetBlueGoat = doorButtonCoordSets[coordSet][kDMDoorButtonD1C];
byte *bitmapNative = getNativeBitmapOrGraphic(nativeBitmapIndex);
blitToBitmapShrinkWithPalChange(bitmapNative, getDerivedBitmap(doorButtonOrdinal),
coordSetBlueGoat[4] << 1, coordSetBlueGoat[5],
// modified code line
coordSetRedEagle[4] << 1,
coordSetRedEagle[5],
- (viewDoorButtonIndex == k2_viewDoorButton_D2C) ? _palChangesDoorButtonAndWallOrnD2 : _palChangesDoorButtonAndWallOrnD3);
+ (doorButton == kDMDoorButtonD2C) ? _palChangesDoorButtonAndWallOrnD2 : _palChangesDoorButtonAndWallOrnD3);
addDerivedBitmap(doorButtonOrdinal);
}
@@ -1353,7 +1353,7 @@ void DisplayMan::drawSquareD3R(Direction dir, int16 posX, int16 posY) {
memmove(_tmpBitmap, _bitmapWallSetDoorFrameLeftD3L, 32 * 44);
drawDoorFrameBitmapFlippedHorizontally(_tmpBitmap, &doorFrameRightD3R);
if (((Door *)_vm->_dungeonMan->_thingData[kDMThingTypeDoor])[squareAspect[kDMSquareAspectDoorThingIndex]].hasButton())
- drawDoorButton(_vm->indexToOrdinal(k0_DoorButton), k0_viewDoorButton_D3R);
+ drawDoorButton(_vm->indexToOrdinal(k0_DoorButton), kDMDoorButtonD3R);
drawDoor(squareAspect[kDMSquareAspectDoorThingIndex],
(DoorState)squareAspect[kDMSquareAspectDoorState], _doorNativeBitmapIndexFrontD3LCR,
@@ -1431,7 +1431,7 @@ 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), kDMDoorOrnamentD2LCR);
+ drawDoorButton(_vm->indexToOrdinal(k0_DoorButton), kDMDoorButtonD3C);
drawDoor(squareAspect[kDMSquareAspectDoorThingIndex], (DoorState)squareAspect[kDMSquareAspectDoorState],
_doorNativeBitmapIndexFrontD3LCR, getBitmapByteCount(48, 41), kDMDoorOrnamentD3LCR, &doorFrameD3C);
@@ -1681,7 +1681,7 @@ void DisplayMan::drawSquareD2C(Direction dir, int16 posX, int16 posY) {
memcpy(_tmpBitmap, _bitmapWallSetDoorFrameLeftD2C, 48 * 65);
drawDoorFrameBitmapFlippedHorizontally(_tmpBitmap, &doorFrameRightD2C);
if (((Door *)_vm->_dungeonMan->_thingData[kDMThingTypeDoor])[squareAspect[kDMSquareAspectDoorThingIndex]].hasButton())
- drawDoorButton(_vm->indexToOrdinal(k0_DoorButton), k2_viewDoorButton_D2C);
+ drawDoorButton(_vm->indexToOrdinal(k0_DoorButton), kDMDoorButtonD2C);
drawDoor(squareAspect[kDMSquareAspectDoorThingIndex], (DoorState)squareAspect[kDMSquareAspectDoorState],
_doorNativeBitmapIndexFrontD2LCR, getBitmapByteCount(64, 61), kDMDoorOrnamentD2LCR, &doorFrameD2C);
@@ -1935,7 +1935,7 @@ void DisplayMan::drawSquareD1C(Direction dir, int16 posX, int16 posY) {
drawWallSetBitmap(_bitmapWallSetDoorFrameLeftD1C, _doorFrameLeftD1C);
drawWallSetBitmap(_bitmapWallSetDoorFrameRightD1C, _doorFrameRightD1C);
if (((Door *)_vm->_dungeonMan->_thingData[kDMThingTypeDoor])[squareAspect[kDMSquareAspectDoorThingIndex]].hasButton())
- drawDoorButton(_vm->indexToOrdinal(k0_DoorButton), k3_viewDoorButton_D1C);
+ drawDoorButton(_vm->indexToOrdinal(k0_DoorButton), kDMDoorButtonD1C);
drawDoor(squareAspect[kDMSquareAspectDoorThingIndex], (DoorState)squareAspect[kDMSquareAspectDoorState],
_doorNativeBitmapIndexFrontD1LCR, getBitmapByteCount(96, 88), kDMDoorOrnamentD1LCR, _doorFrameD1C);
diff --git a/engines/dm/gfx.h b/engines/dm/gfx.h
index 656e6d065a..c3f73b52c8 100644
--- a/engines/dm/gfx.h
+++ b/engines/dm/gfx.h
@@ -46,28 +46,30 @@ enum ViewFloor {
kDMViewFloorD2R = 5, // @ C5_VIEW_FLOOR_D2R
kDMViewFloorD1L = 6, // @ C6_VIEW_FLOOR_D1L
kDMViewFloorD1C = 7, // @ C7_VIEW_FLOOR_D1C
- kDMViewFloorD1R = 8 // @ C8_VIEW_FLOOR_D1R
+ kDMViewFloorD1R = 8 // @ C8_VIEW_FLOOR_D1R
};
enum DoorState {
- kDMDoorStateOpen = 0, // @ C0_DOOR_STATE_OPEN
- kDMDoorStateOneFourth = 1, // @ C1_DOOR_STATE_CLOSED_ONE_FOURTH
- kDMDoorStateHalf = 2, // @ k2_DoorStateAspect_CLOSED_HALF
+ kDMDoorStateOpen = 0, // @ C0_DOOR_STATE_OPEN
+ kDMDoorStateOneFourth = 1, // @ C1_DOOR_STATE_CLOSED_ONE_FOURTH
+ kDMDoorStateHalf = 2, // @ k2_DoorStateAspect_CLOSED_HALF
kDMDoorStateThreeFourth = 3, // @ C3_DOOR_STATE_CLOSED_THREE_FOURTH
- kDMDoorStateClosed = 4, // @ C4_DOOR_STATE_CLOSED
- kDMDoorStateDestroyed = 5 // @ C5_DOOR_STATE_DESTROYED
+ kDMDoorStateClosed = 4, // @ C4_DOOR_STATE_CLOSED
+ kDMDoorStateDestroyed = 5 // @ C5_DOOR_STATE_DESTROYED
};
enum DoorOrnament {
kDMDoorOrnamentD3LCR = 0, // @ C0_VIEW_DOOR_ORNAMENT_D3LCR
kDMDoorOrnamentD2LCR = 1, // @ C1_VIEW_DOOR_ORNAMENT_D2LCR
- kDMDoorOrnamentD1LCR = 2 // @ C2_VIEW_DOOR_ORNAMENT_D1LCR
+ 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
-#define k2_viewDoorButton_D2C 2 // @ C2_VIEW_DOOR_BUTTON_D2C
-#define k3_viewDoorButton_D1C 3 // @ C3_VIEW_DOOR_BUTTON_D1C
+enum DoorButton {
+ kDMDoorButtonD3R = 0, // @ C0_VIEW_DOOR_BUTTON_D3R
+ kDMDoorButtonD3C = 1, // @ C1_VIEW_DOOR_BUTTON_D3C
+ kDMDoorButtonD2C = 2, // @ C2_VIEW_DOOR_BUTTON_D2C
+ kDMDoorButtonD1C = 3 // @ C3_VIEW_DOOR_BUTTON_D1C
+};
#define k0x0001_MaskDoorInfo_CraturesCanSeeThrough 0x0001 // @ MASK0x0001_CREATURES_CAN_SEE_THROUGH
#define k0x0002_MaskDoorInfo_ProjectilesCanPassThrough 0x0002 // @ MASK0x0002_PROJECTILES_CAN_PASS_THROUGH
@@ -717,7 +719,7 @@ public:
void allocateFlippedWallBitmaps(); // @ F0461_START_AllocateFlippedWallBitmaps
void drawDoorBitmap(Frame *frame);// @ F0102_DUNGEONVIEW_DrawDoorBitmap
void drawDoorFrameBitmapFlippedHorizontally(byte *bitmap, Frame *frame); // @ F0103_DUNGEONVIEW_DrawDoorFrameBitmapFlippedHorizontally
- void drawDoorButton(int16 doorButtonOrdinal, int16 viewDoorButtonIndex); // @ F0110_DUNGEONVIEW_DrawDoorButton
+ void drawDoorButton(int16 doorButtonOrdinal, DoorButton doorButton); // @ F0110_DUNGEONVIEW_DrawDoorButton
/// Gives the width of an IMG0 type item
uint16 getPixelWidth(uint16 index);