Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- procedure mapSkew;
- var
- Box, roadBox: TBox;
- bridgeCol,bankCol,floorCol,roadCol,roadCol2,preferredRoad: TcolEx;
- TPA,floorTPA,test4,test5: TPointArray;
- walkPoint,singlePoint,leftSort,rightSort,symbolPnt,symbolPnt2,newPoint: Tpoint;
- foundBank,foundAltar: boolean;
- newX,newY : extended;
- angle: extended;
- begin
- roadCol.create(6579564,7,0.7,0.7);
- roadCol2.create(4671311,7,0.7,0.7);
- Box := [561,4,646,164];
- roadBox := [567,22,706,141];
- roadCol.findAllIn(roadBox,test4);
- roadCol2.findAllIn(roadBox,test5);
- if (length(test4) = 0) and (length(test5) = 0) then
- begin
- writeLn('** Not in view of the road or none of the colors for the road are working **');
- end;
- if (length(test4) > length(test5)) then
- begin
- writeLn('Preferred road color is Road 1');
- preferredRoad := roadCol;
- end;
- if (length(test5) > length(test4)) then
- begin
- writeLn('Preferred road color is Road 2');
- preferredRoad := roadCol2;
- end;
- writeLn('Preferred road color is: ',preferredRoad);
- preferredRoad.findAllIn(roadBox,TPA);
- writeLn('Road TPA length: ',length(TPA));
- if (length(TPA) > 0) then
- begin
- writeLn('Checking Middle');
- sortTPAFrom(TPA,point(553,57));
- LeftSort := TPA[0];
- sortTPAFrom(TPA,point(725,37));
- RightSort := TPA[0];
- newX := Floor((RightSort.X + LeftSort.X)/2);
- newY := Floor((RightSort.Y + LeftSort.Y)/2);
- writeLn(newx,','newy);
- writeLn('LeftSort: ',leftSort,' RightSort: ',rightSort);
- //angle := arctan2(leftSort.y - rightSort.y, leftSort.x - rightSort.x);
- //angle := arctan2(rightSort.y - leftSort.y, rightSort.x - leftSort.x );
- //atan2(x1 * y2 - y1 * x2, x1 * x2 + y1 * y2)
- //angle := arctan2((leftsort.X * (rightsort.y) - leftsort.y * (rightsort.x)),(leftsort.x * (rightsort.x) + leftsort.y * (rightsort.Y)));
- angle := ((arctan2(rightSort.y - leftSort.y, rightSort.x - leftSort.x) / pi) * 180);
- if (angle > 0) then
- begin
- newPoint := point(MMCX + round(25 * cos(angle)), MMCY + round(50 * sin(angle)));
- writeLn('Angle: ',angle);
- writeLn('New Point: ',newPoint);
- humanMMouse(newpoint,0,0);
- wait(1000);
- end;
- if (angle < 0) then
- begin
- angle := ((arctan2(leftSort.y - rightSort.y, leftSort.x - rightSort.x) / pi) * 180);
- newPoint := point(MMCX + round(25 * cos(angle)), MMCY + round(50 * sin(angle)));
- writeLn('Angle: ',angle);
- writeLn('New Point: ',newPoint);
- humanMMouse(newpoint,0,0);
- wait(1000);
- end;
- end;
- end;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement