diff options
| author | Filippos Karapetis | 2015-06-13 23:27:21 +0300 | 
|---|---|---|
| committer | Filippos Karapetis | 2015-06-13 23:27:21 +0300 | 
| commit | 864dc6acb7915f9b45ce958ff0ad645de74019d5 (patch) | |
| tree | d6ceefd3775fce4e3df164389b21ceb10bda17b2 | |
| parent | d314257968837f6c1e26a8465e91cc263017e4bf (diff) | |
| download | scummvm-rg350-864dc6acb7915f9b45ce958ff0ad645de74019d5.tar.gz scummvm-rg350-864dc6acb7915f9b45ce958ff0ad645de74019d5.tar.bz2 scummvm-rg350-864dc6acb7915f9b45ce958ff0ad645de74019d5.zip | |
SHERLOCK: Initial implementation of the NPC-related opcodes
This includes cmdWalkHolmesAndNPCToCAnimation, cmdWalkNPCToCAnimation,
cmdWalkNPCToCoords and cmdWalkHomesAndNPCToCoords
| -rw-r--r-- | engines/sherlock/tattoo/tattoo_people.cpp | 8 | ||||
| -rw-r--r-- | engines/sherlock/tattoo/tattoo_people.h | 5 | ||||
| -rw-r--r-- | engines/sherlock/tattoo/tattoo_talk.cpp | 121 | 
3 files changed, 125 insertions, 9 deletions
| diff --git a/engines/sherlock/tattoo/tattoo_people.cpp b/engines/sherlock/tattoo/tattoo_people.cpp index 7560ca1593..609d3d73d3 100644 --- a/engines/sherlock/tattoo/tattoo_people.cpp +++ b/engines/sherlock/tattoo/tattoo_people.cpp @@ -243,7 +243,7 @@ void TattooPerson::gotoStand() {  }  void TattooPerson::setWalking() { -	error("TODO: setWalking"); +	warning("TODO: setWalking");  }  void TattooPerson::clearNPC() { @@ -253,7 +253,11 @@ void TattooPerson::clearNPC() {  }  void TattooPerson::updateNPC() { -	// TODO +	warning("TODO: updateNPC"); +} + +void TattooPerson::pushNPCPath() { +	warning("TODO: pushNPCPath");  }  /*----------------------------------------------------------------*/ diff --git a/engines/sherlock/tattoo/tattoo_people.h b/engines/sherlock/tattoo/tattoo_people.h index 110063dd15..50a0cb13ce 100644 --- a/engines/sherlock/tattoo/tattoo_people.h +++ b/engines/sherlock/tattoo/tattoo_people.h @@ -103,6 +103,11 @@ public:  	void updateNPC();  	/** +	 * Push the NPC's path +	 */ +	void pushNPCPath(); + +	/**  	 * This adjusts the sprites position, as well as it's animation sequence:  	 */  	virtual void adjustSprite(); diff --git a/engines/sherlock/tattoo/tattoo_talk.cpp b/engines/sherlock/tattoo/tattoo_talk.cpp index 78396c9d34..84ee63daaf 100644 --- a/engines/sherlock/tattoo/tattoo_talk.cpp +++ b/engines/sherlock/tattoo/tattoo_talk.cpp @@ -241,10 +241,12 @@ OpcodeReturn TattooTalk::cmdWalkHolmesToCoords(const byte *&str) {  	int x = (str[0] - 1) * 256 + str[1] - 1;  	if (x > 16384)  		x = -1 * (x - 16384); -	// TODO: The RT walkToCoords call has an extra parameter, person, which is 0 (Holmes) here  	warning("TODO: cmdWalkHolmesToCoords - call RT walkToCoords variant"); -	people[HOLMES].walkToCoords(Point32(x * FIXED_INT_MULTIPLIER, -		((str[2] - 1) * 256 + str[3] - 1) * FIXED_INT_MULTIPLIER), DIRECTION_CONVERSION[str[4] - 1]); +	people[HOLMES].walkToCoords( +		Point32(x * FIXED_INT_MULTIPLIER, ((str[2] - 1) * 256 + str[3] - 1) * FIXED_INT_MULTIPLIER), +		DIRECTION_CONVERSION[str[4] - 1] +		//HOLMES +	);  	if (_talkToAbort)  		return RET_EXIT; @@ -698,10 +700,115 @@ OpcodeReturn TattooTalk::cmdTalkInterruptsDisable(const byte *&str) { error("Dum  OpcodeReturn TattooTalk::cmdTalkInterruptsEnable(const byte *&str) { error("Dummy opcode cmdTalkInterruptsEnable called"); }  OpcodeReturn TattooTalk::cmdTurnSoundsOff(const byte *&str) { error("TODO: script opcode (cmdTurnSoundsOff)"); } -OpcodeReturn TattooTalk::cmdWalkHolmesAndNPCToCAnimation(const byte *&str) { error("TODO: script opcode (cmdWalkHolmesAndNPCToCAnimation)"); } -OpcodeReturn TattooTalk::cmdWalkNPCToCAnimation(const byte *&str) { error("TODO: script opcode (cmdWalkNPCToCAnimation)"); } -OpcodeReturn TattooTalk::cmdWalkNPCToCoords(const byte *&str) { error("TODO: script opcode (cmdWalkNPCToCoords)"); } -OpcodeReturn TattooTalk::cmdWalkHomesAndNPCToCoords(const byte *&str) { error("TODO: script opcode (cmdWalkHomesAndNPCToCoords)"); } + +OpcodeReturn TattooTalk::cmdWalkHolmesAndNPCToCAnimation(const byte *&str) { +	int npcNum = *++str; +	int cAnimNum = *++str; +	TattooPeople &people = *(TattooPeople *)_vm->_people; +	TattooPerson &person = people[npcNum]; +	Scene &scene = *_vm->_scene; +	CAnim &anim = scene._cAnim[cAnimNum]; + +	if (person._npcStack == 0) +		person.pushNPCPath(); +	person._npcMoved = true; + +	warning("TODO: cmdWalkNPCToCAnimation - walkBothToCoords call"); +	person.walkToCoords( +		Point32(anim._goto[1].x * FIXED_INT_MULTIPLIER, anim._goto[1].y * FIXED_INT_MULTIPLIER), +		anim._goto[1]._facing +		//Point32(anim._goto[1].x * FIXED_INT_MULTIPLIER, anim._goto[1].y * FIXED_INT_MULTIPLIER), +		//anim._goto[1]._facing, +		//npcNum + 1 +	); +	if (_talkToAbort) +		return RET_EXIT; + +	return RET_SUCCESS; +} + +OpcodeReturn TattooTalk::cmdWalkNPCToCAnimation(const byte *&str) { +	int npcNum = *++str; +	int cAnimNum = *++str; +	TattooPeople &people = *(TattooPeople *)_vm->_people; +	TattooPerson &person = people[npcNum]; +	Scene &scene = *_vm->_scene; +	CAnim &anim = scene._cAnim[cAnimNum]; + +	if (person._npcStack == 0) +		person.pushNPCPath(); +	person._npcMoved = true; + +	warning("TODO: cmdWalkNPCToCAnimation - call RT walkToCoords variant"); +	person.walkToCoords( +		Point32(anim._goto[1].x * FIXED_INT_MULTIPLIER, anim._goto[1].y * FIXED_INT_MULTIPLIER), +		anim._goto[1]._facing +		// npcNum + 1 +	); +	if (_talkToAbort) +		return RET_EXIT; + +	return RET_SUCCESS; +} + +OpcodeReturn TattooTalk::cmdWalkNPCToCoords(const byte *&str) { +	int npcNum = *++str; +	str++; +	TattooPeople &people = *(TattooPeople *)_vm->_people; +	TattooPerson &person = people[npcNum]; + +	if (person._npcStack == 0) +		person.pushNPCPath(); +	person._npcMoved = true; + +	int x = (str[0] - 1) * 256 + str[1] - 1; +	if (x > 16384) +		x = -1 * (x - 16384); + +	warning("TODO: cmdWalkNPCToCoords - call RT walkToCoords variant"); +	person.walkToCoords( +		Point32(x * FIXED_INT_MULTIPLIER, ((str[2] - 1) * 256 + str[3] - 1) * FIXED_INT_MULTIPLIER), +		DIRECTION_CONVERSION[str[4] - 1] +		// npcNum + 1 +	); +	if (_talkToAbort) +		return RET_EXIT; + +	str += 4; +	return RET_SUCCESS; +} + +OpcodeReturn TattooTalk::cmdWalkHomesAndNPCToCoords(const byte *&str) { +	int npcNum = *++str; +	str++; +	TattooPeople &people = *(TattooPeople *)_vm->_people; +	TattooPerson &person = people[npcNum]; + +	if (person._npcStack == 0) +		person.pushNPCPath(); +	person._npcMoved = true; + +	int x = (str[0] - 1) * 256 + str[1] - 1; +	if (x > 16384) +		x = -1 * (x - 16384); +	//int x1 = (str[5] - 1) * 256 + str[6] - 1; +	//if (x1 > 16384) +	//	x1 = -1 * (x1 - 16384); + +	warning("TODO: cmdWalkHomesAndNPCToCoords - walkBothToCoords call"); +	person.walkToCoords( +		Point32(x * FIXED_INT_MULTIPLIER, ((str[2] - 1) * 256 + str[3] - 1) * FIXED_INT_MULTIPLIER), +		DIRECTION_CONVERSION[str[4] - 1] +		//Point32(x1 * FIXED_INT_MULTIPLIER, ((str[7] - 1) * 256 + str[8] - 1) * FIXED_INT_MULTIPLIER), +		//DIRECTION_CONVERSION[str[9] - 1], +		//npcNum + 1 +	); +	if (_talkToAbort) +		return RET_EXIT; + +	str += 9; +	return RET_SUCCESS; +}  } // End of namespace Tattoo | 
