Skip to content

Commit

Permalink
fix(mapmaker): it won't allow regions out of bounds anymore
Browse files Browse the repository at this point in the history
  • Loading branch information
Torwent committed Sep 18, 2023
1 parent d3e4832 commit 9f64a07
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
9 changes: 7 additions & 2 deletions tools/mapmaker.simba
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,12 @@ begin
for i := 0 to High(Self.RegionArray) do
begin
b := Self.RegionArray[i].Bounds;
arr[i] += ' := [' + ToString(b.X1) + ', ' + ToString(b.Y1) + ', ' + ToString(b.X2) + ', ' + ToString(b.Y2) + '];';
arr[i] += ' := [' +
ToString(Max(b.X1, 0)) + ', ' +
ToString(Max(b.Y1, 0)) + ', ' +
ToString(Min(b.X2, Self.ImageBox.getBackground().getWidth()-1)) + ', ' +
ToString(Min(b.Y2, Self.ImageBox.getBackground().getHeight()-1)) +
'];';
end;

for i := 0 to High(arr) do
Expand Down Expand Up @@ -704,7 +709,7 @@ begin
SetOnMouseDown(@Self.OnMouseDown);
SetOnMouseUp(@Self.OnMouseUp);
SetOnKeyDown(@Self.OnKeyDown);
GetBackground.LoadFromMufasaBitmap(mapImg);
GetBackground().LoadFromMufasaBitmap(mapImg);
BackgroundChanged();
end;
mapImg.Free();
Expand Down
6 changes: 3 additions & 3 deletions utils/rsregions/rsregions.simba
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ begin
RSRegions.RUINS_OF_UNKAH := [7827, 4852, 8303, 5328];
RSRegions.SHILO_VILLAGE := [6560, 4318, 7158, 4714];
RSRegions.FOSSIL_ISLAND := [8800, 592, 9866, 1578];
RSRegions.PEST_CONTROL_ISLAND := [5550, 5441, 5956, 5830];
RSRegions.PEST_CONTROL_ISLAND := [5550, 5441, 5956, 5829];
RSRegions.PEST_CONTROL_OUTPOST := [6022, 4504, 6399, 4851];
RSRegions.CRANDOR := [6520, 3139, 6987, 3617];
RSRegions.ENTRANA := [6520, 2817, 6988, 3206];
Expand All @@ -150,7 +150,7 @@ begin
RSRegions.MOTHERLOADE_MINE := [7423, 4735, 7827, 5133];
RSRegions.MOURNER_TUNNELS := [7090, 5135, 7500, 5550];
RSRegions.MUSA_POINT := [6655, 3565, 7300, 3950];
RSRegions.MYTHS_GUILD_MID_FLOOR := [10321, 5604, 10559, 5830];
RSRegions.MYTHS_GUILD_MID_FLOOR := [10321, 5604, 10559, 5829];
RSRegions.OTTOS_GROTTO := [5293, 2256, 5610, 2631];
RSRegions.PISCARILIUS := [2444, 1122, 2950, 1500];
RSRegions.PISCATORIS := [4419, 1902, 5021, 2422];
Expand Down Expand Up @@ -286,4 +286,4 @@ begin

RSBankRegions.Setup();
RSCombatRegions.Setup();
end;
end;

0 comments on commit 9f64a07

Please sign in to comment.