diff options
| -rw-r--r-- | engines/parallaction/exec.h | 18 | ||||
| -rw-r--r-- | engines/parallaction/exec_br.cpp | 90 | ||||
| -rw-r--r-- | engines/parallaction/parallaction.h | 2 | ||||
| -rw-r--r-- | engines/parallaction/parallaction_br.cpp | 28 | 
4 files changed, 117 insertions, 21 deletions
diff --git a/engines/parallaction/exec.h b/engines/parallaction/exec.h index 2fd141c414..c49bf6ffcb 100644 --- a/engines/parallaction/exec.h +++ b/engines/parallaction/exec.h @@ -116,11 +116,19 @@ public:  	~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 @@ public:  	~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); diff --git a/engines/parallaction/exec_br.cpp b/engines/parallaction/exec_br.cpp index 274e8187ff..e49b679e9d 100644 --- a/engines/parallaction/exec_br.cpp +++ b/engines/parallaction/exec_br.cpp @@ -309,6 +309,58 @@ DECLARE_COMMAND_OPCODE(offsave) {  	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); +	} +} @@ -445,6 +497,40 @@ DECLARE_INSTRUCTION_OPCODE(stop) {  	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 @@ void CommandExec_br::init() {  	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 @@ void ProgramExec_br::init() {  	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;  } diff --git a/engines/parallaction/parallaction.h b/engines/parallaction/parallaction.h index e86485d036..8d1e15b5a2 100644 --- a/engines/parallaction/parallaction.h +++ b/engines/parallaction/parallaction.h @@ -475,7 +475,7 @@ private:  #define NUM_ZONES	100 -class Parallaction_br : public Parallaction_ns { +class Parallaction_br : public Parallaction {  public:  	Parallaction_br(OSystem* syst, const PARALLACTIONGameDescription *gameDesc); diff --git a/engines/parallaction/parallaction_br.cpp b/engines/parallaction/parallaction_br.cpp index 7d71a72666..2d3a3e23b2 100644 --- a/engines/parallaction/parallaction_br.cpp +++ b/engines/parallaction/parallaction_br.cpp @@ -43,7 +43,7 @@ const char *Parallaction_br::_partNames[] = {  	"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,26 +52,22 @@ Common::Error Parallaction_br::init() {  	_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();  | 
