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

peres001 at users.sourceforge.net peres001 at users.sourceforge.net
Wed Feb 25 10:15:53 CET 2009


Revision: 38877
          http://scummvm.svn.sourceforge.net/scummvm/?rev=38877&view=rev
Author:   peres001
Date:     2009-02-25 09:15:53 +0000 (Wed, 25 Feb 2009)

Log Message:
-----------
* Rebased Parallaction_br to inherit from Parallaction instead of Parallaction_ns
* Same as above for CommandExec_br and ProgramExec_br
This should finally kill most issues with destruction, at the cost of some code duplication.

Modified Paths:
--------------
    scummvm/trunk/engines/parallaction/exec.h
    scummvm/trunk/engines/parallaction/exec_br.cpp
    scummvm/trunk/engines/parallaction/parallaction.h
    scummvm/trunk/engines/parallaction/parallaction_br.cpp

Modified: scummvm/trunk/engines/parallaction/exec.h
===================================================================
--- scummvm/trunk/engines/parallaction/exec.h	2009-02-25 08:53:58 UTC (rev 38876)
+++ scummvm/trunk/engines/parallaction/exec.h	2009-02-25 09:15:53 UTC (rev 38877)
@@ -116,11 +116,19 @@
 	~CommandExec_ns();
 };
 
