SCAR Code:
program New;
{.include SRL/SRL.scar}
{*******************************************************************************
function tPtArrayToStr(newTPoint: TPointarray): String;
By: moparisthebest
Description: Loads a TPointArray into a string. (Example String: '50,10 80,53 350,765 8560,1897 2348,346')
*******************************************************************************}
function tPtArrayToStr(newTPoint: TPointArray): string;
var
i, tPtLength: Integer;
begin
tPtLength := GetArrayLength(newTPoint);
repeat
Result := Result + IntToStr(newTPoint[i].x) + ',' +
IntToStr(newTPoint[i].y);
if (not (i = (tPtLength - 1))) then
Result := Result + ' ';
i := i + 1;
until (i = tPtLength)
end;
function FindAllBitmapsIn(TheBmp,startx,starty,endx,endy:integer):array of tpoint;
var tmpbool:boolean;
AL:integer;
curx,cury,tmpx,tmpy,height:integer;
begin
tmpbool:=FindBitmapIn(TheBmp,tmpx,tmpy,startx,starty,endx,endy);
if tmpbool then
begin
curx:=startx;
cury:=starty;
/////auto height finder///////
tmpbool:=FindBitmapIn(TheBmp,tmpx,tmpy,startx,starty,endx,endy);
height:=0;
repeat
height:=height+1;
tmpbool:=FindBitmapIn(TheBmp,tmpx,tmpy,startx,tmpy,endx,tmpy+height);
until tmpbool;
//writeln('height '+inttostr(height));
///////////
repeat
tmpbool:=FindBitmapIn(TheBmp,tmpx,tmpy,curx,cury,endx,cury+height);
if tmpbool then
begin
curx:=tmpx+1;
AL:=getarraylength(result);
setarraylength(result,AL+1);
result[AL].x:=tmpx;
result[AL].y:=tmpy;
end;
if not tmpbool then
begin
curx:=startx;
cury:=cury+1;
end;
until cury=endy+1;
end;
end;
var mytpa:array of tpoint;
t,PlayerDot:integer;
begin
SetupSRL;
PlayerDot := BitmapFromString(4, 5, 'z78DA3330000137570434C010' +
'8140576710C41471310241B026435723107436054188880102182' +
'28B0000E71C1BCB');
t:=getsystemtime;
mytpa:= FindAllBitmapsIn(PlayerDot,0,0,70,70);
writeln(inttostr(getsystemtime-t)+'ms');
writeln(tPtArrayToStr(mytpa));
end.