From b8087fe1a82f87bc0b972f65309692f65370da85 Mon Sep 17 00:00:00 2001 From: Nicola Mettifogo Date: Sat, 10 Feb 2007 21:00:15 +0000 Subject: fixed wrong implementation: zones and animations now survive location switches according to their properties and/or system flags svn-id: r25478 --- engines/parallaction/location.cpp | 7 +++++-- engines/parallaction/zone.cpp | 10 ++++++---- 2 files changed, 11 insertions(+), 6 deletions(-) (limited to 'engines/parallaction') 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; -- cgit v1.2.3