[Scummvm-cvs-logs] SF.net SVN: scummvm: [33003] scummvm/trunk/engines/parallaction

peres001 at users.sourceforge.net peres001 at users.sourceforge.net
Fri Jul 11 15:06:28 CEST 2008


Revision: 33003
          http://scummvm.svn.sourceforge.net/scummvm/?rev=33003&view=rev
Author:   peres001
Date:     2008-07-11 06:06:28 -0700 (Fri, 11 Jul 2008)

Log Message:
-----------
Moved program and command execution code out of the engine, into their own brand new 
classes.

Modified Paths:
--------------
    scummvm/trunk/engines/parallaction/dialogue.cpp
    scummvm/trunk/engines/parallaction/disk_br.cpp
    scummvm/trunk/engines/parallaction/exec_br.cpp
    scummvm/trunk/engines/parallaction/exec_ns.cpp
    scummvm/trunk/engines/parallaction/input.cpp
    scummvm/trunk/engines/parallaction/parallaction.cpp
    scummvm/trunk/engines/parallaction/parallaction.h
    scummvm/trunk/engines/parallaction/parallaction_br.cpp
    scummvm/trunk/engines/parallaction/parallaction_ns.cpp
    scummvm/trunk/engines/parallaction/walk.cpp

Added Paths:
-----------
    scummvm/trunk/engines/parallaction/exec.h

Modified: scummvm/trunk/engines/parallaction/dialogue.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/dialogue.cpp	2008-07-11 12:55:08 UTC (rev 33002)
+++ scummvm/trunk/engines/parallaction/dialogue.cpp	2008-07-11 13:06:28 UTC (rev 33003)
@@ -249,7 +249,7 @@
 	}
 
 	if (cmdlist)
-		_vm->runCommands(*cmdlist);
+		_vm->_cmdExec->run(*cmdlist);
 
 }
 

Modified: scummvm/trunk/engines/parallaction/disk_br.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/disk_br.cpp	2008-07-11 12:55:08 UTC (rev 33002)
+++ scummvm/trunk/engines/parallaction/disk_br.cpp	2008-07-11 13:06:28 UTC (rev 33003)
@@ -287,10 +287,13 @@
 	sprintf(path, "%s/ani/%s", _partPath, name);
 
 	Common::File stream;
-	if (!stream.open(path))
-		errorFileNotFound(path);
+	if (!stream.open(path)) {
+		sprintf(path, "%s/ani/%s.ani", _partPath, name);
+		if (!stream.open(path)) {
+			errorFileNotFound(path);
+		}
+	}
 
-
 	return createSprites(stream);
 }
 

