aboutsummaryrefslogtreecommitdiff
path: root/engines/titanic/support/video_surface.cpp
diff options
context:
space:
mode:
authorPaul Gilbert2016-04-27 23:02:00 -0400
committerPaul Gilbert2016-07-10 16:12:13 -0400
commit001a2ac15e5c8722ba283e7380d6dc9ce11e51b0 (patch)
treed324ea04f06325d689120f45e877eba34e626ca9 /engines/titanic/support/video_surface.cpp
parente4b231b39dfb0247afa61ac8afb40be863b9f08c (diff)
downloadscummvm-rg350-001a2ac15e5c8722ba283e7380d6dc9ce11e51b0.tar.gz
scummvm-rg350-001a2ac15e5c8722ba283e7380d6dc9ce11e51b0.tar.bz2
scummvm-rg350-001a2ac15e5c8722ba283e7380d6dc9ce11e51b0.zip
TITANIC: Implement surface changePixel method
Diffstat (limited to 'engines/titanic/support/video_surface.cpp')
-rw-r--r--engines/titanic/support/video_surface.cpp24
1 files changed, 22 insertions, 2 deletions
diff --git a/engines/titanic/support/video_surface.cpp b/engines/titanic/support/video_surface.cpp
index 089b216347..fe694786e4 100644
--- a/engines/titanic/support/video_surface.cpp
+++ b/engines/titanic/support/video_surface.cpp
@@ -164,6 +164,8 @@ bool CVideoSurface::proc45() {
/*------------------------------------------------------------------------*/
+byte OSVideoSurface::_map[0x400];
+
OSVideoSurface::OSVideoSurface(CScreenManager *screenManager, DirectDrawSurface *surface) :
CVideoSurface(screenManager) {
_ddSurface = surface;
@@ -367,8 +369,26 @@ uint16 OSVideoSurface::getPixel(const Common::Point &pt) {
}
}
-void OSVideoSurface::changePixel(uint16 *pixelP, uint16 color, int val3, int val5) {
- // TODO
+void OSVideoSurface::changePixel(uint16 *pixelP, uint16 *color, byte srcVal, bool remapFlag) {
+ assert(getPixelDepth() == 2);
+ const Graphics::PixelFormat &format = _ddSurface->getFormat();
+
+ // Get the color
+ byte r, g, b;
+ format.colorToRGB(*color, r, g, b);
+ if (remapFlag) {
+ r = _map[0x3e0 - srcVal * 32 + (r >> 2)] << 2;
+ g = _map[0x3e0 - srcVal * 32 + (g >> 2)] << 2;
+ b = _map[0x3e0 - srcVal * 32 + (b >> 2)] << 2;
+ }
+
+ byte r2, g2, b2;
+ format.colorToRGB(*pixelP, r2, g2, b2);
+ r2 = _map[srcVal * 32 + (r2 >> 2)] << 2;
+ g2 = _map[srcVal * 32 + (g2 >> 2)] << 2;
+ b2 = _map[srcVal * 32 + (b2 >> 2)] << 2;
+
+ *pixelP = format.RGBToColor(r + r2, g + g2, b + b2);
}
void OSVideoSurface::shiftColors() {