diff options
| author | Travis Howell | 2010-10-25 08:03:55 +0000 | 
|---|---|---|
| committer | Travis Howell | 2010-10-25 08:03:55 +0000 | 
| commit | 4f0cc6a435d725e62d38a4c7bdbd597f7f142972 (patch) | |
| tree | db84e6f8ebb6401b6b20a6dad9ef64915451aa23 | |
| parent | f228c76b35ba5362ffac6fa7cc86fe1acd5fa8f7 (diff) | |
| download | scummvm-rg350-4f0cc6a435d725e62d38a4c7bdbd597f7f142972.tar.gz scummvm-rg350-4f0cc6a435d725e62d38a4c7bdbd597f7f142972.tar.bz2 scummvm-rg350-4f0cc6a435d725e62d38a4c7bdbd597f7f142972.zip | |
SCUMM: Add patch #3093541 - MMC64: Actor Walk / Object Fix.
svn-id: r53806
| -rw-r--r-- | engines/scumm/actor.cpp | 11 | ||||
| -rw-r--r-- | engines/scumm/object.cpp | 7 | ||||
| -rw-r--r-- | engines/scumm/script_v0.cpp | 5 | ||||
| -rw-r--r-- | engines/scumm/script_v2.cpp | 3 | ||||
| -rw-r--r-- | engines/scumm/scumm.cpp | 1 | ||||
| -rw-r--r-- | engines/scumm/scumm.h | 1 | 
6 files changed, 26 insertions, 2 deletions
| diff --git a/engines/scumm/actor.cpp b/engines/scumm/actor.cpp index 25ce3f5007..eba3bbb078 100644 --- a/engines/scumm/actor.cpp +++ b/engines/scumm/actor.cpp @@ -1052,9 +1052,17 @@ static int checkXYInBoxBounds(int boxnum, int x, int y, int &destX, int &destY)  	// yDist must be divided by 4, as we are using 8x2 pixels  	// blocks for actor coordinates).  	int xDist = ABS(x - destX); -	int yDist = ABS(y - destY) / 4; +	int yDist;  	int dist; +	// MM C64: This fixes the trunk bug (#3070065), as well +	// as the fruit bowl, however im not sure if its  +	// the proper solution or not. +	if( g_scumm->_game.version == 0 ) +		yDist = ABS(y - destY); +	else +		yDist = ABS(y - destY) / 4; +  	if (xDist < yDist)  		dist = (xDist >> 1) + yDist;  	else @@ -1082,6 +1090,7 @@ AdjustBoxResult Actor_v2::adjustXYToBeInBox(const int dstX, const int dstY) {  			abr.x = foundX;  			abr.y = foundY;  			abr.box = box; +  			break;  		}  		if (dist < bestDist) { diff --git a/engines/scumm/object.cpp b/engines/scumm/object.cpp index 60c3a9336e..c44043ca81 100644 --- a/engines/scumm/object.cpp +++ b/engines/scumm/object.cpp @@ -315,6 +315,10 @@ int ScummEngine::getObjectIndex(int object) const {  		return -1;  	for (i = (_numLocalObjects-1); i > 0; i--) { +		if (_game.version == 0 ) +			if( _objs[i].flags != _v0ObjectFlag ) +				continue; +  		if (_objs[i].obj_nr == object)  			return i;  	} @@ -526,6 +530,9 @@ int ScummEngine::findObject(int x, int y) {  #endif  				if (_objs[i].x_pos <= x && _objs[i].width + _objs[i].x_pos > x &&  				    _objs[i].y_pos <= y && _objs[i].height + _objs[i].y_pos > y) { +					// MMC64: Set the object search flag +					if (_game.version == 0) +						_v0ObjectFlag = _objs[i].flags;  					if (_game.version == 0 && _v0ObjectIndex)  						return i;  					else diff --git a/engines/scumm/script_v0.cpp b/engines/scumm/script_v0.cpp index cf44ee195e..c60819ed5b 100644 --- a/engines/scumm/script_v0.cpp +++ b/engines/scumm/script_v0.cpp @@ -987,7 +987,10 @@ void ScummEngine_v0::o_setOwnerOf() {  void ScummEngine_v0::resetSentence(bool walking) {  	_activeVerb = 13; -	if (!walking) { +	// If the actor is walking, or the screen is a keypad (no sentence verbs/objects are drawn) +	// Then reset all active objects (stops the radio crash, bug #3077966) +	if (!walking || !(_userState & 32)) { +		_v0ObjectFlag = 0;  		_activeInventory = 0;  		_activeObject = 0;  		_activeObject2 = 0; diff --git a/engines/scumm/script_v2.cpp b/engines/scumm/script_v2.cpp index bc8446d16f..d3a2272a39 100644 --- a/engines/scumm/script_v2.cpp +++ b/engines/scumm/script_v2.cpp @@ -1174,6 +1174,8 @@ void ScummEngine_v2::o2_walkActorToObject() {  	int obj;  	Actor *a; +	_v0ObjectFlag = 0; +  	a = derefActor(getVarOrDirectByte(PARAM_1), "o2_walkActorToObject");  	obj = getVarOrDirectWord(PARAM_2);  	if (whereIsObject(obj) != WIO_NOT_FOUND) { @@ -1182,6 +1184,7 @@ void ScummEngine_v2::o2_walkActorToObject() {  		AdjustBoxResult r = a->adjustXYToBeInBox(x, y);  		x = r.x;  		y = r.y; +  		a->startWalkActor(x, y, dir);  	}  } diff --git a/engines/scumm/scumm.cpp b/engines/scumm/scumm.cpp index d4865fa94d..18a7b6933c 100644 --- a/engines/scumm/scumm.cpp +++ b/engines/scumm/scumm.cpp @@ -146,6 +146,7 @@ ScummEngine::ScummEngine(OSystem *syst, const DetectorResult &dr)  	// Init all vars  	_v0ObjectIndex = false;  	_v0ObjectInInventory = false; +	_v0ObjectFlag = 0;  	_imuse = NULL;  	_imuseDigital = NULL;  	_musicEngine = NULL; diff --git a/engines/scumm/scumm.h b/engines/scumm/scumm.h index b94bb5e733..346d8fb79a 100644 --- a/engines/scumm/scumm.h +++ b/engines/scumm/scumm.h @@ -593,6 +593,7 @@ protected:  	bool _v0ObjectIndex;			// V0 Use object index, instead of object number  	bool _v0ObjectInInventory;		// V0 Use object number from inventory +	byte _v0ObjectFlag;  	/* Global resource tables */  	int _numVariables, _numBitVariables, _numLocalObjects; | 
