Disable Visual Mode features that don't apply to SRB2

This commit is contained in:
spherallic 2023-09-04 18:36:03 +02:00
parent 758f480faf
commit ab830ea159

View file

@ -1108,23 +1108,32 @@ namespace CodeImp.DoomBuilder.BuilderModes
case "srb2_fofwater":
case "srb2_fofsolidopaque":
case "srb2_fofcrumbling":
case "srb2_foflight":
case "srb2_foffog":
case "srb2_fofintangible":
case "srb2_fofintangibleinvisible":
case "srb2_fofbustable":
case "srb2_foflaser":
case "srb2_fofcustom":
if (l.Front != null)
if (l.Front != null && sectortags.ContainsKey(l.Args[0]))
{
if (sectortags.ContainsKey(l.Args[0]))
List<Sector> sectors = sectortags[l.Args[0]];
foreach (Sector s in sectors)
{
List<Sector> sectors = sectortags[l.Args[0]];
foreach (Sector s in sectors)
{
SectorData sd = GetSectorData(s);
sd.AddEffect3DFloor(l);
}
SectorData sd = GetSectorData(s);
sd.AddEffect3DFloor(l);
}
}
break;
case "srb2_foflight":
case "srb2_foffog":
case "srb2_fofintangibleinvisible":
if (l.Front != null && sectortags.ContainsKey(l.Args[0]))
{
List<Sector> sectors = sectortags[l.Args[0]];
foreach (Sector s in sectors)
{
SectorData sd = GetSectorData(s);
//sd.AddEffectBrightnessLevel(l);
sd.AddEffect3DFloor(l);
}
}
break;
@ -1220,121 +1229,125 @@ namespace CodeImp.DoomBuilder.BuilderModes
}
}
// Find interesting things (such as sector slopes)
// Pass one of slope things, and determine which one are for pass two
//TODO: rewrite using classnames instead of numbers
foreach (Thing t in General.Map.Map.Things)
// Disable loops that are not relevant to SRB2
if (false)
{
switch (t.Type)
// Find interesting things (such as sector slopes)
// Pass one of slope things, and determine which one are for pass two
//TODO: rewrite using classnames instead of numbers
foreach (Thing t in General.Map.Map.Things)
{
// ========== Copy slope ==========
case 9511:
case 9510:
slopethingpass[1].Add(t);
break;
switch (t.Type)
{
// ========== Copy slope ==========
case 9511:
case 9510:
slopethingpass[1].Add(t);
break;
// ========== Thing line slope ==========
case 9501:
case 9500:
if(linetags.ContainsKey(t.Args[0]))
{
// Only slope each sector once, even when multiple lines of the same sector are tagged. See https://github.com/jewalky/UltimateDoomBuilder/issues/491
List<Sector> slopedsectors = new List<Sector>();
foreach(Linedef ld in linetags[t.Args[0]])
// ========== Thing line slope ==========
case 9501:
case 9500:
if (linetags.ContainsKey(t.Args[0]))
{
if (ld.Line.GetSideOfLine(t.Position) < 0.0f)
// Only slope each sector once, even when multiple lines of the same sector are tagged. See https://github.com/jewalky/UltimateDoomBuilder/issues/491
List<Sector> slopedsectors = new List<Sector>();
foreach (Linedef ld in linetags[t.Args[0]])
{
if (ld.Front != null && !slopedsectors.Contains(ld.Front.Sector))
if (ld.Line.GetSideOfLine(t.Position) < 0.0f)
{
GetSectorData(ld.Front.Sector).AddEffectThingLineSlope(t, ld.Front);
slopedsectors.Add(ld.Front.Sector);
if (ld.Front != null && !slopedsectors.Contains(ld.Front.Sector))
{
GetSectorData(ld.Front.Sector).AddEffectThingLineSlope(t, ld.Front);
slopedsectors.Add(ld.Front.Sector);
}
}
else if (ld.Back != null && !slopedsectors.Contains(ld.Back.Sector))
{
GetSectorData(ld.Back.Sector).AddEffectThingLineSlope(t, ld.Back);
slopedsectors.Add(ld.Back.Sector);
}
}
else if (ld.Back != null && !slopedsectors.Contains(ld.Back.Sector))
}
break;
// ========== Thing slope ==========
case 9503:
case 9502:
t.DetermineSector(blockmap);
if (t.Sector != null)
{
SectorData sd = GetSectorData(t.Sector);
sd.AddEffectThingSlope(t);
}
break;
}
}
// Pass two of slope things
//TODO: rewrite using classnames instead of numbers
foreach (Thing t in slopethingpass[1])
{
switch (t.Type)
{
// ========== Copy slope ==========
case 9511:
case 9510:
t.DetermineSector(blockmap);
if (t.Sector != null)
{
SectorData sd = GetSectorData(t.Sector);
sd.AddEffectCopySlope(t);
}
break;
}
}
// Find sectors with 3 vertices, because they can be sloped
foreach (Sector s in General.Map.Map.Sectors)
{
// ========== Thing vertex slope, vertices with UDMF vertex offsets ==========
if (s.Sidedefs.Count == 3)
{
if (General.Map.UDMF) GetSectorData(s).AddEffectVertexOffset(); //mxd
List<Thing> slopeceilingthings = new List<Thing>(3);
List<Thing> slopefloorthings = new List<Thing>(3);
foreach (Sidedef sd in s.Sidedefs)
{
Vertex v = sd.IsFront ? sd.Line.End : sd.Line.Start;
// Check if a thing is at this vertex
foreach (VisualBlockEntry block in blockmap.GetBlocks(v.Position))
{
foreach (Thing t in block.Things)
{
GetSectorData(ld.Back.Sector).AddEffectThingLineSlope(t, ld.Back);
slopedsectors.Add(ld.Back.Sector);
if ((Vector2D)t.Position == v.Position)
{
switch (t.Type)
{
case 1504: slopefloorthings.Add(t); break;
case 1505: slopeceilingthings.Add(t); break;
}
}
}
}
}
break;
// ========== Thing slope ==========
case 9503:
case 9502:
t.DetermineSector(blockmap);
if (t.Sector != null)
// Slope any floor vertices?
if (slopefloorthings.Count > 0)
{
SectorData sd = GetSectorData(t.Sector);
sd.AddEffectThingSlope(t);
SectorData sd = GetSectorData(s);
sd.AddEffectThingVertexSlope(slopefloorthings, true);
}
break;
}
}
// Pass two of slope things
//TODO: rewrite using classnames instead of numbers
foreach (Thing t in slopethingpass[1])
{
switch (t.Type)
{
// ========== Copy slope ==========
case 9511:
case 9510:
t.DetermineSector(blockmap);
if (t.Sector != null)
// Slope any ceiling vertices?
if (slopeceilingthings.Count > 0)
{
SectorData sd = GetSectorData(t.Sector);
sd.AddEffectCopySlope(t);
SectorData sd = GetSectorData(s);
sd.AddEffectThingVertexSlope(slopeceilingthings, false);
}
break;
}
}
// Find sectors with 3 vertices, because they can be sloped
foreach (Sector s in General.Map.Map.Sectors)
{
// ========== Thing vertex slope, vertices with UDMF vertex offsets ==========
if (s.Sidedefs.Count == 3)
{
if (General.Map.UDMF) GetSectorData(s).AddEffectVertexOffset(); //mxd
List<Thing> slopeceilingthings = new List<Thing>(3);
List<Thing> slopefloorthings = new List<Thing>(3);
foreach (Sidedef sd in s.Sidedefs)
{
Vertex v = sd.IsFront ? sd.Line.End : sd.Line.Start;
// Check if a thing is at this vertex
foreach (VisualBlockEntry block in blockmap.GetBlocks(v.Position))
{
foreach (Thing t in block.Things)
{
if ((Vector2D)t.Position == v.Position)
{
switch (t.Type)
{
case 1504: slopefloorthings.Add(t); break;
case 1505: slopeceilingthings.Add(t); break;
}
}
}
}
}
// Slope any floor vertices?
if (slopefloorthings.Count > 0)
{
SectorData sd = GetSectorData(s);
sd.AddEffectThingVertexSlope(slopefloorthings, true);
}
// Slope any ceiling vertices?
if (slopeceilingthings.Count > 0)
{
SectorData sd = GetSectorData(s);
sd.AddEffectThingVertexSlope(slopeceilingthings, false);
}
}
}