Skip to content

Commit

Permalink
Update Minimap.getDots().
Browse files Browse the repository at this point in the history
  • Loading branch information
ollydev committed Sep 2, 2014
1 parent 44a7a4a commit 0cb0cba
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 19 deletions.
8 changes: 4 additions & 4 deletions lib/interfaces/gametabs/gametab.simba
Expand Up @@ -163,7 +163,7 @@ begin

with self.tabs[TAB_BACKPACK] do
begin
_bmp := bitmapFromString(3, 8, 'meJxTss0x7d3Co2xpndScv+dpUudq/drpSrY5FrnrgSL8YkHCMrlABlANUAoo7lo5JWHDYaA4J58akARqBCIgAwC+OReT');
_bmp := bitmapFromString(10, 2, 'meJzjktQQlLJTdu4AIgHJICCbi1lZwsjLJnuiqGIBkAtBSq5ZQARUAyRB6lOqgIoBZmsMmA==');
_navBarId := NAV_BUTTON_GEAR;
_navBarBoxIndex := 1;
end;
Expand All @@ -184,14 +184,14 @@ begin

with self.tabs[TAB_MAGIC] do
begin
_bmp := bitmapFromString(6, 4, 'meJxzie5QFWPzUGCptxLwkHcy9koz7toqIp4ub9Dqm7MdSALZatnt7OxuQC4QcXLPA7KlLX0YGRgEZV2BWhSk5YEmAAC4KBGC');
_bmp := bitmapFromString(11, 5, 'meJzbHmmk37bMdtVl24ApmlI8HgrsqY7KHvJO1uGFqRHBbZb8tRVBHG0LODwzgMpEFQuACKiSh2cWK2uRipw6ULGnEadN9sTApgXKWdMEJIOAsoUlF4DK2Jm9IQZCUHBqroSRFyMDg6CUHdB8oBRcFmgLMkqz4QQiOHd7pBEAQGorag==');
_navBarId := NAV_BUTTON_POWERS;
_navBarBoxIndex := 2;
end;

with self.tabs[TAB_MELEE] do
begin
_bmp := bitmapFromString(4, 5, 'meJzj4udctnDev3//Hty7unzTDiBjzZF76bnZxec+Z3z5GxMa6WRjaLLghvDm264p6Wri7DKWXlx8YuwFPdyO4QAyrR2H');
_bmp := bitmapFromString(9, 4, 'meJyz9vJRVxRXlhUSFuPbOWfm318/5h64WpCb6+7mWnjkpVV0iZS44NQZs16+/wAR93B3k5WTUdC10G9bNm/DFrh6oLiSrIiKjICYMBevlHrxiXc53/8Gp4LEZSSFpEU4lSR5AM6bKxQ=');
_navBarId := NAV_BUTTON_POWERS;
_navBarBoxIndex := 3;
end;
Expand All @@ -205,7 +205,7 @@ begin

with self.tabs[TAB_DEFENSIVE] do
begin
_bmp := bitmapFromString(8, 5, 'meJxrae/MygwREU/XU38UEf90zZF7QCQs59zWlG3j7AkRb1l07vL5K//+/QNKdU+f5WRjCBTXUF3lm7MdKAUU/Pju9bKF89Jzs4HinNzz5A1agVIQWaAgEAnKujKxZgARRCPQIgCjYzZb');
_bmp := bitmapFromString(13, 3, 'meJwryM2ta6iqrQgSkAzSVD5aWHJh37kHk2edE5b2EZbyBTIg3AKwMg93N1bWIguXixDxv79+AEkI4+X7D0C9QGVTZ8wCKgOaxsMzCygCUQmUBSKIUUBBAB0HQt0=');
_navBarId := NAV_BUTTON_POWERS;
_navBarBoxIndex := 5;
end;
Expand Down
37 changes: 22 additions & 15 deletions lib/interfaces/minimap.simba
Expand Up @@ -52,9 +52,9 @@ Example:

*)
const
MM_DOT_NPC = 4369;
MM_DOT_ITEM = 23;
MM_DOT_PLAYER = 1907997;
MM_DOT_NPC = 74522;
MM_DOT_ITEM = 34;
MM_DOT_PLAYER = 2171169;
MM_DOT_FRIEND = 5376;
MM_DOT_TEAM = 2171941;

Expand Down Expand Up @@ -707,10 +707,12 @@ Example:

dots := minimap.getDots(MM_DOT_NPC, minimap.getBounds());
*)
function TRSMinimap.getDots(dotType: integer; searchBox: TBox): TPointArray;
function TRSMinimap.getDots(dotType: integer; searchBox: TBox; tol: Integer = 30): TPointArray;
var
i, c: integer;
tpa: TPointArray;
i: integer;
tpa, res: TPointArray;
atpa: T2DPointArray;
cols: array [0..1] of UInt32;
begin
print('TRSMinimap.getDots()', TDebug.HEADER);

Expand All @@ -734,19 +736,24 @@ begin
exit;
end;

setLength(result, length(tpa));
c := 0;

// gets the difference between the bottom two colors of a dot
for i := 0 to high(tpa) do
if (getColor(tpa[i].x - 1, tpa[i].y - 1) - getColor(tpa[i].x, tpa[i].y - 1) = dotType) then
begin
result[c] := point(tpa[i].x, tpa[i].y - 2);
inc(c);
end;
begin
cols[0] := GetColor(tpa[i].x, tpa[i].y -2);
cols[1] := GetColor(tpa[i].x, tpa[i].y -1);

if (cols[0] = cols[1]) then
continue();

if (inRange(Integer(Abs(cols[0] - cols[1])), dotType - tol, dotType + tol)) then
Insert(tpa[i], res)
end;

unfreeze();
setLength(result, c);

atpa := SplitTPA(res, 1);
for i := 0 to high(ATPA) do
Insert(atpa[i][0], Result);

print('Found '+toStr(length(result))+' minimap dots (ID: '+toStr(dotType)+')');
print('TRSMinimap.getDots(): '+toStr(result), TDebug.FOOTER);
Expand Down

0 comments on commit 0cb0cba

Please sign in to comment.