Postpone loading of mask and path data on BRA. This fixed locations in which mask and path are defined before the screen bitmap.

svn-id: r39512
This commit is contained in:
Nicola Mettifogo 2009-03-18 10:55:05 +00:00
parent e5a640b097
commit 739181c3b7
2 changed files with 13 additions and 18 deletions

View File

@ -133,6 +133,8 @@ protected:
int numZones;
BackgroundInfo *info;
char *characterName;
Common::String _maskName;
Common::String _pathName;
} ctxt;
void warning_unexpected();
@ -244,23 +246,7 @@ public:
};
/*
TODO: adapt the parser to effectively use the
statement list provided by preprocessor as its
input, instead of relying on the current Script
class.
This would need a major rewrite of the parsing
system!
parseNextToken could then be sealed into the
PreProcessor class forever, together with the
_tokens[] and _numTokens stuff, now dangling as
global objects.
NS balloons code should be dealt with before,
though.
*/
class LocationParser_br : public LocationParser_ns {
protected:

View File

@ -466,14 +466,16 @@ DECLARE_LOCATION_PARSER(mask) {
ctxt.info->layers[2] = atoi(_tokens[3]);
ctxt.info->layers[3] = atoi(_tokens[4]);
_vm->_disk->loadScenery(*ctxt.info, 0, _tokens[1], 0);
// postpone loading of screen mask data, because background must be loaded first
ctxt._maskName = _tokens[1];
}
DECLARE_LOCATION_PARSER(path) {
debugC(7, kDebugParser, "LOCATION_PARSER(path) ");
_vm->_disk->loadScenery(*ctxt.info, 0, 0, _tokens[1]);
// postpone loading of screen path data, because background must be loaded first
ctxt._pathName = _tokens[1];
}
@ -1297,9 +1299,16 @@ void LocationParser_br::parse(Script *script) {
ctxt.numZones = 0;
ctxt.characterName = 0;
ctxt.info = new BackgroundInfo;
ctxt._pathName.clear();
ctxt._maskName.clear();
LocationParser_ns::parse(script);
// finally load mask and path, if any
_vm->_disk->loadScenery(*ctxt.info, 0,
ctxt._maskName.empty() ? 0 : ctxt._maskName.c_str(),
ctxt._pathName.empty() ? 0 : ctxt._pathName.c_str());
_vm->_gfx->setBackground(kBackgroundLocation, ctxt.info);
ZoneList::iterator it = _vm->_location._zones.begin();