Hi
Working on making SPS work at any angle.
16/12/2012 made a snippet to rotate the minimap:
Simba Code:
// Returns an image of the minimap in a TMufasaBitmap
function SPS_GatherMinimap: TMufasaBitmap;
var
NormalMM, w, h, x, y: Integer;
rsAngle: Extended;
NormalDetails: T2DIntegerArray;
RotatedDetails: Array[0..149] of Array[0..149] of Integer;
P: TPoint;
begin
try
// Grabbing the minimap and converting it to a 2d array
GetClientDimensions(w, h);
NormalMM := BitmapFromString(w, h, '');
CopyClientToBitmap(NormalMM, 0, 0, w, h);
NormalDetails := GetBitmapAreaColors(NormalMM, 0, 0, w, h);
FreeBitmap(NormalMM);
// Rotating the minimap based on the angle and details we have
rsAngle := 0 - rs_GetCompassAngleRadians;
writeln('Rads: ' + ToStr(rsAngle));
for x:=0 to High(RotatedDetails) do
for y:=0 to High(RotatedDetails[x]) do
begin
P := RotatePoint(Point(X+MMCX-75, Y+MMCY-75), rsAngle, MMCX, MMCY);
if P.y < 0 then P.y := 0;
//writeln('P.x: ' + ToStr(P.x) + ' P.y: ' + ToStr(P.y));
RotatedDetails[x][y] := NormalDetails[P.x][P.y];
//Wait(5);
end;
// Creating the Result
Result := TMufasaBitmap.Create;
Result.SetSize(150, 150);
// Putting the colors based on our array filled with details on the result
for x:=0 to Result.Width-1 do
for y:=0 to Result.Height-1 do
Result.FastSetPixel(x, y, RotatedDetails[x][y]);
except
Writeln('SPS_GatherMinimap ERROR: '+ExceptionToString(ExceptionType, ExceptionParam));
end;
end;
It is pretty slow so I"ll work on something better.
17/12/2012 made it a lot faster:
Simba Code:
function SPS_GatherMinimap: TMufasaBitmap;
var
mmBmp, rBmp, w, h, x, y: Integer;
Details: T2DIntegerArray;
begin
try
// Getting the world map and rotating it
mmBmp := BitmapFromClient(MMCX-75, MMCY-75, MMCX+75, MMCY+75);
rBmp := RotateBitmap(mmBmp, 0-rs_GetCompassAngleRadians);
FreeBitmap(mmBmp);
// Getting the new width/height
GetBitmapSize(rBmp, w, h);
Details := GetBitmapAreaColors(rBmp, w/2-75, h/2-75, w/2+75, w/2+75);
FreeBitmap(rBmp);
// Creating the result
Result := TMufasaBitmap.Create;
Result.SetSize(150, 150);
// Putting the colors based on our array filled with details on the result
for x:=0 to 149 do
for y:=0 to 149 do
Result.FastSetPixel(x, y, Details[x][y]);
except
Writeln('SPS_GatherMinimap ERROR: '+ExceptionToString(ExceptionType, ExceptionParam));
end;
end;
Added rotation support to SPS functions. Added example script & new SPS file as attachment. Please test it with some walking just like you normally would. It automatically rotates everything etc. just let it run like normal. Let me know how it runs!