-class CommandExec_br : public CommandExec_ns {
+class CommandExec_br : public CommandExec {
 
 protected:
 	Parallaction_br	*_vm;
 
+	DECLARE_UNQUALIFIED_COMMAND_OPCODE(invalid);
+	DECLARE_UNQUALIFIED_COMMAND_OPCODE(set);
+	DECLARE_UNQUALIFIED_COMMAND_OPCODE(clear);
+	DECLARE_UNQUALIFIED_COMMAND_OPCODE(speak);
+	DECLARE_UNQUALIFIED_COMMAND_OPCODE(get);
+	DECLARE_UNQUALIFIED_COMMAND_OPCODE(toggle);
+	DECLARE_UNQUALIFIED_COMMAND_OPCODE(quit);
+
 	DECLARE_UNQUALIFIED_COMMAND_OPCODE(location);
 	DECLARE_UNQUALIFIED_COMMAND_OPCODE(open);
 	DECLARE_UNQUALIFIED_COMMAND_OPCODE(close);
@@ -222,11 +230,17 @@
 	~ProgramExec_ns();
 };
 
-class ProgramExec_br : public ProgramExec_ns {
+class ProgramExec_br : public ProgramExec {
 
 	Parallaction_br *_vm;
 
 protected:
+	DECLARE_UNQUALIFIED_INSTRUCTION_OPCODE(invalid);
+	DECLARE_UNQUALIFIED_INSTRUCTION_OPCODE(loop);
+	DECLARE_UNQUALIFIED_INSTRUCTION_OPCODE(endloop);
+	DECLARE_UNQUALIFIED_INSTRUCTION_OPCODE(show);
+	DECLARE_UNQUALIFIED_INSTRUCTION_OPCODE(call);
+	DECLARE_UNQUALIFIED_INSTRUCTION_OPCODE(endscript);
 	DECLARE_UNQUALIFIED_INSTRUCTION_OPCODE(on);
  	DECLARE_UNQUALIFIED_INSTRUCTION_OPCODE(off);
 	DECLARE_UNQUALIFIED_INSTRUCTION_OPCODE(inc);

Modified: scummvm/trunk/engines/parallaction/exec_br.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/exec_br.cpp	2009-02-25 08:53:58 UTC (rev 38876)
+++ scummvm/trunk/engines/parallaction/exec_br.cpp	2009-02-25 09:15:53 UTC (rev 38877)
@@ -309,9 +309,61 @@
 	warning("Parallaction_br::cmdOp_offsave not yet implemented");
 }
 
+DECLARE_INSTRUCTION_OPCODE(invalid) {
+	error("Can't execute invalid opcode %i", (*_ctxt.inst)->_index);
+}
 
+DECLARE_COMMAND_OPCODE(clear) {
+	if (_ctxt.cmd->u._flags & kFlagsGlobal) {
+		_ctxt.cmd->u._flags &= ~kFlagsGlobal;
+		_globalFlags &= ~_ctxt.cmd->u._flags;
+	} else {
+		_vm->clearLocationFlags(_ctxt.cmd->u._flags);
+	}
+}
 
+DECLARE_COMMAND_OPCODE(speak) {
+	if (ACTIONTYPE(_ctxt.cmd->u._zone) == kZoneSpeak) {
+		_vm->enterDialogueMode(_ctxt.cmd->u._zone);
+	} else {
+		_vm->_activeZone = _ctxt.cmd->u._zone;
+	}
+}
 
+
+DECLARE_COMMAND_OPCODE(get) {
+	_ctxt.cmd->u._zone->_flags &= ~kFlagsFixed;
+	_vm->runZone(_ctxt.cmd->u._zone);
+}
+
+DECLARE_COMMAND_OPCODE(toggle) {
+	if (_ctxt.cmd->u._flags & kFlagsGlobal) {
+		_ctxt.cmd->u._flags &= ~kFlagsGlobal;
+		_globalFlags ^= _ctxt.cmd->u._flags;
+	} else {
+		_vm->toggleLocationFlags(_ctxt.cmd->u._flags);
+	}
+}
+
+DECLARE_COMMAND_OPCODE(quit) {
+	_vm->quitGame();
+}
+
+DECLARE_COMMAND_OPCODE(invalid) {
+	error("Can't execute invalid command '%i'", _ctxt.cmd->_id);
+}
+
+DECLARE_COMMAND_OPCODE(set) {
+	if (_ctxt.cmd->u._flags & kFlagsGlobal) {
+		_ctxt.cmd->u._flags &= ~kFlagsGlobal;
+		_globalFlags |= _ctxt.cmd->u._flags;
+	} else {
+		_vm->setLocationFlags(_ctxt.cmd->u._flags);
+	}
+}
+
+
+
 DECLARE_INSTRUCTION_OPCODE(on) {
 	_vm->showZone((*_ctxt.inst)->_z, true);
 }
@@ -445,7 +497,41 @@
 	warning("Parallaction_br::instOp_stop not yet implemented");
 }
 
+DECLARE_INSTRUCTION_OPCODE(loop) {
+	InstructionPtr inst = *_ctxt.inst;
 
+	_ctxt.program->_loopCounter = inst->_opB.getValue();
+	_ctxt.program->_loopStart = _ctxt.ip;
+}
+
+
+DECLARE_INSTRUCTION_OPCODE(endloop) {
+	if (--_ctxt.program->_loopCounter > 0) {
+		_ctxt.ip = _ctxt.program->_loopStart;
+	}
+}
+
+DECLARE_INSTRUCTION_OPCODE(show) {
+	_ctxt.suspend = true;
+}
+
+DECLARE_INSTRUCTION_OPCODE(call) {
+	_vm->callFunction((*_ctxt.inst)->_immediate, 0);
+}
+
+
+DECLARE_INSTRUCTION_OPCODE(endscript) {
+	if ((_ctxt.anim->_flags & kFlagsLooping) == 0) {
+		_ctxt.anim->_flags &= ~kFlagsActing;
+		_vm->_cmdExec->run(_ctxt.anim->_commands, _ctxt.anim);
+		_ctxt.program->_status = kProgramDone;
+	}
+
+	_ctxt.ip = _ctxt.program->_instructions.begin();
+	_ctxt.suspend = true;
+}
+
+
 void CommandExec_br::init() {
 	Common::Array<const Opcode*> *table = 0;
 
@@ -494,7 +580,7 @@
 	COMMAND_OPCODE(offsave);
 }
 
-CommandExec_br::CommandExec_br(Parallaction_br* vm) : CommandExec_ns(vm), _vm(vm) {
+CommandExec_br::CommandExec_br(Parallaction_br* vm) : CommandExec(vm), _vm(vm) {
 
 }
 
@@ -541,7 +627,7 @@
 	INSTRUCTION_OPCODE(endscript);
 }
 
-ProgramExec_br::ProgramExec_br(Parallaction_br *vm) : ProgramExec_ns(vm), _vm(vm) {
+ProgramExec_br::ProgramExec_br(Parallaction_br *vm) : _vm(vm) {
 	_instructionNames = _instructionNamesRes_br;
 }
 

Modified: scummvm/trunk/engines/parallaction/parallaction.h
===================================================================
--- scummvm/trunk/engines/parallaction/parallaction.h	2009-02-25 08:53:58 UTC (rev 38876)
+++ scummvm/trunk/engines/parallaction/parallaction.h	2009-02-25 09:15:53 UTC (rev 38877)
@@ -475,7 +475,7 @@
 
 #define NUM_ZONES	100
 
-class Parallaction_br : public Parallaction_ns {
+class Parallaction_br : public Parallaction {
 
 public:
 	Parallaction_br(OSystem* syst, const PARALLACTIONGameDescription *gameDesc);

Modified: scummvm/trunk/engines/parallaction/parallaction_br.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/parallaction_br.cpp	2009-02-25 08:53:58 UTC (rev 38876)
+++ scummvm/trunk/engines/parallaction/parallaction_br.cpp	2009-02-25 09:15:53 UTC (rev 38877)
@@ -43,7 +43,7 @@
 	"PART4"
 };
 
-Parallaction_br::Parallaction_br(OSystem* syst, const PARALLACTIONGameDescription *gameDesc) : Parallaction_ns(syst, gameDesc),
+Parallaction_br::Parallaction_br(OSystem* syst, const PARALLACTIONGameDescription *gameDesc) : Parallaction(syst, gameDesc),
 	_locationParser(0), _programParser(0) {
 }
 
@@ -52,27 +52,23 @@
 	_screenWidth = 640;
 	_screenHeight = 400;
 
-	if (getGameType() == GType_BRA) {
-		if (getPlatform() == Common::kPlatformPC) {
-			if (getFeatures() & GF_DEMO) {
-				_disk = new DosDemoDisk_br(this);
-			} else {
-				_disk = new DosDisk_br(this);
-			}
-			_disk->setLanguage(2);					// NOTE: language is now hardcoded to English. Original used command-line parameters.
-			_soundMan = new DummySoundMan(this);
+	if (getPlatform() == Common::kPlatformPC) {
+		if (getFeatures() & GF_DEMO) {
+			_disk = new DosDemoDisk_br(this);
 		} else {
-			_disk = new AmigaDisk_br(this);
-			_disk->setLanguage(2);					// NOTE: language is now hardcoded to English. Original used command-line parameters.
-			_soundMan = new AmigaSoundMan(this);
+			_disk = new DosDisk_br(this);
 		}
-
-		_disk->init();
+		_disk->setLanguage(2);					// NOTE: language is now hardcoded to English. Original used command-line parameters.
+		_soundMan = new DummySoundMan(this);
 	} else {
-		error("unknown game type");
+		_disk = new AmigaDisk_br(this);
+		_disk->setLanguage(2);					// NOTE: language is now hardcoded to English. Original used command-line parameters.
+		_soundMan = new AmigaSoundMan(this);
 	}
 
+	_disk->init();
 
+
 	initResources();
 	initFonts();
 	_locationParser = new LocationParser_br(this);


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