@@ -21,14 +21,10 @@ that can be used by Simba and back.
2121 RSMap: record
2222 const ChunkSide: Integer = 64;
2323 const Dimensions: TPoint = [100,200];
24- const Scope: TBox = [15 , 19, 66 , 196];
24+ const Scope: TBox = [0 , 19, 99 , 196];
2525 end;
2626
27- Map: record
28- const ChunkSide: Integer = 256;
29- const Dimensions: TPoint = [2560, 5120];
30- const Scope: TBox = [3840, 4864, 16896, 50176];
31- end;
27+ const MapChunkSide: Integer = 256;
3228 end;
3329
3430(*
@@ -45,7 +41,7 @@ WriteLn RSTranslator.MapWidth;
4541*)
4642property TRSTranslator.MapWidth: Integer;
4743begin
48- Result := Self.RSMap.Scope.Width * Self.Map.ChunkSide ;
44+ Result := Self.RSMap.Scope.Width * Self.MapChunkSide ;
4945end;
5046
5147(*
@@ -62,7 +58,7 @@ WriteLn RSTranslator.MapHeight;
6258*)
6359property TRSTranslator.MapHeight: Integer;
6460begin
65- Result := Self.RSMap.Scope.Height * Self.Map.ChunkSide ;
61+ Result := Self.RSMap.Scope.Height * Self.MapChunkSide ;
6662end;
6763
6864
@@ -82,8 +78,8 @@ WriteLn RSTranslator.Global2Chunk(Point(2000, 2000));
8278function TRSTranslator.Global2Chunk(p: TPoint): TPoint;
8379begin
8480 while p.X > Self.MapWidth do p.X -= Self.MapWidth;
85- Result.X := Self.RSMap.Scope.X1 + Floor(p.X / Self.Map.ChunkSide );
86- Result.Y := Self.RSMap.Scope.Y2 - Floor(p.Y / Self.Map.ChunkSide );
81+ Result.X := Self.RSMap.Scope.X1 + Floor(p.X / Self.MapChunkSide );
82+ Result.Y := Self.RSMap.Scope.Y2 - Floor(p.Y / Self.MapChunkSide );
8783end;
8884
8985function TRSTranslator.Global2Chunk(b: TBox): TBox; overload;
@@ -111,8 +107,8 @@ WriteLn RSTranslator.Chunk2Coordinate(Point(53, 50));
111107*)
112108function TRSTranslator.Chunk2Coordinate(p: TPoint): TPoint;
113109begin
114- Result.X := p.X * Self.Map.ChunkSide - Self.Map.Scope.X1 ;
115- Result.Y := Self.Map .Scope.Y2 - p.Y * Self.Map.ChunkSide ;
110+ Result.X := p.X * Self.MapChunkSide ;
111+ Result.Y := ( Self.RSMap .Scope.Y2 - p.Y) * Self.MapChunkSide ;
116112end;
117113
118114function TRSTranslator.Chunk2Coordinate(b: TBox): TBox; overload;
0 commit comments