mirror of
https://git.do.srb2.org/STJr/UltimateZoneBuilder.git
synced 2024-11-30 15:41:30 +00:00
c087d014a1
Error checks: added "Check unused textures" option. Replaced MissingTexture3D and UnknownTexture3D. Sectors mode: restored "Lower/Raise Floor/Ceiling by 8 mp" actions. Visual mode: in some cases sidedefs were rendered as selected when they were not. Existing linedefs were not split while drawing new lines in some cases. Texture and height overrides were not applied correctly in some cases. Preferences form: "Ctrl+Alt+ScrollUp" and "Ctrl+Alt+ScrollDown" dropdown items were setting the shortcut to "Ctrl+Shift+ScrollUp" and "Ctrl+Shift+ScrollDown".
95 lines
2.7 KiB
C#
95 lines
2.7 KiB
C#
#region ================== Namespaces
|
|
|
|
using CodeImp.DoomBuilder.Map;
|
|
using CodeImp.DoomBuilder.Rendering;
|
|
using CodeImp.DoomBuilder.GZBuilder.Tools;
|
|
|
|
#endregion
|
|
|
|
namespace CodeImp.DoomBuilder.BuilderModes
|
|
{
|
|
public class ResultUnusedTexture : ErrorResult
|
|
{
|
|
#region ================== Variables
|
|
|
|
private Sidedef side;
|
|
private 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.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 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) UDMFTools.ClearFields(side.Fields, new[] { "scalex_top", "scaley_top", "offsetx_top", "offsety_top" });
|
|
break;
|
|
|
|
case SidedefPart.Lower:
|
|
side.SetTextureLow("-");
|
|
if(General.Map.UDMF) UDMFTools.ClearFields(side.Fields, new[] { "scalex_bottom", "scaley_bottom", "offsetx_bottom", "offsety_bottom" });
|
|
break;
|
|
}
|
|
|
|
General.Map.Map.Update();
|
|
return true;
|
|
}
|
|
|
|
#endregion
|
|
}
|
|
}
|