Skip to content

Commit

Permalink
WINTERMUTE: Privatize members in AdRegion
Browse files Browse the repository at this point in the history
  • Loading branch information
somaen committed Dec 9, 2012
1 parent 8d86668 commit 0e93e89
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 17 deletions.
15 changes: 15 additions & 0 deletions engines/wintermute/ad/ad_region.cpp
Expand Up @@ -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) {
Expand Down
14 changes: 10 additions & 4 deletions engines/wintermute/ad/ad_region.h
Expand Up @@ -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
Expand Down
26 changes: 13 additions & 13 deletions engines/wintermute/ad/ad_scene.cpp
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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;
}

Expand Down Expand Up @@ -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;
}

Expand Down

0 comments on commit 0e93e89

Please sign in to comment.