Added: scummvm/trunk/engines/parallaction/exec.h
===================================================================
--- scummvm/trunk/engines/parallaction/exec.h	                        (rev 0)
+++ scummvm/trunk/engines/parallaction/exec.h	2008-07-11 13:06:28 UTC (rev 33003)
@@ -0,0 +1,237 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * $URL$
+ * $Id$
+ *
+ */
+
+
+#ifndef PARALLACTION_EXEC_H
+#define PARALLACTION_EXEC_H
+
+#include "common/util.h"
+#include "parallaction/objects.h"
+
+
+namespace Parallaction {
+
+typedef Common::Functor0<void> Opcode;
+typedef Common::Array<const Opcode*>	OpcodeSet;
+
+#define DECLARE_UNQUALIFIED_COMMAND_OPCODE(op) void cmdOp_##op()
+#define DECLARE_UNQUALIFIED_INSTRUCTION_OPCODE(op) void instOp_##op()
+
+class Parallaction_ns;
+class Parallaction_br;
+
+class CommandExec {
+protected:
+	struct ParallactionStruct1 {
+		CommandPtr cmd;
+		ZonePtr	z;
+	} _cmdRunCtxt;
+
+	OpcodeSet	_opcodes;
+
+public:
+	virtual void init() = 0;
+	virtual void run(CommandList &list, ZonePtr z = nullZonePtr);
+	CommandExec() {
+	}
+	virtual ~CommandExec() {
+		for (Common::Array<const Opcode*>::iterator i = _opcodes.begin(); i != _opcodes.end(); ++i)
+			delete *i;
+		_opcodes.clear();
+	}
+};
+
+class CommandExec_ns : public CommandExec {
+
+	Parallaction_ns	*_vm;
+
+protected:
+	DECLARE_UNQUALIFIED_COMMAND_OPCODE(invalid);
+	DECLARE_UNQUALIFIED_COMMAND_OPCODE(set);
+	DECLARE_UNQUALIFIED_COMMAND_OPCODE(clear);
+	DECLARE_UNQUALIFIED_COMMAND_OPCODE(start);
+	DECLARE_UNQUALIFIED_COMMAND_OPCODE(speak);
+	DECLARE_UNQUALIFIED_COMMAND_OPCODE(get);
+	DECLARE_UNQUALIFIED_COMMAND_OPCODE(location);
+	DECLARE_UNQUALIFIED_COMMAND_OPCODE(open);
+	DECLARE_UNQUALIFIED_COMMAND_OPCODE(close);
+	DECLARE_UNQUALIFIED_COMMAND_OPCODE(on);
+	DECLARE_UNQUALIFIED_COMMAND_OPCODE(off);
+	DECLARE_UNQUALIFIED_COMMAND_OPCODE(call);
+	DECLARE_UNQUALIFIED_COMMAND_OPCODE(toggle);
+	DECLARE_UNQUALIFIED_COMMAND_OPCODE(drop);
+	DECLARE_UNQUALIFIED_COMMAND_OPCODE(quit);
+	DECLARE_UNQUALIFIED_COMMAND_OPCODE(move);
+	DECLARE_UNQUALIFIED_COMMAND_OPCODE(stop);
+
+public:
+	void init();
+
+	CommandExec_ns(Parallaction_ns* vm);
+	~CommandExec_ns();
+};
+
+class CommandExec_br : public CommandExec_ns {
+
+protected:
+	Parallaction_br	*_vm;
+
+	DECLARE_UNQUALIFIED_COMMAND_OPCODE(location);
+	DECLARE_UNQUALIFIED_COMMAND_OPCODE(open);
+	DECLARE_UNQUALIFIED_COMMAND_OPCODE(close);
+	DECLARE_UNQUALIFIED_COMMAND_OPCODE(on);
+	DECLARE_UNQUALIFIED_COMMAND_OPCODE(off);
+	DECLARE_UNQUALIFIED_COMMAND_OPCODE(call);
+	DECLARE_UNQUALIFIED_COMMAND_OPCODE(drop);
+	DECLARE_UNQUALIFIED_COMMAND_OPCODE(move);
+	DECLARE_UNQUALIFIED_COMMAND_OPCODE(start);
+	DECLARE_UNQUALIFIED_COMMAND_OPCODE(stop);
+	DECLARE_UNQUALIFIED_COMMAND_OPCODE(character);
+	DECLARE_UNQUALIFIED_COMMAND_OPCODE(followme);
+	DECLARE_UNQUALIFIED_COMMAND_OPCODE(onmouse);
+	DECLARE_UNQUALIFIED_COMMAND_OPCODE(offmouse);
+	DECLARE_UNQUALIFIED_COMMAND_OPCODE(add);
+	DECLARE_UNQUALIFIED_COMMAND_OPCODE(leave);
+	DECLARE_UNQUALIFIED_COMMAND_OPCODE(inc);
+	DECLARE_UNQUALIFIED_COMMAND_OPCODE(dec);
+	DECLARE_UNQUALIFIED_COMMAND_OPCODE(ifeq);
+	DECLARE_UNQUALIFIED_COMMAND_OPCODE(iflt);
+	DECLARE_UNQUALIFIED_COMMAND_OPCODE(ifgt);
+	DECLARE_UNQUALIFIED_COMMAND_OPCODE(let);
+	DECLARE_UNQUALIFIED_COMMAND_OPCODE(music);
+	DECLARE_UNQUALIFIED_COMMAND_OPCODE(fix);
+	DECLARE_UNQUALIFIED_COMMAND_OPCODE(unfix);
+	DECLARE_UNQUALIFIED_COMMAND_OPCODE(zeta);
+	DECLARE_UNQUALIFIED_COMMAND_OPCODE(scroll);
+	DECLARE_UNQUALIFIED_COMMAND_OPCODE(swap);
+	DECLARE_UNQUALIFIED_COMMAND_OPCODE(give);
+	DECLARE_UNQUALIFIED_COMMAND_OPCODE(text);
+	DECLARE_UNQUALIFIED_COMMAND_OPCODE(part);
+	DECLARE_UNQUALIFIED_COMMAND_OPCODE(testsfx);
+	DECLARE_UNQUALIFIED_COMMAND_OPCODE(ret);
+	DECLARE_UNQUALIFIED_COMMAND_OPCODE(onsave);
+	DECLARE_UNQUALIFIED_COMMAND_OPCODE(offsave);
+
+public:
+	void		init();
+
+	CommandExec_br(Parallaction_br* vm);
+	~CommandExec_br();
+};
+
+
+
+
+
+class ProgramExec {
+protected:
+	struct ParallactionStruct2 {
+		AnimationPtr	anim;
+		ProgramPtr		program;
+		InstructionList::iterator inst;
+		uint16		modCounter;
+		bool		suspend;
+	} _instRunCtxt;
+
+	OpcodeSet	_opcodes;
+
+public:
+	virtual void init() = 0;
+	virtual void runScripts(ProgramList::iterator first, ProgramList::iterator last);
+	ProgramExec() {
+	}
+	virtual ~ProgramExec() {
+		for (Common::Array<const Opcode*>::iterator i = _opcodes.begin(); i != _opcodes.end(); ++i)
+			delete *i;
+		_opcodes.clear();
+	}
+};
+
+class ProgramExec_ns : public ProgramExec {
+
+	Parallaction_ns *_vm;
+
+protected:
+	DECLARE_UNQUALIFIED_INSTRUCTION_OPCODE(invalid);
+	DECLARE_UNQUALIFIED_INSTRUCTION_OPCODE(on);
+	DECLARE_UNQUALIFIED_INSTRUCTION_OPCODE(off);
+	DECLARE_UNQUALIFIED_INSTRUCTION_OPCODE(loop);
+	DECLARE_UNQUALIFIED_INSTRUCTION_OPCODE(endloop);
+	DECLARE_UNQUALIFIED_INSTRUCTION_OPCODE(null);
+	DECLARE_UNQUALIFIED_INSTRUCTION_OPCODE(call);
+	DECLARE_UNQUALIFIED_INSTRUCTION_OPCODE(inc);
+	DECLARE_UNQUALIFIED_INSTRUCTION_OPCODE(set);
+	DECLARE_UNQUALIFIED_INSTRUCTION_OPCODE(put);
+	DECLARE_UNQUALIFIED_INSTRUCTION_OPCODE(wait);
+	DECLARE_UNQUALIFIED_INSTRUCTION_OPCODE(start);
+	DECLARE_UNQUALIFIED_INSTRUCTION_OPCODE(sound);
+	DECLARE_UNQUALIFIED_INSTRUCTION_OPCODE(move);
+	DECLARE_UNQUALIFIED_INSTRUCTION_OPCODE(endscript);
+
+public:
+	void init();
+
+	ProgramExec_ns(Parallaction_ns *vm);
+	~ProgramExec_ns();
+};
+
+class ProgramExec_br : public ProgramExec_ns {
+
+	Parallaction_br *_vm;
+
+protected:
+	DECLARE_UNQUALIFIED_INSTRUCTION_OPCODE(on);
+ 	DECLARE_UNQUALIFIED_INSTRUCTION_OPCODE(off);
+	DECLARE_UNQUALIFIED_INSTRUCTION_OPCODE(loop);
+	DECLARE_UNQUALIFIED_INSTRUCTION_OPCODE(inc);
+	DECLARE_UNQUALIFIED_INSTRUCTION_OPCODE(dec);
+	DECLARE_UNQUALIFIED_INSTRUCTION_OPCODE(set);
+	DECLARE_UNQUALIFIED_INSTRUCTION_OPCODE(put);
+	DECLARE_UNQUALIFIED_INSTRUCTION_OPCODE(wait);
+	DECLARE_UNQUALIFIED_INSTRUCTION_OPCODE(start);
+	DECLARE_UNQUALIFIED_INSTRUCTION_OPCODE(process);
+	DECLARE_UNQUALIFIED_INSTRUCTION_OPCODE(move);
+	DECLARE_UNQUALIFIED_INSTRUCTION_OPCODE(color);
+	DECLARE_UNQUALIFIED_INSTRUCTION_OPCODE(mask);
+	DECLARE_UNQUALIFIED_INSTRUCTION_OPCODE(print);
+	DECLARE_UNQUALIFIED_INSTRUCTION_OPCODE(text);
+	DECLARE_UNQUALIFIED_INSTRUCTION_OPCODE(mul);
+	DECLARE_UNQUALIFIED_INSTRUCTION_OPCODE(div);
+	DECLARE_UNQUALIFIED_INSTRUCTION_OPCODE(ifeq);
+	DECLARE_UNQUALIFIED_INSTRUCTION_OPCODE(iflt);
+	DECLARE_UNQUALIFIED_INSTRUCTION_OPCODE(ifgt);
+	DECLARE_UNQUALIFIED_INSTRUCTION_OPCODE(endif);
+	DECLARE_UNQUALIFIED_INSTRUCTION_OPCODE(stop);
+	DECLARE_UNQUALIFIED_INSTRUCTION_OPCODE(endscript);
+
+public:
+	void init();
+	ProgramExec_br(Parallaction_br *vm);
+	~ProgramExec_br();
+};
+
+} // namespace Parallaction
+
+#endif


Property changes on: scummvm/trunk/engines/parallaction/exec.h
___________________________________________________________________
Name: svn:mime-type
   + text/plain
Name: svn:keywords
   + Date Rev Author URL Id
Name: svn:eol-style
   + native

Modified: scummvm/trunk/engines/parallaction/exec_br.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/exec_br.cpp	2008-07-11 12:55:08 UTC (rev 33002)
+++ scummvm/trunk/engines/parallaction/exec_br.cpp	2008-07-11 13:06:28 UTC (rev 33003)
@@ -23,6 +23,7 @@
  *
  */
 
+#include "parallaction/exec.h"
 #include "parallaction/input.h"
 #include "parallaction/parallaction.h"
 
@@ -64,12 +65,13 @@
 
 #define SetOpcodeTable(x) table = &x;
 
-typedef Common::Functor0Mem<void, Parallaction_br> OpcodeV2;
-#define COMMAND_OPCODE(op) table->push_back(new OpcodeV2(this, &Parallaction_br::cmdOp_##op))
-#define DECLARE_COMMAND_OPCODE(op) void Parallaction_br::cmdOp_##op()
+typedef Common::Functor0Mem<void, CommandExec_br> OpcodeV1;
+#define COMMAND_OPCODE(op) table->push_back(new OpcodeV1(this, &CommandExec_br::cmdOp_##op))
+#define DECLARE_COMMAND_OPCODE(op) void CommandExec_br::cmdOp_##op()
 
