diff options
| -rw-r--r-- | engines/sherlock/tattoo/tattoo_scene.h | 6 | ||||
| -rw-r--r-- | engines/sherlock/tattoo/tattoo_talk.cpp | 27 | 
2 files changed, 29 insertions, 4 deletions
diff --git a/engines/sherlock/tattoo/tattoo_scene.h b/engines/sherlock/tattoo/tattoo_scene.h index 432233f501..c432849bed 100644 --- a/engines/sherlock/tattoo/tattoo_scene.h +++ b/engines/sherlock/tattoo/tattoo_scene.h @@ -35,12 +35,12 @@ enum {  };  struct SceneTripEntry { -	bool _flag; +	int _flag;  	int _sceneNumber;  	int _numTimes; -	SceneTripEntry() : _flag(false), _sceneNumber(0), _numTimes(0) {} -	SceneTripEntry(bool flag, int sceneNumber, int numTimes) : _flag(flag), +	SceneTripEntry() : _flag(0), _sceneNumber(0), _numTimes(0) {} +	SceneTripEntry(int flag, int sceneNumber, int numTimes) : _flag(flag),  		_sceneNumber(sceneNumber), _numTimes(numTimes) {}  }; diff --git a/engines/sherlock/tattoo/tattoo_talk.cpp b/engines/sherlock/tattoo/tattoo_talk.cpp index 5bfccdced3..e176d38ef1 100644 --- a/engines/sherlock/tattoo/tattoo_talk.cpp +++ b/engines/sherlock/tattoo/tattoo_talk.cpp @@ -726,7 +726,32 @@ OpcodeReturn TattooTalk::cmdSetNPCWalkGraphics(const byte *&str) {  	return RET_SUCCESS;  } -OpcodeReturn TattooTalk::cmdSetSceneEntryFlag(const byte *&str) { error("TODO: script opcode (cmdSetSceneEntryFlag)"); } +OpcodeReturn TattooTalk::cmdSetSceneEntryFlag(const byte *&str) { +	TattooScene &scene = *(TattooScene *)_vm->_scene; +	++str; +	int flag = (str[0] - 1) * 256 + str[1] - 1 - (str[1] == 1); + +	int flag1 = flag & 16383; +	if (flag > 16383) +		flag1 *= -1; + +	str += 2; + +	// Make sure that this instance is not already being tracked +	bool found = false; +	for (uint idx = 0; idx < scene._sceneTripCounters.size() && !found; ++idx) { +		SceneTripEntry &entry = scene._sceneTripCounters[idx]; +		if (entry._flag == flag1 && entry._sceneNumber == str[0] - 1) +			found = true; +	} + +	// Only add it if it's not being tracked already +	if (!found) +		scene._sceneTripCounters.push_back(SceneTripEntry(flag1, str[0] - 1, str[1] - 1)); + +	++str; +	return RET_SUCCESS; +}  OpcodeReturn TattooTalk::cmdSetTalkSequence(const byte *&str) {  	TattooPeople &people = *(TattooPeople *)_vm->_people;  | 
