Changed long texture names handling. Texture names conversion is no longer required.

Texture browser form: added "Long texture names" check-box. It can be used to toggle between displaying long and short texture names.
Texture browser form: added "Show image size" check-box.
Texture browser form: image size is now shown differently.
Image Selector: added a button to toggle between long and short texture name.
Linedef info panel: long texture names are now displayed properly.
Sector info panel: long texture names are now displayed properly.
Fixed: "Save Screenshot" and "Save Edit Area Screenshot" actions were triggered multiple times when a child window was open.
Fixed: used textures should be always updated after using "Change map in current WAD" action.
Fixed, "Change map in current WAD": fixed a crash when trying to switch from a map with missing game configuration path.
Updated ZDoom_ACS.cfg.
This commit is contained in:
MaxED 2014-12-03 09:06:05 +00:00
parent 6b765f5a27
commit 99f3ba2844
54 changed files with 1479 additions and 1270 deletions

View file

@ -538,9 +538,11 @@ constants
APROP_ChaseGoal;
APROP_Damage;
APROP_DamageFactor;
APROP_DamageMultiplier;
APROP_DeathSound;
APROP_Dormant;
APROP_Dropped;
APROP_Friction;
APROP_Friendly;
APROP_Frightened;
APROP_Gravity;

View file

@ -276,10 +276,8 @@ namespace CodeImp.DoomBuilder.Actions
// This binds a delegate manually
internal void BindBeginDelegate(Assembly asm, ActionDelegate d, BeginActionAttribute a)
{
string actionname;
// Make proper name
actionname = a.GetFullActionName(asm);
string actionname = a.GetFullActionName(asm);
// Bind delegate to action
if(Exists(actionname))
@ -291,10 +289,8 @@ namespace CodeImp.DoomBuilder.Actions
// This binds a delegate manually
internal void BindEndDelegate(Assembly asm, ActionDelegate d, EndActionAttribute a)
{
string actionname;
// Make proper name
actionname = a.GetFullActionName(asm);
string actionname = a.GetFullActionName(asm);
// Bind delegate to action
if(Exists(actionname))
@ -371,10 +367,8 @@ namespace CodeImp.DoomBuilder.Actions
// This unbinds a delegate manually
internal void UnbindBeginDelegate(Assembly asm, ActionDelegate d, BeginActionAttribute a)
{
string actionname;
// Make proper name
actionname = a.GetFullActionName(asm);
string actionname = a.GetFullActionName(asm);
// Unbind delegate to action
actions[actionname].UnbindBegin(d);
@ -383,10 +377,8 @@ namespace CodeImp.DoomBuilder.Actions
// This unbinds a delegate manually
internal void UnbindEndDelegate(Assembly asm, ActionDelegate d, EndActionAttribute a)
{
string actionname;
// Make proper name
actionname = a.GetFullActionName(asm);
string actionname = a.GetFullActionName(asm);
// Unbind delegate to action
actions[actionname].UnbindEnd(d);

View file

@ -1010,6 +1010,7 @@
<None Include="Resources\Cursor.png" />
<None Include="Resources\Brightness.png" />
<None Include="Resources\Clear.png" />
<None Include="Resources\Collapse.png" />
<Content Include="Resources\DB2.ico" />
<None Include="Resources\GZDB2.ico" />
<None Include="Resources\fog.png" />
@ -1019,6 +1020,7 @@
<None Include="Resources\Keyboard.png" />
<None Include="Resources\ImageStack.png" />
<None Include="Resources\FolderExplore.png" />
<None Include="Resources\Expand.png" />
<Content Include="Resources\Light.png" />
<None Include="Resources\Lightbulb.png" />
<None Include="Resources\LightDisabled.png" />

View file

@ -59,7 +59,6 @@ namespace CodeImp.DoomBuilder.Config
private Configuration config; //mxd
private bool enabled; //mxd
private bool changed; //mxd
private bool longtexturenames; //mxd
private List<EngineInfo> testEngines; //mxd
private int currentEngineIndex; //mxd
@ -85,7 +84,6 @@ namespace CodeImp.DoomBuilder.Config
internal Configuration Configuration { get { return config; } } //mxd
public bool Enabled { get { return enabled; } internal set { enabled = value; } } //mxd
public bool Changed { get { return changed; } internal set { changed = value; } } //mxd
public bool SupportsLongTextureNames { get { return longtexturenames; } internal set { longtexturenames = value; } } //mxd
//mxd
public string TestProgramName { get { return testEngines[currentEngineIndex].TestProgramName; } internal set { testEngines[currentEngineIndex].TestProgramName = value; } }
@ -118,7 +116,6 @@ namespace CodeImp.DoomBuilder.Config
// Load settings from game configuration
this.name = config.ReadSetting("game", "<unnamed game>");
this.defaultlumpname = config.ReadSetting("defaultlumpname", "");
this.longtexturenames = config.ReadSetting("longtexturenames", false); //mxd
// Load settings from program configuration
this.nodebuildersave = General.Settings.ReadSetting("configurations." + settingskey + ".nodebuildersave", MISSING_NODEBUILDER);

View file

@ -74,6 +74,7 @@ namespace CodeImp.DoomBuilder.Config
private readonly string decorategames;
private readonly string skyflatname;
private readonly int maxtexturenamelength;
private readonly bool longtexturenames; //mxd
private readonly int leftboundary;
private readonly int rightboundary;
private readonly int topboundary;
@ -178,6 +179,7 @@ namespace CodeImp.DoomBuilder.Config
public string DecorateGames { get { return decorategames; } }
public string SkyFlatName { get { return skyflatname; } }
public int MaxTextureNameLength { get { return maxtexturenamelength; } }
public bool UseLongTextureNames { get { return longtexturenames; } } //mxd
public int LeftBoundary { get { return leftboundary; } }
public int RightBoundary { get { return rightboundary; } }
public int TopBoundary { get { return topboundary; } }
@ -321,8 +323,8 @@ namespace CodeImp.DoomBuilder.Config
for(int i = 0; i < Linedef.NUM_ARGS; i++) makedoorargs[i] = cfg.ReadSetting("makedoorarg" + i.ToString(CultureInfo.InvariantCulture), 0);
//mxd. Texture names length
bool uselongtexturenames = cfg.ReadSetting("longtexturenames", false);
maxtexturenamelength = (uselongtexturenames ? short.MaxValue : DataManager.CLASIC_IMAGE_NAME_LENGTH);
longtexturenames = cfg.ReadSetting("longtexturenames", false);
maxtexturenamelength = (longtexturenames ? short.MaxValue : DataManager.CLASIC_IMAGE_NAME_LENGTH);
// Flags have special (invariant culture) conversion
// because they are allowed to be written as integers in the configs

View file

@ -44,6 +44,7 @@ namespace CodeImp.DoomBuilder.Controls
if(string.IsNullOrEmpty(imagename))
{
DisplayImageSize(0, 0); //mxd
UpdateToggleImageNameButton(null); //mxd
//mxd. Flat required?
return multipletextures ? Properties.Resources.ImageStack : Properties.Resources.MissingTexture;
@ -51,6 +52,7 @@ namespace CodeImp.DoomBuilder.Controls
else if(imagename == "-") //mxd
{
DisplayImageSize(0, 0);
UpdateToggleImageNameButton(null); //mxd
// Flat required!
return Properties.Resources.MissingTexture;
@ -58,6 +60,7 @@ namespace CodeImp.DoomBuilder.Controls
else
{
ImageData texture = General.Map.Data.GetFlatImage(imagename); //mxd
UpdateToggleImageNameButton(texture); //mxd
if(string.IsNullOrEmpty(texture.FullName) || texture is UnknownImage) DisplayImageSize(0, 0); //mxd
else DisplayImageSize(texture.ScaledWidth, texture.ScaledHeight); //mxd

View file

@ -34,16 +34,15 @@ namespace CodeImp.DoomBuilder.Controls
this.label = new System.Windows.Forms.Label();
this.splitter = new System.Windows.Forms.SplitContainer();
this.list = new CodeImp.DoomBuilder.Controls.OptimizedListView();
this.label2 = new System.Windows.Forms.Label();
this.showtexturesize = new System.Windows.Forms.CheckBox();
this.longtexturenames = new System.Windows.Forms.CheckBox();
this.filterheightlabel = new System.Windows.Forms.Label();
this.filterHeight = new CodeImp.DoomBuilder.Controls.ButtonsNumericTextbox();
this.label1 = new System.Windows.Forms.Label();
this.filterwidthlabel = new System.Windows.Forms.Label();
this.filterWidth = new CodeImp.DoomBuilder.Controls.ButtonsNumericTextbox();
this.cbMixMode = new System.Windows.Forms.ComboBox();
this.texturesize = new System.Windows.Forms.Label();
this.texturesizelabel = new System.Windows.Forms.Label();
this.objectname = new System.Windows.Forms.TextBox();
this.refreshtimer = new System.Windows.Forms.Timer(this.components);
this.texturesizetimer = new System.Windows.Forms.Timer(this.components);
this.splitter.Panel1.SuspendLayout();
this.splitter.Panel2.SuspendLayout();
this.splitter.SuspendLayout();
@ -82,17 +81,17 @@ namespace CodeImp.DoomBuilder.Controls
//
// splitter.Panel2
//
this.splitter.Panel2.Controls.Add(this.label2);
this.splitter.Panel2.Controls.Add(this.showtexturesize);
this.splitter.Panel2.Controls.Add(this.longtexturenames);
this.splitter.Panel2.Controls.Add(this.filterheightlabel);
this.splitter.Panel2.Controls.Add(this.filterHeight);
this.splitter.Panel2.Controls.Add(this.label1);
this.splitter.Panel2.Controls.Add(this.filterwidthlabel);
this.splitter.Panel2.Controls.Add(this.filterWidth);
this.splitter.Panel2.Controls.Add(this.cbMixMode);
this.splitter.Panel2.Controls.Add(this.labelMixMode);
this.splitter.Panel2.Controls.Add(this.texturesize);
this.splitter.Panel2.Controls.Add(this.texturesizelabel);
this.splitter.Panel2.Controls.Add(this.objectname);
this.splitter.Panel2.Controls.Add(this.label);
this.splitter.Size = new System.Drawing.Size(639, 346);
this.splitter.Size = new System.Drawing.Size(840, 346);
this.splitter.SplitterDistance = 312;
this.splitter.TabIndex = 0;
this.splitter.TabStop = false;
@ -106,7 +105,8 @@ namespace CodeImp.DoomBuilder.Controls
this.list.MultiSelect = false;
this.list.Name = "list";
this.list.OwnerDraw = true;
this.list.Size = new System.Drawing.Size(639, 312);
this.list.ShowItemToolTips = true;
this.list.Size = new System.Drawing.Size(840, 312);
this.list.TabIndex = 1;
this.list.TabStop = false;
this.list.TileSize = new System.Drawing.Size(90, 90);
@ -117,14 +117,36 @@ namespace CodeImp.DoomBuilder.Controls
this.list.ItemSelectionChanged += new System.Windows.Forms.ListViewItemSelectionChangedEventHandler(this.list_ItemSelectionChanged);
this.list.KeyDown += new System.Windows.Forms.KeyEventHandler(this.list_KeyDown);
//
// label2
// showtexturesize
//
this.label2.AutoSize = true;
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;
this.label2.Text = "Height:";
this.showtexturesize.AutoSize = true;
this.showtexturesize.Location = new System.Drawing.Point(470, 9);
this.showtexturesize.Name = "showtexturesize";
this.showtexturesize.Size = new System.Drawing.Size(109, 18);
this.showtexturesize.TabIndex = 2;
this.showtexturesize.Text = "Show image size";
this.showtexturesize.UseVisualStyleBackColor = true;
this.showtexturesize.CheckedChanged += new System.EventHandler(this.showtexturesize_CheckedChanged);
//
// longtexturenames
//
this.longtexturenames.AutoSize = true;
this.longtexturenames.Location = new System.Drawing.Point(585, 9);
this.longtexturenames.Name = "longtexturenames";
this.longtexturenames.Size = new System.Drawing.Size(122, 18);
this.longtexturenames.TabIndex = 1;
this.longtexturenames.Text = "Long texture names";
this.longtexturenames.UseVisualStyleBackColor = true;
this.longtexturenames.CheckedChanged += new System.EventHandler(this.longtexturenames_CheckedChanged);
//
// filterheightlabel
//
this.filterheightlabel.AutoSize = true;
this.filterheightlabel.Location = new System.Drawing.Point(367, 9);
this.filterheightlabel.Name = "filterheightlabel";
this.filterheightlabel.Size = new System.Drawing.Size(40, 14);
this.filterheightlabel.TabIndex = 0;
this.filterheightlabel.Text = "Height:";
//
// filterHeight
//
@ -142,14 +164,14 @@ namespace CodeImp.DoomBuilder.Controls
this.filterHeight.TabStop = false;
this.filterHeight.WhenTextChanged += new System.EventHandler(this.filterSize_WhenTextChanged);
//
// label1
// filterwidthlabel
//
this.label1.AutoSize = true;
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;
this.label1.Text = "Width:";
this.filterwidthlabel.AutoSize = true;
this.filterwidthlabel.Location = new System.Drawing.Point(268, 9);
this.filterwidthlabel.Name = "filterwidthlabel";
this.filterwidthlabel.Size = new System.Drawing.Size(37, 14);
this.filterwidthlabel.TabIndex = 0;
this.filterwidthlabel.Text = "Width:";
//
// filterWidth
//
@ -184,25 +206,6 @@ namespace CodeImp.DoomBuilder.Controls
this.cbMixMode.TabStop = false;
this.cbMixMode.SelectedIndexChanged += new System.EventHandler(this.cbMixMode_SelectedIndexChanged);
//
// texturesize
//
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;
this.texturesize.Text = "1024 x 1024";
this.texturesize.Visible = false;
//
// texturesizelabel
//
this.texturesizelabel.AutoSize = true;
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;
this.texturesizelabel.Text = "Size:";
this.texturesizelabel.Visible = false;
//
// objectname
//
this.objectname.CharacterCasing = System.Windows.Forms.CharacterCasing.Upper;
@ -220,11 +223,6 @@ namespace CodeImp.DoomBuilder.Controls
this.refreshtimer.Interval = 500;
this.refreshtimer.Tick += new System.EventHandler(this.refreshtimer_Tick);
//
// texturesizetimer
//
this.texturesizetimer.Interval = 3;
this.texturesizetimer.Tick += new System.EventHandler(this.texturesizetimer_Tick);
//
// ImageBrowserControl
//
this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
@ -232,8 +230,7 @@ namespace CodeImp.DoomBuilder.Controls
this.Controls.Add(this.splitter);
this.Font = new System.Drawing.Font("Arial", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.Name = "ImageBrowserControl";
this.Size = new System.Drawing.Size(639, 346);
this.Resize += new System.EventHandler(this.ImageBrowserControl_Resize);
this.Size = new System.Drawing.Size(840, 346);
this.splitter.Panel1.ResumeLayout(false);
this.splitter.Panel2.ResumeLayout(false);
this.splitter.Panel2.PerformLayout();
@ -248,16 +245,15 @@ namespace CodeImp.DoomBuilder.Controls
private OptimizedListView list;
private System.Windows.Forms.Timer refreshtimer;
private System.Windows.Forms.TextBox objectname;
private System.Windows.Forms.Label texturesize;
private System.Windows.Forms.Label texturesizelabel;
private System.Windows.Forms.Timer texturesizetimer;
private System.Windows.Forms.ComboBox cbMixMode;
private System.Windows.Forms.Label label;
private System.Windows.Forms.Label labelMixMode;
private ButtonsNumericTextbox filterWidth;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label filterheightlabel;
private ButtonsNumericTextbox filterHeight;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label filterwidthlabel;
private System.Windows.Forms.CheckBox longtexturenames;
private System.Windows.Forms.CheckBox showtexturesize;
}
}

View file

@ -51,6 +51,8 @@ namespace CodeImp.DoomBuilder.Controls
private bool updating;
private int keepselected;
private bool browseFlats; //mxd
private static bool uselongtexturenames = (General.Map != null && General.Map.Config.UseLongTextureNames); //mxd
private static bool showtexturesizes = (General.Settings != null && General.Settings.ShowTextureSizes); //mxd
// All items
private readonly List<ImageBrowserItem> items;
@ -60,7 +62,6 @@ namespace CodeImp.DoomBuilder.Controls
//mxd
private static int mixMode;
private string longestTextureName = "";
#endregion
@ -69,6 +70,7 @@ namespace CodeImp.DoomBuilder.Controls
public bool PreventSelection { get { return preventselection; } set { preventselection = value; } }
public bool HideInputBox { get { return splitter.Panel2Collapsed; } set { splitter.Panel2Collapsed = value; } }
public bool BrowseFlats { get { return browseFlats; } set { browseFlats = value; } } //mxd
public static bool ShowTextureSizes { get { return showtexturesizes; } } //mxd
public ListViewItem SelectedItem { get { if(list.SelectedItems.Count > 0) return list.SelectedItems[0]; else return null; } }
#endregion
@ -82,7 +84,7 @@ namespace CodeImp.DoomBuilder.Controls
InitializeComponent();
items = new List<ImageBrowserItem>();
//mxd.
//mxd
StepsList sizes = new StepsList { 4, 8, 16, 32, 48, 64, 96, 128, 196, 256, 512, 1024 };
filterWidth.StepValues = sizes;
filterHeight.StepValues = sizes;
@ -103,7 +105,6 @@ namespace CodeImp.DoomBuilder.Controls
{
int itemwidth = General.Map.Data.Previews.MaxImageWidth + 26;
int itemheight = General.Map.Data.Previews.MaxImageHeight + 26;
if(General.Settings.ShowTextureSizes) itemheight += 12;
list.TileSize = new Size(itemwidth, itemheight);
//mxd
@ -115,17 +116,36 @@ namespace CodeImp.DoomBuilder.Controls
{
labelMixMode.Visible = false;
cbMixMode.Visible = false;
label.Left = labelMixMode.Left;
objectname.Left = label.Right + label.Margin.Right + objectname.Margin.Left;
texturesizelabel.Left = objectname.Right + objectname.Margin.Right;
texturesize.Left = texturesizelabel.Right + texturesizelabel.Margin.Right;
int offset = label.Left - labelMixMode.Left;
label.Left -= offset;
objectname.Left -= offset;
filterWidth.Left -= offset;
filterwidthlabel.Left -= offset;
filterHeight.Left -= offset;
filterheightlabel.Left -= offset;
showtexturesize.Left -= offset;
longtexturenames.Left -= offset;
mixMode = 0;
}
//mxd. Use long texture names?
longtexturenames.Checked = (uselongtexturenames && General.Map.Config.UseLongTextureNames);
longtexturenames.Visible = General.Map.Config.UseLongTextureNames;
}
else
{
longtexturenames.Visible = false; //mxd
uselongtexturenames = false; //mxd
}
//mxd
if(!General.Settings.CapitalizeTextureNames)
objectname.CharacterCasing = CharacterCasing.Normal;
//mxd. Show texture sizes?
showtexturesize.Checked = showtexturesizes;
}
// This cleans everything up
@ -167,8 +187,6 @@ namespace CodeImp.DoomBuilder.Controls
// If all previews were loaded, stop this timer
if(allpreviewsloaded) refreshtimer.Stop();
UpdateTextureSizeLabel();
}
#endregion
@ -237,8 +255,6 @@ namespace CodeImp.DoomBuilder.Controls
// Raise event
if(SelectedItemChanged != null) SelectedItemChanged();
}
UpdateTextureSizeLabel();
}
// Doublelicking an item
@ -247,20 +263,6 @@ namespace CodeImp.DoomBuilder.Controls
if(!preventselection && (list.SelectedItems.Count > 0))
if(SelectedItemDoubleClicked != null) SelectedItemDoubleClicked();
}
// Control is resized
private void ImageBrowserControl_Resize(object sender, EventArgs e)
{
UpdateTextureSizeLabel();
}
// This hides the texture size label
private void texturesizetimer_Tick(object sender, EventArgs e)
{
texturesizetimer.Stop();
texturesize.Visible = false;
texturesizelabel.Visible = false;
}
//mxd
private void cbMixMode_SelectedIndexChanged(object sender, EventArgs e)
@ -268,6 +270,20 @@ namespace CodeImp.DoomBuilder.Controls
mixMode = cbMixMode.SelectedIndex;
RefillList(false);
}
//mxd
private void longtexturenames_CheckedChanged(object sender, EventArgs e)
{
uselongtexturenames = longtexturenames.Checked;
RefillList(false);
}
//mxd
private void showtexturesize_CheckedChanged(object sender, EventArgs e)
{
showtexturesizes = showtexturesize.Checked;
list.Invalidate();
}
#endregion
@ -325,8 +341,6 @@ namespace CodeImp.DoomBuilder.Controls
lvi.Selected = true;
lvi.EnsureVisible();
}
UpdateTextureSizeLabel();
}
// This performs item sleection by keys
@ -374,8 +388,6 @@ namespace CodeImp.DoomBuilder.Controls
// Make selection visible
if(list.SelectedItems.Count > 0) list.SelectedItems[0].EnsureVisible();
}
UpdateTextureSizeLabel();
}
// This selectes the first item
@ -395,8 +407,6 @@ namespace CodeImp.DoomBuilder.Controls
lvi.EnsureVisible();
}
}
UpdateTextureSizeLabel();
}
// This adds a group
@ -433,20 +443,19 @@ namespace CodeImp.DoomBuilder.Controls
}
// This adds an item
public void Add(string text, ImageData image, object tag, ListViewGroup group)
public void Add(ImageData image, object tag, ListViewGroup group)
{
if(text.Length > longestTextureName.Length) longestTextureName = text; //mxd
ImageBrowserItem i = new ImageBrowserItem(text, image, tag);
ImageBrowserItem i = new ImageBrowserItem(image, tag, uselongtexturenames); //mxd
i.ListGroup = group;
i.Group = group;
i.ToolTipText = image.Name; //mxd
items.Add(i);
}
// This adds an item
public void Add(string text, ImageData image, object tag, ListViewGroup group, string tooltiptext)
public void Add(ImageData image, object tag, ListViewGroup group, string tooltiptext)
{
if(text.Length > longestTextureName.Length) longestTextureName = text; //mxd
ImageBrowserItem i = new ImageBrowserItem(text, image, tag);
ImageBrowserItem i = new ImageBrowserItem(image, tag, uselongtexturenames); //mxd
i.ListGroup = group;
i.Group = group;
i.ToolTipText = tooltiptext;
@ -472,14 +481,17 @@ namespace CodeImp.DoomBuilder.Controls
int h = filterHeight.GetResult(-1);
// Go for all items
foreach(ImageBrowserItem i in items)
string prevname = string.Empty; //mxd
for(int i = items.Count - 1; i > -1; i--)
{
// Add item if valid
if(ValidateItem(i) && ValidateItemSize(i, w, h))
items[i].ShowFullName = uselongtexturenames; //mxd
if(ValidateItem(items[i], prevname) && ValidateItemSize(items[i], w, h))
{
i.Group = i.ListGroup;
i.Selected = false;
visibleitems.Add(i);
items[i].Group = items[i].ListGroup;
items[i].Selected = false;
visibleitems.Add(items[i]);
prevname = items[i].TextureName;
}
}
@ -513,14 +525,17 @@ namespace CodeImp.DoomBuilder.Controls
// Raise event
if((SelectedItemChanged != null) && !preventselection) SelectedItemChanged();
UpdateTextureSizeLabel();
}
// This validates an item
private bool ValidateItem(ImageBrowserItem i)
private bool ValidateItem(ImageBrowserItem i, string previtemname)
{
//mxd. Don't show duplicate items
if(i.TextureName == previtemname) return false; //mxd
//mxd. mixMode: 0 = All, 1 = Textures, 2 = Flats, 3 = Based on BrowseFlats
if(!splitter.Panel2Collapsed) {
if(!splitter.Panel2Collapsed)
{
if(mixMode == 1 && i.icon.IsFlat) return false;
if(mixMode == 2 && !i.icon.IsFlat) return false;
if(mixMode == 3 && (browseFlats != i.icon.IsFlat)) return false;
@ -544,27 +559,6 @@ namespace CodeImp.DoomBuilder.Controls
objectname.Focus();
}
// This updates the texture size label
private void UpdateTextureSizeLabel()
{
if((list.SelectedItems.Count == 0) ||
(splitter.Panel2.ClientSize.Width < (texturesize.Location.X + texturesize.Size.Width)))
{
texturesizetimer.Start();
}
else
{
texturesizetimer.Stop();
ImageBrowserItem lvi = (list.SelectedItems[0] as ImageBrowserItem);
if(lvi.icon.IsPreviewLoaded)
texturesize.Text = lvi.icon.Width + " x " + lvi.icon.Height;
else
texturesize.Text = "unknown";
texturesize.Visible = true;
texturesizelabel.Visible = true;
}
}
#endregion
}
}

