Skip to content

Commit 42943c7

Browse files
committed
fix: read notes
- `TRSMap` can now be loaded without focusing a client. - fixed something a logic issue in `T2DIntegerArray.CreateFromBytes()` that could be the cause for webgraphs to become corrupted. Only time will tell, it was definitly an issue anyway - Improved release-branch action to create an even smaller bundle by also removing single-line comments and trimming multiple blank lines
1 parent 0052808 commit 42943c7

File tree

7 files changed

+61
-34
lines changed

7 files changed

+61
-34
lines changed

.github/workflows/release-branch.yml

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,29 @@ jobs:
2828
- name: Remove unwanted files
2929
run: rm -rf tests
3030

31-
- name: Strip Pascal-style multiline comments from .simba files
31+
- name: Strip multi-line comments
3232
run: find . -name "*.simba" -type f -exec perl -0777 -i -pe 's/\(\*.*?\*\)//gs' {} +
33+
34+
- name: Strip single-line comments
35+
run: find . -name "*.simba" -type f -exec perl -0777 -i -pe 's{//.*$}{}gm' {} +
3336

37+
- name: Trim multiple empty lines in .simba files
38+
run: find . -name "*.simba" -type f -exec perl -0777 -i -pe 's/\n[ \t]*(\n[ \t]*)+/\n/g' {} +
39+
3440
- name: Commit and push to release
3541
run: |
3642
git add .
3743
git commit -m "Sync release with main and strip comments" || echo "No changes to commit"
38-
git push origin release --force
44+
git push origin release --force
45+
46+
- name: Check release branch size
47+
run: |
48+
echo "Release branch size:"
49+
du -sh .
50+
51+
- name: Check main branch size
52+
run: |
53+
git fetch origin main
54+
git checkout -b temp-main origin/main
55+
echo "Main branch size:"
56+
du -sh .

osrs/interfaces/minimap.simba

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,6 @@ begin
111111
end;
112112
end;
113113

114-
SetLength(Self.Orbs, Ord(High(ERSMinimapOrb))+1);
115-
116114
with Self.Bounds do
117115
case RSClient.Mode of
118116
ERSMode.RESIZABLE, ERSMode.MODERN_COMPACT, ERSMode.MODERN_WIDE:

osrs/interfaces/setup.simba

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,10 @@ begin
153153
MainScreen.UptextOCR.Tolerance := 25;
154154
MainScreen.UptextOCR.ShadowTolerance := 65;
155155
MainScreen.UptextOCR.Whitelist := ['a'..'z', 'A'..'Z', '0'..'9', '-', '>', '(', ')', '/'];
156+
156157
Minimap.Compass.Accuracy := 0.03*PI;
158+
SetLength(Minimap.Orbs, Ord(High(ERSMinimapOrb))+1);
159+
157160
Options.ZoomLevel := -1;
158161
MM2MS.Projector.RSZoom := -1;
159162
RSMouseZoom.ZoomLevel := -1;

osrs/position/map/entities.simba

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -190,23 +190,23 @@ Internal helper function for {ref}`TRSEntity.GetCuboidArray`.
190190
function TRSEntity._GetCuboid(me: TPoint; vector: TVector2; size: TVector3; height, radians: Single): TCuboid;
191191
var
192192
corners: TVector3Array;
193-
pt, currLoc: TPoint;
193+
pt: TPoint;
194194
arr: TPointArray;
195195
begin
196-
currLoc := me + vector.ToPoint() - Minimap.Center;
196+
pt := me + vector.ToPoint() - Minimap.Center;
197197

198198
size.X := size.X*2;
199199
size.Y := size.Y*2;
200200

