ollie
2006-05-28 04:10:18
This Function Was in GenoDemoNs Ub3r Fighter and i didnt see it in SRL
maybe its useful?
maybe its useful?
function findcolorex(cmc,l,u,r,d,rl,ru,rr,rd:integer):boolean;
var
x1,x2,x3,x4,y1,y2,y3,y4,xxx,yyy,d1,d2,d3,d4:integer ;
b1,b2,b3,b4:boolean;
begin
xxx:=(rl+rr)/2;
yyy:=(ru+rd)/2;
IF ((findcolorspiraltolerance(x1,y1,cmc,l,u,r,ru,tol)) or
(findcolorspiraltolerance(x2,y2,cmc,l,ru,rl,rd,tol))or
(findcolorspiraltolerance(x3,y3,cmc,rr,ru,r,rd,tol))or
(findcolorspiraltolerance(x4,y4,cmc,l,rd,r,d,tol)))then
begin
b1:=false;
b2:=false;
b3:=false;
b4:=false;
IF (findcolorspiraltolerance(x1,y1,cmc,l,u,r,ru,tol)) then b1:=true;
IF (findcolorspiraltolerance(x2,y2,cmc,l,ru,rl,rd,tol)) then b2:=true;
IF (findcolorspiraltolerance(x3,y3,cmc,rr,ru,r,rd,tol)) then b3:=true;
IF (findcolorspiraltolerance(x4,y4,cmc,l,rd,r,d,tol)) then b4:=true;
d1:=(xxx-x1)*(xxx-x1)+(yyy-y1)*(yyy-y1);
d2:=(xxx-x2)*(xxx-x2)+(yyy-y2)*(yyy-y2);
d3:=(xxx-x3)*(xxx-x3)+(yyy-y3)*(yyy-y3);
d4:=(xxx-x4)*(xxx-x4)+(yyy-y4)*(yyy-y4);
result:=false;
If ((d1<d2)and(d1<d3)and(d1<d4)and(b1)) then
begin
x:=x1;
y:=y1;
result:=true;
end;
If ((d2<d1)and(d2<d3)and(d2<d4)and(b2)) then
begin
x:=x2;
y:=y2;
result:=true;
end;
If ((d3<d2)and(d3<d1)and(d3<d4)and(b3)) then
begin
x:=x3;
y:=y3;
result:=true;
end;
If ((d4<d2)and(d4<d3)and(d4<d1)and(b4)) then
begin
x:=x4;
y:=y4;
result:=true;
end;
end;
end;