Janilabo

Untitled

Aug 19th, 2012
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pascal 1.07 KB | None | 0 0
  1. function MapPos(var map_pt: TPoint): Boolean;
  2. var
  3.   old_client, minimap, map, w, h: Integer;
  4.   m_minimap: TMask;
  5. begin
  6.   old_client := GetImageTarget;
  7.   minimap := CreateBitmap(155, 115);
  8.   CopyClientToBitmap(minimap, 353, 72, 508, 187);
  9.   FastReplaceColor(minimap, 255, 0);
  10.   FastReplaceColor(minimap, 16711422, 0);
  11.   FastReplaceColor(minimap, 65535, 0);
  12.   FastReplaceColor(minimap, 16776960, 0);
  13.   m_minimap := CreateMaskFromBitmap(minimap);
  14.   map := LoadBitmap(IncludePath + '\RSCS\map.bmp');
  15.   FastReplaceColor(map, 24495, 0);
  16.   FastReplaceColor(map, 409605, 0);
  17.   SetTransparentColor(map, 0);
  18.   SetTargetBitmap(map);
  19.   GetClientDimensions(w, h);
  20.   Result := FindMaskTolerance(m_minimap, map_pt.X, map_pt.Y, 0, 0, (w - 1), (h - 1), 0, 0);
  21.   if Result then
  22.   begin
  23.     CopyClientToBitmap(minimap, map_pt.X, map_pt.Y, (map_pt.X + 154), (map_pt.Y + 114));
  24.     SaveBitmap(minimap, (AppPath + 'MAPS\minimap.bmp');
  25.   end else
  26.   begin
  27.     map_pt.X := -1;
  28.     map_pt.Y := -1;
  29.   end;
  30.   SetImageTarget(old_client);
  31.   FreeBitmap(map);
  32.   FreeBitmap(minimap);
  33. end;
Advertisement
Add Comment
Please, Sign In to add comment