diff options
-rw-r--r-- | engines/dm/dungeonman.h | 25 | ||||
-rw-r--r-- | engines/dm/gfx.cpp | 197 | ||||
-rw-r--r-- | engines/dm/gfx.h | 62 |
3 files changed, 187 insertions, 97 deletions
diff --git a/engines/dm/dungeonman.h b/engines/dm/dungeonman.h index dcf1659c79..df56ec229b 100644 --- a/engines/dm/dungeonman.h +++ b/engines/dm/dungeonman.h @@ -163,19 +163,20 @@ enum TextType { }; 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 + kElemAspect = 0, // @ C0_ELEMENT + kFirstGroupOrObjectAspect = 1, // @ C1_FIRST_GROUP_OR_OBJECT + kRightWallOrnOrdAspect = 2, // @ C2_RIGHT_WALL_ORNAMENT_ORDINAL + kFrontWallOrnOrdAspect = 3, // @ C3_FRONT_WALL_ORNAMENT_ORDINAL + kLeftWallOrnOrdAspect = 4, // @ C4_LEFT_WALL_ORNAMENT_ORDINAL + kPitInvisibleAspect = 2, // @ C2_PIT_INVISIBLE + kTeleporterVisibleAspect = 2, // @ C2_TELEPORTER_VISIBLE + kStairsUpAspect = 2, // @ C2_STAIRS_UP + kDoorStateAspect = 2, // @ C2_DOOR_STATE + kDoorThingIndexAspect = 3, // @ C3_DOOR_THING_INDEX + kFloorOrnOrdAspect = 4, // @ C4_FLOOR_ORNAMENT_ORDINAL + kFootprintsAspect = 0x8000 // @ MASK0x8000_FOOTPRINTS }; +; diff --git a/engines/dm/gfx.cpp b/engines/dm/gfx.cpp index 81b7e64423..49f0d2e4d3 100644 --- a/engines/dm/gfx.cpp +++ b/engines/dm/gfx.cpp @@ -39,6 +39,43 @@ namespace DM { +Frame g0164Frame_DoorFrameLeft_D3L = Frame(0, 31, 28, 70, 16, 43, 0, 0); // @ G0164_s_Graphic558_Frame_DoorFrameLeft_D3L +Frame g0165Frame_DoorFrameRight_D3R = Frame(192, 223, 28, 70, 16, 43, 0, 0); // @ G0165_s_Graphic558_Frame_DoorFrameRight_D3R +Frame g0166Frame_DoorFrameLeft_D3C = Frame(64, 95, 27, 70, 16, 44, 0, 0); // @ G0166_s_Graphic558_Frame_DoorFrameLeft_D3C +Frame g0167Frame_DoorFrameRight_D3C = Frame(128, 159, 27, 70, 16, 44, 0, 0); // @ G0167_s_Graphic558_Frame_DoorFrameRight_D3C +Frame g0168Frame_DoorFrameLeft_D2C = Frame(48, 95, 22, 86, 24, 65, 0, 0); // @ G0168_s_Graphic558_Frame_DoorFrameLeft_D2C +Frame g0169Frame_DoorFrameRight_D2C = Frame(128, 175, 22, 86, 24, 65, 0, 0); // @ G0169_s_Graphic558_Frame_DoorFrameRight_D2C +Frame g0170Frame_DoorFrameLeft_D1C = Frame(43, 74, 14, 107, 16, 94, 0, 0); // @ G0170_s_Graphic558_Frame_DoorFrameLeft_D1C +Frame g0171Frame_DoorFrameRight_D1C = Frame(149, 180, 14, 107, 16, 94, 0, 0); // @ G0171_s_Graphic558_Frame_DoorFrameRight_D1C +Frame g0172Frame_DoorFrame_D0C = Frame(96, 127, 0, 122, 16, 123, 0, 0); // @ G0172_s_Graphic558_Frame_DoorFrame_D0C +Frame g0173Frame_DoorFrameTop_D2L = Frame(0, 59, 22, 24, 48, 3, 16, 0); // @ G0173_s_Graphic558_Frame_DoorFrameTop_D2L +Frame g0174Frame_DoorFrameTop_D2C = Frame(64, 159, 22, 24, 48, 3, 0, 0); // @ G0174_s_Graphic558_Frame_DoorFrameTop_D2C +Frame g0175Frame_DoorFrameTop_D2R = Frame(164, 223, 22, 24, 48, 3, 16, 0); // @ G0175_s_Graphic558_Frame_DoorFrameTop_D2R +Frame g0176Frame_DoorFrameTop_D1L = Frame(0, 31, 14, 17, 64, 4, 16, 0); // @ G0176_s_Graphic558_Frame_DoorFrameTop_D1L +Frame g0177Frame_DoorFrameTop_D1C = Frame(48, 175, 14, 17, 64, 4, 0, 0); // @ G0177_s_Graphic558_Frame_DoorFrameTop_D1C +Frame g0178Frame_DoorFrameTop_D1R = Frame(192, 223, 14, 17, 64, 4, 16, 0); // @ G0178_s_Graphic558_Frame_DoorFrameTop_D1R +Frame g0140FrameFloorPit_D3L = Frame(0, 79, 66, 73, 40, 8, 0, 0); // @ G0140_s_Graphic558_Frame_FloorPit_D3L +Frame g0141FrameFloorPit_D3C = Frame(64, 159, 66, 73, 48, 8, 0, 0); // @ G0141_s_Graphic558_Frame_FloorPit_D3C +Frame g0142FrameFloorPit_D3R = Frame(144, 223, 66, 73, 40, 8, 0, 0); // @ G0142_s_Graphic558_Frame_FloorPit_D3R +Frame g0143FrameFloorPit_D2L = Frame(0, 79, 77, 88, 40, 12, 0, 0); // @ G0143_s_Graphic558_Frame_FloorPit_D2L +Frame g0144FrameFloorPit_D2C = Frame(64, 159, 77, 88, 48, 12, 0, 0); // @ G0144_s_Graphic558_Frame_FloorPit_D2C +Frame g0145FrameFloorPit_D2R = Frame(144, 223, 77, 88, 40, 12, 0, 0); // @ G0145_s_Graphic558_Frame_FloorPit_D2R +Frame g0146FrameFloorPit_D1L = Frame(0, 63, 93, 116, 32, 24, 0, 0); // @ G0146_s_Graphic558_Frame_FloorPit_D1L +Frame g0147FrameFloorPit_D1C = Frame(32, 191, 93, 116, 80, 24, 0, 0); // @ G0147_s_Graphic558_Frame_FloorPit_D1C +Frame g0148FrameFloorPit_D1R = Frame(160, 223, 93, 116, 32, 24, 0, 0); // @ G0148_s_Graphic558_Frame_FloorPit_D1R +Frame g0149FrameFloorPit_D0L = Frame(0, 31, 124, 135, 16, 12, 0, 0); // @ G0149_s_Graphic558_Frame_FloorPit_D0L +Frame g0150FrameFloorPit_D0C = Frame(16, 207, 124, 135, 96, 12, 0, 0); // @ G0150_s_Graphic558_Frame_FloorPit_D0C +Frame g0151FrameFloorPit_D0R = Frame(192, 223, 124, 135, 16, 12, 0, 0); // @ G0151_s_Graphic558_Frame_FloorPit_D0R +Frame g0152FrameFloorPit_D2L = Frame(0, 79, 19, 23, 40, 5, 0, 0); // @ G0152_s_Graphic558_Frame_CeilingPit_D2L +Frame g0153FrameFloorPit_D2C = Frame(64, 159, 19, 23, 48, 5, 0, 0); // @ G0153_s_Graphic558_Frame_CeilingPit_D2C +Frame g0154FrameFloorPit_D2R = Frame(144, 223, 19, 23, 40, 5, 0, 0); // @ G0154_s_Graphic558_Frame_CeilingPit_D2R +Frame g0155FrameFloorPit_D1L = Frame(0, 63, 8, 16, 32, 9, 0, 0); // @ G0155_s_Graphic558_Frame_CeilingPit_D1L +Frame g0156FrameFloorPit_D1C = Frame(32, 191, 8, 16, 80, 9, 0, 0); // @ G0156_s_Graphic558_Frame_CeilingPit_D1C +Frame g0157FrameFloorPit_D1R = Frame(160, 223, 8, 16, 32, 9, 0, 0); // @ G0157_s_Graphic558_Frame_CeilingPit_D1R +Frame g0158FrameFloorPit_D0L = Frame(0, 15, 0, 3, 8, 4, 0, 0); // @ G0158_s_Graphic558_Frame_CeilingPit_D0L +Frame g0159FrameFloorPit_D0C = Frame(16, 207, 0, 3, 96, 4, 0, 0); // @ G0159_s_Graphic558_Frame_CeilingPit_D0C +Frame g0160FrameFloorPit_D0R = Frame(208, 223, 0, 3, 8, 4, 0, 0); // @ G0160_s_Graphic558_Frame_CeilingPit_D0R + FieldAspect gFieldAspects[12] = { // @ G0188_as_Graphic558_FieldAspects /* { NativeBitmapRelativeIndex, BaseStartUnitIndex, Transparent color, Mask, ByteWidth, Height, X, BitPlaneWordCount } */ FieldAspect(0, 63, 0x8A, 0xFF, 0, 0, 0, 64), /* D3C */ @@ -645,8 +682,8 @@ DisplayMan::DisplayMan(DMEngine *dmEngine) : _vm(dmEngine) { for (int i = 0; i < 25; i++) _wallSetBitMaps[i] = nullptr; - for (int i = 0; i < kStairsGraphicCount; i++) - _stairIndices[i] = 0; + //for (int i = 0; i < kStairsGraphicCount; i++) + // _stairIndices[i] = 0; for (int i = 0; i < 4; i++) _palChangesProjectile[i] = nullptr; @@ -1065,33 +1102,62 @@ uint16 DisplayMan::getHeight(uint16 index) { void DisplayMan::drawWallSetBitmapWithoutTransparency(byte *bitmap, Frame &f) { if (f._srcWidth) - blitToScreen(bitmap, f._srcWidth, f._srcX, f._srcY, f._destFromX, f._destToX, f._destFromY, f._destToY, kColorNoTransparency, gDungeonViewport); + blitToScreen(bitmap, f._srcWidth, f._srcX, f._srcY, f._box, kColorNoTransparency, gDungeonViewport); } void DisplayMan::drawWallSetBitmap(byte *bitmap, Frame &f) { if (f._srcWidth) - blitToScreen(bitmap, f._srcWidth, f._srcX, f._srcY, f._destFromX, f._destToX, f._destFromY, f._destToY, kColorFlesh, gDungeonViewport); + blitToScreen(bitmap, f._srcWidth, f._srcX, f._srcY, f._box, kColorFlesh, gDungeonViewport); } + +// NOTE: has been screened for missing code void DisplayMan::drawSquareD3L(direction dir, int16 posX, int16 posY) { uint16 squareAspect[5]; + int16 order; + _vm->_dungeonMan->setSquareAspect(squareAspect, dir, posX, posY); switch (squareAspect[kElemAspect]) { case kStairsFrontElemType: if (squareAspect[kStairsUpAspect]) - drawFloorPitOrStairsBitmap(kStairsNativeIndex_Up_Front_D3L, gStairFrames[kFrameStairsUpFront_D3L]); + drawFloorPitOrStairsBitmap(_g0675stairsNativeBitmapIndex_Up_Front_D3L, gStairFrames[kFrameStairsUpFront_D3L]); else - drawFloorPitOrStairsBitmap(kStairsNativeIndex_Down_Front_D3L, gStairFrames[kFrameStairsDownFront_D3L]); - break; + drawFloorPitOrStairsBitmap(_g0682stairsNativeBitmapIndex_Down_Front_D3L, gStairFrames[kFrameStairsDownFront_D3L]); + goto T0116015_redEagle; case kWallElemType: drawWallSetBitmap(_wallSetBitMaps[kWall_D3LCR], gFrameWalls[kViewSquare_D3L]); isDrawnWallOrnAnAlcove(squareAspect[kRightWallOrnOrdAspect], kViewWall_D3L_RIGHT); if (isDrawnWallOrnAnAlcove(squareAspect[kFrontWallOrnOrdAspect], kViewWall_D3L_FRONT)) { - // ... missing code + order = kCellOrder_Alcove; + goto T0116017_orangeElk; } - break; - default: - break; + return; + case kElementTypeDoorSide: + case kElementTypeStairsSide: + order = kCellOrder_BackLeft_BackRight_FrontRight; + goto T0116016_blueToad; + case kElementTypeDoorFront: + warning("MISSING CODE: F0108_DUNGEONVIEW_DrawFloorOrnament"); + cthulhu(Thing(squareAspect[kFirstGroupOrObjectAspect]), dir, posX, posY, kViewSquare_D3L, kCellOrder_DoorPass1_BackLeft_BackRight); + drawWallSetBitmap(_wallSetBitMaps[kDoorFrameLeft_D3L], g0164Frame_DoorFrameLeft_D3L); + warning("MISSING CODE: F0111_DUNGEONVIEW_DrawDoor"); + order = kCellOrder_DoorPass2_FrontLeft_FrontRight; + goto T0116017_orangeElk; + case kElementTypePit: + if (!squareAspect[kPitInvisibleAspect]) { + drawFloorPitOrStairsBitmap(k049FloorPit_D3L_GraphicIndice, g0140FrameFloorPit_D3L); + } + case kElementTypeTeleporter: + case kElementTypeCorridor: +T0116015_redEagle: + order = kCellOrder_BackLeft_BackRight_FrontLeft_FrontRight; +T0116016_blueToad: + warning("MISSING CODE: F0108_DUNGEONVIEW_DrawFloorOrnament"); +T0116017_orangeElk: + cthulhu(Thing(squareAspect[kFirstGroupOrObjectAspect]), dir, posX, posY, kViewSquare_D3L, order); + } + if ((squareAspect[kElemAspect] == kElementTypeTeleporter) && squareAspect[kTeleporterVisibleAspect]) { + drawField(&gFieldAspects[kViewSquare_D3L], gFrameWalls[kViewSquare_D3L]._box); } } @@ -1101,9 +1167,9 @@ void DisplayMan::drawSquareD3R(direction dir, int16 posX, int16 posY) { switch (squareAspect[0]) { case kStairsFrontElemType: if (squareAspect[kStairsUpAspect]) - drawFloorPitOrStairsBitmapFlippedHorizontally(kStairsNativeIndex_Up_Front_D3L, gStairFrames[kFrameStairsUpFront_D3R]); + drawFloorPitOrStairsBitmapFlippedHorizontally(_g0675stairsNativeBitmapIndex_Up_Front_D3L, gStairFrames[kFrameStairsUpFront_D3R]); else - drawFloorPitOrStairsBitmapFlippedHorizontally(kStairsNativeIndex_Down_Front_D3L, gStairFrames[kFrameStairsDownFront_D3R]); + drawFloorPitOrStairsBitmapFlippedHorizontally(_g0682stairsNativeBitmapIndex_Down_Front_D3L, gStairFrames[kFrameStairsDownFront_D3R]); break; case kWallElemType: drawWallSetBitmap(_wallSetBitMaps[kWall_D3LCR], gFrameWalls[kViewSquare_D3R]); @@ -1122,9 +1188,9 @@ void DisplayMan::drawSquareD3C(direction dir, int16 posX, int16 posY) { switch (squareAspect[0]) { case kStairsFrontElemType: if (squareAspect[kStairsUpAspect]) - drawFloorPitOrStairsBitmap(kStairsNativeIndex_Up_Front_D3C, gStairFrames[kFrameStairsUpFront_D3C]); + drawFloorPitOrStairsBitmap(_g0676stairsNativeBitmapIndex_Up_Front_D3C, gStairFrames[kFrameStairsUpFront_D3C]); else - drawFloorPitOrStairsBitmap(kStairsNativeIndex_Down_Front_D3C, gStairFrames[kFrameStairsDownFront_D3C]); + drawFloorPitOrStairsBitmap(_g0683stairsNativeBitmapIndex_Down_Front_D3C, gStairFrames[kFrameStairsDownFront_D3C]); break; case kWallElemType: drawWallSetBitmapWithoutTransparency(_wallSetBitMaps[kWall_D3LCR], gFrameWalls[kViewSquare_D3C]); @@ -1142,9 +1208,9 @@ void DisplayMan::drawSquareD2L(direction dir, int16 posX, int16 posY) { switch (squareAspect[0]) { case kStairsFrontElemType: if (squareAspect[kStairsUpAspect]) - drawFloorPitOrStairsBitmap(kStairsNativeIndex_Up_Front_D2L, gStairFrames[kFrameStairsUpFront_D2L]); + drawFloorPitOrStairsBitmap(_g0677stairsNativeBitmapIndex_Up_Front_D2L, gStairFrames[kFrameStairsUpFront_D2L]); else - drawFloorPitOrStairsBitmap(kStairsNativeIndex_Down_Front_D2L, gStairFrames[kFrameStairsDownFront_D2L]); + drawFloorPitOrStairsBitmap(_g0684stairsNativeBitmapIndex_Down_Front_D2L, gStairFrames[kFrameStairsDownFront_D2L]); break; case kWallElemType: drawWallSetBitmap(_wallSetBitMaps[kWall_D2LCR], gFrameWalls[kViewSquare_D2L]); @@ -1154,7 +1220,7 @@ void DisplayMan::drawSquareD2L(direction dir, int16 posX, int16 posY) { } break; case kStairsSideElemType: - drawFloorPitOrStairsBitmap(kStairsNativeIndex_Side_D2L, gStairFrames[kFrameStairsSide_D2L]); + drawFloorPitOrStairsBitmap(_g0689stairsNativeBitmapIndex_Side_D2L, gStairFrames[kFrameStairsSide_D2L]); break; default: break; @@ -1166,9 +1232,9 @@ void DisplayMan::drawSquareD2R(direction dir, int16 posX, int16 posY) { switch (squareAspect[0]) { case kStairsFrontElemType: if (squareAspect[kStairsUpAspect]) - drawFloorPitOrStairsBitmapFlippedHorizontally(kStairsNativeIndex_Up_Front_D2L, gStairFrames[kFrameStairsUpFront_D2R]); + drawFloorPitOrStairsBitmapFlippedHorizontally(_g0677stairsNativeBitmapIndex_Up_Front_D2L, gStairFrames[kFrameStairsUpFront_D2R]); else - drawFloorPitOrStairsBitmapFlippedHorizontally(kStairsNativeIndex_Down_Front_D2L, gStairFrames[kFrameStairsDownFront_D2R]); + drawFloorPitOrStairsBitmapFlippedHorizontally(_g0684stairsNativeBitmapIndex_Down_Front_D2L, gStairFrames[kFrameStairsDownFront_D2R]); break; case kWallElemType: drawWallSetBitmap(_wallSetBitMaps[kWall_D2LCR], gFrameWalls[kViewSquare_D2R]); @@ -1178,7 +1244,7 @@ void DisplayMan::drawSquareD2R(direction dir, int16 posX, int16 posY) { } break; case kStairsSideElemType: - drawFloorPitOrStairsBitmapFlippedHorizontally(kStairsNativeIndex_Side_D2L, gStairFrames[kFrameStairsSide_D2R]); + drawFloorPitOrStairsBitmapFlippedHorizontally(_g0689stairsNativeBitmapIndex_Side_D2L, gStairFrames[kFrameStairsSide_D2R]); break; default: break; @@ -1190,9 +1256,9 @@ void DisplayMan::drawSquareD2C(direction dir, int16 posX, int16 posY) { switch (squareAspect[0]) { case kStairsFrontElemType: if (squareAspect[kStairsUpAspect]) - drawFloorPitOrStairsBitmap(kStairsNativeIndex_Up_Front_D2C, gStairFrames[kFrameStairsUpFront_D2C]); + drawFloorPitOrStairsBitmap(_g0678stairsNativeBitmapIndex_Up_Front_D2C, gStairFrames[kFrameStairsUpFront_D2C]); else - drawFloorPitOrStairsBitmap(kStairsNativeIndex_Down_Front_D2C, gStairFrames[kFrameStairsDownFront_D2C]); + drawFloorPitOrStairsBitmap(_g0685stairsNativeBitmapIndex_Down_Front_D2C, gStairFrames[kFrameStairsDownFront_D2C]); break; case kWallElemType: drawWallSetBitmapWithoutTransparency(_wallSetBitMaps[kWall_D2LCR], gFrameWalls[kViewSquare_D2C]); @@ -1210,9 +1276,9 @@ void DisplayMan::drawSquareD1L(direction dir, int16 posX, int16 posY) { switch (squareAspect[0]) { case kStairsFrontElemType: if (squareAspect[kStairsUpAspect]) - drawFloorPitOrStairsBitmap(kStairsNativeIndex_Up_Front_D1L, gStairFrames[kFrameStairsUpFront_D1L]); + drawFloorPitOrStairsBitmap(_g0679stairsNativeBitmapIndex_Up_Front_D1L, gStairFrames[kFrameStairsUpFront_D1L]); else - drawFloorPitOrStairsBitmap(kStairsNativeIndex_Down_Front_D1L, gStairFrames[kFrameStairsDownFront_D1L]); + drawFloorPitOrStairsBitmap(_g0686stairsNativeBitmapIndex_Down_Front_D1L, gStairFrames[kFrameStairsDownFront_D1L]); break; case kWallElemType: drawWallSetBitmap(_wallSetBitMaps[kWall_D1LCR], gFrameWalls[kViewSquare_D1L]); @@ -1220,9 +1286,9 @@ void DisplayMan::drawSquareD1L(direction dir, int16 posX, int16 posY) { break; case kStairsSideElemType: if (squareAspect[kStairsUpAspect]) - drawFloorPitOrStairsBitmap(kStairsNativeIndex_Up_Side_D1L, gStairFrames[kFrameStairsUpSide_D1L]); + drawFloorPitOrStairsBitmap(_g0690stairsNativeBitmapIndex_Up_Side_D1L, gStairFrames[kFrameStairsUpSide_D1L]); else - drawFloorPitOrStairsBitmap(kStairsNativeIndex_Down_Side_D1L, gStairFrames[kFrameStairsDownSide_D1L]); + drawFloorPitOrStairsBitmap(_g0691stairsNativeBitmapIndex_Down_Side_D1L, gStairFrames[kFrameStairsDownSide_D1L]); break; default: break; @@ -1234,9 +1300,9 @@ void DisplayMan::drawSquareD1R(direction dir, int16 posX, int16 posY) { switch (squareAspect[0]) { case kStairsFrontElemType: if (squareAspect[kStairsUpAspect]) - drawFloorPitOrStairsBitmapFlippedHorizontally(kStairsNativeIndex_Up_Front_D1L, gStairFrames[kFrameStairsUpFront_D1R]); + drawFloorPitOrStairsBitmapFlippedHorizontally(_g0679stairsNativeBitmapIndex_Up_Front_D1L, gStairFrames[kFrameStairsUpFront_D1R]); else - drawFloorPitOrStairsBitmapFlippedHorizontally(kStairsNativeIndex_Down_Front_D1L, gStairFrames[kFrameStairsDownFront_D1R]); + drawFloorPitOrStairsBitmapFlippedHorizontally(_g0686stairsNativeBitmapIndex_Down_Front_D1L, gStairFrames[kFrameStairsDownFront_D1R]); break; case kWallElemType: drawWallSetBitmap(_wallSetBitMaps[kWall_D1LCR], gFrameWalls[kViewSquare_D1R]); @@ -1244,9 +1310,9 @@ void DisplayMan::drawSquareD1R(direction dir, int16 posX, int16 posY) { break; case kStairsSideElemType: if (squareAspect[kStairsUpAspect]) - drawFloorPitOrStairsBitmapFlippedHorizontally(kStairsNativeIndex_Up_Side_D1L, gStairFrames[kFrameStairsUpSide_D1R]); + drawFloorPitOrStairsBitmapFlippedHorizontally(_g0690stairsNativeBitmapIndex_Up_Side_D1L, gStairFrames[kFrameStairsUpSide_D1R]); else - drawFloorPitOrStairsBitmapFlippedHorizontally(kStairsNativeIndex_Down_Side_D1L, gStairFrames[kFrameStairsDownSide_D1R]); + drawFloorPitOrStairsBitmapFlippedHorizontally(_g0691stairsNativeBitmapIndex_Down_Side_D1L, gStairFrames[kFrameStairsDownSide_D1R]); break; default: break; @@ -1258,9 +1324,9 @@ void DisplayMan::drawSquareD1C(direction dir, int16 posX, int16 posY) { switch (squareAspect[0]) { case kStairsFrontElemType: if (squareAspect[kStairsUpAspect]) - drawFloorPitOrStairsBitmap(kStairsNativeIndex_Up_Front_D1C, gStairFrames[kFrameStairsUpFront_D1C]); + drawFloorPitOrStairsBitmap(_g0680stairsNativeBitmapIndex_Up_Front_D1C, gStairFrames[kFrameStairsUpFront_D1C]); else - drawFloorPitOrStairsBitmap(kStairsNativeIndex_Down_Front_D1C, gStairFrames[kFrameStairsDownFront_D1C]); + drawFloorPitOrStairsBitmap(_g0687stairsNativeBitmapIndex_Down_Front_D1C, gStairFrames[kFrameStairsDownFront_D1C]); break; case kWallElemType: _vm->_dungeonMan->_isFacingAlcove = false; @@ -1282,7 +1348,7 @@ void DisplayMan::drawSquareD0L(direction dir, int16 posX, int16 posY) { switch (squareAspect[0]) { case kStairsSideElemType: if (squareAspect[kStairsUpAspect]) - drawFloorPitOrStairsBitmap(kStairsNativeIndex_Side_D0L, gStairFrames[kFrameStairsSide_D0L]); + drawFloorPitOrStairsBitmap(_g0692stairsNativeBitmapIndex_Side_D0L, gStairFrames[kFrameStairsSide_D0L]); break; case kWallElemType: drawWallSetBitmap(_wallSetBitMaps[kWall_D0L], gFrameWalls[kViewSquare_D0L]); @@ -1298,7 +1364,7 @@ void DisplayMan::drawSquareD0R(direction dir, int16 posX, int16 posY) { switch (squareAspect[0]) { case kStairsSideElemType: if (squareAspect[kStairsUpAspect]) - drawFloorPitOrStairsBitmapFlippedHorizontally(kStairsNativeIndex_Side_D0L, gStairFrames[kFrameStairsSide_D0R]); + drawFloorPitOrStairsBitmapFlippedHorizontally(_g0692stairsNativeBitmapIndex_Side_D0L, gStairFrames[kFrameStairsSide_D0R]); return; case kWallElemType: drawWallSetBitmap(_wallSetBitMaps[kWall_D0R], gFrameWalls[kViewSquare_D0R]); @@ -1314,11 +1380,11 @@ void DisplayMan::drawSquareD0C(direction dir, int16 posX, int16 posY) { switch (squareAspect[0]) { case kStairsFrontElemType: if (squareAspect[kStairsUpAspect]) { - drawFloorPitOrStairsBitmap(kStairsNativeIndex_Up_Front_D0C_Left, gStairFrames[kFrameStairsUpFront_D0L]); - drawFloorPitOrStairsBitmapFlippedHorizontally(kStairsNativeIndex_Up_Front_D0C_Left, gStairFrames[kFrameStairsUpFront_D0R]); + drawFloorPitOrStairsBitmap(_g0681stairsNativeBitmapIndex_Up_Front_D0C_Left, gStairFrames[kFrameStairsUpFront_D0L]); + drawFloorPitOrStairsBitmapFlippedHorizontally(_g0681stairsNativeBitmapIndex_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]); + drawFloorPitOrStairsBitmap(_g0688stairsNativeBitmapIndex_Down_Front_D0C_Left, gStairFrames[kFrameStairsDownFront_D0L]); + drawFloorPitOrStairsBitmapFlippedHorizontally(_g0688stairsNativeBitmapIndex_Down_Front_D0C_Left, gStairFrames[kFrameStairsDownFront_D0R]); } break; default: @@ -1481,8 +1547,27 @@ void DisplayMan::loadCurrentMapGraphics() { // 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; + { + int16 val = _vm->_dungeonMan->_currMap._map->_wallSet * kStairsGraphicCount + kFirstStairs; + _g0675stairsNativeBitmapIndex_Up_Front_D3L = val++; + _g0676stairsNativeBitmapIndex_Up_Front_D3C = val++; + _g0677stairsNativeBitmapIndex_Up_Front_D2L = val++; + _g0678stairsNativeBitmapIndex_Up_Front_D2C = val++; + _g0679stairsNativeBitmapIndex_Up_Front_D1L = val++; + _g0680stairsNativeBitmapIndex_Up_Front_D1C = val++; + _g0681stairsNativeBitmapIndex_Up_Front_D0C_Left = val++; + _g0682stairsNativeBitmapIndex_Down_Front_D3L = val++; + _g0683stairsNativeBitmapIndex_Down_Front_D3C = val++; + _g0684stairsNativeBitmapIndex_Down_Front_D2L = val++; + _g0685stairsNativeBitmapIndex_Down_Front_D2C = val++; + _g0686stairsNativeBitmapIndex_Down_Front_D1L = val++; + _g0687stairsNativeBitmapIndex_Down_Front_D1C = val++; + _g0688stairsNativeBitmapIndex_Down_Front_D0C_Left = val++; + _g0689stairsNativeBitmapIndex_Side_D2L = val++; + _g0690stairsNativeBitmapIndex_Up_Side_D1L = val++; + _g0691stairsNativeBitmapIndex_Down_Side_D1L = val++; + _g0692stairsNativeBitmapIndex_Side_D0L = val++; + } for (int16 i = 0; i < kAlcoveOrnCount; ++i) _currMapAlcoveOrnIndices[i] = -1; @@ -1554,17 +1639,17 @@ void DisplayMan::applyCreatureReplColors(int replacedColor, int replacementColor gPalChangesCreature_D3[replacedColor] = gCreatureReplColorSets[replacementColor]._D3ReplacementColor; } -void DisplayMan::drawFloorPitOrStairsBitmap(StairIndex relIndex, Frame &f) { +void DisplayMan::drawFloorPitOrStairsBitmap(uint16 nativeIndex, 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); + blitToScreen(_bitmaps[nativeIndex], f._srcWidth, f._srcX, f._srcY, f._box, kColorFlesh, gDungeonViewport); } } -void DisplayMan::drawFloorPitOrStairsBitmapFlippedHorizontally(StairIndex relIndex, Frame &f) { +void DisplayMan::drawFloorPitOrStairsBitmapFlippedHorizontally(uint16 nativeIndex, Frame &f) { if (f._srcWidth) { - blitToBitmap(_bitmaps[_stairIndices[relIndex]], f._srcWidth, f._srcHeight, _tmpBitmap, f._srcWidth); + blitToBitmap(_bitmaps[nativeIndex], 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); + blitToScreen(_tmpBitmap, f._srcWidth, f._srcX, f._srcY, f._box, kColorFlesh, gDungeonViewport); } } @@ -1641,12 +1726,12 @@ bool DisplayMan::isDrawnWallOrnAnAlcove(int16 wallOrnOrd, ViewWall viewWallIndex while (*character++ < 0x80) { characterCount++; } - frame._destToX = (frame._destFromX = 112 - (characterCount * 4)) + 7; - frame._destFromY = (frame._destToY = gInscriptionLineY[textLineIndex++]) - 7; + frame._box._x2 = (frame._box._x1 = 112 - (characterCount * 4)) + 7; + frame._box._y1 = (frame._box._y2 = gInscriptionLineY[textLineIndex++]) - 7; while (characterCount--) { - blitToScreen(bitmapRed, 288, (*string++) * 8, 0, frame._destFromX, frame._destToX, frame._destFromY, frame._destToY, kColorFlesh, gDungeonViewport); - frame._destFromX += 8; - frame._destToX += 8; + blitToScreen(bitmapRed, 288, (*string++) * 8, 0, frame._box, kColorFlesh, gDungeonViewport); + frame._box._x1 += 8; + frame._box._x2 += 8; } } while (*string++ != 0x81); return isAlcove; @@ -1721,14 +1806,14 @@ bool DisplayMan::isDrawnWallOrnAnAlcove(int16 wallOrnOrd, ViewWall viewWallIndex } while (*string++ != 0x81); if (unreadableTextLineCount < 4) { - frame._destFromX = coordinateSetA[0]; - frame._destToX = coordinateSetA[1]; - frame._destFromY = coordinateSetA[2]; - frame._destToY = coordinateSetA[3]; + frame._box._x1 = coordinateSetA[0]; + frame._box._x2 = coordinateSetA[1]; + frame._box._y1 = coordinateSetA[2]; + frame._box._y2 = coordinateSetA[3]; frame._srcWidth = coordinateSetA[4]; frame._srcHeight = coordinateSetA[5]; - coordinateSetA = &frame._destFromX; + coordinateSetA = (uint16*)&frame._box; coordinateSetA[3] = gUnreadableInscriptionBoxY2[gWallOrnDerivedBitmapIndexIncrement[viewWallIndex] * 3 + unreadableTextLineCount - 1]; } diff --git a/engines/dm/gfx.h b/engines/dm/gfx.h index 8a116b59c7..397417fd75 100644 --- a/engines/dm/gfx.h +++ b/engines/dm/gfx.h @@ -209,7 +209,15 @@ enum GraphicIndice { kFirstObjectGraphicIndice = 360, // @ C360_GRAPHIC_FIRST_OBJECT kFirstCreatureGraphicIndice = 446, // @ C446_GRAPHIC_FIRST_CREATURE kFirstProjectileGraphicIndice = 316, // @ C316_GRAPHIC_FIRST_PROJECTILE - kFirstExplosionPatternGraphicIndice = 351 // @ C351_GRAPHIC_FIRST_EXPLOSION_PATTERN + kFirstExplosionPatternGraphicIndice = 351, // @ C351_GRAPHIC_FIRST_EXPLOSION_PATTERN + k049FloorPit_D3L_GraphicIndice = 49, // @ C049_GRAPHIC_FLOOR_PIT_D3L + k050FloorPit_D3C_GraphicIndice = 50, // @ C050_GRAPHIC_FLOOR_PIT_D3C + k051FloorPit_D2L_GraphicIndice = 51, // @ C051_GRAPHIC_FLOOR_PIT_D2L + k052FloorPit_D2C_GraphicIndice = 52, // @ C052_GRAPHIC_FLOOR_PIT_D2C + k053FloorPit_D1L_GraphicIndice = 53, // @ C053_GRAPHIC_FLOOR_PIT_D1L + k054FloorPit_D1C_GraphicIndice = 54, // @ C054_GRAPHIC_FLOOR_PIT_D1C + k055FloorPit_D0L_GraphicIndice = 55, // @ C055_GRAPHIC_FLOOR_PIT_D0L + k056FloorPit_D0C_GraphicIndice = 56 // @ C056_GRAPHIC_FLOOR_PIT_D0C }; extern uint16 gPalSwoosh[16]; @@ -235,16 +243,16 @@ public: extern Box gBoxMovementArrows; // G0002_s_Graphic562_Box_MovementArrows -// The frames in the original sources contain inclusive boundaries and byte widths, not pixel widths -struct Frame { - uint16 _destFromX, _destToX, _destFromY, _destToY; +class Frame { +public: + Box _box; uint16 _srcWidth, _srcHeight; uint16 _srcX, _srcY; Frame() {} Frame(uint16 destFromX, uint16 destToX, uint16 destFromY, uint16 destToY, uint16 srcWidth, uint16 srcHeight, uint16 srcX, uint16 srcY) : - _destFromX(destFromX), _destToX(destToX + 1), _destFromY(destFromY), _destToY(destToY + 1), + _box(destFromX, destToX, destFromY, destToY), _srcWidth(srcWidth * 2), _srcHeight(srcHeight), _srcX(srcX), _srcY(srcY) {} }; @@ -256,27 +264,6 @@ 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 ViewWall { kViewWall_D3L_RIGHT = 0, // @ C00_VIEW_WALL_D3L_RIGHT kViewWall_D3R_LEFT = 1, // @ C01_VIEW_WALL_D3R_LEFT @@ -416,7 +403,6 @@ class DisplayMan { // pointers 13,14 and [15-19] are owned by this array byte *_wallSetBitMaps[25]; // @G[0696..0710]_puc_Bitmap_WallSet_... - uint16 _stairIndices[kStairsGraphicCount]; // pointers are not owned by these fields byte *_floorBitmap; @@ -432,8 +418,8 @@ class DisplayMan { void unpackGraphics(); void loadFNT1intoBitmap(uint16 index, byte *destBitmap); - void drawFloorPitOrStairsBitmapFlippedHorizontally(StairIndex relIndex, Frame &frame); // @ F0105_DUNGEONVIEW_DrawFloorPitOrStairsBitmapFlippedHorizontally - void drawFloorPitOrStairsBitmap(StairIndex relIndex, Frame &frame); // @ F0104_DUNGEONVIEW_DrawFloorPitOrStairsBitmap + void drawFloorPitOrStairsBitmapFlippedHorizontally(uint16 nativeIndex, Frame &frame); // @ F0105_DUNGEONVIEW_DrawFloorPitOrStairsBitmapFlippedHorizontally + void drawFloorPitOrStairsBitmap(uint16 nativeIndex, 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 @@ -457,6 +443,24 @@ class DisplayMan { uint16 *_derivedBitmapByteCount; // @ G0639_pui_DerivedBitmapByteCount byte **_derivedBitmaps; // @ G0638_pui_DerivedBitmapBlockIndices + int16 _g0675stairsNativeBitmapIndex_Up_Front_D3L; // @ G0675_i_StairsNativeBitmapIndex_Up_Front_D3L + int16 _g0676stairsNativeBitmapIndex_Up_Front_D3C; // @ G0676_i_StairsNativeBitmapIndex_Up_Front_D3C + int16 _g0677stairsNativeBitmapIndex_Up_Front_D2L; // @ G0677_i_StairsNativeBitmapIndex_Up_Front_D2L + int16 _g0678stairsNativeBitmapIndex_Up_Front_D2C; // @ G0678_i_StairsNativeBitmapIndex_Up_Front_D2C + int16 _g0679stairsNativeBitmapIndex_Up_Front_D1L; // @ G0679_i_StairsNativeBitmapIndex_Up_Front_D1L + int16 _g0680stairsNativeBitmapIndex_Up_Front_D1C; // @ G0680_i_StairsNativeBitmapIndex_Up_Front_D1C + int16 _g0681stairsNativeBitmapIndex_Up_Front_D0C_Left; // @ G0681_i_StairsNativeBitmapIndex_Up_Front_D0C_Left + int16 _g0682stairsNativeBitmapIndex_Down_Front_D3L; // @ G0682_i_StairsNativeBitmapIndex_Down_Front_D3L + int16 _g0683stairsNativeBitmapIndex_Down_Front_D3C; // @ G0683_i_StairsNativeBitmapIndex_Down_Front_D3C + int16 _g0684stairsNativeBitmapIndex_Down_Front_D2L; // @ G0684_i_StairsNativeBitmapIndex_Down_Front_D2L + int16 _g0685stairsNativeBitmapIndex_Down_Front_D2C; // @ G0685_i_StairsNativeBitmapIndex_Down_Front_D2C + int16 _g0686stairsNativeBitmapIndex_Down_Front_D1L; // @ G0686_i_StairsNativeBitmapIndex_Down_Front_D1L + int16 _g0687stairsNativeBitmapIndex_Down_Front_D1C; // @ G0687_i_StairsNativeBitmapIndex_Down_Front_D1C + int16 _g0688stairsNativeBitmapIndex_Down_Front_D0C_Left; // @ G0688_i_StairsNativeBitmapIndex_Down_Front_D0C_Left + int16 _g0689stairsNativeBitmapIndex_Side_D2L; // @ G0689_i_StairsNativeBitmapIndex_Side_D2L + int16 _g0690stairsNativeBitmapIndex_Up_Side_D1L; // @ G0690_i_StairsNativeBitmapIndex_Up_Side_D1L + int16 _g0691stairsNativeBitmapIndex_Down_Side_D1L; // @ G0691_i_StairsNativeBitmapIndex_Down_Side_D1L + int16 _g0692stairsNativeBitmapIndex_Side_D0L; // @ G0692_i_StairsNativeBitmapIndex_Side_D0L public: // some methods use this for a stratchpad, don't make assumptions about content between function calls byte *_tmpBitmap; |