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 //mxd
internal override bool FileExists(string name) { internal override bool FileExists(string name) {
Lump l = file.FindLump(name); return file.FindLumpIndex(name) != -1;
return l != null;
} }
#endregion #endregion

View file

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

View file

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

View file

@ -38,14 +38,16 @@ namespace CodeImp.DoomBuilder.IO
#region ================== Variables #region ================== Variables
private Configuration config; //private Configuration config;
#endregion #endregion
#region ================== Constructor / Disposer #region ================== Constructor / Disposer
// Constructor // 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)) if((manager != null) && (manager.Config != null))
{ {
@ -82,6 +84,14 @@ namespace CodeImp.DoomBuilder.IO
foreach(KeyValuePair<string, string> flag in manager.Config.ThingFlags) foreach(KeyValuePair<string, string> flag in manager.Config.ThingFlags)
config.WriteSetting("managedfields.thing." + flag.Key, true); 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 // Done
udmfcfgreader.Dispose(); udmfcfgreader.Dispose();
udmfcfg.Dispose(); udmfcfg.Dispose();
@ -89,7 +99,7 @@ namespace CodeImp.DoomBuilder.IO
} }
} }
} }
} }*/
#endregion #endregion

View file

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

View file

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

View file

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