-#define INSTRUCTION_OPCODE(op) table->push_back(new OpcodeV2(this, &Parallaction_br::instOp_##op))
-#define DECLARE_INSTRUCTION_OPCODE(op) void Parallaction_br::instOp_##op()
+typedef Common::Functor0Mem<void, ProgramExec_br> OpcodeV2;
+#define INSTRUCTION_OPCODE(op) table->push_back(new OpcodeV2(this, &ProgramExec_br::instOp_##op))
+#define DECLARE_INSTRUCTION_OPCODE(op) void ProgramExec_br::instOp_##op()
 
 void Parallaction_br::setupSubtitles(char *s, char *s2, int y) {
 	debugC(5, kDebugExec, "setupSubtitles(%s, %s, %i)", s, s2, y);
@@ -114,7 +116,7 @@
 	warning("Parallaction_br::cmdOp_location command not yet implemented");
 
 	// TODO: handle startPos and startPos2
-	scheduleLocationSwitch(_cmdRunCtxt.cmd->u._string);
+	_vm->scheduleLocationSwitch(_cmdRunCtxt.cmd->u._string);
 }
 
 
@@ -137,7 +139,7 @@
 		z->_flags &= ~kFlagsRemove;
 
 		if ((z->_type & 0xFFFF) & kZoneGet) {
-			_gfx->showGfxObj(z->u.get->gfxobj, true);
+			_vm->_gfx->showGfxObj(z->u.get->gfxobj, true);
 		}
 	}
 }
@@ -151,14 +153,14 @@
 		z->_flags |= kFlagsRemove;
 
 		if ((z->_type & 0xFFFF) & kZoneGet) {
-			_gfx->showGfxObj(z->u.get->gfxobj, false);
+			_vm->_gfx->showGfxObj(z->u.get->gfxobj, false);
 		}
 	}
 }
 
 
 DECLARE_COMMAND_OPCODE(call) {
-	callFunction(_cmdRunCtxt.cmd->u._callable, &_cmdRunCtxt.z);
+	_vm->callFunction(_cmdRunCtxt.cmd->u._callable, &_cmdRunCtxt.z);
 }
 
 
@@ -182,7 +184,7 @@
 
 DECLARE_COMMAND_OPCODE(character) {
 	debugC(9, kDebugExec, "Parallaction_br::cmdOp_character(%s)", _cmdRunCtxt.cmd->u._string);
-	changeCharacter(_cmdRunCtxt.cmd->u._string);
+	_vm->changeCharacter(_cmdRunCtxt.cmd->u._string);
 }
 
 
@@ -192,12 +194,12 @@
 
 
 DECLARE_COMMAND_OPCODE(onmouse) {
-	_input->showCursor(true);
+	_vm->_input->showCursor(true);
 }
 
 
 DECLARE_COMMAND_OPCODE(offmouse) {
-	_input->showCursor(false);
+	_vm->_input->showCursor(false);
 }
 
 
@@ -212,42 +214,42 @@
 
 
 DECLARE_COMMAND_OPCODE(inc) {
-	_counters[_cmdRunCtxt.cmd->u._lvalue] += _cmdRunCtxt.cmd->u._rvalue;
+	_vm->_counters[_cmdRunCtxt.cmd->u._lvalue] += _cmdRunCtxt.cmd->u._rvalue;
 }
 
 
 DECLARE_COMMAND_OPCODE(dec) {
-	_counters[_cmdRunCtxt.cmd->u._lvalue] -= _cmdRunCtxt.cmd->u._rvalue;
+	_vm->_counters[_cmdRunCtxt.cmd->u._lvalue] -= _cmdRunCtxt.cmd->u._rvalue;
 }
 
 
 DECLARE_COMMAND_OPCODE(ifeq) {
-	if (_counters[_cmdRunCtxt.cmd->u._lvalue] == _cmdRunCtxt.cmd->u._rvalue) {
-		setLocationFlags(kFlagsTestTrue);
+	if (_vm->_counters[_cmdRunCtxt.cmd->u._lvalue] == _cmdRunCtxt.cmd->u._rvalue) {
+		_vm->setLocationFlags(kFlagsTestTrue);
 	} else {
-		clearLocationFlags(kFlagsTestTrue);
+		_vm->clearLocationFlags(kFlagsTestTrue);
 	}
 }
 
 DECLARE_COMMAND_OPCODE(iflt) {
-	if (_counters[_cmdRunCtxt.cmd->u._lvalue] < _cmdRunCtxt.cmd->u._rvalue) {
-		setLocationFlags(kFlagsTestTrue);
+	if (_vm->_counters[_cmdRunCtxt.cmd->u._lvalue] < _cmdRunCtxt.cmd->u._rvalue) {
+		_vm->setLocationFlags(kFlagsTestTrue);
 	} else {
-		clearLocationFlags(kFlagsTestTrue);
+		_vm->clearLocationFlags(kFlagsTestTrue);
 	}
 }
 
 DECLARE_COMMAND_OPCODE(ifgt) {
-	if (_counters[_cmdRunCtxt.cmd->u._lvalue] > _cmdRunCtxt.cmd->u._rvalue) {
-		setLocationFlags(kFlagsTestTrue);
+	if (_vm->_counters[_cmdRunCtxt.cmd->u._lvalue] > _cmdRunCtxt.cmd->u._rvalue) {
+		_vm->setLocationFlags(kFlagsTestTrue);
 	} else {
-		clearLocationFlags(kFlagsTestTrue);
+		_vm->clearLocationFlags(kFlagsTestTrue);
 	}
 }
 
 
 DECLARE_COMMAND_OPCODE(let) {
-	_counters[_cmdRunCtxt.cmd->u._lvalue] = _cmdRunCtxt.cmd->u._rvalue;
+	_vm->_counters[_cmdRunCtxt.cmd->u._lvalue] = _cmdRunCtxt.cmd->u._rvalue;
 }
 
 
@@ -267,15 +269,15 @@
 
 
 DECLARE_COMMAND_OPCODE(zeta) {
-	_location._zeta0 = _cmdRunCtxt.cmd->u._zeta0;
-	_location._zeta1 = _cmdRunCtxt.cmd->u._zeta1;
-	_location._zeta2 = _cmdRunCtxt.cmd->u._zeta2;
+	_vm->_location._zeta0 = _cmdRunCtxt.cmd->u._zeta0;
+	_vm->_location._zeta1 = _cmdRunCtxt.cmd->u._zeta1;
+	_vm->_location._zeta2 = _cmdRunCtxt.cmd->u._zeta2;
 }
 
 
 DECLARE_COMMAND_OPCODE(scroll) {
 	warning("Parallaction_br::cmdOp_scroll not yet implemented");
-	_gfx->setVar("scroll_x", _cmdRunCtxt.cmd->u._rvalue );
+	_vm->_gfx->setVar("scroll_x", _cmdRunCtxt.cmd->u._rvalue );
 }
 
 
@@ -291,7 +293,7 @@
 
 DECLARE_COMMAND_OPCODE(text) {
 	CommandData *data = &_cmdRunCtxt.cmd->u;
-	setupSubtitles(data->_string, data->_string2, data->_zeta0);
+	_vm->setupSubtitles(data->_string, data->_string2, data->_zeta0);
 }
 
 
@@ -302,7 +304,7 @@
 
 DECLARE_COMMAND_OPCODE(testsfx) {
 	warning("Parallaction_br::cmdOp_testsfx not completely implemented");
-	clearLocationFlags(kFlagsTestTrue);	// should test if sfx are enabled
+	_vm->clearLocationFlags(kFlagsTestTrue);	// should test if sfx are enabled
 }
 
 
@@ -332,7 +334,7 @@
 		z->_flags &= ~kFlagsRemove;
 
 		if ((z->_type & 0xFFFF) & kZoneGet) {
-			_gfx->showGfxObj(z->u.get->gfxobj, true);
+			_vm->_gfx->showGfxObj(z->u.get->gfxobj, true);
 		}
 	}
 }
@@ -346,7 +348,7 @@
 		z->_flags |= kFlagsRemove;
 
 		if ((z->_type & 0xFFFF) & kZoneGet) {
-			_gfx->showGfxObj(z->u.get->gfxobj, false);
+			_vm->_gfx->showGfxObj(z->u.get->gfxobj, false);
 		}
 	}
 }
