Skip to content

Commit

Permalink
fix: read notes
Browse files Browse the repository at this point in the history
- RandomPointOnZoomRectangle was added again for screen walking.
- Tweaks to my MouseZoom to make it slightly more readable.
-Made ungael region slightly larger
  • Loading branch information
Torwent committed Feb 21, 2024
1 parent b445f57 commit 80279bc
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 37 deletions.
2 changes: 1 addition & 1 deletion optional/handlers/poh.simba
Original file line number Diff line number Diff line change
Expand Up @@ -794,7 +794,7 @@ begin

if Self.ScreenWalk then
begin
p := Minimap.RandomPointOn(minimapPoint, randomness);
p := Minimap.RandomPointOnZoomRectangle(minimapPoint, randomness);
Mouse.Move(Minimap.PointToMsRect(p).Mean());
msUpText := MainScreen.GetUpText();
if not ('Walk here' in msUpText) then
Expand Down
2 changes: 1 addition & 1 deletion osr/walker/objects/walkerobjects.simba
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ begin

if Self.ScreenWalk then
begin
p := Minimap.RandomPointOn(minimapPoint, randomness);
p := Minimap.RandomPointOnZoomRectangle(minimapPoint, randomness);
Mouse.Move(Minimap.PointToMsRect(p).Mean());
msUpText := MainScreen.GetUpText();

Expand Down
52 changes: 18 additions & 34 deletions utils/input/mousezoom.simba
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,7 @@ begin
Result := Self.GetNext(Result, down);
end;


function TRSMouseZoom.GetZoomLevel(): Int32; //Declared here to be used by the next functions but overriden later.
begin
Result := -1;
end;

function TRSMouseZoom.GetZoomLevel(): Int32; forward;

(*
## RSMouseZoom.Level2Slider
Expand Down Expand Up @@ -108,7 +103,6 @@ end;
```pascal
function TRSMouseZoom.Slider2Level(value: Int32 = -1): Int32;
```

As the name implies, this method is used to convert MM2MS.ZoomLevel to RSMouseZoom.ZoomLevel levels (0..100 to 0..768).
Unlike the previous method though, this one is not 100% accurate but good enough.

Expand All @@ -130,17 +124,14 @@ begin
if value < 0 then
value := MM2MS.ZoomLevel;

if value >= 13 then
value -= 1;

if value >= 37 then
value -= 1;

if value >= 63 then
value -= 1;

if value >= 87 then
value -= 1;
//handling "dead" levels of the zoom slider.
//Despite we using a 0..100 range, the slider only has 97 positions.
case value of
13.. 36: Dec(value);
37.. 62: Dec(value, 2);
63.. 86: Dec(value, 3);
87..100: Dec(value, 4);
end;

Result := EnsureRange(value * 8, 0, Self.MAX_ZOOM);
end;
Expand Down Expand Up @@ -256,20 +247,14 @@ end;
```pascal
function TRSMouseZoom.GetZoomLevel(): Int32;
```
```pascal
function TRSMouseZoom.GetZoomLevel(): Int32; override;
```

This method is pre-declared to be used by other methods that require it but it's functionality required said methods to work therefor it's overriden.

Anyway, this simply returns RSMouseZoom.ZoomLevel if it is already set, if it's not set, it will attempt to set it up.
This simply returns RSMouseZoom.ZoomLevel if it is already set, if it's not set, it will attempt to set it up.

Example:
```pascal
WriteLn RSMouseZoom.GetZoomLevel();
```
*)
function TRSMouseZoom.GetZoomLevel(): Int32; override;
function TRSMouseZoom.GetZoomLevel(): Int32;
begin
if (Self.ZoomLevel > -1) then
Exit(Self.ZoomLevel);
Expand All @@ -281,15 +266,14 @@ begin
end;

case Random(3) of
0:
begin
Self.DebugLn('Unknown zoom level, reading from options...');
Self.ZoomLevel := Self.Slider2Level(MM2MS.GetZoomLevel());
Self.DebugLn('Current zoom level: ' + ToString(Self.ZoomLevel));
end;
1: Options.SetZoomLevel(Random(101));
0: Options.SetZoomLevel(Random(101));
1: Self.MaxZoomBlind(SRL.Dice(50));
else
Self.MaxZoomBlind(SRL.Dice(50));
begin
Self.DebugLn('Unknown zoom level, reading from options...');
Self.ZoomLevel := Self.Slider2Level(MM2MS.GetZoomLevel());
Self.DebugLn('Current zoom level: ' + ToString(Self.ZoomLevel));
end;
end;

Result := Self.ZoomLevel;
Expand Down
2 changes: 1 addition & 1 deletion utils/rsregions/rsregions.simba
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ begin
RSRegions.PYRAMID_PLUNDER_ENTRANCE := [9299, 5109, 9526, 5338];
RSRegions.JORMUNGANDS_PRISON := [0, 5377, 448, 5828];
RSRegions.RELLEKKA := [5819, 1562, 6441, 2228];
RSRegions.UNGAEL := [4933, 1622, 5284, 1966];
RSRegions.UNGAEL := [4899, 1581, 5286, 1995];
RSRegions.EVIL_CHICKEN_LAIR := [10156, 4116, 10553, 4494];
RSRegions.FEROX_ENCLAVE := [7803, 1782, 8097, 2062];
RSRegions.FOUNTAIN_OF_RUNE := [8364, 624, 9062, 1575];
Expand Down

0 comments on commit 80279bc

Please sign in to comment.