mirror of
https://git.do.srb2.org/STJr/UltimateZoneBuilder.git
synced 2024-11-27 06:02:11 +00:00
Visual mode: fixed a couple of bugs in Visual vertex logic.
This commit is contained in:
parent
b80bc3f811
commit
0fe02bd3d3
2 changed files with 6 additions and 35 deletions
|
@ -3,7 +3,6 @@ using CodeImp.DoomBuilder.VisualModes;
|
||||||
using CodeImp.DoomBuilder.Map;
|
using CodeImp.DoomBuilder.Map;
|
||||||
using CodeImp.DoomBuilder.Geometry;
|
using CodeImp.DoomBuilder.Geometry;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using CodeImp.DoomBuilder.Windows;
|
|
||||||
|
|
||||||
namespace CodeImp.DoomBuilder.BuilderModes
|
namespace CodeImp.DoomBuilder.BuilderModes
|
||||||
{
|
{
|
||||||
|
@ -41,11 +40,10 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
||||||
if(!changed) return;
|
if(!changed) return;
|
||||||
float z = ceilingVertex ? vertex.ZCeiling : vertex.ZFloor;
|
float z = ceilingVertex ? vertex.ZCeiling : vertex.ZFloor;
|
||||||
|
|
||||||
int height = getSectorHeight();
|
|
||||||
if(!float.IsNaN(z)) {
|
if(!float.IsNaN(z)) {
|
||||||
haveOffset = (z != height || !neighboursHaveSameHeight(height));
|
haveOffset = true;
|
||||||
} else {
|
} else {
|
||||||
z = height;
|
z = getSectorHeight();
|
||||||
haveOffset = false;
|
haveOffset = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -59,21 +57,6 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
||||||
changed = false;
|
changed = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool neighboursHaveSameHeight(int height) {
|
|
||||||
if(ceilingVertex) {
|
|
||||||
foreach(Linedef line in vertex.Linedefs) {
|
|
||||||
if(line.Front != null && line.Front.Sector != null && line.Front.Sector.Sidedefs.Count == 3 && line.Front.Sector.CeilHeight != height) return false;
|
|
||||||
if(line.Back != null && line.Back.Sector != null && line.Back.Sector.Sidedefs.Count == 3 && line.Back.Sector.CeilHeight != height) return false;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
foreach(Linedef line in vertex.Linedefs) {
|
|
||||||
if(line.Front != null && line.Front.Sector != null && line.Front.Sector.Sidedefs.Count == 3 && line.Front.Sector.FloorHeight != height) return false;
|
|
||||||
if(line.Back != null && line.Back.Sector != null && line.Back.Sector.Sidedefs.Count == 3 && line.Back.Sector.FloorHeight != height) return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void updateGeometry(Vertex v) {
|
private void updateGeometry(Vertex v) {
|
||||||
VertexData vd = mode.GetVertexData(v);
|
VertexData vd = mode.GetVertexData(v);
|
||||||
foreach(KeyValuePair<Sector, bool> s in vd.UpdateAlso) {
|
foreach(KeyValuePair<Sector, bool> s in vd.UpdateAlso) {
|
||||||
|
@ -86,7 +69,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
||||||
|
|
||||||
//get the most appropriate height from sectors
|
//get the most appropriate height from sectors
|
||||||
private int getSectorHeight() {
|
private int getSectorHeight() {
|
||||||
int height = 0;
|
int height;
|
||||||
|
|
||||||
VertexData vd = mode.GetVertexData(vertex);
|
VertexData vd = mode.GetVertexData(vertex);
|
||||||
Sector[] sectors = new Sector[vd.UpdateAlso.Keys.Count];
|
Sector[] sectors = new Sector[vd.UpdateAlso.Keys.Count];
|
||||||
|
@ -334,23 +317,11 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
||||||
|
|
||||||
if(ceilingVertex) {
|
if(ceilingVertex) {
|
||||||
vertex.ZCeiling = (float.IsNaN(vertex.ZCeiling) ? getSectorHeight() + amount : vertex.ZCeiling + amount);
|
vertex.ZCeiling = (float.IsNaN(vertex.ZCeiling) ? getSectorHeight() + amount : vertex.ZCeiling + amount);
|
||||||
|
|
||||||
if(vertex.ZCeiling == getSectorHeight()) {
|
|
||||||
vertex.ZCeiling = float.NaN;
|
|
||||||
mode.SetActionResult("Cleared vertex height.");
|
|
||||||
} else {
|
|
||||||
mode.SetActionResult("Changed vertex height to " + vertex.ZCeiling + ".");
|
mode.SetActionResult("Changed vertex height to " + vertex.ZCeiling + ".");
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
vertex.ZFloor = (float.IsNaN(vertex.ZFloor) ? getSectorHeight() + amount : vertex.ZFloor + amount);
|
vertex.ZFloor = (float.IsNaN(vertex.ZFloor) ? getSectorHeight() + amount : vertex.ZFloor + amount);
|
||||||
|
|
||||||
if(vertex.ZFloor == getSectorHeight()) {
|
|
||||||
vertex.ZFloor = float.NaN;
|
|
||||||
mode.SetActionResult("Cleared vertex height.");
|
|
||||||
} else {
|
|
||||||
mode.SetActionResult("Changed vertex height to " + vertex.ZFloor + ".");
|
mode.SetActionResult("Changed vertex height to " + vertex.ZFloor + ".");
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// Update what must be updated
|
// Update what must be updated
|
||||||
updateGeometry(vertex);
|
updateGeometry(vertex);
|
||||||
|
|
|
@ -50,7 +50,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
||||||
|
|
||||||
//mxd. UDMF vertex offset overrides this effect
|
//mxd. UDMF vertex offset overrides this effect
|
||||||
if(General.Map.UDMF) {
|
if(General.Map.UDMF) {
|
||||||
if((slopefloor && v.Fields.ContainsKey("zfloor")) || v.Fields.ContainsKey("zceiling")) {
|
if((slopefloor && !float.IsNaN(v.ZFloor)) || !float.IsNaN(v.ZCeiling)) {
|
||||||
index++;
|
index++;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue