aboutsummaryrefslogtreecommitdiff
path: root/engines/sherlock/surface.cpp
diff options
context:
space:
mode:
authorMartin Kiewitz2015-06-07 17:05:26 +0200
committerMartin Kiewitz2015-06-07 17:05:26 +0200
commit4c9e67ccfa709a74f2c78580f42bb642b258cd22 (patch)
tree947fff50218ab4ab35caf4a6f2624349b241babd /engines/sherlock/surface.cpp
parentef06a86ac87d71bcc1248c29682888dc8e8012d4 (diff)
downloadscummvm-rg350-4c9e67ccfa709a74f2c78580f42bb642b258cd22.tar.gz
scummvm-rg350-4c9e67ccfa709a74f2c78580f42bb642b258cd22.tar.bz2
scummvm-rg350-4c9e67ccfa709a74f2c78580f42bb642b258cd22.zip
SHERLOCK: 3DO animation support
Diffstat (limited to 'engines/sherlock/surface.cpp')
-rw-r--r--engines/sherlock/surface.cpp40
1 files changed, 36 insertions, 4 deletions
diff --git a/engines/sherlock/surface.cpp b/engines/sherlock/surface.cpp
index 006b31ecda..3bbaf4677e 100644
--- a/engines/sherlock/surface.cpp
+++ b/engines/sherlock/surface.cpp
@@ -30,8 +30,8 @@ namespace Sherlock {
const int TRANSPARENCY = 0xFF;
-Surface::Surface(uint16 width, uint16 height) : _freePixels(true) {
- create(width, height);
+Surface::Surface(uint16 width, uint16 height, Common::Platform platform) : _freePixels(true) {
+ create(width, height, platform);
}
Surface::Surface() : _freePixels(false) {
@@ -42,11 +42,15 @@ Surface::~Surface() {
_surface.free();
}
-void Surface::create(uint16 width, uint16 height) {
+void Surface::create(uint16 width, uint16 height, Common::Platform platform) {
if (_freePixels)
_surface.free();
- _surface.create(width, height, Graphics::PixelFormat::createFormatCLUT8());
+ if (platform == Common::kPlatform3DO) {
+ _surface.create(width, height, Graphics::PixelFormat(2, 5, 6, 5, 0, 11, 5, 0, 0));
+ } else {
+ _surface.create(width, height, Graphics::PixelFormat::createFormatCLUT8());
+ }
_freePixels = true;
}
@@ -185,6 +189,34 @@ void Surface::transBlitFromUnscaled(const Graphics::Surface &src, const Common::
}
}
+// TODO: Needs to get implemented properly
+void Surface::transBlitFromUnscaled3DO(const Graphics::Surface &src, const Common::Point &pt) {
+ Common::Rect drawRect(0, 0, src.w, src.h);
+ Common::Rect destRect(pt.x, pt.y, pt.x + src.w, pt.y + src.h);
+
+ // Clip the display area to on-screen
+ if (!clip(drawRect, destRect))
+ // It's completely off-screen
+ return;
+
+ Common::Point destPt(destRect.left, destRect.top);
+ addDirtyRect(Common::Rect(destPt.x, destPt.y, destPt.x + drawRect.width(),
+ destPt.y + drawRect.height()));
+
+ // Draw loop
+ for (int yp = 0; yp < drawRect.height(); ++yp) {
+ const uint16 *srcP = (const uint16 *)src.getBasePtr(drawRect.left, drawRect.top + yp);
+ uint16 *destP = (uint16 *)getBasePtr(destPt.x, destPt.y + yp);
+
+ for (int xp = 0; xp < drawRect.width(); ++xp, ++destP) {
+ if (*srcP) // 0 = transparent on 3DO
+ *destP = *srcP;
+
+ srcP = srcP + 1;
+ }
+ }
+}
+
void Surface::fillRect(int x1, int y1, int x2, int y2, byte color) {
fillRect(Common::Rect(x1, y1, x2, y2), color);
}