Vertex slopes are now rendered in Visual Mode.

This commit is contained in:
MascaraSnake 2016-01-02 14:21:15 +01:00
parent 09a08d2363
commit bbfb569d0f
14 changed files with 259 additions and 94 deletions

View file

@ -97,6 +97,7 @@ namespace CodeImp.DoomBuilder.Config
private readonly bool doommapformat; private readonly bool doommapformat;
private readonly bool hexenmapformat; private readonly bool hexenmapformat;
private readonly bool universalmapformat; private readonly bool universalmapformat;
private readonly bool srb2mapformat;
// Texture/flat/voxel sources // Texture/flat/voxel sources
private readonly IDictionary textureranges; private readonly IDictionary textureranges;
@ -213,6 +214,7 @@ namespace CodeImp.DoomBuilder.Config
public bool UDMF { get { return universalmapformat; } } public bool UDMF { get { return universalmapformat; } }
public bool HEXEN { get { return hexenmapformat; } } public bool HEXEN { get { return hexenmapformat; } }
public bool DOOM { get { return doommapformat; } } public bool DOOM { get { return doommapformat; } }
public bool SRB2 { get { return srb2mapformat; } }
// Texture/flat/voxel sources // Texture/flat/voxel sources
public IDictionary TextureRanges { get { return textureranges; } } public IDictionary TextureRanges { get { return textureranges; } }
@ -354,6 +356,7 @@ namespace CodeImp.DoomBuilder.Config
universalmapformat = (formatinterface == "UniversalMapSetIO"); universalmapformat = (formatinterface == "UniversalMapSetIO");
hexenmapformat = (formatinterface == "HexenMapSetIO"); hexenmapformat = (formatinterface == "HexenMapSetIO");
doommapformat = (formatinterface == "DoomMapSetIO"); doommapformat = (formatinterface == "DoomMapSetIO");
srb2mapformat = (formatinterface == "SRB2MapSetIO");
//mxd. Texture names length //mxd. Texture names length
longtexturenames = cfg.ReadSetting("longtexturenames", false); longtexturenames = cfg.ReadSetting("longtexturenames", false);

View file

@ -126,6 +126,7 @@ namespace CodeImp.DoomBuilder
public bool UDMF { get { return config.UDMF; } } public bool UDMF { get { return config.UDMF; } }
public bool HEXEN { get { return config.HEXEN; } } public bool HEXEN { get { return config.HEXEN; } }
public bool DOOM { get { return config.DOOM; } } public bool DOOM { get { return config.DOOM; } }
public bool SRB2 { get { return config.SRB2; } }
//mxd. Scripts //mxd. Scripts
internal Dictionary<string, ScriptItem> NamedScripts { get { return namedscripts; } } internal Dictionary<string, ScriptItem> NamedScripts { get { return namedscripts; } }

View file

@ -38,6 +38,7 @@ namespace CodeImp.DoomBuilder.IO
protected Dictionary<int, int[]> threeDFloorTypes; protected Dictionary<int, int[]> threeDFloorTypes;
protected Dictionary<int, int[]> slopeTypes; protected Dictionary<int, int[]> slopeTypes;
protected Dictionary<int, int[]> slopeCopyTypes; protected Dictionary<int, int[]> slopeCopyTypes;
protected Dictionary<int, int[]> vertexSlopeTypes;
#endregion #endregion
#region ================== Constructor / Disposer #region ================== Constructor / Disposer
@ -48,6 +49,7 @@ namespace CodeImp.DoomBuilder.IO
threeDFloorTypes = new Dictionary<int, int[]>() { { 160, new int[3] { -1, -1, -1 } } }; threeDFloorTypes = new Dictionary<int, int[]>() { { 160, new int[3] { -1, -1, -1 } } };
slopeTypes = new Dictionary<int, int[]>() { { 181, new int[2] { -1, -1 } } }; slopeTypes = new Dictionary<int, int[]>() { { 181, new int[2] { -1, -1 } } };
slopeCopyTypes = new Dictionary<int, int[]>() { { 118, new int[2] { -1, -1 } } }; slopeCopyTypes = new Dictionary<int, int[]>() { { 118, new int[2] { -1, -1 } } };
vertexSlopeTypes = new Dictionary<int, int[]>() { };
} }
#endregion #endregion
@ -99,6 +101,8 @@ namespace CodeImp.DoomBuilder.IO
public override Dictionary<int, int[]> ThreeDFloorTypes { get { return threeDFloorTypes; } } public override Dictionary<int, int[]> ThreeDFloorTypes { get { return threeDFloorTypes; } }
public override Dictionary<int, int[]> SlopeTypes { get { return slopeTypes; } } public override Dictionary<int, int[]> SlopeTypes { get { return slopeTypes; } }
public override Dictionary<int, int[]> SlopeCopyTypes { get { return slopeCopyTypes; } } 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; } } public override int Custom3DFloorType { get { return 160; } }
#endregion #endregion

