mirror of
https://git.do.srb2.org/STJr/UltimateZoneBuilder.git
synced 2025-02-20 10:53:19 +00:00
Fixed: sprite replacements with different rotation count weren't handled correctly. (reported by DOOMGABR)
This commit is contained in:
parent
6661ed44e3
commit
125844b308
5 changed files with 53 additions and 15 deletions
|
@ -669,7 +669,8 @@ namespace CodeImp.DoomBuilder.Config
|
|||
HashSet<string> spritenames = new HashSet<string>();
|
||||
foreach(string s in allspritenames)
|
||||
{
|
||||
if(s.StartsWith(sourcename)) spritenames.Add(s);
|
||||
if (s.StartsWith(sourcename))
|
||||
spritenames.Add(s);
|
||||
}
|
||||
|
||||
// Find a sprite, which matches baseframe
|
||||
|
|
|
@ -1533,11 +1533,22 @@ namespace CodeImp.DoomBuilder.Data
|
|||
{
|
||||
//mxd. Get all sprite names
|
||||
HashSet<string> spritenames = new HashSet<string>(StringComparer.Ordinal);
|
||||
foreach(DataReader dr in containers)
|
||||
{
|
||||
IEnumerable<string> result = dr.GetSpriteNames();
|
||||
if(result != null) spritenames.UnionWith(result);
|
||||
}
|
||||
// [ZZ] in order to properly replace different rotation count, we need more complex processing here.
|
||||
HashSet<string> loadedspritenames = new HashSet<string>(StringComparer.Ordinal);
|
||||
for (int i = containers.Count-1; i >= 0; i--)
|
||||
{
|
||||
IEnumerable<string> result = containers[i].GetSpriteNames();
|
||||
if (result != null)
|
||||
{
|
||||
// remove old sprites with this name
|
||||
result = result.Where(str => !loadedspritenames.Contains(str.Substring(0, 4))); // only sprites that we still don't have. remember, reverse iteration!
|
||||
// add new sprites with this name
|
||||
spritenames.UnionWith(result);
|
||||
// remember
|
||||
foreach (string spr in result)
|
||||
loadedspritenames.Add(spr.Substring(0, 4));
|
||||
}
|
||||
}
|
||||
|
||||
//mxd. Add sprites from sprites collection (because GetSpriteNames() doesn't return TEXTURES sprites)
|
||||
foreach(ImageData data in sprites.Values) spritenames.Add(data.Name);
|
||||
|
@ -1637,7 +1648,8 @@ namespace CodeImp.DoomBuilder.Data
|
|||
{
|
||||
// This container provides this sprite?
|
||||
Stream spritedata = containers[i].GetSpriteData(pname, ref spritelocation);
|
||||
if(spritedata != null) return spritedata;
|
||||
if(spritedata != null)
|
||||
return spritedata;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -30,6 +30,6 @@ using CodeImp.DoomBuilder;
|
|||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
[assembly: AssemblyVersion("2.3.0.2920")]
|
||||
[assembly: AssemblyVersion("2.3.0.2921")]
|
||||
[assembly: NeutralResourcesLanguageAttribute("en")]
|
||||
[assembly: AssemblyHash("39889a9")]
|
||||
[assembly: AssemblyHash("6661ed4")]
|
||||
|
|
|
@ -414,9 +414,9 @@ namespace CodeImp.DoomBuilder.Rendering
|
|||
return true;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ================== Rendering
|
||||
#endregion
|
||||
|
||||
#region ================== Rendering
|
||||
|
||||
// This begins a drawing session
|
||||
public bool StartRendering(bool clear, Color4 backcolor, Surface target, Surface depthbuffer)
|
||||
|
@ -437,8 +437,33 @@ namespace CodeImp.DoomBuilder.Rendering
|
|||
device.Clear(ClearFlags.Target, backcolor, 1f, 0);
|
||||
}
|
||||
|
||||
// Ready to render
|
||||
device.BeginScene();
|
||||
// Ready to render
|
||||
// [ZZ] Sometimes (apparently during massive lag) this may cause invalid call exception.
|
||||
// Let's put this code here until proper fix is available.
|
||||
// For now, eat the initial exception and try to recover.
|
||||
for (int i = 0; i < 2; i++)
|
||||
{
|
||||
try
|
||||
{
|
||||
device.BeginScene();
|
||||
break;
|
||||
}
|
||||
catch (SlimDXException e)
|
||||
{
|
||||
if (i != 0) throw e;
|
||||
else
|
||||
{
|
||||
if (!CheckAvailability())
|
||||
{
|
||||
isrendering = false;
|
||||
return false;
|
||||
}
|
||||
|
||||
Reset();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
isrendering = true; //mxd
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -29,5 +29,5 @@ using System.Resources;
|
|||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
[assembly: AssemblyVersion("2.3.0.2920")]
|
||||
[assembly: AssemblyVersion("2.3.0.2921")]
|
||||
[assembly: NeutralResourcesLanguageAttribute("en")]
|
||||
|
|
Loading…
Reference in a new issue