Fixed, Visual mode: double-sided middle texture highlighting transparency check didn't take TEXTURES scaling into account.

Fixed, long texture names: textures located in a directory/pk3/pk7 root can't have long texture names.
Fixed, texture selector controls, long texture names: both long and short texture names should be added to texture name auto-completion list. 
Changed: "Grid Increase" and "Grid Decrease" actions can now be bound to mouse wheel.
This commit is contained in:
MaxED 2015-09-01 19:44:03 +00:00
parent c407c8c351
commit dc29b59fe8
6 changed files with 52 additions and 55 deletions

View file

@ -29,29 +29,29 @@ namespace CodeImp.DoomBuilder.Actions
#region ================== Variables
// Description
private string name;
private string shortname;
private string title;
private string description;
private string category;
private readonly string name;
private readonly string shortname;
private readonly string title;
private readonly string description;
private readonly string category;
// Shortcut key
private int key;
private int keymask;
private int defaultkey;
private readonly int keymask;
private readonly int defaultkey;
// Shortcut options
private bool allowkeys;
private bool allowmouse;
private bool allowscroll;
private bool disregardshift;
private bool disregardcontrol;
private bool disregardalt; //mxd
private bool repeat;
private readonly bool allowkeys;
private readonly bool allowmouse;
private readonly bool allowscroll;
private readonly bool disregardshift;
private readonly bool disregardcontrol;
private readonly bool disregardalt; //mxd
private readonly bool repeat;
// Delegate
private List<ActionDelegate> begindelegates;
private List<ActionDelegate> enddelegates;
private readonly List<ActionDelegate> begindelegates;
private readonly List<ActionDelegate> enddelegates;
#endregion
@ -114,12 +114,6 @@ namespace CodeImp.DoomBuilder.Actions
this.key = key & keymask;
}
}
// Destructor
~Action()
{
// Moo.
}
#endregion

View file

@ -376,6 +376,9 @@ namespace CodeImp.DoomBuilder.Data
if(!textures.ContainsKey(t.Key))
{
textures.Add(t.Key, t.Value);
//mxd. Add both short and long names?
if(t.Value.HasLongName) texturenames.Add(t.Value.ShortName);
texturenames.Add(t.Value.Name);
}
}
@ -384,11 +387,14 @@ namespace CodeImp.DoomBuilder.Data
foreach(KeyValuePair<long, ImageData> f in flatsonly)
{
flats.Add(f.Key, f.Value);
//mxd. Add both short and long names?
if(f.Value.HasLongName) flatnames.Add(f.Value.ShortName);
flatnames.Add(f.Value.Name);
}
// 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)
@ -396,6 +402,9 @@ namespace CodeImp.DoomBuilder.Data
if(!flats.ContainsKey(t.Key))
{
flats.Add(t.Key, t.Value);
//mxd. Add both short and long names?
if(t.Value.HasLongName) flatnames.Add(t.Value.ShortName);
flatnames.Add(t.Value.Name);
}
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
@ -406,13 +415,8 @@ namespace CodeImp.DoomBuilder.Data
}
//mxd
foreach (KeyValuePair<long, long> t in texturenamesshorttofull)
{
if (!flatnamesshorttofull.ContainsKey(t.Key))
{
flatnamesshorttofull.Add(t.Key, t.Value);
}
}
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)
@ -420,21 +424,19 @@ namespace CodeImp.DoomBuilder.Data
if(!textures.ContainsKey(f.Key))
{
textures.Add(f.Key, f.Value);
//mxd. Add both short and long names?
if(f.Value.HasLongName) texturenames.Add(f.Value.ShortName);
texturenames.Add(f.Value.Name);
}
}
//mxd
foreach (KeyValuePair<long, long> t in flatnamesshorttofull)
{
if (!texturenamesshorttofull.ContainsKey(t.Key))
{
texturenamesshorttofull.Add(t.Key, t.Value);
}
}
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)
foreach(DataReader dr in containers)
dr.TextureSet.MixTexturesAndFlats();
}

View file

