diff options
author | Eugene Sandulenko | 2015-12-26 11:55:55 +0100 |
---|---|---|
committer | Eugene Sandulenko | 2015-12-27 15:41:02 +0100 |
commit | ab34bafc31475d79ff74887f38631c993e4db9b2 (patch) | |
tree | 09b403a6c798119f5b72b86c812db408c0491081 /engines/wage | |
parent | 6d3fe9568955ff2475f2091d0edb866c68635522 (diff) | |
download | scummvm-rg350-ab34bafc31475d79ff74887f38631c993e4db9b2.tar.gz scummvm-rg350-ab34bafc31475d79ff74887f38631c993e4db9b2.tar.bz2 scummvm-rg350-ab34bafc31475d79ff74887f38631c993e4db9b2.zip |
WAGE: Implement scene drawing
Diffstat (limited to 'engines/wage')
-rw-r--r-- | engines/wage/design.cpp | 32 | ||||
-rw-r--r-- | engines/wage/design.h | 2 | ||||
-rw-r--r-- | engines/wage/entities.cpp | 17 | ||||
-rw-r--r-- | engines/wage/entities.h | 6 | ||||
-rw-r--r-- | engines/wage/wage.cpp | 12 |
5 files changed, 51 insertions, 18 deletions
diff --git a/engines/wage/design.cpp b/engines/wage/design.cpp index 8ea550188a..e3a63faa50 100644 --- a/engines/wage/design.cpp +++ b/engines/wage/design.cpp @@ -73,11 +73,11 @@ Design::~Design() { free(_data); } -void Design::paint(Graphics::Surface *canvas, Patterns &patterns, bool mask) { +void Design::paint(Graphics::Surface *surface, Patterns &patterns, bool mask) { Common::MemoryReadStream in(_data, _len); - if (mask || 1) { - canvas->fillRect(Common::Rect(0, 0, _bounds->width(), _bounds->height()), kColorWhite); + if (mask) { + surface->fillRect(Common::Rect(0, 0, _bounds->width(), _bounds->height()), kColorWhite); } /* @@ -104,30 +104,30 @@ void Design::paint(Graphics::Surface *canvas, Patterns &patterns, bool mask) { while (true) { byte fillType = in.readByte(); + byte borderThickness = in.readByte(); + byte borderFillType = in.readByte(); + int type = in.readByte(); if (in.eos()) return; - byte borderThickness = in.readByte(); - byte borderFillType = in.readByte(); - int type = in.readByte(); debug(2, "fill: %d borderFill: %d border: %d type: %d", fillType, borderFillType, borderThickness, type); switch (type) { case 4: - drawRect(canvas, in, mask, patterns, fillType, borderThickness, borderFillType); + drawRect(surface, in, mask, patterns, fillType, borderThickness, borderFillType); break; case 8: - drawRoundRect(canvas, in, mask, patterns, fillType, borderThickness, borderFillType); + drawRoundRect(surface, in, mask, patterns, fillType, borderThickness, borderFillType); break; case 12: - drawOval(canvas, in, mask, patterns, fillType, borderThickness, borderFillType); + drawOval(surface, in, mask, patterns, fillType, borderThickness, borderFillType); break; case 16: case 20: - drawPolygon(canvas, in, mask, patterns, fillType, borderThickness, borderFillType); + drawPolygon(surface, in, mask, patterns, fillType, borderThickness, borderFillType); break; case 24: - drawBitmap(canvas, in, mask); + drawBitmap(surface, in, mask); break; default: warning("Unknown type => %d", type); @@ -139,9 +139,9 @@ void Design::paint(Graphics::Surface *canvas, Patterns &patterns, bool mask) { return; } - g_system->copyRectToScreen(canvas->getPixels(), canvas->pitch, 0, 0, canvas->w, canvas->h); - ((WageEngine *)g_engine)->processEvents(); - g_system->updateScreen(); + //g_system->copyRectToScreen(surface->getPixels(), surface->pitch, 0, 0, surface->w, surface->h); + //((WageEngine *)g_engine)->processEvents(); + //g_system->updateScreen(); } } @@ -240,7 +240,9 @@ void Design::drawRoundRect(Graphics::Surface *surface, Common::ReadStream &in, b void Design::drawPolygon(Graphics::Surface *surface, Common::ReadStream &in, bool mask, Patterns &patterns, byte fillType, byte borderThickness, byte borderFillType) { - warning("ignored => %d", in.readSint16BE()); + byte ignored = in.readSint16BE(); // ignored + assert(ignored == 0); + int numBytes = in.readSint16BE(); // #bytes used by polygon data, including the numBytes int16 by1 = in.readSint16BE(); int16 bx1 = in.readSint16BE(); diff --git a/engines/wage/design.h b/engines/wage/design.h index 998682c4c7..f5f707ef7f 100644 --- a/engines/wage/design.h +++ b/engines/wage/design.h @@ -70,7 +70,7 @@ public: } Common::Rect *getBounds() { - return new Common::Rect(*_bounds); + return _bounds; } void paint(Graphics::Surface *canvas, Patterns &patterns, bool mask); diff --git a/engines/wage/entities.cpp b/engines/wage/entities.cpp index 0e7e4bc5e3..210ca3e1da 100644 --- a/engines/wage/entities.cpp +++ b/engines/wage/entities.cpp @@ -48,6 +48,7 @@ #include "wage/wage.h" #include "wage/entities.h" #include "wage/design.h" +#include "wage/world.h" #include "common/memstream.h" @@ -82,6 +83,22 @@ Scene::Scene(String name, Common::SeekableReadStream *data) { _visited = false; } +void Scene::paint(Graphics::Surface *surface) { + surface->fillRect(Common::Rect(0, 0, _design->getBounds()->width(), _design->getBounds()->height()), kColorWhite); + + _design->paint(surface, ((WageEngine *)g_engine)->_world->_patterns, false); + + for (Common::List<Obj *>::const_iterator it = _objs.begin(); it != _objs.end(); ++it) { + debug(2, "paining Obj: %s", (*it)->_name.c_str()); + (*it)->_design->paint(surface, ((WageEngine *)g_engine)->_world->_patterns, false); + } + + for (Common::List<Chr *>::const_iterator it = _chrs.begin(); it != _chrs.end(); ++it) { + debug(2, "paining Chr: %s", (*it)->_name.c_str()); + (*it)->_design->paint(surface, ((WageEngine *)g_engine)->_world->_patterns, false); + } +} + Obj::Obj(String name, Common::SeekableReadStream *data) : _currentOwner(NULL), _currentScene(NULL) { _name = name; _classType = OBJ; diff --git a/engines/wage/entities.h b/engines/wage/entities.h index 66f966a65f..8a8044b56c 100644 --- a/engines/wage/entities.h +++ b/engines/wage/entities.h @@ -48,6 +48,10 @@ #ifndef WAGE_ENTITIES_H #define WAGE_ENTITIES_H +namespace Graphics { + struct Surface; +} + namespace Wage { class Design; @@ -397,6 +401,8 @@ public: return _textBounds == NULL ? NULL : new Common::Rect(*_textBounds); } + void paint(Graphics::Surface *screen); + #if 0 String getFontName() { String[] fonts = { diff --git a/engines/wage/wage.cpp b/engines/wage/wage.cpp index ff57d885f8..99d8205913 100644 --- a/engines/wage/wage.cpp +++ b/engines/wage/wage.cpp @@ -112,7 +112,6 @@ Common::Error WageEngine::run() { Graphics::Surface screen; screen.create(640, 480, Graphics::PixelFormat::createFormatCLUT8()); - Common::Rect r(0, 0, screen.w, screen.h); _temporarilyHidden = true; performInitialSetup(); @@ -121,7 +120,16 @@ Common::Error WageEngine::run() { Common::String input("look"); _world->_player->_currentScene = _world->_orderedScenes[1]; - _world->_globalScript->execute(_world, 1, &input, NULL, this); + //_world->_globalScript->execute(_world, 1, &input, NULL, this); + + _world->_orderedScenes[4]->paint(&screen); + g_system->copyRectToScreen(screen.getPixels(), screen.pitch, 0, 0, screen.w, screen.h); + + while (true) { + processEvents(); + g_system->updateScreen(); + g_system->delayMillis(50); + } //_world->_orderedScenes[1]->_design->paint(&screen, _world->_patterns, false); //_world->_objs["frank.1"]->_design->setBounds(&r); |