aboutsummaryrefslogtreecommitdiff
path: root/engines/xeen
diff options
context:
space:
mode:
Diffstat (limited to 'engines/xeen')
-rw-r--r--engines/xeen/sprites.cpp15
-rw-r--r--engines/xeen/sprites.h29
2 files changed, 34 insertions, 10 deletions
diff --git a/engines/xeen/sprites.cpp b/engines/xeen/sprites.cpp
index fed8b6a410..fc2159bca9 100644
--- a/engines/xeen/sprites.cpp
+++ b/engines/xeen/sprites.cpp
@@ -137,6 +137,8 @@ void SpriteResource::draw(XSurface &dest, int frame, const Common::Point &destPo
case SPRFLAG_DRAWER1:
draw = new SpriteDrawer1(_data, _filesize, flags & 0x1F);
break;
+ case SPRFLAG_DRAWER2:
+ error("TODO: Sprite drawer mode 2");
case SPRFLAG_DRAWER3:
draw = new SpriteDrawer3(_data, _filesize, flags & 0x1F);
break;
@@ -460,6 +462,19 @@ void SpriteDrawer3::drawPixel(byte *dest, byte pixel) {
/*------------------------------------------------------------------------*/
+const byte DRAWER4_THRESHOLD[4] = { 4, 7, 10, 13 };
+
+SpriteDrawer4::SpriteDrawer4(byte *data, size_t filesize, int index) : SpriteDrawer(data, filesize) {
+ _threshold = DRAWER4_THRESHOLD[index];
+}
+
+void SpriteDrawer4::drawPixel(byte *dest, byte pixel) {
+ if ((pixel & 0xf) >= _threshold)
+ *dest = pixel;
+}
+
+/*------------------------------------------------------------------------*/
+
const uint16 DRAWER5_MASK[4] = { 0x3333, 0x6666, 0x999A, 0xCCCD };
SpriteDrawer5::SpriteDrawer5(byte *data, size_t filesize, int index) : SpriteDrawer(data, filesize) {
diff --git a/engines/xeen/sprites.h b/engines/xeen/sprites.h
index beb310e193..e8d83e1054 100644
--- a/engines/xeen/sprites.h
+++ b/engines/xeen/sprites.h
@@ -40,10 +40,10 @@ enum {
};
enum SpriteFlags {
- SPRFLAG_MODE_MASK = 0xF00, SPRFLAG_DRAWER1 = 0x100, SPRFLAG_DRAWER3 = 0X300,
- SPRFLAG_DRAWER5 = 0x500, SPRFLAG_DRAWER6 = 0x600, SPRFLAG_800 = 0x800,
- SPRFLAG_SCENE_CLIPPED = 0x2000, SPRFLAG_BOTTOM_CLIPPED = 0x4000,
- SPRFLAG_HORIZ_FLIPPED = 0x8000, SPRFLAG_RESIZE = 0x10000
+ SPRFLAG_MODE_MASK = 0xF00, SPRFLAG_DRAWER1 = 0x100, SPRFLAG_DRAWER2 = 0x200,
+ SPRFLAG_DRAWER3 = 0x300, SPRFLAG_DRAWER4 = 0x400, SPRFLAG_DRAWER5 = 0x500, SPRFLAG_DRAWER6 = 0x600,
+ SPRFLAG_DRAWER7 = 0x700, SPRFLAG_800 = 0x800, SPRFLAG_SCENE_CLIPPED = 0x2000,
+ SPRFLAG_BOTTOM_CLIPPED = 0x4000, SPRFLAG_HORIZ_FLIPPED = 0x8000, SPRFLAG_RESIZE = 0x10000
};
class SpriteResource {
@@ -203,9 +203,6 @@ public:
const Common::Rect &clipRect, uint flags, int scale);
};
-/**
- * Handles drawing a sprite as masked/offset
- */
class SpriteDrawer1 : public SpriteDrawer {
private:
byte _offset, _mask;
@@ -236,6 +233,21 @@ public:
SpriteDrawer3(byte *data, size_t filesize, int index);
};
+class SpriteDrawer4 : public SpriteDrawer {
+private:
+ byte _threshold;
+protected:
+ /**
+ * Output a pixel
+ */
+ virtual void drawPixel(byte *dest, byte pixel) override;
+public:
+ /**
+ * Constructor
+ */
+ SpriteDrawer4(byte *data, size_t filesize, int index);
+};
+
class SpriteDrawer5 : public SpriteDrawer {
private:
uint16 _mask, _random1, _random2;
@@ -256,9 +268,6 @@ public:
SpriteDrawer5(byte *data, size_t filesize, int index);
};
-/**
- * Handles drawing a sprite as a solid color
- */
class SpriteDrawer6 : public SpriteDrawer {
private:
byte _color;