mirror of
https://git.do.srb2.org/STJr/UltimateZoneBuilder.git
synced 2025-01-18 22:41:46 +00:00
@ work on (G)ZDoom Editing plugin
This commit is contained in:
parent
ecf6053a50
commit
f59094e2bc
16 changed files with 237 additions and 65 deletions
|
@ -3,7 +3,7 @@
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||||
<ProductVersion>8.0.50727</ProductVersion>
|
<ProductVersion>9.0.30729</ProductVersion>
|
||||||
<SchemaVersion>2.0</SchemaVersion>
|
<SchemaVersion>2.0</SchemaVersion>
|
||||||
<ProjectGuid>{760A9BC7-CB73-4C36-858B-994C14996FCD}</ProjectGuid>
|
<ProjectGuid>{760A9BC7-CB73-4C36-858B-994C14996FCD}</ProjectGuid>
|
||||||
<OutputType>Library</OutputType>
|
<OutputType>Library</OutputType>
|
||||||
|
@ -56,6 +56,7 @@
|
||||||
<Compile Include="VisualModes\EffectCopySlope.cs" />
|
<Compile Include="VisualModes\EffectCopySlope.cs" />
|
||||||
<Compile Include="VisualModes\EffectLineSlope.cs" />
|
<Compile Include="VisualModes\EffectLineSlope.cs" />
|
||||||
<Compile Include="VisualModes\EffectThingLineSlope.cs" />
|
<Compile Include="VisualModes\EffectThingLineSlope.cs" />
|
||||||
|
<Compile Include="VisualModes\EffectThingVertexSlope.cs" />
|
||||||
<Compile Include="VisualModes\IVisualEventReceiver.cs" />
|
<Compile Include="VisualModes\IVisualEventReceiver.cs" />
|
||||||
<Compile Include="VisualModes\NullVisualEventReceiver.cs" />
|
<Compile Include="VisualModes\NullVisualEventReceiver.cs" />
|
||||||
<Compile Include="VisualModes\Effect3DFloor.cs" />
|
<Compile Include="VisualModes\Effect3DFloor.cs" />
|
||||||
|
|
|
@ -67,9 +67,8 @@ namespace CodeImp.DoomBuilder.GZDoomEditing
|
||||||
#region ================== Constructor / Destructor
|
#region ================== Constructor / Destructor
|
||||||
|
|
||||||
// Constructor
|
// Constructor
|
||||||
public BaseVisualGeometrySector(BaseVisualMode mode, VisualSector vs, SectorLevel level) : base(vs)
|
protected BaseVisualGeometrySector(BaseVisualMode mode, VisualSector vs) : base(vs)
|
||||||
{
|
{
|
||||||
this.level = level;
|
|
||||||
this.mode = mode;
|
this.mode = mode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -85,7 +84,6 @@ namespace CodeImp.DoomBuilder.GZDoomEditing
|
||||||
#region ================== Events
|
#region ================== Events
|
||||||
|
|
||||||
// Unused
|
// Unused
|
||||||
public abstract bool Setup();
|
|
||||||
public virtual void OnSelectBegin(){ }
|
public virtual void OnSelectBegin(){ }
|
||||||
public virtual void OnEditBegin() { }
|
public virtual void OnEditBegin() { }
|
||||||
public virtual void OnMouseMove(MouseEventArgs e) { }
|
public virtual void OnMouseMove(MouseEventArgs e) { }
|
||||||
|
@ -102,6 +100,14 @@ namespace CodeImp.DoomBuilder.GZDoomEditing
|
||||||
public virtual void ApplyUpperUnpegged(bool set) { }
|
public virtual void ApplyUpperUnpegged(bool set) { }
|
||||||
public virtual void ApplyLowerUnpegged(bool set) { }
|
public virtual void ApplyLowerUnpegged(bool set) { }
|
||||||
|
|
||||||
|
// Setup this plane
|
||||||
|
public bool Setup() { return this.Setup(this.level); }
|
||||||
|
public virtual bool Setup(SectorLevel level)
|
||||||
|
{
|
||||||
|
this.level = level;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// Select or deselect
|
// Select or deselect
|
||||||
public virtual void OnSelectEnd()
|
public virtual void OnSelectEnd()
|
||||||
{
|
{
|
||||||
|
@ -207,7 +213,7 @@ namespace CodeImp.DoomBuilder.GZDoomEditing
|
||||||
// Copy properties
|
// Copy properties
|
||||||
public virtual void OnCopyProperties()
|
public virtual void OnCopyProperties()
|
||||||
{
|
{
|
||||||
BuilderPlug.Me.CopiedSectorProps = new SectorProperties(Sector.Sector);
|
BuilderPlug.Me.CopiedSectorProps = new SectorProperties(level.sector);
|
||||||
mode.SetActionResult("Copied sector properties.");
|
mode.SetActionResult("Copied sector properties.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -218,8 +224,12 @@ namespace CodeImp.DoomBuilder.GZDoomEditing
|
||||||
{
|
{
|
||||||
mode.CreateUndo("Paste sector properties");
|
mode.CreateUndo("Paste sector properties");
|
||||||
mode.SetActionResult("Pasted sector properties.");
|
mode.SetActionResult("Pasted sector properties.");
|
||||||
BuilderPlug.Me.CopiedSectorProps.Apply(Sector.Sector);
|
BuilderPlug.Me.CopiedSectorProps.Apply(level.sector);
|
||||||
Sector.UpdateSectorGeometry(true);
|
if(mode.VisualSectorExists(level.sector))
|
||||||
|
{
|
||||||
|
BaseVisualSector vs = (BaseVisualSector)mode.GetVisualSector(level.sector);
|
||||||
|
vs.UpdateSectorGeometry(true);
|
||||||
|
}
|
||||||
mode.ShowTargetInfo();
|
mode.ShowTargetInfo();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -270,9 +280,11 @@ namespace CodeImp.DoomBuilder.GZDoomEditing
|
||||||
// Rebuild sector
|
// Rebuild sector
|
||||||
foreach(Sector s in sectors)
|
foreach(Sector s in sectors)
|
||||||
{
|
{
|
||||||
VisualSector vs = mode.GetVisualSector(s);
|
if(mode.VisualSectorExists(s))
|
||||||
if(vs != null)
|
{
|
||||||
(vs as BaseVisualSector).UpdateSectorGeometry(true);
|
BaseVisualSector vs = (BaseVisualSector)mode.GetVisualSector(s);
|
||||||
|
vs.UpdateSectorGeometry(true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -160,11 +160,10 @@ namespace CodeImp.DoomBuilder.GZDoomEditing
|
||||||
|
|
||||||
|
|
||||||
// This creates vertices from a wall polygon and applies lighting
|
// This creates vertices from a wall polygon and applies lighting
|
||||||
protected List<WorldVertex> CreatePolygonVertices(WallPolygon poly, TexturePlane tp)
|
protected List<WorldVertex> CreatePolygonVertices(WallPolygon poly, TexturePlane tp, SectorData sd)
|
||||||
{
|
{
|
||||||
List<WallPolygon> polygons = new List<WallPolygon>(2);
|
List<WallPolygon> polygons = new List<WallPolygon>(2);
|
||||||
List<WorldVertex> verts = new List<WorldVertex>();
|
List<WorldVertex> verts = new List<WorldVertex>();
|
||||||
SectorData sd = Sector.Data;
|
|
||||||
|
|
||||||
polygons.Add(poly);
|
polygons.Add(poly);
|
||||||
|
|
||||||
|
@ -823,6 +822,8 @@ namespace CodeImp.DoomBuilder.GZDoomEditing
|
||||||
(vs as BaseVisualSector).Changed = true;
|
(vs as BaseVisualSector).Changed = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mode.RebuildSectorData();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Drawing;
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
|
@ -441,6 +442,52 @@ namespace CodeImp.DoomBuilder.GZDoomEditing
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Find sectors with 3 vertices, because they can be sloped
|
||||||
|
foreach(Sector s in General.Map.Map.Sectors)
|
||||||
|
{
|
||||||
|
if(s.Sidedefs.Count == 3)
|
||||||
|
{
|
||||||
|
List<Thing> slopeceilingthings = new List<Thing>(3);
|
||||||
|
List<Thing> slopefloorthings = new List<Thing>(3);
|
||||||
|
foreach(Sidedef sd in s.Sidedefs)
|
||||||
|
{
|
||||||
|
Vertex v;
|
||||||
|
if(sd.IsFront)
|
||||||
|
v = sd.Line.End;
|
||||||
|
else
|
||||||
|
v = sd.Line.Start;
|
||||||
|
|
||||||
|
// 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)
|
||||||
|
{
|
||||||
|
if(t.Type == 1504)
|
||||||
|
slopefloorthings.Add(t);
|
||||||
|
else if(t.Type == 1505)
|
||||||
|
slopeceilingthings.Add(t);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 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)
|
||||||
{
|
{
|
||||||
|
@ -490,7 +537,7 @@ namespace CodeImp.DoomBuilder.GZDoomEditing
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Find interesting things (such as vertex and sector slopes)
|
// Find interesting things (such as sector slopes)
|
||||||
foreach(Thing t in General.Map.Map.Things)
|
foreach(Thing t in General.Map.Map.Things)
|
||||||
{
|
{
|
||||||
// ========== Copy slope ==========
|
// ========== Copy slope ==========
|
||||||
|
|
|
@ -46,11 +46,10 @@ namespace CodeImp.DoomBuilder.GZDoomEditing
|
||||||
|
|
||||||
protected BaseVisualMode mode;
|
protected BaseVisualMode mode;
|
||||||
|
|
||||||
protected SectorData data;
|
|
||||||
protected VisualFloor floor;
|
protected VisualFloor floor;
|
||||||
protected VisualCeiling ceiling;
|
protected VisualCeiling ceiling;
|
||||||
protected Dictionary<Effect3DFloor, VisualFloor> extrafloors;
|
protected List<VisualFloor> extrafloors;
|
||||||
protected Dictionary<Effect3DFloor, VisualCeiling> extraceilings;
|
protected List<VisualCeiling> extraceilings;
|
||||||
protected Dictionary<Sidedef, VisualSidedefParts> sides;
|
protected Dictionary<Sidedef, VisualSidedefParts> sides;
|
||||||
|
|
||||||
// If this is set to true, the sector will be rebuilt after the action is performed.
|
// If this is set to true, the sector will be rebuilt after the action is performed.
|
||||||
|
@ -60,7 +59,6 @@ namespace CodeImp.DoomBuilder.GZDoomEditing
|
||||||
|
|
||||||
#region ================== Properties
|
#region ================== Properties
|
||||||
|
|
||||||
public SectorData Data { get { return data; } }
|
|
||||||
public VisualFloor Floor { get { return floor; } }
|
public VisualFloor Floor { get { return floor; } }
|
||||||
public VisualCeiling Ceiling { get { return ceiling; } }
|
public VisualCeiling Ceiling { get { return ceiling; } }
|
||||||
public bool Changed { get { return changed; } set { changed |= value; } }
|
public bool Changed { get { return changed; } set { changed |= value; } }
|
||||||
|
@ -73,6 +71,8 @@ namespace CodeImp.DoomBuilder.GZDoomEditing
|
||||||
public BaseVisualSector(BaseVisualMode mode, Sector s) : base(s)
|
public BaseVisualSector(BaseVisualMode mode, Sector s) : base(s)
|
||||||
{
|
{
|
||||||
this.mode = mode;
|
this.mode = mode;
|
||||||
|
this.extrafloors = new List<VisualFloor>(2);
|
||||||
|
this.extraceilings = new List<VisualCeiling>(2);
|
||||||
|
|
||||||
// Initialize
|
// Initialize
|
||||||
Rebuild();
|
Rebuild();
|
||||||
|
@ -103,14 +103,23 @@ namespace CodeImp.DoomBuilder.GZDoomEditing
|
||||||
|
|
||||||
#region ================== Methods
|
#region ================== Methods
|
||||||
|
|
||||||
|
// This retreives the sector data for this sector
|
||||||
|
public SectorData GetSectorData()
|
||||||
|
{
|
||||||
|
return mode.GetSectorData(this.Sector);
|
||||||
|
}
|
||||||
|
|
||||||
// This updates this virtual the sector and neightbours if needed
|
// This updates this virtual the sector and neightbours if needed
|
||||||
public void UpdateSectorGeometry(bool includeneighbours)
|
public void UpdateSectorGeometry(bool includeneighbours)
|
||||||
{
|
{
|
||||||
// Rebuild sector
|
// Rebuild sector
|
||||||
this.Changed = true;
|
this.Changed = true;
|
||||||
|
|
||||||
data.Reset();
|
|
||||||
|
|
||||||
|
// Not sure what from this part we need, so commented out for now
|
||||||
|
SectorData data = GetSectorData();
|
||||||
|
data.Reset();
|
||||||
|
|
||||||
|
/*
|
||||||
// Update sectors that rely on this sector
|
// Update sectors that rely on this sector
|
||||||
foreach(KeyValuePair<Sector, bool> s in data.UpdateAlso)
|
foreach(KeyValuePair<Sector, bool> s in data.UpdateAlso)
|
||||||
{
|
{
|
||||||
|
@ -120,7 +129,8 @@ namespace CodeImp.DoomBuilder.GZDoomEditing
|
||||||
vs.UpdateSectorGeometry(s.Value);
|
vs.UpdateSectorGeometry(s.Value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
// Go for all things in this sector
|
// Go for all things in this sector
|
||||||
foreach(Thing t in General.Map.Map.Things)
|
foreach(Thing t in General.Map.Map.Things)
|
||||||
{
|
{
|
||||||
|
@ -159,37 +169,37 @@ namespace CodeImp.DoomBuilder.GZDoomEditing
|
||||||
base.ClearGeometry();
|
base.ClearGeometry();
|
||||||
|
|
||||||
// Get sector data
|
// Get sector data
|
||||||
data = mode.GetSectorData(this.Sector);
|
SectorData data = GetSectorData();
|
||||||
if(!data.Updated) data.Update();
|
if(!data.Updated) data.Update();
|
||||||
|
|
||||||
// Create floor
|
// Create floor
|
||||||
floor = floor ?? new VisualFloor(mode, this, data.Floor);
|
floor = floor ?? new VisualFloor(mode, this);
|
||||||
if(floor.Setup())
|
if(floor.Setup(data.Floor))
|
||||||
base.AddGeometry(floor);
|
base.AddGeometry(floor);
|
||||||
|
|
||||||
// Create ceiling
|
// Create ceiling
|
||||||
ceiling = ceiling ?? new VisualCeiling(mode, this, data.Ceiling);
|
ceiling = ceiling ?? new VisualCeiling(mode, this);
|
||||||
if(ceiling.Setup())
|
if(ceiling.Setup(data.Ceiling))
|
||||||
base.AddGeometry(ceiling);
|
base.AddGeometry(ceiling);
|
||||||
|
|
||||||
// Create 3D floors
|
// Create 3D floors
|
||||||
Dictionary<Effect3DFloor, VisualFloor> oldextrafloors = extrafloors ?? new Dictionary<Effect3DFloor, VisualFloor>(1);
|
for(int i = 0; i < data.ExtraFloors.Count; i++)
|
||||||
extrafloors = new Dictionary<Effect3DFloor, VisualFloor>(data.ExtraFloors.Count);
|
|
||||||
Dictionary<Effect3DFloor, VisualCeiling> oldextraceilings = extraceilings ?? new Dictionary<Effect3DFloor, VisualCeiling>(1);
|
|
||||||
extraceilings = new Dictionary<Effect3DFloor, VisualCeiling>(data.ExtraFloors.Count);
|
|
||||||
foreach(Effect3DFloor ef in data.ExtraFloors)
|
|
||||||
{
|
{
|
||||||
// Create a floor
|
Effect3DFloor ef = data.ExtraFloors[i];
|
||||||
VisualFloor vf = oldextrafloors.ContainsKey(ef) ? oldextrafloors[ef] : new VisualFloor(mode, this, ef.Floor);
|
|
||||||
if(vf.Setup())
|
|
||||||
base.AddGeometry(vf);
|
|
||||||
extrafloors.Add(ef, vf);
|
|
||||||
|
|
||||||
|
// Create a floor
|
||||||
|
VisualFloor vf = (i < extrafloors.Count) ? extrafloors[i] : new VisualFloor(mode, this);
|
||||||
|
if(vf.Setup(ef.Floor))
|
||||||
|
base.AddGeometry(vf);
|
||||||
|
if(i >= extrafloors.Count)
|
||||||
|
extrafloors.Add(vf);
|
||||||
|
|
||||||
// Create a ceiling
|
// Create a ceiling
|
||||||
VisualCeiling vc = oldextraceilings.ContainsKey(ef) ? oldextraceilings[ef] : new VisualCeiling(mode, this, ef.Ceiling);
|
VisualCeiling vc = (i < extraceilings.Count) ? extraceilings[i] : new VisualCeiling(mode, this);
|
||||||
if(vc.Setup())
|
if(vc.Setup(ef.Ceiling))
|
||||||
base.AddGeometry(vc);
|
base.AddGeometry(vc);
|
||||||
extraceilings.Add(ef, vc);
|
if(i >= extraceilings.Count)
|
||||||
|
extraceilings.Add(vc);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Go for all sidedefs
|
// Go for all sidedefs
|
||||||
|
@ -221,18 +231,20 @@ namespace CodeImp.DoomBuilder.GZDoomEditing
|
||||||
// Create 3D wall parts
|
// Create 3D wall parts
|
||||||
SectorData osd = mode.GetSectorData(sd.Other.Sector);
|
SectorData osd = mode.GetSectorData(sd.Other.Sector);
|
||||||
if(!osd.Updated) osd.Update();
|
if(!osd.Updated) osd.Update();
|
||||||
Dictionary<Effect3DFloor, VisualMiddle3D> oldfloors = parts.middle3d ?? new Dictionary<Effect3DFloor, VisualMiddle3D>(2);
|
List<VisualMiddle3D> middles = parts.middle3d ?? new List<VisualMiddle3D>(2);
|
||||||
Dictionary<Effect3DFloor, VisualMiddle3D> newfloors = new Dictionary<Effect3DFloor, VisualMiddle3D>(2);
|
for(int i = 0; i < osd.ExtraFloors.Count; i++)
|
||||||
foreach(Effect3DFloor ef in osd.ExtraFloors)
|
|
||||||
{
|
{
|
||||||
VisualMiddle3D vm3 = oldfloors.ContainsKey(ef) ? oldfloors[ef] : new VisualMiddle3D(mode, this, sd, ef);
|
Effect3DFloor ef = osd.ExtraFloors[i];
|
||||||
if(vm3.Setup())
|
|
||||||
|
VisualMiddle3D vm3 = (i < middles.Count) ? middles[i] : new VisualMiddle3D(mode, this, sd);
|
||||||
|
if(vm3.Setup(ef))
|
||||||
base.AddGeometry(vm3);
|
base.AddGeometry(vm3);
|
||||||
newfloors.Add(ef, vm3);
|
if(i >= middles.Count)
|
||||||
|
middles.Add(vm3);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Store
|
// Store
|
||||||
sides.Add(sd, new VisualSidedefParts(vu, vl, vm, newfloors));
|
sides.Add(sd, new VisualSidedefParts(vu, vl, vm, middles));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -0,0 +1,73 @@
|
||||||
|
#region === Copyright (c) 2010 Pascal van der Heiden ===
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Globalization;
|
||||||
|
using System.Text;
|
||||||
|
using CodeImp.DoomBuilder.Geometry;
|
||||||
|
using CodeImp.DoomBuilder.Map;
|
||||||
|
using CodeImp.DoomBuilder.Rendering;
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
namespace CodeImp.DoomBuilder.GZDoomEditing
|
||||||
|
{
|
||||||
|
internal class EffectThingVertexSlope : SectorEffect
|
||||||
|
{
|
||||||
|
// Thing used to create this effect
|
||||||
|
// The thing is in the sector that must receive the slope and the
|
||||||
|
// Thing's arg 0 indicates the linedef to start the slope at.
|
||||||
|
private List<Thing> things;
|
||||||
|
|
||||||
|
// Floor or ceiling?
|
||||||
|
private bool slopefloor;
|
||||||
|
|
||||||
|
// Constructor
|
||||||
|
public EffectThingVertexSlope(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(Sidedef sd in data.Sector.Sidedefs)
|
||||||
|
{
|
||||||
|
Vertex v = sd.IsFront ? sd.Line.End : sd.Line.Start;
|
||||||
|
|
||||||
|
// Presume not sloped
|
||||||
|
if(slopefloor)
|
||||||
|
verts[index] = new Vector3D(v.Position.x, v.Position.y, data.Floor.plane.GetZ(v.Position));
|
||||||
|
else
|
||||||
|
verts[index] = new Vector3D(v.Position.x, v.Position.y, data.Ceiling.plane.GetZ(v.Position));
|
||||||
|
|
||||||
|
// Find the thing at this position
|
||||||
|
foreach(Thing t in things)
|
||||||
|
{
|
||||||
|
if((Vector2D)t.Position == v.Position)
|
||||||
|
verts[index] = t.Position;
|
||||||
|
}
|
||||||
|
|
||||||
|
index++;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -122,6 +122,13 @@ namespace CodeImp.DoomBuilder.GZDoomEditing
|
||||||
EffectThingLineSlope e = new EffectThingLineSlope(this, sourcething);
|
EffectThingLineSlope e = new EffectThingLineSlope(this, sourcething);
|
||||||
alleffects.Add(e);
|
alleffects.Add(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Thing vertex slope effect
|
||||||
|
public void AddEffectThingVertexSlope(List<Thing> sourcethings, bool slopefloor)
|
||||||
|
{
|
||||||
|
EffectThingVertexSlope e = new EffectThingVertexSlope(this, sourcethings, slopefloor);
|
||||||
|
alleffects.Add(e);
|
||||||
|
}
|
||||||
|
|
||||||
// This adds a sector for updating
|
// This adds a sector for updating
|
||||||
public void AddUpdateSector(Sector s, bool includeneighbours)
|
public void AddUpdateSector(Sector s, bool includeneighbours)
|
||||||
|
@ -148,6 +155,14 @@ namespace CodeImp.DoomBuilder.GZDoomEditing
|
||||||
// This is set to false so that this sector is rebuilt the next time it is needed!
|
// This is set to false so that this sector is rebuilt the next time it is needed!
|
||||||
updated = false;
|
updated = false;
|
||||||
|
|
||||||
|
// The visual sector associated is now outdated
|
||||||
|
if(mode.VisualSectorExists(sector))
|
||||||
|
{
|
||||||
|
BaseVisualSector vs = (BaseVisualSector)mode.GetVisualSector(sector);
|
||||||
|
vs.UpdateSectorGeometry(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Also reset the sectors that depend on this sector
|
||||||
foreach(KeyValuePair<Sector, bool> s in updatesectors)
|
foreach(KeyValuePair<Sector, bool> s in updatesectors)
|
||||||
{
|
{
|
||||||
SectorData sd = mode.GetSectorData(s.Key);
|
SectorData sd = mode.GetSectorData(s.Key);
|
||||||
|
@ -233,6 +248,13 @@ namespace CodeImp.DoomBuilder.GZDoomEditing
|
||||||
if(l.brightnessbelow == -1)
|
if(l.brightnessbelow == -1)
|
||||||
l.brightnessbelow = pl.brightnessbelow;
|
l.brightnessbelow = pl.brightnessbelow;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// The visual sector associated is now outdated
|
||||||
|
if(mode.VisualSectorExists(sector))
|
||||||
|
{
|
||||||
|
BaseVisualSector vs = (BaseVisualSector)mode.GetVisualSector(sector);
|
||||||
|
vs.UpdateSectorGeometry(false);
|
||||||
|
}
|
||||||
|
|
||||||
isupdating = false;
|
isupdating = false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -58,14 +58,14 @@ namespace CodeImp.DoomBuilder.GZDoomEditing
|
||||||
#region ================== Constructor / Setup
|
#region ================== Constructor / Setup
|
||||||
|
|
||||||
// Constructor
|
// Constructor
|
||||||
public VisualCeiling(BaseVisualMode mode, VisualSector vs, SectorLevel level) : base(mode, vs, level)
|
public VisualCeiling(BaseVisualMode mode, VisualSector vs) : base(mode, vs)
|
||||||
{
|
{
|
||||||
// We have no destructor
|
// We have no destructor
|
||||||
GC.SuppressFinalize(this);
|
GC.SuppressFinalize(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
// This builds the geometry. Returns false when no geometry created.
|
// This builds the geometry. Returns false when no geometry created.
|
||||||
public override bool Setup()
|
public override bool Setup(SectorLevel level)
|
||||||
{
|
{
|
||||||
WorldVertex[] verts;
|
WorldVertex[] verts;
|
||||||
WorldVertex v;
|
WorldVertex v;
|
||||||
|
@ -73,6 +73,8 @@ namespace CodeImp.DoomBuilder.GZDoomEditing
|
||||||
float xpan, ypan, xscale, yscale, rotate;
|
float xpan, ypan, xscale, yscale, rotate;
|
||||||
Vector2D texscale;
|
Vector2D texscale;
|
||||||
|
|
||||||
|
base.Setup(level);
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
// Fetch ZDoom fields
|
// Fetch ZDoom fields
|
||||||
|
|
|
@ -58,20 +58,22 @@ namespace CodeImp.DoomBuilder.GZDoomEditing
|
||||||
#region ================== Constructor / Setup
|
#region ================== Constructor / Setup
|
||||||
|
|
||||||
// Constructor
|
// Constructor
|
||||||
public VisualFloor(BaseVisualMode mode, VisualSector vs, SectorLevel level) : base(mode, vs, level)
|
public VisualFloor(BaseVisualMode mode, VisualSector vs) : base(mode, vs)
|
||||||
{
|
{
|
||||||
// We have no destructor
|
// We have no destructor
|
||||||
GC.SuppressFinalize(this);
|
GC.SuppressFinalize(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
// This builds the geometry. Returns false when no geometry created.
|
// This builds the geometry. Returns false when no geometry created.
|
||||||
public override bool Setup()
|
public override bool Setup(SectorLevel level)
|
||||||
{
|
{
|
||||||
WorldVertex[] verts;
|
WorldVertex[] verts;
|
||||||
Sector s = level.sector;
|
Sector s = level.sector;
|
||||||
float xpan, ypan, xscale, yscale, rotate;
|
float xpan, ypan, xscale, yscale, rotate;
|
||||||
Vector2D texscale;
|
Vector2D texscale;
|
||||||
|
|
||||||
|
base.Setup(level);
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
// Fetch ZDoom fields
|
// Fetch ZDoom fields
|
||||||
|
|
|
@ -80,7 +80,7 @@ namespace CodeImp.DoomBuilder.GZDoomEditing
|
||||||
}
|
}
|
||||||
|
|
||||||
// Load sector data
|
// Load sector data
|
||||||
SectorData sd = Sector.Data;
|
SectorData sd = Sector.GetSectorData();
|
||||||
SectorData osd = mode.GetSectorData(Sidedef.Other.Sector);
|
SectorData osd = mode.GetSectorData(Sidedef.Other.Sector);
|
||||||
if(!osd.Updated) osd.Update();
|
if(!osd.Updated) osd.Update();
|
||||||
|
|
||||||
|
@ -173,7 +173,7 @@ namespace CodeImp.DoomBuilder.GZDoomEditing
|
||||||
bottom = sd.Floor.plane;
|
bottom = sd.Floor.plane;
|
||||||
|
|
||||||
// Process the polygon and create vertices
|
// Process the polygon and create vertices
|
||||||
List<WorldVertex> verts = CreatePolygonVertices(poly, tp);
|
List<WorldVertex> verts = CreatePolygonVertices(poly, tp, sd);
|
||||||
if(verts.Count > 0)
|
if(verts.Count > 0)
|
||||||
{
|
{
|
||||||
base.SetVertices(verts);
|
base.SetVertices(verts);
|
||||||
|
|
|
@ -58,20 +58,20 @@ namespace CodeImp.DoomBuilder.GZDoomEditing
|
||||||
#region ================== Constructor / Setup
|
#region ================== Constructor / Setup
|
||||||
|
|
||||||
// Constructor
|
// Constructor
|
||||||
public VisualMiddle3D(BaseVisualMode mode, VisualSector vs, Sidedef s, Effect3DFloor extrafloor)
|
public VisualMiddle3D(BaseVisualMode mode, VisualSector vs, Sidedef s) : base(mode, vs, s)
|
||||||
: base(mode, vs, s)
|
|
||||||
{
|
{
|
||||||
this.extrafloor = extrafloor;
|
|
||||||
|
|
||||||
// We have no destructor
|
// We have no destructor
|
||||||
GC.SuppressFinalize(this);
|
GC.SuppressFinalize(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
// This builds the geometry. Returns false when no geometry created.
|
// This builds the geometry. Returns false when no geometry created.
|
||||||
public override bool Setup()
|
public override bool Setup() { return this.Setup(this.extrafloor); }
|
||||||
|
public bool Setup(Effect3DFloor extrafloor)
|
||||||
{
|
{
|
||||||
Vector2D vl, vr;
|
Vector2D vl, vr;
|
||||||
Sidedef sourceside = extrafloor.Linedef.Front;
|
Sidedef sourceside = extrafloor.Linedef.Front;
|
||||||
|
|
||||||
|
this.extrafloor = extrafloor;
|
||||||
|
|
||||||
// Left and right vertices for this sidedef
|
// Left and right vertices for this sidedef
|
||||||
if(Sidedef.IsFront)
|
if(Sidedef.IsFront)
|
||||||
|
@ -184,7 +184,7 @@ namespace CodeImp.DoomBuilder.GZDoomEditing
|
||||||
CropPoly(ref poly, extrafloor.Ceiling.plane, false);
|
CropPoly(ref poly, extrafloor.Ceiling.plane, false);
|
||||||
|
|
||||||
// Process the polygon and create vertices
|
// Process the polygon and create vertices
|
||||||
List<WorldVertex> verts = CreatePolygonVertices(poly, tp);
|
List<WorldVertex> verts = CreatePolygonVertices(poly, tp, sd);
|
||||||
if(verts.Count > 0)
|
if(verts.Count > 0)
|
||||||
{
|
{
|
||||||
if(extrafloor.Alpha < 255)
|
if(extrafloor.Alpha < 255)
|
||||||
|
|
|
@ -222,7 +222,7 @@ namespace CodeImp.DoomBuilder.GZDoomEditing
|
||||||
bottom = osd.Floor.plane;
|
bottom = osd.Floor.plane;
|
||||||
|
|
||||||
// Process the polygon and create vertices
|
// Process the polygon and create vertices
|
||||||
List<WorldVertex> verts = CreatePolygonVertices(poly, tp);
|
List<WorldVertex> verts = CreatePolygonVertices(poly, tp, sd);
|
||||||
if(verts.Count > 0)
|
if(verts.Count > 0)
|
||||||
{
|
{
|
||||||
// Apply alpha to vertices
|
// Apply alpha to vertices
|
||||||
|
|
|
@ -174,7 +174,7 @@ namespace CodeImp.DoomBuilder.GZDoomEditing
|
||||||
poly.color = wallcolor.WithAlpha(255).ToInt();
|
poly.color = wallcolor.WithAlpha(255).ToInt();
|
||||||
|
|
||||||
// Process the polygon and create vertices
|
// Process the polygon and create vertices
|
||||||
List<WorldVertex> verts = CreatePolygonVertices(poly, tp);
|
List<WorldVertex> verts = CreatePolygonVertices(poly, tp, sd);
|
||||||
if(verts.Count > 0)
|
if(verts.Count > 0)
|
||||||
{
|
{
|
||||||
base.SetVertices(verts);
|
base.SetVertices(verts);
|
||||||
|
|
|
@ -43,10 +43,10 @@ namespace CodeImp.DoomBuilder.GZDoomEditing
|
||||||
public VisualLower lower;
|
public VisualLower lower;
|
||||||
public VisualMiddleDouble middledouble;
|
public VisualMiddleDouble middledouble;
|
||||||
public VisualMiddleSingle middlesingle;
|
public VisualMiddleSingle middlesingle;
|
||||||
public Dictionary<Effect3DFloor, VisualMiddle3D> middle3d;
|
public List<VisualMiddle3D> middle3d;
|
||||||
|
|
||||||
// Constructor
|
// Constructor
|
||||||
public VisualSidedefParts(VisualUpper u, VisualLower l, VisualMiddleDouble m, Dictionary<Effect3DFloor, VisualMiddle3D> e)
|
public VisualSidedefParts(VisualUpper u, VisualLower l, VisualMiddleDouble m, List<VisualMiddle3D> e)
|
||||||
{
|
{
|
||||||
this.upper = u;
|
this.upper = u;
|
||||||
this.lower = l;
|
this.lower = l;
|
||||||
|
@ -74,7 +74,7 @@ namespace CodeImp.DoomBuilder.GZDoomEditing
|
||||||
if(upper != null) upper.Setup();
|
if(upper != null) upper.Setup();
|
||||||
if(middle3d != null)
|
if(middle3d != null)
|
||||||
{
|
{
|
||||||
foreach(VisualMiddle3D m in middle3d.Values)
|
foreach(VisualMiddle3D m in middle3d)
|
||||||
m.Setup();
|
m.Setup();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -81,7 +81,7 @@ namespace CodeImp.DoomBuilder.GZDoomEditing
|
||||||
}
|
}
|
||||||
|
|
||||||
// Load sector data
|
// Load sector data
|
||||||
SectorData sd = Sector.Data;
|
SectorData sd = Sector.GetSectorData();
|
||||||
SectorData osd = mode.GetSectorData(Sidedef.Other.Sector);
|
SectorData osd = mode.GetSectorData(Sidedef.Other.Sector);
|
||||||
if(!osd.Updated) osd.Update();
|
if(!osd.Updated) osd.Update();
|
||||||
|
|
||||||
|
@ -173,7 +173,7 @@ namespace CodeImp.DoomBuilder.GZDoomEditing
|
||||||
bottom = osd.Ceiling.plane;
|
bottom = osd.Ceiling.plane;
|
||||||
|
|
||||||
// Process the polygon and create vertices
|
// Process the polygon and create vertices
|
||||||
List<WorldVertex> verts = CreatePolygonVertices(poly, tp);
|
List<WorldVertex> verts = CreatePolygonVertices(poly, tp, sd);
|
||||||
if(verts.Count > 0)
|
if(verts.Count > 0)
|
||||||
{
|
{
|
||||||
base.SetVertices(verts);
|
base.SetVertices(verts);
|
||||||
|
|
Binary file not shown.
Loading…
Reference in a new issue