@@ -430,7 +432,7 @@
 
 
 DECLARE_INSTRUCTION_OPCODE(process) {
-	_activeZone2 = (*_instRunCtxt.inst)->_z;
+	_vm->_activeZone2 = (*_instRunCtxt.inst)->_z;
 }
 
 
@@ -444,7 +446,7 @@
 
 	int16 entry = inst->_opB.getRValue();
 
-	_gfx->_palette.setEntry(entry, inst->_colors[0], inst->_colors[1], inst->_colors[2]);
+	_vm->_gfx->_palette.setEntry(entry, inst->_colors[0], inst->_colors[1], inst->_colors[2]);
 
 }
 
@@ -465,7 +467,7 @@
 
 DECLARE_INSTRUCTION_OPCODE(text) {
 	InstructionPtr inst = (*_instRunCtxt.inst);
-	setupSubtitles(inst->_text, inst->_text2, inst->_y);
+	_vm->setupSubtitles(inst->_text, inst->_text2, inst->_y);
 }
 
 
@@ -496,7 +498,7 @@
 DECLARE_INSTRUCTION_OPCODE(endscript) {
 	if ((_instRunCtxt.anim->_flags & kFlagsLooping) == 0) {
 		_instRunCtxt.anim->_flags &= ~kFlagsActing;
-		runCommands(_instRunCtxt.anim->_commands, _instRunCtxt.anim);
+		_vm->_cmdExec->run(_instRunCtxt.anim->_commands, _instRunCtxt.anim);
 		_instRunCtxt.program->_status = kProgramDone;
 	}
 	_instRunCtxt.program->_ip = _instRunCtxt.program->_instructions.begin();
@@ -504,11 +506,10 @@
 	_instRunCtxt.suspend = true;
 }
 
-void Parallaction_br::initOpcodes() {
-
+void CommandExec_br::init() {
 	Common::Array<const Opcode*> *table = 0;
 
-	SetOpcodeTable(_commandOpcodes);
+	SetOpcodeTable(_opcodes);
 	COMMAND_OPCODE(invalid);
 	COMMAND_OPCODE(set);
 	COMMAND_OPCODE(clear);
@@ -551,8 +552,21 @@
 	COMMAND_OPCODE(ret);
 	COMMAND_OPCODE(onsave);
 	COMMAND_OPCODE(offsave);
+}
 
-	SetOpcodeTable(_instructionOpcodes);
+CommandExec_br::CommandExec_br(Parallaction_br* vm) : CommandExec_ns(vm), _vm(vm) {
+
+}
+
+CommandExec_br::~CommandExec_br() {
+
+}
+
+void ProgramExec_br::init() {
+
+	Common::Array<const Opcode*> *table = 0;
+
+	SetOpcodeTable(_opcodes);
 	INSTRUCTION_OPCODE(invalid);
 	INSTRUCTION_OPCODE(on);
 	INSTRUCTION_OPCODE(off);
@@ -587,6 +601,12 @@
 	INSTRUCTION_OPCODE(endscript);
 }
 
+ProgramExec_br::ProgramExec_br(Parallaction_br *vm) : ProgramExec_ns(vm), _vm(vm) {
+}
+
+ProgramExec_br::~ProgramExec_br() {
+}
+
 #if 0
 void Parallaction_br::jobWaitRemoveLabelJob(void *parm, Job *job) {
 

Modified: scummvm/trunk/engines/parallaction/exec_ns.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/exec_ns.cpp	2008-07-11 12:55:08 UTC (rev 33002)
+++ scummvm/trunk/engines/parallaction/exec_ns.cpp	2008-07-11 13:06:28 UTC (rev 33003)
@@ -23,6 +23,7 @@
  *
  */
 
+#include "parallaction/exec.h"
 #include "parallaction/input.h"
 #include "parallaction/parallaction.h"
 #include "parallaction/sound.h"
@@ -52,12 +53,13 @@
 
 #define SetOpcodeTable(x) table = &x;
 
-typedef Common::Functor0Mem<void, Parallaction_ns> OpcodeV2;
-#define COMMAND_OPCODE(op) table->push_back(new OpcodeV2(this, &Parallaction_ns::cmdOp_##op))
-#define DECLARE_COMMAND_OPCODE(op) void Parallaction_ns::cmdOp_##op()
+typedef Common::Functor0Mem<void, CommandExec_ns> OpcodeV1;
+#define COMMAND_OPCODE(op) table->push_back(new OpcodeV1(this, &CommandExec_ns::cmdOp_##op))
+#define DECLARE_COMMAND_OPCODE(op) void CommandExec_ns::cmdOp_##op()
 
-#define INSTRUCTION_OPCODE(op) table->push_back(new OpcodeV2(this, &Parallaction_ns::instOp_##op))
-#define DECLARE_INSTRUCTION_OPCODE(op) void Parallaction_ns::instOp_##op()
+typedef Common::Functor0Mem<void, ProgramExec_ns> OpcodeV2;
+#define INSTRUCTION_OPCODE(op) table->push_back(new OpcodeV2(this, &ProgramExec_ns::instOp_##op))
+#define DECLARE_INSTRUCTION_OPCODE(op) void ProgramExec_ns::instOp_##op()
 
 
 
@@ -137,7 +139,7 @@
 	int16 y = inst->_opB.getRValue();
 	bool mask = (inst->_flags & kInstMaskedPut) == kInstMaskedPut;
 
-	_gfx->patchBackground(v18, x, y, mask);
+	_vm->_gfx->patchBackground(v18, x, y, mask);
 }
 
 DECLARE_INSTRUCTION_OPCODE(null) {
@@ -149,7 +151,7 @@
 }
 
 DECLARE_INSTRUCTION_OPCODE(call) {
-	callFunction((*_instRunCtxt.inst)->_immediate, 0);
+	_vm->callFunction((*_instRunCtxt.inst)->_immediate, 0);
 }
 
 
@@ -165,7 +167,7 @@
 
 
 DECLARE_INSTRUCTION_OPCODE(sound) {
-	_activeZone = (*_instRunCtxt.inst)->_z;
+	_vm->_activeZone = (*_instRunCtxt.inst)->_z;
 }
 
 
@@ -175,13 +177,13 @@
 	int16 x = inst->_opA.getRValue();
 	int16 y = inst->_opB.getRValue();
 
-	_char.scheduleWalk(x, y);
+	_vm->_char.scheduleWalk(x, y);
 }
 
 DECLARE_INSTRUCTION_OPCODE(endscript) {
 	if ((_instRunCtxt.anim->_flags & kFlagsLooping) == 0) {
 		_instRunCtxt.anim->_flags &= ~kFlagsActing;
-		runCommands(_instRunCtxt.anim->_commands, _instRunCtxt.anim);
+		_vm->_cmdExec->run(_instRunCtxt.anim->_commands, _instRunCtxt.anim);
 		_instRunCtxt.program->_status = kProgramDone;
 	}
 	_instRunCtxt.program->_ip = _instRunCtxt.program->_instructions.begin();
@@ -201,7 +203,7 @@
 		_cmdRunCtxt.cmd->u._flags &= ~kFlagsGlobal;
 		_commandFlags |= _cmdRunCtxt.cmd->u._flags;
 	} else {
-		setLocationFlags(_cmdRunCtxt.cmd->u._flags);
+		_vm->setLocationFlags(_cmdRunCtxt.cmd->u._flags);
 	}
 }
 
