Fixed, Script Editor: in some cases the editor was unable to restore saved script file settings.

Fixed, Drag Linedefs, Drag Vertices, Edit Selection modes: in some cases sidedefs were incorrectly removed when modifying a closed section of a multi-part sector.
Fixed, Drag Linedefs, Drag Vertices, Drag Sectors, Edit Selection modes: in some cases sidedef textures were not adjusted after applying the modes, leaving middle textures on double-sided lines.
This commit is contained in:
MaxED 2016-05-22 21:22:42 +00:00 committed by spherallic
parent 31a9efb7a7
commit d45e71ce21
6 changed files with 67 additions and 23 deletions

View file

@ -2489,6 +2489,9 @@ namespace CodeImp.DoomBuilder.Geometry
{ {
if(side.Sector != nearest) sidesectorref[side] = nearest; // This side will be reattached in phase 2 if(side.Sector != nearest) sidesectorref[side] = nearest; // This side will be reattached in phase 2
else sidesectorref.Remove(side); // This side is already attached where it needs to be else sidesectorref.Remove(side); // This side is already attached where it needs to be
// Store
adjustedsides.Add(side);
} }
else else
{ {
@ -2574,9 +2577,41 @@ namespace CodeImp.DoomBuilder.Geometry
{ {
List<LinedefSide> sectorsides = FindPotentialSectorAt(line, front); List<LinedefSide> sectorsides = FindPotentialSectorAt(line, front);
if(sectorsides == null) return null; if(sectorsides == null) return null;
Sector result = null;
// Special case: if sectorsides match sidestoexclude and all sidestoexclude reference the same sector, return that sector
if(sidestoexclude.Count > 2 && sectorsides.Count == sidestoexclude.Count)
{
bool allsidesmatch = true;
// Check if all sidestoexclude reference the same sector...
foreach(Sidedef s in sidestoexclude)
{
if(result == null) result = s.Sector;
else if(result != s.Sector)
{
allsidesmatch = false;
break;
}
}
// Check if sidestoexclude match sectorsides...
if(allsidesmatch)
{
HashSet<Sidedef> sectorsidesset = new HashSet<Sidedef>();
foreach(LinedefSide ls in sectorsides)
{
sectorsidesset.Add(ls.Front ? ls.Line.Front : ls.Line.Back);
}
allsidesmatch = sectorsidesset.SetEquals(sidestoexclude);
}
// Sides are already where they need to be
if(allsidesmatch) return result;
}
// Filter outersides from the list, proceed only if all sectorsides reference the same sector // Filter outersides from the list, proceed only if all sectorsides reference the same sector
Sector result = null;
foreach(LinedefSide sectorside in sectorsides) foreach(LinedefSide sectorside in sectorsides)
{ {
Sidedef target = (sectorside.Front ? sectorside.Line.Front : sectorside.Line.Back); Sidedef target = (sectorside.Front ? sectorside.Line.Front : sectorside.Line.Back);

View file

@ -438,16 +438,21 @@ namespace CodeImp.DoomBuilder.Map
{ {
ScriptDocumentSettings settings = new ScriptDocumentSettings { FoldLevels = new Dictionary<int, HashSet<int>>() }; ScriptDocumentSettings settings = new ScriptDocumentSettings { FoldLevels = new Dictionary<int, HashSet<int>>() };
// Copy information from Configuration to ScriptDocumentSaveSettings // Copy information from Configuration to ScriptDocumentSaveSettings
if (scfinfo.Contains("filename") && (scfinfo["filename"] is string)) settings.Filename = (string)scfinfo["filename"]; if(scfinfo.Contains("filename") && (scfinfo["filename"] is string)) settings.Filename = (string)scfinfo["filename"];
if (scfinfo.Contains("hash") && (scfinfo["hash"] is long)) settings.Hash = (long)scfinfo["hash"]; if(scfinfo.Contains("hash"))
if (scfinfo.Contains("caretposition") && (scfinfo["caretposition"] is int)) settings.CaretPosition = (int)scfinfo["caretposition"]; {
if (scfinfo.Contains("firstvisibleline") && (scfinfo["firstvisibleline"] is int)) settings.FirstVisibleLine = (int)scfinfo["firstvisibleline"]; // Configuration will parse the value as int if it's inside int type bounds.
if (scfinfo.Contains("activetab") && (scfinfo["activetab"] is bool)) settings.IsActiveTab = (bool)scfinfo["activetab"]; if(scfinfo["hash"] is int) settings.Hash = (int)scfinfo["hash"];
if (scfinfo.Contains("foldlevels") && (scfinfo["foldlevels"] is string)) else if(scfinfo["hash"] is long) settings.Hash = (long)scfinfo["hash"];
{ }
// 1:12,13,14;2:21,43,36 if(scfinfo.Contains("caretposition") && (scfinfo["caretposition"] is int)) settings.CaretPosition = (int)scfinfo["caretposition"];
string foldstr = (string)scfinfo["foldlevels"]; if(scfinfo.Contains("firstvisibleline") && (scfinfo["firstvisibleline"] is int)) settings.FirstVisibleLine = (int)scfinfo["firstvisibleline"];
if(scfinfo.Contains("activetab") && (scfinfo["activetab"] is bool)) settings.IsActiveTab = (bool)scfinfo["activetab"];
if(scfinfo.Contains("foldlevels") && (scfinfo["foldlevels"] is string))
{
// 1:12,13,14;2:21,43,36
string foldstr = (string)scfinfo["foldlevels"];
// Convert string to dictionary // Convert string to dictionary
if (!string.IsNullOrEmpty(foldstr)) if (!string.IsNullOrEmpty(foldstr))

View file

@ -129,16 +129,17 @@ namespace CodeImp.DoomBuilder.BuilderModes
//mxd. Reattach/add/remove outer sidedefs //mxd. Reattach/add/remove outer sidedefs
HashSet<Sidedef> adjustedsides = Tools.AdjustOuterSidedefs(toadjust, changedlines); HashSet<Sidedef> adjustedsides = Tools.AdjustOuterSidedefs(toadjust, changedlines);
//mxd. Split outer sectors
Tools.SplitOuterSectors(changedlines);
//mxd. Remove unneeded textures //mxd. Remove unneeded textures
foreach(Sidedef side in adjustedsides) foreach(Sidedef side in adjustedsides)
{ {
if(side.IsDisposed) continue;
side.RemoveUnneededTextures(true, true, true); side.RemoveUnneededTextures(true, true, true);
if(side.Other != null) side.Other.RemoveUnneededTextures(true, true, true); if(side.Other != null) side.Other.RemoveUnneededTextures(true, true, true);
} }
//mxd. Split outer sectors
Tools.SplitOuterSectors(changedlines);
// If only a single linedef was selected, deselect it now // If only a single linedef was selected, deselect it now
if(selectedlines.Count == 1) General.Map.Map.ClearSelectedLinedefs(); if(selectedlines.Count == 1) General.Map.Map.ClearSelectedLinedefs();
} }

View file

@ -132,16 +132,17 @@ namespace CodeImp.DoomBuilder.BuilderModes
//mxd. Process outer sidedefs //mxd. Process outer sidedefs
HashSet<Sidedef> adjustedsides = Tools.AdjustOuterSidedefs(toadjust, changedlines); HashSet<Sidedef> adjustedsides = Tools.AdjustOuterSidedefs(toadjust, changedlines);
//mxd. Split outer sectors
Tools.SplitOuterSectors(changedlines);
//mxd. Remove unneeded textures //mxd. Remove unneeded textures
foreach(Sidedef side in adjustedsides) foreach(Sidedef side in adjustedsides)
{ {
if(side.IsDisposed) continue;
side.RemoveUnneededTextures(true, true, true); side.RemoveUnneededTextures(true, true, true);
if(side.Other != null) side.Other.RemoveUnneededTextures(true, true, true); if(side.Other != null) side.Other.RemoveUnneededTextures(true, true, true);
} }
//mxd. Split outer sectors
Tools.SplitOuterSectors(changedlines);
// If only a single sector was selected, deselect it now // If only a single sector was selected, deselect it now
if(selectedsectors.Count == 1) if(selectedsectors.Count == 1)
{ {

View file

@ -123,16 +123,17 @@ namespace CodeImp.DoomBuilder.BuilderModes
// Reattach/add/remove outer sidedefs // Reattach/add/remove outer sidedefs
HashSet<Sidedef> adjustedsides = Tools.AdjustOuterSidedefs(toadjust, changedlines); HashSet<Sidedef> adjustedsides = Tools.AdjustOuterSidedefs(toadjust, changedlines);
// Split outer sectors
Tools.SplitOuterSectors(changedlines);
// Remove unneeded textures // Remove unneeded textures
foreach(Sidedef side in adjustedsides) foreach(Sidedef side in adjustedsides)
{ {
if(side.IsDisposed) continue;
side.RemoveUnneededTextures(true, true, true); side.RemoveUnneededTextures(true, true, true);
if(side.Other != null) side.Other.RemoveUnneededTextures(true, true, true); if(side.Other != null) side.Other.RemoveUnneededTextures(true, true, true);
} }
// Split outer sectors
Tools.SplitOuterSectors(changedlines);
// Additional verts may've been created // Additional verts may've been created
if(selectedverts.Count > 1) if(selectedverts.Count > 1)
{ {

View file

@ -1658,15 +1658,16 @@ namespace CodeImp.DoomBuilder.BuilderModes
// Change floor/ceiling height? // Change floor/ceiling height?
if(!pasting) AdjustSectorsHeight(affectedsectors, heightadjustmode, oldoutsidefloorheight, oldoutsideceilingheight); if(!pasting) AdjustSectorsHeight(affectedsectors, heightadjustmode, oldoutsidefloorheight, oldoutsideceilingheight);
// Split outer sectors
Tools.SplitOuterSectors(changedlines);
// Remove unneeded textures (needs to be done AFTER adjusting floor/ceiling height) // Remove unneeded textures (needs to be done AFTER adjusting floor/ceiling height)
foreach(Sidedef side in adjustedsides) foreach(Sidedef side in adjustedsides)
{ {
if(side.IsDisposed) continue;
side.RemoveUnneededTextures(true, true, true); side.RemoveUnneededTextures(true, true, true);
if(side.Other != null) side.Other.RemoveUnneededTextures(true, true, true); if(side.Other != null) side.Other.RemoveUnneededTextures(true, true, true);
} }
// Split outer sectors
Tools.SplitOuterSectors(changedlines);
} }
// Update cached values // Update cached values