aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicola Mettifogo2007-03-17 20:48:23 +0000
committerNicola Mettifogo2007-03-17 20:48:23 +0000
commitb80dab6c73819edbe2a21903e313b565630a87a3 (patch)
treeaa5b54cdcc308bc254ef4e1fcd60fe9bd3ceb382
parent54201ddaa9bf1ec8bda447f9a76382a238a72617 (diff)
downloadscummvm-rg350-b80dab6c73819edbe2a21903e313b565630a87a3.tar.gz
scummvm-rg350-b80dab6c73819edbe2a21903e313b565630a87a3.tar.bz2
scummvm-rg350-b80dab6c73819edbe2a21903e313b565630a87a3.zip
added getters for width and height in Zone and Animation
svn-id: r26183
-rw-r--r--engines/parallaction/animation.cpp18
-rw-r--r--engines/parallaction/location.cpp4
-rw-r--r--engines/parallaction/walk.cpp30
-rw-r--r--engines/parallaction/zone.cpp8
-rw-r--r--engines/parallaction/zone.h18
5 files changed, 46 insertions, 32 deletions
diff --git a/engines/parallaction/animation.cpp b/engines/parallaction/animation.cpp
index 89e9bd1ea4..a3256e6b12 100644
--- a/engines/parallaction/animation.cpp
+++ b/engines/parallaction/animation.cpp
@@ -191,15 +191,15 @@ void jobDisplayAnimations(void *parm, Job *j) {
for ( ; v18; v18 = (Animation*)v18->_zone._next) {
if ((v18->_zone._flags & kFlagsActive) && ((v18->_zone._flags & kFlagsRemove) == 0)) {
- v14._width = v18->_cnv._width;
- v14._height = v18->_cnv._height;
+ v14._width = v18->width();
+ v14._height = v18->height();
v14._data0 = v18->_cnv._array[v18->_frame];
// v14._data1 = v18->_cnv.field_8[v18->_frame];
if (v18->_zone._flags & kFlagsNoMasked)
_si = 3;
else
- _si = _vm->_gfx->queryMask(v18->_zone._top + v18->_cnv._height);
+ _si = _vm->_gfx->queryMask(v18->_zone._top + v18->height());
// printf("jobDisplayAnimations %s, x: %i, y: %i, w: %i, h: %i\n", v18->_zone._name, v18->_zone._left, v18->_zone._top, v14._width, v14._height);
_vm->_gfx->blitCnv(&v14, v18->_zone._left, v18->_zone._top, _si, Gfx::kBitBack);
@@ -233,7 +233,7 @@ void jobEraseAnimations(void *arg_0, Job *j) {
if (((a->_zone._flags & kFlagsActive) == 0) && ((a->_zone._flags & kFlagsRemove) == 0)) continue;
- Common::Rect r(a->_cnv._width, a->_cnv._height);
+ Common::Rect r(a->width(), a->height());
r.moveTo(a->_zone._oldLeft, a->_zone._oldTop);
_vm->_gfx->restoreBackground(r);
@@ -489,7 +489,7 @@ void jobRunScripts(void *parm, Job *j) {
StaticCnv v18;
WalkNode *v4 = NULL;
- if (a->_zone._flags & kFlagsCharacter) a->_z = a->_zone._top + a->_cnv._height;
+ if (a->_zone._flags & kFlagsCharacter) a->_z = a->_zone._top + a->height();
for ( ; a; a = (Animation*)a->_zone._next) {
if ((a->_zone._flags & kFlagsActing) == 0) continue;
@@ -571,8 +571,8 @@ void jobRunScripts(void *parm, Job *j) {
break;
case INST_PUT: // put
- v18._width = inst->_opBase._a->_cnv._width;
- v18._height = inst->_opBase._a->_cnv._height;
+ v18._width = inst->_opBase._a->width();
+ v18._height = inst->_opBase._a->height();
v18._data0 = inst->_opBase._a->_cnv._array[inst->_opBase._a->_frame];
v18._data1 = NULL; // inst->_opBase._a->_cnv.field_8[inst->_opBase._a->_frame];
@@ -632,7 +632,7 @@ void jobRunScripts(void *parm, Job *j) {
label1:
if (a->_zone._flags & kFlagsCharacter)
- a->_z = a->_zone._top + a->_cnv._height;
+ a->_z = a->_zone._top + a->height();
}
sortAnimations();
@@ -658,7 +658,7 @@ void sortAnimations() {
Node v14;
memset(&v14, 0, sizeof(Node));
- _vm->_char._ani._z = _vm->_char._ani._cnv._height + _vm->_char._ani._zone._top;
+ _vm->_char._ani._z = _vm->_char._ani.height() + _vm->_char._ani._zone._top;
Animation *vC = (Animation*)_animations._next;
Node *v8;
diff --git a/engines/parallaction/location.cpp b/engines/parallaction/location.cpp
index 4f37f442d7..b03c41b23e 100644
--- a/engines/parallaction/location.cpp
+++ b/engines/parallaction/location.cpp
@@ -237,8 +237,8 @@ void parseWalkNodes(Script& script, Node *list) {
if (!scumm_stricmp(_tokens[0], "COORD")) {
WalkNode *v4 = (WalkNode*)malloc(sizeof(WalkNode));
- v4->_x = atoi(_tokens[1]) - _vm->_char._ani._cnv._width/2;
- v4->_y = atoi(_tokens[2]) - _vm->_char._ani._cnv._height;
+ v4->_x = atoi(_tokens[1]) - _vm->_char._ani.width()/2;
+ v4->_y = atoi(_tokens[2]) - _vm->_char._ani.height();
addNode(list, v4);
diff --git a/engines/parallaction/walk.cpp b/engines/parallaction/walk.cpp
index 9e48dcb628..31d5dd3489 100644
--- a/engines/parallaction/walk.cpp
+++ b/engines/parallaction/walk.cpp
@@ -115,8 +115,8 @@ WalkNode *buildWalkPath(uint16 x, uint16 y) {
WalkNode *v48 = (WalkNode*)malloc(sizeof(WalkNode));
WalkNode *v44 = (WalkNode*)malloc(sizeof(WalkNode));
- v48->_x = to_x - _vm->_char._ani._cnv._width / 2; // target top left coordinates
- v48->_y = to_y - _vm->_char._ani._cnv._height;
+ v48->_x = to_x - _vm->_char._ani.width() / 2; // target top left coordinates
+ v48->_y = to_y - _vm->_char._ani.height();
v48->_next = NULL;
memcpy(v44, v48, sizeof(WalkNode));
@@ -245,8 +245,8 @@ uint16 walkFunc1(int16 x, int16 y, WalkNode *Node) {
Point v4 = { 0, 0 };
Point foot = {
- _vm->_char._ani._zone._left + _vm->_char._ani._cnv._width/2,
- _vm->_char._ani._zone._top + _vm->_char._ani._cnv._height
+ _vm->_char._ani._zone._left + _vm->_char._ani.width()/2,
+ _vm->_char._ani._zone._top + _vm->_char._ani.height()
};
Point v8 = {
@@ -297,8 +297,8 @@ uint16 walkFunc1(int16 x, int16 y, WalkNode *Node) {
v8._y = foot._y;
}
- Node->_x = v4._x - _vm->_char._ani._cnv._width / 2;
- Node->_y = v4._y - _vm->_char._ani._cnv._height;
+ Node->_x = v4._x - _vm->_char._ani.width() / 2;
+ Node->_y = v4._y - _vm->_char._ani.height();
return (x - v4._x) * (x - v4._x) + (y - v4._y) * (y - v4._y);
}
@@ -319,7 +319,7 @@ void jobWalk(void *parm, Job *j) {
int16 _si = _vm->_char._ani._zone._left;
int16 _di = _vm->_char._ani._zone._top;
-// debugC(1, kDebugWalk, "jobWalk to (%i, %i)", node->_x + _vm->_char._ani._cnv._width / 2, node->_y + _vm->_char._ani._cnv._height);
+// debugC(1, kDebugWalk, "jobWalk to (%i, %i)", node->_x + _vm->_char._ani.width() / 2, node->_y + _vm->_char._ani.height());
_vm->_char._ani._zone._oldLeft = _si;
_vm->_char._ani._zone._oldTop = _di;
@@ -386,27 +386,27 @@ void jobWalk(void *parm, Job *j) {
}
// StaticCnv v14;
-// v14._width = _vm->_char._ani._cnv._width;
-// v14._height = _vm->_char._ani._cnv._height;
+// v14._width = _vm->_char._ani.width();
+// v14._height = _vm->_char._ani.height();
// v14._data0 = _vm->_char._ani._cnv._array[_vm->_char._ani._frame];
// v14._data1 = _vm->_char._ani._cnv.field_8[_vm->_char._ani._frame];
- if ((_si < node->_x) && (_si < SCREEN_WIDTH) && (queryPath(_vm->_char._ani._cnv._width/2 + _si + 2, _vm->_char._ani._cnv._height + _di) != 0)) {
+ if ((_si < node->_x) && (_si < SCREEN_WIDTH) && (queryPath(_vm->_char._ani.width()/2 + _si + 2, _vm->_char._ani.height() + _di) != 0)) {
// printf("walk right\n");
_si = (_si + 2 < node->_x) ? _si + 2 : node->_x;
}
- if ((_si > node->_x) && (_si > -20) && (queryPath(_vm->_char._ani._cnv._width/2 + _si - 2, _vm->_char._ani._cnv._height + _di) != 0)) {
+ if ((_si > node->_x) && (_si > -20) && (queryPath(_vm->_char._ani.width()/2 + _si - 2, _vm->_char._ani.height() + _di) != 0)) {
// printf("walk left\n");
_si = (_si - 2 > node->_x) ? _si - 2 :node->_x;
}
- if ((_di < node->_y) && (_di < (SCREEN_HEIGHT - _vm->_char._ani._cnv._height)) && (queryPath(_vm->_char._ani._cnv._width/2 + _si, _vm->_char._ani._cnv._height + _di + 2) != 0)) {
+ if ((_di < node->_y) && (_di < (SCREEN_HEIGHT - _vm->_char._ani.height())) && (queryPath(_vm->_char._ani.width()/2 + _si, _vm->_char._ani.height() + _di + 2) != 0)) {
// printf("walk down\n");
_di = (_di + 2 <= node->_y) ? _di + 2 : node->_y;
}
- if ((_di > node->_y) && (_di > -20) && (queryPath(_vm->_char._ani._cnv._width/2 + _si, _vm->_char._ani._cnv._height + _di - 2) != 0)) {
+ if ((_di > node->_y) && (_di > -20) && (queryPath(_vm->_char._ani.width()/2 + _si, _vm->_char._ani.height() + _di - 2) != 0)) {
// printf("walk up\n");
_di = (_di - 2 >= node->_y) ? _di - 2 : node->_y;
}
@@ -440,7 +440,7 @@ uint16 checkDoor() {
}
_engineFlags &= ~kEngineWalking;
- Zone *z = hitZone(kZoneDoor, _vm->_char._ani._zone._left + _vm->_char._ani._cnv._width / 2, _vm->_char._ani._zone._top + _vm->_char._ani._cnv._height);
+ Zone *z = hitZone(kZoneDoor, _vm->_char._ani._zone._left + _vm->_char._ani.width() / 2, _vm->_char._ani._zone._top + _vm->_char._ani.height());
if (z != NULL) {
@@ -458,7 +458,7 @@ uint16 checkDoor() {
}
}
- z = hitZone(kZoneTrap, _vm->_char._ani._zone._left + _vm->_char._ani._cnv._width / 2, _vm->_char._ani._zone._top + _vm->_char._ani._cnv._height);
+ z = hitZone(kZoneTrap, _vm->_char._ani._zone._left + _vm->_char._ani.width() / 2, _vm->_char._ani._zone._top + _vm->_char._ani.height());
if (z != NULL) {
_localFlags[_vm->_currentLocationIndex] |= kFlagsEnter;
diff --git a/engines/parallaction/zone.cpp b/engines/parallaction/zone.cpp
index 13709f57de..181fa23ec4 100644
--- a/engines/parallaction/zone.cpp
+++ b/engines/parallaction/zone.cpp
@@ -610,11 +610,11 @@ Zone *hitZone(uint32 type, uint16 x, uint16 y) {
continue;
if (_si < _vm->_char._ani._zone._left)
continue;
- if (_si > (_vm->_char._ani._zone._left + _vm->_char._ani._cnv._width))
+ if (_si > (_vm->_char._ani._zone._left + _vm->_char._ani.width()))
continue;
if (_di < _vm->_char._ani._zone._top)
continue;
- if (_di > (_vm->_char._ani._zone._top + _vm->_char._ani._cnv._height))
+ if (_di > (_vm->_char._ani._zone._top + _vm->_char._ani.height()))
continue;
}
@@ -636,8 +636,8 @@ Zone *hitZone(uint32 type, uint16 x, uint16 y) {
// printf("Animation name: %s", a->_zone._name);
_a = (a->_zone._flags & kFlagsActive) ? 1 : 0; // _a: active Animation
- _e = ((_si >= a->_zone._left + a->_cnv._width) || (_si <= a->_zone._left)) ? 0 : 1; // _e: horizontal range
- _f = ((_di >= a->_zone._top + a->_cnv._height) || (_di <= a->_zone._top)) ? 0 : 1; // _f: vertical range
+ _e = ((_si >= a->_zone._left + a->width()) || (_si <= a->_zone._left)) ? 0 : 1; // _e: horizontal range
+ _f = ((_di >= a->_zone._top + a->height()) || (_di <= a->_zone._top)) ? 0 : 1; // _f: vertical range
_b = ((type != 0) || (a->_zone._type == kZoneYou)) ? 0 : 1; // _b: (no type specified) AND (Animation is not the character)
_c = (a->_zone._type & 0xFFFF0000) ? 0 : 1; // _c: Animation is not an object
diff --git a/engines/parallaction/zone.h b/engines/parallaction/zone.h
index b5a73945f8..ef878eb41e 100644
--- a/engines/parallaction/zone.h
+++ b/engines/parallaction/zone.h
@@ -134,14 +134,20 @@ struct Zone : public Node {
uint32 _type;
uint32 _flags;
-// char* _labeltext;
-// StaticCnv _labelcnv;
ZoneLabel _label;
uint16 field_2C; // unused
uint16 field_2E; // unused
ZoneTypeData u;
Command *_commands;
Point _moveTo;
+
+ uint16 width() const {
+ return _right - _left;
+ }
+
+ uint16 height() const {
+ return _bottom - _top;
+ }
};
struct LocalVariable {
@@ -199,6 +205,14 @@ struct Animation {
uint16 field_5A; // unused
uint16 field_5C; // unused
uint16 field_5E; // unused
+
+ uint16 width() const {
+ return _cnv._width;
+ }
+
+ uint16 height() const {
+ return _cnv._height;
+ }
};
extern Node _zones;