View file

@ -38,6 +38,7 @@ namespace CodeImp.DoomBuilder.IO
protected Dictionary<int, int[]> threeDFloorTypes; protected Dictionary<int, int[]> threeDFloorTypes;
protected Dictionary<int, int[]> slopeTypes; protected Dictionary<int, int[]> slopeTypes;
protected Dictionary<int, int[]> slopeCopyTypes; protected Dictionary<int, int[]> slopeCopyTypes;
protected Dictionary<int, int[]> vertexSlopeTypes;
#endregion #endregion
#region ================== Constructor / Disposer #region ================== Constructor / Disposer
@ -48,6 +49,7 @@ namespace CodeImp.DoomBuilder.IO
threeDFloorTypes = new Dictionary<int, int[]>() { { 160, new int[3] { -1, -1, -1 } } }; threeDFloorTypes = new Dictionary<int, int[]>() { { 160, new int[3] { -1, -1, -1 } } };
slopeTypes = new Dictionary<int, int[]>() { { 181, new int[2] { -1, -1 } } }; slopeTypes = new Dictionary<int, int[]>() { { 181, new int[2] { -1, -1 } } };
slopeCopyTypes = new Dictionary<int, int[]>() { { 118, new int[2] { -1, -1 } } }; slopeCopyTypes = new Dictionary<int, int[]>() { { 118, new int[2] { -1, -1 } } };
vertexSlopeTypes = new Dictionary<int, int[]>() { };
} }
#endregion #endregion
@ -99,6 +101,8 @@ namespace CodeImp.DoomBuilder.IO
public override Dictionary<int, int[]> ThreeDFloorTypes { get { return threeDFloorTypes; } } public override Dictionary<int, int[]> ThreeDFloorTypes { get { return threeDFloorTypes; } }
public override Dictionary<int, int[]> SlopeTypes { get { return slopeTypes; } } public override Dictionary<int, int[]> SlopeTypes { get { return slopeTypes; } }
public override Dictionary<int, int[]> SlopeCopyTypes { get { return slopeCopyTypes; } } 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; } } public override int Custom3DFloorType { get { return 160; } }
#endregion #endregion

View file

@ -73,6 +73,8 @@ namespace CodeImp.DoomBuilder.IO
Dictionary<int, int[]> ThreeDFloorTypes { get; } Dictionary<int, int[]> ThreeDFloorTypes { get; }
Dictionary<int,int[]> SlopeTypes { get; } Dictionary<int,int[]> SlopeTypes { get; }
Dictionary<int, int[]> SlopeCopyTypes { get; } Dictionary<int, int[]> SlopeCopyTypes { get; }
Dictionary<int, int[]> VertexSlopeTypes { get; }
int SlopeVertexType { get; }
int Custom3DFloorType { get; } int Custom3DFloorType { get; }
} }
} }

View file

@ -94,6 +94,8 @@ namespace CodeImp.DoomBuilder.IO
public abstract Dictionary<int, int[]> ThreeDFloorTypes { get; } public abstract Dictionary<int, int[]> ThreeDFloorTypes { get; }
public abstract Dictionary<int, int[]> SlopeTypes { get; } public abstract Dictionary<int, int[]> SlopeTypes { get; }
public abstract Dictionary<int, int[]> SlopeCopyTypes { 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; } public abstract int Custom3DFloorType { get; }
#endregion #endregion

View file

