diff options
author | Nicola Mettifogo | 2009-03-29 13:56:16 +0000 |
---|---|---|
committer | Nicola Mettifogo | 2009-03-29 13:56:16 +0000 |
commit | 666f0720ab801e8e9df4a8e65f452044b110f7b2 (patch) | |
tree | 92ab19ec096d2335463e6545ee8ca215f8e5b451 /engines/parallaction | |
parent | 340b0e632eabec16a9ee07545bc57b9ca6f78660 (diff) | |
download | scummvm-rg350-666f0720ab801e8e9df4a8e65f452044b110f7b2.tar.gz scummvm-rg350-666f0720ab801e8e9df4a8e65f452044b110f7b2.tar.bz2 scummvm-rg350-666f0720ab801e8e9df4a8e65f452044b110f7b2.zip |
(Re)link bounding animations after location has been completely parsed. This avoids problems due to forward references.
svn-id: r39740
Diffstat (limited to 'engines/parallaction')
-rw-r--r-- | engines/parallaction/exec_br.cpp | 5 | ||||
-rw-r--r-- | engines/parallaction/objects.cpp | 4 | ||||
-rw-r--r-- | engines/parallaction/objects.h | 2 | ||||
-rw-r--r-- | engines/parallaction/parallaction.cpp | 4 | ||||
-rw-r--r-- | engines/parallaction/parallaction_br.cpp | 8 | ||||
-rw-r--r-- | engines/parallaction/parser_br.cpp | 3 |
6 files changed, 13 insertions, 13 deletions
diff --git a/engines/parallaction/exec_br.cpp b/engines/parallaction/exec_br.cpp index 8821db4e3c..c333a284da 100644 --- a/engines/parallaction/exec_br.cpp +++ b/engines/parallaction/exec_br.cpp @@ -115,14 +115,11 @@ void Parallaction_br::clearSubtitles() { DECLARE_COMMAND_OPCODE(location) { - warning("Parallaction_br::cmdOp_location command not yet implemented"); - _vm->_location._startPosition = ctxt._cmd->_startPos; - _vm->_location._startFrame = 0; // TODO: verify this against the disassembly!f + _vm->_location._startFrame = 0; _vm->_location._followerStartPosition = ctxt._cmd->_startPos2; _vm->_location._followerStartFrame = 0; - // TODO: handle startPos and startPos2 _vm->scheduleLocationSwitch(ctxt._cmd->_string); } diff --git a/engines/parallaction/objects.cpp b/engines/parallaction/objects.cpp index f1309c6919..85e0215956 100644 --- a/engines/parallaction/objects.cpp +++ b/engines/parallaction/objects.cpp @@ -201,13 +201,9 @@ Zone::Zone() { // BRA specific _index = INVALID_ZONE_INDEX; _locationIndex = INVALID_LOCATION_INDEX; - _linkedName = 0; } Zone::~Zone() { -// printf("~Zone(%s)\n", _name); - - free(_linkedName); } void Zone::translate(int16 x, int16 y) { diff --git a/engines/parallaction/objects.h b/engines/parallaction/objects.h index 4c02d94334..c6ebeb7850 100644 --- a/engines/parallaction/objects.h +++ b/engines/parallaction/objects.h @@ -281,7 +281,7 @@ public: // BRA specific uint _index; uint _locationIndex; - char *_linkedName; + Common::String _linkedName; AnimationPtr _linkedAnim; Zone(); diff --git a/engines/parallaction/parallaction.cpp b/engines/parallaction/parallaction.cpp index ffb336f40f..be33bfdaa9 100644 --- a/engines/parallaction/parallaction.cpp +++ b/engines/parallaction/parallaction.cpp @@ -728,7 +728,9 @@ bool Parallaction::checkLinkedAnimBox(ZonePtr z, uint32 type, uint x, uint y) { if (z->_flags & kFlagsRemove) return false; - if ((z->_flags & kFlagsAnimLinked) == 0) + // flag kFlagsAnimLinked may be on, but the animation may not be loaded, so + // we must use the animation reference to check here + if (!z->_linkedAnim) return false; debugC(5, kDebugExec, "checkLinkedAnimBox for %s (type = %x, x = %i, y = %i)", z->_name, type, x, y); diff --git a/engines/parallaction/parallaction_br.cpp b/engines/parallaction/parallaction_br.cpp index 73ab2c0bb6..7d641b530f 100644 --- a/engines/parallaction/parallaction_br.cpp +++ b/engines/parallaction/parallaction_br.cpp @@ -360,8 +360,14 @@ void Parallaction_br::parseLocation(const char *filename) { ZoneList::iterator zit = _vm->_location._zones.begin(); for ( ; zit != _vm->_location._zones.end(); ++zit) { + ZonePtr z = *zit; // restore the flags if the location has already been visited - restoreOrSaveZoneFlags(*zit, visited); + restoreOrSaveZoneFlags(z, visited); + + // (re)link the bounding animation if needed + if (z->_flags & kFlagsAnimLinked) { + z->_linkedAnim = _location.findAnimation(z->_linkedName.c_str()); + } } debugC(1, kDebugParser, "parseLocation('%s') done", filename); diff --git a/engines/parallaction/parser_br.cpp b/engines/parallaction/parser_br.cpp index 618bba254e..8bb034986b 100644 --- a/engines/parallaction/parser_br.cpp +++ b/engines/parallaction/parser_br.cpp @@ -717,8 +717,7 @@ DECLARE_ZONE_PARSER(limits) { if (isalpha(_tokens[1][1])) { ctxt.z->_flags |= kFlagsAnimLinked; - ctxt.z->_linkedAnim = _vm->_location.findAnimation(_tokens[1]); - ctxt.z->_linkedName = strdup(_tokens[1]); + ctxt.z->_linkedName = _tokens[1]; } else { ctxt.z->setRect(atoi(_tokens[1]), atoi(_tokens[2]), atoi(_tokens[3]), atoi(_tokens[4])); } |