mirror of
https://git.do.srb2.org/STJr/ZoneBuilder.git
synced 2025-01-31 05:00:34 +00:00
Vertex slopes are now rendered in Visual Mode.
This commit is contained in:
parent
09a08d2363
commit
bbfb569d0f
14 changed files with 259 additions and 94 deletions
|
@ -97,6 +97,7 @@ namespace CodeImp.DoomBuilder.Config
|
|||
private readonly bool doommapformat;
|
||||
private readonly bool hexenmapformat;
|
||||
private readonly bool universalmapformat;
|
||||
private readonly bool srb2mapformat;
|
||||
|
||||
// Texture/flat/voxel sources
|
||||
private readonly IDictionary textureranges;
|
||||
|
@ -213,6 +214,7 @@ namespace CodeImp.DoomBuilder.Config
|
|||
public bool UDMF { get { return universalmapformat; } }
|
||||
public bool HEXEN { get { return hexenmapformat; } }
|
||||
public bool DOOM { get { return doommapformat; } }
|
||||
public bool SRB2 { get { return srb2mapformat; } }
|
||||
|
||||
// Texture/flat/voxel sources
|
||||
public IDictionary TextureRanges { get { return textureranges; } }
|
||||
|
@ -354,6 +356,7 @@ namespace CodeImp.DoomBuilder.Config
|
|||
universalmapformat = (formatinterface == "UniversalMapSetIO");
|
||||
hexenmapformat = (formatinterface == "HexenMapSetIO");
|
||||
doommapformat = (formatinterface == "DoomMapSetIO");
|
||||
srb2mapformat = (formatinterface == "SRB2MapSetIO");
|
||||
|
||||
//mxd. Texture names length
|
||||
longtexturenames = cfg.ReadSetting("longtexturenames", false);
|
||||
|
|
|
@ -126,6 +126,7 @@ namespace CodeImp.DoomBuilder
|
|||
public bool UDMF { get { return config.UDMF; } }
|
||||
public bool HEXEN { get { return config.HEXEN; } }
|
||||
public bool DOOM { get { return config.DOOM; } }
|
||||
public bool SRB2 { get { return config.SRB2; } }
|
||||
|
||||
//mxd. Scripts
|
||||
internal Dictionary<string, ScriptItem> NamedScripts { get { return namedscripts; } }
|
||||
|
|
|
@ -38,6 +38,7 @@ namespace CodeImp.DoomBuilder.IO
|
|||
protected Dictionary<int, int[]> threeDFloorTypes;
|
||||
protected Dictionary<int, int[]> slopeTypes;
|
||||
protected Dictionary<int, int[]> slopeCopyTypes;
|
||||
protected Dictionary<int, int[]> vertexSlopeTypes;
|
||||
#endregion
|
||||
|
||||
#region ================== Constructor / Disposer
|
||||
|
@ -48,6 +49,7 @@ namespace CodeImp.DoomBuilder.IO
|
|||
threeDFloorTypes = new Dictionary<int, int[]>() { { 160, new int[3] { -1, -1, -1 } } };
|
||||
slopeTypes = new Dictionary<int, int[]>() { { 181, new int[2] { -1, -1 } } };
|
||||
slopeCopyTypes = new Dictionary<int, int[]>() { { 118, new int[2] { -1, -1 } } };
|
||||
vertexSlopeTypes = new Dictionary<int, int[]>() { };
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
@ -99,6 +101,8 @@ namespace CodeImp.DoomBuilder.IO
|
|||
public override Dictionary<int, int[]> ThreeDFloorTypes { get { return threeDFloorTypes; } }
|
||||
public override Dictionary<int, int[]> SlopeTypes { get { return slopeTypes; } }
|
||||
public override Dictionary<int, int[]> SlopeCopyTypes { get { return slopeCopyTypes; } }
|
||||
public override Dictionary<int, int[]> VertexSlopeTypes { get { return vertexSlopeTypes; } }
|
||||
public override int SlopeVertexType { get { return 9500; } }
|
||||
public override int Custom3DFloorType { get { return 160; } }
|
||||
|
||||
#endregion
|
||||
|
|
|
@ -38,6 +38,7 @@ namespace CodeImp.DoomBuilder.IO
|
|||
protected Dictionary<int, int[]> threeDFloorTypes;
|
||||
protected Dictionary<int, int[]> slopeTypes;
|
||||
protected Dictionary<int, int[]> slopeCopyTypes;
|
||||
protected Dictionary<int, int[]> vertexSlopeTypes;
|
||||
#endregion
|
||||
|
||||
#region ================== Constructor / Disposer
|
||||
|
@ -48,6 +49,7 @@ namespace CodeImp.DoomBuilder.IO
|
|||
threeDFloorTypes = new Dictionary<int, int[]>() { { 160, new int[3] { -1, -1, -1 } } };
|
||||
slopeTypes = new Dictionary<int, int[]>() { { 181, new int[2] { -1, -1 } } };
|
||||
slopeCopyTypes = new Dictionary<int, int[]>() { { 118, new int[2] { -1, -1 } } };
|
||||
vertexSlopeTypes = new Dictionary<int, int[]>() { };
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
@ -99,6 +101,8 @@ namespace CodeImp.DoomBuilder.IO
|
|||
public override Dictionary<int, int[]> ThreeDFloorTypes { get { return threeDFloorTypes; } }
|
||||
public override Dictionary<int, int[]> SlopeTypes { get { return slopeTypes; } }
|
||||
public override Dictionary<int, int[]> SlopeCopyTypes { get { return slopeCopyTypes; } }
|
||||
public override Dictionary<int, int[]> VertexSlopeTypes { get { return vertexSlopeTypes; } }
|
||||
public override int SlopeVertexType { get { return 9500; } }
|
||||
public override int Custom3DFloorType { get { return 160; } }
|
||||
|
||||
#endregion
|
||||
|
|
|
@ -73,6 +73,8 @@ namespace CodeImp.DoomBuilder.IO
|
|||
Dictionary<int, int[]> ThreeDFloorTypes { get; }
|
||||
Dictionary<int,int[]> SlopeTypes { get; }
|
||||
Dictionary<int, int[]> SlopeCopyTypes { get; }
|
||||
Dictionary<int, int[]> VertexSlopeTypes { get; }
|
||||
int SlopeVertexType { get; }
|
||||
int Custom3DFloorType { get; }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -94,6 +94,8 @@ namespace CodeImp.DoomBuilder.IO
|
|||
public abstract Dictionary<int, int[]> ThreeDFloorTypes { get; }
|
||||
public abstract Dictionary<int, int[]> SlopeTypes { get; }
|
||||
public abstract Dictionary<int, int[]> SlopeCopyTypes { get; }
|
||||
public abstract Dictionary<int, int[]> VertexSlopeTypes { get; }
|
||||
public abstract int SlopeVertexType { get; }
|
||||
public abstract int Custom3DFloorType { get; }
|
||||
|
||||
#endregion
|
||||
|
|
|
@ -120,6 +120,16 @@ namespace CodeImp.DoomBuilder.IO
|
|||
{ 721, new int[2] { 0, 1 } },
|
||||
{ 722, new int[2] { 1, 1 } },
|
||||
};
|
||||
|
||||
//Dictionary contents:
|
||||
//1. 0 = slope front, 1 = slope back
|
||||
//2. 0 = slope floor, 1 = slope ceiling
|
||||
vertexSlopeTypes = new Dictionary<int, int[]>() {
|
||||
{ 704, new int[2] { 0, 0 } },
|
||||
{ 705, new int[2] { 0, 1 } },
|
||||
{ 714, new int[2] { 1, 0 } },
|
||||
{ 715, new int[2] { 1, 1 } },
|
||||
};
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
@ -129,6 +139,7 @@ namespace CodeImp.DoomBuilder.IO
|
|||
public override bool HasLinedefParameters { get { return false; } }
|
||||
public override bool HasTranslucent3DFloors { get { return true; } }
|
||||
public override int Custom3DFloorType { get { return 259; } }
|
||||
public override int SlopeVertexType { get { return 750; } }
|
||||
public override int MaxThingHeight { get { return 4095; } }
|
||||
public override int MinThingHeight { get { return 0; } }
|
||||
#endregion
|
||||
|
|
|
@ -41,6 +41,7 @@ namespace CodeImp.DoomBuilder.IO
|
|||
protected Dictionary<int, int[]> threeDFloorTypes;
|
||||
protected Dictionary<int, int[]> slopeTypes;
|
||||
protected Dictionary<int, int[]> slopeCopyTypes;
|
||||
protected Dictionary<int, int[]> vertexSlopeTypes;
|
||||
#endregion
|
||||
|
||||
#region ================== Constructor / Disposer
|
||||
|
@ -53,6 +54,7 @@ namespace CodeImp.DoomBuilder.IO
|
|||
threeDFloorTypes = new Dictionary<int, int[]>() { { 160, new int[3] { -1, -1, -1 } } };
|
||||
slopeTypes = new Dictionary<int, int[]>() { { 181, new int[2] { -1, -1 } } };
|
||||
slopeCopyTypes = new Dictionary<int, int[]>() { { 118, new int[2] { -1, -1 } } };
|
||||
vertexSlopeTypes = new Dictionary<int, int[]>() { };
|
||||
// Make configuration
|
||||
Configuration config = new Configuration();
|
||||
|
||||
|
@ -149,6 +151,8 @@ namespace CodeImp.DoomBuilder.IO
|
|||
public override Dictionary<int, int[]> ThreeDFloorTypes { get { return threeDFloorTypes; } }
|
||||
public override Dictionary<int, int[]> SlopeTypes { get { return slopeTypes; } }
|
||||
public override Dictionary<int, int[]> SlopeCopyTypes { get { return slopeCopyTypes; } }
|
||||
public override Dictionary<int, int[]> VertexSlopeTypes { get { return vertexSlopeTypes; } }
|
||||
public override int SlopeVertexType { get { return 9500; } }
|
||||
public override int Custom3DFloorType { get { return 160; } }
|
||||
|
||||
#endregion
|
||||
|
|
|
@ -94,6 +94,7 @@ namespace CodeImp.DoomBuilder.Map
|
|||
public bool Is3DFloor { get { return General.Map.FormatInterface.ThreeDFloorTypes.ContainsKey(Action); } }
|
||||
public bool IsSlope { get { return General.Map.FormatInterface.SlopeTypes.ContainsKey(Action); } }
|
||||
public bool IsSlopeCopy { get { return General.Map.FormatInterface.SlopeCopyTypes.ContainsKey(Action); } }
|
||||
public bool IsVertexSlope { get { return General.Map.FormatInterface.VertexSlopeTypes.ContainsKey(Action); } }
|
||||
public int Tag { get { return tags[0]; } set { BeforePropsChange(); tags[0] = value; if((value < General.Map.FormatInterface.MinTag) || (value > General.Map.FormatInterface.MaxTag)) throw new ArgumentOutOfRangeException("Tag", "Invalid tag number"); } } //mxd
|
||||
public List<int> Tags { get { return tags; } set { BeforePropsChange(); tags = value; } } //mxd
|
||||
public float LengthSq { get { return lengthsq; } }
|
||||
|
@ -801,7 +802,7 @@ namespace CodeImp.DoomBuilder.Map
|
|||
//Read settings for preconfigured 3D floor type
|
||||
int[] settings = General.Map.FormatInterface.ThreeDFloorTypes[Action];
|
||||
Args[1] = settings[0];
|
||||
Args[2] = Flags.ContainsKey("64") && Flags["64"] ? settings[3] : settings[1]; //Flags may depend on whether the noclimb flag is set
|
||||
Args[2] = IsFlagSet("64") ? settings[3] : settings[1]; //Flags may depend on whether the noclimb flag is set
|
||||
switch (settings[2])
|
||||
{
|
||||
case 0:
|
||||
|
@ -864,6 +865,16 @@ namespace CodeImp.DoomBuilder.Map
|
|||
Args[4] = 0; //share (irrelevant for SRB2)
|
||||
}
|
||||
|
||||
//Set slope arguments for SRB2-style vertex slopes. These are fake arguments I invented to make their handling easier.
|
||||
//Args[0]: 0 = slope front sector, 1 = slope back sector
|
||||
//Args[1]: 0 = slope floor, 1 = slope ceiling
|
||||
public void SetVertexSlopeArgs()
|
||||
{
|
||||
int[] settings = General.Map.FormatInterface.VertexSlopeTypes[Action];
|
||||
Args[0] = settings[0];
|
||||
Args[1] = settings[1];
|
||||
}
|
||||
|
||||
// This checks and returns a flag without creating it
|
||||
public bool IsFlagSet(string flagname)
|
||||
{
|
||||
|
|
|
@ -119,13 +119,15 @@ namespace CodeImp.DoomBuilder.Map
|
|||
public bool IsModel { get { return ismodel; } } //mxd
|
||||
public bool IsDirectional { get { return directional; } } //mxd
|
||||
public bool Highlighted { get { return highlighted; } set { highlighted = value; } } //mxd
|
||||
public bool IsSlopeVertex { get { return General.Map.FormatInterface.SlopeVertexType == this.Type; } }
|
||||
|
||||
#endregion
|
||||
|
||||
#region ================== Constructor / Disposer
|
||||
#endregion
|
||||
|
||||
// Constructor
|
||||
internal Thing(MapSet map, int listindex)
|
||||
#region ================== Constructor / Disposer
|
||||
|
||||
// Constructor
|
||||
internal Thing(MapSet map, int listindex)
|
||||
{
|
||||
// Initialize
|
||||
this.elementtype = MapElementType.THING; //mxd
|
||||
|
|
|
@ -415,6 +415,7 @@
|
|||
<Compile Include="VisualModes\EffectPlaneCopySlope.cs" />
|
||||
<Compile Include="VisualModes\EffectThingLineSlope.cs" />
|
||||
<Compile Include="VisualModes\EffectThingSlope.cs" />
|
||||
<Compile Include="VisualModes\EffectSRB2ThingVertexSlope.cs" />
|
||||
<Compile Include="VisualModes\EffectThingVertexSlope.cs" />
|
||||
<Compile Include="VisualModes\EffectTransferCeilingBrightness.cs" />
|
||||
<Compile Include="VisualModes\EffectTransferFloorBrightness.cs" />
|
||||
|
@ -509,7 +510,7 @@
|
|||
<EmbeddedResource Include="Interface\WavefrontSettingsForm.resx">
|
||||
<DependentUpon>WavefrontSettingsForm.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Resources\VisualMode.png" />
|
||||
<EmbeddedResource Include="Resources\VisualMode.png" />
|
||||
<EmbeddedResource Include="Resources\VisualModeGZ.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
|
|
|
@ -833,57 +833,60 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
}
|
||||
}
|
||||
|
||||
// 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;
|
||||
if (!General.Map.SRB2)
|
||||
{
|
||||
// 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);
|
||||
|
||||
// Check if a thing is at this vertex
|
||||
VisualBlockEntry b = blockmap.GetBlock(blockmap.GetBlockCoordinates(v.Position));
|
||||
foreach(Thing t in b.Things)
|
||||
{
|
||||
if((Vector2D)t.Position == v.Position)
|
||||
{
|
||||
switch(t.Type)
|
||||
{
|
||||
//case 1504: slopefloorthings.Add(t); break;
|
||||
//case 1505: slopeceilingthings.Add(t); break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
foreach (Sidedef sd in s.Sidedefs)
|
||||
{
|
||||
Vertex v = sd.IsFront ? sd.Line.End : sd.Line.Start;
|
||||
|
||||
// Slope any floor vertices?
|
||||
if(slopefloorthings.Count > 0)
|
||||
{
|
||||
SectorData sd = GetSectorData(s);
|
||||
sd.AddEffectThingVertexSlope(slopefloorthings, true);
|
||||
}
|
||||
// Check if a thing is at this vertex
|
||||
VisualBlockEntry b = blockmap.GetBlock(blockmap.GetBlockCoordinates(v.Position));
|
||||
foreach (Thing t in b.Things)
|
||||
{
|
||||
if ((Vector2D)t.Position == v.Position)
|
||||
{
|
||||
switch (t.Type)
|
||||
{
|
||||
case 1504: slopefloorthings.Add(t); break;
|
||||
case 1505: slopeceilingthings.Add(t); break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Slope any ceiling vertices?
|
||||
if(slopeceilingthings.Count > 0)
|
||||
{
|
||||
SectorData sd = GetSectorData(s);
|
||||
sd.AddEffectThingVertexSlope(slopeceilingthings, false);
|
||||
}
|
||||
}
|
||||
|
||||
// ========== mxd. Glowing flats ==========
|
||||
if(General.Map.Data.GlowingFlats.ContainsKey(s.LongFloorTexture) || General.Map.Data.GlowingFlats.ContainsKey(s.LongCeilTexture))
|
||||
{
|
||||
SectorData sd = GetSectorData(s);
|
||||
sd.AddEffectGlowingFlat(s);
|
||||
}
|
||||
}
|
||||
// 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);
|
||||
}
|
||||
}
|
||||
|
||||
// ========== mxd. Glowing flats ==========
|
||||
if (General.Map.Data.GlowingFlats.ContainsKey(s.LongFloorTexture) || General.Map.Data.GlowingFlats.ContainsKey(s.LongCeilTexture))
|
||||
{
|
||||
SectorData sd = GetSectorData(s);
|
||||
sd.AddEffectGlowingFlat(s);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Find interesting linedefs (such as line slopes)
|
||||
foreach (Linedef l in General.Map.Map.Linedefs)
|
||||
|
@ -945,6 +948,58 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
}
|
||||
}
|
||||
|
||||
// MascaraSnake: Vertex slopes, SRB2-style
|
||||
if (General.Map.SRB2 && l.IsVertexSlope)
|
||||
{
|
||||
l.SetVertexSlopeArgs();
|
||||
bool slopefloor = l.Args[1] == 0;
|
||||
List<Thing> slopevertices = new List<Thing>(3);
|
||||
Sector s = (l.Args[0] == 0) ? l.Front.Sector : l.Back.Sector;
|
||||
|
||||
//If NOKNUCKLES is set, use tag, X offset and Y offset to search for slope vertices.
|
||||
if (l.IsFlagSet("8192"))
|
||||
{
|
||||
bool foundtag = false;
|
||||
bool foundxoffset = false;
|
||||
bool foundyoffset = false;
|
||||
foreach (Thing t in General.Map.Map.Things)
|
||||
{
|
||||
if (t.IsSlopeVertex)
|
||||
{
|
||||
if (!foundtag && (int)t.AngleDoom == l.Tag)
|
||||
{
|
||||
slopevertices.Add(t);
|
||||
foundtag = true;
|
||||
}
|
||||
if (!foundxoffset && (int)t.AngleDoom == l.Front.OffsetX)
|
||||
{
|
||||
slopevertices.Add(t);
|
||||
foundxoffset = true;
|
||||
}
|
||||
if (!foundyoffset && (int)t.AngleDoom == l.Front.OffsetY)
|
||||
{
|
||||
slopevertices.Add(t);
|
||||
foundyoffset = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
//Otherwise, just use tag.
|
||||
else
|
||||
{
|
||||
foreach (Thing t in General.Map.Map.Things)
|
||||
{
|
||||
if (t.IsSlopeVertex && (int)t.AngleDoom == l.Tag) slopevertices.Add(t);
|
||||
}
|
||||
}
|
||||
if (slopevertices.Count >= 3)
|
||||
{
|
||||
SectorData sd = GetSectorData(s);
|
||||
sd.AddEffectSRB2ThingVertexSlope(slopevertices, slopefloor);
|
||||
}
|
||||
}
|
||||
|
||||
// MascaraSnake: 3D floor handling
|
||||
// ========== Sector 3D floor (see http://zdoom.org/wiki/Sector_Set3dFloor) ==========
|
||||
if (l.Is3DFloor)
|
||||
|
@ -966,7 +1021,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
}
|
||||
|
||||
}
|
||||
if (General.Map.FormatInterface.HasLinedefParameters)
|
||||
if (!General.Map.SRB2)
|
||||
{
|
||||
switch (l.Action)
|
||||
{
|
||||
|
@ -1012,45 +1067,48 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
}
|
||||
}
|
||||
|
||||
// Find interesting things (such as sector slopes)
|
||||
foreach(Thing t in General.Map.Map.Things)
|
||||
{
|
||||
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;
|
||||
if (!General.Map.SRB2)
|
||||
{
|
||||
// Find interesting things (such as sector slopes)
|
||||
foreach (Thing t in General.Map.Map.Things)
|
||||
{
|
||||
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;
|
||||
|
||||
// ========== Thing line slope ==========
|
||||
case 9501:
|
||||
case 9500:
|
||||
t.DetermineSector(blockmap);
|
||||
if(t.Sector != null)
|
||||
{
|
||||
SectorData sd = GetSectorData(t.Sector);
|
||||
sd.AddEffectThingLineSlope(t);
|
||||
}
|
||||
break;
|
||||
// ========== Thing line slope ==========
|
||||
case 9501:
|
||||
case 9500:
|
||||
t.DetermineSector(blockmap);
|
||||
if (t.Sector != null)
|
||||
{
|
||||
SectorData sd = GetSectorData(t.Sector);
|
||||
sd.AddEffectThingLineSlope(t);
|
||||
}
|
||||
break;
|
||||
|
||||
// ========== Thing slope ==========
|
||||
case 9503:
|
||||
case 9502:
|
||||
t.DetermineSector(blockmap);
|
||||
if(t.Sector != null)
|
||||
{
|
||||
SectorData sd = GetSectorData(t.Sector);
|
||||
sd.AddEffectThingSlope(t);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
// ========== Thing slope ==========
|
||||
case 9503:
|
||||
case 9502:
|
||||
t.DetermineSector(blockmap);
|
||||
if (t.Sector != null)
|
||||
{
|
||||
SectorData sd = GetSectorData(t.Sector);
|
||||
sd.AddEffectThingSlope(t);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
|
|
@ -0,0 +1,55 @@
|
|||
#region === Copyright (c) 2010 Pascal van der Heiden ===
|
||||
|
||||
using System.Collections.Generic;
|
||||
using CodeImp.DoomBuilder.Geometry;
|
||||
using CodeImp.DoomBuilder.Map;
|
||||
|
||||
#endregion
|
||||
|
||||
namespace CodeImp.DoomBuilder.BuilderModes
|
||||
{
|
||||
internal class EffectSRB2ThingVertexSlope : SectorEffect
|
||||
{
|
||||
// Things used to create this effect.
|
||||
private List<Thing> things;
|
||||
|
||||
// Floor or ceiling?
|
||||
private bool slopefloor;
|
||||
|
||||
// Constructor
|
||||
public EffectSRB2ThingVertexSlope(SectorData data, List<Thing> sourcethings, bool floor) : base(data)
|
||||
{
|
||||
things = sourcethings;
|
||||
slopefloor = floor;
|
||||
|
||||
// New effect added: This sector needs an update!
|
||||
if(data.Mode.VisualSectorExists(data.Sector))
|
||||
{
|
||||
BaseVisualSector vs = (BaseVisualSector)data.Mode.GetVisualSector(data.Sector);
|
||||
vs.UpdateSectorGeometry(true);
|
||||
}
|
||||
}
|
||||
|
||||
// This makes sure we are updated with the source linedef information
|
||||
public override void Update()
|
||||
{
|
||||
// Create vertices in clockwise order
|
||||
Vector3D[] verts = new Vector3D[3];
|
||||
int index = 0;
|
||||
foreach (Thing t in things)
|
||||
{
|
||||
ThingData td = data.Mode.GetThingData(t);
|
||||
td.AddUpdateSector(data.Sector, true);
|
||||
verts[index] = t.Position;
|
||||
index++;
|
||||
if (index > 2) break; //Only the first three vertices are used
|
||||
}
|
||||
|
||||
// Make new plane
|
||||
if(slopefloor)
|
||||
data.Floor.plane = new Plane(verts[0], verts[1], verts[2], true);
|
||||
else
|
||||
data.Ceiling.plane = new Plane(verts[0], verts[2], verts[1], false);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -174,8 +174,15 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
alleffects.Add(e);
|
||||
}
|
||||
|
||||
//mxd. Add UDMF vertex offset effect
|
||||
public void AddEffectVertexOffset()
|
||||
// SRB2-style Thing vertex slope effect
|
||||
public void AddEffectSRB2ThingVertexSlope(List<Thing> sourcethings, bool slopefloor)
|
||||
{
|
||||
EffectSRB2ThingVertexSlope e = new EffectSRB2ThingVertexSlope(this, sourcethings, slopefloor);
|
||||
alleffects.Add(e);
|
||||
}
|
||||
|
||||
//mxd. Add UDMF vertex offset effect
|
||||
public void AddEffectVertexOffset()
|
||||
{
|
||||
EffectUDMFVertexOffset e = new EffectUDMFVertexOffset(this);
|
||||
alleffects.Add(e);
|
||||
|
|
Loading…
Reference in a new issue