View file

@ -126,7 +126,4 @@
<metadata name="refreshtimer.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>103, 17</value>
</metadata>
<metadata name="texturesizetimer.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>215, 17</value>
</metadata>
</root>

View file

@ -31,7 +31,7 @@ namespace CodeImp.DoomBuilder.Controls
{
#region ================== Constants
private const int MAX_DISPLAY_NAME_LENGTH = 16; //mxd
internal const int MAX_NAME_LENGTH = 14; //mxd
#endregion
@ -39,7 +39,8 @@ namespace CodeImp.DoomBuilder.Controls
// Display image and text
public readonly ImageData icon;
private string displaytext;
private string imagesize; //mxd
private bool showfullname; //mxd
private static readonly StringFormat format = new StringFormat { Alignment = StringAlignment.Center }; //mxd
// Group
@ -54,25 +55,21 @@ namespace CodeImp.DoomBuilder.Controls
public ListViewGroup ListGroup { get { return listgroup; } set { listgroup = value; } }
public bool IsPreviewLoaded { get { return imageloaded; } }
public bool ShowFullName { set { showfullname = value; UpdateName(); } }
public string TextureName { get { return showfullname ? icon.Name : icon.ShortName; } }
#endregion
#region ================== Constructor / Disposer
// Constructors
public ImageBrowserItem(string text, ImageData icon, object tag)
public ImageBrowserItem(ImageData icon, object tag, bool showfullname)
{
// Initialize
this.Text = text;
if (text.Length > MAX_DISPLAY_NAME_LENGTH) text = text.Substring(0, MAX_DISPLAY_NAME_LENGTH); //mxd
this.displaytext = text;
if(General.Settings.ShowTextureSizes)
this.displaytext = text + "\n" + icon.ScaledWidth + " x " + icon.ScaledHeight;
else
this.displaytext = text;
this.icon = icon;
this.Tag = tag;
this.showfullname = showfullname; //mxd
UpdateName(); //mxd
}
#endregion
@ -82,10 +79,7 @@ namespace CodeImp.DoomBuilder.Controls
// This checks if a redraw is needed
public bool CheckRedrawNeeded()
{
//mxd. Update texture size if needed
if(General.Settings.ShowTextureSizes && imageloaded != icon.IsPreviewLoaded)
displaytext = Text + "\n" + icon.ScaledWidth + " x " + icon.ScaledHeight;
UpdateName(); //mxd. Update texture size if needed
return (icon.IsPreviewLoaded != imageloaded);
}
@ -105,7 +99,7 @@ namespace CodeImp.DoomBuilder.Controls
g.PixelOffsetMode = PixelOffsetMode.None;
// Determine coordinates
SizeF textsize = g.MeasureString(displaytext, this.ListView.Font, bounds.Width * 2);
SizeF textsize = g.MeasureString(Text, this.ListView.Font, bounds.Width * 2);
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);
@ -130,7 +124,22 @@ namespace CodeImp.DoomBuilder.Controls
// Draw!
g.FillRectangle(backcolor, bounds);
icon.DrawPreview(g, imagerect.Location);
g.DrawString(displaytext, this.ListView.Font, forecolor, textpos, format);
g.DrawString(Text, this.ListView.Font, forecolor, textpos, format);
//mxd. Draw size label?
if (ImageBrowserControl.ShowTextureSizes && !string.IsNullOrEmpty(imagesize))
{
// Setup
Font sizefont = new Font(this.ListView.Font.FontFamily, this.ListView.Font.SizeInPoints - 1);
textsize = g.MeasureString(imagesize, sizefont, bounds.Width * 2);
textpos = new PointF(bounds.Left + textsize.Width / 2, bounds.Top + 1);
imagerect = new Rectangle(bounds.Left + 1, bounds.Top + 1, (int)textsize.Width, (int)textsize.Height);
SolidBrush labelbg = new SolidBrush(Color.FromArgb(196, base.ListView.BackColor));
// Draw
g.FillRectangle(labelbg, imagerect);
g.DrawString(imagesize, sizefont, new SolidBrush(base.ListView.ForeColor), textpos, format);
}
}
// This brightens or darkens a color
@ -153,6 +162,14 @@ namespace CodeImp.DoomBuilder.Controls
if(v < 0f) return 0f; else if(v > 1f) return 1f; else return v;
}
//mxd
private void UpdateName()
{
Text = (showfullname ? icon.DisplayName : icon.ShortName);
if(General.Settings.ShowTextureSizes && icon.IsPreviewLoaded)
imagesize = icon.ScaledWidth + "x" + icon.ScaledHeight;
}
// Comparer
public int CompareTo(ImageBrowserItem other)
{

View file

@ -32,10 +32,11 @@ namespace CodeImp.DoomBuilder.Controls
this.components = new System.ComponentModel.Container();
this.preview = new System.Windows.Forms.Panel();
this.labelSize = new System.Windows.Forms.Label();
this.imagebox = new CodeImp.DoomBuilder.Controls.ConfigurablePictureBox();
this.timer = new System.Windows.Forms.Timer(this.components);
this.tooltip = new System.Windows.Forms.ToolTip(this.components);
this.togglefullname = new System.Windows.Forms.Button();
this.name = new CodeImp.DoomBuilder.Controls.AutoSelectTextbox();
this.imagebox = new CodeImp.DoomBuilder.Controls.ConfigurablePictureBox();
this.preview.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.imagebox)).BeginInit();
this.SuspendLayout();
@ -45,6 +46,7 @@ namespace CodeImp.DoomBuilder.Controls
this.preview.BackColor = System.Drawing.SystemColors.AppWorkspace;
this.preview.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom;
this.preview.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.preview.Controls.Add(this.togglefullname);
this.preview.Controls.Add(this.labelSize);
this.preview.Controls.Add(this.imagebox);
this.preview.Location = new System.Drawing.Point(0, 0);
@ -66,6 +68,33 @@ namespace CodeImp.DoomBuilder.Controls
this.labelSize.Text = "128x128";
this.labelSize.Visible = false;
//
// timer
//
this.timer.Tick += new System.EventHandler(this.timer_Tick);
//
// togglefullname
//
this.togglefullname.BackColor = System.Drawing.Color.Transparent;
this.togglefullname.Image = global::CodeImp.DoomBuilder.Properties.Resources.Collapse;
this.togglefullname.Location = new System.Drawing.Point(43, 35);
this.togglefullname.Name = "togglefullname";
this.togglefullname.Size = new System.Drawing.Size(20, 20);
this.togglefullname.TabIndex = 3;
this.togglefullname.UseVisualStyleBackColor = false;
this.togglefullname.Visible = false;
this.togglefullname.Click += new System.EventHandler(this.togglefullname_Click);
//
// name
//
this.name.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest;
this.name.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.CustomSource;
this.name.Location = new System.Drawing.Point(0, 64);
this.name.MaxLength = 8;
this.name.Name = "name";
this.name.Size = new System.Drawing.Size(68, 20);
this.name.TabIndex = 2;
this.name.TextChanged += new System.EventHandler(this.name_TextChanged);
//
// imagebox
//
this.imagebox.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom;
@ -86,21 +115,6 @@ namespace CodeImp.DoomBuilder.Controls
this.imagebox.MouseDown += new System.Windows.Forms.MouseEventHandler(this.preview_MouseDown);
this.imagebox.MouseEnter += new System.EventHandler(this.preview_MouseEnter);
//
// timer
//
this.timer.Tick += new System.EventHandler(this.timer_Tick);
//
// name
//
this.name.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest;
this.name.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.CustomSource;
this.name.Location = new System.Drawing.Point(0, 64);
this.name.MaxLength = 8;
this.name.Name = "name";
this.name.Size = new System.Drawing.Size(68, 20);
this.name.TabIndex = 2;
this.name.TextChanged += new System.EventHandler(this.name_TextChanged);
//
// ImageSelectorControl
//
this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
@ -128,6 +142,7 @@ namespace CodeImp.DoomBuilder.Controls
protected System.Windows.Forms.Timer timer;
private System.Windows.Forms.ToolTip tooltip;
private ConfigurablePictureBox imagebox;
private System.Windows.Forms.Button togglefullname;
}
}

View file

