diff options
| author | Travis Howell | 2007-04-15 14:32:58 +0000 | 
|---|---|---|
| committer | Travis Howell | 2007-04-15 14:32:58 +0000 | 
| commit | 5668e15b2efb2aa9ab5bff3cf6b257a3986602ff (patch) | |
| tree | e47d59fbd63748a1bc16b7b2190baf29ec744663 | |
| parent | 7fad7c6f3f40540c933a022c144bbe5187006f01 (diff) | |
| download | scummvm-rg350-5668e15b2efb2aa9ab5bff3cf6b257a3986602ff.tar.gz scummvm-rg350-5668e15b2efb2aa9ab5bff3cf6b257a3986602ff.tar.bz2 scummvm-rg350-5668e15b2efb2aa9ab5bff3cf6b257a3986602ff.zip | |
Update reporting of invalid script opcodes.
svn-id: r26501
| -rw-r--r-- | engines/agos/agos.cpp | 1 | ||||
| -rw-r--r-- | engines/agos/agos.h | 2 | ||||
| -rw-r--r-- | engines/agos/script.cpp | 30 | ||||
| -rw-r--r-- | engines/agos/script_e1.cpp | 2 | 
4 files changed, 16 insertions, 19 deletions
| diff --git a/engines/agos/agos.cpp b/engines/agos/agos.cpp index ce22b3c424..3bb984f199 100644 --- a/engines/agos/agos.cpp +++ b/engines/agos/agos.cpp @@ -112,6 +112,7 @@ AGOSEngine::AGOSEngine(OSystem *syst)  	_keyPressed = 0;  	_gameFile = 0; +	_opcode = 0;  	_itemMemSize = 0;  	_tableMemSize = 0; diff --git a/engines/agos/agos.h b/engines/agos/agos.h index 31df6d86a8..fc9b179fd7 100644 --- a/engines/agos/agos.h +++ b/engines/agos/agos.h @@ -141,7 +141,7 @@ class AGOSEngine : public Engine {  public:  	virtual void setupOpcodes(); -	int _numOpcodes; +	int _numOpcodes, _opcode;  	typedef void (AGOSEngine::*VgaOpcodeProc) (); diff --git a/engines/agos/script.cpp b/engines/agos/script.cpp index 3ba88524d9..ecc43038c1 100644 --- a/engines/agos/script.cpp +++ b/engines/agos/script.cpp @@ -61,8 +61,7 @@ int AGOSEngine::getScriptReturn() {  // -----------------------------------------------------------------------  void AGOSEngine::o_invalid() { -	// TODO: Better error reporting -	error("Invalid opcode"); +	error("Invalid opcode %d", _opcode);  }  void AGOSEngine::o_at() { @@ -883,7 +882,6 @@ void AGOSEngine::writeVariable(uint variable, uint16 contents) {  }  int AGOSEngine::runScript() { -	int opcode;  	bool flag;  	do { @@ -891,12 +889,12 @@ int AGOSEngine::runScript() {  			dumpOpcode(_codePtr);  		if (getGameType() == GType_ELVIRA1) { -			opcode = getVarOrWord(); -			if (opcode == 10000) +			_opcode = getVarOrWord(); +			if (_opcode == 10000)  				return 0;  		} else { -			opcode = getByte(); -			if (opcode == 0xFF) +			_opcode = getByte(); +			if (_opcode == 0xFF)  				return 0;  		} @@ -906,17 +904,17 @@ int AGOSEngine::runScript() {  		/* Invert condition? */  		flag = false;  		if (getGameType() == GType_ELVIRA1) { -			if (opcode == 203) { +			if (_opcode == 203) {  				flag = true; -				opcode = getVarOrWord(); -				if (opcode == 10000) +				_opcode = getVarOrWord(); +				if (_opcode == 10000)  					return 0;  			}  		} else { -			if (opcode == 0) { +			if (_opcode == 0) {  				flag = true; -				opcode = getByte(); -				if (opcode == 0xFF) +				_opcode = getByte(); +				if (_opcode == 0xFF)  					return 0;  			}  		} @@ -924,10 +922,10 @@ int AGOSEngine::runScript() {  		setScriptCondition(true);  		setScriptReturn(0); -		if (opcode > _numOpcodes) -			error("Invalid opcode '%d' encountered", opcode); +		if (_opcode > _numOpcodes) +			error("Invalid opcode '%d' encountered", _opcode); -		executeOpcode(opcode); +		executeOpcode(_opcode);  	} while (getScriptCondition() != flag && !getScriptReturn());  	return getScriptReturn(); diff --git a/engines/agos/script_e1.cpp b/engines/agos/script_e1.cpp index ba778b8d2e..4196cd9567 100644 --- a/engines/agos/script_e1.cpp +++ b/engines/agos/script_e1.cpp @@ -394,8 +394,6 @@ void AGOSEngine_Elvira1::setupOpcodes() {  }  void AGOSEngine_Elvira1::executeOpcode(int opcode) { -	printf("opcode %d\n", opcode); -  	OpcodeProcElvira1 op = _opcodesElvira1[opcode].proc;  	(this->*op) ();  } | 
