From d7f31cf55d54b7f74fb5e8ed9ccdb3d8ddbacd6d Mon Sep 17 00:00:00 2001 From: Nicola Mettifogo Date: Sat, 17 Mar 2007 19:48:48 +0000 Subject: Flattened anonymous union in Zone. Its members have been partially merged. svn-id: r26181 --- engines/parallaction/animation.cpp | 40 ++++++++++++------------ engines/parallaction/callables.cpp | 40 ++++++++++++------------ engines/parallaction/intro.cpp | 12 ++++---- engines/parallaction/location.cpp | 12 ++++---- engines/parallaction/parallaction.cpp | 4 +-- engines/parallaction/parallaction.h | 8 ++--- engines/parallaction/saveload.cpp | 4 +-- engines/parallaction/walk.cpp | 34 ++++++++++---------- engines/parallaction/zone.cpp | 58 +++++++++++++++++------------------ engines/parallaction/zone.h | 14 ++++----- 10 files changed, 113 insertions(+), 113 deletions(-) (limited to 'engines') diff --git a/engines/parallaction/animation.cpp b/engines/parallaction/animation.cpp index edcf47a861..a383e57b7d 100644 --- a/engines/parallaction/animation.cpp +++ b/engines/parallaction/animation.cpp @@ -133,8 +133,8 @@ Animation *Parallaction::parseAnimation(Script& script, Node *list, char *name) // if (_ax == -1) exit(-1); } if (!scumm_stricmp(_tokens[0], "position")) { - vD0->_zone.pos._position._x = atoi(_tokens[1]); - vD0->_zone.pos._position._y = atoi(_tokens[2]); + vD0->_zone._left = atoi(_tokens[1]); + vD0->_zone._top = atoi(_tokens[2]); vD0->_z = atoi(_tokens[3]); } if (!scumm_stricmp(_tokens[0], "moveto")) { @@ -145,8 +145,8 @@ Animation *Parallaction::parseAnimation(Script& script, Node *list, char *name) fillBuffers(script, true); } - vD0->_zone.pos._oldposition._x = -1000; - vD0->_zone.pos._oldposition._y = -1000; + vD0->_zone._oldposition._x = -1000; + vD0->_zone._oldposition._y = -1000; vD0->_zone._flags |= 0x1000000; @@ -199,16 +199,16 @@ void jobDisplayAnimations(void *parm, Job *j) { if (v18->_zone._flags & kFlagsNoMasked) _si = 3; else - _si = _vm->_gfx->queryMask(v18->_zone.pos._position._y + v18->_cnv._height); + _si = _vm->_gfx->queryMask(v18->_zone._top + v18->_cnv._height); -// printf("jobDisplayAnimations %s, x: %i, y: %i, w: %i, h: %i\n", v18->_zone._name, v18->_zone.pos._position._x, v18->_zone.pos._position._y, v14._width, v14._height); - _vm->_gfx->blitCnv(&v14, v18->_zone.pos._position._x, v18->_zone.pos._position._y, _si, Gfx::kBitBack); +// 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); } if (((v18->_zone._flags & kFlagsActive) == 0) && (v18->_zone._flags & kFlagsRemove)) { v18->_zone._flags &= ~kFlagsRemove; - v18->_zone.pos._oldposition._x = -1000; + v18->_zone._oldposition._x = -1000; } if ((v18->_zone._flags & kFlagsActive) && (v18->_zone._flags & kFlagsRemove)) { @@ -234,12 +234,12 @@ 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); - r.moveTo(a->_zone.pos._oldposition._x, a->_zone.pos._oldposition._y); + r.moveTo(a->_zone._oldposition._x, a->_zone._oldposition._y); _vm->_gfx->restoreBackground(r); if (arg_0) { - a->_zone.pos._oldposition._x = a->_zone.pos._position._x; - a->_zone.pos._oldposition._y = a->_zone.pos._position._y; + a->_zone._oldposition._x = a->_zone._left; + a->_zone._oldposition._y = a->_zone._top; } } @@ -327,12 +327,12 @@ void Parallaction::parseScriptLine(Instruction *inst, Animation *a, LocalVariabl break; case INST_X: // x - inst->_opA._pvalue = &a->_zone.pos._position._x; + inst->_opA._pvalue = &a->_zone._left; inst->_opB = getLValue(inst, _tokens[1], locals, a); break; case INST_Y: // y - inst->_opA._pvalue = &a->_zone.pos._position._y; + inst->_opA._pvalue = &a->_zone._top; inst->_opB = getLValue(inst, _tokens[1], locals, a); break; @@ -349,10 +349,10 @@ void Parallaction::parseScriptLine(Instruction *inst, Animation *a, LocalVariabl case INST_INC: // inc case INST_DEC: // dec if (!scumm_stricmp(_tokens[1], "X")) { - inst->_opA._pvalue = &a->_zone.pos._position._x; + inst->_opA._pvalue = &a->_zone._left; } else if (!scumm_stricmp(_tokens[1], "Y")) { - inst->_opA._pvalue = &a->_zone.pos._position._y; + inst->_opA._pvalue = &a->_zone._top; } else if (!scumm_stricmp(_tokens[1], "Z")) { inst->_opA._pvalue = &a->_z; @@ -462,10 +462,10 @@ LValue getLValue(Instruction *inst, char *str, LocalVariable *locals, Animation } if (str[0] == 'X') { - v._pvalue = &a->_zone.pos._position._x; + v._pvalue = &a->_zone._left; } else if (str[0] == 'Y') { - v._pvalue = &a->_zone.pos._position._y; + v._pvalue = &a->_zone._top; } else if (str[0] == 'Z') { v._pvalue = &a->_z; @@ -489,7 +489,7 @@ void jobRunScripts(void *parm, Job *j) { StaticCnv v18; WalkNode *v4 = NULL; - if (a->_zone._flags & kFlagsCharacter) a->_z = a->_zone.pos._position._y + a->_cnv._height; + if (a->_zone._flags & kFlagsCharacter) a->_z = a->_zone._top + a->_cnv._height; for ( ; a; a = (Animation*)a->_zone._next) { if ((a->_zone._flags & kFlagsActing) == 0) continue; @@ -632,7 +632,7 @@ void jobRunScripts(void *parm, Job *j) { label1: if (a->_zone._flags & kFlagsCharacter) - a->_z = a->_zone.pos._position._y + a->_cnv._height; + a->_z = a->_zone._top + a->_cnv._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._limits._top; + _vm->_char._ani._z = _vm->_char._ani._cnv._height + _vm->_char._ani._zone._top; Animation *vC = (Animation*)_animations._next; Node *v8; diff --git a/engines/parallaction/callables.cpp b/engines/parallaction/callables.cpp index b422909010..8768c21da6 100644 --- a/engines/parallaction/callables.cpp +++ b/engines/parallaction/callables.cpp @@ -116,21 +116,21 @@ void _c_moveSarc(void *parm) { } } - _introSarcData1 = _introSarcData3 - _moveSarcZone1->_limits._left; + _introSarcData1 = _introSarcData3 - _moveSarcZone1->_left; a->_z = _introSarcData3; - a->_frame = _moveSarcZone1->_limits._top - (_introSarcData1 / 20); - _introSarcData3 = _moveSarcZone1->_limits._left; + a->_frame = _moveSarcZone1->_top - (_introSarcData1 / 20); + _introSarcData3 = _moveSarcZone1->_left; if (_introSarcData1 > 0) { - a->_zone.pos._position._x = _introSarcData1 / 2; + a->_zone._left = _introSarcData1 / 2; } else { - a->_zone.pos._position._x = -_introSarcData1 / 2; + a->_zone._left = -_introSarcData1 / 2; } if (_introSarcData1 > 0) { - a->_zone.pos._position._y = 2; + a->_zone._top = 2; } else { - a->_zone.pos._position._y = -2; + a->_zone._top = -2; } return; @@ -139,23 +139,23 @@ void _c_moveSarc(void *parm) { _introSarcData2 = 1; - _moveSarcZone1->_limits._right += _introSarcData1; - _moveSarcZone1->_limits._left += _introSarcData1; + _moveSarcZone1->_right += _introSarcData1; + _moveSarcZone1->_left += _introSarcData1; - _moveSarcZone1->_limits._top -= (_introSarcData1 / 20); - _moveSarcZone1->_limits._bottom -= (_introSarcData1 / 20); + _moveSarcZone1->_top -= (_introSarcData1 / 20); + _moveSarcZone1->_bottom -= (_introSarcData1 / 20); - _moveSarcZone0->_limits._right += _introSarcData1; - _moveSarcZone0->_limits._left += _introSarcData1; + _moveSarcZone0->_right += _introSarcData1; + _moveSarcZone0->_left += _introSarcData1; - _moveSarcZone0->_limits._top -= (_introSarcData1 / 20); - _moveSarcZone0->_limits._bottom -= (_introSarcData1 / 20); + _moveSarcZone0->_top -= (_introSarcData1 / 20); + _moveSarcZone0->_bottom -= (_introSarcData1 / 20); - if (_moveSarcZones[0]->_limits._left == 35 && - _moveSarcZones[1]->_limits._left == 68 && - _moveSarcZones[2]->_limits._left == 101 && - _moveSarcZones[3]->_limits._left == 134 && - _moveSarcZones[4]->_limits._left == 167) { + if (_moveSarcZones[0]->_left == 35 && + _moveSarcZones[1]->_left == 68 && + _moveSarcZones[2]->_left == 101 && + _moveSarcZones[3]->_left == 134 && + _moveSarcZones[4]->_left == 167) { a = findAnimation("finito"); diff --git a/engines/parallaction/intro.cpp b/engines/parallaction/intro.cpp index 0224702158..64eed32b91 100644 --- a/engines/parallaction/intro.cpp +++ b/engines/parallaction/intro.cpp @@ -313,8 +313,8 @@ void _c_sketch(void *parm) { introFunc1(_1, _2, _3, _4); - _rightHandAnim->_zone.pos._position._x = _rightHandPositions[index*2]; - _rightHandAnim->_zone.pos._position._y = _rightHandPositions[index*2+1] - 20; + _rightHandAnim->_zone._left = _rightHandPositions[index*2]; + _rightHandAnim->_zone._top = _rightHandPositions[index*2+1] - 20; index++; @@ -327,10 +327,10 @@ void _c_sketch(void *parm) { void _c_shade(void *parm) { Common::Rect r( - _rightHandAnim->_zone.pos._position._x - 36, - _rightHandAnim->_zone.pos._position._y - 36, - _rightHandAnim->_zone.pos._position._x, - _rightHandAnim->_zone.pos._position._y + _rightHandAnim->_zone._left - 36, + _rightHandAnim->_zone._top - 36, + _rightHandAnim->_zone._left, + _rightHandAnim->_zone._top ); _vm->_gfx->maskClearRectangle(r); diff --git a/engines/parallaction/location.cpp b/engines/parallaction/location.cpp index edd7b319cb..d285a99b68 100644 --- a/engines/parallaction/location.cpp +++ b/engines/parallaction/location.cpp @@ -92,8 +92,8 @@ void Parallaction::parseLocation(const char *filename) { switchBackground(_location._name, mask); if (_tokens[2][0] != '\0') { - _vm->_char._ani._zone.pos._position._x = atoi(_tokens[2]); - _vm->_char._ani._zone.pos._position._y = atoi(_tokens[3]); + _vm->_char._ani._zone._left = atoi(_tokens[2]); + _vm->_char._ani._zone._top = atoi(_tokens[3]); } if (_tokens[4][0] != '\0') { @@ -384,13 +384,13 @@ void Parallaction::changeLocation(char *location) { _gfx->copyScreen(Gfx::kBitBack, Gfx::kBit2); debugC(1, kDebugLocation, "changeLocation: new location '%s' parsed", _saveData1); - _vm->_char._ani._zone.pos._oldposition._x = -1000; - _vm->_char._ani._zone.pos._oldposition._y = -1000; + _vm->_char._ani._zone._oldposition._x = -1000; + _vm->_char._ani._zone._oldposition._y = -1000; _vm->_char._ani.field_50 = 0; if (_location._startPosition._x != -1000) { - _vm->_char._ani._zone.pos._position._x = _location._startPosition._x; - _vm->_char._ani._zone.pos._position._y = _location._startPosition._y; + _vm->_char._ani._zone._left = _location._startPosition._x; + _vm->_char._ani._zone._top = _location._startPosition._y; _vm->_char._ani._frame = _location._startFrame; _location._startPosition._y = -1000; _location._startPosition._x = -1000; diff --git a/engines/parallaction/parallaction.cpp b/engines/parallaction/parallaction.cpp index 52987850da..084300e37d 100644 --- a/engines/parallaction/parallaction.cpp +++ b/engines/parallaction/parallaction.cpp @@ -261,8 +261,8 @@ void Parallaction::initGame() { parseLocation(_location._name); if (_location._startPosition._x != -1000) { - _vm->_char._ani._zone.pos._position._x = _location._startPosition._x; - _vm->_char._ani._zone.pos._position._y = _location._startPosition._y; + _vm->_char._ani._zone._left = _location._startPosition._x; + _vm->_char._ani._zone._top = _location._startPosition._y; _vm->_char._ani._frame = _location._startFrame; _location._startPosition._y = -1000; _location._startPosition._x = -1000; diff --git a/engines/parallaction/parallaction.h b/engines/parallaction/parallaction.h index 0295f3e646..e6e1bf92c2 100644 --- a/engines/parallaction/parallaction.h +++ b/engines/parallaction/parallaction.h @@ -255,11 +255,11 @@ struct Character { _objs._count = 0; - _ani._zone.pos._position._x = 150; - _ani._zone.pos._position._y = 100; + _ani._zone._left = 150; + _ani._zone._top = 100; _ani._z = 10; - _ani._zone.pos._oldposition._x = -1000; - _ani._zone.pos._oldposition._y = -1000; + _ani._zone._oldposition._x = -1000; + _ani._zone._oldposition._y = -1000; _ani._frame = 0; _ani._zone._flags = kFlagsActive | kFlagsNoName; _ani._zone._type = kZoneYou; diff --git a/engines/parallaction/saveload.cpp b/engines/parallaction/saveload.cpp index 2b4f464258..e78dde1f82 100644 --- a/engines/parallaction/saveload.cpp +++ b/engines/parallaction/saveload.cpp @@ -175,9 +175,9 @@ void Parallaction::doSaveGame(uint16 slot, const char* name) { sprintf(s, "%s\n", _saveData1); f->writeString(s); - sprintf(s, "%d\n", _vm->_char._ani._zone.pos._position._x); + sprintf(s, "%d\n", _vm->_char._ani._zone._left); f->writeString(s); - sprintf(s, "%d\n", _vm->_char._ani._zone.pos._position._y); + sprintf(s, "%d\n", _vm->_char._ani._zone._top); f->writeString(s); sprintf(s, "%d\n", _score); f->writeString(s); diff --git a/engines/parallaction/walk.cpp b/engines/parallaction/walk.cpp index 152dc68d24..4418372f68 100644 --- a/engines/parallaction/walk.cpp +++ b/engines/parallaction/walk.cpp @@ -152,11 +152,11 @@ WalkNode *buildWalkPath(uint16 x, uint16 y) { v48 = &v58; - v20._x = _vm->_char._ani._zone.pos._position._x; - v20._y = _vm->_char._ani._zone.pos._position._y; + v20._x = _vm->_char._ani._zone._left; + v20._y = _vm->_char._ani._zone._top; - v8._x = _si - _vm->_char._ani._zone.pos._position._x; - v8._y = _di - _vm->_char._ani._zone.pos._position._y; + v8._x = _si - _vm->_char._ani._zone._left; + v8._y = _di - _vm->_char._ani._zone._top; v34 = v30 = dotProduct(&v8, &v8); // square distance from current position and target while (_closest_node_found != 0) { @@ -245,8 +245,8 @@ uint16 walkFunc1(int16 x, int16 y, WalkNode *Node) { Point v4 = { 0, 0 }; Point foot = { - _vm->_char._ani._zone.pos._position._x + _vm->_char._ani._cnv._width/2, - _vm->_char._ani._zone.pos._position._y + _vm->_char._ani._cnv._height + _vm->_char._ani._zone._left + _vm->_char._ani._cnv._width/2, + _vm->_char._ani._zone._top + _vm->_char._ani._cnv._height }; Point v8 = { @@ -316,13 +316,13 @@ uint16 walkFunc1(int16 x, int16 y, WalkNode *Node) { void jobWalk(void *parm, Job *j) { WalkNode *node = (WalkNode*)parm; - int16 _si = _vm->_char._ani._zone.pos._position._x; - int16 _di = _vm->_char._ani._zone.pos._position._y; + 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); - _vm->_char._ani._zone.pos._oldposition._x = _si; - _vm->_char._ani._zone.pos._oldposition._y = _di; + _vm->_char._ani._zone._oldposition._x = _si; + _vm->_char._ani._zone._oldposition._y = _di; if ((node->_x == _si) && (node->_y == _di)) { if (node->_next == NULL) { @@ -346,8 +346,8 @@ void jobWalk(void *parm, Job *j) { } Point dist = { - node->_x - _vm->_char._ani._zone.pos._position._x, - node->_y - _vm->_char._ani._zone.pos._position._y + node->_x - _vm->_char._ani._zone._left, + node->_y - _vm->_char._ani._zone._top }; if (dist._x < 0) @@ -412,10 +412,10 @@ void jobWalk(void *parm, Job *j) { } // printf("hitZone: %i, %i\n", _si, _di); - _vm->_char._ani._zone.pos._position._x = _si; - _vm->_char._ani._zone.pos._position._y = _di; + _vm->_char._ani._zone._left = _si; + _vm->_char._ani._zone._top = _di; - if ((_si == _vm->_char._ani._zone.pos._oldposition._x) && (_di == _vm->_char._ani._zone.pos._oldposition._y)) { + if ((_si == _vm->_char._ani._zone._oldposition._x) && (_di == _vm->_char._ani._zone._oldposition._y)) { j->_finished = 1; checkDoor(); @@ -440,7 +440,7 @@ uint16 checkDoor() { } _engineFlags &= ~kEngineWalking; - Zone *z = hitZone(kZoneDoor, _vm->_char._ani._zone.pos._position._x + _vm->_char._ani._cnv._width / 2, _vm->_char._ani._zone.pos._position._y + _vm->_char._ani._cnv._height); + 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); if (z != NULL) { @@ -458,7 +458,7 @@ uint16 checkDoor() { } } - z = hitZone(kZoneTrap, _vm->_char._ani._zone.pos._position._x + _vm->_char._ani._cnv._width / 2, _vm->_char._ani._zone.pos._position._y + _vm->_char._ani._cnv._height); + z = hitZone(kZoneTrap, _vm->_char._ani._zone._left + _vm->_char._ani._cnv._width / 2, _vm->_char._ani._zone._top + _vm->_char._ani._cnv._height); if (z != NULL) { _localFlags[_vm->_currentLocationIndex] |= kFlagsEnter; diff --git a/engines/parallaction/zone.cpp b/engines/parallaction/zone.cpp index 8ce938be5f..13709f57de 100644 --- a/engines/parallaction/zone.cpp +++ b/engines/parallaction/zone.cpp @@ -77,10 +77,10 @@ void Parallaction::parseZone(Script &script, Node *list, char *name) { // printf("token[0] = %s", _tokens[0]); if (!scumm_stricmp(_tokens[0], "limits")) { - z->_limits._left = atoi(_tokens[1]); - z->_limits._top = atoi(_tokens[2]); - z->_limits._right = atoi(_tokens[3]); - z->_limits._bottom = atoi(_tokens[4]); + z->_left = atoi(_tokens[1]); + z->_top = atoi(_tokens[2]); + z->_right = atoi(_tokens[3]); + z->_bottom = atoi(_tokens[4]); } if (!scumm_stricmp(_tokens[0], "moveto")) { z->_moveTo._x = atoi(_tokens[1]); @@ -131,8 +131,8 @@ void freeZones(Node *list) { // WORKAROUND: this huge condition is needed because we made ZoneTypeData a collection of structs // instead of an union. So, merge->_obj1 and get->_icon were just aliases in the original engine, // but we need to check it separately here. The same workaround is applied in hitZone. - if (((z->_limits._top == -1) || - ((z->_limits._left == -2) && ( + if (((z->_top == -1) || + ((z->_left == -2) && ( (((z->_type & 0xFFFF) == kZoneMerge) && ((isItemInInventory(MAKE_INVENTORY_ID(z->u.merge->_obj1)) != 0) || (isItemInInventory(MAKE_INVENTORY_ID(z->u.merge->_obj2)) != 0))) || (((z->_type & 0xFFFF) == kZoneGet) && ((isItemInInventory(MAKE_INVENTORY_ID(z->u.get->_icon)) != 0))) ))) && @@ -293,9 +293,9 @@ void Parallaction::parseZoneTypeBlock(Script &script, Zone *z) { // vE0._data1 = doorcnv->field_8[_ax]; u->door->_background = (byte*)malloc(vE0._width*vE0._height); - _gfx->backupDoorBackground(u->door, z->_limits._left, z->_limits._top); + _gfx->backupDoorBackground(u->door, z->_left, z->_top); - _gfx->flatBlitCnv(&vE0, z->_limits._left, z->_limits._top, Gfx::kBitBack, vE0._data1); + _gfx->flatBlitCnv(&vE0, z->_left, z->_top, Gfx::kBitBack, vE0._data1); } if (!scumm_stricmp(_tokens[0], "startpos")) { @@ -313,8 +313,8 @@ void Parallaction::parseZoneTypeBlock(Script &script, Zone *z) { u->get->_backup = (byte*)malloc(vE4->_width*vE4->_height); if ((z->_flags & kFlagsRemove) == 0) { - _gfx->backupGetBackground(u->get, z->_limits._left, z->_limits._top); - _gfx->flatBlitCnv(vE4, z->_limits._left, z->_limits._top, Gfx::kBitBack, vE4->_data1); + _gfx->backupGetBackground(u->get, z->_left, z->_top); + _gfx->flatBlitCnv(vE4, z->_left, z->_top, Gfx::kBitBack, vE4->_data1); } } @@ -490,7 +490,7 @@ void jobToggleDoor(void *parm, Job *j) { v14._width = v18->_width; v14._height = v18->_height; - Common::Rect r(z->_limits._left, z->_limits._top, z->_limits._left+v18->_width, z->_limits._top+v18->_height); + Common::Rect r(z->_left, z->_top, z->_left+v18->_width, z->_top+v18->_height); _vm->_gfx->restoreZoneBackground(r, z->u.door->_background); @@ -498,8 +498,8 @@ void jobToggleDoor(void *parm, Job *j) { v14._data0 = v18->_array[_ax]; - _vm->_gfx->flatBlitCnv(&v14, z->_limits._left, z->_limits._top, Gfx::kBitBack, v14._data1); - _vm->_gfx->flatBlitCnv(&v14, z->_limits._left, z->_limits._top, Gfx::kBit2, v14._data1); + _vm->_gfx->flatBlitCnv(&v14, z->_left, z->_top, Gfx::kBitBack, v14._data1); + _vm->_gfx->flatBlitCnv(&v14, z->_left, z->_top, Gfx::kBit2, v14._data1); } count++; @@ -527,7 +527,7 @@ void jobRemovePickedItem(void *parm, Job *j) { static uint16 count = 0; if (z->u.get->_cnv._width != 0) { - Common::Rect r(z->_limits._left, z->_limits._top, z->_limits._left + z->u.get->_cnv._width, z->_limits._top + z->u.get->_cnv._height); + Common::Rect r(z->_left, z->_top, z->_left + z->u.get->_cnv._width, z->_top + z->u.get->_cnv._height); _vm->_gfx->restoreZoneBackground(r, z->u.get->_backup); } @@ -548,11 +548,11 @@ void jobDisplayDroppedItem(void *parm, Job *j) { if (&z->u.get->_cnv != NULL) { if (z->u.get->_cnv._data0 != NULL) { - _vm->_gfx->backupGetBackground(z->u.get, z->_limits._left, z->_limits._top); + _vm->_gfx->backupGetBackground(z->u.get, z->_left, z->_top); } - _vm->_gfx->flatBlitCnv(&z->u.get->_cnv, z->_limits._left, z->_limits._top, Gfx::kBitBack, z->u.get->_cnv._data1); - _vm->_gfx->flatBlitCnv(&z->u.get->_cnv, z->_limits._left, z->_limits._top, Gfx::kBit2, z->u.get->_cnv._data1); + _vm->_gfx->flatBlitCnv(&z->u.get->_cnv, z->_left, z->_top, Gfx::kBitBack, z->u.get->_cnv._data1); + _vm->_gfx->flatBlitCnv(&z->u.get->_cnv, z->_left, z->_top, Gfx::kBit2, z->u.get->_cnv._data1); } j->_count++; @@ -581,13 +581,13 @@ Zone *hitZone(uint32 type, uint16 x, uint16 y) { if (z->_flags & kFlagsRemove) continue; - if ((_si >= z->_limits._right) || - (_si <= z->_limits._left) || - (_di >= z->_limits._bottom) || - (_di <= z->_limits._top)) { + if ((_si >= z->_right) || + (_si <= z->_left) || + (_di >= z->_bottom) || + (_di <= z->_top)) { // out of Zone, so look for special values - if ((z->_limits._left == -2) || (z->_limits._left == -3)) { + if ((z->_left == -2) || (z->_left == -3)) { // WORKAROUND: this huge condition is needed because we made ZoneTypeData a collection of structs // instead of an union. So, merge->_obj1 and get->_icon were just aliases in the original engine, @@ -606,15 +606,15 @@ Zone *hitZone(uint32 type, uint16 x, uint16 y) { } } - if (z->_limits._left != -1) + if (z->_left != -1) continue; - if (_si < _vm->_char._ani._zone.pos._position._x) + if (_si < _vm->_char._ani._zone._left) continue; - if (_si > (_vm->_char._ani._zone.pos._position._x + _vm->_char._ani._cnv._width)) + if (_si > (_vm->_char._ani._zone._left + _vm->_char._ani._cnv._width)) continue; - if (_di < _vm->_char._ani._zone.pos._position._y) + if (_di < _vm->_char._ani._zone._top) continue; - if (_di > (_vm->_char._ani._zone.pos._position._y + _vm->_char._ani._cnv._height)) + if (_di > (_vm->_char._ani._zone._top + _vm->_char._ani._cnv._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.pos._position._x + a->_cnv._width) || (_si <= a->_zone.pos._position._x)) ? 0 : 1; // _e: horizontal range - _f = ((_di >= a->_zone.pos._position._y + a->_cnv._height) || (_di <= a->_zone.pos._position._y)) ? 0 : 1; // _f: vertical range + _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 _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 f9d9ce6a0b..8a32f1f5f0 100644 --- a/engines/parallaction/zone.h +++ b/engines/parallaction/zone.h @@ -124,13 +124,13 @@ struct ZoneLabel { }; struct Zone : public Node { - union { - Rect _limits; // for zones - struct { // for animations - Point _position; - Point _oldposition; - } pos; - }; + + int16 _left; + int16 _top; + int16 _right; + int16 _bottom; + Point _oldposition; + uint32 _type; uint32 _flags; // char* _labeltext; -- cgit v1.2.3