diff options
Diffstat (limited to 'engines/avalanche/lucerna2.cpp')
| -rw-r--r-- | engines/avalanche/lucerna2.cpp | 30 | 
1 files changed, 12 insertions, 18 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() { | 
