From 9f64a07f149d9b760563bbe1ad6a162792833ba7 Mon Sep 17 00:00:00 2001 From: Torwent Date: Mon, 18 Sep 2023 14:03:35 +0200 Subject: [PATCH] fix(mapmaker): it won't allow regions out of bounds anymore --- tools/mapmaker.simba | 9 +++++++-- utils/rsregions/rsregions.simba | 6 +++--- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/tools/mapmaker.simba b/tools/mapmaker.simba index 44ecdcc5..7ee89dec 100644 --- a/tools/mapmaker.simba +++ b/tools/mapmaker.simba @@ -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 @@ -704,7 +709,7 @@ begin SetOnMouseDown(@Self.OnMouseDown); SetOnMouseUp(@Self.OnMouseUp); SetOnKeyDown(@Self.OnKeyDown); - GetBackground.LoadFromMufasaBitmap(mapImg); + GetBackground().LoadFromMufasaBitmap(mapImg); BackgroundChanged(); end; mapImg.Free(); diff --git a/utils/rsregions/rsregions.simba b/utils/rsregions/rsregions.simba index be4d1eea..17468c41 100644 --- a/utils/rsregions/rsregions.simba +++ b/utils/rsregions/rsregions.simba @@ -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]; @@ -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]; @@ -286,4 +286,4 @@ begin RSBankRegions.Setup(); RSCombatRegions.Setup(); -end; \ No newline at end of file +end;