aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEugene Sandulenko2015-12-16 21:44:48 +0100
committerEugene Sandulenko2015-12-27 15:39:52 +0100
commit4cfc0d0480088476fabfe2fd99f1ec6a5e63a833 (patch)
tree1e5f35b3d6cbacee8ccdb24aaae43a29f74b3bc2
parent327a9ec74ae7ce0e9ae100449b31df5320700d75 (diff)
downloadscummvm-rg350-4cfc0d0480088476fabfe2fd99f1ec6a5e63a833.tar.gz
scummvm-rg350-4cfc0d0480088476fabfe2fd99f1ec6a5e63a833.tar.bz2
scummvm-rg350-4cfc0d0480088476fabfe2fd99f1ec6a5e63a833.zip
WAGE: Get rid of hacky drawing
-rw-r--r--engines/wage/design.cpp24
-rw-r--r--engines/wage/design.h8
-rw-r--r--engines/wage/entities.cpp2
-rw-r--r--engines/wage/wage.cpp7
-rw-r--r--engines/wage/wage.h2
-rw-r--r--engines/wage/world.h8
6 files changed, 28 insertions, 23 deletions
diff --git a/engines/wage/design.cpp b/engines/wage/design.cpp
index 42e1c0ac8e..66205f58ea 100644
--- a/engines/wage/design.cpp
+++ b/engines/wage/design.cpp
@@ -55,19 +55,13 @@ Design::Design(Common::SeekableReadStream *data) {
_len = data->readUint16BE() - 2;
_data = (byte *)malloc(_len);
data->read(_data, _len);
-
- Graphics::Surface screen;
- screen.create(320, 200, Graphics::PixelFormat::createFormatCLUT8());
- Common::Rect r(0, 0, 320, 200);
- setBounds(&r);
- paint(&screen, 0, true);
}
Design::~Design() {
free(_data);
}
-void Design::paint(Graphics::Surface *canvas, TexturePaint *patterns, bool mask) {
+void Design::paint(Graphics::Surface *canvas, Patterns &patterns, bool mask) {
Common::MemoryReadStream in(_data, _len);
if (mask) {
@@ -80,6 +74,7 @@ void Design::paint(Graphics::Surface *canvas, TexturePaint *patterns, bool mask)
byte fillType = in.readByte();
byte borderThickness = in.readByte();
byte borderFillType = in.readByte();
+ warning("fill: %d border: %d borderFill: %d", fillType, borderThickness, borderFillType);
int type = in.readByte();
switch (type) {
case 4:
@@ -118,7 +113,7 @@ void Design::paint(Graphics::Surface *canvas, TexturePaint *patterns, bool mask)
}
void Design::drawRect(Graphics::Surface *surface, Common::ReadStream &in, bool mask,
- TexturePaint *patterns, byte fillType, byte borderThickness, byte borderFillType) {
+ Patterns &patterns, byte fillType, byte borderThickness, byte borderFillType) {
int16 y = in.readSint16BE();
int16 x = in.readSint16BE();
int16 height = in.readSint16BE();
@@ -135,7 +130,7 @@ void Design::drawRect(Graphics::Surface *surface, Common::ReadStream &in, bool m
}
void Design::drawPolygon(Graphics::Surface *surface, Common::ReadStream &in, bool mask,
- TexturePaint *patterns, byte fillType, byte borderThickness, byte borderFillType) {
+ Patterns &patterns, byte fillType, byte borderThickness, byte borderFillType) {
//surface->setColor(Color.BLACK);
//in.readUint16BE();
warning("ignored => %d", in.readSint16BE());
@@ -143,10 +138,11 @@ void Design::drawPolygon(Graphics::Surface *surface, Common::ReadStream &in, boo
warning("Num bytes is %d", numBytes);
// Ignoring these values works!!!
//in.readUint16BE(); in.readUint16BE(); in.readUint16BE(); in.readUint16BE();
- warning("Ignoring: %d", in.readSint16BE());
- warning("Ignoring: %d", in.readSint16BE());
- warning("Ignoring: %d", in.readSint16BE());
- warning("Ignoring: %d", in.readSint16BE());
+ int16 by1 = in.readSint16BE();
+ int16 bx1 = in.readSint16BE();
+ int16 by2 = in.readSint16BE();
+ int16 bx2 = in.readSint16BE();
+ warning("Bbox: %d, %d, %d, %d", bx1, by1, bx2, by2);
numBytes -= 8;
@@ -186,7 +182,7 @@ void Design::drawPolygon(Graphics::Surface *surface, Common::ReadStream &in, boo
//surface->setColor(Color.black);
xcoords.push_back(x1);
ycoords.push_back(y1);
- warning("%d %d %d %d", x1, y1, x2, y2);
+ debug(8, "%d %d %d %d", x1, y1, x2, y2);
//surface->drawLine(x1, y1, x2, y2);
x1 = x2;
y1 = y2;
diff --git a/engines/wage/design.h b/engines/wage/design.h
index 1c08cd9977..59b3226541 100644
--- a/engines/wage/design.h
+++ b/engines/wage/design.h
@@ -54,8 +54,6 @@
namespace Wage {
-struct TexturePaint;
-
enum {
kColorBlack = 0,
kColorGray = 1,
@@ -75,7 +73,7 @@ public:
return new Common::Rect(*_bounds);
}
- void paint(Graphics::Surface *canvas, TexturePaint *patterns, bool mask);
+ void paint(Graphics::Surface *canvas, Patterns &patterns, bool mask);
private:
byte *_data;
@@ -84,9 +82,9 @@ private:
private:
void drawRect(Graphics::Surface *surface, Common::ReadStream &in, bool mask,
- TexturePaint *patterns, byte fillType, byte borderThickness, byte borderFillType);
+ Patterns &patterns, byte fillType, byte borderThickness, byte borderFillType);
void drawPolygon(Graphics::Surface *surface, Common::ReadStream &in, bool mask,
- TexturePaint *patterns, byte fillType, byte borderThickness, byte borderFillType);
+ Patterns &patterns, byte fillType, byte borderThickness, byte borderFillType);
};
diff --git a/engines/wage/entities.cpp b/engines/wage/entities.cpp
index c499283e07..d75a348bbc 100644
--- a/engines/wage/entities.cpp
+++ b/engines/wage/entities.cpp
@@ -62,6 +62,8 @@ Scene::Scene(String name, Common::SeekableReadStream *data) {
_name = name;
_design = new Design(data);
+ warning("Scene %s", _name.c_str());
+
setDesignBounds(readRect(data));
_worldY = data->readSint16BE();
_worldX = data->readSint16BE();
diff --git a/engines/wage/wage.cpp b/engines/wage/wage.cpp
index ec9396f81d..fdeb5d3840 100644
--- a/engines/wage/wage.cpp
+++ b/engines/wage/wage.cpp
@@ -61,6 +61,7 @@
#include "wage/wage.h"
#include "wage/entities.h"
#include "wage/world.h"
+#include "wage/design.h"
namespace Wage {
@@ -104,6 +105,12 @@ Common::Error WageEngine::run() {
if (!_world->loadWorld(_resManager))
return Common::kNoGameDataFoundError;
+ Graphics::Surface screen;
+ screen.create(320, 200, Graphics::PixelFormat::createFormatCLUT8());
+ Common::Rect r(0, 0, 320, 200);
+ _world->_scenes["entry"]->_design->setBounds(&r);
+ _world->_scenes["entry"]->_design->paint(&screen, _world->_patterns, true);
+
return Common::kNoError;
}
diff --git a/engines/wage/wage.h b/engines/wage/wage.h
index d58be8f72a..d7c3386fe4 100644
--- a/engines/wage/wage.h
+++ b/engines/wage/wage.h
@@ -79,6 +79,8 @@ enum {
Common::String readPascalString(Common::SeekableReadStream *in);
Common::Rect *readRect(Common::SeekableReadStream *in);
+typedef Common::Array<byte *> Patterns;
+
class WageEngine : public Engine {
public:
WageEngine(OSystem *syst, const ADGameDescription *gameDesc);
diff --git a/engines/wage/world.h b/engines/wage/world.h
index 8d7c70f5ec..1b1bc73e9f 100644
--- a/engines/wage/world.h
+++ b/engines/wage/world.h
@@ -56,7 +56,7 @@ class World {
public:
World();
~World();
-
+
bool loadWorld(Common::MacResManager *resMan);
void loadExternalSounds(String fname);
@@ -75,7 +75,7 @@ public:
Common::Array<Obj *> _orderedObjs;
Common::Array<Chr *> _orderedChrs;
Common::Array<Sound *> _orderedSounds;
- Common::Array<byte *> _patterns;
+ Patterns _patterns;
Scene _storageScene;
Chr *_player;
//List<MoveListener> moveListeners;
@@ -112,7 +112,7 @@ public:
_orderedSounds.push_back(sound);
}
};
-
+
} // End of namespace Wage
-
+
#endif