diff options
author | Eugene Sandulenko | 2013-09-04 22:40:00 +0300 |
---|---|---|
committer | Eugene Sandulenko | 2013-09-06 14:51:25 +0300 |
commit | f61b77e07e032b8ec672eb4daabe625b59d9292f (patch) | |
tree | a5fd421af569c827fa5f35ef7413b802bd864d16 | |
parent | 8ea65ec40f5ab3422a415be8c1e08185ea60ed05 (diff) | |
download | scummvm-rg350-f61b77e07e032b8ec672eb4daabe625b59d9292f.tar.gz scummvm-rg350-f61b77e07e032b8ec672eb4daabe625b59d9292f.tar.bz2 scummvm-rg350-f61b77e07e032b8ec672eb4daabe625b59d9292f.zip |
FULLPIPE: Implement Bitmap::isPixelHitAtPos()
-rw-r--r-- | engines/fullpipe/gfx.cpp | 64 | ||||
-rw-r--r-- | engines/fullpipe/gfx.h | 4 |
2 files changed, 41 insertions, 27 deletions
diff --git a/engines/fullpipe/gfx.cpp b/engines/fullpipe/gfx.cpp index 629e8e5b0e..a38203375b 100644 --- a/engines/fullpipe/gfx.cpp +++ b/engines/fullpipe/gfx.cpp @@ -663,23 +663,23 @@ bool Bitmap::isPixelHitAtPos(int x, int y) { return false; break; case 'RB\0\0': - { - Bitmap bmp; - - if (decompressRle2(&bmp)) - return bmp._pixels[off] != bmp._flags; - - return false; - } + return isPixelAtHitPosRB(x, y); } } return true; } -bool Bitmap::decompressRle2(Bitmap *res) { - warning("STUB: Bitmap::decompressRle2()"); +bool Bitmap::isPixelAtHitPosRB(int x, int y) { + int ox = _x; + int oy = _y; - return false; + _x = _y = 0; + + bool res = putDibRB(0, x, y); + _x = ox; + _y = oy; + + return res; } void Bitmap::putDib(int x, int y, int32 *palette) { @@ -694,7 +694,7 @@ void Bitmap::putDib(int x, int y, int32 *palette) { putDibCB(palette); } -void Bitmap::putDibRB(int32 *palette) { +bool Bitmap::putDibRB(int32 *palette, int pX, int pY) { uint16 *curDestPtr; int endy; int x; @@ -706,7 +706,7 @@ void Bitmap::putDibRB(int32 *palette) { uint16 *srcPtr2; uint16 *srcPtr; - if (!palette) + if (!palette && pX == -1) error("Bitmap::putDibRB(): Both global and local palettes are empty"); debug(8, "Bitmap::putDibRB()"); @@ -715,13 +715,15 @@ void Bitmap::putDibRB(int32 *palette) { endy = _height + _y - 1; if (_x > 799 || endx < 0 || _y > 599 || endy < 0) - return; + return false; - if (endy > 599) - endy = 599; + if (pX == -1) { + if (endy > 599) + endy = 599; - if (endx > 799) - endx = 799; + if (endx > 799) + endx = 799; + } int startx = _x; if (startx < 0) @@ -773,10 +775,14 @@ void Bitmap::putDibRB(int32 *palette) { if (fillLen > 0 || start1 >= 0) { if (x <= 799 + 1 || (fillLen += 799 - x + 1, fillLen > 0)) { if (y <= endy) { - curDestPtr = (uint16 *)g_fullpipe->_backgroundSurface.getBasePtr(start1, y); - - int bgcolor = palette[(pixel >> 8) & 0xff]; - colorFill(curDestPtr, fillLen, bgcolor); + if (pX == -1) { + int bgcolor = palette[(pixel >> 8) & 0xff]; + curDestPtr = (uint16 *)g_fullpipe->_backgroundSurface.getBasePtr(start1, y); + colorFill(curDestPtr, fillLen, bgcolor); + } else { + if (y == pY && pX >= start1 && pX < start1 + fillLen) + return true; + } } } } @@ -801,14 +807,22 @@ void Bitmap::putDibRB(int32 *palette) { } if (y <= endy) { - curDestPtr = (uint16 *)g_fullpipe->_backgroundSurface.getBasePtr(start1, y); - paletteFill(curDestPtr, (byte *)srcPtr2, fillLen, (int32 *)palette); + if (pX == -1) { + curDestPtr = (uint16 *)g_fullpipe->_backgroundSurface.getBasePtr(start1, y); + paletteFill(curDestPtr, (byte *)srcPtr2, fillLen, (int32 *)palette); + } else { + if (y == pY && pX >= start1 && pX < start1 + fillLen) + return true; + } } } } } - g_fullpipe->_system->copyRectToScreen(g_fullpipe->_backgroundSurface.getBasePtr(startx, starty), g_fullpipe->_backgroundSurface.pitch, startx, starty, endx + 1 - startx, endy + 1 - starty); + if (pX == -1) + g_fullpipe->_system->copyRectToScreen(g_fullpipe->_backgroundSurface.getBasePtr(startx, starty), g_fullpipe->_backgroundSurface.pitch, startx, starty, endx + 1 - startx, endy + 1 - starty); + + return false; } void Bitmap::putDibCB(int32 *palette) { diff --git a/engines/fullpipe/gfx.h b/engines/fullpipe/gfx.h index ccfc72f96f..f4b13d6fbf 100644 --- a/engines/fullpipe/gfx.h +++ b/engines/fullpipe/gfx.h @@ -45,7 +45,7 @@ struct Bitmap { void load(Common::ReadStream *s); void putDib(int x, int y, int32 *palette); - void putDibRB(int32 *palette); + bool putDibRB(int32 *palette, int x = -1, int y = -1); void putDibCB(int32 *palette); void colorFill(uint16 *dest, int len, int color); @@ -63,7 +63,7 @@ struct Bitmap { void drawRotated(int x, int y, int angle, byte *palette); bool isPixelHitAtPos(int x, int y); - bool decompressRle2(Bitmap *res); + bool isPixelAtHitPosRB(int x, int y); }; class Picture : public MemoryObject { |