aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicola Mettifogo2008-06-03 00:49:27 +0000
committerNicola Mettifogo2008-06-03 00:49:27 +0000
commitb87c11a4a14343a23c35e43b02bc8f4ff6b40922 (patch)
tree15313d47e1d291231e6bb68e0f5d038249a5693e
parent220dd330c2f7418e2d20217507569551f22fc0d5 (diff)
downloadscummvm-rg350-b87c11a4a14343a23c35e43b02bc8f4ff6b40922.tar.gz
scummvm-rg350-b87c11a4a14343a23c35e43b02bc8f4ff6b40922.tar.bz2
scummvm-rg350-b87c11a4a14343a23c35e43b02bc8f4ff6b40922.zip
Fixed initialization of parsers, necessary after the latest removal of static arrays.
svn-id: r32509
-rw-r--r--engines/parallaction/parallaction.h1
-rw-r--r--engines/parallaction/parallaction_br.cpp21
-rw-r--r--engines/parallaction/parallaction_ns.cpp2
-rw-r--r--engines/parallaction/parser.h18
4 files changed, 32 insertions, 10 deletions
diff --git a/engines/parallaction/parallaction.h b/engines/parallaction/parallaction.h
index 3117424373..63042a8882 100644
--- a/engines/parallaction/parallaction.h
+++ b/engines/parallaction/parallaction.h
@@ -723,6 +723,7 @@ private:
const Callable *_callables;
void parseLocation(const char* name);
+ void loadProgram(AnimationPtr a, const char *filename);
DECLARE_UNQUALIFIED_COMMAND_OPCODE(location);
DECLARE_UNQUALIFIED_COMMAND_OPCODE(open);
diff --git a/engines/parallaction/parallaction_br.cpp b/engines/parallaction/parallaction_br.cpp
index f07d201ae9..62cc702222 100644
--- a/engines/parallaction/parallaction_br.cpp
+++ b/engines/parallaction/parallaction_br.cpp
@@ -74,7 +74,9 @@ int Parallaction_br::init() {
initCursors();
initOpcodes();
_locationParser = new LocationParser_br(this);
+ _locationParser->init();
_programParser = new ProgramParser_br(this);
+ _programParser->init();
_part = -1;
@@ -258,6 +260,25 @@ void Parallaction_br::parseLocation(const char *filename) {
return;
}
+void Parallaction_br::loadProgram(AnimationPtr a, const char *filename) {
+ debugC(1, kDebugParser, "loadProgram(Animation: %s, script: %s)", a->_name, filename);
+
+ Script *script = _disk->loadScript(filename);
+ ProgramPtr program(new Program);
+ program->_anim = a;
+
+ _programParser->parse(script, program);
+
+ delete script;
+
+ _vm->_location._programs.push_back(program);
+
+ debugC(1, kDebugParser, "loadProgram() done");
+
+ return;
+}
+
+
void Parallaction_br::changeCharacter(const char *name) {
diff --git a/engines/parallaction/parallaction_ns.cpp b/engines/parallaction/parallaction_ns.cpp
index 9c1b25d824..2cca3a6a4a 100644
--- a/engines/parallaction/parallaction_ns.cpp
+++ b/engines/parallaction/parallaction_ns.cpp
@@ -137,7 +137,9 @@ int Parallaction_ns::init() {
initCursors();
initOpcodes();
_locationParser = new LocationParser_ns(this);
+ _locationParser->init();
_programParser = new ProgramParser_ns(this);
+ _programParser->init();
_introSarcData1 = 0;
_introSarcData2 = 1;
diff --git a/engines/parallaction/parser.h b/engines/parallaction/parser.h
index fa5d0527ed..22d3119d87 100644
--- a/engines/parallaction/parser.h
+++ b/engines/parallaction/parser.h
@@ -207,7 +207,6 @@ protected:
} _forwardedCommands[MAX_FORWARDS];
uint _numForwardedCommands;
- void init();
void clearSet(OpcodeSet &opcodes) {
for (Common::Array<const Opcode*>::iterator i = opcodes.begin(); i != opcodes.end(); ++i)
delete *i;
@@ -216,9 +215,10 @@ protected:
public:
LocationParser_ns(Parallaction_ns *vm) : _vm(vm) {
- init();
}
+ virtual void init();
+
virtual ~LocationParser_ns() {
delete _commandsNames;
delete _locationStmt;
@@ -282,13 +282,12 @@ protected:
DECLARE_UNQUALIFIED_ANIM_PARSER(moveto);
DECLARE_UNQUALIFIED_ANIM_PARSER(endanimation);
- void init();
-
public:
LocationParser_br(Parallaction_br *vm) : LocationParser_ns((Parallaction_ns*)vm), _vm(vm) {
- init();
}
+ virtual void init();
+
virtual ~LocationParser_br() {
delete _commandsNames;
delete _locationStmt;
@@ -343,7 +342,6 @@ protected:
void parseLValue(ScriptVar &var, const char *str);
virtual void parseRValue(ScriptVar &var, const char *str);
- void init();
void clearSet(OpcodeSet &opcodes) {
for (Common::Array<const Opcode*>::iterator i = opcodes.begin(); i != opcodes.end(); ++i)
delete *i;
@@ -352,9 +350,10 @@ protected:
public:
ProgramParser_ns(Parallaction_ns *vm) : _vm(vm) {
- init();
}
+ virtual void init();
+
virtual ~ProgramParser_ns() {
delete _instructionNames;
clearSet(_instructionParsers);
@@ -380,13 +379,12 @@ protected:
virtual void parseRValue(ScriptVar &var, const char *str);
- void init();
-
public:
ProgramParser_br(Parallaction_br *vm) : ProgramParser_ns((Parallaction_ns*)vm), _vm(vm) {
- init();
}
+ virtual void init();
+
virtual ~ProgramParser_br() {
delete _instructionNames;
delete _parser;