diff options
| author | Walter van Niftrik | 2016-04-12 21:52:31 +0200 | 
|---|---|---|
| committer | Walter van Niftrik | 2016-06-06 20:35:49 +0200 | 
| commit | d2175a70ce3873e09f9f7b7bc84dcc1b614ae054 (patch) | |
| tree | afc4bf1c782a6bfd589d640fe9f972b364393a8e | |
| parent | 04604ed6023aa322660f3ab5e93a3a067b22bbf4 (diff) | |
| download | scummvm-rg350-d2175a70ce3873e09f9f7b7bc84dcc1b614ae054.tar.gz scummvm-rg350-d2175a70ce3873e09f9f7b7bc84dcc1b614ae054.tar.bz2 scummvm-rg350-d2175a70ce3873e09f9f7b7bc84dcc1b614ae054.zip | |
ADL: Implement remaining hires6 conditionals
| -rw-r--r-- | engines/adl/adl_v3.cpp | 42 | ||||
| -rw-r--r-- | engines/adl/adl_v3.h | 5 | 
2 files changed, 42 insertions, 5 deletions
| diff --git a/engines/adl/adl_v3.cpp b/engines/adl/adl_v3.cpp index e326b05af5..4f2b3449ee 100644 --- a/engines/adl/adl_v3.cpp +++ b/engines/adl/adl_v3.cpp @@ -30,7 +30,8 @@  namespace Adl {  AdlEngine_v3::AdlEngine_v3(OSystem *syst, const AdlGameDescription *gd) : -		AdlEngine_v2(syst, gd) { +		AdlEngine_v2(syst, gd), +		_curDisk(1) {  }  Common::String AdlEngine_v3::loadMessage(uint idx) const { @@ -57,9 +58,9 @@ void AdlEngine_v3::setupOpcodeTables() {  	OpcodeUnImpl();  	Opcode(o2_isFirstTime);  	Opcode(o2_isRandomGT); -	Opcode(o1_isItemInRoom); +	Opcode(o3_isItemInRoom);  	// 0x04 -	Opcode(o2_isNounNotInRoom); +	Opcode(o3_isNounNotInRoom);  	Opcode(o1_isMovesGT);  	Opcode(o1_isVarEQ);  	Opcode(o2_isCarryingSomething); @@ -122,9 +123,8 @@ int AdlEngine_v3::o3_isVarGT(ScriptEnv &e) {  	return -1;  } -// FIXME: Move to HiRes6 class?  int AdlEngine_v3::o3_skipOneCommand(ScriptEnv &e) { -	OP_DEBUG_0("\t&& SKIP_NEXT_COMMAND()"); +	OP_DEBUG_0("\t&& SKIP_ONE_COMMAND()");  	_skipOneCommand = true;  	setVar(2, 0); @@ -132,4 +132,36 @@ int AdlEngine_v3::o3_skipOneCommand(ScriptEnv &e) {  	return -1;  } +int AdlEngine_v3::o3_isItemInRoom(ScriptEnv &e) { +	OP_DEBUG_2("\t&& GET_ITEM_ROOM(%s) == %s", itemStr(e.arg(1)).c_str(), itemRoomStr(e.arg(2)).c_str()); + +	const Item &item = getItem(e.arg(1)); + +	if (e.arg(2) != IDI_ANY && item.isLineArt != _curDisk) +		return -1; + +	if (item.room == roomArg(e.arg(2))) +		return 2; + +	return -1; +} + +int AdlEngine_v3::o3_isNounNotInRoom(ScriptEnv &e) { +	OP_DEBUG_1("\t&& NO_SUCH_ITEMS_IN_ROOM(%s)", itemRoomStr(e.arg(1)).c_str()); + +	Common::List<Item>::const_iterator item; + +	setVar(24, 0); + +	for (item = _state.items.begin(); item != _state.items.end(); ++item) +		if (item->noun == e.getNoun()) { +			setVar(24, 1); + +			if (item->room == roomArg(e.arg(1))) +				return -1; +		} + +	return 1; +} +  } // End of namespace Adl diff --git a/engines/adl/adl_v3.h b/engines/adl/adl_v3.h index f99e0bd1e8..7d4790f045 100644 --- a/engines/adl/adl_v3.h +++ b/engines/adl/adl_v3.h @@ -46,7 +46,12 @@ protected:  	virtual Common::String loadMessage(uint idx) const;  	int o3_isVarGT(ScriptEnv &e); +	int o3_isItemInRoom(ScriptEnv &e); +	int o3_isNounNotInRoom(ScriptEnv &e);  	int o3_skipOneCommand(ScriptEnv &e); + +private: +	byte _curDisk;  };  } // End of namespace Adl | 
