aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorEugene Sandulenko2013-07-11 08:09:11 +0300
committerEugene Sandulenko2013-09-06 14:48:17 +0300
commitf18e318f788d126b6c39232afaf0012ef401d55d (patch)
tree0ded7bb7305ca6bb2147bc46fd81574dbf39a596 /engines
parentc2103bb9cd4b8b2958ea99c7797df2cd4f0905d5 (diff)
downloadscummvm-rg350-f18e318f788d126b6c39232afaf0012ef401d55d.tar.gz
scummvm-rg350-f18e318f788d126b6c39232afaf0012ef401d55d.tar.bz2
scummvm-rg350-f18e318f788d126b6c39232afaf0012ef401d55d.zip
FULLPIPE: Bitmap loading
Diffstat (limited to 'engines')
-rw-r--r--engines/fullpipe/gfx.cpp37
-rw-r--r--engines/fullpipe/gfx.h19
-rw-r--r--engines/fullpipe/utils.cpp18
-rw-r--r--engines/fullpipe/utils.h4
4 files changed, 73 insertions, 5 deletions
diff --git a/engines/fullpipe/gfx.cpp b/engines/fullpipe/gfx.cpp
index 15a3defa59..b06968e77f 100644
--- a/engines/fullpipe/gfx.cpp
+++ b/engines/fullpipe/gfx.cpp
@@ -24,8 +24,24 @@
#include "fullpipe/objects.h"
+#include "common/memstream.h"
+
namespace Fullpipe {
+void Bitmap::load(Common::ReadStream *s) {
+ x = s->readUint32LE();
+ y = s->readUint32LE();
+ width = s->readUint32LE();
+ height = s->readUint32LE();
+ s->readUint32LE(); // pixels
+ type = s->readUint32LE();
+ field_18 = s->readUint32LE();
+ flags = s->readUint32LE();
+
+ debug(9, "x: %d y: %d w: %d h: %d", x, y, width, height);
+ debug(9, "type: %d field_18: %d flags: 0x%x", type, field_18, flags);
+}
+
Background::Background() {
_x = 0;
_y = 0;
@@ -227,6 +243,27 @@ void Picture::setAOIDs() {
warning("STUB: Picture::setAOIDs()");
}
+void Picture::init() {
+ _bitmap = new Bitmap();
+
+ getDibInfo();
+
+ _bitmap->flags |= 0x1000000;
+}
+
+void Picture::getDibInfo() {
+ int off = _dataSize & ~0xf;
+
+ if (_dataSize != off) {
+ warning("Uneven data size: 0x%x", _dataSize);
+ }
+
+ Common::MemoryReadStream *s = new Common::MemoryReadStream(_data + off, 32);
+
+ _bitmap->load(s);
+ _bitmap->pixels = _data;
+}
+
BigPicture::BigPicture() {
}
diff --git a/engines/fullpipe/gfx.h b/engines/fullpipe/gfx.h
index 6e1a3a1494..f03cc72ff9 100644
--- a/engines/fullpipe/gfx.h
+++ b/engines/fullpipe/gfx.h
@@ -23,12 +23,27 @@
#ifndef FULLPIPE_GFX_H
#define FULLPIPE_GFX_H
+class Common::ReadStream;
+
namespace Fullpipe {
class ShadowsItemArray : public CObArray {
// empty
};
+struct Bitmap {
+ int x;
+ int y;
+ int width;
+ int height;
+ byte *pixels;
+ int type;
+ int field_18;
+ int flags;
+
+ void load(Common::ReadStream *s);
+};
+
class Picture : public MemoryObject {
friend class Movement;
@@ -39,7 +54,7 @@ class Picture : public MemoryObject {
int _field_44;
int _width;
int _height;
- int _bitmap;
+ Bitmap *_bitmap;
int _field_54;
MemoryObject2 *_memoryObject2;
int _alpha;
@@ -49,6 +64,8 @@ class Picture : public MemoryObject {
Picture();
virtual bool load(MfcArchive &file);
void setAOIDs();
+ void init();
+ void getDibInfo();
};
class BigPicture : public Picture {
diff --git a/engines/fullpipe/utils.cpp b/engines/fullpipe/utils.cpp
index 88a21a08fe..be1bcd38a6 100644
--- a/engines/fullpipe/utils.cpp
+++ b/engines/fullpipe/utils.cpp
@@ -134,15 +134,27 @@ void MemoryObject::loadFile(char *filename) {
if (s) {
assert(s->size() > 0);
- debug(0, "Loading %s", filename);
- _data = calloc(s->size(), 1);
- s->read(_data, s->size());
+ _dataSize = s->size();
+
+ debug(0, "Loading %s (%d bytes)", filename, _dataSize);
+ _data = (byte *)calloc(_dataSize, 1);
+ s->read(_data, _dataSize);
delete s;
}
}
}
+void *MemoryObject::getData() {
+ load();
+
+ if (_field_14 || _flags & 1) {
+ return _data;
+ } else {
+ error("Unhandled packed data");
+ }
+}
+
MemoryObject2::MemoryObject2() {
_data2 = 0;
}
diff --git a/engines/fullpipe/utils.h b/engines/fullpipe/utils.h
index 4588541bc1..c12d857be9 100644
--- a/engines/fullpipe/utils.h
+++ b/engines/fullpipe/utils.h
@@ -89,7 +89,7 @@ class MemoryObject : CObject {
char _field_15;
char _field_16;
char _field_17;
- void *_data;
+ byte *_data;
int _dataSize;
int _flags;
NGIArchive *_libHandle;
@@ -98,6 +98,8 @@ class MemoryObject : CObject {
MemoryObject();
virtual bool load(MfcArchive &file);
void loadFile(char *filename);
+ void load() { loadFile(_filename); }
+ void *getData();
};
class MemoryObject2 : public MemoryObject {