diff options
author | Heather Douglass | 2011-10-08 20:43:54 -0700 |
---|---|---|
committer | Filippos Karapetis | 2011-10-12 02:50:28 +0300 |
commit | 084b2deccc7eeb64f2936dbb6cd0fb47319e5db2 (patch) | |
tree | 2e8db8ba7856bc9d7a8333a21c592b3bc88d788b /engines/sci/graphics | |
parent | c5e6cdea551f34fd78ab23411d76724959d597a8 (diff) | |
download | scummvm-rg350-084b2deccc7eeb64f2936dbb6cd0fb47319e5db2.tar.gz scummvm-rg350-084b2deccc7eeb64f2936dbb6cd0fb47319e5db2.tar.bz2 scummvm-rg350-084b2deccc7eeb64f2936dbb6cd0fb47319e5db2.zip |
SCI: Implementation of kCelInfo subop 4
kCelInfo subop 4 returns the pixel color at the
passed in x,y coordinates for the passed in view,
loop, cel. Shivers uses this function for the
red door puzzle, room 23601 to determine what
blocks on the puzzle board are already occupied
by pieces.
Diffstat (limited to 'engines/sci/graphics')
-rw-r--r-- | engines/sci/graphics/cache.cpp | 4 | ||||
-rw-r--r-- | engines/sci/graphics/cache.h | 2 | ||||
-rw-r--r-- | engines/sci/graphics/view.cpp | 9 | ||||
-rw-r--r-- | engines/sci/graphics/view.h | 2 |
4 files changed, 17 insertions, 0 deletions
diff --git a/engines/sci/graphics/cache.cpp b/engines/sci/graphics/cache.cpp index d2bd76ac99..55f8624c49 100644 --- a/engines/sci/graphics/cache.cpp +++ b/engines/sci/graphics/cache.cpp @@ -102,4 +102,8 @@ int16 GfxCache::kernelViewGetCelCount(GuiResourceId viewId, int16 loopNo) { return getView(viewId)->getCelCount(loopNo); } +byte GfxCache::kernelViewGetColorAtCoordinate(GuiResourceId viewId, int16 loopNo, int16 celNo, int16 x, int16 y) { + return getView(viewId)->getColorAtCoordinate(loopNo, celNo, x, y); +} + } // End of namespace Sci diff --git a/engines/sci/graphics/cache.h b/engines/sci/graphics/cache.h index c090cda7d7..2f462fe042 100644 --- a/engines/sci/graphics/cache.h +++ b/engines/sci/graphics/cache.h @@ -49,6 +49,8 @@ public: int16 kernelViewGetLoopCount(GuiResourceId viewId); int16 kernelViewGetCelCount(GuiResourceId viewId, int16 loopNo); + byte kernelViewGetColorAtCoordinate(GuiResourceId viewId, int16 loopNo, int16 celNo, int16 x, int16 y); + private: void purgeFontCache(); void purgeViewCache(); diff --git a/engines/sci/graphics/view.cpp b/engines/sci/graphics/view.cpp index a0d5b51a2b..d5c52bfb59 100644 --- a/engines/sci/graphics/view.cpp +++ b/engines/sci/graphics/view.cpp @@ -837,4 +837,13 @@ void GfxView::adjustBackUpscaledCoordinates(int16 &y, int16 &x) { _screen->adjustBackUpscaledCoordinates(y, x, _sci2ScaleRes); } +byte GfxView::getColorAtCoordinate(int16 loopNo, int16 celNo, int16 x, int16 y) { + const CelInfo *celInfo = getCelInfo(loopNo, celNo); + const byte *bitmap = getBitmap(loopNo, celNo); + const int16 celWidth = celInfo->width; + + bitmap += (celWidth * y); + return bitmap[x]; +} + } // End of namespace Sci diff --git a/engines/sci/graphics/view.h b/engines/sci/graphics/view.h index 19ef2e62f8..d3473f1024 100644 --- a/engines/sci/graphics/view.h +++ b/engines/sci/graphics/view.h @@ -85,6 +85,8 @@ public: void adjustToUpscaledCoordinates(int16 &y, int16 &x); void adjustBackUpscaledCoordinates(int16 &y, int16 &x); + byte getColorAtCoordinate(int16 loopNo, int16 celNo, int16 x, int16 y); + private: void initData(GuiResourceId resourceId); void unpackCel(int16 loopNo, int16 celNo, byte *outPtr, uint32 pixelCount); |