SRL Archive - SRL Bugs

IsDropdot, doorprofiles.scar


Awkwardsaw

2009-12-31 17:18:24

{*******************************************************************************
function IsDropDot(Pt: TPoint): Boolean;
By: Awkwardsaw
Description: Returns true if a point is in a drop dot.
*******************************************************************************}
function IsDropDot(Pt: TPoint): Boolean;
var
i: integer;
Col_Arr : Array of integer;
tpa : TPointArray;
begin
result := true;
Col_Arr := [395004, 237, 789758, 3553023];
for i := 0 to high(Col_Arr) do
if FindColorsTolerance(tpa, Col_Arr[i], Pt.x-4, Pt.y-4, Pt.x+4, Pt.y+4, 30) then
break;
result := length(tpa) > 4;
end;

the current one doesnt have correct colors, and the actual dot colors arent static, so i had to go with this

lordsaturn

2009-12-31 21:10:36

Yes they are static? Unless rs has been updated..

Awkwardsaw

2009-12-31 22:21:31

From: lordsaturn
Yes they are static? Unless rs has been updated..


when i tested, the old one didnt determine if it was a door, or a drop dot. this one does(for me atleast)

Boreas

2010-01-01 00:16:39

{ 3553023 789758
3553023 2105598 395004 237
789758 395004 237 206
65536 217 188 65536
65536 65536 }

RS hasn't updated, it matches that from Rev333 perfectly as of just now.

Naum

2010-01-01 06:25:09

From: Boreas
RS hasn't updated, it matches that from Rev333 perfectly as of just now.


There is a problem with it, I gather, last time I used it, it filtered the drop dots and the gate points.

Awkwardsaw

2010-01-01 08:39:03

From: Naum
There is a problem with it, I gather, last time I used it it filtered the drop dots and the gate points.


which was also one of my problems :( this one doesnt really fix it that though

Boreas

2010-01-13 13:21:11

I changed to this and it worked for me, only tried it on 1 screenshot though. My problems were that FindColorsTol in GetDoorPoints wasn't finding any points at all, and that FilterDropDots was filtering all points even with no dots at all.
{*******************************************************************************
function FilterDropDots(P: TPointArray): TPointArray;
By: lordsaturn
Description: Returns a TPointArray filtered of drop dots.
*******************************************************************************}
function FilterDropDots(P: TPointArray): TPointArray;
var
i, Hi, L: integer;
begin
Hi := High(P);
if Hi < 0 then Exit;
SetLength(Result, Hi+1);
for i := 0 to Hi do
begin
// if (not(IsDropDot(P[i]))) and rs_OnMinimap(P[i].x, P[i].y) and
// (InRange(GetColor(P[i].x, P[i].y), 200, 254))then
if not rs_OnMinimap(P[i].x, P[i].y) then
continue;
if InRange(GetColor(P[i].x, P[i].y), 200, 254) then
if IsDropDot(P[i]) then
continue;
Result[L] := P[i];
Inc(L);
end;
SetLength(Result, L);
end;

{*******************************************************************************
function GetDoorPoints: T2DPointArray;
By: lordsaturn
Description: Returns all door points on the minimap in a T2DPointArray.
*******************************************************************************}
function GetDoorPoints: T2DPointArray;
var
CTS: integer;
P: TPointArray;
begin
CTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorspeed2Modifiers(0.1, 0.1);
FindColorsTolerance(P, 227, MMX1, MMY1, MMX2, MMY2, 25);
SetColorspeed2Modifiers(0.2, 0.2);
ColorToleranceSpeed(CTS);
if Length(P) < 1 then Exit;
Result := SplitTPA(FilterDropDots(P), 6);
SortATPAFrom(Result, Point(MMCX, MMCY));
end;
I'm still having problems with SortDoors but I just ended up copying the midpoints to a TPA and sorting that.