aboutsummaryrefslogtreecommitdiff
path: root/engines/titanic/support
diff options
context:
space:
mode:
authorPaul Gilbert2016-04-04 18:15:02 -0400
committerPaul Gilbert2016-04-04 18:15:02 -0400
commit572301a33efc8c574d7ab2fc9b243050b2db1492 (patch)
tree80cc09df4c279b2b556a8799091711d0a6c8b1fb /engines/titanic/support
parent3acf1116cd7eff2f98538f8457f724ac25b28df1 (diff)
downloadscummvm-rg350-572301a33efc8c574d7ab2fc9b243050b2db1492.tar.gz
scummvm-rg350-572301a33efc8c574d7ab2fc9b243050b2db1492.tar.bz2
scummvm-rg350-572301a33efc8c574d7ab2fc9b243050b2db1492.zip
TITANIC: Implement OSVideoSurface::setupMap
Diffstat (limited to 'engines/titanic/support')
-rw-r--r--engines/titanic/support/video_surface.cpp32
-rw-r--r--engines/titanic/support/video_surface.h22
2 files changed, 54 insertions, 0 deletions
diff --git a/engines/titanic/support/video_surface.cpp b/engines/titanic/support/video_surface.cpp
index ebe552a062..a1b26386b3 100644
--- a/engines/titanic/support/video_surface.cpp
+++ b/engines/titanic/support/video_surface.cpp
@@ -182,6 +182,34 @@ OSVideoSurface::OSVideoSurface(CScreenManager *screenManager, const CResourceKey
}
}
+void OSVideoSurface::setupMap(byte map[0x400], byte val) {
+ byte *pBase = map;
+ int incr = 0;
+
+ for (uint idx1 = 0; idx1 < 32; ++idx1, pBase += 32) {
+ for (uint idx2 = 0, base = 0; idx2 < 32; ++idx2, base += incr) {
+ int64 v = 0x84210843;
+ v *= base;
+ v = ((v >> 32) + base) >> 4;
+ v += (v >> 31);
+ pBase[idx2] = v;
+
+ if (val != 0xff) {
+ v &= 0xff;
+ if (v != idx2) {
+ v = 0x80808081 * val * v * val;
+ v = (v >> 32) + incr;
+ incr = idx1;
+
+ v >>= 7;
+ v += (v >> 31);
+ pBase[idx2] = v;
+ }
+ }
+ }
+ }
+}
+
void OSVideoSurface::loadResource(const CResourceKey &key) {
_resourceKey = key;
_pendingLoad = true;
@@ -323,6 +351,10 @@ uint16 OSVideoSurface::getPixel(const Common::Point &pt) {
}
}
+void OSVideoSurface::changePixel(uint16 *pixelP, uint16 color, int val3, int val5) {
+ // TODO
+}
+
void OSVideoSurface::shiftColors() {
if (!loadIfReady())
return;
diff --git a/engines/titanic/support/video_surface.h b/engines/titanic/support/video_surface.h
index da53270122..e1ddde8013 100644
--- a/engines/titanic/support/video_surface.h
+++ b/engines/titanic/support/video_surface.h
@@ -143,6 +143,11 @@ public:
virtual uint16 getPixel(const Common::Point &pt) = 0;
/**
+ * Change a pixel
+ */
+ virtual void changePixel(uint16 *pixelP, uint16 color, int val3, int val5) = 0;
+
+ /**
* Shifts the colors of the surface.. maybe greys it out?
*/
virtual void shiftColors() = 0;
@@ -202,6 +207,18 @@ public:
};
class OSVideoSurface : public CVideoSurface {
+private:
+ static byte _map[0x400];
+
+ /**
+ * Setup the color mapping table
+ */
+ static void setupMap(byte map[0x400], byte val);
+public:
+ /**
+ * Setup statics
+ */
+ static void setup() { setupMap(_map, 0xff); }
public:
OSVideoSurface(CScreenManager *screenManager, DirectDrawSurface *surface);
OSVideoSurface(CScreenManager *screenManager, const CResourceKey &key, bool flag = false);
@@ -272,6 +289,11 @@ public:
virtual uint16 getPixel(const Common::Point &pt);
/**
+ * Change a pixel
+ */
+ virtual void changePixel(uint16 *pixelP, uint16 color, int val3, int val5);
+
+ /**
* Shifts the colors of the surface.. maybe greys it out?
*/
virtual void shiftColors();