diff options
author | Nicola Mettifogo | 2008-08-02 02:24:36 +0000 |
---|---|---|
committer | Nicola Mettifogo | 2008-08-02 02:24:36 +0000 |
commit | 15aada52c4d641e54bc6c15af0999b5ea47a9025 (patch) | |
tree | a55e78b5a278d1934b8c46a016bbcd23c7c77c79 /engines/parallaction/parser_br.cpp | |
parent | a89fb6b7fb886e2bdb4ca0975b8aa075914c638a (diff) | |
download | scummvm-rg350-15aada52c4d641e54bc6c15af0999b5ea47a9025.tar.gz scummvm-rg350-15aada52c4d641e54bc6c15af0999b5ea47a9025.tar.bz2 scummvm-rg350-15aada52c4d641e54bc6c15af0999b5ea47a9025.zip |
* Added a preprocessor to deal with the crappy location scripts in BRA.
* Added some comments on how the parser and related code should be changed to make things smoother.
svn-id: r33509
Diffstat (limited to 'engines/parallaction/parser_br.cpp')
-rw-r--r-- | engines/parallaction/parser_br.cpp | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/engines/parallaction/parser_br.cpp b/engines/parallaction/parser_br.cpp index 3b446805d7..a4298bbedb 100644 --- a/engines/parallaction/parser_br.cpp +++ b/engines/parallaction/parser_br.cpp @@ -25,6 +25,8 @@ #include "parallaction/parallaction.h" +#include "parallaction/preprocessor.h" + #include "parallaction/sound.h" namespace Parallaction { @@ -104,6 +106,7 @@ namespace Parallaction { #define INST_ENDIF 30 #define INST_STOP 31 + const char *_zoneTypeNamesRes_br[] = { "examine", "door", @@ -1168,8 +1171,27 @@ void ProgramParser_br::init() { INSTRUCTION_PARSER(endscript); } + +/* + Ancillary routine to support hooking preprocessor and + parser. +*/ +Common::ReadStream *getStream(StatementList &list) { + Common::String text; + StatementList::iterator it = list.begin(); + for ( ; it != list.end(); it++) { + text += (*it)._text; + } + return new ReadStringStream(text); +} + void LocationParser_br::parse(Script *script) { + PreProcessor pp; + StatementList list; + pp.preprocessScript(*script, list); + Script *script2 = new Script(getStream(list), true); + ctxt.numZones = 0; ctxt.bgName = 0; ctxt.maskName = 0; @@ -1177,7 +1199,7 @@ void LocationParser_br::parse(Script *script) { ctxt.characterName = 0; ctxt.info = new BackgroundInfo; - LocationParser_ns::parse(script); + LocationParser_ns::parse(script2); _vm->_disk->loadScenery(*ctxt.info, ctxt.bgName, ctxt.maskName, ctxt.pathName); _vm->_gfx->setBackground(kBackgroundLocation, ctxt.info); @@ -1193,6 +1215,7 @@ void LocationParser_br::parse(Script *script) { free(ctxt.pathName); free(ctxt.characterName); + delete script2; } } // namespace Parallaction |