aboutsummaryrefslogtreecommitdiff
path: root/engines/parallaction
diff options
context:
space:
mode:
authorNicola Mettifogo2007-02-10 21:00:15 +0000
committerNicola Mettifogo2007-02-10 21:00:15 +0000
commitb8087fe1a82f87bc0b972f65309692f65370da85 (patch)
treeb744fa45bd9583ddb9c52277702c65c40f955087 /engines/parallaction
parentdcfd2e922486654037f3e93ff4338d4a38b20729 (diff)
downloadscummvm-rg350-b8087fe1a82f87bc0b972f65309692f65370da85.tar.gz
scummvm-rg350-b8087fe1a82f87bc0b972f65309692f65370da85.tar.bz2
scummvm-rg350-b8087fe1a82f87bc0b972f65309692f65370da85.zip
fixed wrong implementation: zones and animations now survive location switches according to their properties and/or system flags
svn-id: r25478
Diffstat (limited to 'engines/parallaction')
-rw-r--r--engines/parallaction/location.cpp7
-rw-r--r--engines/parallaction/zone.cpp10
2 files changed, 11 insertions, 6 deletions
diff --git a/engines/parallaction/location.cpp b/engines/parallaction/location.cpp
index 4e9bf11bf3..e437b606e0 100644
--- a/engines/parallaction/location.cpp
+++ b/engines/parallaction/location.cpp
@@ -36,6 +36,7 @@ void switchBackground(char *name);
void parseWalkNodes(ArchivedFile *file, Node *list);
void freeAnimations();
+Node helperNode = { NULL, NULL };
void Parallaction::parseLocation(const char *filename) {
// printf("parseLocation(%s)", filename);
@@ -217,15 +218,17 @@ void freeLocation() {
_locationWalkNodes._next = NULL;
debugC(7, kDebugLocation, "freeLocation: walk nodes freed");
+ helperNode._prev = helperNode._next = NULL;
freeZones(_zones._next);
freeNodeList(_zones._next);
- memset(&_zones, 0, sizeof(Node));
+ memcpy(&_zones, &helperNode, sizeof(Node));
debugC(7, kDebugLocation, "freeLocation: zones freed");
+ helperNode._prev = helperNode._next = NULL;
freeZones(_animations._next);
freeAnimations();
freeNodeList(_animations._next);
- memset(&_animations, 0, sizeof(Node));
+ memcpy(&_animations, &helperNode, sizeof(Node));
debugC(7, kDebugLocation, "freeLocation: animations freed");
if (_locationComment) {
diff --git a/engines/parallaction/zone.cpp b/engines/parallaction/zone.cpp
index 46de82dfdc..e065fd849e 100644
--- a/engines/parallaction/zone.cpp
+++ b/engines/parallaction/zone.cpp
@@ -36,6 +36,8 @@ void freeDialogue(Dialogue *d);
Node _zones = { NULL, NULL };
Node _animations = { NULL, NULL };
+extern Node helperNode;
+
Zone *findZone(const char *name) {
Zone *v4 = (Zone*)_zones._next;
@@ -124,9 +126,7 @@ void freeZones(Node *list) {
Zone *z = (Zone*)list;
Zone *v8 = NULL;
- Node nullNode = { 0, 0 };
-
- for (; z; z=(Zone*)z->_node._next) {
+ for (; z; ) {
// TODO: understand and simplify this monster
if (((z->_limits._top == -1) || ((z->_limits._left == -2) && ((isItemInInventory(z->u.merge->_obj1) != 0) || (isItemInInventory(z->u.merge->_obj2) != 0)))) &&
@@ -136,7 +136,7 @@ void freeZones(Node *list) {
v8 = (Zone*)z->_node._next;
removeNode(&z->_node);
- addNode(&nullNode, &z->_node);
+ addNode(&helperNode, &z->_node);
z = v8;
continue;
}
@@ -184,6 +184,8 @@ void freeZones(Node *list) {
_vm->_graphics->freeStaticCnv(&z->_label._cnv);
freeCommands(z->_commands);
+ z=(Zone*)z->_node._next;
+
}
return;