diff options
author | Einar Johan Trøan Sømåen | 2012-12-09 12:13:04 +0100 |
---|---|---|
committer | Einar Johan Trøan Sømåen | 2012-12-09 12:13:04 +0100 |
commit | 0e93e898c5b80e99da60a97faf3816091b6e1b35 (patch) | |
tree | 8d6bfe550a91a9f1096765dde40318de36f5b4db | |
parent | 8d866683d90e69c3313fda5fed63679a603d2b45 (diff) | |
download | scummvm-rg350-0e93e898c5b80e99da60a97faf3816091b6e1b35.tar.gz scummvm-rg350-0e93e898c5b80e99da60a97faf3816091b6e1b35.tar.bz2 scummvm-rg350-0e93e898c5b80e99da60a97faf3816091b6e1b35.zip |
WINTERMUTE: Privatize members in AdRegion
-rw-r--r-- | engines/wintermute/ad/ad_region.cpp | 15 | ||||
-rw-r--r-- | engines/wintermute/ad/ad_region.h | 14 | ||||
-rw-r--r-- | engines/wintermute/ad/ad_scene.cpp | 26 |
3 files changed, 38 insertions, 17 deletions
diff --git a/engines/wintermute/ad/ad_region.cpp b/engines/wintermute/ad/ad_region.cpp index c9f1553c9a..39e0ddcf9a 100644 --- a/engines/wintermute/ad/ad_region.cpp +++ b/engines/wintermute/ad/ad_region.cpp @@ -51,6 +51,21 @@ AdRegion::AdRegion(BaseGame *inGame) : BaseRegion(inGame) { AdRegion::~AdRegion() { } +uint32 AdRegion::getAlpha() { + return _alpha; +} + +float AdRegion::getZoom() { + return _zoom; +} + +bool AdRegion::isBlocked() { + return _blocked; +} + +bool AdRegion::hasDecoration() { + return _decoration; +} ////////////////////////////////////////////////////////////////////////// bool AdRegion::loadFile(const char *filename) { diff --git a/engines/wintermute/ad/ad_region.h b/engines/wintermute/ad/ad_region.h index 6112900361..454e4bdebe 100644 --- a/engines/wintermute/ad/ad_region.h +++ b/engines/wintermute/ad/ad_region.h @@ -36,21 +36,27 @@ namespace Wintermute { class AdRegion : public BaseRegion { public: DECLARE_PERSISTENT(AdRegion, BaseRegion) - uint32 _alpha; - float _zoom; - bool _blocked; - bool _decoration; + AdRegion(BaseGame *inGame); virtual ~AdRegion(); bool loadFile(const char *filename); bool loadBuffer(byte *buffer, bool complete = true); virtual bool saveAsText(BaseDynamicBuffer *buffer, int indent); + bool hasDecoration(); + bool isBlocked(); + uint32 getAlpha(); + float getZoom(); // scripting interface virtual ScValue *scGetProperty(const Common::String &name); virtual bool scSetProperty(const char *name, ScValue *value); virtual bool scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack, const char *name); virtual const char *scToString(); +private: + uint32 _alpha; + float _zoom; + bool _blocked; + bool _decoration; }; } // end of namespace Wintermute diff --git a/engines/wintermute/ad/ad_scene.cpp b/engines/wintermute/ad/ad_scene.cpp index 3791b7b0bc..c6c034b4a7 100644 --- a/engines/wintermute/ad/ad_scene.cpp +++ b/engines/wintermute/ad/ad_scene.cpp @@ -287,9 +287,9 @@ float AdScene::getZoomAt(int x, int y) { if (_mainLayer) { for (int i = _mainLayer->_nodes.size() - 1; i >= 0; i--) { AdSceneNode *node = _mainLayer->_nodes[i]; - if (node->_type == OBJECT_REGION && node->_region->_active && !node->_region->_blocked && node->_region->pointInRegion(x, y)) { - if (node->_region->_zoom != 0) { - ret = node->_region->_zoom; + if (node->_type == OBJECT_REGION && node->_region->_active && !node->_region->isBlocked() && node->_region->pointInRegion(x, y)) { + if (node->_region->getZoom() != 0) { + ret = node->_region->getZoom(); found = true; break; } @@ -320,9 +320,9 @@ uint32 AdScene::getAlphaAt(int x, int y, bool colorCheck) { if (_mainLayer) { for (int i = _mainLayer->_nodes.size() - 1; i >= 0; i--) { AdSceneNode *node = _mainLayer->_nodes[i]; - if (node->_type == OBJECT_REGION && node->_region->_active && (colorCheck || !node->_region->_blocked) && node->_region->pointInRegion(x, y)) { - if (!node->_region->_blocked) { - ret = node->_region->_alpha; + if (node->_type == OBJECT_REGION && node->_region->_active && (colorCheck || !node->_region->isBlocked()) && node->_region->pointInRegion(x, y)) { + if (!node->_region->isBlocked()) { + ret = node->_region->getAlpha(); } break; } @@ -365,8 +365,8 @@ bool AdScene::isBlockedAt(int x, int y, bool checkFreeObjects, BaseObject *reque break; } */ - if (node->_type == OBJECT_REGION && node->_region->_active && !node->_region->_decoration && node->_region->pointInRegion(x, y)) { - if (node->_region->_blocked) { + if (node->_type == OBJECT_REGION && node->_region->_active && !node->_region->hasDecoration() && node->_region->pointInRegion(x, y)) { + if (node->_region->isBlocked()) { ret = true; break; } else { @@ -405,8 +405,8 @@ bool AdScene::isWalkableAt(int x, int y, bool checkFreeObjects, BaseObject *requ if (_mainLayer) { for (uint32 i = 0; i < _mainLayer->_nodes.size(); i++) { AdSceneNode *node = _mainLayer->_nodes[i]; - if (node->_type == OBJECT_REGION && node->_region->_active && !node->_region->_decoration && node->_region->pointInRegion(x, y)) { - if (node->_region->_blocked) { + if (node->_type == OBJECT_REGION && node->_region->_active && !node->_region->hasDecoration() && node->_region->pointInRegion(x, y)) { + if (node->_region->isBlocked()) { ret = false; break; } else { @@ -1045,10 +1045,10 @@ bool AdScene::traverseNodes(bool doUpdate) { break; case OBJECT_REGION: { - if (node->_region->_blocked) { + if (node->_region->isBlocked()) { break; } - if (node->_region->_decoration) { + if (node->_region->hasDecoration()) { break; } @@ -1536,7 +1536,7 @@ bool AdScene::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack, for (int i = _mainLayer->_nodes.size() - 1; i >= 0; i--) { AdSceneNode *node = _mainLayer->_nodes[i]; if (node->_type == OBJECT_REGION && node->_region->_active && node->_region->pointInRegion(x, y)) { - if (node->_region->_decoration && !includeDecors) { + if (node->_region->hasDecoration() && !includeDecors) { continue; } |