Fixed a crash when reloading resources after removing a resource.

Visual mode: rendering was broken on video cards without Shader Model 2.0 support.
Engines list was not updated after changing engine in Test button's drop down.
This commit is contained in:
MaxED 2013-08-05 13:03:08 +00:00
parent 82722e546c
commit 3890c4a7c8
7 changed files with 43 additions and 24 deletions

View file

@ -898,8 +898,7 @@ namespace CodeImp.DoomBuilder.Data
//mxd
internal override bool FileExists(string name) {
Lump l = file.FindLump(name);
return l != null;
return file.FindLumpIndex(name) != -1;
}
#endregion

View file

@ -44,10 +44,9 @@ namespace CodeImp.DoomBuilder.GZBuilder.GZDoom
base.Parse(stream, sourcefilename);
//already parsed this?
if (parsedLumps.IndexOf(sourcefilename) != -1) return false;
if (parsedLumps.Contains(sourcefilename)) return false;
parsedLumps.Add(sourcefilename);
if (isinclude)
includes.Add(sourcefilename);
if (isinclude) includes.Add(sourcefilename);
// Keep local data
Stream localstream = datastream;
@ -104,7 +103,9 @@ namespace CodeImp.DoomBuilder.GZBuilder.GZDoom
string includeLump = StripTokenQuotes(ReadToken()).ToLowerInvariant();
if (!string.IsNullOrEmpty(includeLump)) {
if (includeLump == "zcommon.acs" || includeLump == "common.acs")
string includeName = Path.GetFileName(includeLump);
if (includeName == "zcommon.acs" || includeName == "common.acs" || includes.Contains(includeName))
continue;
// Callback to parse this file

View file

@ -1719,7 +1719,6 @@ namespace CodeImp.DoomBuilder {
foreach(Thing t in General.Map.Map.Things) t.TranslateToUDMF();
}
General.Map.Map.UpdateCustomLinedefColors();
UpdateScriptNames(); //mxd
// Update interface
General.MainWindow.SetupInterface();
@ -1728,6 +1727,7 @@ namespace CodeImp.DoomBuilder {
// Reload resources
ReloadResources();
UpdateScriptNames(); //mxd
// Done
General.MainWindow.DisplayReady();

View file

@ -38,14 +38,16 @@ namespace CodeImp.DoomBuilder.IO
#region ================== Variables
private Configuration config;
//private Configuration config;
#endregion
#region ================== Constructor / Disposer
// Constructor
public UniversalMapSetIO(WAD wad, MapManager manager) : base(wad, manager)
public UniversalMapSetIO(WAD wad, MapManager manager) : base(wad, manager) { }
/*public UniversalMapSetIO(WAD wad, MapManager manager) : base(wad, manager)
{
if((manager != null) && (manager.Config != null))
{
@ -81,6 +83,14 @@ namespace CodeImp.DoomBuilder.IO
// Add thing flags
foreach(KeyValuePair<string, string> flag in manager.Config.ThingFlags)
config.WriteSetting("managedfields.thing." + flag.Key, true);
//mxd. Add sector flags
foreach(KeyValuePair<string, string> flag in manager.Config.SectorFlags)
config.WriteSetting("managedfields.sector." + flag.Key, true);
//mxd. Add sidedef flags
foreach(KeyValuePair<string, string> flag in manager.Config.SidedefFlags)
config.WriteSetting("managedfields.sidedef." + flag.Key, true);
// Done
udmfcfgreader.Dispose();
@ -89,7 +99,7 @@ namespace CodeImp.DoomBuilder.IO
}
}
}
}
}*/
#endregion

View file

@ -104,15 +104,22 @@ namespace CodeImp.DoomBuilder.Rendering
}
// Initialize world vertex declaration
vertexElements = new VertexElement[]
{
new VertexElement(0, 0, DeclarationType.Float3, DeclarationMethod.Default, DeclarationUsage.Position, 0),
new VertexElement(0, 12, DeclarationType.Color, DeclarationMethod.Default, DeclarationUsage.Color, 0),
new VertexElement(0, 16, DeclarationType.Float2, DeclarationMethod.Default, DeclarationUsage.TextureCoordinate, 0),
//mxd
new VertexElement(0, 24, DeclarationType.Float3, DeclarationMethod.Default, DeclarationUsage.Normal, 0),
VertexElement.VertexDeclarationEnd
};
if (manager.Enabled){ //mxd
vertexElements = new VertexElement[] {
new VertexElement(0, 0, DeclarationType.Float3, DeclarationMethod.Default, DeclarationUsage.Position, 0),
new VertexElement(0, 12, DeclarationType.Color, DeclarationMethod.Default, DeclarationUsage.Color, 0),
new VertexElement(0, 16, DeclarationType.Float2, DeclarationMethod.Default, DeclarationUsage.TextureCoordinate, 0),
new VertexElement(0, 24, DeclarationType.Float3, DeclarationMethod.Default, DeclarationUsage.Normal, 0), //mxd
VertexElement.VertexDeclarationEnd
};
} else {
vertexElements = new VertexElement[] {
new VertexElement(0, 0, DeclarationType.Float3, DeclarationMethod.Default, DeclarationUsage.Position, 0),
new VertexElement(0, 12, DeclarationType.Color, DeclarationMethod.Default, DeclarationUsage.Color, 0),
new VertexElement(0, 16, DeclarationType.Float2, DeclarationMethod.Default, DeclarationUsage.TextureCoordinate, 0),
VertexElement.VertexDeclarationEnd
};
}
vertexdecl = new VertexDeclaration(General.Map.Graphics.Device, vertexElements);
// We have no destructor

View file

@ -1052,9 +1052,7 @@ namespace CodeImp.DoomBuilder.VisualModes
/// </summary>
protected virtual void FillBlockMap()
{
if(blockmap != null) blockmap.Dispose();
blockmap = new VisualBlockMap();
blockmap.Clear();//mxd
blockmap.AddLinedefsSet(General.Map.Map.Linedefs);
blockmap.AddThingsSet(General.Map.Map.Things);
blockmap.AddSectorsSet(General.Map.Map.Sectors);

View file

@ -1446,6 +1446,7 @@ namespace CodeImp.DoomBuilder.Windows
//mxd
private void engineItem_Click(object sender, EventArgs e) {
General.Map.ConfigSettings.CurrentEngineIndex = (int)(((ToolStripMenuItem)sender).Tag);
UpdateSkills();
}
// Event handler for testing at a specific skill
@ -3126,8 +3127,11 @@ namespace CodeImp.DoomBuilder.Windows
//mxd
private void blinkTimer_Elapsed(object sender, System.Timers.ElapsedEventArgs e) {
if(warningsCount > 0) {
if(!this.Disposing && blinkTimer != null)
this.Invoke(new CallBlink(blink));
if (!this.Disposing && blinkTimer != null) {
try {
this.Invoke(new CallBlink(blink));
} catch(ObjectDisposedException oe) { } //la-la-la. We don't care.
}
} else {
//get rid of timer
blinkTimer.Stop();