Heya. So I had to make up something like this in one of my projects I've been working on lately. Just feed the function a point on the MM and it'll turn your camera to that point as well as return the degree of the point. It works really nicely for SPS as well.
Simba Code:
Procedure TurnToMMPoint(P: TPoint);
var
BaseRad: Extended;
FinalAn,RMod,CAng: Integer;
begin
CAng := (Round(rs_GetCompassAngleDegrees)-90);
if (CAng < 0) then
CAng := (360+CAng);
BaseRad := (ArcTan2((P.Y - MMCY),(P.X - MMCX)) + Radians(CAng));
FinalAn := Round(Degrees(fixRad(BaseRad-Pi)));
MakeCompass(FinalAn);
end;
You can see it uses similar math to SRL's 'rs_GetCompassAngleRadians'. Maybe some of you will find the use out of this for things like rotating to the nearest NPC/Object on the MM to get a better camera view for a higher chance of finding the MS object, ect...
For use with SPS just do something like this:
Simba Code:
TurnToMMPoint(SPS_PosToMM(Point(X, Y)));
Edit:
I'd also like to bring up to an SRL dev a updated 'rs_GetCompassAngleRadians'. This modified version is mathematically correct therefore more accurate: Already added to the include.
Simba Code:
Function rs_GetCompassAngleRadians: Extended;
var
TPA: TPointArray;
T: TPoint;
B: TBox;
begin
B := IntToBox(524, 5, 562, 43);
with B do
FindColorsSpiralTolerance(T.x, T.y, TPA, 65536, x1, y1, x2, y2, 0);
if Length(TPA) < 1 then
Exit;
T := MiddleTPA(TPA);
Result := ArcTan2(-(T.Y - 24), T.X - 543) + Radians(90);
Result := fixRad(Result - Pi);
end;