@@ -211,7 +213,7 @@
 		_cmdRunCtxt.cmd->u._flags &= ~kFlagsGlobal;
 		_commandFlags &= ~_cmdRunCtxt.cmd->u._flags;
 	} else {
-		clearLocationFlags(_cmdRunCtxt.cmd->u._flags);
+		_vm->clearLocationFlags(_cmdRunCtxt.cmd->u._flags);
 	}
 }
 
@@ -222,25 +224,25 @@
 
 
 DECLARE_COMMAND_OPCODE(speak) {
-	_activeZone = _cmdRunCtxt.cmd->u._zone;
+	_vm->_activeZone = _cmdRunCtxt.cmd->u._zone;
 }
 
 
 DECLARE_COMMAND_OPCODE(get) {
 	_cmdRunCtxt.cmd->u._zone->_flags &= ~kFlagsFixed;
-	runZone(_cmdRunCtxt.cmd->u._zone);
+	_vm->runZone(_cmdRunCtxt.cmd->u._zone);
 }
 
 
 DECLARE_COMMAND_OPCODE(location) {
-	scheduleLocationSwitch(_cmdRunCtxt.cmd->u._string);
+	_vm->scheduleLocationSwitch(_cmdRunCtxt.cmd->u._string);
 }
 
 
 DECLARE_COMMAND_OPCODE(open) {
 	_cmdRunCtxt.cmd->u._zone->_flags &= ~kFlagsClosed;
 	if (_cmdRunCtxt.cmd->u._zone->u.door->gfxobj) {
-		updateDoor(_cmdRunCtxt.cmd->u._zone);
+		_vm->updateDoor(_cmdRunCtxt.cmd->u._zone);
 	}
 }
 
@@ -248,7 +250,7 @@
 DECLARE_COMMAND_OPCODE(close) {
 	_cmdRunCtxt.cmd->u._zone->_flags |= kFlagsClosed;
 	if (_cmdRunCtxt.cmd->u._zone->u.door->gfxobj) {
-		updateDoor(_cmdRunCtxt.cmd->u._zone);
+		_vm->updateDoor(_cmdRunCtxt.cmd->u._zone);
 	}
 }
 
@@ -265,7 +267,7 @@
 		z->_flags &= ~kFlagsRemove;
 		z->_flags |= kFlagsActive;
 		if ((z->_type & 0xFFFF) == kZoneGet) {
-			_gfx->showGfxObj(z->u.get->gfxobj, true);
+			_vm->_gfx->showGfxObj(z->u.get->gfxobj, true);
 		}
 	}
 }
@@ -277,7 +279,7 @@
 
 
 DECLARE_COMMAND_OPCODE(call) {
-	callFunction(_cmdRunCtxt.cmd->u._callable, &_cmdRunCtxt.z);
+	_vm->callFunction(_cmdRunCtxt.cmd->u._callable, &_cmdRunCtxt.z);
 }
 
 
@@ -286,13 +288,13 @@
 		_cmdRunCtxt.cmd->u._flags &= ~kFlagsGlobal;
 		_commandFlags ^= _cmdRunCtxt.cmd->u._flags;
 	} else {
-		toggleLocationFlags(_cmdRunCtxt.cmd->u._flags);
+		_vm->toggleLocationFlags(_cmdRunCtxt.cmd->u._flags);
 	}
 }
 
 
 DECLARE_COMMAND_OPCODE(drop){
-	dropItem( _cmdRunCtxt.cmd->u._object );
+	_vm->dropItem( _cmdRunCtxt.cmd->u._object );
 }
 
 
@@ -302,7 +304,7 @@
 
 
 DECLARE_COMMAND_OPCODE(move) {
-	_char.scheduleWalk(_cmdRunCtxt.cmd->u._move.x, _cmdRunCtxt.cmd->u._move.y);
+	_vm->_char.scheduleWalk(_cmdRunCtxt.cmd->u._move.x, _cmdRunCtxt.cmd->u._move.y);
 }
 
 
@@ -356,7 +358,7 @@
 }
 
 
-void Parallaction_ns::runScripts() {
+void ProgramExec::runScripts(ProgramList::iterator first, ProgramList::iterator last) {
 	if (_engineFlags & kEnginePauseJobs) {
 		return;
 	}
@@ -365,7 +367,7 @@
 
 	static uint16 modCounter = 0;
 
-	for (ProgramList::iterator it = _location._programs.begin(); it != _location._programs.end(); it++) {
+	for (ProgramList::iterator it = first; it != last; it++) {
 
 		AnimationPtr a = (*it)->_anim;
 
@@ -388,7 +390,7 @@
 			_instRunCtxt.modCounter = modCounter;
 			_instRunCtxt.suspend = false;
 
-			(*_instructionOpcodes[(*inst)->_index])();
+			(*_opcodes[(*inst)->_index])();
 
 			inst = _instRunCtxt.inst;		// handles endloop correctly
 
@@ -405,17 +407,13 @@
 			a->_z = a->_top + a->height();
 	}
 
-	_char._ani->_z = _char._ani->height() + _char._ani->_top;
-	if (_char._ani->gfxobj) {
-		_char._ani->gfxobj->z = _char._ani->_z;
-	}
 	modCounter++;
 
 	return;
 }
 
 
-void Parallaction::runCommands(CommandList& list, ZonePtr z) {
+void CommandExec::run(CommandList& list, ZonePtr z) {
 	if (list.size() == 0)
 		return;
 
@@ -425,7 +423,7 @@
 	for ( ; it != list.end(); it++) {
 
 		CommandPtr cmd = *it;
-		uint32 v8 = getLocationFlags();
+		uint32 v8 = _vm->getLocationFlags();
 
 		if (_engineFlags & kEngineQuit)
 			break;
@@ -434,15 +432,15 @@
 			v8 = _commandFlags | kFlagsGlobal;
 		}
 
+		debugC(3, kDebugExec, "runCommands[%i] (on: %x, off: %x)", cmd->_id,  cmd->_flagsOn, cmd->_flagsOff);
+
 		if ((cmd->_flagsOn & v8) != cmd->_flagsOn) continue;
 		if ((cmd->_flagsOff & ~v8) != cmd->_flagsOff) continue;
 
-//		debugC(3, kDebugExec, "runCommands[%i]: %s (on: %x, off: %x)", cmd->_id, _commandsNamesRes[cmd->_id-1], cmd->_flagsOn, cmd->_flagsOff);
-
 		_cmdRunCtxt.z = z;
 		_cmdRunCtxt.cmd = cmd;
 
-		(*_commandOpcodes[cmd->_id])();
+		(*_opcodes[cmd->_id])();
 	}
 
 	debugC(3, kDebugExec, "runCommands completed");
@@ -451,7 +449,14 @@
 
 }
 
+CommandExec_ns::CommandExec_ns(Parallaction_ns* vm) : _vm(vm) {
 
+}
+
+CommandExec_ns::~CommandExec_ns() {
+
+}
+
 //
 //	ZONE TYPE: EXAMINE
 //
@@ -527,7 +532,7 @@
 
 	debugC(3, kDebugExec, "runZone completed");
 
-	runCommands(z->_commands, z);
+	_cmdExec->run(z->_commands, z);
 
 	return 0;
 }
@@ -654,11 +659,34 @@
 }
 
 