@ -20,6 +20,7 @@ using System;
using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms;
using CodeImp.DoomBuilder.Data;
using SlimDX;
#endregion
@ -37,6 +38,7 @@ namespace CodeImp.DoomBuilder.Controls
private Bitmap bmp;
private MouseButtons button;
private ImageData image; //mxd
private string previousImageName; //mxd
protected bool multipletextures; //mxd
protected bool usepreviews = true; //mxd
@ -83,6 +85,8 @@ namespace CodeImp.DoomBuilder.Controls
preview.Height = this.ClientSize.Height - name.Height - 4;
name.Width = this.ClientSize.Width;
name.Top = this.ClientSize.Height - name.Height;
togglefullname.Left = preview.Right - togglefullname.Width - 1; //mxd
togglefullname.Top = preview.Bottom - togglefullname.Height - 1; //mxd
}
// Layout change
@ -148,6 +152,16 @@ namespace CodeImp.DoomBuilder.Controls
{
labelSize.Visible = !(!General.Settings.ShowTextureSizes || !this.Enabled || string.IsNullOrEmpty(labelSize.Text));
}
//mxd
private void togglefullname_Click(object sender, EventArgs e)
{
// Toggle between short and full name
name.Text = (name.Text == image.ShortName ? image.Name : image.ShortName);
// Update icon and tooltip
UpdateToggleImageNameButton(image);
}
#endregion
@ -200,6 +214,31 @@ namespace CodeImp.DoomBuilder.Controls
// This must show the image browser and return the selected texture name
protected abstract string BrowseImage(string imagename);
protected void UpdateToggleImageNameButton(ImageData image)
{
this.image = image;
// Update visibility
if(!General.Map.Config.UseLongTextureNames || image == null || !image.HasLongName)
{
togglefullname.Visible = false;
return;
}
// Update icon and tooltip
togglefullname.Visible = true;
if (image.ShortName == name.Text)
{
togglefullname.Image = Properties.Resources.Expand;
tooltip.SetToolTip(togglefullname, "Switch to full name");
}
else
{
togglefullname.Image = Properties.Resources.Collapse;
tooltip.SetToolTip(togglefullname, "Switch to short name");
}
}
// This determines the result value
public string GetResult(string original)
{

File diff suppressed because it is too large Load diff

View file

@ -18,7 +18,9 @@
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Windows.Forms;
using CodeImp.DoomBuilder.GZBuilder.Tools;
using CodeImp.DoomBuilder.Map;
using CodeImp.DoomBuilder.Config;
using CodeImp.DoomBuilder.Types;
@ -31,11 +33,9 @@ namespace CodeImp.DoomBuilder.Controls
{
internal partial class LinedefInfoPanel : UserControl
{
private int hexenformatwidth;
private int doomformatwidth;
private List<UniversalFieldInfo> fieldInfos;
private int[] labelPositionsY = new[] { 39, 58, 77 }; //mxd
private const int defaultPanelWidth = 270; //mxd
private readonly int hexenformatwidth;
private readonly int doomformatwidth;
private readonly int[] labelPositionsY = new[] { 39, 58, 77 }; //mxd
// Constructor
public LinedefInfoPanel()
@ -46,17 +46,21 @@ namespace CodeImp.DoomBuilder.Controls
// Hide stuff when in Doom format
hexenformatwidth = infopanel.Width;
doomformatwidth = infopanel.Width - 190;
//mxd
labelTextureFrontTop.BackColor = Color.FromArgb(128, labelTextureFrontTop.BackColor);
labelTextureFrontMid.BackColor = Color.FromArgb(128, labelTextureFrontMid.BackColor);
labelTextureFrontBottom.BackColor = Color.FromArgb(128, labelTextureFrontBottom.BackColor);
labelTextureBackTop.BackColor = Color.FromArgb(128, labelTextureBackTop.BackColor);
labelTextureBackMid.BackColor = Color.FromArgb(128, labelTextureBackMid.BackColor);
labelTextureBackBottom.BackColor = Color.FromArgb(128, labelTextureBackBottom.BackColor);
}
// This shows the info
public void ShowInfo(Linedef l)
{
bool upperunpegged, lowerunpegged;
string peggedness;
//mxd
if (General.Map.UDMF && fieldInfos == null)
fieldInfos = General.Map.Config.SidedefFields;
// Show/hide stuff depending on format
if(!General.Map.FormatInterface.HasActionArgs)
@ -108,6 +112,8 @@ namespace CodeImp.DoomBuilder.Controls
activation.Top = labelPositionsY[0];
activationlabel.Top = labelPositionsY[0];
activation.Enabled = (l.Activate != 0); //mxd
activationlabel.Enabled = (l.Activate != 0); //mxd
unpegged.Top = labelPositionsY[0];
peglabel.Top = labelPositionsY[0];
@ -130,6 +136,8 @@ namespace CodeImp.DoomBuilder.Controls
//set tag
tag.Text = l.Tag + (General.Map.Options.TagLabels.ContainsKey(l.Tag) ? " (" + General.Map.Options.TagLabels[l.Tag] + ")" : string.Empty);
tag.Enabled = (l.Tag != 0);
taglabel.Enabled = (l.Tag != 0);
length.Top = labelPositionsY[0];
lengthlabel.Top = labelPositionsY[0];
@ -151,8 +159,8 @@ namespace CodeImp.DoomBuilder.Controls
LinedefActionInfo act = General.Map.Config.GetLinedefActionInfo(l.Action);
// Determine peggedness
upperunpegged = l.IsFlagSet(General.Map.Config.UpperUnpeggedFlag);
lowerunpegged = l.IsFlagSet(General.Map.Config.LowerUnpeggedFlag);
bool upperunpegged = l.IsFlagSet(General.Map.Config.UpperUnpeggedFlag);
bool lowerunpegged = l.IsFlagSet(General.Map.Config.LowerUnpeggedFlag);
if(upperunpegged && lowerunpegged)
peggedness = "Upper & Lower";
else if(upperunpegged)
@ -168,6 +176,8 @@ namespace CodeImp.DoomBuilder.Controls
length.Text = l.Length.ToString("0.##");
angle.Text = l.AngleDeg + "\u00B0";
unpegged.Text = peggedness;
action.Enabled = (act.Index != 0);
actionlabel.Enabled = (act.Index != 0);
//mxd
bool hasArg0Str = General.Map.UDMF && Array.IndexOf(GZGeneral.ACS_SPECIALS, l.Action) != -1 && l.Fields.ContainsKey("arg0str");
@ -193,65 +203,61 @@ namespace CodeImp.DoomBuilder.Controls
if (hasArg0Str)
arg1.Text = '"' + l.Fields["arg0str"].Value.ToString() + '"';
else
setArgumentText(act.Args[0], arg1, l.Args[0]);
setArgumentText(act.Args[1], arg2, l.Args[1]);
setArgumentText(act.Args[2], arg3, l.Args[2]);
setArgumentText(act.Args[3], arg4, l.Args[3]);
setArgumentText(act.Args[4], arg5, l.Args[4]);
SetArgumentText(act.Args[0], arg1, l.Args[0]);
SetArgumentText(act.Args[1], arg2, l.Args[1]);
SetArgumentText(act.Args[2], arg3, l.Args[2]);
SetArgumentText(act.Args[3], arg4, l.Args[3]);
SetArgumentText(act.Args[4], arg5, l.Args[4]);
// Front side available?
if(l.Front != null)
{
int addedWidth = 0; //mxd
//mxd. Extended info shown?
bool hasTopFields = false;
bool hasMiddleFields = false;
bool hasBottomFields = false;
// Show sidedef info
frontpanel.Visible = true; //mxd
frontpanel.Text = " Front Sidedef " + l.Front.Index;
frontsector.Text = " Sector " + l.Front.Sector.Index;
frontsector.Visible = true;
//mxd
if(General.Map.UDMF)
{
//light
frontoffsetlabel.Text = "Front light:";
setUDMFLight(l.Front, frontoffsetlabel, frontoffset);
SetUDMFLight(l.Front, frontoffsetlabel, frontoffset);
//global offset
frontpanel.Text += ". Offset: " + l.Front.OffsetX + ", " + l.Front.OffsetY;
bool hasTopFields = false;
bool hasMiddleFields = false;
bool hasBottomFields = false;
//global offset, sector index
frontpanel.Text += ". Offset " + l.Front.OffsetX + ", " + l.Front.OffsetY + ". Sector " + l.Front.Sector.Index + " ";
//sidedef top
if(checkPairedUDMFFields(l.Front.Fields, "offsetx_top", "offsety_top", frontTopUDMFOffsetLabel, frontTopUDMFOffset))
hasTopFields = true;
if (checkPairedUDMFFields(l.Front.Fields, "scalex_top", "scaley_top", frontTopUDMFScaleLabel, frontTopUDMFScale))
hasTopFields = true;
hasTopFields = SetPairedUDMFFieldsLabel(l.Front.Fields, "offsetx_top", "offsety_top", 0.0f, frontTopUDMFOffsetLabel, frontTopUDMFOffset);
hasTopFields |= SetPairedUDMFFieldsLabel(l.Front.Fields, "scalex_top", "scaley_top", 1.0f, frontTopUDMFScaleLabel, frontTopUDMFScale);
//sidedef middle
if (checkPairedUDMFFields(l.Front.Fields, "offsetx_mid", "offsety_mid", frontMidUDMFOffsetLabel, frontMidUDMFOffset))
hasMiddleFields = true;
if (checkPairedUDMFFields(l.Front.Fields, "scalex_mid", "scaley_mid", frontMidUDMFScaleLabel, frontMidUDMFScale))
hasMiddleFields = true;
hasMiddleFields = SetPairedUDMFFieldsLabel(l.Front.Fields, "offsetx_mid", "offsety_mid", 0.0f, frontMidUDMFOffsetLabel, frontMidUDMFOffset);
hasMiddleFields |= SetPairedUDMFFieldsLabel(l.Front.Fields, "scalex_mid", "scaley_mid", 1.0f, frontMidUDMFScaleLabel, frontMidUDMFScale);
//sidedef bottom
if (checkPairedUDMFFields(l.Front.Fields, "offsetx_bottom", "offsety_bottom", frontBottomUDMFOffsetLabel, frontBottomUDMFOffset))
hasBottomFields = true;
if (checkPairedUDMFFields(l.Front.Fields, "scalex_bottom", "scaley_bottom", frontBottomUDMFScaleLabel, frontBottomUDMFScale))
hasBottomFields = true;
hasBottomFields = SetPairedUDMFFieldsLabel(l.Front.Fields, "offsetx_bottom", "offsety_bottom", 0.0f, frontBottomUDMFOffsetLabel, frontBottomUDMFOffset);
hasBottomFields |= SetPairedUDMFFieldsLabel(l.Front.Fields, "scalex_bottom", "scaley_bottom", 1.0f, frontBottomUDMFScaleLabel, frontBottomUDMFScale);
//visibility
panelUDMFFrontTop.Visible = hasTopFields;
panelUDMFFrontMid.Visible = hasMiddleFields;
panelUDMFFrontBottom.Visible = hasBottomFields;
frontTopUDMFOffset.Visible = hasTopFields;
frontTopUDMFOffsetLabel.Visible = hasTopFields;
frontTopUDMFScale.Visible = hasTopFields;
frontTopUDMFScaleLabel.Visible = hasTopFields;
//size
if(hasTopFields) addedWidth = 64;
if(hasMiddleFields) addedWidth += 64;
if(hasBottomFields) addedWidth += 64;
frontMidUDMFOffset.Visible = hasMiddleFields;
frontMidUDMFOffsetLabel.Visible = hasMiddleFields;
frontMidUDMFScale.Visible = hasMiddleFields;
frontMidUDMFScaleLabel.Visible = hasMiddleFields;
frontBottomUDMFOffset.Visible = hasBottomFields;
frontBottomUDMFOffsetLabel.Visible = hasBottomFields;
frontBottomUDMFScale.Visible = hasBottomFields;
frontBottomUDMFScaleLabel.Visible = hasBottomFields;
}
else
{
@ -260,22 +266,26 @@ namespace CodeImp.DoomBuilder.Controls
frontoffsetlabel.Enabled = true;
frontoffset.Enabled = true;
panelUDMFFrontTop.Visible = false;
panelUDMFFrontMid.Visible = false;
panelUDMFFrontBottom.Visible = false;
//mxd. Sector index
frontpanel.Text += ". Sector " + l.Front.Sector.Index + " ";
}
//mxd. Set texture names, update panel sizes
UpdateTexturePanel(panelFrontTop, l.Front.HighTexture, fronthighname, labelTextureFrontTop,
Math.Max(frontTopUDMFOffset.Right, frontTopUDMFScale.Right) + 4, fronthightex,
frontTopUDMFOffsetLabel.Left, hasTopFields, l.Front.HighRequired());
UpdateTexturePanel(panelFrontMid, l.Front.MiddleTexture, frontmidname, labelTextureFrontMid,
Math.Max(frontMidUDMFOffset.Right, frontMidUDMFScale.Right) + 4, frontmidtex,
frontMidUDMFOffsetLabel.Left, hasMiddleFields, l.Front.MiddleRequired());
UpdateTexturePanel(panelFrontLow, l.Front.LowTexture, frontlowname, labelTextureFrontBottom,
Math.Max(frontBottomUDMFOffset.Right, frontBottomUDMFScale.Right) + 4, frontlowtex,
frontBottomUDMFOffsetLabel.Left, hasBottomFields, l.Front.LowRequired());
//mxd. Resize panel
frontpanel.Width = defaultPanelWidth + addedWidth + 12;
flowLayoutPanelFront.Width = defaultPanelWidth + addedWidth;
// Show textures
DisplaySidedefTexture(fronthightex, fronthighname, labelTextureFrontTop, l.Front.HighTexture, l.Front.HighRequired());
DisplaySidedefTexture(frontmidtex, frontmidname, labelTextureFrontMid, l.Front.MiddleTexture, l.Front.MiddleRequired());
DisplaySidedefTexture(frontlowtex, frontlowname, labelTextureFrontBottom, l.Front.LowTexture, l.Front.LowRequired());
//mxd. Position label
frontsector.Left = frontpanel.Width - frontsector.Width - 12;
flowLayoutPanelFront.Width = panelFrontLow.Right;
frontpanel.Width = flowLayoutPanelFront.Width + flowLayoutPanelFront.Left * 2 - 4;
}
else
{
@ -304,76 +314,80 @@ namespace CodeImp.DoomBuilder.Controls
// Back size available?
if(l.Back != null)
{
int addedWidth = 0; //mxd
//mxd. Extended info shown?
bool hasTopFields = false;
bool hasMiddleFields = false;
bool hasBottomFields = false;
// Show sidedef info
backpanel.Visible = true; //mxd
backpanel.Text = " Back Sidedef " + l.Back.Index;
backsector.Text = " Sector " + l.Back.Sector.Index;
backsector.Visible = true;
//mxd
if(General.Map.UDMF) {
if(General.Map.UDMF)
{
//light
backoffsetlabel.Text = "Back light:";
setUDMFLight(l.Back, backoffsetlabel, backoffset);
SetUDMFLight(l.Back, backoffsetlabel, backoffset);
//global offset
backpanel.Text += ". Offset: " + l.Back.OffsetX + ", " + l.Back.OffsetY;
bool hasTopFields = false;
bool hasMiddleFields = false;
bool hasBottomFields = false;
//global offset, sector index
backpanel.Text += ". Offset " + l.Back.OffsetX + ", " + l.Back.OffsetY + ". Sector " + l.Back.Sector.Index + " ";
//sidedef top
if (checkPairedUDMFFields(l.Back.Fields, "offsetx_top", "offsety_top", backTopUDMFOffsetLabel, backTopUDMFOffset))
hasTopFields = true;
if (checkPairedUDMFFields(l.Back.Fields, "scalex_top", "scaley_top", backTopUDMFScaleLabel, backTopUDMFScale))
hasTopFields = true;
hasTopFields = SetPairedUDMFFieldsLabel(l.Back.Fields, "offsetx_top", "offsety_top", 0f, backTopUDMFOffsetLabel, backTopUDMFOffset);
hasTopFields |= SetPairedUDMFFieldsLabel(l.Back.Fields, "scalex_top", "scaley_top", 1.0f, backTopUDMFScaleLabel, backTopUDMFScale);
//sidedef middle
if (checkPairedUDMFFields(l.Back.Fields, "offsetx_mid", "offsety_mid", backMidUDMFOffsetLabel, backMidUDMFOffset))
hasMiddleFields = true;
if (checkPairedUDMFFields(l.Back.Fields, "scalex_mid", "scaley_mid", backMidUDMFScaleLabel, backMidUDMFScale))
hasMiddleFields = true;
hasMiddleFields = SetPairedUDMFFieldsLabel(l.Back.Fields, "offsetx_mid", "offsety_mid", 0f, backMidUDMFOffsetLabel, backMidUDMFOffset);
hasMiddleFields |= SetPairedUDMFFieldsLabel(l.Back.Fields, "scalex_mid", "scaley_mid", 1.0f, backMidUDMFScaleLabel, backMidUDMFScale);
//sidedef bottom
if (checkPairedUDMFFields(l.Back.Fields, "offsetx_bottom", "offsety_bottom", backBottomUDMFOffsetLabel, backBottomUDMFOffset))
hasBottomFields = true;
if (checkPairedUDMFFields(l.Back.Fields, "scalex_bottom", "scaley_bottom", backBottomUDMFScaleLabel, backBottomUDMFScale))
hasBottomFields = true;
hasBottomFields = SetPairedUDMFFieldsLabel(l.Back.Fields, "offsetx_bottom", "offsety_bottom", 0f, backBottomUDMFOffsetLabel, backBottomUDMFOffset);
hasBottomFields |= SetPairedUDMFFieldsLabel(l.Back.Fields, "scalex_bottom", "scaley_bottom", 1.0f, backBottomUDMFScaleLabel, backBottomUDMFScale);
//visibility
panelUDMFBackTop.Visible = hasTopFields;
panelUDMFBackMid.Visible = hasMiddleFields;
panelUDMFBackBottom.Visible = hasBottomFields;
backTopUDMFOffset.Visible = hasTopFields;
backTopUDMFOffsetLabel.Visible = hasTopFields;
backTopUDMFScale.Visible = hasTopFields;
backTopUDMFScaleLabel.Visible = hasTopFields;
//size
if(hasTopFields) addedWidth = 64;
if(hasMiddleFields) addedWidth += 64;
if(hasBottomFields) addedWidth += 64;
} else {
backMidUDMFOffset.Visible = hasMiddleFields;
backMidUDMFOffsetLabel.Visible = hasMiddleFields;
backMidUDMFScale.Visible = hasMiddleFields;
backMidUDMFScaleLabel.Visible = hasMiddleFields;
backBottomUDMFOffset.Visible = hasBottomFields;
backBottomUDMFOffsetLabel.Visible = hasBottomFields;
backBottomUDMFScale.Visible = hasBottomFields;
backBottomUDMFScaleLabel.Visible = hasBottomFields;
}
else
{
backoffsetlabel.Text = "Back offset:";
backoffset.Text = l.Back.OffsetX + ", " + l.Back.OffsetY;
backoffsetlabel.Enabled = true;
backoffset.Enabled = true;
panelUDMFBackTop.Visible = false;
panelUDMFBackMid.Visible = false;
panelUDMFBackBottom.Visible = false;
// Sector index
backpanel.Text += ". Sector " + l.Back.Sector.Index + " ";
}
//mxd. Set texture names, update panel sizes
UpdateTexturePanel(panelBackTop, l.Back.HighTexture, backhighname, labelTextureBackTop,
Math.Max(backTopUDMFOffset.Right, backTopUDMFScale.Right) + 4, backhightex,
backTopUDMFOffsetLabel.Left, hasTopFields, l.Back.HighRequired());
UpdateTexturePanel(panelBackMid, l.Back.MiddleTexture, backmidname, labelTextureBackMid,
Math.Max(backMidUDMFOffset.Right, backMidUDMFScale.Right) + 4, backmidtex,
backMidUDMFOffsetLabel.Left, hasMiddleFields, l.Back.MiddleRequired());
UpdateTexturePanel(panelBackLow, l.Back.LowTexture, backlowname, labelTextureBackBottom,
Math.Max(backBottomUDMFOffset.Right, backBottomUDMFScale.Right) + 4, backlowtex,
backBottomUDMFOffsetLabel.Left, hasBottomFields, l.Back.LowRequired());
//mxd. Resize panel
backpanel.Width = defaultPanelWidth + addedWidth + 12;
flowLayoutPanelBack.Width = defaultPanelWidth + addedWidth;
// Show textures
DisplaySidedefTexture(backhightex, backhighname, labelTextureBackTop, l.Back.HighTexture, l.Back.HighRequired());
DisplaySidedefTexture(backmidtex, backmidname, labelTextureBackMid, l.Back.MiddleTexture, l.Back.MiddleRequired());
DisplaySidedefTexture(backlowtex, backlowname, labelTextureBackBottom, l.Back.LowTexture, l.Back.LowRequired());
//mxd. Position label
backsector.Left = backpanel.Width - backsector.Width - 12;
flowLayoutPanelBack.Width = panelBackLow.Right;
backpanel.Width = flowLayoutPanelBack.Width + flowLayoutPanelBack.Left * 2 - 4;
}
else
{
@ -437,35 +451,54 @@ namespace CodeImp.DoomBuilder.Controls
this.Update();
}
//mxd
private bool checkPairedUDMFFields(UniFields fields, string paramX, string paramY, Label label, Label value)
private static void UpdateTexturePanel(Panel panel, string texturename, Label texturenamelabel, Label sizelabel, int maxlabelright, Panel image, int sizeref, bool extendedinfoshown, bool required)
{
float dx = getDefaultUDMFValue(paramX);
float dy = getDefaultUDMFValue(paramY);
float x = dx;
float y = dy;
// Set texture name
texturenamelabel.Text = texturename;
if(fields.ContainsKey(paramX))
x = (float)fields[paramX].Value;
if(fields.ContainsKey(paramY))
y = (float)fields[paramY].Value;
// And image
DisplayTextureImage(image, sizelabel, texturename, required);
//Reposition texture name label?
if(texturenamelabel.Width < image.Width + 2)
texturenamelabel.Location = new Point(image.Location.X + (image.Width - texturenamelabel.Width) / 2, texturenamelabel.Location.Y);
else
texturenamelabel.Location = new Point(image.Location.X, texturenamelabel.Location.Y);
if(x != dx || y != dy)
{
value.Text = String.Format("{0:0.##}", x) + ", " + String.Format("{0:0.##}", y);
value.Enabled = true;
label.Enabled = true;
return true;
}
value.Text = "--, --";
value.Enabled = false;
label.Enabled = false;
return false;
// Resize panel
if(!extendedinfoshown)
panel.Width = Math.Max(texturenamelabel.Right + image.Location.X + 1, sizeref);
else
panel.Width = Math.Max(texturenamelabel.Right, maxlabelright) + image.Location.X;
}
//mxd
private static void setUDMFLight(Sidedef sd, Label label, Label value)
private static bool SetPairedUDMFFieldsLabel(UniFields fields, string paramX, string paramY, float defaultvalue, Label namelabel, Label valuelabel)
{
float x = UDMFTools.GetFloat(fields, paramX, defaultvalue);
float y = UDMFTools.GetFloat(fields, paramY, defaultvalue);
if(fields.ContainsKey(paramX)) x = (float)fields[paramX].Value;
if(fields.ContainsKey(paramY)) y = (float)fields[paramY].Value;
if(x != defaultvalue || y != defaultvalue)
{
valuelabel.Text = String.Format("{0:0.##}", x) + ", " + String.Format("{0:0.##}", y);
valuelabel.Enabled = true;
namelabel.Enabled = true;
}
else
{
valuelabel.Text = "--, --";
valuelabel.Enabled = false;
namelabel.Enabled = false;
}
return valuelabel.Enabled;
}
//mxd
private static void SetUDMFLight(Sidedef sd, Label label, Label value)
{
if(sd.Fields.ContainsKey("light"))
{
@ -488,15 +521,7 @@ namespace CodeImp.DoomBuilder.Controls
}
//mxd
private float getDefaultUDMFValue(string valueName)
{
foreach (UniversalFieldInfo fi in fieldInfos)
if (fi.Name == valueName) return (float)fi.Default;
return 0;
}
//mxd
private static void setArgumentText(ArgumentInfo info, Label label, int value)
private static void SetArgumentText(ArgumentInfo info, Label label, int value)
{
TypeHandler th = General.Types.GetArgumentHandler(info);
th.SetValue(value);
@ -527,7 +552,7 @@ namespace CodeImp.DoomBuilder.Controls
}
// This shows a sidedef texture in a panel
private static void DisplaySidedefTexture(Panel panel, Label namelabel, Label sizelabel, string name, bool required)
private static void DisplayTextureImage(Panel panel, Label sizelabel, string name, bool required)
{
// Check if name is a "none" texture
if((name.Length < 1) || (name == "-"))
@ -539,16 +564,12 @@ namespace CodeImp.DoomBuilder.Controls
General.DisplayZoomedImage(panel, Properties.Resources.MissingTexture);
else
panel.BackgroundImage = null;
// Set texture name
namelabel.Text = "-";
}
else
{
//mxd
ImageData texture = General.Map.Data.GetTextureImage(name);
bool unknowntexture = texture is UnknownImage;
if(General.Settings.ShowTextureSizes && texture.ImageState == ImageLoadState.Ready && !unknowntexture)
if(General.Settings.ShowTextureSizes && texture.ImageState == ImageLoadState.Ready && !(texture is UnknownImage))
{
sizelabel.Visible = true;
sizelabel.Text = texture.ScaledWidth + "x" + texture.ScaledHeight;
@ -557,9 +578,6 @@ namespace CodeImp.DoomBuilder.Controls
{
sizelabel.Visible = false;
}
// Set texture name
namelabel.Text = (unknowntexture ? name : texture.DisplayName);
// Set the image
General.DisplayZoomedImage(panel, texture.GetPreview());

View file

@ -117,8 +117,47 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="actionlabel.GenerateMember" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
<metadata name="unpegged.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="peglabel.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="arg5.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="arglbl5.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="arglbl4.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="arg4.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="arglbl3.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="arglbl2.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="arg3.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="arglbl1.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="arg2.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="backoffset.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="arg1.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="frontoffset.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="unpegged.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
@ -162,10 +201,4 @@
<metadata name="frontoffset.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="frontsector.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="backsector.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
</root>

View file

@ -30,10 +30,10 @@ namespace CodeImp.DoomBuilder.Controls
{
System.Windows.Forms.Label label13;
System.Windows.Forms.Label label5;
System.Windows.Forms.Label label4;
System.Windows.Forms.Label label3;
System.Windows.Forms.Label label2;
System.Windows.Forms.Label label1;
this.labelTag = new System.Windows.Forms.Label();
this.labelEffect = new System.Windows.Forms.Label();
this.ceilingLightLabel = new System.Windows.Forms.Label();
this.ceilingScaleLabel = new System.Windows.Forms.Label();
this.ceilingAngleLabel = new System.Windows.Forms.Label();
@ -58,12 +58,10 @@ namespace CodeImp.DoomBuilder.Controls
this.ceilingAngle = new System.Windows.Forms.Label();
this.ceilingOffset = new System.Windows.Forms.Label();
this.ceilingpanel = new System.Windows.Forms.GroupBox();
this.ceilingInfo = new System.Windows.Forms.Panel();
this.ceilingname = new System.Windows.Forms.Label();
this.ceilingtex = new System.Windows.Forms.Panel();
this.labelCeilTextureSize = new System.Windows.Forms.Label();
this.floorpanel = new System.Windows.Forms.GroupBox();
this.floorInfo = new System.Windows.Forms.Panel();
this.floorLight = new System.Windows.Forms.Label();
this.floorScale = new System.Windows.Forms.Label();
this.floorOffset = new System.Windows.Forms.Label();
@ -76,16 +74,12 @@ namespace CodeImp.DoomBuilder.Controls
this.flags = new System.Windows.Forms.ListView();
label13 = new System.Windows.Forms.Label();
label5 = new System.Windows.Forms.Label();
label4 = new System.Windows.Forms.Label();
label3 = new System.Windows.Forms.Label();
label2 = new System.Windows.Forms.Label();
label1 = new System.Windows.Forms.Label();
this.sectorinfo.SuspendLayout();
this.ceilingpanel.SuspendLayout();
this.ceilingInfo.SuspendLayout();
this.ceilingtex.SuspendLayout();
this.floorpanel.SuspendLayout();
this.floorInfo.SuspendLayout();
this.floortex.SuspendLayout();
this.flowLayoutPanel1.SuspendLayout();
this.flagsPanel.SuspendLayout();
@ -109,15 +103,6 @@ namespace CodeImp.DoomBuilder.Controls
label5.Text = "Height:";
label5.TextAlign = System.Drawing.ContentAlignment.TopRight;
//
// label4
//
label4.Location = new System.Drawing.Point(8, 79);
label4.Name = "label4";
label4.Size = new System.Drawing.Size(44, 14);
label4.TabIndex = 4;
label4.Text = "Tag:";
label4.TextAlign = System.Drawing.ContentAlignment.TopRight;
//
// label3
//
label3.Location = new System.Drawing.Point(8, 49);
@ -136,18 +121,27 @@ namespace CodeImp.DoomBuilder.Controls
label2.Text = "Ceiling:";
label2.TextAlign = System.Drawing.ContentAlignment.TopRight;
//
// label1
// labelTag
//
label1.Location = new System.Drawing.Point(8, 19);
label1.Name = "label1";
label1.Size = new System.Drawing.Size(44, 14);
label1.TabIndex = 0;
label1.Text = "Effect:";
label1.TextAlign = System.Drawing.ContentAlignment.TopRight;
this.labelTag.Location = new System.Drawing.Point(8, 79);
this.labelTag.Name = "labelTag";
this.labelTag.Size = new System.Drawing.Size(44, 14);
this.labelTag.TabIndex = 4;
this.labelTag.Text = "Tag:";
this.labelTag.TextAlign = System.Drawing.ContentAlignment.TopRight;
//
// labelEffect
//
this.labelEffect.Location = new System.Drawing.Point(8, 19);
this.labelEffect.Name = "labelEffect";
this.labelEffect.Size = new System.Drawing.Size(44, 14);
this.labelEffect.TabIndex = 0;
this.labelEffect.Text = "Effect:";
this.labelEffect.TextAlign = System.Drawing.ContentAlignment.TopRight;
//
// ceilingLightLabel
//
this.ceilingLightLabel.Location = new System.Drawing.Point(3, 61);
this.ceilingLightLabel.Location = new System.Drawing.Point(77, 63);
this.ceilingLightLabel.Name = "ceilingLightLabel";
this.ceilingLightLabel.Size = new System.Drawing.Size(45, 14);
this.ceilingLightLabel.TabIndex = 27;
@ -156,7 +150,7 @@ namespace CodeImp.DoomBuilder.Controls
//
// ceilingScaleLabel
//
this.ceilingScaleLabel.Location = new System.Drawing.Point(3, 43);
this.ceilingScaleLabel.Location = new System.Drawing.Point(77, 47);
this.ceilingScaleLabel.Name = "ceilingScaleLabel";
this.ceilingScaleLabel.Size = new System.Drawing.Size(45, 14);
this.ceilingScaleLabel.TabIndex = 26;
@ -165,7 +159,7 @@ namespace CodeImp.DoomBuilder.Controls
//
// ceilingAngleLabel
//
this.ceilingAngleLabel.Location = new System.Drawing.Point(3, 25);
this.ceilingAngleLabel.Location = new System.Drawing.Point(77, 31);
this.ceilingAngleLabel.Name = "ceilingAngleLabel";
this.ceilingAngleLabel.Size = new System.Drawing.Size(45, 14);
this.ceilingAngleLabel.TabIndex = 24;
@ -174,7 +168,7 @@ namespace CodeImp.DoomBuilder.Controls
//
// ceilingOffsetLabel
//
this.ceilingOffsetLabel.Location = new System.Drawing.Point(3, 7);
this.ceilingOffsetLabel.Location = new System.Drawing.Point(77, 15);
this.ceilingOffsetLabel.Name = "ceilingOffsetLabel";
this.ceilingOffsetLabel.Size = new System.Drawing.Size(45, 14);
this.ceilingOffsetLabel.TabIndex = 22;
@ -183,7 +177,7 @@ namespace CodeImp.DoomBuilder.Controls
//
// floorOffsetLabel
//
this.floorOffsetLabel.Location = new System.Drawing.Point(3, 7);
this.floorOffsetLabel.Location = new System.Drawing.Point(77, 15);
this.floorOffsetLabel.Name = "floorOffsetLabel";
this.floorOffsetLabel.Size = new System.Drawing.Size(45, 14);
this.floorOffsetLabel.TabIndex = 22;
@ -192,7 +186,7 @@ namespace CodeImp.DoomBuilder.Controls
//
// floorLightLabel
//
this.floorLightLabel.Location = new System.Drawing.Point(3, 61);
this.floorLightLabel.Location = new System.Drawing.Point(77, 63);
this.floorLightLabel.Name = "floorLightLabel";
this.floorLightLabel.Size = new System.Drawing.Size(45, 14);
this.floorLightLabel.TabIndex = 27;
@ -201,7 +195,7 @@ namespace CodeImp.DoomBuilder.Controls
//
// floorAngleLabel
//
this.floorAngleLabel.Location = new System.Drawing.Point(3, 25);
this.floorAngleLabel.Location = new System.Drawing.Point(77, 31);
this.floorAngleLabel.Name = "floorAngleLabel";
this.floorAngleLabel.Size = new System.Drawing.Size(45, 14);
this.floorAngleLabel.TabIndex = 24;
@ -210,7 +204,7 @@ namespace CodeImp.DoomBuilder.Controls
//
// floorScaleLabel
//
this.floorScaleLabel.Location = new System.Drawing.Point(3, 43);
this.floorScaleLabel.Location = new System.Drawing.Point(77, 47);
this.floorScaleLabel.Name = "floorScaleLabel";
this.floorScaleLabel.Size = new System.Drawing.Size(45, 14);
this.floorScaleLabel.TabIndex = 26;
@ -230,11 +224,11 @@ namespace CodeImp.DoomBuilder.Controls
this.sectorinfo.Controls.Add(this.tag);
this.sectorinfo.Controls.Add(this.floor);
this.sectorinfo.Controls.Add(this.ceiling);
this.sectorinfo.Controls.Add(label4);
this.sectorinfo.Controls.Add(this.labelTag);
this.sectorinfo.Controls.Add(label3);
this.sectorinfo.Controls.Add(label2);
this.sectorinfo.Controls.Add(this.effect);
this.sectorinfo.Controls.Add(label1);
this.sectorinfo.Controls.Add(this.labelEffect);
this.sectorinfo.Location = new System.Drawing.Point(0, 0);
this.sectorinfo.Margin = new System.Windows.Forms.Padding(0, 0, 3, 0);
this.sectorinfo.Name = "sectorinfo";
@ -328,39 +322,50 @@ namespace CodeImp.DoomBuilder.Controls
//
// ceilingLight
//
this.ceilingLight.Location = new System.Drawing.Point(54, 61);
this.ceilingLight.AutoSize = true;
this.ceilingLight.Location = new System.Drawing.Point(124, 63);
this.ceilingLight.Name = "ceilingLight";
this.ceilingLight.Size = new System.Drawing.Size(60, 14);
this.ceilingLight.Size = new System.Drawing.Size(15, 14);
this.ceilingLight.TabIndex = 29;
this.ceilingLight.Text = "255 (abs.)";
this.ceilingLight.Text = "--";
//
// ceilingScale
//
this.ceilingScale.Location = new System.Drawing.Point(54, 43);
this.ceilingScale.AutoSize = true;
this.ceilingScale.Location = new System.Drawing.Point(124, 47);
this.ceilingScale.Name = "ceilingScale";
this.ceilingScale.Size = new System.Drawing.Size(60, 14);
this.ceilingScale.Size = new System.Drawing.Size(29, 14);
this.ceilingScale.TabIndex = 28;
this.ceilingScale.Text = "-1.0, -1.0";
this.ceilingScale.Text = "--, --";
//
// ceilingAngle
//
this.ceilingAngle.Location = new System.Drawing.Point(54, 25);
this.ceilingAngle.AutoSize = true;
this.ceilingAngle.Location = new System.Drawing.Point(124, 31);
this.ceilingAngle.Name = "ceilingAngle";
this.ceilingAngle.Size = new System.Drawing.Size(60, 14);
this.ceilingAngle.Size = new System.Drawing.Size(15, 14);
this.ceilingAngle.TabIndex = 25;
this.ceilingAngle.Text = "45";
this.ceilingAngle.Text = "--";
//
// ceilingOffset
//
this.ceilingOffset.Location = new System.Drawing.Point(54, 7);
this.ceilingOffset.AutoSize = true;
this.ceilingOffset.Location = new System.Drawing.Point(124, 15);
this.ceilingOffset.Name = "ceilingOffset";
this.ceilingOffset.Size = new System.Drawing.Size(60, 14);
this.ceilingOffset.Size = new System.Drawing.Size(29, 14);
this.ceilingOffset.TabIndex = 23;
this.ceilingOffset.Text = "-100, -100";
this.ceilingOffset.Text = "--, --";
//
// ceilingpanel
//
this.ceilingpanel.Controls.Add(this.ceilingInfo);
this.ceilingpanel.Controls.Add(this.ceilingOffsetLabel);
this.ceilingpanel.Controls.Add(this.ceilingOffset);
this.ceilingpanel.Controls.Add(this.ceilingLight);
this.ceilingpanel.Controls.Add(this.ceilingAngleLabel);
this.ceilingpanel.Controls.Add(this.ceilingAngle);
this.ceilingpanel.Controls.Add(this.ceilingScaleLabel);
this.ceilingpanel.Controls.Add(this.ceilingScale);
this.ceilingpanel.Controls.Add(this.ceilingLightLabel);
this.ceilingpanel.Controls.Add(this.ceilingname);
this.ceilingpanel.Controls.Add(this.ceilingtex);
this.ceilingpanel.Location = new System.Drawing.Point(506, 0);
@ -371,29 +376,14 @@ namespace CodeImp.DoomBuilder.Controls
this.ceilingpanel.TabStop = false;
this.ceilingpanel.Text = " Ceiling ";
//
// ceilingInfo
//
this.ceilingInfo.Controls.Add(this.ceilingLight);
this.ceilingInfo.Controls.Add(this.ceilingOffsetLabel);
this.ceilingInfo.Controls.Add(this.ceilingScale);
this.ceilingInfo.Controls.Add(this.ceilingOffset);
this.ceilingInfo.Controls.Add(this.ceilingLightLabel);
this.ceilingInfo.Controls.Add(this.ceilingAngleLabel);
this.ceilingInfo.Controls.Add(this.ceilingScaleLabel);
this.ceilingInfo.Controls.Add(this.ceilingAngle);
this.ceilingInfo.Location = new System.Drawing.Point(80, 15);
this.ceilingInfo.Name = "ceilingInfo";
this.ceilingInfo.Size = new System.Drawing.Size(118, 80);
this.ceilingInfo.TabIndex = 2;
//
// ceilingname
//
this.ceilingname.Location = new System.Drawing.Point(8, 80);
this.ceilingname.AutoSize = true;
this.ceilingname.Location = new System.Drawing.Point(6, 81);
this.ceilingname.Name = "ceilingname";
this.ceilingname.Size = new System.Drawing.Size(68, 13);
this.ceilingname.Size = new System.Drawing.Size(68, 14);
this.ceilingname.TabIndex = 1;
this.ceilingname.Text = "BROWNHUG";
this.ceilingname.TextAlign = System.Drawing.ContentAlignment.TopCenter;
//
// ceilingtex
//
@ -401,9 +391,9 @@ namespace CodeImp.DoomBuilder.Controls
this.ceilingtex.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom;
this.ceilingtex.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
this.ceilingtex.Controls.Add(this.labelCeilTextureSize);
this.ceilingtex.Location = new System.Drawing.Point(8, 19);
this.ceilingtex.Location = new System.Drawing.Point(7, 14);
this.ceilingtex.Name = "ceilingtex";
this.ceilingtex.Size = new System.Drawing.Size(68, 60);
this.ceilingtex.Size = new System.Drawing.Size(64, 64);
this.ceilingtex.TabIndex = 0;
//
// labelCeilTextureSize
@ -412,7 +402,7 @@ namespace CodeImp.DoomBuilder.Controls
this.labelCeilTextureSize.BackColor = System.Drawing.Color.Black;
this.labelCeilTextureSize.Font = new System.Drawing.Font("Arial", 7F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.labelCeilTextureSize.ForeColor = System.Drawing.Color.White;
this.labelCeilTextureSize.Location = new System.Drawing.Point(3, 1);
this.labelCeilTextureSize.Location = new System.Drawing.Point(1, 1);
this.labelCeilTextureSize.MaximumSize = new System.Drawing.Size(0, 13);
this.labelCeilTextureSize.Name = "labelCeilTextureSize";
this.labelCeilTextureSize.Size = new System.Drawing.Size(48, 13);
@ -421,7 +411,14 @@ namespace CodeImp.DoomBuilder.Controls
//
// floorpanel
//
this.floorpanel.Controls.Add(this.floorInfo);
this.floorpanel.Controls.Add(this.floorLight);
this.floorpanel.Controls.Add(this.floorOffsetLabel);
this.floorpanel.Controls.Add(this.floorLightLabel);
this.floorpanel.Controls.Add(this.floorScale);
this.floorpanel.Controls.Add(this.floorOffset);
this.floorpanel.Controls.Add(this.floorAngleLabel);
this.floorpanel.Controls.Add(this.floorScaleLabel);
this.floorpanel.Controls.Add(this.floorAngle);
this.floorpanel.Controls.Add(this.floorname);
this.floorpanel.Controls.Add(this.floortex);
this.floorpanel.Location = new System.Drawing.Point(303, 0);
@ -432,61 +429,50 @@ namespace CodeImp.DoomBuilder.Controls
this.floorpanel.TabStop = false;
this.floorpanel.Text = " Floor ";
//
// floorInfo
//
this.floorInfo.Controls.Add(this.floorLight);
this.floorInfo.Controls.Add(this.floorOffsetLabel);
this.floorInfo.Controls.Add(this.floorScale);
this.floorInfo.Controls.Add(this.floorOffset);
this.floorInfo.Controls.Add(this.floorLightLabel);
this.floorInfo.Controls.Add(this.floorAngleLabel);
this.floorInfo.Controls.Add(this.floorScaleLabel);
this.floorInfo.Controls.Add(this.floorAngle);
this.floorInfo.Location = new System.Drawing.Point(80, 15);
this.floorInfo.Name = "floorInfo";
this.floorInfo.Size = new System.Drawing.Size(118, 80);
this.floorInfo.TabIndex = 30;
//
// floorLight
//
this.floorLight.Location = new System.Drawing.Point(54, 61);
this.floorLight.AutoSize = true;
this.floorLight.Location = new System.Drawing.Point(124, 63);
this.floorLight.Name = "floorLight";
this.floorLight.Size = new System.Drawing.Size(60, 14);
this.floorLight.Size = new System.Drawing.Size(15, 14);
this.floorLight.TabIndex = 29;
this.floorLight.Text = "255 (abs.)";
this.floorLight.Text = "--";
//
// floorScale
//
this.floorScale.Location = new System.Drawing.Point(54, 43);
this.floorScale.AutoSize = true;
this.floorScale.Location = new System.Drawing.Point(124, 47);
this.floorScale.Name = "floorScale";
this.floorScale.Size = new System.Drawing.Size(60, 14);
this.floorScale.Size = new System.Drawing.Size(29, 14);
this.floorScale.TabIndex = 28;
this.floorScale.Text = "-1.0, -1.0";
this.floorScale.Text = "--, --";
//
// floorOffset
//
this.floorOffset.Location = new System.Drawing.Point(54, 7);
this.floorOffset.AutoSize = true;
this.floorOffset.Location = new System.Drawing.Point(124, 15);
this.floorOffset.Name = "floorOffset";
this.floorOffset.Size = new System.Drawing.Size(60, 14);
this.floorOffset.Size = new System.Drawing.Size(29, 14);
this.floorOffset.TabIndex = 23;
this.floorOffset.Text = "-100, -100";
this.floorOffset.Text = "--, --";
//
// floorAngle
//
this.floorAngle.Location = new System.Drawing.Point(54, 25);
this.floorAngle.AutoSize = true;
this.floorAngle.Location = new System.Drawing.Point(124, 31);
this.floorAngle.Name = "floorAngle";
this.floorAngle.Size = new System.Drawing.Size(60, 14);
this.floorAngle.Size = new System.Drawing.Size(15, 14);
this.floorAngle.TabIndex = 25;
this.floorAngle.Text = "45";
this.floorAngle.Text = "--";
//
// floorname
//
this.floorname.Location = new System.Drawing.Point(8, 80);
this.floorname.AutoSize = true;
this.floorname.Location = new System.Drawing.Point(6, 81);
this.floorname.Name = "floorname";
this.floorname.Size = new System.Drawing.Size(68, 13);
this.floorname.Size = new System.Drawing.Size(68, 14);
this.floorname.TabIndex = 1;
this.floorname.Text = "BROWNHUG";
this.floorname.TextAlign = System.Drawing.ContentAlignment.TopCenter;
//
// floortex
//
@ -494,9 +480,9 @@ namespace CodeImp.DoomBuilder.Controls
this.floortex.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom;
this.floortex.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
this.floortex.Controls.Add(this.labelFloorTextureSize);
this.floortex.Location = new System.Drawing.Point(8, 19);
this.floortex.Location = new System.Drawing.Point(7, 14);
this.floortex.Name = "floortex";
this.floortex.Size = new System.Drawing.Size(68, 60);
this.floortex.Size = new System.Drawing.Size(64, 64);
this.floortex.TabIndex = 0;
//
// labelFloorTextureSize
@ -505,7 +491,7 @@ namespace CodeImp.DoomBuilder.Controls
this.labelFloorTextureSize.BackColor = System.Drawing.Color.Black;
this.labelFloorTextureSize.Font = new System.Drawing.Font("Arial", 7F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.labelFloorTextureSize.ForeColor = System.Drawing.Color.White;
this.labelFloorTextureSize.Location = new System.Drawing.Point(3, 1);
this.labelFloorTextureSize.Location = new System.Drawing.Point(1, 1);
this.labelFloorTextureSize.MaximumSize = new System.Drawing.Size(0, 13);
this.labelFloorTextureSize.Name = "labelFloorTextureSize";
this.labelFloorTextureSize.Size = new System.Drawing.Size(48, 13);
@ -518,10 +504,11 @@ namespace CodeImp.DoomBuilder.Controls
this.flowLayoutPanel1.Controls.Add(this.floorpanel);
this.flowLayoutPanel1.Controls.Add(this.ceilingpanel);
this.flowLayoutPanel1.Controls.Add(this.flagsPanel);
this.flowLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
this.flowLayoutPanel1.Location = new System.Drawing.Point(0, 0);
this.flowLayoutPanel1.Margin = new System.Windows.Forms.Padding(0);
this.flowLayoutPanel1.Name = "flowLayoutPanel1";
this.flowLayoutPanel1.Size = new System.Drawing.Size(1090, 100);
this.flowLayoutPanel1.Size = new System.Drawing.Size(1400, 100);
this.flowLayoutPanel1.TabIndex = 5;
this.flowLayoutPanel1.WrapContents = false;
//
@ -564,11 +551,11 @@ namespace CodeImp.DoomBuilder.Controls
this.sectorinfo.ResumeLayout(false);
this.sectorinfo.PerformLayout();
this.ceilingpanel.ResumeLayout(false);
this.ceilingInfo.ResumeLayout(false);
this.ceilingpanel.PerformLayout();
this.ceilingtex.ResumeLayout(false);
this.ceilingtex.PerformLayout();
this.floorpanel.ResumeLayout(false);
this.floorInfo.ResumeLayout(false);
this.floorpanel.PerformLayout();
this.floortex.ResumeLayout(false);
this.floortex.PerformLayout();
this.flowLayoutPanel1.ResumeLayout(false);
@ -597,8 +584,6 @@ namespace CodeImp.DoomBuilder.Controls
private System.Windows.Forms.Label ceilingAngle;
private System.Windows.Forms.Label ceilingOffset;
private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel1;
private System.Windows.Forms.Panel ceilingInfo;
private System.Windows.Forms.Panel floorInfo;
private System.Windows.Forms.Label floorLight;
private System.Windows.Forms.Label floorScale;
private System.Windows.Forms.Label floorOffset;
@ -619,5 +604,7 @@ namespace CodeImp.DoomBuilder.Controls
private System.Windows.Forms.Label labelLight;
private System.Windows.Forms.GroupBox flagsPanel;
private System.Windows.Forms.ListView flags;
private System.Windows.Forms.Label labelTag;
private System.Windows.Forms.Label labelEffect;
}
}

View file

@ -17,6 +17,7 @@
#region ================== Namespaces
using System;
using System.Drawing;
using System.Windows.Forms;
using CodeImp.DoomBuilder.Map;
using CodeImp.DoomBuilder.Data;
@ -29,14 +30,21 @@ namespace CodeImp.DoomBuilder.Controls
{
internal partial class SectorInfoPanel : UserControl
{
private readonly int fullWidth; //mxd
private readonly List<Label> floorlabels;
private readonly List<Label> ceillabels;
// Constructor
public SectorInfoPanel()
{
// Initialize
InitializeComponent();
fullWidth = floorpanel.Width; //mxd
//mxd
labelFloorTextureSize.BackColor = Color.FromArgb(128, labelFloorTextureSize.BackColor);
labelCeilTextureSize.BackColor = Color.FromArgb(128, labelCeilTextureSize.BackColor);
floorlabels = new List<Label> { floorAngle, floorLight, floorOffset, floorScale };
ceillabels = new List<Label> { ceilingAngle, ceilingLight, ceilingOffset, ceilingScale };
}
// This shows the info
@ -55,34 +63,38 @@ namespace CodeImp.DoomBuilder.Controls
tag.Text = s.Tag + (General.Map.Options.TagLabels.ContainsKey(s.Tag) ? " (" + General.Map.Options.TagLabels[s.Tag] + ")" : string.Empty);
height.Text = sheight.ToString();
brightness.Text = s.Brightness.ToString();
floorname.Text = s.FloorTexture;
ceilingname.Text = s.CeilTexture;
//mxd. Texture info
//mxd
effect.Enabled = (s.Effect != 0);
labelEffect.Enabled = (s.Effect != 0);
tag.Enabled = (s.Tag != 0);
labelTag.Enabled = (s.Tag != 0);
//mxd. Texture size
if (s.LongFloorTexture == MapSet.EmptyLongName)
{
labelFloorTextureSize.Visible = false;
General.DisplayZoomedImage(floortex, Properties.Resources.MissingTexture);
floorname.Text = s.FloorTexture;
}
else
{
ImageData image = General.Map.Data.GetFlatImage(s.FloorTexture);
DisplayTextureSize(labelFloorTextureSize, image);
General.DisplayZoomedImage(floortex, image.GetPreview());
floorname.Text = (image is UnknownImage ? s.FloorTexture : image.DisplayName);
}
if (s.LongCeilTexture == MapSet.EmptyLongName)
{
labelCeilTextureSize.Visible = false;
General.DisplayZoomedImage(ceilingtex, Properties.Resources.MissingTexture);
ceilingname.Text = s.CeilTexture;
}
else
{
ImageData image = General.Map.Data.GetFlatImage(s.CeilTexture);
DisplayTextureSize(labelCeilTextureSize, image); //mxd
General.DisplayZoomedImage(ceilingtex, image.GetPreview());
ceilingname.Text = (image is UnknownImage ? s.CeilTexture : image.DisplayName);
}
//mxd
@ -105,7 +117,7 @@ namespace CodeImp.DoomBuilder.Controls
}
else
{
panelLightColor.BackColor = System.Drawing.SystemColors.Control;
panelLightColor.BackColor = SystemColors.Control;
labelLight.Enabled = false;
}
@ -116,7 +128,7 @@ namespace CodeImp.DoomBuilder.Controls
}
else
{
panelFadeColor.BackColor = System.Drawing.SystemColors.Control;
panelFadeColor.BackColor = SystemColors.Control;
labelFade.Enabled = false;
}
@ -245,7 +257,7 @@ namespace CodeImp.DoomBuilder.Controls
}
else
{
ceilingAngle.Text = "-";
ceilingAngle.Text = "--";
ceilingAngle.Enabled = false;
ceilingAngleLabel.Enabled = false;
}
@ -259,7 +271,7 @@ namespace CodeImp.DoomBuilder.Controls
}
else
{
floorAngle.Text = "-";
floorAngle.Text = "--";
floorAngle.Enabled = false;
floorAngleLabel.Enabled = false;
}
@ -286,7 +298,6 @@ namespace CodeImp.DoomBuilder.Controls
flags.Width = itemWidth * (int)Math.Ceiling(flags.Items.Count / 5.0f);
flagsPanel.Width = flags.Width + flags.Left * 2;
}
}
else
{
@ -297,36 +308,41 @@ namespace CodeImp.DoomBuilder.Controls
flagsPanel.Visible = false;
}
//panels size
if(showExtededCeilingInfo)
{
ceilingpanel.Width = fullWidth;
ceilingInfo.Visible = true;
}
else
{
ceilingInfo.Visible = false;
ceilingpanel.Width = 84;
}
if(showExtededFloorInfo)
{
floorpanel.Width = fullWidth;
floorInfo.Visible = true;
}
else
{
floorInfo.Visible = false;
floorpanel.Width = 84;
}
//mxd. Resize panels
UpdateTexturePanel(ceilingpanel, ceilingname, ceillabels, ceilingtex, ceilingOffsetLabel.Location.X - 1, showExtededCeilingInfo);
UpdateTexturePanel(floorpanel, floorname, floorlabels, floortex, floorOffsetLabel.Location.X - 1, showExtededFloorInfo);
// Show the whole thing
this.Show();
this.Update();
}
private void DisplayTextureSize(Label label, ImageData texture)
//mxd
private static void UpdateTexturePanel(GroupBox panel, Label texturename, List<Label> proplabels, Panel image, int sizeref, bool extendedinfoshown)
{
//Reposition texture name label?
if(texturename.Width < image.Width + 2)
texturename.Location = new Point(image.Location.X + (image.Width - texturename.Width) / 2, texturename.Location.Y);
else
texturename.Location = new Point(image.Location.X - 1, texturename.Location.Y);
// Resize panel
if(!extendedinfoshown)
panel.Width = Math.Max(texturename.Right + image.Location.X - 1, sizeref);
else
panel.Width = Math.Max(texturename.Right, GetMaxRight(proplabels)) + image.Location.X;
}
//mxd
private static int GetMaxRight(IEnumerable<Label> labels)
{
int max = 0;
foreach (Label label in labels) if (label.Right > max) max = label.Right;
return max;
}
//mxd
private static void DisplayTextureSize(Label label, ImageData texture)
{
if(General.Settings.ShowTextureSizes && texture.ImageState == ImageLoadState.Ready
&& !string.IsNullOrEmpty(texture.Name) && !(texture is UnknownImage))

View file

@ -123,16 +123,10 @@
<metadata name="label5.GenerateMember" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
<metadata name="label4.GenerateMember" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
<metadata name="label3.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="label1.GenerateMember" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
</root>

View file

@ -53,6 +53,7 @@ namespace CodeImp.DoomBuilder.Controls
if(string.IsNullOrEmpty(imagename))
{
DisplayImageSize(0, 0); //mxd
UpdateToggleImageNameButton(null); //mxd
//mxd. Determine image to show
if (multipletextures) return Properties.Resources.ImageStack;
@ -61,6 +62,7 @@ namespace CodeImp.DoomBuilder.Controls
else if(imagename == "-") //mxd
{
DisplayImageSize(0, 0);
UpdateToggleImageNameButton(null); //mxd
// Determine image to show
return (required ? Properties.Resources.MissingTexture : null);
@ -68,6 +70,7 @@ namespace CodeImp.DoomBuilder.Controls
else
{
ImageData texture = General.Map.Data.GetTextureImage(imagename); //mxd
UpdateToggleImageNameButton(texture); //mxd
if(string.IsNullOrEmpty(texture.FullName) || texture is UnknownImage) DisplayImageSize(0, 0); //mxd
else DisplayImageSize(texture.ScaledWidth, texture.ScaledHeight); //mxd

View file

@ -310,8 +310,8 @@ namespace CodeImp.DoomBuilder.Data
// Load stuff
LoadPalette();
texcount = LoadTextures(texturesonly);
flatcount = LoadFlats(flatsonly);
texcount = LoadTextures(texturesonly, texturenamesshorttofull);
flatcount = LoadFlats(flatsonly, flatnamesshorttofull);
colormapcount = LoadColormaps(colormapsonly);
LoadSprites();
thingcount = LoadDecorateThings();
@ -353,7 +353,8 @@ namespace CodeImp.DoomBuilder.Data
}
// Mixed textures and flats?
if (General.Map.Config.MixTexturesFlats) {
if (General.Map.Config.MixTexturesFlats)
{
// Add textures to flats
foreach(KeyValuePair<long, ImageData> t in texturesonly)
{
@ -364,10 +365,20 @@ namespace CodeImp.DoomBuilder.Data
}
else if(t.Value is HighResImage || t.Value is SimpleTextureImage) //mxd. Textures defined in TEXTURES or placed between TX_START and TX_END markers override "regular" flats in ZDoom
{
//TODO: check this!
flats[t.Key] = t.Value;
}
}
//mxd
foreach (KeyValuePair<long, long> t in texturenamesshorttofull)
{
if (!flatnamesshorttofull.ContainsKey(t.Key))
{
flatnamesshorttofull.Add(t.Key, t.Value);
}
}
// Add flats to textures
foreach(KeyValuePair<long, ImageData> f in flatsonly)
{
@ -378,6 +389,15 @@ namespace CodeImp.DoomBuilder.Data
}
}
//mxd
foreach (KeyValuePair<long, long> t in flatnamesshorttofull)
{
if (!texturenamesshorttofull.ContainsKey(t.Key))
{
texturenamesshorttofull.Add(t.Key, t.Value);
}
}
// Do the same on the data readers
foreach (DataReader dr in containers)
dr.TextureSet.MixTexturesAndFlats();
@ -390,10 +410,6 @@ namespace CodeImp.DoomBuilder.Data
// Sort things
foreach(ThingCategory tc in thingcategories) tc.SortIfNeeded();
//mxd. Create texture name translation lists
texturenamesshorttofull = CreateShortTextureNamesCollection(textures);
flatnamesshorttofull = CreateShortTextureNamesCollection(flats);
// Update the used textures
General.Map.Data.UpdateUsedTextures();
@ -425,36 +441,9 @@ namespace CodeImp.DoomBuilder.Data
// Output info
General.WriteLogLine("Loaded " + texcount + " textures, " + flatcount + " flats, " + colormapcount + " colormaps, " + spritecount + " sprites, " + thingcount + " decorate things, " + modeldefEntries.Count + " model deinitions, " + gldefsEntries.Count + " dynamic light definitions");
}
//mxd
private Dictionary<long, long> CreateShortTextureNamesCollection(Dictionary<long, ImageData> images)
{
Dictionary<long, long> names = new Dictionary<long, long>();
foreach(KeyValuePair<long, ImageData> pair in images)
{
if(pair.Value.FullName.Length > CLASIC_IMAGE_NAME_LENGTH)
{
string shortname = pair.Value.DisplayName.ToUpperInvariant();
if(shortname.Length > CLASIC_IMAGE_NAME_LENGTH) shortname = shortname.Substring(0, CLASIC_IMAGE_NAME_LENGTH);
long hash = MurmurHash2.Hash(shortname);
if(names.ContainsKey(hash))
{
names[hash] = pair.Value.LongName;
}
else
{
names.Add(hash, pair.Value.LongName);
}
}
}
return names;
}
// This unloads all data
internal void Unload()
private void Unload()
{
// Stop background loader
StopBackgroundLoader();
@ -725,13 +714,15 @@ namespace CodeImp.DoomBuilder.Data
}
//mxd. This loads a model
internal bool ProcessModel(int type) {
internal bool ProcessModel(int type)
{
if(modeldefEntries[type].LoadState != ModelLoadState.None) return true;
//create models
ModelReader.Load(modeldefEntries[type], containers, General.Map.Graphics.Device);
if(modeldefEntries[type].Model != null) {
if(modeldefEntries[type].Model != null)
{
modeldefEntries[type].LoadState = ModelLoadState.Ready;
return true;
}
@ -753,7 +744,8 @@ namespace CodeImp.DoomBuilder.Data
}
// Set used on all flats
foreach(KeyValuePair<long, ImageData> i in flats) {
foreach(KeyValuePair<long, ImageData> i in flats)
{
i.Value.SetUsedInMap(usedimages.ContainsKey(i.Key));
if(i.Value.IsImageLoaded != i.Value.IsReferenced) ProcessImage(i.Value);
}
@ -843,7 +835,7 @@ namespace CodeImp.DoomBuilder.Data
#region ================== Textures
// This loads the textures
private int LoadTextures(Dictionary<long, ImageData> list)
private int LoadTextures(Dictionary<long, ImageData> list, Dictionary<long, long> nametranslation)
{
ICollection<ImageData> images;
PatchNames pnames = new PatchNames();
@ -873,6 +865,20 @@ namespace CodeImp.DoomBuilder.Data
list.Add(img.LongName, img);
if(firsttexture == 0) firsttexture = img.LongName;
counter++;
//mxd. Also add as short name when texture name is longer than 8 chars
// Or remove when a wad image with short name overrides previously added
// resource image with long name
if(img.HasLongName)
{
long longshortname = Lump.MakeLongName(Path.GetFileNameWithoutExtension(img.Name), false);
nametranslation.Remove(longshortname);
nametranslation.Add(longshortname, img.LongName);
}
else if (img is TextureImage && nametranslation.ContainsKey(img.LongName))
{
nametranslation.Remove(img.LongName);
}
// Add to preview manager
previews.AddImage(img);
@ -932,7 +938,7 @@ namespace CodeImp.DoomBuilder.Data
// This checks if a given texture is known
public bool GetTextureExists(long longname)
{
return textures.ContainsKey(longname);
return textures.ContainsKey(longname) || texturenamesshorttofull.ContainsKey(longname);
}
// This returns an image by string
@ -947,11 +953,8 @@ namespace CodeImp.DoomBuilder.Data
public ImageData GetTextureImage(long longname)
{
// Does this texture exist?
if(textures.ContainsKey(longname))
{
// Return texture
return textures[longname];
}
if(texturenamesshorttofull.ContainsKey(longname)) return textures[texturenamesshorttofull[longname]]; //mxd
if(textures.ContainsKey(longname)) return textures[longname];
// Return null image
return unknownimage; //mxd
@ -963,17 +966,24 @@ namespace CodeImp.DoomBuilder.Data
if (Path.GetFileNameWithoutExtension(name) == name && name.Length > CLASIC_IMAGE_NAME_LENGTH)
name = name.Substring(0, CLASIC_IMAGE_NAME_LENGTH);
long hash = MurmurHash2.Hash(name.Trim().ToUpperInvariant());
if(textures.ContainsKey(hash)) return textures[hash].Name;
if(texturenamesshorttofull.ContainsKey(hash)) return textures[texturenamesshorttofull[hash]].Name;
if(textures.ContainsKey(hash)) return textures[hash].Name;
return name;
}
//mxd
internal long GetFullLongTextureName(long hash)
{
return (General.Map.Config.UseLongTextureNames && texturenamesshorttofull.ContainsKey(hash) ? texturenamesshorttofull[hash] : hash);
}
#endregion
#region ================== Flats
// This loads the flats
private int LoadFlats(Dictionary<long, ImageData> list)
private int LoadFlats(Dictionary<long, ImageData> list, Dictionary<long, long> nametranslation)
{
ICollection<ImageData> images;
int counter = 0;
@ -993,6 +1003,20 @@ namespace CodeImp.DoomBuilder.Data
list.Add(img.LongName, img);
counter++;
//mxd. Also add as short name when texture name is longer than 8 chars
// Or remove when a wad image with short name overrides previously added
// resource image with long name
if (img.HasLongName)
{
long longshortname = Lump.MakeLongName(Path.GetFileNameWithoutExtension(img.Name), false);
nametranslation.Remove(longshortname);
nametranslation.Add(longshortname, img.LongName);
}
else if(img is FlatImage && nametranslation.ContainsKey(img.LongName))
{
nametranslation.Remove(img.LongName);
}
// Add to preview manager
previews.AddImage(img);
}
@ -1030,7 +1054,7 @@ namespace CodeImp.DoomBuilder.Data
// This checks if a flat is known
public bool GetFlatExists(long longname)
{
return flats.ContainsKey(longname);
return flats.ContainsKey(longname) || flatnamesshorttofull.ContainsKey(longname);
}
// This returns an image by string
@ -1045,6 +1069,7 @@ namespace CodeImp.DoomBuilder.Data
public ImageData GetFlatImage(long longname)
{
// Does this flat exist?
if(flatnamesshorttofull.ContainsKey(longname)) return flats[flatnamesshorttofull[longname]]; //mxd
if(flats.ContainsKey(longname)) return flats[longname];
// Return null image
@ -1055,7 +1080,7 @@ namespace CodeImp.DoomBuilder.Data
public ImageData GetFlatImageKnown(long longname)
{
// Return flat
return flats[longname];
return flatnamesshorttofull.ContainsKey(longname) ? flats[flatnamesshorttofull[longname]] : flats[longname]; //mxd
}
//mxd. Gets full flat name by short flat name
@ -1064,10 +1089,17 @@ namespace CodeImp.DoomBuilder.Data
if(Path.GetFileNameWithoutExtension(name) == name && name.Length > CLASIC_IMAGE_NAME_LENGTH)
name = name.Substring(0, CLASIC_IMAGE_NAME_LENGTH);
long hash = MurmurHash2.Hash(name.ToUpperInvariant());
if(flats.ContainsKey(hash)) return flats[hash].Name;
if(flatnamesshorttofull.ContainsKey(hash)) return flats[flatnamesshorttofull[hash]].Name;
if(flats.ContainsKey(hash)) return flats[hash].Name;
return name;
}
//mxd
internal long GetFullLongFlatName(long hash)
{
return (General.Map.Config.UseLongTextureNames && flatnamesshorttofull.ContainsKey(hash) ? flatnamesshorttofull[hash] : hash);
}
#endregion
@ -1124,8 +1156,8 @@ namespace CodeImp.DoomBuilder.Data
// Add to collection
sprites.Add(ti.SpriteLongName, image);
}
else
{ //mxd
else //mxd
{
General.ErrorLogger.Add(ErrorType.Error, "Missing sprite lump '" + ti.Sprite + "'. Forgot to include required resources?");
}
}

View file

@ -140,17 +140,19 @@ namespace CodeImp.DoomBuilder.Data
try
{
//mxd. Long names are absolute
if(General.Map.Options.UseLongTextureNames && !string.IsNullOrEmpty(Path.GetExtension(pname)))
if (longname)
{
pname = pname.Replace(Path.AltDirectorySeparatorChar, Path.DirectorySeparatorChar);
return (FileExists(pname) ? LoadFile(pname) : null);
}
// Find in textures directory
string path = Path.Combine(TEXTURES_DIR, Path.GetDirectoryName(pname));
string filename = FindFirstFile(path, Path.GetFileName(pname), true);
if(!string.IsNullOrEmpty(filename) && FileExists(filename))
return LoadFile(filename);
else
{
// Find in textures directory
string path = Path.Combine(TEXTURES_DIR, Path.GetDirectoryName(pname));
string filename = FindFirstFile(path, Path.GetFileName(pname), true);
if (!string.IsNullOrEmpty(filename) && FileExists(filename))
return LoadFile(filename);
}
}
catch(Exception e)
{
@ -266,24 +268,30 @@ namespace CodeImp.DoomBuilder.Data
#region ================== Voxels (mxd)
//mxd. This finds and returns a voxel stream
public override Stream GetVoxelData(string name) {
public override Stream GetVoxelData(string name)
{
// Error when suspended
if(issuspended) throw new Exception("Data reader is suspended");
// Find in any of the wad files
for(int i = wads.Count - 1; i >= 0; i--) {
for(int i = wads.Count - 1; i >= 0; i--)
{
Stream voxel = wads[i].GetVoxelData(name);
if(voxel != null) return voxel;
}
try {
try
{
// Find in voxels directory
string path = Path.Combine(VOXELS_DIR, Path.GetDirectoryName(name));
string filename = FindFirstFile(path, Path.GetFileName(name), true);
if((filename != null) && FileExists(filename)) {
if((filename != null) && FileExists(filename))
{
return LoadFile(filename);
}
} catch(Exception e) {
}
catch(Exception e)
{
General.ErrorLogger.Add(ErrorType.Error, e.GetType().Name + " while loading voxel '" + name + "' from directory: " + e.Message);
}

View file

@ -19,6 +19,7 @@
using System;
using System.IO;
using CodeImp.DoomBuilder.IO;
using CodeImp.DoomBuilder.Controls;
#endregion
@ -94,7 +95,7 @@ namespace CodeImp.DoomBuilder.Data
//mxd: also, zdoom uses '/' as directory separator char.
private void SetName(string name, string filepathname)
{
SetName(name, filepathname, General.Map.Options.UseLongTextureNames);
SetName(name, filepathname, General.Map.Config.UseLongTextureNames);
}
private void SetName(string name, string filepathname, bool uselongtexturenames)
@ -104,26 +105,39 @@ namespace CodeImp.DoomBuilder.Data
if(!uselongtexturenames)
{
this.name = Path.GetFileNameWithoutExtension(name.ToUpperInvariant());
if(this.name.Length > DataManager.CLASIC_IMAGE_NAME_LENGTH)
if (this.name.Length > DataManager.CLASIC_IMAGE_NAME_LENGTH)
{
this.name = this.name.Substring(0, DataManager.CLASIC_IMAGE_NAME_LENGTH);
}
this.virtualname = Path.Combine(Path.GetDirectoryName(name), this.name).Replace(Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar);
this.displayname = this.name;
this.longname = Lump.MakeLongName(this.name); //mxd
this.shortname = this.name;
}
else
{
this.name = name;
this.virtualname = name;
this.displayname = Path.GetFileNameWithoutExtension(name);
this.longname = Lump.MakeLongName(name);
this.shortname = this.displayname.ToUpperInvariant();
if (this.shortname.Length > DataManager.CLASIC_IMAGE_NAME_LENGTH)
{
this.shortname = this.shortname.Substring(0, DataManager.CLASIC_IMAGE_NAME_LENGTH);
}
hasLongName = true;
}
this.longname = Lump.MakeLongName(this.name, uselongtexturenames); //mxd
this.fullname = filepathname;
if(General.Settings.CapitalizeTextureNames && !string.IsNullOrEmpty(this.displayname))
{
this.displayname = this.displayname.ToUpperInvariant();
}
if (this.displayname.Length > ImageBrowserItem.MAX_NAME_LENGTH)
{
this.displayname = this.displayname.Substring(0, ImageBrowserItem.MAX_NAME_LENGTH);
}
}
// This loads the image

View file

@ -20,6 +20,7 @@ using System;
using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Imaging;
using CodeImp.DoomBuilder.Controls;
using CodeImp.DoomBuilder.Rendering;
using CodeImp.DoomBuilder.IO;
using System.IO;
@ -50,16 +51,8 @@ namespace CodeImp.DoomBuilder.Data
this.patches = new List<TexturePatch>(1);
//mxd
if (!General.Map.Options.UseLongTextureNames)
{
if(name.Length > DataManager.CLASIC_IMAGE_NAME_LENGTH)
name = name.Substring(0, DataManager.CLASIC_IMAGE_NAME_LENGTH);
name = name.ToUpperInvariant();
}
SetName(name);
this.virtualname = "[TEXTURES]/" + this.name; //mxd
this.isFlat = isflat; //mxd
this.isFlat = isflat;
// We have no destructor
GC.SuppressFinalize(this);
@ -69,6 +62,36 @@ namespace CodeImp.DoomBuilder.Data
#region ================== Methods
//mxd
protected override void SetName(string name)
{
if(!General.Map.Config.UseLongTextureNames)
{
if(name.Length > DataManager.CLASIC_IMAGE_NAME_LENGTH)
name = name.Substring(0, DataManager.CLASIC_IMAGE_NAME_LENGTH);
name = name.ToUpperInvariant();
}
base.SetName(name);
this.virtualname = "[TEXTURES]/" + this.name;
if(General.Settings.CapitalizeTextureNames && !string.IsNullOrEmpty(this.displayname))
{
this.displayname = this.displayname.ToUpperInvariant();
}
if(this.displayname.Length > ImageBrowserItem.MAX_NAME_LENGTH)
{
this.displayname = this.displayname.Substring(0, ImageBrowserItem.MAX_NAME_LENGTH);
}
this.shortname = this.displayname.ToUpperInvariant();
if(this.shortname.Length > DataManager.CLASIC_IMAGE_NAME_LENGTH)
{
this.shortname = this.shortname.Substring(0, DataManager.CLASIC_IMAGE_NAME_LENGTH);
}
}
// This adds a patch to the texture
public void AddPatch(TexturePatch patch)
{

View file

@ -50,8 +50,9 @@ namespace CodeImp.DoomBuilder.Data
protected bool worldpanning;
private bool usecolorcorrection;
protected string fullname; //mxd. name with path;
protected string virtualname; //mxd
protected string displayname; //mxd
protected string shortname; //mxd. Name in uppercase and clamped to DataManager.CLASIC_IMAGE_NAME_LENGTH
protected string virtualname; //mxd. Path of this name is used in TextureBrowserForm
protected string displayname; //mxd. Name to display in TextureBrowserForm
protected bool isFlat; //mxd. if false, it's a texture
protected bool hasLongName; //mxd. Texture name is longer than DataManager.CLASIC_IMAGE_NAME_LENGTH
protected bool hasPatchWithSameName; //mxd
@ -84,11 +85,13 @@ namespace CodeImp.DoomBuilder.Data
public string Name { get { return name; } }
public long LongName { get { return longname; } }
public string ShortName { get { return shortname; } } //mxd
public string FullName { get { return fullname; } } //mxd
public string VirtualName { get { return virtualname; } } //mxd
public string DisplayName { get { return displayname; } } //mxd
public bool IsFlat { get { return isFlat; } } //mxd
public bool HasPatchWithSameName { get { return hasPatchWithSameName; } } //mxd
internal bool HasLongName { get { return hasLongName; } } //mxd
public bool UseColorCorrection { get { return usecolorcorrection; } set { usecolorcorrection = value; } }
public Texture Texture { get { lock(this) { return texture; } } }
public bool IsPreviewLoaded { get { return (previewstate == ImageLoadState.Ready); } }
@ -184,6 +187,7 @@ namespace CodeImp.DoomBuilder.Data
{
this.name = name;
this.fullname = name; //mxd
this.shortname = name; //mxd
this.virtualname = name; //mxd
this.displayname = name; //mxd
this.longname = Lump.MakeLongName(name); //mxd

View file

@ -18,6 +18,7 @@
using System;
using System.IO;
using CodeImp.DoomBuilder.Controls;
using CodeImp.DoomBuilder.IO;
#endregion
@ -67,28 +68,41 @@ namespace CodeImp.DoomBuilder.Data
//mxd: filepathname is relative path to the image ("Textures\sometexture.png")
protected override void SetName(string filepathname)
{
if(!General.Map.Options.UseLongTextureNames)
if(!General.Map.Config.UseLongTextureNames)
{
this.name = Path.GetFileNameWithoutExtension(filepathname.ToUpperInvariant());
if(this.name.Length > DataManager.CLASIC_IMAGE_NAME_LENGTH)
if (this.name.Length > DataManager.CLASIC_IMAGE_NAME_LENGTH)
{
this.name = this.name.Substring(0, DataManager.CLASIC_IMAGE_NAME_LENGTH);
}
this.displayname = this.name;
this.longname = Lump.MakeLongName(this.name); //mxd
this.shortname = this.name;
}
else
{
this.name = filepathname.Replace(Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar);
this.displayname = Path.GetFileNameWithoutExtension(name);
this.longname = Lump.MakeLongName(this.name);
this.shortname = this.displayname.ToUpperInvariant();
if (this.shortname.Length > DataManager.CLASIC_IMAGE_NAME_LENGTH)
{
this.shortname = this.shortname.Substring(0, DataManager.CLASIC_IMAGE_NAME_LENGTH);
}
this.hasLongName = true;
}
this.longname = Lump.MakeLongName(this.name);
this.virtualname = filepathname.Replace(Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar);
this.fullname = filepathname;
if(General.Settings.CapitalizeTextureNames && !string.IsNullOrEmpty(this.displayname))
{
this.displayname = this.displayname.ToUpperInvariant();
}
if(this.displayname.Length > ImageBrowserItem.MAX_NAME_LENGTH)
{
this.displayname = this.displayname.Substring(0, ImageBrowserItem.MAX_NAME_LENGTH);
}
}
// This loads the image

View file

@ -610,10 +610,6 @@ namespace CodeImp.DoomBuilder.Data
string[] files = GetAllFiles(path, includesubdirs);
foreach(string f in files)
{
//mxd. Skip IMGZ files
string ext = Path.GetExtension(f);
if(!string.IsNullOrEmpty(ext) && ext.ToUpperInvariant() == ".IMGZ") continue;
if(string.IsNullOrEmpty(Path.GetFileNameWithoutExtension(f)))
{
// Can't load image without name

View file

@ -58,11 +58,6 @@ namespace CodeImp.DoomBuilder.Data
// This loads the image
protected override void LocalLoadImage()
{
IImageReader reader;
MemoryStream mem;
Stream patchdata;
byte[] membytes;
// Checks
if(this.IsImageLoaded) return;
@ -70,18 +65,18 @@ namespace CodeImp.DoomBuilder.Data
{
// Get the patch data stream
if(bitmap != null) bitmap.Dispose(); bitmap = null;
patchdata = General.Map.Data.GetTextureData(lumpname, hasLongName);
Stream patchdata = General.Map.Data.GetTextureData(lumpname, hasLongName);
if(patchdata != null)
{
// Copy patch data to memory
patchdata.Seek(0, SeekOrigin.Begin);
membytes = new byte[(int)patchdata.Length];
byte[] membytes = new byte[(int)patchdata.Length];
patchdata.Read(membytes, 0, (int)patchdata.Length);
mem = new MemoryStream(membytes);
MemoryStream mem = new MemoryStream(membytes);
mem.Seek(0, SeekOrigin.Begin);
// Get a reader for the data
reader = ImageDataFormat.GetImageReader(mem, ImageDataFormat.DOOMPICTURE, General.Map.Data.Palette);
IImageReader reader = ImageDataFormat.GetImageReader(mem, ImageDataFormat.DOOMPICTURE, General.Map.Data.Palette);
if(!(reader is UnknownImageReader))
{
// Load the image

View file

@ -27,7 +27,7 @@ namespace CodeImp.DoomBuilder.Data
{
#region ================== Variables
private Bitmap loadbitmap;
private readonly Bitmap loadbitmap;
#endregion

View file

@ -230,7 +230,7 @@ namespace CodeImp.DoomBuilder.Editing
// Write data to stream
MemoryStream memstream = new MemoryStream();
ClipboardStreamWriter writer = new ClipboardStreamWriter(); //mxd
writer.Write(copyset, memstream, General.Map.Options.UseLongTextureNames);
writer.Write(copyset, memstream, General.Map.Config.UseLongTextureNames);
// Set on clipboard
Clipboard.SetData(CLIPBOARD_DATA_FORMAT, memstream);
@ -295,8 +295,8 @@ namespace CodeImp.DoomBuilder.Editing
if(!(General.Map.FormatInterface is UniversalMapSetIO)) General.Map.Map.TranslateFromUDMF();
//mxd. Translate texture names if needed
if(reader.UseLongTextureNames != General.Map.Options.UseLongTextureNames)
General.Map.Map.TranslateTextureNames(General.Map.Options.UseLongTextureNames, true);
if(reader.UseLongTextureNames != General.Map.Config.UseLongTextureNames)
General.Map.Map.TranslateTextureNames(General.Map.Config.UseLongTextureNames, true);
// Modify tags and actions if preferred
if(options.ChangeTags == PasteOptions.TAGS_REMOVE) Tools.RemoveMarkedTags();

View file

@ -1166,8 +1166,7 @@ namespace CodeImp.DoomBuilder
openfile.Dispose();
}
//mxd
// This loads a different map from same wad file
//mxd. This loads a different map from same wad file without reloading resources
[BeginAction("openmapincurrentwad")]
internal static void OpenMapInCurrentWad()
{

View file

@ -414,8 +414,8 @@ namespace CodeImp.DoomBuilder {
map.RemoveUnusedSectors(true);
//mxd. Translate to long or short texture names.
bool nameschanged = map.TranslateTextureNames(options.UseLongTextureNames, false);
grid.TranslateBackgroundName(options.UseLongTextureNames);
bool nameschanged = map.TranslateTextureNames(config.UseLongTextureNames, false);
grid.TranslateBackgroundName(config.UseLongTextureNames);
//mxd. Sector textures may've been changed
if (nameschanged)
@ -458,21 +458,6 @@ namespace CodeImp.DoomBuilder {
//mxd. This switches to another map in the same wad
internal bool InitializeSwitchMap(MapOptions options)
{
bool uselongtexturenames = this.options.UseLongTextureNames;
// Does not compute! (we don't reload resources, so it can potentially
// lead to texture lookup FIALS if there are non-WAD resources)
if(uselongtexturenames != options.UseLongTextureNames &&
MessageBox.Show(General.MainWindow,
"Texture names in the map you are opening will be translated to "
+ (uselongtexturenames ? "long" : "short") + " texture names."
+ (!uselongtexturenames ? " This may lead to texture and flat name conflicts." : "")
+ " Do you want to continue?",
Application.ProductName, MessageBoxButtons.YesNo, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button2) == DialogResult.No)
{
return false;
}
this.changed = false;
this.options = options;
@ -535,15 +520,11 @@ namespace CodeImp.DoomBuilder {
ChangeMapSet(newmap);
//mxd. Translate texture names
bool nameschanged = map.TranslateTextureNames(uselongtexturenames, false);
grid.TranslateBackgroundName(uselongtexturenames);
map.TranslateTextureNames(config.UseLongTextureNames, false);
grid.TranslateBackgroundName(config.UseLongTextureNames);
//mxd. Sector textures may've been changed
if (nameschanged)
{
data.UpdateUsedTextures();
General.Map.IsChanged = true;
}
data.UpdateUsedTextures();
//mxd. check script names
UpdateScriptNames();
@ -1922,8 +1903,8 @@ namespace CodeImp.DoomBuilder {
UpdateScriptNames(); //mxd
//mxd. Translate texture names
bool nameschanged = map.TranslateTextureNames(options.UseLongTextureNames, false);
grid.TranslateBackgroundName(options.UseLongTextureNames);
bool nameschanged = map.TranslateTextureNames(config.UseLongTextureNames, false);
grid.TranslateBackgroundName(config.UseLongTextureNames);
//mxd. Sector textures may've been changed
if (nameschanged)

View file

@ -28,8 +28,8 @@ namespace CodeImp.DoomBuilder.IO
{
#region ================== Variables
private DirectoryFileEntry[] entries;
private Dictionary<string, DirectoryFileEntry> hashedentries;
private readonly DirectoryFileEntry[] entries;
private readonly Dictionary<string, DirectoryFileEntry> hashedentries;
#endregion
@ -46,6 +46,7 @@ namespace CodeImp.DoomBuilder.IO
{
path = Path.GetFullPath(path);
string[] files = Directory.GetFiles(path, "*", subdirectories ? SearchOption.AllDirectories : SearchOption.TopDirectoryOnly);
Array.Sort(files); //mxd
entries = new DirectoryFileEntry[files.Length];
hashedentries = new Dictionary<string, DirectoryFileEntry>(files.Length, StringComparer.Ordinal);
for(int i = 0; i < files.Length; i++)
@ -165,13 +166,16 @@ namespace CodeImp.DoomBuilder.IO
}
//mxd. This returns a list of all files that are in the given path and which names starts with title
public List<string> GetAllFilesWhichTitleStartsWith(string path, string title) {
public List<string> GetAllFilesWhichTitleStartsWith(string path, string title)
{
path = CorrectPath(path).ToLowerInvariant();
title = title.ToLowerInvariant();
List<string> files = new List<string>(entries.Length);
for (int i = 0; i < entries.Length; i++)
if ((entries[i].path == path) && (entries[i].filetitle.StartsWith(title)))
{
if ((entries[i].path == path) && (entries[i].filetitle.StartsWith(title)))
files.Add(entries[i].filepathname);
}
return files;
}

View file

@ -82,7 +82,7 @@ namespace CodeImp.DoomBuilder.IO
// Make name
this.name = MakeNormalName(fixedname, WAD.ENCODING).ToUpperInvariant();
this.fixedname = MakeFixedName(name, WAD.ENCODING);
this.longname = MakeLongName(name);
this.longname = MakeLongName(name, false); //mxd
// We have no destructor
GC.SuppressFinalize(this);
@ -125,9 +125,15 @@ namespace CodeImp.DoomBuilder.IO
//mxd. This returns (hopefully) unique hash value for a texture name of any length
public static long MakeLongName(string name)
{
return MakeLongName(name, General.Map != null && General.Map.Config != null && General.Map.Config.UseLongTextureNames);
}
//mxd. This returns (hopefully) unique hash value for a texture name of any length
public static long MakeLongName(string name, bool uselongnames)
{
name = name.Trim().ToUpper();
if(name.Length > DataManager.CLASIC_IMAGE_NAME_LENGTH && General.Map != null && General.Map.Options != null && !General.Map.Options.UseLongTextureNames)
if(!uselongnames && name.Length > DataManager.CLASIC_IMAGE_NAME_LENGTH)
{
name = name.Substring(0, DataManager.CLASIC_IMAGE_NAME_LENGTH);
}

View file

@ -79,8 +79,6 @@ namespace CodeImp.DoomBuilder.Map
private bool overridefloorheight;
private bool overrideceilheight;
private bool overridebrightness;
private bool uselongtexturenames; //mxd
#endregion
@ -132,8 +130,6 @@ namespace CodeImp.DoomBuilder.Map
public bool OverrideCeilingHeight { get { return overrideceilheight; } set { overrideceilheight = value; } }
public bool OverrideBrightness { get { return overridebrightness; } set { overridebrightness = value; } }
public bool UseLongTextureNames { get { return uselongtexturenames; } set { uselongtexturenames = value; } } //mxd
#endregion
#region ================== Constructor / Disposer
@ -179,11 +175,13 @@ namespace CodeImp.DoomBuilder.Map
this.tagLabels = new Dictionary<int, string>();
ListDictionary tagLabelsData = (ListDictionary)this.mapconfig.ReadSetting("taglabels", new ListDictionary());
foreach(DictionaryEntry tagLabelsEntry in tagLabelsData) {
foreach(DictionaryEntry tagLabelsEntry in tagLabelsData)
{
int tag = 0;
string label = string.Empty;
foreach(DictionaryEntry entry in (ListDictionary)tagLabelsEntry.Value) {
foreach(DictionaryEntry entry in (ListDictionary)tagLabelsEntry.Value)
{
if((string)entry.Key == "tag") tag = (int)entry.Value;
else if((string)entry.Key == "label") label = (string)entry.Value;
}
@ -215,8 +213,6 @@ namespace CodeImp.DoomBuilder.Map
overrideceilheight = this.mapconfig.ReadSetting("overrideceilheight", false);
overridebrightness = this.mapconfig.ReadSetting("overridebrightness", false);
uselongtexturenames = this.mapconfig.ReadSetting("uselongtexturenames", false); //mxd
// Resources
IDictionary reslist = this.mapconfig.ReadSetting("resources", new Hashtable());
foreach(DictionaryEntry mp in reslist)
@ -338,8 +334,6 @@ namespace CodeImp.DoomBuilder.Map
mapconfig.WriteSetting("overrideceilheight", overrideceilheight);
mapconfig.WriteSetting("overridebrightness", overridebrightness);
mapconfig.WriteSetting("uselongtexturenames", uselongtexturenames); //mxd
//mxd. Write script compiler
if(!string.IsNullOrEmpty(scriptcompiler))
mapconfig.WriteSetting("scriptcompiler", scriptcompiler);
@ -426,7 +420,7 @@ namespace CodeImp.DoomBuilder.Map
// This loads the grid settings
internal void ApplyGridSettings()
{
General.Map.Grid.ReadFromConfig(mapconfig, "grid", uselongtexturenames);
General.Map.Grid.ReadFromConfig(mapconfig, "grid", General.Map.Config.UseLongTextureNames);
}
//mxd. This reads stored selection groups from the map configuration

View file

@ -261,7 +261,7 @@ namespace CodeImp.DoomBuilder.Map
// Static initializer
internal static void Initialize()
{
emptylongname = Lump.MakeLongName("-");
emptylongname = Lump.MakeLongName("-", false);
virtualsectorvalue = new UniValue((int)UniversalType.Integer, 0);
}
@ -3234,7 +3234,7 @@ namespace CodeImp.DoomBuilder.Map
string ft = General.Map.Data.GetFullFlatName(s.FloorTexture);
if (ft != s.FloorTexture)
{
s.SetFloorTexture(ft);
s.SetFloorTexture(Lump.MakeLongName(ft));
changed = true;
}
}
@ -3243,7 +3243,7 @@ namespace CodeImp.DoomBuilder.Map
string ct = General.Map.Data.GetFullFlatName(s.CeilTexture);
if (ct != s.CeilTexture)
{
s.SetCeilTexture(ct);
s.SetCeilTexture(Lump.MakeLongName(ct));
changed = true;
}
}
@ -3256,7 +3256,7 @@ namespace CodeImp.DoomBuilder.Map
string ht = General.Map.Data.GetFullTextureName(s.HighTexture);
if (ht != s.HighTexture)
{
s.SetTextureHigh(ht);
s.SetTextureHigh(Lump.MakeLongName(ht));
changed = true;
}
}
@ -3265,7 +3265,7 @@ namespace CodeImp.DoomBuilder.Map
string mt = General.Map.Data.GetFullTextureName(s.MiddleTexture);
if (mt != s.MiddleTexture)
{
s.SetTextureMid(mt);
s.SetTextureMid(Lump.MakeLongName(mt));
changed = true;
}
}
@ -3274,7 +3274,7 @@ namespace CodeImp.DoomBuilder.Map
string lt = General.Map.Data.GetFullTextureName(s.LowTexture);
if (lt != s.LowTexture)
{
s.SetTextureLow(lt);
s.SetTextureLow(Lump.MakeLongName(lt));
changed = true;
}
}
@ -3294,7 +3294,7 @@ namespace CodeImp.DoomBuilder.Map
string ft = GetShortTextureName(s.FloorTexture);
if (ft != s.FloorTexture)
{
s.SetFloorTexture(ft);
s.SetFloorTexture(Lump.MakeLongName(ft));
changed = true;
}
}
@ -3303,7 +3303,7 @@ namespace CodeImp.DoomBuilder.Map
string ct = GetShortTextureName(s.CeilTexture);
if (ct != s.CeilTexture)
{
s.SetCeilTexture(ct);
s.SetCeilTexture(Lump.MakeLongName(ct));
changed = true;
}
}
@ -3316,7 +3316,7 @@ namespace CodeImp.DoomBuilder.Map
string ht = GetShortTextureName(s.HighTexture);
if (ht != s.HighTexture)
{
s.SetTextureHigh(ht);
s.SetTextureHigh(Lump.MakeLongName(ht));
changed = true;
}
}
@ -3325,7 +3325,7 @@ namespace CodeImp.DoomBuilder.Map
string mt = GetShortTextureName(s.MiddleTexture);
if (mt != s.MiddleTexture)
{
s.SetTextureMid(mt);
s.SetTextureMid(Lump.MakeLongName(mt));
changed = true;
}
}
@ -3334,7 +3334,7 @@ namespace CodeImp.DoomBuilder.Map
string lt = GetShortTextureName(s.LowTexture);
if (lt != s.LowTexture)
{
s.SetTextureLow(lt);
s.SetTextureLow(Lump.MakeLongName(lt));
changed = true;
}
}

View file

@ -213,18 +213,23 @@ namespace CodeImp.DoomBuilder.Map
base.ReadWrite(s);
//mxd
if(s.IsWriting) {
if(s.IsWriting)
{
s.wInt(flags.Count);
foreach(KeyValuePair<string, bool> f in flags) {
foreach(KeyValuePair<string, bool> f in flags)
{
s.wString(f.Key);
s.wBool(f.Value);
}
} else {
}
else
{
int c; s.rInt(out c);
flags = new Dictionary<string, bool>(c, StringComparer.Ordinal);
for(int i = 0; i < c; i++) {
for(int i = 0; i < c; i++)
{
string t; s.rString(out t);
bool b; s.rBool(out b);
flags.Add(t, b);
@ -456,16 +461,16 @@ namespace CodeImp.DoomBuilder.Map
#region ================== Methods
// This checks and returns a flag without creating it
public bool IsFlagSet(string flagname) {
if(flags.ContainsKey(flagname))
return flags[flagname];
else
return false;
public bool IsFlagSet(string flagname)
{
return flags.ContainsKey(flagname) && flags[flagname];
}
// This sets a flag
public void SetFlag(string flagname, bool value) {
if(!flags.ContainsKey(flagname) || (IsFlagSet(flagname) != value)) {
public void SetFlag(string flagname, bool value)
{
if(!flags.ContainsKey(flagname) || (IsFlagSet(flagname) != value))
{
BeforePropsChange();
flags[flagname] = value;
@ -473,14 +478,15 @@ namespace CodeImp.DoomBuilder.Map
}
// This returns a copy of the flags dictionary
public Dictionary<string, bool> GetFlags() {
public Dictionary<string, bool> GetFlags()
{
return new Dictionary<string, bool>(flags);
}
// This clears all flags
public void ClearFlags() {
public void ClearFlags()
{
BeforePropsChange();
flags.Clear();
}
@ -609,8 +615,8 @@ namespace CodeImp.DoomBuilder.Map
// Apply changes
this.floorheight = hfloor;
this.ceilheight = hceil;
SetFloorTexture(tfloor);
SetCeilTexture(tceil);
//SetFloorTexture(tfloor);
//SetCeilTexture(tceil);
this.effect = effect;
this.tag = tag;
this.flags = new Dictionary<string, bool>(flags); //mxd
@ -619,6 +625,19 @@ namespace CodeImp.DoomBuilder.Map
this.floorslope = floorslope; //mxd
this.ceiloffset = ceiloffset; //mxd
this.ceilslope = ceilslope; //mxd
//mxd. Set ceil texture
if(string.IsNullOrEmpty(tceil)) tceil = "-";
ceiltexname = tceil;
longceiltexname = Lump.MakeLongName(ceiltexname);
//mxd. Set floor texture
if(string.IsNullOrEmpty(tfloor)) tfloor = "-"; //mxd
floortexname = tfloor;
longfloortexname = Lump.MakeLongName(tfloor);
//mxd. Map is changed
General.Map.IsChanged = true;
updateneeded = true;
}
@ -629,7 +648,7 @@ namespace CodeImp.DoomBuilder.Map
if(string.IsNullOrEmpty(name)) name = "-"; //mxd
floortexname = name;
longfloortexname = Lump.MakeLongName(name);
longfloortexname = General.Map.Data.GetFullLongFlatName(Lump.MakeLongName(name)); //mxd
updateneeded = true;
General.Map.IsChanged = true;
}
@ -641,24 +660,44 @@ namespace CodeImp.DoomBuilder.Map
if(string.IsNullOrEmpty(name)) name = "-"; //mxd
ceiltexname = name;
longceiltexname = Lump.MakeLongName(name);
longceiltexname = General.Map.Data.GetFullLongFlatName(Lump.MakeLongName(name)); //mxd
updateneeded = true;
General.Map.IsChanged = true;
}
//mxd. This sets texture lookup
internal void SetFloorTexture(long hash)
{
BeforePropsChange();
longfloortexname = hash;
updateneeded = true;
General.Map.IsChanged = true;
}
//mxd. This sets texture lookup
internal void SetCeilTexture(long hash)
{
BeforePropsChange();
longceiltexname = hash;
updateneeded = true;
General.Map.IsChanged = true;
}
//mxd
public void UpdateFogColor() {
public void UpdateFogColor()
{
useOutsideFog = General.Map.Data.MapInfo.HasOutsideFogColor && ceiltexname == General.Map.Config.SkyFlatName;
if(General.Map.UDMF && Fields.ContainsKey("fadecolor")) {
if(General.Map.UDMF && Fields.ContainsKey("fadecolor"))
fogColor = new Color4((int)Fields["fadecolor"].Value);
} else if(useOutsideFog) {
else if(useOutsideFog)
fogColor = General.Map.Data.MapInfo.OutsideFogColor;
} else if(General.Map.Data.MapInfo.HasFadeColor) {
else if(General.Map.Data.MapInfo.HasFadeColor)
fogColor = General.Map.Data.MapInfo.FadeColor;
} else {
else
fogColor = new Color4();
}
hasFogColor = fogColor.Red > 0 || fogColor.Green > 0 || fogColor.Blue > 0;
}

View file

@ -169,19 +169,24 @@ namespace CodeImp.DoomBuilder.Map
base.ReadWrite(s);
//mxd
if(s.IsWriting) {
if(s.IsWriting)
{
s.wInt(flags.Count);
foreach(KeyValuePair<string, bool> f in flags) {
foreach(KeyValuePair<string, bool> f in flags)
{
s.wString(f.Key);
s.wBool(f.Value);
}
} else {
}
else
{
int c;
s.rInt(out c);
flags = new Dictionary<string, bool>(c, StringComparer.Ordinal);
for(int i = 0; i < c; i++) {
for(int i = 0; i < c; i++)
{
string t;
s.rString(out t);
bool b;
@ -302,7 +307,8 @@ namespace CodeImp.DoomBuilder.Map
// This sets a flag
public void SetFlag(string flagname, bool value)
{
if(!flags.ContainsKey(flagname) || (IsFlagSet(flagname) != value)) {
if(!flags.ContainsKey(flagname) || (IsFlagSet(flagname) != value))
{
BeforePropsChange();
flags[flagname] = value;
}
@ -375,7 +381,8 @@ namespace CodeImp.DoomBuilder.Map
}
// The middle texture can be removed regardless of any sector tag or linedef action
if(!MiddleRequired() && removemiddle) {
if(!MiddleRequired() && removemiddle)
{
if(!changed) BeforePropsChange(); //mxd
this.texnamemid = "-";
this.longtexnamemid = MapSet.EmptyLongName;
@ -565,9 +572,24 @@ namespace CodeImp.DoomBuilder.Map
this.offsetx = offsetx;
this.offsety = offsety;
this.flags = new Dictionary<string, bool>(flags); //mxd
SetTextureMid(tmid);
SetTextureLow(tlow);
SetTextureHigh(thigh);
//SetTextureMid(tmid);
//SetTextureLow(tlow);
//SetTextureHigh(thigh);
//mxd. Set mid texture
texnamemid = string.IsNullOrEmpty(tmid) ? "-" : tmid;
longtexnamemid = Lump.MakeLongName(tmid);
//mxd. Set low texture
texnamelow = string.IsNullOrEmpty(tlow) ? "-" : tlow;
longtexnamelow = Lump.MakeLongName(tlow);
//mxd. Set high texture
texnamehigh = string.IsNullOrEmpty(thigh) ? "-" : thigh;
longtexnamehigh = Lump.MakeLongName(texnamehigh);
//mxd. Map is changed
General.Map.IsChanged = true;
}
// This sets texture
@ -575,9 +597,8 @@ namespace CodeImp.DoomBuilder.Map
{
BeforePropsChange();
if(string.IsNullOrEmpty(name)) name = "-"; //mxd
texnamehigh = name;
longtexnamehigh = Lump.MakeLongName(name);
texnamehigh = string.IsNullOrEmpty(name) ? "-" : name; //mxd
longtexnamehigh = General.Map.Data.GetFullLongTextureName(Lump.MakeLongName(name)); //mxd
General.Map.IsChanged = true;
}
@ -586,9 +607,8 @@ namespace CodeImp.DoomBuilder.Map
{
BeforePropsChange();
if (string.IsNullOrEmpty(name)) name = "-"; //mxd
texnamemid = name;
longtexnamemid = Lump.MakeLongName(name);
texnamemid = string.IsNullOrEmpty(name) ? "-" : name; //mxd;
longtexnamemid = General.Map.Data.GetFullLongTextureName(Lump.MakeLongName(name)); //mxd
General.Map.IsChanged = true;
}
@ -597,9 +617,35 @@ namespace CodeImp.DoomBuilder.Map
{
BeforePropsChange();
if(string.IsNullOrEmpty(name)) name = "-"; //mxd
texnamelow = name;
longtexnamelow = Lump.MakeLongName(name);
texnamelow = string.IsNullOrEmpty(name) ? "-" : name; //mxd;
longtexnamelow = General.Map.Data.GetFullLongTextureName(Lump.MakeLongName(name)); //mxd
General.Map.IsChanged = true;
}
//mxd. This sets texture lookup
public void SetTextureHigh(long hash)
{
BeforePropsChange();
longtexnamehigh = hash;
General.Map.IsChanged = true;
}
//mxd. This sets texture lookup
public void SetTextureMid(long hash)
{
BeforePropsChange();
longtexnamemid = hash;
General.Map.IsChanged = true;
}
//mxd. This sets texture lookup
public void SetTextureLow(long hash)
{
BeforePropsChange();
longtexnamelow = hash;
General.Map.IsChanged = true;
}

View file

@ -130,6 +130,13 @@ namespace CodeImp.DoomBuilder.Properties {
}
}
internal static System.Drawing.Bitmap Collapse {
get {
object obj = ResourceManager.GetObject("Collapse", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
internal static System.Drawing.Bitmap ColorPick {
get {
object obj = ResourceManager.GetObject("ColorPick", resourceCulture);
@ -165,6 +172,13 @@ namespace CodeImp.DoomBuilder.Properties {
}
}
internal static System.Drawing.Bitmap Expand {
get {
object obj = ResourceManager.GetObject("Expand", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
internal static System.Drawing.Bitmap Failed {
get {
object obj = ResourceManager.GetObject("Failed", resourceCulture);

View file

@ -454,4 +454,10 @@
<data name="WordWrap" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\WordWrap.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="Collapse" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\Collapse.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="Expand" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\Expand.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
</root>

View file

@ -1161,7 +1161,8 @@ namespace CodeImp.DoomBuilder.Rendering
graphics.Shaders.Things2D.BeginPass(1);
float spriteShrink = General.Settings.SquareThings ? THING_SPRITE_SHRINK : THING_SPRITE_SHRINK * 2;
foreach(KeyValuePair<int, List<Thing>> group in thingsByType){
foreach(KeyValuePair<int, List<Thing>> group in thingsByType)
{
// Find thing information
ThingTypeInfo info = General.Map.Data.GetThingInfo(group.Key);
@ -1170,7 +1171,8 @@ namespace CodeImp.DoomBuilder.Rendering
ImageData sprite = General.Map.Data.GetSpriteImage(info.Sprite);
if (sprite == null) continue;
if (!sprite.IsImageLoaded) {
if (!sprite.IsImageLoaded)
{
sprite.SetUsedInMap(true);
continue;
}
@ -1190,30 +1192,35 @@ namespace CodeImp.DoomBuilder.Rendering
float spriteWidth, spriteHeight;
float spriteScale = (group.Value[0].FixedSize && (scale > 1.0f)) ? 1.0f : scale;
if(sprite.Width > sprite.Height) {
if(sprite.Width > sprite.Height)
{
spriteWidth = info.Radius * spriteScale - spriteShrink * spriteScale;
spriteHeight = spriteWidth * ((float)sprite.Height / sprite.Width);
if(spriteWidth < MINIMUM_SPRITE_RADIUS) continue; //don't render tiny little sprites
} else if(sprite.Width < sprite.Height) {
}
else if(sprite.Width < sprite.Height)
{
spriteHeight = info.Radius * spriteScale - spriteShrink * spriteScale;
spriteWidth = spriteHeight * ((float)sprite.Width / sprite.Height);
if(spriteHeight < MINIMUM_SPRITE_RADIUS) continue; //don't render tiny little sprites
} else {
}
else
{
spriteWidth = info.Radius * spriteScale - spriteShrink * spriteScale;
spriteHeight = spriteWidth;
if(spriteWidth < MINIMUM_SPRITE_RADIUS) continue; //don't render tiny little sprites
}
foreach(Thing t in group.Value) {
foreach(Thing t in group.Value)
{
if(t.IsModel && (General.Settings.GZDrawModelsMode == ModelRenderMode.ALL || (General.Settings.GZDrawModelsMode == ModelRenderMode.SELECTION && t.Selected))) continue;
CreateThingSpriteVerts(thingsByPosition[t], spriteWidth, spriteHeight, ref verts, buffercount * 6, t.Selected ? selectionColor : 0xFFFFFF);
buffercount++;
totalcount++;
// Buffer filled?
if(buffercount == locksize) {
if(buffercount == locksize)
{
// Write to buffer
stream = thingsvertices.Lock(0, locksize * 6 * FlatVertex.Stride, LockFlags.Discard);
stream.WriteRange(verts, 0, buffercount * 6);
@ -1257,7 +1264,8 @@ namespace CodeImp.DoomBuilder.Rendering
buffercount = 0;
totalcount = 0;
foreach (KeyValuePair<Thing, Vector2D> group in thingsByPosition) {
foreach (KeyValuePair<Thing, Vector2D> group in thingsByPosition)
{
if(!group.Key.IsDirectional) continue;
CreateThingArrowVerts(group.Key, ref verts, group.Value, buffercount * 6);
@ -1265,7 +1273,8 @@ namespace CodeImp.DoomBuilder.Rendering
totalcount++;
// Buffer filled?
if(buffercount == locksize) {
if(buffercount == locksize)
{
// Write to buffer
stream = thingsvertices.Lock(0, locksize * 6 * FlatVertex.Stride, LockFlags.Discard);
stream.WriteRange(verts, 0, buffercount * 6);

View file

@ -637,7 +637,7 @@ namespace CodeImp.DoomBuilder.Rendering
img = General.Map.Data.WhiteTexture;
}
}
else if(longimagename == Lump.MakeLongName("-")) //mxd
else if(longimagename == MapSet.EmptyLongName) //mxd
{
img = General.Map.Data.MissingTexture3D;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 494 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 490 B

View file

@ -17,13 +17,15 @@ namespace CodeImp.DoomBuilder.Windows
public MapOptions Options { get { return options; } }
public ChangeMapForm(string filepathname, MapOptions options) {
public ChangeMapForm(string filepathname, MapOptions options)
{
InitializeComponent();
this.options = options;
this.filepathname = filepathname;
}
private void LoadSettings() {
private void LoadSettings()
{
int scanindex, checkoffset;
int lumpsfound, lumpsrequired = 0;
string lumpname;
@ -84,9 +86,11 @@ namespace CodeImp.DoomBuilder.Windows
IDictionary maplumpnames = ci.Configuration.ReadSetting("maplumpnames", new Hashtable());
// Count how many required lumps we have to find
foreach(DictionaryEntry ml in maplumpnames) {
foreach(DictionaryEntry ml in maplumpnames)
{
// Ignore the map header (it will not be found because the name is different)
if(ml.Key.ToString() != MapManager.CONFIG_MAP_HEADER) {
if(ml.Key.ToString() != MapManager.CONFIG_MAP_HEADER)
{
// Read lump setting and count it
if(ci.Configuration.ReadSetting("maplumpnames." + ml.Key + ".required", false))
lumpsrequired++;
@ -94,16 +98,19 @@ namespace CodeImp.DoomBuilder.Windows
}
// Go for all the lumps in the wad
for(scanindex = 0; scanindex < (wadfile.Lumps.Count - 1); scanindex++) {
for(scanindex = 0; scanindex < (wadfile.Lumps.Count - 1); scanindex++)
{
// Make sure this lump is not part of the map
if(!maplumpnames.Contains(wadfile.Lumps[scanindex].Name)) {
if(!maplumpnames.Contains(wadfile.Lumps[scanindex].Name))
{
// Reset check
lumpsfound = 0;
checkoffset = 1;
// Continue while still within bounds and lumps are still recognized
while(((scanindex + checkoffset) < wadfile.Lumps.Count) &&
maplumpnames.Contains(wadfile.Lumps[scanindex + checkoffset].Name)) {
maplumpnames.Contains(wadfile.Lumps[scanindex + checkoffset].Name))
{
// Count the lump when it is marked as required
lumpname = wadfile.Lumps[scanindex + checkoffset].Name;
if(ci.Configuration.ReadSetting("maplumpnames." + lumpname + ".required", false))
@ -128,9 +135,11 @@ namespace CodeImp.DoomBuilder.Windows
mapslist.Sort();
//select current map
foreach(ListViewItem item in mapslist.Items) {
foreach(ListViewItem item in mapslist.Items)
{
// Was this item previously selected?
if(item.Text == options.LevelName) {
if(item.Text == options.LevelName)
{
// Select it again
item.Selected = true;
break;
@ -145,16 +154,19 @@ namespace CodeImp.DoomBuilder.Windows
Cursor.Current = Cursors.Default;
}
private void ChangeMapForm_Shown(object sender, EventArgs e){
private void ChangeMapForm_Shown(object sender, EventArgs e)
{
LoadSettings();
}
private void mapslist_DoubleClick(object sender, EventArgs e) {
private void mapslist_DoubleClick(object sender, EventArgs e)
{
// Click OK
if(mapslist.SelectedItems.Count > 0) apply.PerformClick();
}
private void apply_Click(object sender, EventArgs e) {
private void apply_Click(object sender, EventArgs e)
{
if (mapslist.SelectedItems.Count < 1)
{
General.ShowWarningMessage("Please select a map first!", MessageBoxButtons.OK);
@ -166,16 +178,20 @@ namespace CodeImp.DoomBuilder.Windows
return;
}
// Create new map options
options = new MapOptions(mapsettings, mapslist.SelectedItems[0].Text);
// Create new map options, pass settings which should stay unchanged
//TODO: are there other settings which should stay unchanged?..
MapOptions newoptions = new MapOptions(mapsettings, mapslist.SelectedItems[0].Text);
newoptions.ConfigFile = options.ConfigFile;
options = newoptions;
// Hide window
this.DialogResult = DialogResult.OK;
this.Close();
}
private void cancel_Click(object sender, EventArgs e) {
// Just hide window
private void cancel_Click(object sender, EventArgs e)
{
// Just hide the window
this.DialogResult = DialogResult.Cancel;
this.Close();
}

View file

@ -40,6 +40,13 @@ namespace CodeImp.DoomBuilder.Windows
{
this.Opacity = 0; //mxd
//mxd. And now, let's hope this doesn't horribly break anything...
if(!(this is MainForm))
{
this.KeyPreview = true;
this.KeyUp += OnKeyUp;
}
// Create a timer that we need to show the form
formshowtimer = new Timer();
formshowtimer.Interval = 1;
@ -73,11 +80,12 @@ namespace CodeImp.DoomBuilder.Windows
}
}
// Block this. MainForm overrides this, so it's only called from child DelayedForms (mxd).
protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
//mxd. Special handling to call "save screenshot" actions from any form,
//which inherits form DelayedForm and either doesn't override OnKeyUp, or calls base.OnKeyUp
private void OnKeyUp(object sender, KeyEventArgs e)
{
if(Form.ActiveForm == this) ProcessSaveScreenshotAction((int)keyData);
return false;
e.Handled = (Form.ActiveForm == this && ProcessSaveScreenshotAction((int)e.KeyData));
if(e.Handled) e.SuppressKeyPress = true;
}
// mxd. Handle screenshot saving from any form
@ -97,14 +105,14 @@ namespace CodeImp.DoomBuilder.Windows
}
//mxd
[BeginAction("savescreenshot", BaseAction = true)]
[EndAction("savescreenshot", BaseAction = true)]
internal void SaveScreenshot()
{
if(Form.ActiveForm == this) General.MainWindow.SaveScreenshot(false);
}
//mxd
[BeginAction("saveeditareascreenshot", BaseAction = true)]
[EndAction("saveeditareascreenshot", BaseAction = true)]
internal void SaveEditAreaScreenshot()
{
if(Form.ActiveForm == this) General.MainWindow.SaveScreenshot(true);

View file

@ -1428,7 +1428,8 @@ namespace CodeImp.DoomBuilder.Windows
}
//mxd. Sometimes it's handeled by RenderTargetControl, not by MainForm leading to keys being "stuck"
private void display_OnKeyReleased(object sender, KeyEventArgs e) {
private void display_OnKeyReleased(object sender, KeyEventArgs e)
{
MainForm_KeyUp(sender, e);
}

View file

@ -41,7 +41,6 @@ namespace CodeImp.DoomBuilder.Windows
this.apply = new System.Windows.Forms.Button();
this.cancel = new System.Windows.Forms.Button();
this.panelres = new System.Windows.Forms.GroupBox();
this.uselongtexturenames = new System.Windows.Forms.CheckBox();
this.strictpatches = new System.Windows.Forms.CheckBox();
this.datalocations = new CodeImp.DoomBuilder.Controls.ResourceListEditor();
label3 = new System.Windows.Forms.Label();
@ -64,12 +63,12 @@ namespace CodeImp.DoomBuilder.Windows
//
// label2
//
label2.Location = new System.Drawing.Point(13, 83);
label2.AutoSize = true;
label2.Location = new System.Drawing.Point(58, 83);
label2.Name = "label2";
label2.Size = new System.Drawing.Size(110, 14);
label2.Size = new System.Drawing.Size(65, 14);
label2.TabIndex = 7;
label2.Text = "Level name:";
label2.TextAlign = System.Drawing.ContentAlignment.TopRight;
//
// label1
//
@ -77,7 +76,7 @@ namespace CodeImp.DoomBuilder.Windows
label1.Name = "label1";
label1.Size = new System.Drawing.Size(110, 14);
label1.TabIndex = 5;
label1.Text = "Game configuration:";
label1.Text = "Game Configuration:";
label1.TextAlign = System.Drawing.ContentAlignment.TopRight;
//
// panelsettings
@ -125,7 +124,7 @@ namespace CodeImp.DoomBuilder.Windows
this.scriptcompilerlabel.Name = "scriptcompilerlabel";
this.scriptcompilerlabel.Size = new System.Drawing.Size(110, 14);
this.scriptcompilerlabel.TabIndex = 11;
this.scriptcompilerlabel.Text = "Script type:";
this.scriptcompilerlabel.Text = "Script Type:";
this.scriptcompilerlabel.TextAlign = System.Drawing.ContentAlignment.TopRight;
//
// levelname
@ -153,7 +152,7 @@ namespace CodeImp.DoomBuilder.Windows
// label4
//
label4.AutoSize = true;
label4.Location = new System.Drawing.Point(15, 210);
label4.Location = new System.Drawing.Point(15, 190);
label4.Name = "label4";
label4.Size = new System.Drawing.Size(312, 42);
label4.TabIndex = 17;
@ -164,7 +163,7 @@ namespace CodeImp.DoomBuilder.Windows
// apply
//
this.apply.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.apply.Location = new System.Drawing.Point(297, 400);
this.apply.Location = new System.Drawing.Point(297, 378);
this.apply.Name = "apply";
this.apply.Size = new System.Drawing.Size(112, 25);
this.apply.TabIndex = 2;
@ -176,7 +175,7 @@ namespace CodeImp.DoomBuilder.Windows
//
this.cancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.cancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.cancel.Location = new System.Drawing.Point(179, 400);
this.cancel.Location = new System.Drawing.Point(179, 378);
this.cancel.Name = "cancel";
this.cancel.Size = new System.Drawing.Size(112, 25);
this.cancel.TabIndex = 3;
@ -188,27 +187,16 @@ namespace CodeImp.DoomBuilder.Windows
//
this.panelres.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.panelres.Controls.Add(this.uselongtexturenames);
this.panelres.Controls.Add(this.strictpatches);
this.panelres.Controls.Add(this.datalocations);
this.panelres.Controls.Add(label4);
this.panelres.Location = new System.Drawing.Point(12, 130);
this.panelres.Name = "panelres";
this.panelres.Size = new System.Drawing.Size(397, 260);
this.panelres.Size = new System.Drawing.Size(397, 240);
this.panelres.TabIndex = 1;
this.panelres.TabStop = false;
this.panelres.Text = " Resources ";
//
// uselongtexturenames
//
this.uselongtexturenames.AutoSize = true;
this.uselongtexturenames.Location = new System.Drawing.Point(15, 51);
this.uselongtexturenames.Name = "uselongtexturenames";
this.uselongtexturenames.Size = new System.Drawing.Size(140, 18);
this.uselongtexturenames.TabIndex = 21;
this.uselongtexturenames.Text = "Use long texture names";
this.uselongtexturenames.UseVisualStyleBackColor = true;
//
// strictpatches
//
this.strictpatches.AutoSize = true;
@ -224,7 +212,7 @@ namespace CodeImp.DoomBuilder.Windows
this.datalocations.AllowDrop = true;
this.datalocations.DialogOffset = new System.Drawing.Point(40, 20);
this.datalocations.Font = new System.Drawing.Font("Arial", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.datalocations.Location = new System.Drawing.Point(15, 75);
this.datalocations.Location = new System.Drawing.Point(15, 57);
this.datalocations.Name = "datalocations";
this.datalocations.Size = new System.Drawing.Size(368, 130);
this.datalocations.TabIndex = 0;
@ -235,7 +223,7 @@ namespace CodeImp.DoomBuilder.Windows
this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
this.CancelButton = this.cancel;
this.ClientSize = new System.Drawing.Size(421, 433);
this.ClientSize = new System.Drawing.Size(421, 411);
this.Controls.Add(this.panelres);
this.Controls.Add(this.cancel);
this.Controls.Add(this.apply);
@ -271,7 +259,6 @@ namespace CodeImp.DoomBuilder.Windows
private System.Windows.Forms.ComboBox scriptcompiler;
private System.Windows.Forms.Label scriptcompilerlabel;
private System.Windows.Forms.Label examplelabel;
private System.Windows.Forms.CheckBox uselongtexturenames;
}

View file

@ -43,8 +43,7 @@ namespace CodeImp.DoomBuilder.Windows
public MapOptionsForm(MapOptions options, bool newmap)
{
this.newmap = newmap;
int index;
// Initialize
InitializeComponent();
@ -58,7 +57,7 @@ namespace CodeImp.DoomBuilder.Windows
if(!General.Configs[i].Enabled) continue;
// Add config name to list
index = config.Items.Add(General.Configs[i]);
int index = config.Items.Add(General.Configs[i]);
//mxd.
if(newmap && !string.IsNullOrEmpty(General.Settings.LastUsedConfigName) && General.Configs[i].Name == General.Settings.LastUsedConfigName)
@ -169,16 +168,6 @@ namespace CodeImp.DoomBuilder.Windows
return;
}
//mxd. Long texture names
if(!newmap && !uselongtexturenames.Checked && options.UseLongTextureNames &&
MessageBox.Show(this, "Switching to short texture names may lead to texture and flat name conflicts. Do you want to continue?",
Application.ProductName, MessageBoxButtons.YesNo, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button2) == DialogResult.No)
{
return;
}
options.UseLongTextureNames = uselongtexturenames.Checked;
// Collect information
ConfigurationInfo configinfo = config.SelectedItem as ConfigurationInfo; //mxd
DataLocationList locations = datalocations.GetResources();
@ -322,10 +311,6 @@ namespace CodeImp.DoomBuilder.Windows
{
scriptcompiler.SelectedIndex = -1;
}
//mxd. Long texture names
uselongtexturenames.Enabled = ci.SupportsLongTextureNames;
uselongtexturenames.Checked = (ci.SupportsLongTextureNames && options.UseLongTextureNames);
// Show resources
datalocations.FixedResourceLocationList(ci.Resources);

View file

@ -33,7 +33,6 @@ namespace CodeImp.DoomBuilder.Windows
System.Windows.Forms.Label label2;
System.Windows.Forms.Label label3;
this.panelres = new System.Windows.Forms.GroupBox();
this.uselongtexturenames = new System.Windows.Forms.CheckBox();
this.strictpatches = new System.Windows.Forms.CheckBox();
this.datalocations = new CodeImp.DoomBuilder.Controls.ResourceListEditor();
this.apply = new System.Windows.Forms.Button();
@ -59,7 +58,7 @@ namespace CodeImp.DoomBuilder.Windows
label1.Name = "label1";
label1.Size = new System.Drawing.Size(120, 14);
label1.TabIndex = 14;
label1.Text = "Game configuration:";
label1.Text = "Game Configuration:";
label1.TextAlign = System.Drawing.ContentAlignment.TopRight;
//
// label2
@ -74,7 +73,7 @@ namespace CodeImp.DoomBuilder.Windows
// label3
//
label3.AutoSize = true;
label3.Location = new System.Drawing.Point(14, 210);
label3.Location = new System.Drawing.Point(14, 191);
label3.Name = "label3";
label3.Size = new System.Drawing.Size(312, 42);
label3.TabIndex = 17;
@ -86,27 +85,16 @@ namespace CodeImp.DoomBuilder.Windows
//
this.panelres.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.panelres.Controls.Add(this.uselongtexturenames);
this.panelres.Controls.Add(this.strictpatches);
this.panelres.Controls.Add(this.datalocations);
this.panelres.Controls.Add(label3);
this.panelres.Location = new System.Drawing.Point(12, 246);
this.panelres.Name = "panelres";
this.panelres.Size = new System.Drawing.Size(396, 264);
this.panelres.Size = new System.Drawing.Size(396, 240);
this.panelres.TabIndex = 2;
this.panelres.TabStop = false;
this.panelres.Text = " Resources ";
//
// uselongtexturenames
//
this.uselongtexturenames.AutoSize = true;
this.uselongtexturenames.Location = new System.Drawing.Point(14, 51);
this.uselongtexturenames.Name = "uselongtexturenames";
this.uselongtexturenames.Size = new System.Drawing.Size(140, 18);
this.uselongtexturenames.TabIndex = 20;
this.uselongtexturenames.Text = "Use long texture names";
this.uselongtexturenames.UseVisualStyleBackColor = true;
//
// strictpatches
//
this.strictpatches.AutoSize = true;
@ -122,7 +110,7 @@ namespace CodeImp.DoomBuilder.Windows
this.datalocations.AllowDrop = true;
this.datalocations.DialogOffset = new System.Drawing.Point(40, 20);
this.datalocations.Font = new System.Drawing.Font("Arial", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.datalocations.Location = new System.Drawing.Point(14, 75);
this.datalocations.Location = new System.Drawing.Point(14, 58);
this.datalocations.Name = "datalocations";
this.datalocations.Size = new System.Drawing.Size(368, 127);
this.datalocations.TabIndex = 0;
@ -130,7 +118,7 @@ namespace CodeImp.DoomBuilder.Windows
// apply
//
this.apply.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.apply.Location = new System.Drawing.Point(296, 517);
this.apply.Location = new System.Drawing.Point(296, 496);
this.apply.Name = "apply";
this.apply.Size = new System.Drawing.Size(112, 25);
this.apply.TabIndex = 3;
@ -142,7 +130,7 @@ namespace CodeImp.DoomBuilder.Windows
//
this.cancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.cancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.cancel.Location = new System.Drawing.Point(178, 516);
this.cancel.Location = new System.Drawing.Point(178, 495);
this.cancel.Name = "cancel";
this.cancel.Size = new System.Drawing.Size(112, 25);
this.cancel.TabIndex = 4;
@ -203,7 +191,7 @@ namespace CodeImp.DoomBuilder.Windows
this.scriptcompilerlabel.Name = "scriptcompilerlabel";
this.scriptcompilerlabel.Size = new System.Drawing.Size(120, 14);
this.scriptcompilerlabel.TabIndex = 18;
this.scriptcompilerlabel.Text = "Script type:";
this.scriptcompilerlabel.Text = "Script Type:";
this.scriptcompilerlabel.TextAlign = System.Drawing.ContentAlignment.TopRight;
//
// OpenMapOptionsForm
@ -212,7 +200,7 @@ namespace CodeImp.DoomBuilder.Windows
this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
this.CancelButton = this.cancel;
this.ClientSize = new System.Drawing.Size(420, 551);
this.ClientSize = new System.Drawing.Size(420, 530);
this.Controls.Add(this.scriptcompiler);
this.Controls.Add(this.scriptcompilerlabel);
this.Controls.Add(this.mapslist);
@ -251,7 +239,6 @@ namespace CodeImp.DoomBuilder.Windows
private System.Windows.Forms.CheckBox strictpatches;
private System.Windows.Forms.ComboBox scriptcompiler;
private System.Windows.Forms.Label scriptcompilerlabel;
private System.Windows.Forms.CheckBox uselongtexturenames;
}

View file

@ -109,38 +109,44 @@ namespace CodeImp.DoomBuilder.Windows
mapsettings = new Configuration(true);
// Check strict patches box, check what game configuration is preferred
if (options != null) {
if (options != null)
{
strictpatches.Checked = options.StrictPatches;
gameconfig = options.ConfigFile;
} else {
}
else
{
strictpatches.Checked = mapsettings.ReadSetting("strictpatches", false);
gameconfig = mapsettings.ReadSetting("gameconfig", "");
}
//mxd. Fill script compilers list
foreach(KeyValuePair<string, ScriptConfiguration> group in General.CompiledScriptConfigs) {
foreach(KeyValuePair<string, ScriptConfiguration> group in General.CompiledScriptConfigs)
{
scriptcompiler.Items.Add(group.Value);
}
//mxd. Go for all enabled configurations
for(int i = 0; i < General.Configs.Count; i++) {
for(int i = 0; i < General.Configs.Count; i++)
{
if(!General.Configs[i].Enabled) continue;
// Add config name to list
index = config.Items.Add(General.Configs[i]);
if(General.Configs[i].Filename == gameconfig) {
// Select this item
config.SelectedIndex = index;
}
// Select this item
if(General.Configs[i].Filename == gameconfig) config.SelectedIndex = index;
}
//mxd. No dice? Try disabled ones
if(config.SelectedIndex == -1) {
for(int i = 0; i < General.Configs.Count; i++) {
if(config.SelectedIndex == -1)
{
for(int i = 0; i < General.Configs.Count; i++)
{
if(General.Configs[i].Enabled) continue;
if(General.Configs[i].Filename == gameconfig) {
if(General.Configs[i].Filename == gameconfig)
{
//add and Select this item
config.SelectedIndex = config.Items.Add(General.Configs[i]);
break;
@ -149,7 +155,8 @@ namespace CodeImp.DoomBuilder.Windows
}
// Still no configuration selected?
if(config.SelectedIndex == -1) {
if(config.SelectedIndex == -1)
{
// Then go for all configurations to find a suitable one
for(int i = 0; i < General.Configs.Count; i++)
{
@ -158,10 +165,13 @@ namespace CodeImp.DoomBuilder.Windows
{
//mxd. Already added?
index = config.Items.IndexOf(General.Configs[i]);
if (index != -1) {
if (index != -1)
{
// Select this item
config.SelectedIndex = index;
} else {
}
else
{
// Add and select this item
config.SelectedIndex = config.Items.Add(General.Configs[i]);
}
@ -186,9 +196,11 @@ namespace CodeImp.DoomBuilder.Windows
IDictionary maplumpnames = cfg.ReadSetting("maplumpnames", new Hashtable());
// Count how many required lumps we have to find
foreach(DictionaryEntry ml in maplumpnames) {
foreach(DictionaryEntry ml in maplumpnames)
{
// Ignore the map header (it will not be found because the name is different)
if(ml.Key.ToString() != MapManager.CONFIG_MAP_HEADER) {
if(ml.Key.ToString() != MapManager.CONFIG_MAP_HEADER)
{
// Read lump setting and count it
if(cfg.ReadSetting("maplumpnames." + ml.Key + ".required", false))
lumpsrequired++;
@ -196,19 +208,23 @@ namespace CodeImp.DoomBuilder.Windows
}
// Go for all the lumps in the wad
for(scanindex = 0; scanindex < (wadfile.Lumps.Count - 1); scanindex++) {
for(scanindex = 0; scanindex < (wadfile.Lumps.Count - 1); scanindex++)
{
// Make sure this lump is not part of the map.
if(!maplumpnames.Contains(wadfile.Lumps[scanindex].Name)) {
if(!maplumpnames.Contains(wadfile.Lumps[scanindex].Name))
{
// Reset check
lumpsfound = 0;
checkoffset = 1;
// Continue while still within bounds and lumps are still recognized
while(((scanindex + checkoffset) < wadfile.Lumps.Count) &&
maplumpnames.Contains(wadfile.Lumps[scanindex + checkoffset].Name)) {
maplumpnames.Contains(wadfile.Lumps[scanindex + checkoffset].Name))
{
lumpname = wadfile.Lumps[scanindex + checkoffset].Name;
//mxd. Lump cannot present in current map format, fail this check
if(cfg.ReadSetting("maplumpnames." + lumpname + ".forbidden", false)) {
if(cfg.ReadSetting("maplumpnames." + lumpname + ".forbidden", false))
{
lumpsfound = -1;
break;
}
@ -256,9 +272,11 @@ namespace CodeImp.DoomBuilder.Windows
IDictionary maplumpnames = cfg.ReadSetting("maplumpnames", new Hashtable());
// Count how many required lumps we have to find
foreach(DictionaryEntry ml in maplumpnames) {
foreach(DictionaryEntry ml in maplumpnames)
{
// Ignore the map header (it will not be found because the name is different)
if(ml.Key.ToString() != MapManager.CONFIG_MAP_HEADER) {
if(ml.Key.ToString() != MapManager.CONFIG_MAP_HEADER)
{
// Read lump setting and count it
if(cfg.ReadSetting("maplumpnames." + ml.Key + ".required", false))
lumpsrequired++;
@ -266,19 +284,23 @@ namespace CodeImp.DoomBuilder.Windows
}
// Go for all the lumps in the wad
for(scanindex = 0; scanindex < (wadfile.Lumps.Count - 1); scanindex++) {
for(scanindex = 0; scanindex < (wadfile.Lumps.Count - 1); scanindex++)
{
// Make sure this lump is not part of the map.
if(!maplumpnames.Contains(wadfile.Lumps[scanindex].Name)) {
if(!maplumpnames.Contains(wadfile.Lumps[scanindex].Name))
{
// Reset check
lumpsfound = 0;
checkoffset = 1;
// Continue while still within bounds and lumps are still recognized
while(((scanindex + checkoffset) < wadfile.Lumps.Count) &&
maplumpnames.Contains(wadfile.Lumps[scanindex + checkoffset].Name)) {
maplumpnames.Contains(wadfile.Lumps[scanindex + checkoffset].Name))
{
lumpname = wadfile.Lumps[scanindex + checkoffset].Name;
//mxd. Lump cannot present in current map format, fail this check
if(cfg.ReadSetting("maplumpnames." + lumpname + ".forbidden", false)) {
if(cfg.ReadSetting("maplumpnames." + lumpname + ".forbidden", false))
{
lumpsfound = -1;
break;
}
@ -304,9 +326,11 @@ namespace CodeImp.DoomBuilder.Windows
mapslist.Sort();
// Go for all items in the list
foreach(ListViewItem item in mapslist.Items) {
foreach(ListViewItem item in mapslist.Items)
{
// Was this item previously selected?
if(item.Text == selectedname) {
if(item.Text == selectedname)
{
// Select it again
item.Selected = true;
break;
@ -324,10 +348,6 @@ namespace CodeImp.DoomBuilder.Windows
scriptcompilerlabel.Enabled = false;
}
//mxd. Long texture names
uselongtexturenames.Enabled = ci.SupportsLongTextureNames;
uselongtexturenames.Checked = (ci.SupportsLongTextureNames && options.UseLongTextureNames);
// Show configuration resources
datalocations.FixedResourceLocationList(ci.Resources);
}
@ -343,15 +363,6 @@ namespace CodeImp.DoomBuilder.Windows
config.Focus();
return;
}
//mxd. Use long texture names?
if (uselongtexturenames.Enabled && !options.UseLongTextureNames && uselongtexturenames.Checked &&
MessageBox.Show(this, "Switching to long texture names can make the map incompatible with some map editors and game engines. Do you want to continue?",
Application.ProductName, MessageBoxButtons.YesNo, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button2) == DialogResult.No)
{
return;
}
options.UseLongTextureNames = uselongtexturenames.Checked;
// Collect information
ConfigurationInfo configinfo = (config.SelectedItem as ConfigurationInfo); //mxd
@ -487,9 +498,6 @@ namespace CodeImp.DoomBuilder.Windows
if(!string.IsNullOrEmpty(defaultscriptconfig) && General.CompiledScriptConfigs.ContainsKey(defaultscriptconfig))
scriptconfig = defaultscriptconfig;
}
//mxd. Long texture names
if(uselongtexturenames.Enabled) uselongtexturenames.Checked = options.UseLongTextureNames;
}
//mxd. Select proper script compiler

View file

@ -121,9 +121,9 @@ namespace CodeImp.DoomBuilder.Windows
this.Controls.Add(this.apply);
this.Controls.Add(this.browser);
this.Font = new System.Drawing.Font("Arial", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.KeyPreview = true;
this.MinimizeBox = false;
this.Name = "TextureBrowserForm";
this.Opacity = 1;
this.ShowIcon = false;
this.ShowInTaskbar = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.Manual;

View file

@ -120,8 +120,9 @@ namespace CodeImp.DoomBuilder.Windows
//mxd. Select the last one that was selected
string selectname = General.Settings.ReadSetting("browserwindow.textureset", "");
TreeNode match;
if (string.IsNullOrEmpty(selectname))
if(string.IsNullOrEmpty(selectname) || selectname == "-")
{
// When texture name is empty, select "All" texture set
match = tvTextureSets.Nodes[tvTextureSets.Nodes.Count - 1];
}
else
@ -356,7 +357,7 @@ namespace CodeImp.DoomBuilder.Windows
if(browser.SelectedItem != null)
{
ImageBrowserItem item = browser.SelectedItem as ImageBrowserItem;
selectedname = item.icon.Name;
selectedname = item.TextureName;
DialogResult = DialogResult.OK;
}
else
@ -475,21 +476,21 @@ namespace CodeImp.DoomBuilder.Windows
{
// Add all available flats
foreach(ImageData img in set.Flats)
browser.Add(img.DisplayName, img, img, availgroup);
browser.Add(img, img, availgroup);
// Add all used flats
foreach(ImageData img in set.Flats)
if(img.UsedInMap) browser.Add(img.DisplayName, img, img, usedgroup);
if(img.UsedInMap) browser.Add(img, img, usedgroup);
}
else
{
// Add all available textures and mark the images for temporary loading
foreach (ImageData img in set.Textures)
browser.Add(img.DisplayName, img, img, availgroup);
browser.Add(img, img, availgroup);
// Add all used textures and mark the images for permanent loading
foreach (ImageData img in set.Textures)
if(img.UsedInMap) browser.Add(img.DisplayName, img, img, usedgroup);
if(img.UsedInMap) browser.Add(img, img, usedgroup);
}
// Done adding

View file

@ -125,7 +125,7 @@
AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj0yLjAuMC4w
LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0
ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAAAi
EAAAAk1TRnQBSQFMAgEBCAEAAfwBAAH8AQABEAEAARYBAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo
EAAAAk1TRnQBSQFMAgEBCAEAAQQBAQEEAQEBEAEAARYBAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo
AwABQAMAAUIDAAEBAQABCAUAAYABEBgAAYACAAGAAwACgAEAAYADAAGAAQABgAEAAoACAAPAAQABwAHc
AcABAAHwAcoBpgEAATMFAAEzAQABMwEAATMBAAIzAgADFgEAAxwBAAMiAQADKQEAA1UBAANNAQADQgEA
AzkBAAGAAXwB/wEAAlAB/wEAAZMBAAHWAQAB/wHsAcwBAAHGAdYB7wEAAdYC5wEAAZABqQGtAgAB/wEz
@ -163,7 +163,7 @@
AwADbQEHArwB8AIAAm0BDgIAAVIBegFSAaABcwH/AdwF2wH0AXMBUgFLAQAB7AEcAXkCdAoSAQAB6wH/
AfQJ8wH/AesDAAFtAfADBwK8AgABEQEHAewCAAFSAZoBUgH/AbwB/wYZAfMBvAFSAUsBAAIcAnQCBwPv
AfcBHAPtARIBAAHrAf8B8wH3B5IB8wH/AesDAAFtAfAB7wMHAbwCAAJtAQ4CAAFSAaANUgIAAe0BHAF0
AUsBHAj/Ae0BEgEAAfgB/wrzAf8B+AMAAW0B8ALvAwcCAAERAQcB7AIAAVIDoAEcAf8BrgGaAb0BdQHj
AUsBHAj/Ae0BEgEAAewB/wrzAf8B7AMAAW0B8ALvAwcCAAERAQcB7AIAAVIDoAEcAf8BrgGaAb0BdQHj
Aa4B/wHtAesCAAHsAXMBdAFLAfcB/wauAf8B7QESAQAB7AH/AfMI7wHyAf8B7AMAAW0B8APvAgcCAAJt
AQ4CAAFSAf8CoAH3Af8BrgL/AnUBrgH/Ae0B6wIAAZMDdAHvAf8BrgGUAf8BmgGUAa4B/wHtARIBAAHs
Af8G8wX/AewDAAFtAbwE7wEHAgABEQEHAewDAAFSAv8B7wH/Aa4BlAH/AZoBlAGuAf8B7QHrAgABHAGZ

View file

@ -170,7 +170,7 @@ namespace CodeImp.DoomBuilder.Windows
{
bool ismatch = set.IsMatch(img);
if((ismatch && matchesbutton.Checked) || (!ismatch && nomatchesbutton.Checked))
matcheslist.Add(img.Name, img, img, null, tooltiptext);
matcheslist.Add(img, img, null, tooltiptext);
}
// If not already mixed, add flats as well
@ -181,7 +181,7 @@ namespace CodeImp.DoomBuilder.Windows
{
bool ismatch = set.IsMatch(img);
if((ismatch && matchesbutton.Checked) || (!ismatch && nomatchesbutton.Checked))
matcheslist.Add(img.Name, img, img, null, tooltiptext);
matcheslist.Add(img, img, null, tooltiptext);
}
}