mirror of
https://git.do.srb2.org/STJr/UltimateZoneBuilder.git
synced 2025-02-21 03:11:40 +00:00
Iterate over things before lines in Visual Mode
This commit is contained in:
parent
464a6eba9f
commit
27a268ae89
1 changed files with 61 additions and 61 deletions
|
@ -1050,6 +1050,67 @@ 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)
|
||||
{
|
||||
// SRB2
|
||||
if (t.Type == 750)
|
||||
{
|
||||
if (!thingtags.ContainsKey(t.Tag)) thingtags[t.Tag] = new List<Thing>();
|
||||
thingtags[t.Tag].Add(t);
|
||||
}
|
||||
continue;
|
||||
|
||||
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]])
|
||||
{
|
||||
if (ld.Line.GetSideOfLine(t.Position) < 0.0f)
|
||||
{
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
// ========== Thing slope ==========
|
||||
case 9503:
|
||||
case 9502:
|
||||
t.DetermineSector(blockmap);
|
||||
if (t.Sector != null)
|
||||
{
|
||||
SectorData sd = GetSectorData(t.Sector);
|
||||
sd.AddEffectThingSlope(t);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Find interesting linedefs (such as line slopes)
|
||||
// This also determines which slope lines belong to pass one and pass two. See https://zdoom.org/wiki/Slope
|
||||
foreach (Linedef l in General.Map.Map.Linedefs)
|
||||
|
@ -1265,67 +1326,6 @@ 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)
|
||||
{
|
||||
// SRB2
|
||||
if (t.Type == 750)
|
||||
{
|
||||
if (!thingtags.ContainsKey(t.Tag)) thingtags[t.Tag] = new List<Thing>();
|
||||
thingtags[t.Tag].Add(t);
|
||||
}
|
||||
continue;
|
||||
|
||||
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]])
|
||||
{
|
||||
if (ld.Line.GetSideOfLine(t.Position) < 0.0f)
|
||||
{
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
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])
|
||||
|
|
Loading…
Reference in a new issue