Use the absolute Z position to calculate a vertex slope plane, not the one relative to the floor

This commit is contained in:
MascaraSnake 2016-01-05 16:24:36 +01:00
parent df0d4e2e09
commit 27626192fa
3 changed files with 19 additions and 5 deletions

View file

@ -1077,7 +1077,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
if (slopevertices.Count >= 3)
{
SectorData sd = GetSectorData(s);
sd.AddEffectSRB2ThingVertexSlope(slopevertices, slopefloor);
sd.AddEffectSRB2ThingVertexSlope(slopevertices, slopefloor, blockmap);
}
}
}

View file

@ -6,6 +6,10 @@ using CodeImp.DoomBuilder.Map;
#endregion
#region ================== Namespaces
using CodeImp.DoomBuilder.VisualModes;
#endregion
namespace CodeImp.DoomBuilder.BuilderModes
{
internal class EffectSRB2ThingVertexSlope : SectorEffect
@ -15,12 +19,15 @@ namespace CodeImp.DoomBuilder.BuilderModes
// Floor or ceiling?
private bool slopefloor;
private VisualBlockMap blockmap;
// Constructor
public EffectSRB2ThingVertexSlope(SectorData data, List<Thing> sourcethings, bool floor) : base(data)
public EffectSRB2ThingVertexSlope(SectorData data, List<Thing> sourcethings, bool floor, VisualBlockMap bmap) : base(data)
{
things = sourcethings;
slopefloor = floor;
blockmap = bmap;
// New effect added: This sector needs an update!
if(data.Mode.VisualSectorExists(data.Sector))
@ -40,7 +47,10 @@ namespace CodeImp.DoomBuilder.BuilderModes
{
ThingData td = data.Mode.GetThingData(t);
td.AddUpdateSector(data.Sector, true);
verts[index] = t.Position;
Vector3D position = t.Position;
t.DetermineSector(blockmap);
position.z += t.Sector.FloorHeight;
verts[index] = position;
index++;
if (index > 2) break; //Only the first three vertices are used
}

View file

@ -9,6 +9,10 @@ using CodeImp.DoomBuilder.Rendering;
#endregion
#region ================== Namespaces
using CodeImp.DoomBuilder.VisualModes;
#endregion
namespace CodeImp.DoomBuilder.BuilderModes
{
internal class SectorData
@ -175,9 +179,9 @@ namespace CodeImp.DoomBuilder.BuilderModes
}
// SRB2-style Thing vertex slope effect
public void AddEffectSRB2ThingVertexSlope(List<Thing> sourcethings, bool slopefloor)
public void AddEffectSRB2ThingVertexSlope(List<Thing> sourcethings, bool slopefloor, VisualBlockMap blockmap)
{
EffectSRB2ThingVertexSlope e = new EffectSRB2ThingVertexSlope(this, sourcethings, slopefloor);
EffectSRB2ThingVertexSlope e = new EffectSRB2ThingVertexSlope(this, sourcethings, slopefloor, blockmap);
alleffects.Add(e);
}