mirror of
https://git.do.srb2.org/STJr/UltimateZoneBuilder.git
synced 2024-11-26 22:01:45 +00:00
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:
parent
c407c8c351
commit
dc29b59fe8
6 changed files with 52 additions and 55 deletions
|
@ -29,29 +29,29 @@ namespace CodeImp.DoomBuilder.Actions
|
||||||
#region ================== Variables
|
#region ================== Variables
|
||||||
|
|
||||||
// Description
|
// Description
|
||||||
private string name;
|
private readonly string name;
|
||||||
private string shortname;
|
private readonly string shortname;
|
||||||
private string title;
|
private readonly string title;
|
||||||
private string description;
|
private readonly string description;
|
||||||
private string category;
|
private readonly string category;
|
||||||
|
|
||||||
// Shortcut key
|
// Shortcut key
|
||||||
private int key;
|
private int key;
|
||||||
private int keymask;
|
private readonly int keymask;
|
||||||
private int defaultkey;
|
private readonly int defaultkey;
|
||||||
|
|
||||||
// Shortcut options
|
// Shortcut options
|
||||||
private bool allowkeys;
|
private readonly bool allowkeys;
|
||||||
private bool allowmouse;
|
private readonly bool allowmouse;
|
||||||
private bool allowscroll;
|
private readonly bool allowscroll;
|
||||||
private bool disregardshift;
|
private readonly bool disregardshift;
|
||||||
private bool disregardcontrol;
|
private readonly bool disregardcontrol;
|
||||||
private bool disregardalt; //mxd
|
private readonly bool disregardalt; //mxd
|
||||||
private bool repeat;
|
private readonly bool repeat;
|
||||||
|
|
||||||
// Delegate
|
// Delegate
|
||||||
private List<ActionDelegate> begindelegates;
|
private readonly List<ActionDelegate> begindelegates;
|
||||||
private List<ActionDelegate> enddelegates;
|
private readonly List<ActionDelegate> enddelegates;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
@ -114,12 +114,6 @@ namespace CodeImp.DoomBuilder.Actions
|
||||||
this.key = key & keymask;
|
this.key = key & keymask;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Destructor
|
|
||||||
~Action()
|
|
||||||
{
|
|
||||||
// Moo.
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|
|
@ -376,6 +376,9 @@ namespace CodeImp.DoomBuilder.Data
|
||||||
if(!textures.ContainsKey(t.Key))
|
if(!textures.ContainsKey(t.Key))
|
||||||
{
|
{
|
||||||
textures.Add(t.Key, t.Value);
|
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);
|
texturenames.Add(t.Value.Name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -384,11 +387,14 @@ namespace CodeImp.DoomBuilder.Data
|
||||||
foreach(KeyValuePair<long, ImageData> f in flatsonly)
|
foreach(KeyValuePair<long, ImageData> f in flatsonly)
|
||||||
{
|
{
|
||||||
flats.Add(f.Key, f.Value);
|
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);
|
flatnames.Add(f.Value.Name);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Mixed textures and flats?
|
// Mixed textures and flats?
|
||||||
if (General.Map.Config.MixTexturesFlats)
|
if(General.Map.Config.MixTexturesFlats)
|
||||||
{
|
{
|
||||||
// Add textures to flats
|
// Add textures to flats
|
||||||
foreach(KeyValuePair<long, ImageData> t in texturesonly)
|
foreach(KeyValuePair<long, ImageData> t in texturesonly)
|
||||||
|
@ -396,6 +402,9 @@ namespace CodeImp.DoomBuilder.Data
|
||||||
if(!flats.ContainsKey(t.Key))
|
if(!flats.ContainsKey(t.Key))
|
||||||
{
|
{
|
||||||
flats.Add(t.Key, t.Value);
|
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);
|
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
|
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
|
//mxd
|
||||||
foreach (KeyValuePair<long, long> t in texturenamesshorttofull)
|
foreach(KeyValuePair<long, long> t in texturenamesshorttofull)
|
||||||
{
|
if(!flatnamesshorttofull.ContainsKey(t.Key)) flatnamesshorttofull.Add(t.Key, t.Value);
|
||||||
if (!flatnamesshorttofull.ContainsKey(t.Key))
|
|
||||||
{
|
|
||||||
flatnamesshorttofull.Add(t.Key, t.Value);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Add flats to textures
|
// Add flats to textures
|
||||||
foreach(KeyValuePair<long, ImageData> f in flatsonly)
|
foreach(KeyValuePair<long, ImageData> f in flatsonly)
|
||||||
|
@ -420,21 +424,19 @@ namespace CodeImp.DoomBuilder.Data
|
||||||
if(!textures.ContainsKey(f.Key))
|
if(!textures.ContainsKey(f.Key))
|
||||||
{
|
{
|
||||||
textures.Add(f.Key, f.Value);
|
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);
|
texturenames.Add(f.Value.Name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//mxd
|
//mxd
|
||||||
foreach (KeyValuePair<long, long> t in flatnamesshorttofull)
|
foreach(KeyValuePair<long, long> t in flatnamesshorttofull)
|
||||||
{
|
if(!texturenamesshorttofull.ContainsKey(t.Key)) texturenamesshorttofull.Add(t.Key, t.Value);
|
||||||
if (!texturenamesshorttofull.ContainsKey(t.Key))
|
|
||||||
{
|
|
||||||
texturenamesshorttofull.Add(t.Key, t.Value);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Do the same on the data readers
|
// Do the same on the data readers
|
||||||
foreach (DataReader dr in containers)
|
foreach(DataReader dr in containers)
|
||||||
dr.TextureSet.MixTexturesAndFlats();
|
dr.TextureSet.MixTexturesAndFlats();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -78,7 +78,7 @@ namespace CodeImp.DoomBuilder.Data
|
||||||
internal FileImage(string name, string filepathname)
|
internal FileImage(string name, string filepathname)
|
||||||
{
|
{
|
||||||
// Initialize
|
// Initialize
|
||||||
SetName(name, filepathname, true);
|
SetName(name, filepathname, true, true);
|
||||||
|
|
||||||
probableformat = ImageDataFormat.DOOMPICTURE;
|
probableformat = ImageDataFormat.DOOMPICTURE;
|
||||||
|
|
||||||
|
@ -93,16 +93,17 @@ namespace CodeImp.DoomBuilder.Data
|
||||||
//mxd: name is relative path to the image ("\Textures\sometexture.png")
|
//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: filepathname is absolute path to the image ("D:\Doom\MyCoolProject\Textures\sometexture.png")
|
||||||
//mxd: also, zdoom uses '/' as directory separator char.
|
//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)
|
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);
|
name = name.Replace(Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar);
|
||||||
|
|
||||||
if(!uselongtexturenames)
|
if(!uselongtexturenames || (!forcelongtexturename && string.IsNullOrEmpty(Path.GetDirectoryName(name))))
|
||||||
{
|
{
|
||||||
this.name = Path.GetFileNameWithoutExtension(name.ToUpperInvariant());
|
this.name = Path.GetFileNameWithoutExtension(name.ToUpperInvariant());
|
||||||
if (this.name.Length > DataManager.CLASIC_IMAGE_NAME_LENGTH)
|
if (this.name.Length > DataManager.CLASIC_IMAGE_NAME_LENGTH)
|
||||||
|
|
|
@ -68,7 +68,7 @@ namespace CodeImp.DoomBuilder.Data
|
||||||
//mxd: filepathname is relative path to the image ("Textures\sometexture.png")
|
//mxd: filepathname is relative path to the image ("Textures\sometexture.png")
|
||||||
protected override void SetName(string filepathname)
|
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());
|
this.name = Path.GetFileNameWithoutExtension(filepathname.ToUpperInvariant());
|
||||||
if (this.name.Length > DataManager.CLASIC_IMAGE_NAME_LENGTH)
|
if (this.name.Length > DataManager.CLASIC_IMAGE_NAME_LENGTH)
|
||||||
|
|
|
@ -421,9 +421,9 @@ griddec // Note, these were incorrectly swapped before, hence the wrong action
|
||||||
title = "Grid Increase";
|
title = "Grid Increase";
|
||||||
category = "edit";
|
category = "edit";
|
||||||
description = "Increases the grid size, decreasing the grid density.";
|
description = "Increases the grid size, decreasing the grid density.";
|
||||||
unbind = 1;
|
allowkeys = true;
|
||||||
mousebuttons = 0;
|
allowmouse = true;
|
||||||
mousescroll = 1;
|
allowscroll = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -432,9 +432,9 @@ gridinc // Note, these were incorrectly swapped before, hence the wrong action
|
||||||
title = "Grid Decrease";
|
title = "Grid Decrease";
|
||||||
category = "edit";
|
category = "edit";
|
||||||
description = "Decreases the grid size, increasing the grid density.";
|
description = "Decreases the grid size, increasing the grid density.";
|
||||||
unbind = 1;
|
allowkeys = true;
|
||||||
mousebuttons = 0;
|
allowmouse = true;
|
||||||
mousescroll = 1;
|
allowscroll = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
undo
|
undo
|
||||||
|
|
|
@ -315,7 +315,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
||||||
|
|
||||||
// Get correct offset to texture space...
|
// Get correct offset to texture space...
|
||||||
float zoffset;
|
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;
|
int oy;
|
||||||
|
|
||||||
if(repeatmidtex)
|
if(repeatmidtex)
|
||||||
|
@ -325,20 +325,20 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
||||||
else
|
else
|
||||||
zoffset = Sidedef.Sector.CeilHeight;
|
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
|
else
|
||||||
{
|
{
|
||||||
zoffset = bottomclipplane.GetZ(pickintersect);
|
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...
|
// Make sure offsets are inside of texture dimensions...
|
||||||
if(ox < 0) ox = Texture.Width + ox;
|
while(ox < 0) ox += Texture.Width;
|
||||||
if(oy < 0) oy = Texture.Height + oy;
|
while(oy < 0) oy += Texture.Height;
|
||||||
|
|
||||||
// Check pixel alpha
|
// 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);
|
return base.PickAccurate(from, to, dir, ref u_ray);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue