diff options
Diffstat (limited to 'engines/wage/entities.cpp')
-rw-r--r-- | engines/wage/entities.cpp | 27 |
1 files changed, 22 insertions, 5 deletions
diff --git a/engines/wage/entities.cpp b/engines/wage/entities.cpp index a2648c49fe..43ac6c8cc7 100644 --- a/engines/wage/entities.cpp +++ b/engines/wage/entities.cpp @@ -52,6 +52,7 @@ #include "wage/world.h" #include "common/memstream.h" +#include "graphics/managed_surface.h" namespace Wage { @@ -134,20 +135,20 @@ Scene::~Scene() { delete _textBounds; } -void Scene::paint(Graphics::Surface *surface, int x, int y) { +void Scene::paint(Graphics::ManagedSurface *surface, int x, int y) { Common::Rect r(x + 5, y + 5, _design->getBounds()->width() + x - 10, _design->getBounds()->height() + y - 10); surface->fillRect(r, kColorWhite); - _design->paint(surface, ((WageEngine *)g_engine)->_world->_patterns, x, y); + _design->paint(surface, *((WageEngine *)g_engine)->_world->_patterns, x, y); for (ObjList::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, x, y); + debug(2, "paining Obj: %s, index: %d, type: %d", (*it)->_name.c_str(), (*it)->_index, (*it)->_type); + (*it)->_design->paint(surface, *((WageEngine *)g_engine)->_world->_patterns, x, y); } for (ChrList::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, x, y); + (*it)->_design->paint(surface, *((WageEngine *)g_engine)->_world->_patterns, x, y); } } @@ -202,6 +203,22 @@ const char *Scene::getFontName() { return "Unknown"; } +Designed *Scene::lookUpEntity(int x, int y) { + for (ObjList::const_iterator it = _objs.end(); it != _objs.begin(); ) { + it--; + if ((*it)->_design->isPointOpaque(x, y)) + return *it; + } + + for (ChrList::const_iterator it = _chrs.end(); it != _chrs.begin(); ) { + it--; + if ((*it)->_design->isPointOpaque(x, y)) + return *it; + } + + return nullptr; +} + Obj::Obj() : _currentOwner(NULL), _currentScene(NULL) { _index = 0; _namePlural = false; |