UltimateZoneBuilder/Source/Plugins/BuilderModes/ErrorChecks/ResultUnusedTexture.cs
MaxED 13c3155db5 Removed "Paste Properties Options" action.
Added "Paste Properties Special" actions in "Classic" and "Visual" categories. They work the same way as "Paste Special" action.
Added: "Copy Properties", "Paste Properties" and "Paste Properties Special" options are now shown in the Edit menu if current classic mode supports them.
Changed, Paste Properties Special window: only options relevant to current map format are now displayed.
Changed, Paste Properties Special window, UDMF: all UI-managed options are now available.
Fixed: MAPINFO parser was unable to process "include" directives.
Fixed, General interface: selection info was reset to "Nothing selected" after few seconds regardless of current selection.
Fixed, Visual mode: thing bounding boxes were not updated when changing things positions using Randomize mode.
Fixed, Visual mode: event lines were displayed at incorrect height when entering Visual mode for the first time.
Fixed, Texture Browser window: when MixTexturesFlats Game Configuration option is disabled, textures/flats are no longer shown in the Used group when flats/textures with the same names are used in the map. 
Fixed(?): probably fixed an exception some users reported when trying to initialize a Classic mode after switching from Visual mode with "Sync cameras" option enabled.
Changed, Game configurations, Thing Categories: a block must have at least one thing category property to be recognized as a thing category.
Changed, Visplane Explorer: the plugin now outputs more info when it fails to initialize vpo.dll.
Cosmetic, Thing Edit window, Doom/Hexen map format: adjusted UI layout so thing flags control no longer displays scrollbars in Hexen map format.
Internal: merged methods from UDMFTools into UniFields, removed UDMFTools. 
Updated Inno Setup script (added VC++ 2008 SP1 distributive). 
Updated ZDoom_DECORATE.cfg (A_CheckBlock).
Updated documentation (added "System Requirements" page).
2015-10-09 12:38:12 +00:00

105 lines
3.1 KiB
C#

#region ================== Namespaces
using System;
using CodeImp.DoomBuilder.Map;
using CodeImp.DoomBuilder.Rendering;
#endregion
namespace CodeImp.DoomBuilder.BuilderModes
{
public class ResultUnusedTexture : ErrorResult
{
#region ================== Variables
private readonly Sidedef side;
private readonly SidedefPart part;
#endregion
#region ================== Properties
public override int Buttons { get { return 1; } }
public override string Button1Text { get { return "Remove Texture"; } }
#endregion
#region ================== Constructor / Destructor
// Constructor
public ResultUnusedTexture(Sidedef sd, SidedefPart part)
{
// Initialize
this.side = sd;
this.part = part;
this.viewobjects.Add(sd);
this.hidden = sd.IgnoredErrorChecks.Contains(this.GetType()); //mxd
this.description = "This sidedef uses an upper or lower texture, which is not required (it will never be visible ingame). Click the Remove Texture button to remove the texture (this will also reset texture offsets and scale in UDMF map format).";
}
#endregion
#region ================== Methods
// This sets if this result is displayed in ErrorCheckForm (mxd)
internal override void Hide(bool hide)
{
hidden = hide;
Type t = this.GetType();
if(hide) side.IgnoredErrorChecks.Add(t);
else if(side.IgnoredErrorChecks.Contains(t)) side.IgnoredErrorChecks.Remove(t);
}
// This must return the string that is displayed in the listbox
public override string ToString()
{
switch(part)
{
case SidedefPart.Upper:
return "Sidedef " + side.Index + " has unused upper texture \"" + side.HighTexture + "\"";
case SidedefPart.Middle:
return "Sidedef " + side.Index + " has unused middle texture \"" + side.MiddleTexture + "\"";
case SidedefPart.Lower:
return "Sidedef " + side.Index + " has unused lower texture \"" + side.LowTexture + "\"";
default:
return "ERROR";
}
}
// Rendering
public override void PlotSelection(IRenderer2D renderer)
{
renderer.PlotLinedef(side.Line, General.Colors.Selection);
renderer.PlotVertex(side.Line.Start, ColorCollection.VERTICES);
renderer.PlotVertex(side.Line.End, ColorCollection.VERTICES);
}
// Fix by removing texture
public override bool Button1Click(bool batchMode)
{
if(!batchMode) General.Map.UndoRedo.CreateUndo("Remove unused texture");
if(General.Map.UDMF) side.Fields.BeforeFieldsChange();
switch(part)
{
case SidedefPart.Upper:
side.SetTextureHigh("-");
if(General.Map.UDMF) UniFields.RemoveFields(side.Fields, new[] { "scalex_top", "scaley_top", "offsetx_top", "offsety_top" });
break;
case SidedefPart.Lower:
side.SetTextureLow("-");
if(General.Map.UDMF) UniFields.RemoveFields(side.Fields, new[] { "scalex_bottom", "scaley_bottom", "offsetx_bottom", "offsety_bottom" });
break;
}
General.Map.Map.Update();
return true;
}
#endregion
}
}