From 85171eadaae2f54581239b2723a02eab87a50f88 Mon Sep 17 00:00:00 2001 From: Nicola Mettifogo Date: Sun, 3 Feb 2008 14:58:16 +0000 Subject: Programs are now handled in their own list, instead of being accessed via the referring Animation. svn-id: r30768 --- engines/parallaction/parser_ns.cpp | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) (limited to 'engines/parallaction/parser_ns.cpp') diff --git a/engines/parallaction/parser_ns.cpp b/engines/parallaction/parser_ns.cpp index bff9107297..b5fdfc3502 100644 --- a/engines/parallaction/parser_ns.cpp +++ b/engines/parallaction/parser_ns.cpp @@ -196,7 +196,7 @@ Animation *Parallaction_ns::parseAnimation(Script& script, AnimationList &list, return a; } -void Parallaction_ns::parseInstruction(Animation *a, LocalVariable *locals) { +void Parallaction_ns::parseInstruction(Program *program) { Instruction *inst = new Instruction; @@ -208,15 +208,15 @@ void Parallaction_ns::parseInstruction(Animation *a, LocalVariable *locals) { _tokens[1][1] = '\0'; _instParseCtxt.a = findAnimation(&_tokens[1][2]); } else - _instParseCtxt.a = a; + _instParseCtxt.a = program->_anim; inst->_index = _instructionNames->lookup(_tokens[0]); _instParseCtxt.inst = inst; - _instParseCtxt.locals = locals; + _instParseCtxt.locals = program->_locals; (*(_instructionParsers[inst->_index]))(); - a->_program->_instructions.push_back(inst); + program->_instructions.push_back(inst); return; } @@ -225,22 +225,24 @@ void Parallaction_ns::loadProgram(Animation *a, const char *filename) { debugC(1, kDebugParser, "loadProgram(Animation: %s, script: %s)", a->_name, filename); Script *script = _disk->loadScript(filename); - - a->_program = new Program; + Program *program = new Program; + program->_anim = a; _instParseCtxt.openIf = NULL; _instParseCtxt.end = false; - _instParseCtxt.program = a->_program; + _instParseCtxt.program = program; do { script->readLineToken(); - parseInstruction(a, a->_program->_locals); + parseInstruction(program); } while (!_instParseCtxt.end); - a->_program->_ip = a->_program->_instructions.begin(); + program->_ip = program->_instructions.begin(); delete script; + _programs.push_back(program); + debugC(1, kDebugParser, "loadProgram() done"); return; @@ -998,7 +1000,7 @@ void Parallaction_ns::parseLocation(const char *filename) { // this loads animation scripts AnimationList::iterator it = _animations.begin(); for ( ; it != _animations.end(); it++) { - if (((*it)->_scriptName) && ((*it)->_program == 0)) { + if ((*it)->_scriptName) { loadProgram(*it, (*it)->_scriptName); } } -- cgit v1.2.3