Skip to content

Commit

Permalink
fix: added a new button to mapmaker.simba to "grow" regions easily
Browse files Browse the repository at this point in the history
  • Loading branch information
Torwent committed Oct 9, 2023
1 parent da92684 commit 26c3b82
Show file tree
Hide file tree
Showing 2 changed files with 66 additions and 34 deletions.
92 changes: 59 additions & 33 deletions tools/mapmaker.simba
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ type
TRSMapMaker = record
Form: TForm;
Panel: TPanel;
ButtonNewRegion, ButtonDeleteRegion, ButtonReset, ButtonPrintSelected, ButtonPrintType, ButtonPrintBoxes, ButtonPrintNamed, ButtonRewriteFile: TButton;
ButtonNewRegion, ButtonDeleteRegion, ButtonReset, ButtonGrowRegion, ButtonPrintSelected, ButtonPrintType, ButtonPrintBoxes, ButtonPrintNamed, ButtonRewriteFile: TButton;
RenameLabel: TLabel;
RenameEdit: TEdit;
ListBoxRegions: TListBox;
Expand Down Expand Up @@ -347,6 +347,15 @@ begin
Self.ImageBox.Update();
end;

procedure TRSMapMaker.OnGrowRegion(sender: TObject);
begin
if Self.Index < 0 then
Exit;

Self.RegionArray[Self.Index].Bounds := Self.RegionArray[Self.Index].Bounds.Expand(80);
Self.ImageBox.Update();
end;


function TRSMapMaker.GetDirectivesString(): String;
begin
Expand Down Expand Up @@ -604,38 +613,6 @@ begin
setAlign(alTop);
end;


//Top buttons
with Self.ButtonReset do
begin
Init(Self.Panel);
SetParent(Self.Panel);
SetAutoSize(True);
SetCaption('Reset');
SetOnClick(@Self.OnReset);
setAlign(alTop);
end;

with Self.ButtonDeleteRegion do
begin
Init(Self.Panel);
SetParent(Self.Panel);
SetAutoSize(True);
SetCaption('Delete Region');
SetOnClick(@Self.OnDelete);
setAlign(alTop);
end;

with Self.ButtonNewRegion do
begin
Init(Self.Panel);
SetParent(Self.Panel);
SetAutoSize(True);
SetCaption('New Region');
SetOnClick(@Self.OnNewRegion);
setAlign(alTop);
end;

//Listbox
with Self.ListBoxRegions do
begin
Expand Down Expand Up @@ -698,6 +675,55 @@ begin
end;


with Self.Panel do
begin
Init(Self.Form);
SetParent(Self.Form);
SetAutoSize(False);
SetAlign(alTop);
end;

//Top buttons
with Self.ButtonGrowRegion do
begin
Init(Self.Panel);
SetParent(Self.Panel);
SetAutoSize(True);
SetCaption('Grow Region by 80px');
SetOnClick(@Self.OnGrowRegion);
setAlign(alLeft);
end;

with Self.ButtonReset do
begin
Init(Self.Panel);
SetParent(Self.Panel);
SetAutoSize(True);
SetCaption('Reset');
SetOnClick(@Self.OnReset);
setAlign(alLeft);
end;

with Self.ButtonDeleteRegion do
begin
Init(Self.Panel);
SetParent(Self.Panel);
SetAutoSize(True);
SetCaption('Delete Region');
SetOnClick(@Self.OnDelete);
setAlign(alLeft);
end;

with Self.ButtonNewRegion do
begin
Init(Self.Panel);
SetParent(Self.Panel);
SetAutoSize(True);
SetCaption('New Region');
SetOnClick(@Self.OnNewRegion);
setAlign(alLeft);
end;

mapImg := TRSWalkerMap.InternalLoadMap(MAP_NAME);
with Self.ImageBox do
begin
Expand Down
8 changes: 7 additions & 1 deletion utils/rsregions/rsregions.simba
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,8 @@ type RSRegions = record(TSRLBaseRecord) class var
GEM_ROCKS_MINE: TBox;
ISLE_OF_SOULS: TBox;
TAVERLY_DUNGEON: TBox;
PYRAMID_PLUNDER: TBox;
SOPHANEM: TBox;
end;

begin
Expand Down Expand Up @@ -197,6 +199,8 @@ begin
RSRegions.GEM_ROCKS_MINE := [3912, 627, 4238, 889];
RSRegions.ISLE_OF_SOULS := [4020, 4332, 5202, 5426];
RSRegions.TAVERLY_DUNGEON := [5522, 0, 6301, 895];
RSRegions.PYRAMID_PLUNDER := [1353, 0, 1751, 397];
RSRegions.SOPHANEM := [8397, 5131, 8762, 5536];

RSNamedRegionsArray := [
['Abyss', RSRegions.ABYSS],
Expand Down Expand Up @@ -293,7 +297,9 @@ begin
['Sophanem Bank', RSRegions.SOPHANEM_BANK],
['Gem Rocks Mine', RSRegions.GEM_ROCKS_MINE],
['Isle of Souls', RSRegions.ISLE_OF_SOULS],
['Taverly Dungeon', RSRegions.TAVERLY_DUNGEON]
['Taverly Dungeon', RSRegions.TAVERLY_DUNGEON],
['Pyramid Plunder', RSRegions.PYRAMID_PLUNDER],
['Sophanem', RSRegions.SOPHANEM]
];

RSBankRegions.Setup();
Expand Down

0 comments on commit 26c3b82

Please sign in to comment.