UDMF map format: increased maximum supported texture name length to 2048.

Preferences: added "Capitalize texture names" option (located in Preferences -> Appearance -> Additional options). When disabled, the casing of displayed texture names will match filenames for textures loaded form TEXTURES or pk3/pk7/folder resources.
Textures Browser: added support for displaying long texture names.
Errors list is now cleared when reloading resources.
Visual mode: added basic support for sector slopes (no UI for that feature yet).
This commit is contained in:
MaxED 2014-05-19 13:33:38 +00:00
parent 48caddf130
commit a61bba2536
25 changed files with 254 additions and 103 deletions

View file

@ -293,7 +293,12 @@ mapformat_hexen
mapformat_udmf
{
// The format interface handles the map data format
formatinterface = "UniversalMapSetIO";
formatinterface = "UniversalMapSetIO";
// Maximum length of texture name length in characters (0 for unlimited)
// WARNING: changing this may destroy your WAD file. Only change it when
// you know what you're doing!
maxtexturenamelength = 2048;
// Default nodebuilder configurations
defaultsavecompiler = "zdbsp_udmf_normal";

View file

@ -177,7 +177,7 @@ namespace CodeImp.DoomBuilder.Config
public bool LineTagIndicatesSectors { get { return linetagindicatesectors ; } }
public string DecorateGames { get { return decorategames; } }
public string SkyFlatName { get { return skyflatname; } }
public int MaxTextureNamelength { get { return maxtexturenamelength; } }
public int MaxTextureNameLength { get { return maxtexturenamelength; } }
public int LeftBoundary { get { return leftboundary; } }
public int RightBoundary { get { return rightboundary; } }
public int TopBoundary { get { return topboundary; } }

View file

@ -44,6 +44,7 @@ namespace CodeImp.DoomBuilder.Config
// Cached variables
private bool blackbrowsers;
private bool capitalizetexturenames; //mxd
private int visualfov;
private float visualmousesensx;
private float visualmousesensy;
@ -128,6 +129,7 @@ namespace CodeImp.DoomBuilder.Config
internal Configuration Config { get { return cfg; } }
public bool BlackBrowsers { get { return blackbrowsers; } internal set { blackbrowsers = value; } }
public bool CapitalizeTextureNames { get { return capitalizetexturenames; } internal set { capitalizetexturenames = value; } } //mxd
public int VisualFOV { get { return visualfov; } internal set { visualfov = value; } }
public int ImageBrightness { get { return imagebrightness; } internal set { imagebrightness = value; } }
public float DoubleSidedAlpha { get { return doublesidedalpha; } internal set { doublesidedalpha = value; doublesidedalphabyte = (byte)(doublesidedalpha * 255f); } }
@ -234,6 +236,7 @@ namespace CodeImp.DoomBuilder.Config
{
// Read the cache variables
blackbrowsers = cfg.ReadSetting("blackbrowsers", false);
capitalizetexturenames = cfg.ReadSetting("capitalizetexturenames", true); //mxd
//undolevels = cfg.ReadSetting("undolevels", 20);
visualfov = cfg.ReadSetting("visualfov", 80);
visualmousesensx = cfg.ReadSetting("visualmousesensx", 40f);
@ -324,6 +327,7 @@ namespace CodeImp.DoomBuilder.Config
// Write the cache variables
cfg.WriteSetting("blackbrowsers", blackbrowsers);
cfg.WriteSetting("capitalizetexturenames", capitalizetexturenames); //mxd
//cfg.WriteSetting("undolevels", undolevels);
cfg.WriteSetting("visualfov", visualfov);
cfg.WriteSetting("visualmousesensx", visualmousesensx);

View file

@ -71,10 +71,8 @@ namespace CodeImp.DoomBuilder.Controls
// This browses for a flat
protected override string BrowseImage(string imagename)
{
string result;
// Browse for texture
result = TextureBrowserForm.Browse(this.ParentForm, imagename, true); //mxd
string result = TextureBrowserForm.Browse(this.ParentForm, imagename, true);
if(result != null) return result; else return imagename;
}
}

View file

@ -119,7 +119,7 @@ namespace CodeImp.DoomBuilder.Controls
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(337, 9);
this.label2.Location = new System.Drawing.Point(367, 9);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(40, 14);
this.label2.TabIndex = 0;
@ -132,7 +132,7 @@ namespace CodeImp.DoomBuilder.Controls
this.filterHeight.AllowRelative = false;
this.filterHeight.ButtonStep = 1;
this.filterHeight.ButtonStepFloat = 1F;
this.filterHeight.Location = new System.Drawing.Point(380, 4);
this.filterHeight.Location = new System.Drawing.Point(410, 4);
this.filterHeight.Name = "filterHeight";
this.filterHeight.Size = new System.Drawing.Size(54, 24);
this.filterHeight.StepValues = null;
@ -143,7 +143,7 @@ namespace CodeImp.DoomBuilder.Controls
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(238, 9);
this.label1.Location = new System.Drawing.Point(268, 9);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(37, 14);
this.label1.TabIndex = 0;
@ -156,7 +156,7 @@ namespace CodeImp.DoomBuilder.Controls
this.filterWidth.AllowRelative = false;
this.filterWidth.ButtonStep = 1;
this.filterWidth.ButtonStepFloat = 1F;
this.filterWidth.Location = new System.Drawing.Point(278, 4);
this.filterWidth.Location = new System.Drawing.Point(308, 4);
this.filterWidth.Name = "filterWidth";
this.filterWidth.Size = new System.Drawing.Size(54, 24);
this.filterWidth.StepValues = null;
@ -183,7 +183,7 @@ namespace CodeImp.DoomBuilder.Controls
//
// texturesize
//
this.texturesize.Location = new System.Drawing.Point(479, 9);
this.texturesize.Location = new System.Drawing.Point(509, 9);
this.texturesize.Name = "texturesize";
this.texturesize.Size = new System.Drawing.Size(100, 14);
this.texturesize.TabIndex = 0;
@ -193,7 +193,7 @@ namespace CodeImp.DoomBuilder.Controls
// texturesizelabel
//
this.texturesizelabel.AutoSize = true;
this.texturesizelabel.Location = new System.Drawing.Point(442, 9);
this.texturesizelabel.Location = new System.Drawing.Point(472, 9);
this.texturesizelabel.Name = "texturesizelabel";
this.texturesizelabel.Size = new System.Drawing.Size(31, 14);
this.texturesizelabel.TabIndex = 0;
@ -206,7 +206,7 @@ namespace CodeImp.DoomBuilder.Controls
this.objectname.Location = new System.Drawing.Point(166, 6);
this.objectname.Margin = new System.Windows.Forms.Padding(3, 3, 6, 3);
this.objectname.Name = "objectname";
this.objectname.Size = new System.Drawing.Size(64, 20);
this.objectname.Size = new System.Drawing.Size(94, 20);
this.objectname.TabIndex = 0;
this.objectname.TabStop = false;
this.objectname.TextChanged += new System.EventHandler(this.objectname_TextChanged);

View file

@ -53,13 +53,14 @@ namespace CodeImp.DoomBuilder.Controls
private bool browseFlats; //mxd
// All items
private List<ImageBrowserItem> items;
private readonly List<ImageBrowserItem> items;
// Items visible in the list
private List<ImageBrowserItem> visibleitems;
//mxd
private static int mixMode;
private string longestTextureName = "";
#endregion
@ -86,6 +87,7 @@ namespace CodeImp.DoomBuilder.Controls
StepsList sizes = new StepsList { 4, 8, 16, 32, 48, 64, 96, 128, 196, 256, 512, 1024 };
filterWidth.StepValues = sizes;
filterHeight.StepValues = sizes;
if(!General.Settings.CapitalizeTextureNames) objectname.CharacterCasing = CharacterCasing.Normal;
}
// This applies the application settings
@ -200,7 +202,8 @@ namespace CodeImp.DoomBuilder.Controls
}
//mxd
private void filterSize_WhenTextChanged(object sender, EventArgs e) {
private void filterSize_WhenTextChanged(object sender, EventArgs e)
{
objectname_TextChanged(sender, e);
}
@ -416,6 +419,14 @@ namespace CodeImp.DoomBuilder.Controls
// This ends adding items
public void EndAdding()
{
//mxd. Do we need to change item width?
if (longestTextureName.Length > 8)
{
Graphics g = Graphics.FromImage(new Bitmap(1, 1));
SizeF size = g.MeasureString(longestTextureName, list.Font);
list.TileSize = new Size((int)(size.Width + 12), list.TileSize.Height);
}
// Fill list with items
RefillList(true);
@ -426,6 +437,7 @@ namespace CodeImp.DoomBuilder.Controls
// This adds an item
public void Add(string text, ImageData image, object tag, ListViewGroup group)
{
if(text.Length > longestTextureName.Length) longestTextureName = text; //mxd
ImageBrowserItem i = new ImageBrowserItem(text, image, tag);
i.ListGroup = group;
i.Group = group;
@ -435,6 +447,7 @@ namespace CodeImp.DoomBuilder.Controls
// This adds an item
public void Add(string text, ImageData image, object tag, ListViewGroup group, string tooltiptext)
{
if(text.Length > longestTextureName.Length) longestTextureName = text; //mxd
ImageBrowserItem i = new ImageBrowserItem(text, image, tag);
i.ListGroup = group;
i.Group = group;
@ -515,11 +528,12 @@ namespace CodeImp.DoomBuilder.Controls
if(mixMode == 3 && (browseFlats != i.icon.IsFlat)) return false;
}
return i.Text.Contains(objectname.Text);
return i.Text.ToUpperInvariant().Contains(objectname.Text.ToUpperInvariant());
}
//mxd. This validates an item's texture size
private static bool ValidateItemSize(ImageBrowserItem i, int w, int h) {
private static bool ValidateItemSize(ImageBrowserItem i, int w, int h)
{
if (!i.icon.IsPreviewLoaded) return true;
if (w > 0 && i.icon.Width != w) return false;
if (h > 0 && i.icon.Height != h) return false;

View file

@ -32,8 +32,9 @@ namespace CodeImp.DoomBuilder.Controls
#region ================== Variables
// Display image and text
public ImageData icon;
public readonly ImageData icon;
private string displaytext;
private static readonly StringFormat format = new StringFormat { Alignment = StringAlignment.Center }; //mxd
// Group
private ListViewGroup listgroup;
@ -99,7 +100,7 @@ namespace CodeImp.DoomBuilder.Controls
Rectangle imagerect = new Rectangle(bounds.Left + ((bounds.Width - General.Map.Data.Previews.MaxImageWidth) >> 1),
bounds.Top + ((bounds.Height - General.Map.Data.Previews.MaxImageHeight - (int)textsize.Height) >> 1),
General.Map.Data.Previews.MaxImageWidth, General.Map.Data.Previews.MaxImageHeight);
PointF textpos = new PointF(bounds.Left + (bounds.Width - textsize.Width) * 0.5f, bounds.Bottom - textsize.Height - 2);
PointF textpos = new PointF(bounds.Left + (bounds.Width * 0.5f), bounds.Bottom - textsize.Height - 2);
// Determine colors
if(this.Selected)
@ -120,7 +121,7 @@ namespace CodeImp.DoomBuilder.Controls
// Draw!
g.FillRectangle(backcolor, bounds);
icon.DrawPreview(g, imagerect.Location);
g.DrawString(displaytext, this.ListView.Font, forecolor, textpos);
g.DrawString(displaytext, this.ListView.Font, forecolor, textpos, format);
}
// This brightens or darkens a color
@ -146,7 +147,7 @@ namespace CodeImp.DoomBuilder.Controls
// Comparer
public int CompareTo(ImageBrowserItem other)
{
return this.Text.CompareTo(other.Text);
return this.Text.ToUpperInvariant().CompareTo(other.Text.ToUpperInvariant());
}
#endregion

View file

@ -72,7 +72,6 @@ namespace CodeImp.DoomBuilder.Controls
//
this.name.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest;
this.name.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.CustomSource;
this.name.CharacterCasing = System.Windows.Forms.CharacterCasing.Upper;
this.name.Location = new System.Drawing.Point(0, 64);
this.name.MaxLength = 8;
this.name.Name = "name";

View file

@ -59,13 +59,14 @@ namespace CodeImp.DoomBuilder.Controls
{
// Initialize
InitializeComponent();
if(General.Settings.CapitalizeTextureNames) this.name.CharacterCasing = CharacterCasing.Upper; //mxd
}
// Setup
public virtual void Initialize()
{
// set the max length of texture names
name.MaxLength = General.Map.Config.MaxTextureNamelength;
name.MaxLength = General.Map.Config.MaxTextureNameLength;
}
#endregion
@ -157,12 +158,14 @@ namespace CodeImp.DoomBuilder.Controls
}
//mxd
private void timer_Tick(object sender, EventArgs e) {
private void timer_Tick(object sender, EventArgs e)
{
Refresh();
}
//mxd
private void ImageSelectorControl_EnabledChanged(object sender, EventArgs e) {
private void ImageSelectorControl_EnabledChanged(object sender, EventArgs e)
{
labelSize.Visible = !(!General.Settings.ShowTextureSizes || !this.Enabled || string.IsNullOrEmpty(labelSize.Text));
}
@ -204,7 +207,8 @@ namespace CodeImp.DoomBuilder.Controls
}
//mxd
protected void DisplayImageSize(float width, float height) {
protected void DisplayImageSize(float width, float height)
{
labelSize.Text = (width > 0 && height > 0) ? width + "x" + height : string.Empty;
ImageSelectorControl_EnabledChanged(this, EventArgs.Empty);
}

View file

@ -1159,7 +1159,8 @@ namespace CodeImp.DoomBuilder.Data
}
//mxd
if(!internalsprites.ContainsKey("missingthing")) {
if(!internalsprites.ContainsKey("missingthing"))
{
ImageData img = new ResourceImage("CodeImp.DoomBuilder.Resources.MissingThing.png");
img.LoadImage();
img.AllowUnload = false;

View file

@ -597,25 +597,27 @@ namespace CodeImp.DoomBuilder.Data
private ICollection<ImageData> LoadDirectoryImages(string path, int imagetype, bool includesubdirs)
{
List<ImageData> images = new List<ImageData>();
string[] files;
string name;
// Go for all files
files = GetAllFiles(path, includesubdirs);
string[] files = GetAllFiles(path, includesubdirs);
foreach(string f in files)
{
// Make the texture name from filename without extension
name = Path.GetFileNameWithoutExtension(f).ToUpperInvariant();
if(name.Length > 8) name = name.Substring(0, 8);
if(name.Length > 0)
{
// Add image to list
images.Add(CreateImage(name, f, imagetype));
}
else
name = Path.GetFileNameWithoutExtension(f);
if (string.IsNullOrEmpty(name))
{
// Can't load image without name
General.ErrorLogger.Add(ErrorType.Error, "Can't load an unnamed texture from \"" + path + "\". Please consider giving names to your resources.");
}
else
{
if(name.Length > General.Map.Config.MaxTextureNameLength) name = name.Substring(0, General.Map.Config.MaxTextureNameLength);
if(General.Settings.CapitalizeTextureNames) name = name.ToUpperInvariant(); //mxd
// Add image to list
images.Add(CreateImage(name, f, imagetype));
}
}

View file

@ -1637,6 +1637,9 @@ namespace CodeImp.DoomBuilder {
GC.Collect();
GC.WaitForPendingFinalizers();
// Clear errors
General.ErrorLogger.Clear();
// Reload game configuration
General.WriteLogLine("Reloading game configuration...");
configinfo = General.GetConfigurationInfo(options.ConfigFile);

View file

@ -1697,10 +1697,8 @@ namespace CodeImp.DoomBuilder.Geometry
if(j.forward)
{
Vertex v;
// Add sidedefs forward (connected to the right vertex)
v = j.sidedef.IsFront ? j.sidedef.Line.End : j.sidedef.Line.Start;
Vertex v = j.sidedef.IsFront ? j.sidedef.Line.End : j.sidedef.Line.Start;
AddSidedefsForFloodfill(todo, v, true, originaltexture);
// Add sidedefs backward (connected to the left vertex)
@ -1709,10 +1707,8 @@ namespace CodeImp.DoomBuilder.Geometry
}
else
{
Vertex v;
// Add sidedefs backward (connected to the left vertex)
v = j.sidedef.IsFront ? j.sidedef.Line.Start : j.sidedef.Line.End;
Vertex v = j.sidedef.IsFront ? j.sidedef.Line.Start : j.sidedef.Line.End;
AddSidedefsForFloodfill(todo, v, false, originaltexture);
// Add sidedefs forward (connected to the right vertex)

View file

@ -164,6 +164,7 @@ namespace CodeImp.DoomBuilder.Windows
this.label16 = new System.Windows.Forms.Label();
this.pasteoptions = new CodeImp.DoomBuilder.Controls.PasteOptionsControl();
this.toolTip1 = new System.Windows.Forms.ToolTip(this.components);
this.capitalizetexturenames = new System.Windows.Forms.CheckBox();
label7 = new System.Windows.Forms.Label();
label6 = new System.Windows.Forms.Label();
label5 = new System.Windows.Forms.Label();
@ -1313,6 +1314,7 @@ namespace CodeImp.DoomBuilder.Windows
this.appearancegroup1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.appearancegroup1.Controls.Add(this.capitalizetexturenames);
this.appearancegroup1.Controls.Add(this.cbMarkExtraFloors);
this.appearancegroup1.Controls.Add(this.cbOldHighlightMode);
this.appearancegroup1.Controls.Add(label21);
@ -1356,7 +1358,7 @@ namespace CodeImp.DoomBuilder.Windows
// cbOldHighlightMode
//
this.cbOldHighlightMode.AutoSize = true;
this.cbOldHighlightMode.Location = new System.Drawing.Point(236, 233);
this.cbOldHighlightMode.Location = new System.Drawing.Point(236, 254);
this.cbOldHighlightMode.Name = "cbOldHighlightMode";
this.cbOldHighlightMode.Size = new System.Drawing.Size(218, 18);
this.cbOldHighlightMode.TabIndex = 33;
@ -1434,7 +1436,7 @@ namespace CodeImp.DoomBuilder.Windows
// animatevisualselection
//
this.animatevisualselection.AutoSize = true;
this.animatevisualselection.Location = new System.Drawing.Point(236, 212);
this.animatevisualselection.Location = new System.Drawing.Point(236, 233);
this.animatevisualselection.Name = "animatevisualselection";
this.animatevisualselection.Size = new System.Drawing.Size(188, 18);
this.animatevisualselection.TabIndex = 23;
@ -1770,6 +1772,18 @@ namespace CodeImp.DoomBuilder.Windows
this.pasteoptions.Size = new System.Drawing.Size(666, 427);
this.pasteoptions.TabIndex = 0;
//
// capitalizetexturenames
//
this.capitalizetexturenames.AutoSize = true;
this.capitalizetexturenames.Location = new System.Drawing.Point(236, 212);
this.capitalizetexturenames.Name = "capitalizetexturenames";
this.capitalizetexturenames.Size = new System.Drawing.Size(144, 18);
this.capitalizetexturenames.TabIndex = 36;
this.capitalizetexturenames.Text = "Capitalize texture names";
this.toolTip1.SetToolTip(this.capitalizetexturenames, "When enabled, texture names will be shown \r\nand saved as all caps (DB2 behaviour)" +
"");
this.capitalizetexturenames.UseVisualStyleBackColor = true;
//
// PreferencesForm
//
this.AcceptButton = this.apply;
@ -1958,5 +1972,6 @@ namespace CodeImp.DoomBuilder.Windows
private System.Windows.Forms.Label labelRecentFiles;
private System.Windows.Forms.Label label25;
private System.Windows.Forms.CheckBox snippetsallmanstyle;
private System.Windows.Forms.CheckBox capitalizetexturenames;
}
}

View file

@ -177,6 +177,7 @@ namespace CodeImp.DoomBuilder.Windows
colorliterals.Color = General.Colors.Literals;
colorconstants.Color = General.Colors.Constants;
blackbrowsers.Checked = General.Settings.BlackBrowsers;
capitalizetexturenames.Checked = General.Settings.CapitalizeTextureNames; //mxd
classicbilinear.Checked = General.Settings.ClassicBilinear;
visualbilinear.Checked = General.Settings.VisualBilinear;
qualitydisplay.Checked = General.Settings.QualityDisplay;
@ -280,6 +281,7 @@ namespace CodeImp.DoomBuilder.Windows
General.Colors.CreateAssistColors();
General.Settings.BlackBrowsers = blackbrowsers.Checked;
General.Settings.CapitalizeTextureNames = capitalizetexturenames.Checked; //mxd
General.Settings.ClassicBilinear = classicbilinear.Checked;
General.Settings.VisualBilinear = visualbilinear.Checked;
General.Settings.QualityDisplay = qualitydisplay.Checked;

View file

@ -220,9 +220,9 @@ namespace CodeImp.DoomBuilder.Windows
//
// label2
//
label2.Location = new System.Drawing.Point(242, 16);
label2.Location = new System.Drawing.Point(193, 16);
label2.Name = "label2";
label2.Size = new System.Drawing.Size(83, 16);
label2.Size = new System.Drawing.Size(114, 16);
label2.TabIndex = 15;
label2.Text = "Floor";
label2.TextAlign = System.Drawing.ContentAlignment.TopCenter;
@ -238,9 +238,9 @@ namespace CodeImp.DoomBuilder.Windows
//
// label4
//
label4.Location = new System.Drawing.Point(337, 16);
label4.Location = new System.Drawing.Point(313, 16);
label4.Name = "label4";
label4.Size = new System.Drawing.Size(83, 16);
label4.Size = new System.Drawing.Size(114, 16);
label4.TabIndex = 14;
label4.Text = "Ceiling";
label4.TextAlign = System.Drawing.ContentAlignment.TopCenter;
@ -256,10 +256,10 @@ namespace CodeImp.DoomBuilder.Windows
//
// floortex
//
this.floortex.Location = new System.Drawing.Point(242, 35);
this.floortex.Location = new System.Drawing.Point(196, 35);
this.floortex.MultipleTextures = false;
this.floortex.Name = "floortex";
this.floortex.Size = new System.Drawing.Size(83, 105);
this.floortex.Size = new System.Drawing.Size(114, 105);
this.floortex.TabIndex = 2;
this.floortex.TextureName = "";
this.floortex.OnValueChanged += new System.EventHandler(this.floortex_OnValueChanged);
@ -280,10 +280,10 @@ namespace CodeImp.DoomBuilder.Windows
//
// ceilingtex
//
this.ceilingtex.Location = new System.Drawing.Point(337, 35);
this.ceilingtex.Location = new System.Drawing.Point(316, 35);
this.ceilingtex.MultipleTextures = false;
this.ceilingtex.Name = "ceilingtex";
this.ceilingtex.Size = new System.Drawing.Size(83, 105);
this.ceilingtex.Size = new System.Drawing.Size(114, 105);
this.ceilingtex.TabIndex = 3;
this.ceilingtex.TextureName = "";
this.ceilingtex.OnValueChanged += new System.EventHandler(this.ceilingtex_OnValueChanged);

View file

@ -135,6 +135,9 @@
<metadata name="label8.GenerateMember" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
<metadata name="label8.GenerateMember" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
<metadata name="label9.GenerateMember" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>

View file

@ -464,7 +464,7 @@
// cbUseFloorLineAngles
//
this.cbUseFloorLineAngles.AutoSize = true;
this.cbUseFloorLineAngles.Location = new System.Drawing.Point(236, 119);
this.cbUseFloorLineAngles.Location = new System.Drawing.Point(236, 147);
this.cbUseFloorLineAngles.Name = "cbUseFloorLineAngles";
this.cbUseFloorLineAngles.Size = new System.Drawing.Size(99, 18);
this.cbUseFloorLineAngles.TabIndex = 57;
@ -476,7 +476,7 @@
// floorAngleControl
//
this.floorAngleControl.Angle = 0;
this.floorAngleControl.Location = new System.Drawing.Point(186, 104);
this.floorAngleControl.Location = new System.Drawing.Point(186, 132);
this.floorAngleControl.Name = "floorAngleControl";
this.floorAngleControl.Size = new System.Drawing.Size(44, 44);
this.floorAngleControl.TabIndex = 56;
@ -484,7 +484,7 @@
//
// label7
//
this.label7.Location = new System.Drawing.Point(29, 178);
this.label7.Location = new System.Drawing.Point(29, 88);
this.label7.Name = "label7";
this.label7.Size = new System.Drawing.Size(80, 14);
this.label7.TabIndex = 54;
@ -494,7 +494,7 @@
//
// label10
//
this.label10.Location = new System.Drawing.Point(29, 150);
this.label10.Location = new System.Drawing.Point(29, 178);
this.label10.Name = "label10";
this.label10.Size = new System.Drawing.Size(80, 14);
this.label10.TabIndex = 52;
@ -509,7 +509,7 @@
this.floorAlpha.AllowRelative = false;
this.floorAlpha.ButtonStep = 1;
this.floorAlpha.ButtonStepFloat = 0.1F;
this.floorAlpha.Location = new System.Drawing.Point(118, 145);
this.floorAlpha.Location = new System.Drawing.Point(118, 173);
this.floorAlpha.Name = "floorAlpha";
this.floorAlpha.Size = new System.Drawing.Size(62, 24);
this.floorAlpha.StepValues = null;
@ -518,7 +518,7 @@
//
// label11
//
this.label11.Location = new System.Drawing.Point(29, 120);
this.label11.Location = new System.Drawing.Point(29, 148);
this.label11.Name = "label11";
this.label11.Size = new System.Drawing.Size(80, 14);
this.label11.TabIndex = 50;
@ -533,7 +533,7 @@
this.floorRotation.AllowRelative = true;
this.floorRotation.ButtonStep = 5;
this.floorRotation.ButtonStepFloat = 1F;
this.floorRotation.Location = new System.Drawing.Point(118, 115);
this.floorRotation.Location = new System.Drawing.Point(118, 143);
this.floorRotation.Name = "floorRotation";
this.floorRotation.Size = new System.Drawing.Size(62, 24);
this.floorRotation.StepValues = null;
@ -544,7 +544,7 @@
// floorLightAbsolute
//
this.floorLightAbsolute.AutoSize = true;
this.floorLightAbsolute.Location = new System.Drawing.Point(186, 89);
this.floorLightAbsolute.Location = new System.Drawing.Point(186, 117);
this.floorLightAbsolute.Name = "floorLightAbsolute";
this.floorLightAbsolute.Size = new System.Drawing.Size(69, 18);
this.floorLightAbsolute.TabIndex = 49;
@ -554,7 +554,7 @@
//
// label12
//
this.label12.Location = new System.Drawing.Point(29, 90);
this.label12.Location = new System.Drawing.Point(29, 118);
this.label12.Name = "label12";
this.label12.Size = new System.Drawing.Size(80, 14);
this.label12.TabIndex = 47;
@ -569,7 +569,7 @@
this.floorBrightness.AllowRelative = true;
this.floorBrightness.ButtonStep = 16;
this.floorBrightness.ButtonStepFloat = 1F;
this.floorBrightness.Location = new System.Drawing.Point(118, 85);
this.floorBrightness.Location = new System.Drawing.Point(118, 113);
this.floorBrightness.Name = "floorBrightness";
this.floorBrightness.Size = new System.Drawing.Size(62, 24);
this.floorBrightness.StepValues = null;
@ -581,9 +581,9 @@
//
this.floorRenderStyle.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.floorRenderStyle.FormattingEnabled = true;
this.floorRenderStyle.Location = new System.Drawing.Point(118, 175);
this.floorRenderStyle.Location = new System.Drawing.Point(118, 85);
this.floorRenderStyle.Name = "floorRenderStyle";
this.floorRenderStyle.Size = new System.Drawing.Size(86, 22);
this.floorRenderStyle.Size = new System.Drawing.Size(130, 22);
this.floorRenderStyle.TabIndex = 46;
//
// floorScale
@ -624,10 +624,10 @@
//
// floortex
//
this.floortex.Location = new System.Drawing.Point(338, 19);
this.floortex.Location = new System.Drawing.Point(305, 19);
this.floortex.MultipleTextures = false;
this.floortex.Name = "floortex";
this.floortex.Size = new System.Drawing.Size(83, 105);
this.floortex.Size = new System.Drawing.Size(132, 105);
this.floortex.TabIndex = 15;
this.floortex.TextureName = "";
this.floortex.OnValueChanged += new System.EventHandler(this.floortex_OnValueChanged);
@ -660,7 +660,7 @@
// cbUseCeilLineAngles
//
this.cbUseCeilLineAngles.AutoSize = true;
this.cbUseCeilLineAngles.Location = new System.Drawing.Point(236, 119);
this.cbUseCeilLineAngles.Location = new System.Drawing.Point(236, 147);
this.cbUseCeilLineAngles.Name = "cbUseCeilLineAngles";
this.cbUseCeilLineAngles.Size = new System.Drawing.Size(99, 18);
this.cbUseCeilLineAngles.TabIndex = 56;
@ -672,7 +672,7 @@
// ceilAngleControl
//
this.ceilAngleControl.Angle = 0;
this.ceilAngleControl.Location = new System.Drawing.Point(186, 104);
this.ceilAngleControl.Location = new System.Drawing.Point(186, 132);
this.ceilAngleControl.Name = "ceilAngleControl";
this.ceilAngleControl.Size = new System.Drawing.Size(44, 44);
this.ceilAngleControl.TabIndex = 55;
@ -680,7 +680,7 @@
//
// label3
//
this.label3.Location = new System.Drawing.Point(29, 178);
this.label3.Location = new System.Drawing.Point(29, 88);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(80, 14);
this.label3.TabIndex = 54;
@ -690,7 +690,7 @@
//
// label4
//
this.label4.Location = new System.Drawing.Point(29, 150);
this.label4.Location = new System.Drawing.Point(29, 178);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(80, 14);
this.label4.TabIndex = 52;
@ -705,7 +705,7 @@
this.ceilAlpha.AllowRelative = false;
this.ceilAlpha.ButtonStep = 1;
this.ceilAlpha.ButtonStepFloat = 0.1F;
this.ceilAlpha.Location = new System.Drawing.Point(118, 145);
this.ceilAlpha.Location = new System.Drawing.Point(118, 173);
this.ceilAlpha.Name = "ceilAlpha";
this.ceilAlpha.Size = new System.Drawing.Size(62, 24);
this.ceilAlpha.StepValues = null;
@ -714,7 +714,7 @@
//
// label1
//
this.label1.Location = new System.Drawing.Point(29, 120);
this.label1.Location = new System.Drawing.Point(29, 148);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(80, 14);
this.label1.TabIndex = 50;
@ -729,7 +729,7 @@
this.ceilRotation.AllowRelative = true;
this.ceilRotation.ButtonStep = 5;
this.ceilRotation.ButtonStepFloat = 1F;
this.ceilRotation.Location = new System.Drawing.Point(118, 115);
this.ceilRotation.Location = new System.Drawing.Point(118, 143);
this.ceilRotation.Name = "ceilRotation";
this.ceilRotation.Size = new System.Drawing.Size(62, 24);
this.ceilRotation.StepValues = null;
@ -740,7 +740,7 @@
// ceilLightAbsolute
//
this.ceilLightAbsolute.AutoSize = true;
this.ceilLightAbsolute.Location = new System.Drawing.Point(186, 89);
this.ceilLightAbsolute.Location = new System.Drawing.Point(186, 117);
this.ceilLightAbsolute.Name = "ceilLightAbsolute";
this.ceilLightAbsolute.Size = new System.Drawing.Size(69, 18);
this.ceilLightAbsolute.TabIndex = 49;
@ -751,7 +751,7 @@
//
// labelLightFront
//
this.labelLightFront.Location = new System.Drawing.Point(29, 90);
this.labelLightFront.Location = new System.Drawing.Point(29, 118);
this.labelLightFront.Name = "labelLightFront";
this.labelLightFront.Size = new System.Drawing.Size(80, 14);
this.labelLightFront.TabIndex = 47;
@ -766,7 +766,7 @@
this.ceilBrightness.AllowRelative = true;
this.ceilBrightness.ButtonStep = 16;
this.ceilBrightness.ButtonStepFloat = 1F;
this.ceilBrightness.Location = new System.Drawing.Point(118, 85);
this.ceilBrightness.Location = new System.Drawing.Point(118, 113);
this.ceilBrightness.Name = "ceilBrightness";
this.ceilBrightness.Size = new System.Drawing.Size(62, 24);
this.ceilBrightness.StepValues = null;
@ -778,9 +778,9 @@
//
this.ceilRenderStyle.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.ceilRenderStyle.FormattingEnabled = true;
this.ceilRenderStyle.Location = new System.Drawing.Point(118, 175);
this.ceilRenderStyle.Location = new System.Drawing.Point(118, 85);
this.ceilRenderStyle.Name = "ceilRenderStyle";
this.ceilRenderStyle.Size = new System.Drawing.Size(86, 22);
this.ceilRenderStyle.Size = new System.Drawing.Size(130, 22);
this.ceilRenderStyle.TabIndex = 46;
//
// ceilScale
@ -821,10 +821,10 @@
//
// ceilingtex
//
this.ceilingtex.Location = new System.Drawing.Point(338, 19);
this.ceilingtex.Location = new System.Drawing.Point(305, 19);
this.ceilingtex.MultipleTextures = false;
this.ceilingtex.Name = "ceilingtex";
this.ceilingtex.Size = new System.Drawing.Size(83, 105);
this.ceilingtex.Size = new System.Drawing.Size(132, 105);
this.ceilingtex.TabIndex = 15;
this.ceilingtex.TextureName = "";
this.ceilingtex.OnValueChanged += new System.EventHandler(this.ceilingtex_OnValueChanged);

View file

@ -138,6 +138,21 @@
<metadata name="label8.GenerateMember" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
<metadata name="label14.GenerateMember" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
<metadata name="label9.GenerateMember" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
<metadata name="label13.GenerateMember" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
<metadata name="label2.GenerateMember" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
<metadata name="label8.GenerateMember" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
<metadata name="groupfloorceiling.GenerateMember" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
@ -147,6 +162,12 @@
<metadata name="label5.GenerateMember" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
<metadata name="label6.GenerateMember" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
<metadata name="label5.GenerateMember" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
<metadata name="tabproperties.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
@ -156,4 +177,7 @@
<metadata name="fieldslist.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="fieldslist.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
</root>

View file

@ -90,9 +90,9 @@ namespace CodeImp.DoomBuilder.ZDoom
if(this.HasError) break;
// if a limit for the texture name length is set make sure that it's not exceeded
if ((General.Map.Config.MaxTextureNamelength > 0) && (tx.Name.Length > General.Map.Config.MaxTextureNamelength))
if((General.Map.Config.MaxTextureNameLength > 0) && (tx.Name.Length > General.Map.Config.MaxTextureNameLength))
{
General.ErrorLogger.Add(ErrorType.Error, "Texture name \"" + tx.Name + "\" too long. Texture names must have a length of " + General.Map.Config.MaxTextureNamelength + " characters or less");
General.ErrorLogger.Add(ErrorType.Error, "Texture name \"" + tx.Name + "\" too long. Texture names must have a length of " + General.Map.Config.MaxTextureNameLength + " characters or less");
}
else
{
@ -108,9 +108,9 @@ namespace CodeImp.DoomBuilder.ZDoom
if(this.HasError) break;
// if a limit for the sprite name length is set make sure that it's not exceeded
if ((General.Map.Config.MaxTextureNamelength > 0) && (tx.Name.Length > General.Map.Config.MaxTextureNamelength))
if((General.Map.Config.MaxTextureNameLength > 0) && (tx.Name.Length > General.Map.Config.MaxTextureNameLength))
{
General.ErrorLogger.Add(ErrorType.Error, "Sprite name \"" + tx.Name + "\" too long. Sprite names must have a length of " + General.Map.Config.MaxTextureNamelength + " characters or less");
General.ErrorLogger.Add(ErrorType.Error, "Sprite name \"" + tx.Name + "\" too long. Sprite names must have a length of " + General.Map.Config.MaxTextureNameLength + " characters or less");
}
else
{
@ -125,9 +125,9 @@ namespace CodeImp.DoomBuilder.ZDoom
if(this.HasError) break;
// if a limit for the walltexture name length is set make sure that it's not exceeded
if((General.Map.Config.MaxTextureNamelength > 0) && (tx.Name.Length > General.Map.Config.MaxTextureNamelength))
if((General.Map.Config.MaxTextureNameLength > 0) && (tx.Name.Length > General.Map.Config.MaxTextureNameLength))
{
General.ErrorLogger.Add(ErrorType.Error, "WallTexture name \"" + tx.Name + "\" too long. WallTexture names must have a length of " + General.Map.Config.MaxTextureNamelength + " characters or less");
General.ErrorLogger.Add(ErrorType.Error, "WallTexture name \"" + tx.Name + "\" too long. WallTexture names must have a length of " + General.Map.Config.MaxTextureNameLength + " characters or less");
}
else
{
@ -143,9 +143,9 @@ namespace CodeImp.DoomBuilder.ZDoom
if(this.HasError) break;
// if a limit for the flat name length is set make sure that it's not exceeded
if((General.Map.Config.MaxTextureNamelength > 0) && (tx.Name.Length > General.Map.Config.MaxTextureNamelength))
if((General.Map.Config.MaxTextureNameLength > 0) && (tx.Name.Length > General.Map.Config.MaxTextureNameLength))
{
General.ErrorLogger.Add(ErrorType.Error, "Flat name \"" + tx.Name + "\" too long. Flat names must have a length of " + General.Map.Config.MaxTextureNamelength + " characters or less");
General.ErrorLogger.Add(ErrorType.Error, "Flat name \"" + tx.Name + "\" too long. Flat names must have a length of " + General.Map.Config.MaxTextureNameLength + " characters or less");
}
else
{

View file

@ -360,6 +360,7 @@
<Compile Include="VisualModes\EffectCopySlope.cs" />
<Compile Include="VisualModes\EffectLineSlope.cs" />
<Compile Include="VisualModes\EffectPlaneCopySlope.cs" />
<Compile Include="VisualModes\EffectSectorSlope.cs" />
<Compile Include="VisualModes\EffectThingLineSlope.cs" />
<Compile Include="VisualModes\EffectThingSlope.cs" />
<Compile Include="VisualModes\EffectThingVertexSlope.cs" />

View file

@ -757,7 +757,16 @@ namespace CodeImp.DoomBuilder.BuilderModes
// Find sectors with 3 vertices, because they can be sloped
foreach(Sector s in General.Map.Map.Sectors)
{
// ========== Thing vertex slope, vertices with UDMF vertex offsets ==========
// ========== Sector slope, Thing vertex slope, vertices with UDMF vertex offsets ==========
if (General.Map.UDMF)
{
bool havesectorfloorslope = !(!s.Fields.ContainsKey("floorplane_a") || !s.Fields.ContainsKey("floorplane_b") || !s.Fields.ContainsKey("floorplane_c") || !s.Fields.ContainsKey("floorplane_d"));
bool havesectorceilingslope = !(!s.Fields.ContainsKey("ceilingplane_a") || !s.Fields.ContainsKey("ceilingplane_b") || !s.Fields.ContainsKey("ceilingplane_c") || !s.Fields.ContainsKey("ceilingplane_d"));
if(havesectorfloorslope) GetSectorData(s).AddEffectSectorSlope(false);
if(havesectorceilingslope) GetSectorData(s).AddEffectSectorSlope(true);
}
if(s.Sidedefs.Count == 3)
{
if(General.Map.UDMF) //mxd

View file

@ -0,0 +1,51 @@
using CodeImp.DoomBuilder.Geometry;
namespace CodeImp.DoomBuilder.BuilderModes
{
internal class EffectSectorSlope : SectorEffect
{
private readonly bool ceilingslope;
public EffectSectorSlope(SectorData data, bool ceilingslope) : base(data)
{
this.ceilingslope = ceilingslope;
// New effect added: This sector needs an update!
if(data.Mode.VisualSectorExists(data.Sector))
{
BaseVisualSector vs = (BaseVisualSector)data.Mode.GetVisualSector(data.Sector);
vs.UpdateSectorGeometry(true);
}
}
// This makes sure we are updated with the source linedef information
public override void Update()
{
if (ceilingslope) {
float a = data.Sector.Fields.GetValue("ceilingplane_a", 0f);
float b = data.Sector.Fields.GetValue("ceilingplane_b", 0f);
float c = data.Sector.Fields.GetValue("ceilingplane_c", 0f);
float d = 0; //data.Sector.Fields.GetValue("ceilingplane_d", 0f);
Vector3D normal = new Vector3D(a, b, c).GetNormal();
if (normal.x != 0 || normal.y != 0 || normal.z != 0) {
if(normal.z > 0) normal = -normal; //flip the plane if it's facing the wrong direction
data.Ceiling.plane = new Plane(normal, d);
}
}
else
{
float a = data.Sector.Fields.GetValue("floorplane_a", 0f);
float b = data.Sector.Fields.GetValue("floorplane_b", 0f);
float c = data.Sector.Fields.GetValue("floorplane_c", 0f);
float d = 0; //data.Sector.Fields.GetValue("floorplane_d", 0f);
Vector3D normal = new Vector3D(a, b, c).GetNormal();
if (normal.x != 0 || normal.y != 0 || normal.z != 0) {
if(normal.z < 0) normal = -normal; //flip the plane if it's facing the wrong direction
data.Floor.plane = new Plane(normal, d);
}
}
}
}
}

View file

@ -3,17 +3,20 @@ using CodeImp.DoomBuilder.Geometry;
namespace CodeImp.DoomBuilder.BuilderModes
{
internal class EffectUDMFVertexOffset : SectorEffect {
public EffectUDMFVertexOffset(SectorData data) : base(data) {
internal class EffectUDMFVertexOffset : SectorEffect
{
public EffectUDMFVertexOffset(SectorData data) : base(data)
{
// New effect added: This sector needs an update!
if(data.Mode.VisualSectorExists(data.Sector)) {
if(data.Mode.VisualSectorExists(data.Sector))
{
BaseVisualSector vs = (BaseVisualSector)data.Mode.GetVisualSector(data.Sector);
vs.UpdateSectorGeometry(true);
}
}
public override void Update() {
public override void Update()
{
// Create vertices in clockwise order
Vector3D[] floorVerts = new Vector3D[3];
Vector3D[] ceilingVerts = new Vector3D[3];
@ -22,7 +25,8 @@ namespace CodeImp.DoomBuilder.BuilderModes
int index = 0;
//check vertices
foreach(Sidedef sd in data.Sector.Sidedefs) {
foreach(Sidedef sd in data.Sector.Sidedefs)
{
Vertex v = sd.IsFront ? sd.Line.End : sd.Line.Start;
//create "normal" vertices
@ -30,26 +34,33 @@ namespace CodeImp.DoomBuilder.BuilderModes
ceilingVerts[index] = new Vector3D(v.Position);
//check ceiling
if(!float.IsNaN(v.ZCeiling)) {
if(!float.IsNaN(v.ZCeiling))
{
//vertex offset is absolute
ceilingVerts[index].z = v.ZCeiling;
ceilingChanged = true;
} else {
}
else
{
ceilingVerts[index].z = data.Ceiling.plane.GetZ(v.Position);
}
//and floor
if(!float.IsNaN(v.ZFloor)) {
if(!float.IsNaN(v.ZFloor))
{
//vertex offset is absolute
floorVerts[index].z = v.ZFloor;
floorChanged = true;
} else {
}
else
{
floorVerts[index].z = data.Floor.plane.GetZ(v.Position);
}
VertexData vd = data.Mode.GetVertexData(v);
foreach(Linedef line in v.Linedefs) {
foreach(Linedef line in v.Linedefs)
{
if(line.Front != null && line.Front.Sector != null)
vd.AddUpdateSector(line.Front.Sector, false);
if(line.Back != null && line.Back.Sector != null)
@ -57,7 +68,6 @@ namespace CodeImp.DoomBuilder.BuilderModes
}
data.Mode.UpdateVertexHandle(v);
index++;
}

View file

@ -114,8 +114,16 @@ namespace CodeImp.DoomBuilder.BuilderModes
alleffects.Add(e);
}
//mxd. Sector slope effect
public void AddEffectSectorSlope(bool ceilingslope)
{
EffectSectorSlope e = new EffectSectorSlope(this, ceilingslope);
alleffects.Add(e);
}
//mxd. Plane copy slope effect
public void AddEffectPlaneClopySlope(Linedef sourcelinedef, bool front) {
public void AddEffectPlaneClopySlope(Linedef sourcelinedef, bool front)
{
EffectPlaneCopySlope e = new EffectPlaneCopySlope(this, sourcelinedef, front);
alleffects.Add(e);
}
@ -149,7 +157,8 @@ namespace CodeImp.DoomBuilder.BuilderModes
}
//mxd. Add UDMF vertex offset effect
public void AddEffectVertexOffset() {
public void AddEffectVertexOffset()
{
EffectUDMFVertexOffset e = new EffectUDMFVertexOffset(this);
alleffects.Add(e);
}