PDA

View Full Version : rsc_GetCompassAngleDegrees;



weequ
12-02-2009, 10:16 PM
{************************************************* ******************************
function rsc_GetCompassAngleDegrees: Extended;
By: Wizzup?. Modded for rsc by antti mies.
Description: Returns the compass angle in degrees.
************************************************** *****************************}
function rsc_GetCompassAngleDegrees: Extended;

Var
North, Compass: TPointArray;
MyPoint, MiddleCompass: TPoint;

Begin
Result := -1;
GameTabRSC(5);
FindColors(North, 264324, RSSX1+353, 36, RSSX1+393, 75);
FindColors(Compass, 4026033, RSSX1+353, 36, RSSX1+393, 75);
If (Length(North) < 1) or (Length(Compass) < 1) Then
Exit;
MyPoint := MiddleTPA(North);
MiddleCompass := MiddleTPA(Compass);
Result := Degrees(ArcTan2(-(MyPoint.Y - MiddleCompass.Y), MyPoint.X - MiddleCompass.X)) - 90;
If (Result < 0) Then
Result := Result + 360;
End;
Now someone make RSC_MakeCompass ;)

Awkwardsaw
12-02-2009, 11:28 PM
i'll commit this when i get on tonight, unless someone else wants too :)