201201
corners := [
202-
[vector.X-size.X, vector.Y-size.Y, Self.Walker^.Height(currLoc - [1,3], False) - height],
203-
[vector.X+size.X, vector.Y-size.Y, Self.Walker^.Height(currLoc + [3,-3], False) - height],
204-
[vector.X+size.X, vector.Y+size.Y, Self.Walker^.Height(currLoc + [3,1], False) - height],
205-
[vector.X-size.X, vector.Y+size.Y, Self.Walker^.Height(currLoc - [1,1], False) - height],
206-
[vector.X-size.X, vector.Y-size.Y, Self.Walker^.Height(currLoc - [1,3], False) - height+size.Z],
207-
[vector.X+size.X, vector.Y-size.Y, Self.Walker^.Height(currLoc + [3,-3], False) - height+size.Z],
208-
[vector.X+size.X, vector.Y+size.Y, Self.Walker^.Height(currLoc + [3,1], False) - height+size.Z],
209-
[vector.X-size.X, vector.Y+size.Y, Self.Walker^.Height(currLoc - [1,1], False) - height+size.Z]
202+
[vector.X-size.X, vector.Y-size.Y, Self.Walker^.Height(pt - [1,3], False) - height],
203+
[vector.X+size.X, vector.Y-size.Y, Self.Walker^.Height(pt + [3,-3], False) - height],
204+
[vector.X+size.X, vector.Y+size.Y, Self.Walker^.Height(pt + [3,1], False) - height],
205+
[vector.X-size.X, vector.Y+size.Y, Self.Walker^.Height(pt - [1,1], False) - height],
206+
[vector.X-size.X, vector.Y-size.Y, Self.Walker^.Height(pt - [1,3], False) - height+size.Z],
207+
[vector.X+size.X, vector.Y-size.Y, Self.Walker^.Height(pt + [3,-3], False) - height+size.Z],
208+
[vector.X+size.X, vector.Y+size.Y, Self.Walker^.Height(pt + [3,1], False) - height+size.Z],
209+
[vector.X-size.X, vector.Y+size.Y, Self.Walker^.Height(pt - [1,1], False) - height+size.Z]
210210
];
211211

