aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorjohndoe1232011-06-26 18:08:18 +0000
committerWillem Jan Palenstijn2013-05-08 20:30:57 +0200
commita262055df25b0b00fcb0fe9e7919153f5089d615 (patch)
treedbc440172176f7595a76e107afa9aa0ca848f5d2 /engines
parent7d5d5f139f5d2ac747f1440171f4cc42735541a7 (diff)
downloadscummvm-rg350-a262055df25b0b00fcb0fe9e7919153f5089d615.tar.gz
scummvm-rg350-a262055df25b0b00fcb0fe9e7919153f5089d615.tar.bz2
scummvm-rg350-a262055df25b0b00fcb0fe9e7919153f5089d615.zip
NEVERHOOD: Start with the BaseSurface class (doesn't do much yet)
Diffstat (limited to 'engines')
-rw-r--r--engines/neverhood/graphics.cpp33
-rw-r--r--engines/neverhood/graphics.h31
2 files changed, 64 insertions, 0 deletions
diff --git a/engines/neverhood/graphics.cpp b/engines/neverhood/graphics.cpp
index 8f8849be41..fb8ec4ad72 100644
--- a/engines/neverhood/graphics.cpp
+++ b/engines/neverhood/graphics.cpp
@@ -24,6 +24,39 @@
namespace Neverhood {
+BaseSurface::BaseSurface(NeverhoodEngine *vm, int priority, int16 width, int16 height)
+ : _vm(vm), _priority(priority), _visible(true) {
+
+ _drawRect.x = 0;
+ _drawRect.y = 0;
+ _drawRect.width = width;
+ _drawRect.height = height;
+ _sysRect.x = 0;
+ _sysRect.y = 0;
+ _sysRect.width = (width + 3) & 0xFFFC; // align by 4 bytes
+ _sysRect.height = height;
+ _clipRect.x1 = 0;
+ _clipRect.y1 = 0;
+ _clipRect.x2 = 640;
+ _clipRect.y2 = 480;
+ _surface = new Graphics::Surface();
+ _surface->create(width, height, Graphics::PixelFormat::createFormatCLUT8());
+}
+
+BaseSurface::~BaseSurface() {
+ delete _surface;
+}
+
+void BaseSurface::draw() {
+ // TODO
+}
+
+void BaseSurface::addDirtyRect() {
+ // TODO
+}
+
+// Misc
+
void parseBitmapResource(byte *sprite, bool *rle, NDimensions *dimensions, NUnknown *unknown, byte **palette, byte **pixels) {
uint16 flags;
diff --git a/engines/neverhood/graphics.h b/engines/neverhood/graphics.h
index 8cac5a5af0..bc592870d3 100644
--- a/engines/neverhood/graphics.h
+++ b/engines/neverhood/graphics.h
@@ -25,6 +25,7 @@
#include "common/array.h"
#include "common/file.h"
+#include "graphics/surface.h"
#include "neverhood/neverhood.h"
namespace Neverhood {
@@ -37,6 +38,36 @@ struct NUnknown {
int16 unk1, unk2;
};
+struct NRect {
+ int16 x1, y1, x2, y2;
+ NRect() : x1(0), y1(0), x2(0), y2(0) {}
+};
+
+struct NDrawRect {
+ int16 x, y, width, height;
+ NDrawRect() : x(0), y(0), width(0), height(0) {}
+};
+
+// NOTE: "Restore" methods aren't need in the reimplementation as they're DirectDraw-specific
+
+class BaseSurface {
+public:
+ BaseSurface(NeverhoodEngine *vm, int priority, int16 width, int16 height);
+ virtual ~BaseSurface();
+ virtual void draw();
+ virtual void addDirtyRect();
+protected:
+ NeverhoodEngine *_vm;
+ int _priority;
+ bool _visible;
+ Graphics::Surface *_surface;
+ NDrawRect _drawRect;
+ NDrawRect _sysRect;
+ NRect _clipRect;
+};
+
+// Misc
+
void parseBitmapResource(byte *sprite, bool *rle, NDimensions *dimensions, NUnknown *unknown, byte **palette, byte **pixels);
void unpackSpriteRle(byte *source, int width, int height, byte *dest, int destPitch, bool flipX, bool flipY);