diff options
author | WinterGrascph | 2016-05-06 18:55:09 +0200 |
---|---|---|
committer | Bendegúz Nagy | 2016-08-26 23:02:22 +0200 |
commit | a8434fc165266fb6a788618cdf334b01be53c25e (patch) | |
tree | 42194e471e50ed0a9f60c7386682b8b80d40c61a /engines/dm | |
parent | 98a43792448fc937fa48dffd79adc0b1dda6cbf0 (diff) | |
download | scummvm-rg350-a8434fc165266fb6a788618cdf334b01be53c25e.tar.gz scummvm-rg350-a8434fc165266fb6a788618cdf334b01be53c25e.tar.bz2 scummvm-rg350-a8434fc165266fb6a788618cdf334b01be53c25e.zip |
DM: Add support for viewports with blitting
Diffstat (limited to 'engines/dm')
-rw-r--r-- | engines/dm/gfx.cpp | 13 | ||||
-rw-r--r-- | engines/dm/gfx.h | 12 |
2 files changed, 18 insertions, 7 deletions
diff --git a/engines/dm/gfx.cpp b/engines/dm/gfx.cpp index 52e2e200c3..0ae3b251fd 100644 --- a/engines/dm/gfx.cpp +++ b/engines/dm/gfx.cpp @@ -38,6 +38,9 @@ struct Frame { Frame gCeilingFrame = {0, 223, 0, 28, 0, 0}; Frame gFloorFrame = {0, 223, 66, 135, 0, 0}; +extern Viewport gDefultViewPort = {0, 0}; +extern Viewport gDungeonViewport = {0, 64}; + } using namespace DM; @@ -170,20 +173,20 @@ void DisplayMan::loadIntoBitmap(uint16 index, byte *destBitmap) { void DisplayMan::blitToBitmap(byte *srcBitmap, uint16 srcWidth, uint16 srcX, uint16 srcY, byte *destBitmap, uint16 destWidth, uint16 destFromX, uint16 destToX, uint16 destFromY, uint16 destToY, - Color transparent) { + Color transparent, Viewport &destViewport) { for (uint16 y = 0; y < destToY - destFromY; ++y) for (uint16 x = 0; x < destToX - destFromX; ++x) { byte srcPixel = srcBitmap[srcWidth * (y + srcY) + srcX + x]; if (srcPixel != transparent) - destBitmap[destWidth * (y + destFromY) + destFromX + x] = srcPixel; + destBitmap[destWidth * (y + destFromY + destViewport.posY) + destFromX + x + destViewport.posX] = srcPixel; } } void DisplayMan::blitToScreen(byte *srcBitmap, uint16 srcWidth, uint16 srcX, uint16 srcY, uint16 destFromX, uint16 destToX, uint16 destFromY, uint16 destToY, - Color transparent) { + Color transparent, Viewport &viewport) { blitToBitmap(srcBitmap, srcWidth, srcX, srcY, - getCurrentVgaBuffer(), _screenWidth, destFromX, destToX, destFromY, destToY, transparent); + getCurrentVgaBuffer(), _screenWidth, destFromX, destToX, destFromY, destToY, transparent, viewport); } void DisplayMan::blitToBitmap(byte *srcBitmap, uint16 srcWidth, uint16 srcHeight, byte *destBitmap, uint16 destWidth, uint16 destX, uint16 destY) { @@ -235,7 +238,7 @@ uint16 DisplayMan::height(uint16 index) { } void DisplayMan::drawWallSetBitmap(byte *bitmap, Frame &f, uint16 srcWidth) { - blitToScreen(bitmap, srcWidth, f.srcX, f.srcY, f.destFromX, f.destToX + 1, f.destFromY, f.destToY + 1, kColorFlesh); + blitToScreen(bitmap, srcWidth, f.srcX, f.srcY, f.destFromX, f.destToX + 1, f.destFromY, f.destToY + 1, kColorFlesh, gDungeonViewport); } diff --git a/engines/dm/gfx.h b/engines/dm/gfx.h index 79a4afd426..34bb8cf991 100644 --- a/engines/dm/gfx.h +++ b/engines/dm/gfx.h @@ -7,6 +7,7 @@ namespace DM { struct Frame; + enum Color { kColorNoTransparency = 255, kColorBlack = 0, @@ -40,6 +41,13 @@ enum dmPaletteEnum { kPalDungeonView5 = 9, }; +struct Viewport { + // TODO: should probably add width and height, seems redundant right meow + uint16 posX, posY; +}; + +extern Viewport gDefultViewPort; +extern Viewport gDungeonViewport; @@ -75,11 +83,11 @@ public: void blitToBitmap(byte *srcBitmap, uint16 srcWidth, uint16 srcX, uint16 srcY, byte *destBitmap, uint16 destWidth, uint16 destFromX, uint16 destToX, uint16 destFromY, uint16 destToY, - Color transparent = kColorNoTransparency); + Color transparent = kColorNoTransparency, Viewport &viewport = gDefultViewPort); void blitToBitmap(byte *srcBitmap, uint16 srcWidth, uint16 srcHeight, byte *destBitmap, uint16 destWidth, uint16 destX = 0, uint16 destY = 0); void blitToScreen(byte *srcBitmap, uint16 srcWidth, uint16 srcX, uint16 srcY, uint16 destFromX, uint16 destToX, uint16 destFromY, uint16 destToY, - Color transparent = kColorNoTransparency); + Color transparent = kColorNoTransparency, Viewport &viewport = gDefultViewPort); void flipBitmapHorizontal(byte *bitmap, uint16 width, uint16 height); void flipBitmapVertical(byte *bitmap, uint16 width, uint16 height); |