diff --git a/NetAF/Rendering/FrameBuilders/Console/ConsoleRegionMapBuilder.cs b/NetAF/Rendering/FrameBuilders/Console/ConsoleRegionMapBuilder.cs index 3f05a28b..7bf2d16b 100644 --- a/NetAF/Rendering/FrameBuilders/Console/ConsoleRegionMapBuilder.cs +++ b/NetAF/Rendering/FrameBuilders/Console/ConsoleRegionMapBuilder.cs @@ -225,11 +225,11 @@ private void DrawLowerLevelRoom(Point2D topLeft) /// The available size, in the grid. /// The matrix. /// The position of the room, in the matrix. - /// The x position of the player, in the matrix. + /// The focus position, in the matrix. /// The left position to begin rendering the room at, in the grid. /// The top position to begin rendering the room at, in the grid. /// True if the matrix position could be converted to a grid position and fit in the available space. - private static bool TryConvertMatrixPositionToGridLayoutPosition(Point2D gridStartPosition, Size availableSize, Matrix matrix, Point2D roomPosition, Point2D playerPosition, out int gridLeft, out int gridTop) + private static bool TryConvertMatrixPositionToGridLayoutPosition(Point2D gridStartPosition, Size availableSize, Matrix matrix, Point2D roomPosition, Point2D focusPosition, out int gridLeft, out int gridTop) { const int roomWidth = 5; const int roomHeight = 3; @@ -241,9 +241,9 @@ private static bool TryConvertMatrixPositionToGridLayoutPosition(Point2D gridSta // check if map will fit if (matrix.Width * roomWidth > availableSize.Width || matrix.Height * roomHeight > availableSize.Height) { - // centralise on player - gridLeft += availableSize.Width / 2 - playerPosition.X * roomWidth + roomWidth / 2; - gridTop += availableSize.Height / 2 + (playerPosition.Y - matrix.Height) * roomHeight - roomHeight / 2; + // centralise on the focus position + gridLeft += availableSize.Width / 2 - focusPosition.X * roomWidth + roomWidth / 2; + gridTop += availableSize.Height / 2 + (focusPosition.Y - matrix.Height) * roomHeight - roomHeight / 2; } else { @@ -316,7 +316,7 @@ public void BuildRegionMap(Region region, Point2D startPosition, Point3D focusPo foreach (var position in lowerLevelRooms) { - if (TryConvertMatrixPositionToGridLayoutPosition(new Point2D(x, y), new Size(maxAvailableWidth, maxSize.Height), matrix, new Point2D(position.Position.X, position.Position.Y), new Point2D(playerRoom.Position.X, playerRoom.Position.Y), out var left, out var top)) + if (TryConvertMatrixPositionToGridLayoutPosition(new Point2D(x, y), new Size(maxAvailableWidth, maxSize.Height), matrix, new Point2D(position.Position.X, position.Position.Y), new Point2D(focusPosition.X, focusPosition.Y), out var left, out var top)) DrawLowerLevelRoom(new Point2D(left, top)); } } @@ -329,7 +329,7 @@ public void BuildRegionMap(Region region, Point2D startPosition, Point3D focusPo foreach (var position in focusLevelRooms) { - if (TryConvertMatrixPositionToGridLayoutPosition(new Point2D(x, y), new Size(maxAvailableWidth, maxSize.Height), matrix, new Point2D(position.Position.X, position.Position.Y), new Point2D(playerRoom.Position.X, playerRoom.Position.Y), out var left, out var top)) + if (TryConvertMatrixPositionToGridLayoutPosition(new Point2D(x, y), new Size(maxAvailableWidth, maxSize.Height), matrix, new Point2D(position.Position.X, position.Position.Y), new Point2D(focusPosition.X, focusPosition.Y), out var left, out var top)) DrawCurrentFloorRoom(position.Room, new Point2D(left, top), position.Room == playerRoom.Room, position.Position.Equals(focusPosition)); } }