-void Parallaction_ns::initOpcodes() {
+void CommandExec_ns::init() {
+	Common::Array<const Opcode*> *table = 0;
 
+	SetOpcodeTable(_opcodes);
+	COMMAND_OPCODE(invalid);
+	COMMAND_OPCODE(set);
+	COMMAND_OPCODE(clear);
+	COMMAND_OPCODE(start);
+	COMMAND_OPCODE(speak);
+	COMMAND_OPCODE(get);
+	COMMAND_OPCODE(location);
+	COMMAND_OPCODE(open);
+	COMMAND_OPCODE(close);
+	COMMAND_OPCODE(on);
+	COMMAND_OPCODE(off);
+	COMMAND_OPCODE(call);
+	COMMAND_OPCODE(toggle);
+	COMMAND_OPCODE(drop);
+	COMMAND_OPCODE(quit);
+	COMMAND_OPCODE(move);
+	COMMAND_OPCODE(stop);
+}
+
+void ProgramExec_ns::init() {
+
 	Common::Array<const Opcode*> *table = 0;
 
-	SetOpcodeTable(_instructionOpcodes);
+	SetOpcodeTable(_opcodes);
 	INSTRUCTION_OPCODE(invalid);
 	INSTRUCTION_OPCODE(on);
 	INSTRUCTION_OPCODE(off);
@@ -680,25 +708,12 @@
 	INSTRUCTION_OPCODE(move);
 	INSTRUCTION_OPCODE(endscript);
 
-	SetOpcodeTable(_commandOpcodes);
-	COMMAND_OPCODE(invalid);
-	COMMAND_OPCODE(set);
-	COMMAND_OPCODE(clear);
-	COMMAND_OPCODE(start);
-	COMMAND_OPCODE(speak);
-	COMMAND_OPCODE(get);
-	COMMAND_OPCODE(location);
-	COMMAND_OPCODE(open);
-	COMMAND_OPCODE(close);
-	COMMAND_OPCODE(on);
-	COMMAND_OPCODE(off);
-	COMMAND_OPCODE(call);
-	COMMAND_OPCODE(toggle);
-	COMMAND_OPCODE(drop);
-	COMMAND_OPCODE(quit);
-	COMMAND_OPCODE(move);
-	COMMAND_OPCODE(stop);
 }
 
+ProgramExec_ns::ProgramExec_ns(Parallaction_ns *vm) : _vm(vm) {
+	}
 
+ProgramExec_ns::~ProgramExec_ns() {
+}
+
 }	// namespace Parallaction

Modified: scummvm/trunk/engines/parallaction/input.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/input.cpp	2008-07-11 12:55:08 UTC (rev 33002)
+++ scummvm/trunk/engines/parallaction/input.cpp	2008-07-11 13:06:28 UTC (rev 33003)
@@ -302,7 +302,7 @@
 			_vm->dropItem(z->u.merge->_obj1);
 			_vm->dropItem(z->u.merge->_obj2);
 			_vm->addInventoryItem(z->u.merge->_obj3);
-			_vm->runCommands(z->_commands);
+			_vm->_cmdExec->run(z->_commands);
 		}
 
 		return true;

