diff options
| -rw-r--r-- | engines/avalanche/lucerna2.cpp | 30 | ||||
| -rw-r--r-- | engines/avalanche/lucerna2.h | 2 | 
2 files changed, 13 insertions, 19 deletions
| diff --git a/engines/avalanche/lucerna2.cpp b/engines/avalanche/lucerna2.cpp index d6aab20c4f..d96bbbc5e0 100644 --- a/engines/avalanche/lucerna2.cpp +++ b/engines/avalanche/lucerna2.cpp @@ -1332,25 +1332,19 @@ void Lucerna::major_redraw() {  }  uint16 Lucerna::bearing(byte whichped) { -/* Returns the bearing from ped Whichped to Avvy, in degrees. */ -	const double rad2deg = 180 / 3.14/*Pi*/; - -	uint16 bearing_result;  -	{ -		pedtype &with = _vm->_gyro->peds[whichped]; -		if (_vm->_trip->tr[0].x == with.x) -			bearing_result = 0; /* This would cause a division by zero if we let it through. */ -		else { -			/* -			 bearing:=trunc(((arctan((_vm->_trip->tr[1].y-y)/(_vm->_trip->tr[1].x-x)))*rad2deg)+90) mod 360*/ +	whichped--; // Different array indexes in Pascal and C. + +	const double rad2deg = 180 / 3.14 /*Pi*/; -			if (_vm->_trip->tr[0].x < with.x) -				bearing_result = (atan(double((_vm->_trip->tr[0].y - with.y)) / (_vm->_trip->tr[0].x - with.x)) * rad2deg) + 90; -			else -				bearing_result = (atan(double((_vm->_trip->tr[0].y - with.y)) / (_vm->_trip->tr[0].x - with.x)) * rad2deg) + 270; -		} -	} -	return bearing_result; +	if (_vm->_trip->tr[0].x == _vm->_gyro->peds[whichped].x) +		return 0; +	else  +		if (_vm->_trip->tr[0].x < _vm->_gyro->peds[whichped].x) +			return (atan(double((_vm->_trip->tr[0].y - _vm->_gyro->peds[whichped].y)) +					/ (_vm->_trip->tr[0].x - _vm->_gyro->peds[whichped].x)) * rad2deg) + 90; +		else +			return (atan(double((_vm->_trip->tr[0].y - _vm->_gyro->peds[whichped].y)) +					/ (_vm->_trip->tr[0].x - _vm->_gyro->peds[whichped].x)) * rad2deg) + 270;  }  void Lucerna::sprite_run() { diff --git a/engines/avalanche/lucerna2.h b/engines/avalanche/lucerna2.h index 8ab7342c42..854c01cc28 100644 --- a/engines/avalanche/lucerna2.h +++ b/engines/avalanche/lucerna2.h @@ -100,7 +100,7 @@ public:  	void major_redraw(); -	uint16 bearing(byte whichped); +	uint16 bearing(byte whichped); // Returns the bearing from ped Whichped to Avvy, in degrees.  	void flesh_colours(); | 