@ -120,6 +120,16 @@ namespace CodeImp.DoomBuilder.IO
{ 721, new int[2] { 0, 1 } }, { 721, new int[2] { 0, 1 } },
{ 722, new int[2] { 1, 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 #endregion
@ -129,6 +139,7 @@ namespace CodeImp.DoomBuilder.IO
public override bool HasLinedefParameters { get { return false; } } public override bool HasLinedefParameters { get { return false; } }
public override bool HasTranslucent3DFloors { get { return true; } } public override bool HasTranslucent3DFloors { get { return true; } }
public override int Custom3DFloorType { get { return 259; } } public override int Custom3DFloorType { get { return 259; } }
public override int SlopeVertexType { get { return 750; } }
public override int MaxThingHeight { get { return 4095; } } public override int MaxThingHeight { get { return 4095; } }
public override int MinThingHeight { get { return 0; } } public override int MinThingHeight { get { return 0; } }
#endregion #endregion

View file

@ -41,6 +41,7 @@ namespace CodeImp.DoomBuilder.IO
protected Dictionary<int, int[]> threeDFloorTypes; protected Dictionary<int, int[]> threeDFloorTypes;
protected Dictionary<int, int[]> slopeTypes; protected Dictionary<int, int[]> slopeTypes;
protected Dictionary<int, int[]> slopeCopyTypes; protected Dictionary<int, int[]> slopeCopyTypes;
protected Dictionary<int, int[]> vertexSlopeTypes;
#endregion #endregion
#region ================== Constructor / Disposer #region ================== Constructor / Disposer
@ -53,6 +54,7 @@ namespace CodeImp.DoomBuilder.IO
threeDFloorTypes = new Dictionary<int, int[]>() { { 160, new int[3] { -1, -1, -1 } } }; threeDFloorTypes = new Dictionary<int, int[]>() { { 160, new int[3] { -1, -1, -1 } } };
slopeTypes = new Dictionary<int, int[]>() { { 181, new int[2] { -1, -1 } } }; slopeTypes = new Dictionary<int, int[]>() { { 181, new int[2] { -1, -1 } } };
slopeCopyTypes = new Dictionary<int, int[]>() { { 118, new int[2] { -1, -1 } } }; slopeCopyTypes = new Dictionary<int, int[]>() { { 118, new int[2] { -1, -1 } } };
vertexSlopeTypes = new Dictionary<int, int[]>() { };
// Make configuration // Make configuration
Configuration config = new 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[]> ThreeDFloorTypes { get { return threeDFloorTypes; } }
public override Dictionary<int, int[]> SlopeTypes { get { return slopeTypes; } } public override Dictionary<int, int[]> SlopeTypes { get { return slopeTypes; } }
public override Dictionary<int, int[]> SlopeCopyTypes { get { return slopeCopyTypes; } } 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; } } public override int Custom3DFloorType { get { return 160; } }
#endregion #endregion

View file

