mirror of
https://git.do.srb2.org/STJr/ZoneBuilder.git
synced 2024-11-10 06:41:49 +00:00
Stair Sector Builder Mode: fixed a crash when trying to build geometry from linedefs without sidedefs. Fixes #569
This commit is contained in:
parent
c813106ec5
commit
40f8a5ac16
1 changed files with 64 additions and 13 deletions
|
@ -1119,18 +1119,45 @@ namespace CodeImp.DoomBuilder.StairSectorBuilderMode
|
|||
}
|
||||
}
|
||||
|
||||
si.ceilingheight = primary.Sector.CeilHeight;
|
||||
si.floorheight = primary.Sector.FloorHeight;
|
||||
if (primary == null || primary.IsDisposed)
|
||||
{
|
||||
si.ceilingheight = General.Settings.DefaultCeilingHeight;
|
||||
si.floorheight = General.Settings.DefaultFloorHeight;
|
||||
}
|
||||
else
|
||||
{
|
||||
si.ceilingheight = primary.Sector.CeilHeight;
|
||||
si.floorheight = primary.Sector.FloorHeight;
|
||||
}
|
||||
|
||||
if(String.IsNullOrEmpty(stairsectorbuilderform.UpperTextureTexture))
|
||||
stairsectorbuilderform.UpperTextureTexture = (secondary == null) ? primary.MiddleTexture : primary.HighTexture;
|
||||
if (stairsectorbuilderform.UpperTextureTexture == "")
|
||||
{
|
||||
if ((primary == null || primary.IsDisposed) && (secondary == null || secondary.IsDisposed))
|
||||
stairsectorbuilderform.UpperTextureTexture = General.Settings.DefaultTexture;
|
||||
else if (secondary == null || secondary.IsDisposed)
|
||||
stairsectorbuilderform.UpperTextureTexture = primary.MiddleTexture;
|
||||
else
|
||||
stairsectorbuilderform.UpperTextureTexture = secondary.HighTexture;
|
||||
}
|
||||
|
||||
if(String.IsNullOrEmpty(stairsectorbuilderform.LowerTextureTexture))
|
||||
stairsectorbuilderform.LowerTextureTexture = (secondary == null) ? primary.MiddleTexture : primary.LowTexture;
|
||||
if(stairsectorbuilderform.LowerTextureTexture == "")
|
||||
{
|
||||
if ((primary == null || primary.IsDisposed) && (secondary == null || secondary.IsDisposed))
|
||||
stairsectorbuilderform.LowerTextureTexture = General.Settings.DefaultTexture;
|
||||
else if (secondary == null || secondary.IsDisposed)
|
||||
stairsectorbuilderform.LowerTextureTexture = primary.MiddleTexture;
|
||||
else
|
||||
stairsectorbuilderform.LowerTextureTexture = secondary.LowTexture;
|
||||
|
||||
}
|
||||
|
||||
siout = si;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the base heights from a linedef. If there are no sidedefs it uses the default values.
|
||||
/// </summary>
|
||||
/// <param name="ld">Linedef to the the base heights from</param>
|
||||
private void GetSetBaseHeights(Linedef ld)
|
||||
{
|
||||
if(baseheightset) return;
|
||||
|
@ -1140,21 +1167,45 @@ namespace CodeImp.DoomBuilder.StairSectorBuilderMode
|
|||
if(stairsectorbuilderform.SideFront)
|
||||
{
|
||||
if(ld.Back == null)
|
||||
{
|
||||
if (ld.Front != null && !ld.Front.IsDisposed && ld.Front.Sector != null && !ld.Front.Sector.IsDisposed)
|
||||
{
|
||||
stairsectorbuilderform.CeilingBase = ld.Front.Sector.CeilHeight;
|
||||
stairsectorbuilderform.FloorBase = ld.Front.Sector.FloorHeight;
|
||||
}
|
||||
else
|
||||
{
|
||||
stairsectorbuilderform.CeilingBase = General.Settings.DefaultCeilingHeight;
|
||||
stairsectorbuilderform.FloorBase = General.Settings.DefaultFloorHeight;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (ld.Back != null && !ld.Back.IsDisposed && ld.Back.Sector != null && !ld.Back.Sector.IsDisposed)
|
||||
{
|
||||
stairsectorbuilderform.CeilingBase = ld.Back.Sector.CeilHeight;
|
||||
stairsectorbuilderform.FloorBase = ld.Back.Sector.FloorHeight;
|
||||
}
|
||||
else
|
||||
{
|
||||
stairsectorbuilderform.CeilingBase = General.Settings.DefaultCeilingHeight;
|
||||
stairsectorbuilderform.FloorBase = General.Settings.DefaultFloorHeight;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (ld.Front != null && !ld.Front.IsDisposed && ld.Front.Sector != null && !ld.Front.Sector.IsDisposed)
|
||||
{
|
||||
stairsectorbuilderform.CeilingBase = ld.Front.Sector.CeilHeight;
|
||||
stairsectorbuilderform.FloorBase = ld.Front.Sector.FloorHeight;
|
||||
}
|
||||
else
|
||||
{
|
||||
stairsectorbuilderform.CeilingBase = ld.Back.Sector.CeilHeight;
|
||||
stairsectorbuilderform.FloorBase = ld.Back.Sector.FloorHeight;
|
||||
stairsectorbuilderform.CeilingBase = General.Settings.DefaultCeilingHeight;
|
||||
stairsectorbuilderform.FloorBase = General.Settings.DefaultFloorHeight;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
stairsectorbuilderform.CeilingBase = ld.Front.Sector.CeilHeight;
|
||||
stairsectorbuilderform.FloorBase = ld.Front.Sector.FloorHeight;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
|
Loading…
Reference in a new issue