@ -78,7 +78,7 @@ namespace CodeImp.DoomBuilder.Data
internal FileImage(string name, string filepathname)
{
// Initialize
SetName(name, filepathname, true);
SetName(name, filepathname, true, true);
probableformat = ImageDataFormat.DOOMPICTURE;
@ -93,16 +93,17 @@ namespace CodeImp.DoomBuilder.Data
//mxd: name is relative path to the image ("\Textures\sometexture.png")
//mxd: filepathname is absolute path to the image ("D:\Doom\MyCoolProject\Textures\sometexture.png")
//mxd: also, zdoom uses '/' as directory separator char.
//mxd: and doesn't recognize long texture names in a root folder / pk3/7 root
private void SetName(string name, string filepathname)
{
SetName(name, filepathname, General.Map.Config.UseLongTextureNames);
SetName(name, filepathname, General.Map.Config.UseLongTextureNames, false);
}
private void SetName(string name, string filepathname, bool uselongtexturenames)
private void SetName(string name, string filepathname, bool uselongtexturenames, bool forcelongtexturename)
{
name = name.Replace(Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar);
if(!uselongtexturenames)
if(!uselongtexturenames || (!forcelongtexturename && string.IsNullOrEmpty(Path.GetDirectoryName(name))))
{
this.name = Path.GetFileNameWithoutExtension(name.ToUpperInvariant());
if (this.name.Length > DataManager.CLASIC_IMAGE_NAME_LENGTH)

View file

@ -68,7 +68,7 @@ namespace CodeImp.DoomBuilder.Data
//mxd: filepathname is relative path to the image ("Textures\sometexture.png")
protected override void SetName(string filepathname)
{
if(!General.Map.Config.UseLongTextureNames)
if(!General.Map.Config.UseLongTextureNames || string.IsNullOrEmpty(Path.GetDirectoryName(filepathname)))
{
this.name = Path.GetFileNameWithoutExtension(filepathname.ToUpperInvariant());
if (this.name.Length > DataManager.CLASIC_IMAGE_NAME_LENGTH)

View file

@ -421,9 +421,9 @@ griddec // Note, these were incorrectly swapped before, hence the wrong action
title = "Grid Increase";
category = "edit";
description = "Increases the grid size, decreasing the grid density.";
unbind = 1;
mousebuttons = 0;
mousescroll = 1;
allowkeys = true;
allowmouse = true;
allowscroll = true;
}
@ -432,9 +432,9 @@ gridinc // Note, these were incorrectly swapped before, hence the wrong action
title = "Grid Decrease";
category = "edit";
description = "Decreases the grid size, increasing the grid density.";
unbind = 1;
mousebuttons = 0;
mousescroll = 1;
allowkeys = true;
allowmouse = true;
allowscroll = true;
}
undo

View file

@ -315,7 +315,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
// Get correct offset to texture space...
float zoffset;
int ox = (int)Math.Floor((u * Sidedef.Line.Length * UDMFTools.GetFloat(Sidedef.Fields, "scalex_mid", 1.0f) + Sidedef.OffsetX + UDMFTools.GetFloat(Sidedef.Fields, "offsetx_mid")) % Texture.Width);
int ox = (int)Math.Floor((u * Sidedef.Line.Length * UDMFTools.GetFloat(Sidedef.Fields, "scalex_mid", 1.0f) / Texture.Scale.x + Sidedef.OffsetX + UDMFTools.GetFloat(Sidedef.Fields, "offsetx_mid")) % Texture.Width);
int oy;
if(repeatmidtex)
@ -325,20 +325,20 @@ namespace CodeImp.DoomBuilder.BuilderModes
else
zoffset = Sidedef.Sector.CeilHeight;
oy = (int)Math.Floor(((pickintersect.z - zoffset) * UDMFTools.GetFloat(Sidedef.Fields, "scaley_mid", 1.0f) - Sidedef.OffsetY - UDMFTools.GetFloat(Sidedef.Fields, "offsety_mid")) % Texture.Height);
oy = (int)Math.Floor(((pickintersect.z - zoffset) * UDMFTools.GetFloat(Sidedef.Fields, "scaley_mid", 1.0f) / Texture.Scale.y - Sidedef.OffsetY - UDMFTools.GetFloat(Sidedef.Fields, "offsety_mid")) % Texture.Height);
}
else
{
zoffset = bottomclipplane.GetZ(pickintersect);
oy = (int)Math.Floor(((pickintersect.z - zoffset) * UDMFTools.GetFloat(Sidedef.Fields, "scaley_mid", 1.0f)) % Texture.Height);
oy = (int)Math.Ceiling(((pickintersect.z - zoffset) * UDMFTools.GetFloat(Sidedef.Fields, "scaley_mid", 1.0f) / Texture.Scale.y) % Texture.Height);
}
// Make sure offsets are inside of texture dimensions...
if(ox < 0) ox = Texture.Width + ox;
if(oy < 0) oy = Texture.Height + oy;
while(ox < 0) ox += Texture.Width;
while(oy < 0) oy += Texture.Height;
// Check pixel alpha
if(Texture.GetBitmap().GetPixel(General.Clamp(ox, 0, Texture.Width - 1), General.Clamp(Texture.Height - oy - 1, 0, Texture.Height - 1)).A > 0)
if(Texture.GetBitmap().GetPixel(General.Clamp(ox, 0, Texture.Width - 1), General.Clamp(Texture.Height - oy, 0, Texture.Height - 1)).A > 0)
{
return base.PickAccurate(from, to, dir, ref u_ray);
}