diff options
author | Bendegúz Nagy | 2016-06-30 12:12:22 +0200 |
---|---|---|
committer | Bendegúz Nagy | 2016-08-26 23:02:22 +0200 |
commit | b3e1760bfb6113159a7a8d6079c358a451eee781 (patch) | |
tree | a532241d6fb48cc20996e9d77757c8b53ca59326 /engines/dm | |
parent | bc583bf0d52cb2e9d959ad36a06e462707084d63 (diff) | |
download | scummvm-rg350-b3e1760bfb6113159a7a8d6079c358a451eee781.tar.gz scummvm-rg350-b3e1760bfb6113159a7a8d6079c358a451eee781.tar.bz2 scummvm-rg350-b3e1760bfb6113159a7a8d6079c358a451eee781.zip |
DM: Add dummy blitBoxFilledWithMaskedBitmap and DisplayMan::drawField
Diffstat (limited to 'engines/dm')
-rw-r--r-- | engines/dm/TODOs/methodtree.txt | 10 | ||||
-rw-r--r-- | engines/dm/gfx.cpp | 38 | ||||
-rw-r--r-- | engines/dm/gfx.h | 28 |
3 files changed, 70 insertions, 6 deletions
diff --git a/engines/dm/TODOs/methodtree.txt b/engines/dm/TODOs/methodtree.txt index 10ed85fa5c..7a05ad177f 100644 --- a/engines/dm/TODOs/methodtree.txt +++ b/engines/dm/TODOs/methodtree.txt @@ -1,9 +1,9 @@ F0115_DUNGEONVIEW_DrawObjectsCreaturesProjectilesExplosions_CPSEF - F0113_DUNGEONVIEW_DrawField // dummy - F0133_VIDEO_BlitBoxFilledWithMaskedBitmap - FIELD_ASPECT + F0113_DUNGEONVIEW_DrawField // stub method + F0133_VIDEO_BlitBoxFilledWithMaskedBitmap // dummy + FIELD_ASPECT // done F0114_DUNGEONVIEW_GetExplosionBitmap - F0133_VIDEO_BlitBoxFilledWithMaskedBitmap + F0133_VIDEO_BlitBoxFilledWithMaskedBitmap // dummy F0141_DUNGEON_GetObjectInfoIndex F0142_DUNGEON_GetProjectileAspect F0176_GROUP_GetCreatureOrdinalInCell @@ -44,7 +44,7 @@ F0115_DUNGEONVIEW_DrawObjectsCreaturesProjectilesExplosions_CPSEF CREATURE_ASPECT PROJECTILE EXPLOSION - FIELD_ASPECT + FIELD_ASPECT // done diff --git a/engines/dm/gfx.cpp b/engines/dm/gfx.cpp index ea3a4b7b67..2fa2bf5d5a 100644 --- a/engines/dm/gfx.cpp +++ b/engines/dm/gfx.cpp @@ -969,6 +969,12 @@ void DisplayMan::blitToBitmap(byte *srcBitmap, uint16 srcWidth, uint16 srcHeight memcpy(destBitmap + destWidth*(y + destY) + destX, srcBitmap + y * srcWidth, sizeof(byte)* srcWidth); } +void DisplayMan::blitBoxFilledWithMaskedBitmapToScreen(byte* src, byte* mask, byte* tmp, Box& box, + int16 lastUnitIndex, int16 firstUnitIndex, int16 destPixelWidth, Color transparent, + int16 xPos, int16 yPos, int16 height2, Viewport& viewport) { + blitBoxFilledWithMaskedBitmap(src, _vgaBuffer, mask, tmp, box, lastUnitIndex, firstUnitIndex, _screenWidth, transparent, xPos, yPos, _screenHeight, height2, viewport); +} + void DisplayMan::flipBitmapHorizontal(byte *bitmap, uint16 width, uint16 height) { for (uint16 y = 0; y < height; ++y) { for (uint16 x = 0; x < width / 2; ++x) { @@ -1724,6 +1730,32 @@ uint32 DisplayMan::getCompressedDataSize(uint16 index) { return _packedItemPos[index + 1] - _packedItemPos[index]; } +/* Field Aspect Mask */ +#define kMaskFieldAspectFlipMask 0x0080 // @ MASK0x0080_FLIP_MASK +#define kMaskFieldAspectIndex 0x007F // @ MASK0x007F_MASK_INDEX +#define kMaskFieldAspectNoMask 255 // @ C255_NO_MASK + +void DisplayMan::drawField(FieldAspect* fieldAspect, Box& box) { + DisplayMan &dispMan = *_vm->_displayMan; + + byte *bitmapMask; + if (fieldAspect->_mask == kMaskFieldAspectNoMask) { + bitmapMask = nullptr; + } else { + bitmapMask = dispMan._tmpBitmap; + memcpy(bitmapMask, dispMan.getBitmap(kFieldMask_D3R_GraphicIndice + getFlag(fieldAspect->_mask, kMaskFieldAspectIndex)), + fieldAspect->_height * fieldAspect->_pixelWidth * sizeof(bitmapMask[0])); + if (getFlag(fieldAspect->_mask, kMaskFieldAspectFlipMask)) { + dispMan.flipBitmapHorizontal(bitmapMask, fieldAspect->_pixelWidth, fieldAspect->_height); + } + } + + byte *bitmap = dispMan.getBitmap(kFieldTeleporterGraphicIndice + fieldAspect->_nativeBitmapRelativeIndex); + warning("MISSING CODE: F0133_VIDEO_BlitBoxFilledWithMaskedBitmap"); + + warning("IGNORED CODE: F0491_CACHE_IsDerivedBitmapInCache, F0493_CACHE_AddDerivedBitmap, F0480_CACHE_ReleaseBlock"); +} + int16 DisplayMan::getScaledBitmapPixelCount(int16 pixelWidth, int16 pixelHeight, int16 scale) { return getScaledDimension(pixelWidth, scale) * getScaledDimension(pixelHeight, scale); } @@ -1756,4 +1788,10 @@ void DisplayMan::blitToScreen(byte *srcBitmap, uint16 srcWidth, uint16 srcX, uin blitToScreen(srcBitmap, srcWidth, srcX, srcY, box._x1, box._x2, box._y1, box._y2, transparent, viewport); } +void DisplayMan::blitBoxFilledWithMaskedBitmap(byte* src, byte* dest, byte* mask, byte* tmp, Box& box, + int16 lastUnitIndex, int16 firstUnitIndex, int16 destPixelWidth, Color transparent, + int16 xPos, int16 yPos, int16 destHeight, int16 height2, Viewport &viewport) { + warning("STUB FUNCTION: does nothing at all"); +} + } diff --git a/engines/dm/gfx.h b/engines/dm/gfx.h index ba6584f0f4..34a1399366 100644 --- a/engines/dm/gfx.h +++ b/engines/dm/gfx.h @@ -35,6 +35,9 @@ #include "common/array.h" namespace DM { + + + #define kFloorSetGraphicCount 2 // @ C002_FLOOR_SET_GRAPHIC_COUNT #define kWallSetGraphicCount 13 // @ C013_WALL_SET_GRAPHIC_COUNT #define kStairsGraphicCount 18 // @ C018_STAIRS_GRAPHIC_COUNT @@ -161,7 +164,9 @@ enum GraphicIndice { kEyeForObjectDescriptionIndice = 19, // @ C019_GRAPHIC_EYE_FOR_OBJECT_DESCRIPTION kArrowForChestContentIndice = 18, // @ C018_GRAPHIC_ARROW_FOR_CHEST_CONTENT kObjectDescCircleIndice = 29, // @ C029_GRAPHIC_OBJECT_DESCRIPTION_CIRCLE - kFloorOrn_15_D3L_footprints = 241 // @ C241_GRAPHIC_FLOOR_ORNAMENT_15_D3L_FOOTPRINTS + kFloorOrn_15_D3L_footprints = 241, // @ C241_GRAPHIC_FLOOR_ORNAMENT_15_D3L_FOOTPRINTS + kFieldMask_D3R_GraphicIndice = 69, // @ C069_GRAPHIC_FIELD_MASK_D3R + kFieldTeleporterGraphicIndice = 73 // @ C073_GRAPHIC_FIELD_TELEPORTER }; extern uint16 gPalSwoosh[16]; @@ -265,6 +270,20 @@ enum Color { kColorWhite = 15 }; +class FieldAspect { +public: + uint16 _nativeBitmapRelativeIndex; + uint16 _baseStartUnitIndex; /* Index of the unit (16 pixels = 8 bytes) in bitmap where blit will start from. A random value of 0 or 1 is added to this base index */ + Color _transparentColor; /* Bit 7: Do not use mask if set, Bits 6-0: Transparent color index. 0xFF = no transparency */ + byte _mask; /* Bit 7: Flip, Bits 6-0: Mask index. 0xFF = no mask */ + uint16 _pixelWidth; + uint16 _height; + uint16 _xPos; + FieldAspect(uint16 native, uint16 base, Color transparent, byte mask, uint16 byteWidth, uint16 height, uint16 xPos) + : _nativeBitmapRelativeIndex(native), _baseStartUnitIndex(base), _transparentColor(transparent), _mask(mask), + _pixelWidth(byteWidth * 2), _height(height), _xPos(xPos) {} +}; // @ FIELD_ASPECT + class Viewport { public: @@ -429,6 +448,12 @@ public: void blitToScreen(byte *srcBitmap, uint16 srcWidth, uint16 srcX, uint16 srcY, Box &box, Color transparent = kColorNoTransparency, Viewport &viewport = gDefultViewPort); + void blitBoxFilledWithMaskedBitmap(byte *src, byte *dest, byte *mask, byte *tmp, Box &box, int16 lastUnitIndex, + int16 firstUnitIndex, int16 destPixelWidth, Color transparent, + int16 xPos, int16 yPos, int16 destHeight, int16 height2, Viewport &viewport = gDefultViewPort); // @ F0133_VIDEO_BlitBoxFilledWithMaskedBitmap + void blitBoxFilledWithMaskedBitmapToScreen(byte *src, byte *mask, byte *tmp, Box &box, int16 lastUnitIndex, + int16 firstUnitIndex, int16 destPixelWidth, Color transparent, + int16 xPos, int16 yPos, int16 height2, Viewport &viewport = gDungeonViewport); // @ F0133_VIDEO_BlitBoxFilledWithMaskedBitmap void flipBitmapHorizontal(byte *bitmap, uint16 width, uint16 height); void flipBitmapVertical(byte *bitmap, uint16 width, uint16 height); @@ -441,6 +466,7 @@ public: byte* getBitmap(uint16 index); Common::MemoryReadStream getCompressedData(uint16 index); uint32 getCompressedDataSize(uint16 index); + void drawField(FieldAspect *fieldAspect, Box &box); // @ F0113_DUNGEONVIEW_DrawField int16 getScaledBitmapPixelCount(int16 pixelWidth, int16 pixelHeight, int16 scale); // @ F0459_START_GetScaledBitmapByteCount int16 getScaledDimension(int16 dimension, int16 scale); // @ M78_SCALED_DIMENSION |