@ -94,6 +94,7 @@ namespace CodeImp.DoomBuilder.Map
public bool Is3DFloor { get { return General.Map.FormatInterface.ThreeDFloorTypes.ContainsKey(Action); } } public bool Is3DFloor { get { return General.Map.FormatInterface.ThreeDFloorTypes.ContainsKey(Action); } }
public bool IsSlope { get { return General.Map.FormatInterface.SlopeTypes.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 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 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 List<int> Tags { get { return tags; } set { BeforePropsChange(); tags = value; } } //mxd
public float LengthSq { get { return lengthsq; } } public float LengthSq { get { return lengthsq; } }
@ -801,7 +802,7 @@ namespace CodeImp.DoomBuilder.Map
//Read settings for preconfigured 3D floor type //Read settings for preconfigured 3D floor type
int[] settings = General.Map.FormatInterface.ThreeDFloorTypes[Action]; int[] settings = General.Map.FormatInterface.ThreeDFloorTypes[Action];
Args[1] = settings[0]; 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]) switch (settings[2])
{ {
case 0: case 0:
@ -864,6 +865,16 @@ namespace CodeImp.DoomBuilder.Map
Args[4] = 0; //share (irrelevant for SRB2) 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 // This checks and returns a flag without creating it
public bool IsFlagSet(string flagname) public bool IsFlagSet(string flagname)
{ {

View file

@ -119,13 +119,15 @@ namespace CodeImp.DoomBuilder.Map
public bool IsModel { get { return ismodel; } } //mxd public bool IsModel { get { return ismodel; } } //mxd
public bool IsDirectional { get { return directional; } } //mxd public bool IsDirectional { get { return directional; } } //mxd
public bool Highlighted { get { return highlighted; } set { highlighted = value; } } //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 #region ================== Constructor / Disposer
internal Thing(MapSet map, int listindex)
// Constructor
internal Thing(MapSet map, int listindex)
{ {
// Initialize // Initialize
this.elementtype = MapElementType.THING; //mxd this.elementtype = MapElementType.THING; //mxd

View file

@ -415,6 +415,7 @@
<Compile Include="VisualModes\EffectPlaneCopySlope.cs" /> <Compile Include="VisualModes\EffectPlaneCopySlope.cs" />
<Compile Include="VisualModes\EffectThingLineSlope.cs" /> <Compile Include="VisualModes\EffectThingLineSlope.cs" />
<Compile Include="VisualModes\EffectThingSlope.cs" /> <Compile Include="VisualModes\EffectThingSlope.cs" />
<Compile Include="VisualModes\EffectSRB2ThingVertexSlope.cs" />
<Compile Include="VisualModes\EffectThingVertexSlope.cs" /> <Compile Include="VisualModes\EffectThingVertexSlope.cs" />
<Compile Include="VisualModes\EffectTransferCeilingBrightness.cs" /> <Compile Include="VisualModes\EffectTransferCeilingBrightness.cs" />
<Compile Include="VisualModes\EffectTransferFloorBrightness.cs" /> <Compile Include="VisualModes\EffectTransferFloorBrightness.cs" />
@ -509,7 +510,7 @@
<EmbeddedResource Include="Interface\WavefrontSettingsForm.resx"> <EmbeddedResource Include="Interface\WavefrontSettingsForm.resx">
<DependentUpon>WavefrontSettingsForm.cs</DependentUpon> <DependentUpon>WavefrontSettingsForm.cs</DependentUpon>
</EmbeddedResource> </EmbeddedResource>
<EmbeddedResource Include="Resources\VisualMode.png" /> <EmbeddedResource Include="Resources\VisualMode.png" />
<EmbeddedResource Include="Resources\VisualModeGZ.png" /> <EmbeddedResource Include="Resources\VisualModeGZ.png" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

View file

@ -833,57 +833,60 @@ namespace CodeImp.DoomBuilder.BuilderModes
} }
} }
// Find sectors with 3 vertices, because they can be sloped if (!General.Map.SRB2)
foreach(Sector s in General.Map.Map.Sectors) {
{ // Find sectors with 3 vertices, because they can be sloped
// ========== Thing vertex slope, vertices with UDMF vertex offsets ========== foreach (Sector s in General.Map.Map.Sectors)
if(s.Sidedefs.Count == 3) {
{ // ========== Thing vertex slope, vertices with UDMF vertex offsets ==========
if(General.Map.UDMF) GetSectorData(s).AddEffectVertexOffset(); //mxd if (s.Sidedefs.Count == 3)
List<Thing> slopeceilingthings = new List<Thing>(3); {
List<Thing> slopefloorthings = new List<Thing>(3); if (General.Map.UDMF) GetSectorData(s).AddEffectVertexOffset(); //mxd
List<Thing> slopeceilingthings = new List<Thing>(3);
foreach(Sidedef sd in s.Sidedefs) List<Thing> slopefloorthings = new List<Thing>(3);
{
Vertex v = sd.IsFront ? sd.Line.End : sd.Line.Start;
// Check if a thing is at this vertex foreach (Sidedef sd in s.Sidedefs)
VisualBlockEntry b = blockmap.GetBlock(blockmap.GetBlockCoordinates(v.Position)); {
foreach(Thing t in b.Things) Vertex v = sd.IsFront ? sd.Line.End : sd.Line.Start;
{
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? // Check if a thing is at this vertex
if(slopefloorthings.Count > 0) VisualBlockEntry b = blockmap.GetBlock(blockmap.GetBlockCoordinates(v.Position));
{ foreach (Thing t in b.Things)
SectorData sd = GetSectorData(s); {
sd.AddEffectThingVertexSlope(slopefloorthings, true); 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? // Slope any floor vertices?
if(slopeceilingthings.Count > 0) if (slopefloorthings.Count > 0)
{ {
SectorData sd = GetSectorData(s); SectorData sd = GetSectorData(s);
sd.AddEffectThingVertexSlope(slopeceilingthings, false); sd.AddEffectThingVertexSlope(slopefloorthings, true);
} }
}
// Slope any ceiling vertices?
// ========== mxd. Glowing flats ========== if (slopeceilingthings.Count > 0)
if(General.Map.Data.GlowingFlats.ContainsKey(s.LongFloorTexture) || General.Map.Data.GlowingFlats.ContainsKey(s.LongCeilTexture)) {
{ SectorData sd = GetSectorData(s);
SectorData sd = GetSectorData(s); sd.AddEffectThingVertexSlope(slopeceilingthings, false);
sd.AddEffectGlowingFlat(s); }
} }
}
// ========== 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) // Find interesting linedefs (such as line slopes)
foreach (Linedef l in General.Map.Map.Linedefs) 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 // MascaraSnake: 3D floor handling
// ========== Sector 3D floor (see http://zdoom.org/wiki/Sector_Set3dFloor) ========== // ========== Sector 3D floor (see http://zdoom.org/wiki/Sector_Set3dFloor) ==========
if (l.Is3DFloor) if (l.Is3DFloor)
@ -966,7 +1021,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
} }
} }
if (General.Map.FormatInterface.HasLinedefParameters) if (!General.Map.SRB2)
{ {
switch (l.Action) switch (l.Action)
{ {
@ -1012,45 +1067,48 @@ namespace CodeImp.DoomBuilder.BuilderModes
} }
} }
// Find interesting things (such as sector slopes) if (!General.Map.SRB2)
foreach(Thing t in General.Map.Map.Things) {
{ // Find interesting things (such as sector slopes)
switch(t.Type) foreach (Thing t in General.Map.Map.Things)
{ {
// ========== Copy slope ========== switch (t.Type)
case 9511: {
case 9510: // ========== Copy slope ==========
t.DetermineSector(blockmap); case 9511:
if(t.Sector != null) case 9510:
{ t.DetermineSector(blockmap);
SectorData sd = GetSectorData(t.Sector); if (t.Sector != null)
sd.AddEffectCopySlope(t); {
} SectorData sd = GetSectorData(t.Sector);
break; sd.AddEffectCopySlope(t);
}
break;
// ========== Thing line slope ========== // ========== Thing line slope ==========
case 9501: case 9501:
case 9500: case 9500:
t.DetermineSector(blockmap); t.DetermineSector(blockmap);
if(t.Sector != null) if (t.Sector != null)
{ {
SectorData sd = GetSectorData(t.Sector); SectorData sd = GetSectorData(t.Sector);
sd.AddEffectThingLineSlope(t); sd.AddEffectThingLineSlope(t);
} }
break; break;
// ========== Thing slope ========== // ========== Thing slope ==========
case 9503: case 9503:
case 9502: case 9502:
t.DetermineSector(blockmap); t.DetermineSector(blockmap);
if(t.Sector != null) if (t.Sector != null)
{ {
SectorData sd = GetSectorData(t.Sector); SectorData sd = GetSectorData(t.Sector);
sd.AddEffectThingSlope(t); sd.AddEffectThingSlope(t);
} }
break; break;
} }
} }
}
} }
#endregion #endregion

View file

@ -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);
}
}
}

View file

@ -174,8 +174,15 @@ namespace CodeImp.DoomBuilder.BuilderModes
alleffects.Add(e); alleffects.Add(e);
} }
//mxd. Add UDMF vertex offset effect // SRB2-style Thing vertex slope effect
public void AddEffectVertexOffset() 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); EffectUDMFVertexOffset e = new EffectUDMFVertexOffset(this);
alleffects.Add(e); alleffects.Add(e);