aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorNicola Mettifogo2007-05-18 20:05:08 +0000
committerNicola Mettifogo2007-05-18 20:05:08 +0000
commit342d1aa48f0ccf97dd156485cd170c3c3854866a (patch)
treea15b85c17ba3f98d719ca57d6db9e797f147d39d /engines
parent93e41222b5d2e938c66dc7cf249da6c3ec7f409c (diff)
downloadscummvm-rg350-342d1aa48f0ccf97dd156485cd170c3c3854866a.tar.gz
scummvm-rg350-342d1aa48f0ccf97dd156485cd170c3c3854866a.tar.bz2
scummvm-rg350-342d1aa48f0ccf97dd156485cd170c3c3854866a.zip
Reverting my last change.
svn-id: r26866
Diffstat (limited to 'engines')
-rw-r--r--engines/parallaction/animation.cpp2
-rw-r--r--engines/parallaction/commands.cpp2
-rw-r--r--engines/parallaction/parallaction.cpp4
-rw-r--r--engines/parallaction/zone.cpp32
-rw-r--r--engines/parallaction/zone.h9
5 files changed, 23 insertions, 26 deletions
diff --git a/engines/parallaction/animation.cpp b/engines/parallaction/animation.cpp
index 73e8672f3d..67dc25994e 100644
--- a/engines/parallaction/animation.cpp
+++ b/engines/parallaction/animation.cpp
@@ -93,7 +93,7 @@ Animation *Parallaction::parseAnimation(Script& script, AnimationList &list, cha
int16 _si = _zoneTypeNames->lookup(_tokens[1]);
if (_si != -1) {
vD0->_type |= 1 << (_si-1);
- if ((vD0->type() != kZoneNone) && (vD0->type() != kZoneCommand)) {
+ if (((vD0->_type & 0xFFFF) != kZoneNone) && ((vD0->_type & 0xFFFF) != kZoneCommand)) {
parseZoneTypeBlock(script, vD0);
}
}
diff --git a/engines/parallaction/commands.cpp b/engines/parallaction/commands.cpp
index e9a2354c8b..d53763dfa8 100644
--- a/engines/parallaction/commands.cpp
+++ b/engines/parallaction/commands.cpp
@@ -283,7 +283,7 @@ void Parallaction::runCommands(CommandList& list, Zone *z) {
if (u->_zone != NULL) {
u->_zone->_flags &= ~kFlagsRemove;
u->_zone->_flags |= kFlagsActive;
- if (u->_zone->type() == kZoneGet) {
+ if ((u->_zone->_type & 0xFFFF) == kZoneGet) {
addJob(&jobDisplayDroppedItem, u->_zone, kPriority17 );
}
}
diff --git a/engines/parallaction/parallaction.cpp b/engines/parallaction/parallaction.cpp
index f21e6e9a5e..6095e43c40 100644
--- a/engines/parallaction/parallaction.cpp
+++ b/engines/parallaction/parallaction.cpp
@@ -561,7 +561,7 @@ Parallaction::InputData *Parallaction::translateInput() {
return &_input;
}
- if (((_mouseButtons == kMouseLeftUp) && (_activeItem._id == 0) && ((_engineFlags & kEngineWalking) == 0)) && ((z == NULL) || (z->type() != kZoneCommand))) {
+ if (((_mouseButtons == kMouseLeftUp) && (_activeItem._id == 0) && ((_engineFlags & kEngineWalking) == 0)) && ((z == NULL) || ((z->_type & 0xFFFF) != kZoneCommand))) {
_input._event = kEvWalk;
return &_input;
}
@@ -584,7 +584,7 @@ Parallaction::InputData *Parallaction::translateInput() {
return &_input;
}
- if ((_mouseButtons == kMouseLeftUp) && ((_activeItem._id != 0) || (z->type() == kZoneCommand))) {
+ if ((_mouseButtons == kMouseLeftUp) && ((_activeItem._id != 0) || ((z->_type & 0xFFFF) == kZoneCommand))) {
_input._zone = z;
if (z->_flags & kFlagsNoWalk) {
diff --git a/engines/parallaction/zone.cpp b/engines/parallaction/zone.cpp
index 43c3899e5b..176df5a9bc 100644
--- a/engines/parallaction/zone.cpp
+++ b/engines/parallaction/zone.cpp
@@ -121,8 +121,8 @@ void Parallaction::freeZones() {
// but we need to check it separately here. The same workaround is applied in hitZone.
if (((z->_top == -1) ||
((z->_left == -2) && (
- ((z->type() == kZoneMerge) && ((isItemInInventory(MAKE_INVENTORY_ID(z->u.merge->_obj1)) != 0) || (isItemInInventory(MAKE_INVENTORY_ID(z->u.merge->_obj2)) != 0))) ||
- ((z->type() == kZoneGet) && ((isItemInInventory(MAKE_INVENTORY_ID(z->u.get->_icon)) != 0)))
+ (((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)))
))) &&
((_engineFlags & kEngineQuit) == 0)) {
@@ -152,7 +152,7 @@ void Parallaction::parseZoneTypeBlock(Script &script, Zone *z) {
TypeData *u = &z->u;
- switch (z->type()) {
+ switch (z->_type & 0xFFFF) {
case kZoneExamine: // examine Zone alloc
u->examine = new ExamineData;
break;
@@ -185,7 +185,7 @@ void Parallaction::parseZoneTypeBlock(Script &script, Zone *z) {
do {
- switch (z->type()) {
+ switch (z->_type & 0xFFFF) {
case kZoneExamine: // examine Zone init
if (!scumm_stricmp(_tokens[0], "file")) {
u->examine->_filename = (char*)malloc(strlen(_tokens[1])+1);
@@ -374,8 +374,10 @@ void Parallaction::displayItemComment(ExamineData *data) {
uint16 Parallaction::runZone(Zone *z) {
debugC(3, kDebugLocation, "runZone (%s)", z->_label._text);
- debugC(3, kDebugLocation, "type = %x, id = %x",z->type(), z->boundId() >> 16);
- switch(z->type()) {
+ uint16 subtype = z->_type & 0xFFFF;
+
+ debugC(3, kDebugLocation, "type = %x, object = %x", subtype, (z->_type & 0xFFFF0000) >> 16);
+ switch(subtype) {
case kZoneExamine:
if (z->u.examine->_filename) {
@@ -542,15 +544,15 @@ Zone *Parallaction::hitZone(uint32 type, uint16 x, uint16 y) {
// WORKAROUND: this huge condition is needed because we made TypeData 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 freeZones.
- if (((z->type() == kZoneMerge) && (((_si == z->u.merge->_obj1) && (_di == z->u.merge->_obj2)) || ((_si == z->u.merge->_obj2) && (_di == z->u.merge->_obj1)))) ||
- ((z->type() == kZoneGet) && ((_si == z->u.get->_icon) || (_di == z->u.get->_icon)))) {
+ if ((((z->_type & 0xFFFF) == kZoneMerge) && (((_si == z->u.merge->_obj1) && (_di == z->u.merge->_obj2)) || ((_si == z->u.merge->_obj2) && (_di == z->u.merge->_obj1)))) ||
+ (((z->_type & 0xFFFF) == kZoneGet) && ((_si == z->u.get->_icon) || (_di == z->u.get->_icon)))) {
// special Zone
- if ((type == 0) && (z->boundId() == 0 == 0))
+ if ((type == 0) && ((z->_type & 0xFFFF0000) == 0))
return z;
if (z->_type == type)
return z;
- if (z->boundId() == type)
+ if ((z->_type & 0xFFFF0000) == type)
return z;
}
@@ -570,11 +572,11 @@ Zone *Parallaction::hitZone(uint32 type, uint16 x, uint16 y) {
}
// normal Zone
- if ((type == 0) && (z->boundId() == 0))
+ if ((type == 0) && ((z->_type & 0xFFFF0000) == 0))
return z;
if (z->_type == type)
return z;
- if (z->boundId() == type)
+ if ((z->_type & 0xFFFF0000) == type)
return z;
}
@@ -590,8 +592,8 @@ Zone *Parallaction::hitZone(uint32 type, uint16 x, uint16 y) {
_f = ((_di >= a->_top + a->height()) || (_di <= a->_top)) ? 0 : 1; // _f: vertical range
_b = ((type != 0) || (a->_type == kZoneYou)) ? 0 : 1; // _b: (no type specified) AND (Animation is not the character)
- _c = (a->boundId()) ? 0 : 1; // _c: Animation is not an object
- _d = (a->boundId() != type) ? 0 : 1; // _d: Animation is an object of the same type
+ _c = (a->_type & 0xFFFF0000) ? 0 : 1; // _c: Animation is not an object
+ _d = ((a->_type & 0xFFFF0000) != type) ? 0 : 1; // _d: Animation is an object of the same type
if ((_a != 0 && _e != 0 && _f != 0) && ((_b != 0 && _c != 0) || (a->_type == type) || (_d != 0))) {
@@ -615,7 +617,7 @@ Zone::Zone() {
Zone::~Zone() {
// printf("~Zone(%s)\n", _label._text);
- switch (type()) {
+ switch (_type & 0xFFFF) {
case kZoneExamine:
free(u.examine->_filename);
free(u.examine->_description);
diff --git a/engines/parallaction/zone.h b/engines/parallaction/zone.h
index f52e4bdeb6..a2a852f31c 100644
--- a/engines/parallaction/zone.h
+++ b/engines/parallaction/zone.h
@@ -48,6 +48,7 @@ enum ZoneTypes {
kZoneCommand = 0x800
};
+
enum ZoneFlags {
kFlagsClosed = 1, // Zone: door is closed / switch is off
kFlagsActive = 2, // Zone/Animation: object is visible
@@ -63,6 +64,7 @@ enum ZoneFlags {
kFlagsNoWalk = 0x800 // Zone: character doesn't need to walk towards object to interact
};
+
#define NUM_ANSWERS 5
struct Command;
@@ -212,13 +214,6 @@ struct Zone {
void translate(int16 x, int16 y);
virtual uint16 width() const;
virtual uint16 height() const;
-
- uint32 type() {
- return _type & 0xFFFF;
- }
- uint32 boundId() {
- return (_type & 0xFFFF0000);
- }
};
typedef Zone* ZonePointer;