mirror of
https://git.do.srb2.org/STJr/UltimateZoneBuilder.git
synced 2024-11-30 15:41:30 +00:00
b37457dbc1
Added, Map Analysis mode: added "Check map size" check. It will generate a warning when map's width or height is larger than 32767 m.u.
65 lines
1.8 KiB
C#
65 lines
1.8 KiB
C#
#region ================== Namespaces
|
|
|
|
using System.Drawing;
|
|
using CodeImp.DoomBuilder.Geometry;
|
|
|
|
#endregion
|
|
|
|
namespace CodeImp.DoomBuilder.BuilderModes.ErrorChecks
|
|
{
|
|
public class ResultMapTooBig : ErrorResult
|
|
{
|
|
#region ================== Variables
|
|
|
|
private readonly bool toowide;
|
|
private readonly bool toohigh;
|
|
private readonly Vector2D min;
|
|
private readonly Vector2D max;
|
|
|
|
#endregion
|
|
|
|
#region ================== Properties
|
|
|
|
public override int Buttons { get { return 0; } }
|
|
|
|
#endregion
|
|
|
|
#region ================== Constructor / Destructor
|
|
|
|
public ResultMapTooBig(Vector2D min, Vector2D max)
|
|
{
|
|
// Initialize
|
|
this.min = min;
|
|
this.max = max;
|
|
this.toowide = max.x - min.x > CheckMapSize.MAXIMUM_DISTANCE;
|
|
this.toohigh = max.y - min.y > CheckMapSize.MAXIMUM_DISTANCE;
|
|
description = "Map is too big.";
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region ================== Methods
|
|
|
|
public override RectangleF GetZoomArea()
|
|
{
|
|
const float scaler = 0.5f;
|
|
return new RectangleF(min.x * scaler, min.y * scaler, (max.x - min.x) * scaler, (max.y - min.y) * scaler);
|
|
}
|
|
|
|
// This sets if this result is displayed in ErrorCheckForm (mxd)
|
|
internal override void Hide(bool hide)
|
|
{
|
|
hidden = hide;
|
|
}
|
|
|
|
// This must return the string that is displayed in the listbox
|
|
public override string ToString()
|
|
{
|
|
if(toowide && toohigh) return "Map's width and height is bigger than " + CheckMapSize.MAXIMUM_DISTANCE + " m.u. This can cause rendering and physics issues.";
|
|
if(toowide) return "Map is wider than than " + CheckMapSize.MAXIMUM_DISTANCE + " m.u. This can cause rendering and physics issues.";
|
|
return "Map is taller than " + CheckMapSize.MAXIMUM_DISTANCE + " m.u. This can cause rendering and physics issues.";
|
|
}
|
|
|
|
#endregion
|
|
}
|
|
}
|