SRL Archive - SRL Archives

DebugTPA'Ex'


Naum

2010-02-22 12:06:49

The current one colours in the found point in red, this isn't any use when debugging points on doors, red dots and the like. So why not have a DebugTPA'Ex' where the user can choose the colour?

{*******************************************************************************
Function DebugTPAEx(Points: TPointArray; PointColor : Integer; BmpName: String): Boolean;
By: Wizzup?
Description: Shows an image of the Debug screen, plotting the color 'PointColor' over the points
stored in Points TPA. If a name is specified, an image will be saved to that path.
*******************************************************************************}
Function DebugTPAEx(Points: TPointArray; PointColor : Integer; BmpName: String): Boolean;
{$ifdef Simba}
var
Bmp,i : integer;
TempTPA : TPointArray;
Box : TBox;
begin
Box := GetTPABounds(Points);
Bmp := BitmapFromClient(Box.x1,Box.y1,Box.x2,Box.y2);
SetLength(TempTPA,Length(Points));
for i := high(points) downto 0 do
TempTPA[i] := Point(Points[i].x-box.x1,Points[i].y - box.y1);
DrawTPABitmap(Bmp,TempTPA, PointColor);
DisplayDebugImgWindow(box.x2-Box.x1 + 1, box.y2-box.y1 + 1);
DrawBitmapDebugImg(Bmp);
if bmpname <> '' then
SaveBitmap(Bmp, ScriptPath + BmpName + '.bmp');
FreeBitmap(Bmp);
end;
{$else}
Var
Width, Height, ClientBMP, I, H: Integer;
xs, ys, xe, ye: Integer;

Begin
Try
Begin
xe := xs xor xs;
ye := ys xor ys;
xs := 1 shl 20;
ys := 1 shl 20;

H := High(Points);
For I := 0 To H Do
Begin
xs := Min(xs, Points[i].X);
ys := Min(ys, Points[i].Y);

xe := Max(xe, Points[i].X);
ye := Max(ye, Points[i].Y);
End;

Width := xe - xs;
Height := ye - ys;

DisplayDebugImgWindow(0, 0);
DisplayDebugImgWindow(Width, Height);
ClientBMP := BitmapFromString(Width, Height, '');

CopyClientToBitmap(ClientBMP, xs, ys, xe, ye);
For I := 0 To H Do
FastSetPixel(ClientBMP, Points[i].X - xs, Points[i].Y - ys, PointColor);
If BmpName <> '' Then
SaveBitmap(ClientBMP, ScriptPath + BmpName + '.bmp');
SafeDrawBitmap(ClientBMP, GetDebugCanvas, 0, 0);
DisplayDebugImgWindow(Width, Height);

FreeBitmap(ClientBMP);
End
Except
FreeBitmap(ClientBMP);
End;
Result := True;
End;
{$endif}

{*******************************************************************************
Function DebugTPA(Points: TPointArray; BmpName: String): Boolean;
By: Wizzup? edited by Naum
Description: Shows an image of the Debug screen, plotting colors over the points
stored in Points TPA. If a name is specified, an image will be saved to that path.
*******************************************************************************}

Function DebugTPA(Points: TPointArray; BmpName: String) : Boolean;
Begin
Result := DebugTPAEx(Points, ClRed, BmpName);
End;

marpis

2010-02-22 12:08:10

Committing :)
E: Oh, but first I gotta get the latest Simba somewhere…

Naum

2010-02-22 14:52:39

From: marpis
Committing :)
E: Oh, but first I gotta get the latest Simba somewhere…


Thanks <3

Wanted

2010-02-27 10:44:19

(9:41:48 AM) Naum: commit something for me?
(9:42:00 AM) James: what
(9:42:50 AM) Naum: http://villavu.com/forum/showthread.php?t=55120
(9:42:52 AM) Naum: commit this pl0x
(9:43:23 AM) James: lmao
(9:43:31 AM) James: whats the point of this?
(9:43:47 AM) Naum: making it a different colour than red
(9:43:48 AM) James: DeBugATPA([TPA], '')
(9:43:50 AM) James: problem solved
(9:43:52 AM) James: denied
(9:44:13 AM) Naum: didn't think of that lol
(9:44:21 AM) Naum: accepted your denied


And thats all I have to say about that