212212
arr := MM2MS.Run(corners, radians);
@@ -227,9 +227,8 @@ function TRSEntity.GetCuboidArray(me: TPoint; out coordinates: TPointArray; radi
227227
var
228228
weights: TDoubleArray;
229229
meLocal, pt: TPoint;
230-
h, diff: Single;
231230
i: Integer;
232-
dist: Double;
231+
h, dist: Double;
233232
vector: TVector2;
234233
dots: TPointArray;
235234
begin
@@ -242,7 +241,6 @@ begin
242241
Self.Walker^.Height(meLocal + [3,1], False) + Self.Walker^.Height(meLocal - [1,1], False);
243242
h := h/4;
244243

245-
WriteLn 'here';
246244
if Self.Filter <> [] then
247245
begin
248246
dots := Minimap.GetFilteredDotArray(Self.MinimapDots, Self.Walker^.FiltersToMM(me, Self.Filter, radians));

osrs/position/map/map.simba

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -86,10 +86,20 @@ begin
8686
if Self.Sample.Radius = 0 then Self.Sample.Radius := -1;
8787

8888
if Minimap.Radius = 0 then
89-
raise GetDebugLn('Minimap.Radius is set to 0, did you target the client?');
90-
img := new TImage(Minimap.Radius*2+1,Minimap.Radius*2+1);
91-
img.ReplaceColor($0, $FFFFFF);
92-
sample := Minimap.ScaleMinimap(img, Self.Loader.Downscale, Self.Sample.Radius);
89+
begin
90+
WriteLn GetDebugLn('Map', 'Minimap.Radius is 0, did you target the client? Using 65 for now.', ELogLevel.WARN);
91+
WriteLn GetDebugLn('Map', 'If you are botting focus the client and restart or you will have issues.', ELogLevel.WARN);
92+
img := new TImage(131,131);
93+
img.ReplaceColor($0, $FFFFFF);
94+
sample := Minimap.ScaleMinimap(img, Self.Loader.Downscale, 65);
95+
end
96+
else
97+
begin
98+
i := Minimap.Radius*2+1;
99+
img := new TImage(i,i);
100+
img.ReplaceColor($0, $FFFFFF);
101+
sample := Minimap.ScaleMinimap(img, Self.Loader.Downscale, Self.Sample.Radius);
102+
end;
93103

94104
Self.Cache.MatchTemplate := TMatchTemplateCache.Create(Self.Loader.DownscaledMap, sample, ETMFormula.TM_CCOEFF_NORMED);
95105
Self.Cache.MatchTemplate.FreeOnTerminate := True;

osrs/position/map/objects.simba

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -200,23 +200,23 @@ Internal helper function for {ref}`TRSObject.GetCuboidArray`.
200200
function TRSObject._GetCuboid(me: TPoint; vector: TVector2; size: TVector3; height, radians, rotation: Single): TCuboid;
201201
var
202202
corners: TVector3Array;
203-
pt, currLoc: TPoint;
203+
pt: TPoint;
204204
arr: TPointArray;
205205
begin
206-
currLoc := me + vector.ToPoint() - Minimap.Center;
206+
pt := me + vector.ToPoint() - Minimap.Center;
207207

208208
size.X := size.X*2;
209209
size.Y := size.Y*2;
210210

211211
corners := [
212-
[vector.X-size.X, vector.Y-size.Y, Self.Walker^.Height(currLoc - [1,3], False) - height],
213-
[vector.X+size.X, vector.Y-size.Y, Self.Walker^.Height(currLoc + [3,-3], False) - height],
214-
[vector.X+size.X, vector.Y+size.Y, Self.Walker^.Height(currLoc + [3,1], False) - height],
215-
[vector.X-size.X, vector.Y+size.Y, Self.Walker^.Height(currLoc - [1,1], False) - height],
216-
[vector.X-size.X, vector.Y-size.Y, Self.Walker^.Height(currLoc - [1,3], False) - height+size.Z],
217-
[vector.X+size.X, vector.Y-size.Y, Self.Walker^.Height(currLoc + [3,-3], False) - height+size.Z],
218-
[vector.X+size.X, vector.Y+size.Y, Self.Walker^.Height(currLoc + [3,1], False) - height+size.Z],
219-
[vector.X-size.X, vector.Y+size.Y, Self.Walker^.Height(currLoc - [1,1], False) - height+size.Z]
212+
[vector.X-size.X, vector.Y-size.Y, Self.Walker^.Height(pt - [1,3], False) - height],
213+
[vector.X+size.X, vector.Y-size.Y, Self.Walker^.Height(pt + [3,-3], False) - height],
214+
[vector.X+size.X, vector.Y+size.Y, Self.Walker^.Height(pt + [3,1], False) - height],
215+
[vector.X-size.X, vector.Y+size.Y, Self.Walker^.Height(pt - [1,1], False) - height],
216+
[vector.X-size.X, vector.Y-size.Y, Self.Walker^.Height(pt - [1,3], False) - height+size.Z],
217+
[vector.X+size.X, vector.Y-size.Y, Self.Walker^.Height(pt + [3,-3], False) - height+size.Z],
218+
[vector.X+size.X, vector.Y+size.Y, Self.Walker^.Height(pt + [3,1], False) - height+size.Z],
219+
[vector.X-size.X, vector.Y+size.Y, Self.Walker^.Height(pt - [1,1], False) - height+size.Z]
220220
];
221221

222222
arr := MM2MS.Run(corners, radians);
@@ -258,9 +258,8 @@ function TRSObject.GetCuboidArray(me: TPoint; out coordinates: TPointArray; radi
258258
var
259259
weights: TDoubleArray;
260260
meLocal, pt: TPoint;
261-
h, diff: Single;
262261
i: Integer;
263-
dist: Double;
262+
h, dist: Double;
264263
vector: TVector2;
265264
begin
266265
coordinates := [];

utils/math/conversions.simba

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,8 @@ var
6767
begin
6868
len := Length(bytes);
6969
if len = 0 then Exit;
70-
size := SizeOf(Integer);
70+
71+
size := SizeOf(Int32);
7172
Move(bytes[0], len, size);
7273
SetLength(Result, len);
7374
offset := size;

0 commit comments

Comments
 (0)