aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWinterGrascph2016-05-22 00:32:53 +0200
committerBendegúz Nagy2016-08-26 23:02:22 +0200
commit3ada56f6b1e8f2b65b6a77dbd3ff4d91bba705a0 (patch)
treead5c51ba5a5631d0edb18f28cdb02a308d85956e
parentf591cbbcf350b0f61cb2441bd4a89a7b45e3c689 (diff)
downloadscummvm-rg350-3ada56f6b1e8f2b65b6a77dbd3ff4d91bba705a0.tar.gz
scummvm-rg350-3ada56f6b1e8f2b65b6a77dbd3ff4d91bba705a0.tar.bz2
scummvm-rg350-3ada56f6b1e8f2b65b6a77dbd3ff4d91bba705a0.zip
DM: Add stairs display
-rw-r--r--engines/dm/dungeonman.cpp17
-rw-r--r--engines/dm/dungeonman.h17
-rw-r--r--engines/dm/gfx.cpp192
-rw-r--r--engines/dm/gfx.h34
4 files changed, 233 insertions, 27 deletions
diff --git a/engines/dm/dungeonman.cpp b/engines/dm/dungeonman.cpp
index ccefaceb45..af10338030 100644
--- a/engines/dm/dungeonman.cpp
+++ b/engines/dm/dungeonman.cpp
@@ -7,6 +7,8 @@
using namespace DM;
+
+
CreatureInfo gCreatureInfo[kCreatureTypeCount] = { // @ G0243_as_Graphic559_CreatureInfo
/* { CreatureAspectIndex, AttackSoundOrdinal, Attributes, GraphicInfo,
MovementTicks, AttackTicks, Defense, BaseHealth, Attack, PoisonAttack,
@@ -436,21 +438,6 @@ Thing DungeonMan::getSquareFirstThing(int16 mapX, int16 mapY) {
return _dunData.squareFirstThings[index];
}
-enum SquareAspectIndice {
- kElemAspect = 0,
- kFirstGroupOrObjectAspect = 1,
- kRightWallOrnOrdAspect = 2,
- kFrontWallOrnOrdAspect = 3,
- kLeftWallOrnOrdAspect = 4,
- kPitInvisibleAspect = 2,
- kTeleporterVisibleAspect = 2,
- kStairsUpAspect = 2,
- kDoorStateAspect = 2,
- kDoorThingIndexAspect = 3,
- kFloorOrnOrdAspect = 4,
- kFootprintsAspect = 0x8000 // @ MASK0x8000_FOOTPRINTS
-};
-
// TODO: get rid of the GOTOs
void DungeonMan::setSquareAspect(uint16 *aspectArray, direction dir, int16 mapX, int16 mapY) { // complete, except where marked
diff --git a/engines/dm/dungeonman.h b/engines/dm/dungeonman.h
index 35a337d088..60a0bb6881 100644
--- a/engines/dm/dungeonman.h
+++ b/engines/dm/dungeonman.h
@@ -12,6 +12,23 @@ struct Map;
int16 ordinalToIndex(int16 val); // @ M01_ORDINAL_TO_INDEX
int16 indexToOrdinal(int16 val); // @ M00_INDEX_TO_ORDINAL
+
+enum SquareAspectIndice {
+ kElemAspect = 0,
+ kFirstGroupOrObjectAspect = 1,
+ kRightWallOrnOrdAspect = 2,
+ kFrontWallOrnOrdAspect = 3,
+ kLeftWallOrnOrdAspect = 4,
+ kPitInvisibleAspect = 2,
+ kTeleporterVisibleAspect = 2,
+ kStairsUpAspect = 2,
+ kDoorStateAspect = 2,
+ kDoorThingIndexAspect = 3,
+ kFloorOrnOrdAspect = 4,
+ kFootprintsAspect = 0x8000 // @ MASK0x8000_FOOTPRINTS
+};
+
+
struct CreatureInfo {
byte creatureAspectIndex;
byte attackSoundOrdinal;
diff --git a/engines/dm/gfx.cpp b/engines/dm/gfx.cpp
index 4dbc31515a..c88ca0068a 100644
--- a/engines/dm/gfx.cpp
+++ b/engines/dm/gfx.cpp
@@ -23,6 +23,71 @@ struct Frame {
};
+enum StairFrameIndex {
+ kFrameStairsUpFront_D3L = 0, // @ G0110_s_Graphic558_Frame_StairsUpFront_D3L
+ kFrameStairsUpFront_D3C = 1, // @ G0111_s_Graphic558_Frame_StairsUpFront_D3C
+ kFrameStairsUpFront_D3R = 2, // @ G0112_s_Graphic558_Frame_StairsUpFront_D3R
+ kFrameStairsUpFront_D2L = 3, // @ G0113_s_Graphic558_Frame_StairsUpFront_D2L
+ kFrameStairsUpFront_D2C = 4, // @ G0114_s_Graphic558_Frame_StairsUpFront_D2C
+ kFrameStairsUpFront_D2R = 5, // @ G0115_s_Graphic558_Frame_StairsUpFront_D2R
+ kFrameStairsUpFront_D1L = 6, // @ G0116_s_Graphic558_Frame_StairsUpFront_D1L
+ kFrameStairsUpFront_D1C = 7, // @ G0117_s_Graphic558_Frame_StairsUpFront_D1C
+ kFrameStairsUpFront_D1R = 8, // @ G0118_s_Graphic558_Frame_StairsUpFront_D1R
+ kFrameStairsUpFront_D0L = 9, // @ G0119_s_Graphic558_Frame_StairsUpFront_D0L
+ kFrameStairsUpFront_D0R = 10, // @ G0120_s_Graphic558_Frame_StairsUpFront_D0R
+ kFrameStairsDownFront_D3L = 11, // @ G0121_s_Graphic558_Frame_StairsDownFront_D3L
+ kFrameStairsDownFront_D3C = 12, // @ G0122_s_Graphic558_Frame_StairsDownFront_D3C
+ kFrameStairsDownFront_D3R = 13, // @ G0123_s_Graphic558_Frame_StairsDownFront_D3R
+ kFrameStairsDownFront_D2L = 14, // @ G0124_s_Graphic558_Frame_StairsDownFront_D2L
+ kFrameStairsDownFront_D2C = 15, // @ G0125_s_Graphic558_Frame_StairsDownFront_D2C
+ kFrameStairsDownFront_D2R = 16, // @ G0126_s_Graphic558_Frame_StairsDownFront_D2R
+ kFrameStairsDownFront_D1L = 17, // @ G0127_s_Graphic558_Frame_StairsDownFront_D1L
+ kFrameStairsDownFront_D1C = 18, // @ G0128_s_Graphic558_Frame_StairsDownFront_D1C
+ kFrameStairsDownFront_D1R = 19, // @ G0129_s_Graphic558_Frame_StairsDownFront_D1R
+ kFrameStairsDownFront_D0L = 20, // @ G0130_s_Graphic558_Frame_StairsDownFront_D0L
+ kFrameStairsDownFront_D0R = 21, // @ G0131_s_Graphic558_Frame_StairsDownFront_D0R
+ kFrameStairsSide_D2L = 22, // @ G0132_s_Graphic558_Frame_StairsSide_D2L
+ kFrameStairsSide_D2R = 23, // @ G0133_s_Graphic558_Frame_StairsSide_D2R
+ kFrameStairsUpSide_D1L = 24, // @ G0134_s_Graphic558_Frame_StairsUpSide_D1L
+ kFrameStairsUpSide_D1R = 25, // @ G0135_s_Graphic558_Frame_StairsUpSide_D1R
+ kFrameStairsDownSide_D1L = 26, // @ G0136_s_Graphic558_Frame_StairsDownSide_D1L
+ kFrameStairsDownSide_D1R = 27, // @ G0137_s_Graphic558_Frame_StairsDownSide_D1R
+ kFrameStairsSide_D0L = 28, // @ G0138_s_Graphic558_Frame_StairsSide_D0L
+ kFrameStairsSide_D0R = 29 // @ G0139_s_Graphic558_Frame_StairsSide_D0R
+};
+
+Frame gStairFrames[] = {{0, 79, 25, 70, 40, 46, 0, 0},
+{64, 159, 25, 70, 48, 46, 0, 0},
+{149, 223, 25, 70, 40, 46, 5, 0},
+{0, 63, 22, 83, 32, 62, 0, 0},
+{64, 159, 22, 83, 48, 62, 0, 0},
+{160, 223, 22, 83, 32, 62, 0, 0},
+{0, 31, 9, 108, 16, 100, 0, 0},
+{32, 191, 9, 108, 80, 100, 0, 0},
+{192, 223, 9, 108, 16, 100, 0, 0},
+{0, 31, 58, 101, 16, 44, 0, 0},
+{192, 223, 58, 101, 16, 44, 0, 0},
+{0, 79, 28, 68, 40, 41, 0, 0},
+{64, 159, 28, 70, 48, 43, 0, 0},
+{149, 223, 28, 68, 40, 41, 5, 0},
+{0, 63, 24, 85, 32, 62, 0, 0},
+{64, 159, 24, 85, 48, 62, 0, 0},
+{160, 223, 24, 85, 32, 62, 0, 0},
+{0, 31, 18, 108, 16, 91, 0, 0},
+{32, 191, 18, 108, 80, 91, 0, 0},
+{192, 223, 18, 108, 16, 91, 0, 0},
+{0, 31, 76, 135, 16, 60, 0, 0},
+{192, 223, 76, 135, 16, 60, 0, 0},
+{60, 75, 57, 61, 8, 5, 0, 0},
+{148, 163, 57, 61, 8, 5, 0, 0},
+{32, 63, 57, 99, 16, 43, 0, 0},
+{160, 191, 57, 99, 16, 43, 0, 0},
+{32, 63, 60, 98, 16, 39, 0, 0},
+{160, 191, 60, 98, 16, 39, 0, 0},
+{0, 15, 73, 85, 8, 13, 0, 0},
+{208, 223, 73, 85, 8, 13, 0, 0}};
+
+
#define kFirstWallOrn 121 // @ C121_GRAPHIC_FIRST_WALL_ORNAMENT
#define kFirstFloorSet 75 // @ C075_GRAPHIC_FIRST_FLOOR_SET
#define kFirstWallSet 77 // @ C077_GRAPHIC_FIRST_WALL_SET
@@ -581,6 +646,8 @@ DisplayMan::~DisplayMan() {
void DisplayMan::setUpScreens(uint16 width, uint16 height) {
_screenWidth = width;
_screenHeight = height;
+ delete[] _tmpBitmap;
+ _tmpBitmap = new byte[_screenWidth * _screenHeight];
delete[] _vgaBuffer;
_vgaBuffer = new byte[_screenWidth * _screenHeight];
clearScreen(kColorBlack);
@@ -590,18 +657,18 @@ void DisplayMan::loadGraphics() {
Common::File f;
f.open("graphics.dat");
- grapItemCount = f.readUint16BE();
+ _grapItemCount = f.readUint16BE();
delete[] _packedItemPos;
- _packedItemPos = new uint32[grapItemCount + 1];
+ _packedItemPos = new uint32[_grapItemCount + 1];
_packedItemPos[0] = 0;
- for (uint16 i = 1; i < grapItemCount + 1; ++i)
+ for (uint16 i = 1; i < _grapItemCount + 1; ++i)
_packedItemPos[i] = f.readUint16BE() + _packedItemPos[i - 1];
delete[] _packedBitmaps;
- _packedBitmaps = new uint8[_packedItemPos[grapItemCount]];
+ _packedBitmaps = new uint8[_packedItemPos[_grapItemCount]];
- f.seek(2 + grapItemCount * 4);
- for (uint32 i = 0; i < _packedItemPos[grapItemCount]; ++i)
+ f.seek(2 + _grapItemCount * 4);
+ for (uint32 i = 0; i < _packedItemPos[_grapItemCount]; ++i)
_packedBitmaps[i] = f.readByte();
f.close();
@@ -790,7 +857,13 @@ void DisplayMan::drawWallSetBitmap(byte *bitmap, Frame &f) {
void DisplayMan::drawSquareD3L(direction dir, int16 posX, int16 posY) {
uint16 squareAspect[5];
_vm->_dungeonMan->setSquareAspect(squareAspect, dir, posX, posY);
- switch (squareAspect[0]) {
+ switch (squareAspect[kElemAspect]) {
+ case kStairsFrontElemType:
+ if (squareAspect[kStairsUpAspect])
+ drawFloorPitOrStairsBitmap(kStairsNativeIndex_Up_Front_D3L, gStairFrames[kFrameStairsUpFront_D3L]);
+ else
+ drawFloorPitOrStairsBitmap(kStairsNativeIndex_Down_Front_D3L, gStairFrames[kFrameStairsDownFront_D3L]);
+ break;
case kWallElemType:
drawWallSetBitmap(_wallSetBitMaps[kWall_D3LCR], gFrameWalls[kViewSquare_D3L]);
break;
@@ -801,6 +874,12 @@ void DisplayMan::drawSquareD3R(direction dir, int16 posX, int16 posY) {
uint16 squareAspect[5];
_vm->_dungeonMan->setSquareAspect(squareAspect, dir, posX, posY);
switch (squareAspect[0]) {
+ case kStairsFrontElemType:
+ if (squareAspect[kStairsUpAspect])
+ drawFloorPitOrStairsBitmapFlippedHorizontally(kStairsNativeIndex_Up_Front_D3L, gStairFrames[kFrameStairsUpFront_D3R]);
+ else
+ drawFloorPitOrStairsBitmapFlippedHorizontally(kStairsNativeIndex_Down_Front_D3L, gStairFrames[kFrameStairsDownFront_D3R]);
+ break;
case kWallElemType:
drawWallSetBitmap(_wallSetBitMaps[kWall_D3LCR], gFrameWalls[kViewSquare_D3R]);
break;
@@ -810,6 +889,12 @@ void DisplayMan::drawSquareD3C(direction dir, int16 posX, int16 posY) {
uint16 squareAspect[5];
_vm->_dungeonMan->setSquareAspect(squareAspect, dir, posX, posY);
switch (squareAspect[0]) {
+ case kStairsFrontElemType:
+ if (squareAspect[kStairsUpAspect])
+ drawFloorPitOrStairsBitmap(kStairsNativeIndex_Up_Front_D3C, gStairFrames[kFrameStairsUpFront_D3C]);
+ else
+ drawFloorPitOrStairsBitmap(kStairsNativeIndex_Down_Front_D3C, gStairFrames[kFrameStairsDownFront_D3C]);
+ break;
case kWallElemType:
drawWallSetBitmapWithoutTransparency(_wallSetBitMaps[kWall_D3LCR], gFrameWalls[kViewSquare_D3C]);
break;
@@ -819,24 +904,48 @@ void DisplayMan::drawSquareD2L(direction dir, int16 posX, int16 posY) {
uint16 squareAspect[5];
_vm->_dungeonMan->setSquareAspect(squareAspect, dir, posX, posY);
switch (squareAspect[0]) {
+ case kStairsFrontElemType:
+ if (squareAspect[kStairsUpAspect])
+ drawFloorPitOrStairsBitmap(kStairsNativeIndex_Up_Front_D2L, gStairFrames[kFrameStairsUpFront_D2L]);
+ else
+ drawFloorPitOrStairsBitmap(kStairsNativeIndex_Down_Front_D2L, gStairFrames[kFrameStairsDownFront_D2L]);
+ break;
case kWallElemType:
drawWallSetBitmap(_wallSetBitMaps[kWall_D2LCR], gFrameWalls[kViewSquare_D2L]);
break;
+ case kStairsSideElemType:
+ drawFloorPitOrStairsBitmap(kStairsNativeIndex_Side_D2L, gFrameWalls[kFrameStairsSide_D2L]);
+ break;
}
}
void DisplayMan::drawSquareD2R(direction dir, int16 posX, int16 posY) {
uint16 squareAspect[5];
_vm->_dungeonMan->setSquareAspect(squareAspect, dir, posX, posY);
switch (squareAspect[0]) {
+ case kStairsFrontElemType:
+ if (squareAspect[kStairsUpAspect])
+ drawFloorPitOrStairsBitmapFlippedHorizontally(kStairsNativeIndex_Up_Front_D2L, gStairFrames[kFrameStairsUpFront_D2R]);
+ else
+ drawFloorPitOrStairsBitmapFlippedHorizontally(kStairsNativeIndex_Down_Front_D2L, gStairFrames[kFrameStairsDownFront_D2R]);
+ break;
case kWallElemType:
drawWallSetBitmap(_wallSetBitMaps[kWall_D2LCR], gFrameWalls[kViewSquare_D2R]);
break;
+ case kStairsSideElemType:
+ drawFloorPitOrStairsBitmapFlippedHorizontally(kStairsNativeIndex_Side_D2L, gStairFrames[kFrameStairsSide_D2R]);
+ break;
}
}
void DisplayMan::drawSquareD2C(direction dir, int16 posX, int16 posY) {
uint16 squareAspect[5];
_vm->_dungeonMan->setSquareAspect(squareAspect, dir, posX, posY);
switch (squareAspect[0]) {
+ case kStairsFrontElemType:
+ if (squareAspect[kStairsUpAspect])
+ drawFloorPitOrStairsBitmap(kStairsNativeIndex_Up_Front_D2C, gStairFrames[kFrameStairsUpFront_D2C]);
+ else
+ drawFloorPitOrStairsBitmap(kStairsNativeIndex_Down_Front_D2C, gStairFrames[kFrameStairsDownFront_D2C]);
+ break;
case kWallElemType:
drawWallSetBitmapWithoutTransparency(_wallSetBitMaps[kWall_D2LCR], gFrameWalls[kViewSquare_D2C]);
break;
@@ -846,24 +955,54 @@ void DisplayMan::drawSquareD1L(direction dir, int16 posX, int16 posY) {
uint16 squareAspect[5];
_vm->_dungeonMan->setSquareAspect(squareAspect, dir, posX, posY);
switch (squareAspect[0]) {
+ case kStairsFrontElemType:
+ if (squareAspect[kStairsUpAspect])
+ drawFloorPitOrStairsBitmap(kStairsNativeIndex_Up_Front_D1L, gStairFrames[kFrameStairsUpFront_D1L]);
+ else
+ drawFloorPitOrStairsBitmap(kStairsNativeIndex_Down_Front_D1L, gStairFrames[kFrameStairsDownFront_D1L]);
+ break;
case kWallElemType:
drawWallSetBitmap(_wallSetBitMaps[kWall_D1LCR], gFrameWalls[kViewSquare_D1L]);
break;
+ case kStairsSideElemType:
+ if (squareAspect[kStairsUpAspect])
+ drawFloorPitOrStairsBitmap(kStairsNativeIndex_Up_Side_D1L, gStairFrames[kFrameStairsUpSide_D1L]);
+ else
+ drawFloorPitOrStairsBitmap(kStairsNativeIndex_Down_Side_D1L, gStairFrames[kFrameStairsDownSide_D1L]);
+ break;
}
}
void DisplayMan::drawSquareD1R(direction dir, int16 posX, int16 posY) {
uint16 squareAspect[5];
_vm->_dungeonMan->setSquareAspect(squareAspect, dir, posX, posY);
switch (squareAspect[0]) {
+ case kStairsFrontElemType:
+ if (squareAspect[kStairsUpAspect])
+ drawFloorPitOrStairsBitmapFlippedHorizontally(kStairsNativeIndex_Up_Front_D1L, gStairFrames[kFrameStairsUpFront_D1R]);
+ else
+ drawFloorPitOrStairsBitmapFlippedHorizontally(kStairsNativeIndex_Down_Front_D1L, gStairFrames[kFrameStairsDownFront_D1R]);
+ break;
case kWallElemType:
drawWallSetBitmap(_wallSetBitMaps[kWall_D1LCR], gFrameWalls[kViewSquare_D1R]);
break;
+ case kStairsSideElemType:
+ if (squareAspect[kStairsUpAspect])
+ drawFloorPitOrStairsBitmapFlippedHorizontally(kStairsNativeIndex_Up_Side_D1L, gStairFrames[kFrameStairsUpSide_D1R]);
+ else
+ drawFloorPitOrStairsBitmapFlippedHorizontally(kStairsNativeIndex_Down_Side_D1L, gStairFrames[kFrameStairsDownSide_D1R]);
+ break;
}
}
void DisplayMan::drawSquareD1C(direction dir, int16 posX, int16 posY) {
uint16 squareAspect[5];
_vm->_dungeonMan->setSquareAspect(squareAspect, dir, posX, posY);
switch (squareAspect[0]) {
+ case kStairsFrontElemType:
+ if (squareAspect[kStairsUpAspect])
+ drawFloorPitOrStairsBitmap(kStairsNativeIndex_Up_Front_D1C, gStairFrames[kFrameStairsUpFront_D1C]);
+ else
+ drawFloorPitOrStairsBitmap(kStairsNativeIndex_Down_Front_D1C, gStairFrames[kFrameStairsDownFront_D1C]);
+ break;
case kWallElemType:
drawWallSetBitmapWithoutTransparency(_wallSetBitMaps[kWall_D1LCR], gFrameWalls[kViewSquare_D1C]);
break;
@@ -873,6 +1012,10 @@ void DisplayMan::drawSquareD0L(direction dir, int16 posX, int16 posY) {
uint16 squareAspect[5];
_vm->_dungeonMan->setSquareAspect(squareAspect, dir, posX, posY);
switch (squareAspect[0]) {
+ case kStairsSideElemType:
+ if (squareAspect[kStairsUpAspect])
+ drawFloorPitOrStairsBitmap(kStairsNativeIndex_Side_D0L, gStairFrames[kFrameStairsSide_D0L]);
+ break;
case kWallElemType:
drawWallSetBitmap(_wallSetBitMaps[kWall_D0L], gFrameWalls[kViewSquare_D0L]);
break;
@@ -883,6 +1026,10 @@ void DisplayMan::drawSquareD0R(direction dir, int16 posX, int16 posY) {
uint16 squareAspect[5];
_vm->_dungeonMan->setSquareAspect(squareAspect, dir, posX, posY);
switch (squareAspect[0]) {
+ case kStairsSideElemType:
+ if (squareAspect[kStairsUpAspect])
+ drawFloorPitOrStairsBitmapFlippedHorizontally(kStairsNativeIndex_Side_D0L, gStairFrames[kFrameStairsSide_D0R]);
+ return;
case kWallElemType:
drawWallSetBitmap(_wallSetBitMaps[kWall_D0R], gFrameWalls[kViewSquare_D0R]);
break;
@@ -893,8 +1040,14 @@ void DisplayMan::drawSquareD0C(direction dir, int16 posX, int16 posY) {
uint16 squareAspect[5];
_vm->_dungeonMan->setSquareAspect(squareAspect, dir, posX, posY);
switch (squareAspect[0]) {
- case kWallElemType:
- drawWallSetBitmap(_wallSetBitMaps[kWall_D0L], gFrameWalls[kViewSquare_D0L]);
+ case kStairsFrontElemType:
+ if (squareAspect[kStairsUpAspect]) {
+ drawFloorPitOrStairsBitmap(kStairsNativeIndex_Up_Front_D0C_Left, gStairFrames[kFrameStairsUpFront_D0L]);
+ drawFloorPitOrStairsBitmapFlippedHorizontally(kStairsNativeIndex_Up_Front_D0C_Left, gStairFrames[kFrameStairsUpFront_D0R]);
+ } else {
+ drawFloorPitOrStairsBitmap(kStairsNativeIndex_Down_Front_D0C_Left, gStairFrames[kFrameStairsDownFront_D0L]);
+ drawFloorPitOrStairsBitmapFlippedHorizontally(kStairsNativeIndex_Down_Front_D0C_Left, gStairFrames[kFrameStairsDownFront_D0R]);
+ }
break;
}
}
@@ -1007,6 +1160,8 @@ void DisplayMan::loadWallSet(WallSet set) {
uint16 destIndex[7] = {kDoorFrameRight_D1C, kWall_D3R2, kWall_D1LCR_Flipped, kWall_D0R_Flipped, kWall_D0L_Flipped,
kWall_D2LCR_Flipped, kWall_D3LCR_Flipped};
+ // the original loads these flipped walls in loadCurrentMapGraphics
+
for (uint16 i = 0; i < 7; ++i) {
uint16 srcGraphicIndice = firstIndice + srcIndex[i];
uint16 w = width(srcGraphicIndice), h = height(srcGraphicIndice);
@@ -1043,6 +1198,11 @@ void DisplayMan::loadCurrentMapGraphics() {
loadFloorSet(_vm->_dungeonMan->_currMap.map->floorSet);
loadWallSet(_vm->_dungeonMan->_currMap.map->wallSet);
+ // the original loads some flipped walls here, I moved it to loadWallSet
+
+ for (uint16 i = 0, firstGraphicIndex = _vm->_dungeonMan->_currMap.map->wallSet * kStairsGraphicCount + kFirstStairs; i < kStairsGraphicCount; ++i)
+ _stairIndices[i] = firstGraphicIndex + i;
+
for (int16 i = 0; i < kAlcoveOrnCount; ++i)
_currMapAlcoveOrnIndices[i] = -1;
for (int16 i = 0; i < kFountainOrnCount; ++i)
@@ -1110,3 +1270,17 @@ void DisplayMan::applyCreatureReplColors(int replacedColor, int replacementColor
gPalChangesCreature_D2[replacedColor] = gCreatureReplColorSets[replacementColor].D2ReplacementColor;
gPalChangesCreature_D3[replacedColor] = gCreatureReplColorSets[replacementColor].D3ReplacementColor;
}
+
+void DisplayMan::drawFloorPitOrStairsBitmap(StairIndex relIndex, Frame &f) {
+ if (f.srcWidth) {
+ blitToScreen(_bitmaps[_stairIndices[relIndex]], f.srcWidth, f.srcX, f.srcY, f.destFromX, f.destToX, f.destFromY, f.destToY, kColorFlesh, gDungeonViewport);
+ }
+}
+
+void DisplayMan::drawFloorPitOrStairsBitmapFlippedHorizontally(StairIndex relIndex, Frame &f) {
+ if (f.srcWidth) {
+ blitToBitmap(_bitmaps[_stairIndices[relIndex]], f.srcWidth, f.srcHeight, _tmpBitmap, f.srcWidth);
+ flipBitmapHorizontal(_tmpBitmap, f.srcWidth, f.srcHeight);
+ blitToScreen(_tmpBitmap, f.srcWidth, f.srcX, f.srcY, f.destFromX, f.destToX, f.destFromY, f.destToY, kColorFlesh, gDungeonViewport);
+ }
+}
diff --git a/engines/dm/gfx.h b/engines/dm/gfx.h
index d558e812a7..bc7296e9c2 100644
--- a/engines/dm/gfx.h
+++ b/engines/dm/gfx.h
@@ -28,6 +28,28 @@ enum FloorSet {
kFloorSetStone = 0 // @ C0_FLOOR_SET_STONE
};
+enum StairIndex {
+ kStairsNativeIndex_Up_Front_D3L = 0, // @ G0675_i_StairsNativeBitmapIndex_Up_Front_D3L
+ kStairsNativeIndex_Up_Front_D3C = 1, // @ G0676_i_StairsNativeBitmapIndex_Up_Front_D3C
+ kStairsNativeIndex_Up_Front_D2L = 2, // @ G0677_i_StairsNativeBitmapIndex_Up_Front_D2L
+ kStairsNativeIndex_Up_Front_D2C = 3, // @ G0678_i_StairsNativeBitmapIndex_Up_Front_D2C
+ kStairsNativeIndex_Up_Front_D1L = 4, // @ G0679_i_StairsNativeBitmapIndex_Up_Front_D1L
+ kStairsNativeIndex_Up_Front_D1C = 5, // @ G0680_i_StairsNativeBitmapIndex_Up_Front_D1C
+ kStairsNativeIndex_Up_Front_D0C_Left = 6, // @ G0681_i_StairsNativeBitmapIndex_Up_Front_D0C_Left
+ kStairsNativeIndex_Down_Front_D3L = 7, // @ G0682_i_StairsNativeBitmapIndex_Down_Front_D3L
+ kStairsNativeIndex_Down_Front_D3C = 8, // @ G0683_i_StairsNativeBitmapIndex_Down_Front_D3C
+ kStairsNativeIndex_Down_Front_D2L = 9, // @ G0684_i_StairsNativeBitmapIndex_Down_Front_D2L
+ kStairsNativeIndex_Down_Front_D2C = 10, // @ G0685_i_StairsNativeBitmapIndex_Down_Front_D2C
+ kStairsNativeIndex_Down_Front_D1L = 11, // @ G0686_i_StairsNativeBitmapIndex_Down_Front_D1L
+ kStairsNativeIndex_Down_Front_D1C = 12, // @ G0687_i_StairsNativeBitmapIndex_Down_Front_D1C
+ kStairsNativeIndex_Down_Front_D0C_Left = 13, // @ G0688_i_StairsNativeBitmapIndex_Down_Front_D0C_Left
+ kStairsNativeIndex_Side_D2L = 14, // @ G0689_i_StairsNativeBitmapIndex_Side_D2L
+ kStairsNativeIndex_Up_Side_D1L = 15, // @ G0690_i_StairsNativeBitmapIndex_Up_Side_D1L
+ kStairsNativeIndex_Down_Side_D1L = 16, // @ G0691_i_StairsNativeBitmapIndex_Down_Side_D1L
+ kStairsNativeIndex_Side_D0L = 17 // @ G0692_i_StairsNativeBitmapIndex_Side_D0L
+};
+
+
enum Color {
kColorNoTransparency = 255,
kColorBlack = 0,
@@ -91,15 +113,18 @@ class DisplayMan {
/// Related to graphics.dat file
- uint16 grapItemCount = 0; // @ G0632_ui_GraphicCount
+ uint16 _grapItemCount = 0; // @ G0632_ui_GraphicCount
uint32 *_packedItemPos = NULL;
byte *_packedBitmaps = NULL;
byte **_bitmaps = NULL;
- // the last two pointers are owned by this array
+ // pointers 13,14 and [15-19] are owned by this array
byte *_wallSetBitMaps[25] = {NULL}; // @G[0696..0710]_puc_Bitmap_WallSet_...
+ uint16 _stairIndices[kStairsGraphicCount] = {0};
+
+
// pointers are not owned by these fields
byte *_floorBitmap = NULL;
byte *_ceilingBitmap = NULL;
@@ -116,7 +141,8 @@ class DisplayMan {
void loadIntoBitmap(uint16 index, byte *destBitmap); // @ F0466_EXPAND_GraphicToBitmap
void unpackGraphics();
- // @ F0104_DUNGEONVIEW_DrawFloorPitOrStairsBitmap
+ void drawFloorPitOrStairsBitmapFlippedHorizontally(StairIndex relIndex, Frame &frame); // @ F0105_DUNGEONVIEW_DrawFloorPitOrStairsBitmapFlippedHorizontally
+ void drawFloorPitOrStairsBitmap(StairIndex relIndex, Frame &frame); // @ F0104_DUNGEONVIEW_DrawFloorPitOrStairsBitmap
void drawWallSetBitmap(byte *bitmap, Frame &f); // @ F0100_DUNGEONVIEW_DrawWallSetBitmap
void drawWallSetBitmapWithoutTransparency(byte *bitmap, Frame &f); // @ F0101_DUNGEONVIEW_DrawWallSetBitmapWithoutTransparency
void drawSquareD3L(direction dir, int16 posX, int16 posY); // @ F0116_DUNGEONVIEW_DrawSquareD3L
@@ -137,6 +163,8 @@ class DisplayMan {
void applyCreatureReplColors(int replacedColor, int replacementColor); // @ F0093_DUNGEONVIEW_ApplyCreatureReplacementColors
+ // some methods use this for a stratchpad, don't make assumptions about content between function calls
+ byte *_tmpBitmap = NULL;
public:
DisplayMan(DMEngine *dmEngine);
~DisplayMan();