mirror of
https://git.do.srb2.org/STJr/UltimateZoneBuilder.git
synced 2024-12-03 17:12:06 +00:00
Fixed a crash when opening Thing Filters form when non-UDMF map was loaded.
Fixed a possible crash when rendering thing arrows in classic modes caused by incorrect vertex buffer size calculation. Reverted changes to texture\flat access when "mixtexturesflats" option is set to true in game configuration.
This commit is contained in:
parent
d9439850f7
commit
bf2f520a8e
7 changed files with 60 additions and 57 deletions
|
@ -42,7 +42,7 @@ namespace CodeImp.DoomBuilder.Config
|
|||
#region ================== Properties
|
||||
|
||||
public ICollection<ImageData> Textures { get { return textures; } }
|
||||
public ICollection<ImageData> Flats { get { if(General.Map.Config.MixTexturesFlats) return textures; return flats; } } //mxd
|
||||
public ICollection<ImageData> Flats { get { return flats; } }
|
||||
|
||||
#endregion
|
||||
|
||||
|
|
|
@ -42,7 +42,7 @@ namespace CodeImp.DoomBuilder.Config
|
|||
#region ================== Properties
|
||||
|
||||
public ICollection<ImageData> Textures { get { return textures; } }
|
||||
public ICollection<ImageData> Flats { get { if(General.Map.Config.MixTexturesFlats) return textures; return flats; } } //mxd
|
||||
public ICollection<ImageData> Flats { get { return flats; } } //mxd
|
||||
|
||||
#endregion
|
||||
|
||||
|
|
|
@ -41,7 +41,7 @@ namespace CodeImp.DoomBuilder.Config
|
|||
#region ================== Properties
|
||||
|
||||
public ICollection<ImageData> Textures { get { return textures.Values; } }
|
||||
public ICollection<ImageData> Flats { get { return General.Map.Config.MixTexturesFlats ? textures.Values : flats.Values; } }
|
||||
public ICollection<ImageData> Flats { get { return flats.Values; } }
|
||||
public DataLocation Location { get { return location; } }
|
||||
|
||||
#endregion
|
||||
|
@ -86,24 +86,26 @@ namespace CodeImp.DoomBuilder.Config
|
|||
// Check if this set has a flat
|
||||
internal bool FlatExists(ImageData image)
|
||||
{
|
||||
if(General.Map.Config.MixTexturesFlats) return textures.ContainsKey(image.LongName); //mxd
|
||||
return flats.ContainsKey(image.LongName);
|
||||
}
|
||||
|
||||
// Mix the textures and flats
|
||||
internal void MixTexturesAndFlats()
|
||||
{
|
||||
Dictionary<long, ImageData> newflats = new Dictionary<long, ImageData>(); //mxd
|
||||
|
||||
// Add flats to textures
|
||||
foreach(KeyValuePair<long, ImageData> f in flats) {
|
||||
if(!textures.ContainsKey(f.Key))
|
||||
textures.Add(f.Key, f.Value);
|
||||
else
|
||||
newflats.Add(f.Key, f.Value); //mxd
|
||||
// Make a copy of the flats only
|
||||
Dictionary<long, ImageData> flatsonly = new Dictionary<long, ImageData>(flats);
|
||||
|
||||
// Add textures to flats
|
||||
foreach(KeyValuePair<long, ImageData> t in textures)
|
||||
{
|
||||
if(!flats.ContainsKey(t.Key)) flats.Add(t.Key, t.Value);
|
||||
}
|
||||
|
||||
flats = newflats; //mxd
|
||||
// Add flats to textures
|
||||
foreach(KeyValuePair<long, ImageData> f in flatsonly)
|
||||
{
|
||||
if(!textures.ContainsKey(f.Key)) textures.Add(f.Key, f.Value);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
|
|
@ -113,9 +113,9 @@ namespace CodeImp.DoomBuilder.Data
|
|||
public Playpal Palette { get { return palette; } }
|
||||
public PreviewManager Previews { get { return previews; } }
|
||||
public ICollection<ImageData> Textures { get { return textures.Values; } }
|
||||
public ICollection<ImageData> Flats { get { return (General.Map.Config.MixTexturesFlats ? textures.Values : flats.Values); } } //mxd
|
||||
public ICollection<ImageData> Flats { get { return flats.Values; } }
|
||||
public List<string> TextureNames { get { return texturenames; } }
|
||||
public List<string> FlatNames { get { return (General.Map.Config.MixTexturesFlats ? texturenames : flatnames); } } //mxd
|
||||
public List<string> FlatNames { get { return flatnames; } }
|
||||
public bool IsDisposed { get { return isdisposed; } }
|
||||
public ImageData MissingTexture3D { get { return missingtexture3d; } }
|
||||
public ImageData UnknownTexture3D { get { return unknowntexture3d; } }
|
||||
|
@ -342,29 +342,38 @@ namespace CodeImp.DoomBuilder.Data
|
|||
}
|
||||
}
|
||||
|
||||
// Process flats
|
||||
foreach(KeyValuePair<long, ImageData> f in flatsonly)
|
||||
{
|
||||
flats.Add(f.Key, f.Value);
|
||||
flatnames.Add(f.Value.Name);
|
||||
}
|
||||
|
||||
// Mixed textures and flats?
|
||||
if (General.Map.Config.MixTexturesFlats) {
|
||||
// Add textures to flats
|
||||
foreach(KeyValuePair<long, ImageData> t in texturesonly)
|
||||
{
|
||||
if(!flats.ContainsKey(t.Key))
|
||||
{
|
||||
flats.Add(t.Key, t.Value);
|
||||
flatnames.Add(t.Value.Name);
|
||||
}
|
||||
}
|
||||
|
||||
// Add flats to textures
|
||||
foreach (KeyValuePair<long, ImageData> f in flatsonly) {
|
||||
if (!textures.ContainsKey(f.Key)) {
|
||||
foreach(KeyValuePair<long, ImageData> f in flatsonly)
|
||||
{
|
||||
if(!textures.ContainsKey(f.Key))
|
||||
{
|
||||
textures.Add(f.Key, f.Value);
|
||||
texturenames.Add(f.Value.Name);
|
||||
} else {
|
||||
//mxd. If there are flats with the same name as textures - add them to flats
|
||||
flats.Add(f.Key, f.Value);
|
||||
flatnames.Add(f.Value.Name);
|
||||
}
|
||||
}
|
||||
|
||||
// Do the same on the data readers
|
||||
foreach (DataReader dr in containers)
|
||||
dr.TextureSet.MixTexturesAndFlats();
|
||||
} else {
|
||||
// Process flats
|
||||
foreach(KeyValuePair<long, ImageData> f in flatsonly) {
|
||||
flats.Add(f.Key, f.Value);
|
||||
flatnames.Add(f.Value.Name);
|
||||
}
|
||||
}
|
||||
|
||||
// Sort names
|
||||
|
@ -975,13 +984,13 @@ namespace CodeImp.DoomBuilder.Data
|
|||
public bool GetFlatExists(string name)
|
||||
{
|
||||
long longname = Lump.MakeLongName(name);
|
||||
return General.Map.Config.MixTexturesFlats ? flats.ContainsKey(longname) || textures.ContainsKey(longname) : flats.ContainsKey(longname);
|
||||
return flats.ContainsKey(longname);
|
||||
}
|
||||
|
||||
// This checks if a flat is known
|
||||
public bool GetFlatExists(long longname)
|
||||
{
|
||||
return General.Map.Config.MixTexturesFlats ? flats.ContainsKey(longname) || textures.ContainsKey(longname) : flats.ContainsKey(longname);
|
||||
return flats.ContainsKey(longname);
|
||||
}
|
||||
|
||||
// This returns an image by string
|
||||
|
@ -997,11 +1006,7 @@ namespace CodeImp.DoomBuilder.Data
|
|||
{
|
||||
// Does this flat exist?
|
||||
if(flats.ContainsKey(longname)) return flats[longname];
|
||||
|
||||
//mxd. Probably a texture will do?
|
||||
if(General.Map.Config.MixTexturesFlats && textures.ContainsKey(longname))
|
||||
return textures[longname];
|
||||
|
||||
|
||||
// Return null image
|
||||
return unknownImage; //mxd
|
||||
}
|
||||
|
@ -1009,14 +1014,8 @@ namespace CodeImp.DoomBuilder.Data
|
|||
// This returns an image by long and doesn't check if it exists
|
||||
public ImageData GetFlatImageKnown(long longname)
|
||||
{
|
||||
//mxd. Err... can't it do without checks...
|
||||
if(General.Map.Config.MixTexturesFlats) {
|
||||
if(flats.ContainsKey(longname)) return flats[longname];
|
||||
return textures[longname];
|
||||
}
|
||||
|
||||
// Return flat
|
||||
return flats[longname]; //mxd
|
||||
return flats[longname];
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
|
|
@ -261,12 +261,8 @@ namespace CodeImp.DoomBuilder.Data
|
|||
private void LoadColormapsRange(string startlump, string endlump, ref List<ImageData> images)
|
||||
{
|
||||
int startindex, endindex;
|
||||
float defaultscale;
|
||||
ColormapImage image;
|
||||
|
||||
// Determine default scale
|
||||
defaultscale = General.Map.Config.DefaultTextureScale;
|
||||
|
||||
// Continue until no more start can be found
|
||||
startindex = file.FindLumpIndex(startlump);
|
||||
while(startindex > -1)
|
||||
|
@ -331,7 +327,6 @@ namespace CodeImp.DoomBuilder.Data
|
|||
public override ICollection<ImageData> LoadTextures(PatchNames pnames)
|
||||
{
|
||||
List<ImageData> images = new List<ImageData>();
|
||||
//string rangestart, rangeend;
|
||||
int lumpindex;
|
||||
Lump lump;
|
||||
|
||||
|
@ -433,8 +428,7 @@ namespace CodeImp.DoomBuilder.Data
|
|||
TextureImage image = null;
|
||||
bool strifedata;
|
||||
|
||||
if(texturedata.Length == 0)
|
||||
return;
|
||||
if(texturedata.Length == 0) return;
|
||||
|
||||
// Determine default scale
|
||||
defaultscale = General.Map.Config.DefaultTextureScale;
|
||||
|
|
|
@ -1232,7 +1232,7 @@ namespace CodeImp.DoomBuilder.Rendering
|
|||
buffercount = 0;
|
||||
|
||||
// Determine next lock size
|
||||
locksize = ((things.Count - totalcount) > THING_BUFFER_SIZE) ? THING_BUFFER_SIZE : (things.Count - totalcount);
|
||||
locksize = ((group.Value.Count - totalcount) > THING_BUFFER_SIZE) ? THING_BUFFER_SIZE : (group.Value.Count - totalcount);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1255,6 +1255,10 @@ namespace CodeImp.DoomBuilder.Rendering
|
|||
graphics.Shaders.Things2D.Texture1 = thingtexture[thingtextureindex].Texture;
|
||||
graphics.Shaders.Things2D.BeginPass(0);
|
||||
|
||||
// Determine next lock size
|
||||
locksize = (thingsByPosition.Count > THING_BUFFER_SIZE) ? THING_BUFFER_SIZE : thingsByPosition.Count;
|
||||
verts = new FlatVertex[THING_BUFFER_SIZE * 6];
|
||||
|
||||
// Go for all things
|
||||
buffercount = 0;
|
||||
totalcount = 0;
|
||||
|
@ -1279,7 +1283,7 @@ namespace CodeImp.DoomBuilder.Rendering
|
|||
buffercount = 0;
|
||||
|
||||
// Determine next lock size
|
||||
locksize = ((things.Count - totalcount) > THING_BUFFER_SIZE) ? THING_BUFFER_SIZE : (things.Count - totalcount);
|
||||
locksize = ((thingsByPosition.Count - totalcount) > THING_BUFFER_SIZE) ? THING_BUFFER_SIZE : (thingsByPosition.Count - totalcount);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -62,9 +62,11 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
filteraction.AddInfo(General.Map.Config.SortedLinedefActions.ToArray());
|
||||
|
||||
// Initialize custom fields editor
|
||||
fieldslist.ListNoFixedFields();
|
||||
fieldslist.Setup("thing");
|
||||
|
||||
if (General.Map.FormatInterface.HasCustomFields) { //mxd
|
||||
fieldslist.ListNoFixedFields();
|
||||
fieldslist.Setup("thing");
|
||||
}
|
||||
|
||||
// Fill checkboxes list
|
||||
foreach(KeyValuePair<string, string> flag in General.Map.Config.ThingFlags)
|
||||
{
|
||||
|
@ -239,10 +241,12 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
}
|
||||
|
||||
// Custom fields
|
||||
fieldslist.ClearFields();
|
||||
fieldslist.Setup("thing");
|
||||
fieldslist.SetValues(f.ThingCustomFields, true);
|
||||
|
||||
if (General.Map.FormatInterface.HasCustomFields) { //mxd
|
||||
fieldslist.ClearFields();
|
||||
fieldslist.Setup("thing");
|
||||
fieldslist.SetValues(f.ThingCustomFields, true);
|
||||
}
|
||||
|
||||
// Done
|
||||
settingup = false;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue