Skip to content

Commit e2526c0

Browse files
committed
mm2ms debugger
1 parent 415c514 commit e2526c0

File tree

4 files changed

+297
-41
lines changed

4 files changed

+297
-41
lines changed

osrs/interfaces/mm2ms.simba

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -650,8 +650,8 @@ begin
650650
radians := Self.CompassRadians;
651651
img.DrawColor := $00FF00;
652652

653-
for pt.X := Self.Center.X - 100 to Self.Center.X + 100 with 4 do
654-
for pt.Y := Self.Center.Y - 100 to Self.Center.Y + 100 with 4 do
653+
for pt.X := Self.Center.X - 120 to Self.Center.X + 120 with 4 do
654+
for pt.Y := Self.Center.Y - 120 to Self.Center.Y + 120 with 4 do
655655
begin
656656
vector := pt.ToVec3().Rotate(radians, Self.Center);
657657
if not Self.PointOnZoomQuad(vector.ToPoint()) then Continue;
@@ -679,7 +679,7 @@ begin
679679
img.DrawColor := $FF0000;
680680
vector := Self.Center.ToVec3();
681681
quad := Self.Vector2MSQuad(vector, radians, [1,1]);
682-
tpa := quad.Corners.Connect().Grow(1);
682+
tpa := quad.Corners.Connect();
683683
img.DrawTPA(tpa);
684684
end;
685685

osrs/interfaces/mm2ms_projector.simba

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,9 @@ Main record responsible for {ref}`MM2MS` projection.
5757
View, Projection, InvertedView, InvertedProjection: TMatrix4;
5858
Transformer: TVector3;
5959

60-
ViewEye, ViewTarget, ViewUp: TVector3;
60+
ViewEye, CustomEye, ViewTarget, ViewUp: TVector3;
6161
ProjectionHeight, ProjectionWidth: Integer;
62+
MinScaleMultiplier, MaxScaleMultiplier, FOV, ZNear, ZFar: Double;
6263
end;
6364

6465
(*
@@ -220,18 +221,25 @@ begin
220221
case mode of
221222
ERSMode.FIXED:
222223
begin
223-
Self.ScaleMin := 0.83 * MainScreen.Bounds.Height / Self.ProjectionHeight;
224-
Self.ScaleMax := 6.32 * MainScreen.Bounds.Height / Self.ProjectionHeight;
224+
if Self.MinScaleMultiplier = 0 then Self.MinScaleMultiplier := 0.8;
225+
if Self.MaxScaleMultiplier = 0 then Self.MaxScaleMultiplier := 6.32;
225226
end;
226227

227228
ERSMode.RESIZABLE, ERSMode.MODERN_COMPACT, ERSMode.MODERN_WIDE:
228229
begin
229-
Self.ScaleMin := 0.635 * MainScreen.Bounds.Height / Self.ProjectionHeight;
230-
Self.ScaleMax := 4.90 * MainScreen.Bounds.Height / Self.ProjectionHeight;
230+
if Self.MinScaleMultiplier = 0 then Self.MinScaleMultiplier := 0.635;
231+
if Self.MaxScaleMultiplier = 0 then Self.MaxScaleMultiplier := 4.90;
231232
end;
232233
end;
233234

234-
Self.Projection := TMatrix4.PerspectiveFovRH(Sqrt(2), Self.ProjectionWidth / Self.ProjectionHeight, 0.01, 1.0);
235+
Self.ScaleMin := Self.MinScaleMultiplier * MainScreen.Bounds.Height / Self.ProjectionHeight;
236+
Self.ScaleMax := Self.MaxScaleMultiplier * MainScreen.Bounds.Height / Self.ProjectionHeight;
237+
238+
if Self.FOV = 0 then Self.FOV := Sqrt(2);
239+
if Self.ZNear = 0 then Self.ZNear := 0.0;
240+
if Self.ZFar = 0 then Self.ZFar := 1.0;
241+
242+
Self.Projection := TMatrix4.PerspectiveFovRH(Self.FOV, Self.ProjectionWidth / Self.ProjectionHeight, 0.01, 1.0);
235243
Self.InvertedProjection := Self._InvertProjection(Self.Projection);
236244

237245
Self.ViewTarget := [0.0, 0.0, 1.0];

osrs/position/map/map.simba

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -549,8 +549,8 @@ begin
549549
Self.Height(loc + [3,1], False) + Self.Height(loc - [1,1], False);
550550
h := h/4;
551551

552-
for x := Minimap.Center.X - 100 to Minimap.Center.X + 100 with 4 do
553-
for y := Minimap.Center.Y - 100 to Minimap.Center.Y + 100 with 4 do
552+
for x := Minimap.Center.X - 120 to Minimap.Center.X + 120 with 4 do
553+
for y := Minimap.Center.Y - 120 to Minimap.Center.Y + 120 with 4 do
554554
begin
555555
vector := Point(x,y).ToVec3().Rotate(angle, Minimap.Center);
556556
pt := vector.ToPoint();
@@ -610,7 +610,7 @@ begin
610610
end;
611611

612612
img.DrawColor := DOT_COLORS[dot];
613-
img.DrawTPA(MainScreen.Filter(tpa).Grow(1));
613+
img.DrawTPA(MainScreen.Filter(tpa));
614614
end;
615615
end;
616616

0 commit comments

Comments
 (0)