diff options
author | WinterGrascph | 2016-05-25 01:13:36 +0200 |
---|---|---|
committer | Bendegúz Nagy | 2016-08-26 23:02:22 +0200 |
commit | b9935dfddc17ed71a6135896554d27d80c30b516 (patch) | |
tree | 7778bb5300140a76c513d1d64f80055e0d01f901 /engines | |
parent | ab1e17257ca737c89c3e1a5f51741b2665ab4cac (diff) | |
download | scummvm-rg350-b9935dfddc17ed71a6135896554d27d80c30b516.tar.gz scummvm-rg350-b9935dfddc17ed71a6135896554d27d80c30b516.tar.bz2 scummvm-rg350-b9935dfddc17ed71a6135896554d27d80c30b516.zip |
DM: Add blitToBitmapShrinkWithPalChange
Diffstat (limited to 'engines')
-rw-r--r-- | engines/dm/gfx.cpp | 27 | ||||
-rw-r--r-- | engines/dm/gfx.h | 3 |
2 files changed, 27 insertions, 3 deletions
diff --git a/engines/dm/gfx.cpp b/engines/dm/gfx.cpp index cc9d971177..5a81151f64 100644 --- a/engines/dm/gfx.cpp +++ b/engines/dm/gfx.cpp @@ -1052,6 +1052,7 @@ void DisplayMan::drawSquareD1C(direction dir, int16 posX, int16 posY) { break; } } + void DisplayMan::drawSquareD0L(direction dir, int16 posX, int16 posY) { uint16 squareAspect[5]; _vm->_dungeonMan->setSquareAspect(squareAspect, dir, posX, posY); @@ -1434,6 +1435,7 @@ bool DisplayMan::isDrawnWallOrnAnAlcove(int16 wallOrnOrd, ViewWall viewWallIndex bitmapGreen = _bitmaps[nativeBitmapIndex]; if (viewWallIndex == kViewWall_D1R_LEFT) { blitToBitmap(bitmapGreen, coordinateSetA[4], coordinateSetA[5], _tmpBitmap, coordinateSetA[4]); + flipBitmapHorizontal(_tmpBitmap, coordinateSetA[4], coordinateSetA[5]); bitmapGreen = _tmpBitmap; } var_X = 0; @@ -1455,11 +1457,14 @@ bool DisplayMan::isDrawnWallOrnAnAlcove(int16 wallOrnOrd, ViewWall viewWallIndex } } int16 pixelWidth = (coordinateSetA + coordinateSetOffset)[1] - (coordinateSetA + coordinateSetOffset)[0]; - // TODO: I skipped some bitmap shrinking code here + blitToBitmapShrinkWithPalChange(_bitmaps[nativeBitmapIndex], coordSetB[4] << 1, coordSetB[5], _tmpBitmap, pixelWidth + 1, coordinateSetA[5], + (viewWallIndex <= kViewWall_D3R_FRONT) ? gPalChangesDoorButtonAndWallOrn_D3 : gPalChangesDoorButtonAndWallOrn_D2); bitmapGreen = _bitmaps[nativeBitmapIndex]; var_X = pixelWidth; if (flipHorizontal) { - blitToBitmap(bitmapGreen, coordSetB[4], coordSetB[5], _tmpBitmap, coordSetB[4]); + if(bitmapGreen != _tmpBitmap) + blitToBitmap(bitmapGreen, coordSetB[4], coordSetB[5], _tmpBitmap, coordSetB[4]); + flipBitmapHorizontal(_tmpBitmap, coordSetB[4], coordSetB[5]); bitmapGreen = _tmpBitmap; var_X = 15 - (var_X & 0xF); } else if (viewWallIndex == kViewWall_D2L_FRONT) { @@ -1495,10 +1500,26 @@ bool DisplayMan::isDrawnWallOrnAnAlcove(int16 wallOrnOrd, ViewWall viewWallIndex if ((viewWallIndex == kViewWall_D1C_FRONT) && _championPortraitOrdinal--) { Box &box = gBoxChampionPortraitOnWall; - blitToScreen(_bitmaps[kChampionPortraitsIndice], 256, (_championPortraitOrdinal & 0x7) << 5, _championPortraitOrdinal, box.X1, box.X2, box.Y1, box.Y2, + blitToScreen(_bitmaps[kChampionPortraitsIndice], 256, (_championPortraitOrdinal & 0x7) << 5, (_championPortraitOrdinal >> 3) * 29, box.X1, box.X2, box.Y1, box.Y2, kColorDarkGary, gDungeonViewport); } return isAlcove; } return false; } + + +void DisplayMan::blitToBitmapShrinkWithPalChange(byte *srcBitmap, int16 srcWidth, int16 srcHeight, byte *destBitmap, int16 destWidth, int16 destHeight, byte *palChange) { + double rateW = srcWidth / destWidth; + double rateH = srcHeight / destHeight; + + for (uint16 y = 0; y < destHeight; ++y) { + for (uint16 x = 0; x < destWidth; ++x) { + if (palChange) + destBitmap[y * destWidth + x] = palChange[srcBitmap[(int)(y * rateH * srcWidth) + (int)(x * rateW)]]; + else + destBitmap[y * destWidth + x] = srcBitmap[(int)(y * rateH * srcWidth) + (int)(x * rateW)]; + } + } + +} diff --git a/engines/dm/gfx.h b/engines/dm/gfx.h index 14cb6ebc94..d8f4e29247 100644 --- a/engines/dm/gfx.h +++ b/engines/dm/gfx.h @@ -206,6 +206,9 @@ public: byte *destBitmap, uint16 destWidth, uint16 destFromX, uint16 destToX, uint16 destFromY, uint16 destToY, Color transparent = kColorNoTransparency, Viewport &viewport = gDefultViewPort); + void blitToBitmapShrinkWithPalChange(byte *srcBitmap, int16 srcWidth, int16 srcHight, + byte *destBitmap, int16 destWidth, int16 destHeight, byte *palChange); // @ F0129_VIDEO_BlitShrinkWithPaletteChanges + 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, |