Modified: scummvm/trunk/engines/parallaction/parallaction.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/parallaction.cpp	2008-07-11 12:55:08 UTC (rev 33002)
+++ scummvm/trunk/engines/parallaction/parallaction.cpp	2008-07-11 13:06:28 UTC (rev 33003)
@@ -84,12 +84,11 @@
 
 
 Parallaction::~Parallaction() {
-	clearSet(_commandOpcodes);
-	clearSet(_instructionOpcodes);
-
 	delete _debugger;
 	delete _globalTable;
 	delete _callableNames;
+	delete _cmdExec;
+	delete _programExec;
 
 	_gfx->clearGfxObjects(kGfxObjCharacter | kGfxObjNormal);
 	hideDialogueStuff();
@@ -386,7 +385,11 @@
 	_gfx->beginFrame();
 
 	if (_input->_inputMode == Input::kInputModeGame) {
-		runScripts();
+		_programExec->runScripts(_location._programs.begin(), _location._programs.end());
+		_char._ani->_z = _char._ani->height() + _char._ani->_top;
+		if (_char._ani->gfxobj) {
+			_char._ani->gfxobj->z = _char._ani->_z;
+		}
 		walk();
 		drawAnimations();
 	}
@@ -422,7 +425,7 @@
 	pal.makeGrayscale();
 	_gfx->setPalette(pal);
 
-	runScripts();
+	_programExec->runScripts(_location._programs.begin(), _location._programs.end());
 	drawAnimations();
 
 	_gfx->updateScreen();

Modified: scummvm/trunk/engines/parallaction/parallaction.h
===================================================================
--- scummvm/trunk/engines/parallaction/parallaction.h	2008-07-11 12:55:08 UTC (rev 33002)
+++ scummvm/trunk/engines/parallaction/parallaction.h	2008-07-11 13:06:28 UTC (rev 33003)
@@ -33,6 +33,7 @@
 
 #include "engines/engine.h"
 
+#include "parallaction/exec.h"
 #include "parallaction/input.h"
 #include "parallaction/inventory.h"
 #include "parallaction/parser.h"
@@ -238,10 +239,6 @@
 
 
 
-#define DECLARE_UNQUALIFIED_COMMAND_OPCODE(op) void cmdOp_##op()
-#define DECLARE_UNQUALIFIED_INSTRUCTION_OPCODE(op) void instOp_##op()
-
-
 #define NUM_LOCATIONS 120
 
 class Parallaction : public Engine {
@@ -259,23 +256,6 @@
 
 	Input	*_input;
 
-	OpcodeSet	_commandOpcodes;
-
-	struct ParallactionStruct1 {
-		CommandPtr cmd;
-		ZonePtr	z;
-	} _cmdRunCtxt;
-
-	OpcodeSet	_instructionOpcodes;
-
-	struct ParallactionStruct2 {
-		AnimationPtr	anim;
-		ProgramPtr		program;
-		InstructionList::iterator inst;
-		uint16		modCounter;
-		bool		suspend;
-	} _instRunCtxt;
-
 	void		processInput(InputData* data);
 
 	void		pauseJobs();
@@ -292,8 +272,6 @@
 
 	void		runDialogue(SpeakData*);
 
-	void		runCommands(CommandList& list, ZonePtr z = nullZonePtr);
-
 	AnimationPtr findAnimation(const char *name);
 	void		freeAnimations();
 
@@ -327,6 +305,8 @@
 	Gfx*			_gfx;
 	Disk*			_disk;
 
+	CommandExec*	_cmdExec;
+	ProgramExec*	_programExec;
 	Character		_char;
 
 	void			setLocationFlags(uint32 flags);
@@ -367,10 +347,8 @@
 	void		runGame();
 	void		updateView();
 
-	void		scheduleLocationSwitch(const char *location);
 	void		doLocationEnterTransition();
 	virtual void changeLocation(char *location) = 0;
-	virtual void changeCharacter(const char *name) = 0;
 	virtual void runPendingZones() = 0;
 	void		allocateLocationSlot(const char *name);
 	void		finalizeLocationParsing();
@@ -389,6 +367,9 @@
 
 
 public:
+	void		scheduleLocationSwitch(const char *location);
+	virtual void changeCharacter(const char *name) = 0;
+
 	virtual	void callFunction(uint index, void* parm) { }
 
 	virtual void setArrowCursor() = 0;
@@ -398,7 +379,6 @@
 
 	void updateDoor(ZonePtr z);
 
-	virtual void runScripts() = 0;
 	virtual void walk() = 0;
 	virtual void drawAnimations() = 0;
 
@@ -533,7 +513,6 @@
 
 	void initResources();
 	void initCursors();
-	void initParsers();
 
 	static byte _resMouseArrow[256];
 	byte	*_mouseArrow;
@@ -596,49 +575,12 @@
 	const Callable *_callables;
 
 protected:
-	void runScripts();
 	void walk();
 	void drawAnimations();
 
 	void		parseLocation(const char *filename);
 	void		loadProgram(AnimationPtr a, const char *filename);
 
-	void		initOpcodes();
-
-	DECLARE_UNQUALIFIED_COMMAND_OPCODE(invalid);
-	DECLARE_UNQUALIFIED_COMMAND_OPCODE(set);
-	DECLARE_UNQUALIFIED_COMMAND_OPCODE(clear);
-	DECLARE_UNQUALIFIED_COMMAND_OPCODE(start);
-	DECLARE_UNQUALIFIED_COMMAND_OPCODE(speak);
-	DECLARE_UNQUALIFIED_COMMAND_OPCODE(get);
-	DECLARE_UNQUALIFIED_COMMAND_OPCODE(location);
-	DECLARE_UNQUALIFIED_COMMAND_OPCODE(open);
-	DECLARE_UNQUALIFIED_COMMAND_OPCODE(close);
-	DECLARE_UNQUALIFIED_COMMAND_OPCODE(on);
-	DECLARE_UNQUALIFIED_COMMAND_OPCODE(off);
-	DECLARE_UNQUALIFIED_COMMAND_OPCODE(call);
-	DECLARE_UNQUALIFIED_COMMAND_OPCODE(toggle);
-	DECLARE_UNQUALIFIED_COMMAND_OPCODE(drop);
-	DECLARE_UNQUALIFIED_COMMAND_OPCODE(quit);
-	DECLARE_UNQUALIFIED_COMMAND_OPCODE(move);
-	DECLARE_UNQUALIFIED_COMMAND_OPCODE(stop);
-
-	DECLARE_UNQUALIFIED_INSTRUCTION_OPCODE(invalid);
-	DECLARE_UNQUALIFIED_INSTRUCTION_OPCODE(on);
-	DECLARE_UNQUALIFIED_INSTRUCTION_OPCODE(off);
-	DECLARE_UNQUALIFIED_INSTRUCTION_OPCODE(loop);
-	DECLARE_UNQUALIFIED_INSTRUCTION_OPCODE(endloop);
-	DECLARE_UNQUALIFIED_INSTRUCTION_OPCODE(null);
-	DECLARE_UNQUALIFIED_INSTRUCTION_OPCODE(call);
-	DECLARE_UNQUALIFIED_INSTRUCTION_OPCODE(inc);
-	DECLARE_UNQUALIFIED_INSTRUCTION_OPCODE(set);
-	DECLARE_UNQUALIFIED_INSTRUCTION_OPCODE(put);
-	DECLARE_UNQUALIFIED_INSTRUCTION_OPCODE(wait);
-	DECLARE_UNQUALIFIED_INSTRUCTION_OPCODE(start);
-	DECLARE_UNQUALIFIED_INSTRUCTION_OPCODE(sound);
-	DECLARE_UNQUALIFIED_INSTRUCTION_OPCODE(move);
-	DECLARE_UNQUALIFIED_INSTRUCTION_OPCODE(endscript);
-
 	void		selectStartLocation();
 
 	void		guiStart();
@@ -671,7 +613,10 @@
 	typedef void (Parallaction_br::*Callable)(void*);
 	virtual	void callFunction(uint index, void* parm);
 	void		changeCharacter(const char *name);
+	void setupSubtitles(char *s, char *s2, int y);
+	void clearSubtitles();
 
+
 public:
 	Table		*_countersNames;
 
@@ -698,8 +643,6 @@
 	void		initResources();
 	void		initFonts();
 	void		freeFonts();
-	void		initOpcodes();
-	void		initParsers();
 
 	void setArrowCursor();
 	void setInventoryCursor(int pos);
@@ -741,68 +684,6 @@
 	void parseLocation(const char* name);
 	void loadProgram(AnimationPtr a, const char *filename);
 
-	DECLARE_UNQUALIFIED_COMMAND_OPCODE(location);
-	DECLARE_UNQUALIFIED_COMMAND_OPCODE(open);
-	DECLARE_UNQUALIFIED_COMMAND_OPCODE(close);
-	DECLARE_UNQUALIFIED_COMMAND_OPCODE(on);
-	DECLARE_UNQUALIFIED_COMMAND_OPCODE(off);
-	DECLARE_UNQUALIFIED_COMMAND_OPCODE(call);
-	DECLARE_UNQUALIFIED_COMMAND_OPCODE(drop);
-	DECLARE_UNQUALIFIED_COMMAND_OPCODE(move);
-	DECLARE_UNQUALIFIED_COMMAND_OPCODE(start);
-	DECLARE_UNQUALIFIED_COMMAND_OPCODE(stop);
-	DECLARE_UNQUALIFIED_COMMAND_OPCODE(character);
-	DECLARE_UNQUALIFIED_COMMAND_OPCODE(followme);
-	DECLARE_UNQUALIFIED_COMMAND_OPCODE(onmouse);
-	DECLARE_UNQUALIFIED_COMMAND_OPCODE(offmouse);
-	DECLARE_UNQUALIFIED_COMMAND_OPCODE(add);
-	DECLARE_UNQUALIFIED_COMMAND_OPCODE(leave);
-	DECLARE_UNQUALIFIED_COMMAND_OPCODE(inc);
-	DECLARE_UNQUALIFIED_COMMAND_OPCODE(dec);
-	DECLARE_UNQUALIFIED_COMMAND_OPCODE(ifeq);
-	DECLARE_UNQUALIFIED_COMMAND_OPCODE(iflt);
-	DECLARE_UNQUALIFIED_COMMAND_OPCODE(ifgt);
-	DECLARE_UNQUALIFIED_COMMAND_OPCODE(let);
-	DECLARE_UNQUALIFIED_COMMAND_OPCODE(music);
-	DECLARE_UNQUALIFIED_COMMAND_OPCODE(fix);
-	DECLARE_UNQUALIFIED_COMMAND_OPCODE(unfix);
-	DECLARE_UNQUALIFIED_COMMAND_OPCODE(zeta);
-	DECLARE_UNQUALIFIED_COMMAND_OPCODE(scroll);
-	DECLARE_UNQUALIFIED_COMMAND_OPCODE(swap);
-	DECLARE_UNQUALIFIED_COMMAND_OPCODE(give);
-	DECLARE_UNQUALIFIED_COMMAND_OPCODE(text);
-	DECLARE_UNQUALIFIED_COMMAND_OPCODE(part);
-	DECLARE_UNQUALIFIED_COMMAND_OPCODE(testsfx);
-	DECLARE_UNQUALIFIED_COMMAND_OPCODE(ret);
-	DECLARE_UNQUALIFIED_COMMAND_OPCODE(onsave);
-	DECLARE_UNQUALIFIED_COMMAND_OPCODE(offsave);
-
-	DECLARE_UNQUALIFIED_INSTRUCTION_OPCODE(on);
-	DECLARE_UNQUALIFIED_INSTRUCTION_OPCODE(off);
-	DECLARE_UNQUALIFIED_INSTRUCTION_OPCODE(loop);
-	DECLARE_UNQUALIFIED_INSTRUCTION_OPCODE(inc);
-	DECLARE_UNQUALIFIED_INSTRUCTION_OPCODE(dec);
-	DECLARE_UNQUALIFIED_INSTRUCTION_OPCODE(set);
-	DECLARE_UNQUALIFIED_INSTRUCTION_OPCODE(put);
-	DECLARE_UNQUALIFIED_INSTRUCTION_OPCODE(wait);
-	DECLARE_UNQUALIFIED_INSTRUCTION_OPCODE(start);
-	DECLARE_UNQUALIFIED_INSTRUCTION_OPCODE(process);
-	DECLARE_UNQUALIFIED_INSTRUCTION_OPCODE(move);
-	DECLARE_UNQUALIFIED_INSTRUCTION_OPCODE(color);
-	DECLARE_UNQUALIFIED_INSTRUCTION_OPCODE(mask);
-	DECLARE_UNQUALIFIED_INSTRUCTION_OPCODE(print);
-	DECLARE_UNQUALIFIED_INSTRUCTION_OPCODE(text);
-	DECLARE_UNQUALIFIED_INSTRUCTION_OPCODE(mul);
-	DECLARE_UNQUALIFIED_INSTRUCTION_OPCODE(div);
-	DECLARE_UNQUALIFIED_INSTRUCTION_OPCODE(ifeq);
-	DECLARE_UNQUALIFIED_INSTRUCTION_OPCODE(iflt);
-	DECLARE_UNQUALIFIED_INSTRUCTION_OPCODE(ifgt);
-	DECLARE_UNQUALIFIED_INSTRUCTION_OPCODE(endif);
-	DECLARE_UNQUALIFIED_INSTRUCTION_OPCODE(stop);
-	DECLARE_UNQUALIFIED_INSTRUCTION_OPCODE(endscript);
-
-	void setupSubtitles(char *s, char *s2, int y);
-	void clearSubtitles();
 #if 0
 	void jobWaitRemoveLabelJob(void *parm, Job *job);
 	void jobPauseSfx(void *parm, Job *job);

Modified: scummvm/trunk/engines/parallaction/parallaction_br.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/parallaction_br.cpp	2008-07-11 12:55:08 UTC (rev 33002)
+++ scummvm/trunk/engines/parallaction/parallaction_br.cpp	2008-07-11 13:06:28 UTC (rev 33003)
@@ -72,12 +72,16 @@
 	initResources();
 	initFonts();
 	initCursors();
-	initOpcodes();
 	_locationParser = new LocationParser_br(this);
 	_locationParser->init();
 	_programParser = new ProgramParser_br(this);
 	_programParser->init();
 
+	_cmdExec = new CommandExec_br(this);
+	_cmdExec->init();
+	_programExec = new ProgramExec_br(this);
+	_programExec->init();
+
 	_part = -1;
 
 	_subtitle[0] = -1;
@@ -226,8 +230,14 @@
 	freeBackground();
 	_gfx->clearGfxObjects(kGfxObjNormal | kGfxObjCharacter);
 	_location._programs.clear();
+
+	_location._animations.remove(_char._ani);
+
 	freeZones();
 	freeAnimations();
+
+	_location._animations.push_front(_char._ani);
+
 //	free(_location._comment);
 //	_location._comment = 0;
 //	_location._commands.clear();
@@ -236,9 +246,9 @@
 
 	// load new location
 	parseLocation(location);
-	runCommands(_location._commands);
+	_cmdExec->run(_location._commands);
 //	doLocationEnterTransition();
-	runCommands(_location._aCommands);
+	_cmdExec->run(_location._aCommands);
 
 	_engineFlags &= ~kEngineChangeLocation;
 }
@@ -287,12 +297,16 @@
 
 
 void Parallaction_br::changeCharacter(const char *name) {
+	printf("changeCharacter(%s)\n", name);
+
 	const char *charName = _char.getName();
 	if (!scumm_stricmp(charName, name)) {
 		return;
 	}
 
 	_char.setName(name);
+	_char._ani->gfxobj = _gfx->loadAnim(name);
+	_char._ani->gfxobj->setFlags(kGfxObjCharacter);
 	_char._talk = _disk->loadTalk(name);
 }
 

Modified: scummvm/trunk/engines/parallaction/parallaction_ns.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/parallaction_ns.cpp	2008-07-11 12:55:08 UTC (rev 33002)
+++ scummvm/trunk/engines/parallaction/parallaction_ns.cpp	2008-07-11 13:06:28 UTC (rev 33003)
@@ -135,12 +135,16 @@
 	initResources();
 	initFonts();
 	initCursors();
-	initOpcodes();
 	_locationParser = new LocationParser_ns(this);
 	_locationParser->init();
 	_programParser = new ProgramParser_ns(this);
 	_programParser->init();
 
+	_cmdExec = new CommandExec_ns(this);
+	_cmdExec->init();
+	_programExec = new ProgramExec_ns(this);
+	_programExec->init();
+
 	_introSarcData1 = 0;
 	_introSarcData2 = 1;
 	_introSarcData3 = 200;
@@ -353,11 +357,11 @@
 	// and acommands are executed, so that it can be set again if needed.
 	_engineFlags &= ~kEngineChangeLocation;
 
-	runCommands(_location._commands);
+	_cmdExec->run(_location._commands);
 
 	doLocationEnterTransition();
 
-	runCommands(_location._aCommands);
+	_cmdExec->run(_location._aCommands);
 
 	if (_location._hasSound)
 		_soundMan->playSfx(_location._soundFile, 0, true);

Modified: scummvm/trunk/engines/parallaction/walk.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/walk.cpp	2008-07-11 12:55:08 UTC (rev 33002)
+++ scummvm/trunk/engines/parallaction/walk.cpp	2008-07-11 13:06:28 UTC (rev 33003)
@@ -347,7 +347,7 @@
 			_zoneTrap = nullZonePtr;
 
 		} else {
-			runCommands(z->_commands, z);
+			_cmdExec->run(z->_commands, z);
 		}
 	}
 
@@ -356,13 +356,13 @@
 
 	if (z) {
 		setLocationFlags(kFlagsEnter);
-		runCommands(z->_commands, z);
+		_cmdExec->run(z->_commands, z);
 		clearLocationFlags(kFlagsEnter);
 		_zoneTrap = z;
 	} else
 	if (_zoneTrap) {
 		setLocationFlags(kFlagsExit);
-		runCommands(_zoneTrap->_commands, _zoneTrap);
+		_cmdExec->run(_zoneTrap->_commands, _zoneTrap);
 		clearLocationFlags(kFlagsExit);
 		_zoneTrap = nullZonePtr;
 	}


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list