diff --git a/engines/wage/design.cpp b/engines/wage/design.cpp index 42e1c0ac8e7f..66205f58ea51 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 1c08cd99774d..59b3226541a7 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 @@ class Design { 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 @@ class Design { 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 c499283e076c..d75a348bbc3e 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 ec9396f81de4..fdeb5d38408c 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 d58be8f72a4c..d7c3386fe47a 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 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 8d7c70f5ec44..1b1bc73e9f72 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 @@ class World { Common::Array _orderedObjs; Common::Array _orderedChrs; Common::Array _orderedSounds; - Common::Array _patterns; + Patterns _patterns; Scene _storageScene; Chr *_player; //List moveListeners; @@ -112,7 +112,7 @@ class World { _orderedSounds.push_back(sound); } }; - + } // End of namespace Wage - + #endif