mirror of
https://git.do.srb2.org/STJr/UltimateZoneBuilder.git
synced 2024-11-26 22:01:45 +00:00
Event lines are now shown for ActorMover.
Event lines for "event activators" (ActorMover, Camera and things with Thing_SetGoal special) are now drawn with different color. Fixed a crash when a Thing with arguments is pasted in Visual modes. Several other small fixes. Fixed config error in ZDoom_things.cfg. Fixed config error in ZDoom_ACS.cfg
This commit is contained in:
parent
95702dbf48
commit
5e52082409
15 changed files with 346 additions and 212 deletions
|
@ -429,7 +429,7 @@ zdoom
|
|||
128 = "Nonsolid";
|
||||
}
|
||||
}
|
||||
arg4
|
||||
arg3
|
||||
{
|
||||
title = "Thing";
|
||||
type = 14;
|
||||
|
@ -445,11 +445,11 @@ zdoom
|
|||
}
|
||||
arg1
|
||||
{
|
||||
title = "Travel Time";
|
||||
title = "Travel Time (otics)";
|
||||
}
|
||||
arg2
|
||||
{
|
||||
title = "Hold Time";
|
||||
title = "Hold Time (otics)";
|
||||
}
|
||||
arg3
|
||||
{
|
||||
|
|
|
@ -357,7 +357,7 @@ keywords
|
|||
Teleport_EndGame = "Teleport_EndGame()";
|
||||
Teleport_Line = "Teleport_Line(thisid, destid, flip)";
|
||||
Teleport_NewMap = "Teleport_NewMap(map, pos)";
|
||||
Teleport_NoFog = "Teleport_NoFog(tid)";
|
||||
Teleport_NoFog = "Teleport_NoFog(tid, useangle, tag)";
|
||||
Teleport_NoStop = "Teleport_NoStop(tid, tag, nofog)";
|
||||
Teleport_ZombieChanger = "Teleport_ZombieChanger(tid, tag)";
|
||||
TeleportGroup = "TeleportGroup(groupid, sourceid, destinationid, movesource, fog)";
|
||||
|
|
|
@ -705,7 +705,7 @@
|
|||
<Compile Include="GZBuilder\Data\BoundingBox.cs" />
|
||||
<Compile Include="GZBuilder\Data\GameType.cs" />
|
||||
<Compile Include="GZBuilder\Data\GZDoomLight.cs" />
|
||||
<Compile Include="GZBuilder\Data\LinkHelper.cs" />
|
||||
<Compile Include="GZBuilder\Data\LinksCollector.cs" />
|
||||
<Compile Include="GZBuilder\Data\MapInfo.cs" />
|
||||
<Compile Include="GZBuilder\Data\ModeldefEntry.cs" />
|
||||
<Compile Include="GZBuilder\Data\ScriptItem.cs" />
|
||||
|
|
|
@ -1,164 +0,0 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
//using CodeImp.DoomBuilder.Geometry;
|
||||
using CodeImp.DoomBuilder.Map;
|
||||
using CodeImp.DoomBuilder.VisualModes;
|
||||
using CodeImp.DoomBuilder.GZBuilder.Geometry;
|
||||
using CodeImp.DoomBuilder.Geometry;
|
||||
using CodeImp.DoomBuilder.Rendering;
|
||||
using CodeImp.DoomBuilder.Config;
|
||||
|
||||
namespace CodeImp.DoomBuilder.GZBuilder.Data {
|
||||
|
||||
public static class LinksCollector {
|
||||
private struct ThingsCheckResult {
|
||||
public bool ProcessPathNodes;
|
||||
public bool ProcessInterpolationPoints;
|
||||
public bool ProcessThingsWithGoal;
|
||||
public bool ProcessCameras;
|
||||
}
|
||||
|
||||
public static List<Line3D> GetThingLinks(ICollection<VisualThing> visualThings) {
|
||||
List<Thing> things = new List<Thing>();
|
||||
foreach (VisualThing vt in visualThings) things.Add(vt.Thing);
|
||||
|
||||
ThingsCheckResult result = checkThings(things);
|
||||
if (result.ProcessPathNodes || result.ProcessInterpolationPoints || result.ProcessThingsWithGoal || result.ProcessCameras)
|
||||
return getThingLinks(result, true);
|
||||
return new List<Line3D>();
|
||||
}
|
||||
|
||||
public static List<Line3D> GetThingLinks(ICollection<Thing> things) {
|
||||
ThingsCheckResult result = checkThings(things);
|
||||
if (result.ProcessPathNodes || result.ProcessInterpolationPoints || result.ProcessThingsWithGoal || result.ProcessCameras)
|
||||
return getThingLinks(result, false);
|
||||
return new List<Line3D>();
|
||||
}
|
||||
|
||||
private static ThingsCheckResult checkThings(ICollection<Thing> things) {
|
||||
ThingsCheckResult result = new ThingsCheckResult();
|
||||
|
||||
foreach (Thing t in things) {
|
||||
if (t.Type == 9024) //zdoom path node
|
||||
result.ProcessPathNodes = true;
|
||||
else if (t.Type == 9070) //zdoom camera interpolation point
|
||||
result.ProcessInterpolationPoints = true;
|
||||
else if (t.Action == 229 && t.Args[1] != 0) //Thing_SetGoal
|
||||
result.ProcessThingsWithGoal = true;
|
||||
else if (t.Type == 9072 && (t.Args[0] != 0 || t.Args[1] != 0)) //camera with a path
|
||||
result.ProcessCameras = true;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
private static List<Line3D> getThingLinks(ThingsCheckResult result, bool correctHeight) {
|
||||
List<Line3D> lines = new List<Line3D>();
|
||||
Dictionary<int, Thing> pathNodes = new Dictionary<int, Thing>();
|
||||
Dictionary<int, Thing> interpolationPoints = new Dictionary<int, Thing>();
|
||||
List<Thing> thingsWithGoal = new List<Thing>();
|
||||
List<Thing> cameras = new List<Thing>();
|
||||
|
||||
bool getPathNodes = result.ProcessPathNodes || result.ProcessThingsWithGoal;
|
||||
bool getInterpolationPoints = result.ProcessInterpolationPoints || result.ProcessCameras;
|
||||
|
||||
//collect relevant things
|
||||
foreach (Thing t in General.Map.Map.Things) {
|
||||
if (getPathNodes && t.Type == 9024) {
|
||||
pathNodes[t.Tag] = t;
|
||||
}
|
||||
if (getInterpolationPoints && t.Type == 9070) {
|
||||
interpolationPoints[t.Tag] = t;
|
||||
}
|
||||
if (result.ProcessThingsWithGoal && t.Action == 229 && t.Args[1] != 0) {
|
||||
thingsWithGoal.Add(t);
|
||||
}
|
||||
if (result.ProcessCameras && t.Type == 9072 && (t.Args[0] != 0 || t.Args[1] != 0)) {
|
||||
cameras.Add(t);
|
||||
}
|
||||
}
|
||||
|
||||
Vector3D start = new Vector3D();
|
||||
Vector3D end = new Vector3D();
|
||||
|
||||
//process path nodes
|
||||
if (result.ProcessPathNodes) {
|
||||
foreach (KeyValuePair<int, Thing> group in pathNodes) {
|
||||
if (group.Value.Args[0] == 0) continue; //no goal
|
||||
if (pathNodes.ContainsKey(group.Value.Args[0])) {
|
||||
start = group.Value.Position;
|
||||
if (correctHeight) start.z += getCorrectHeight(group.Value);
|
||||
|
||||
end = pathNodes[group.Value.Args[0]].Position;
|
||||
if (correctHeight) end.z += getCorrectHeight(pathNodes[group.Value.Args[0]]);
|
||||
|
||||
lines.Add(new Line3D(start, end));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//process things with Thing_SetGoal
|
||||
if (result.ProcessThingsWithGoal) {
|
||||
foreach (Thing t in thingsWithGoal) {
|
||||
if (pathNodes.ContainsKey(t.Args[1])) {
|
||||
if (t.Args[0] == 0 || t.Args[0] == t.Tag) {
|
||||
start = t.Position;
|
||||
if (correctHeight) start.z += getCorrectHeight(t);
|
||||
|
||||
end = pathNodes[t.Args[1]].Position;
|
||||
if (correctHeight) end.z += getCorrectHeight(pathNodes[t.Args[1]]);
|
||||
|
||||
lines.Add(new Line3D(start, end));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//process interpolation points
|
||||
if (result.ProcessInterpolationPoints) {
|
||||
foreach (KeyValuePair<int, Thing> group in interpolationPoints) {
|
||||
int targetTag = group.Value.Args[3] + group.Value.Args[4] * 256;
|
||||
if (targetTag == 0) continue; //no goal
|
||||
|
||||
if (interpolationPoints.ContainsKey(targetTag)) {
|
||||
start = group.Value.Position;
|
||||
if (correctHeight) start.z += getCorrectHeight(group.Value);
|
||||
|
||||
end = interpolationPoints[targetTag].Position;
|
||||
if (correctHeight) end.z += getCorrectHeight(interpolationPoints[targetTag]);
|
||||
|
||||
lines.Add(new Line3D(start, end));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//process cameras
|
||||
if (result.ProcessCameras) {
|
||||
foreach (Thing t in cameras) {
|
||||
int targetTag = t.Args[0] + t.Args[1] * 256;
|
||||
if (targetTag == 0) continue; //no goal
|
||||
|
||||
if (interpolationPoints.ContainsKey(targetTag)) {
|
||||
start = t.Position;
|
||||
if (correctHeight) start.z += getCorrectHeight(t);
|
||||
|
||||
end = interpolationPoints[targetTag].Position;
|
||||
if (correctHeight) end.z += getCorrectHeight(interpolationPoints[targetTag]);
|
||||
|
||||
lines.Add(new Line3D(start, end));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return lines;
|
||||
}
|
||||
|
||||
private static float getCorrectHeight(Thing thing) {
|
||||
ThingTypeInfo tti = General.Map.Data.GetThingInfo(thing.Type);
|
||||
float height = tti.Height / 2f;
|
||||
if (thing.Sector != null) height += thing.Sector.FloorHeight;
|
||||
return height;
|
||||
}
|
||||
}
|
||||
}
|
237
Source/Core/GZBuilder/Data/LinksCollector.cs
Normal file
237
Source/Core/GZBuilder/Data/LinksCollector.cs
Normal file
|
@ -0,0 +1,237 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
//using CodeImp.DoomBuilder.Geometry;
|
||||
using CodeImp.DoomBuilder.Map;
|
||||
using CodeImp.DoomBuilder.VisualModes;
|
||||
using CodeImp.DoomBuilder.GZBuilder.Geometry;
|
||||
using CodeImp.DoomBuilder.Geometry;
|
||||
using CodeImp.DoomBuilder.Rendering;
|
||||
using CodeImp.DoomBuilder.Config;
|
||||
|
||||
namespace CodeImp.DoomBuilder.GZBuilder.Data {
|
||||
|
||||
public static class LinksCollector {
|
||||
private struct ThingsCheckResult {
|
||||
public bool ProcessPathNodes;
|
||||
public bool ProcessInterpolationPoints;
|
||||
public bool ProcessThingsWithGoal;
|
||||
public bool ProcessCameras;
|
||||
public bool ProcessActorMovers;
|
||||
}
|
||||
|
||||
public static List<Line3D> GetThingLinks(ICollection<VisualThing> visualThings) {
|
||||
List<Thing> things = new List<Thing>();
|
||||
foreach (VisualThing vt in visualThings) things.Add(vt.Thing);
|
||||
|
||||
ThingsCheckResult result = checkThings(things);
|
||||
if (result.ProcessPathNodes || result.ProcessInterpolationPoints || result.ProcessThingsWithGoal || result.ProcessCameras)
|
||||
return getThingLinks(result, true);
|
||||
return new List<Line3D>();
|
||||
}
|
||||
|
||||
public static List<Line3D> GetThingLinks(ICollection<Thing> things) {
|
||||
ThingsCheckResult result = checkThings(things);
|
||||
if (result.ProcessPathNodes || result.ProcessInterpolationPoints || result.ProcessThingsWithGoal || result.ProcessCameras)
|
||||
return getThingLinks(result, false);
|
||||
return new List<Line3D>();
|
||||
}
|
||||
|
||||
private static ThingsCheckResult checkThings(ICollection<Thing> things) {
|
||||
ThingsCheckResult result = new ThingsCheckResult();
|
||||
|
||||
foreach (Thing t in things) {
|
||||
if(t.Type == 9024) //zdoom path node
|
||||
result.ProcessPathNodes = true;
|
||||
else if(t.Type == 9070) //zdoom camera interpolation point
|
||||
result.ProcessInterpolationPoints = true;
|
||||
else if(t.Action == 229 && t.Args[1] != 0) //Thing_SetGoal
|
||||
result.ProcessThingsWithGoal = true;
|
||||
else if(t.Type == 9072 && (t.Args[0] != 0 || t.Args[1] != 0)) //camera with a path
|
||||
result.ProcessCameras = true;
|
||||
else if(t.Type == 9074 && (t.Args[0] != 0 || t.Args[1] != 0) && t.Args[3] != 0) //actor mover
|
||||
result.ProcessActorMovers = true;
|
||||
}
|
||||
|
||||
if(result.ProcessActorMovers || result.ProcessCameras)
|
||||
result.ProcessInterpolationPoints = true;
|
||||
|
||||
if(result.ProcessThingsWithGoal)
|
||||
result.ProcessPathNodes = true;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
private static List<Line3D> getThingLinks(ThingsCheckResult result, bool correctHeight) {
|
||||
List<Line3D> lines = new List<Line3D>();
|
||||
Dictionary<int, List<Thing>> pathNodes = new Dictionary<int, List<Thing>>();
|
||||
Dictionary<int, List<Thing>> interpolationPoints = new Dictionary<int, List<Thing>>();
|
||||
List<Thing> thingsWithGoal = new List<Thing>();
|
||||
List<Thing> cameras = new List<Thing>();
|
||||
List<Thing> actorMovers = new List<Thing>();
|
||||
Dictionary<int, List<Thing>> actorMoverTargets = new Dictionary<int, List<Thing>>();
|
||||
|
||||
//collect relevant things
|
||||
foreach (Thing t in General.Map.Map.Things) {
|
||||
if(result.ProcessPathNodes && t.Type == 9024) {
|
||||
if(!pathNodes.ContainsKey(t.Tag))
|
||||
pathNodes[t.Tag] = new List<Thing>();
|
||||
pathNodes[t.Tag].Add(t);
|
||||
}
|
||||
if(result.ProcessInterpolationPoints && t.Type == 9070) {
|
||||
if(!interpolationPoints.ContainsKey(t.Tag))
|
||||
interpolationPoints[t.Tag] = new List<Thing>();
|
||||
interpolationPoints[t.Tag].Add(t);
|
||||
}
|
||||
if (result.ProcessThingsWithGoal && t.Action == 229 && t.Args[1] != 0) {
|
||||
thingsWithGoal.Add(t);
|
||||
}
|
||||
if (result.ProcessCameras && t.Type == 9072 && (t.Args[0] != 0 || t.Args[1] != 0)) {
|
||||
cameras.Add(t);
|
||||
}
|
||||
if(result.ProcessActorMovers && t.Type == 9074 && (t.Args[0] != 0 || t.Args[1] != 0) && t.Args[3] != 0) {
|
||||
actorMovers.Add(t);
|
||||
}
|
||||
}
|
||||
|
||||
if(actorMovers.Count > 0) {
|
||||
List<int> targetedTags = new List<int>();
|
||||
|
||||
foreach(Thing t in actorMovers) {
|
||||
targetedTags.Add(t.Args[3]);
|
||||
}
|
||||
|
||||
foreach(Thing t in General.Map.Map.Things) {
|
||||
if(targetedTags.Contains(t.Tag)) {
|
||||
if(!actorMoverTargets.ContainsKey(t.Tag))
|
||||
actorMoverTargets[t.Tag] = new List<Thing>();
|
||||
actorMoverTargets[t.Tag].Add(t);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Vector3D start = new Vector3D();
|
||||
Vector3D end = new Vector3D();
|
||||
|
||||
//process path nodes
|
||||
if (result.ProcessPathNodes) {
|
||||
foreach (KeyValuePair<int, List<Thing>> group in pathNodes) {
|
||||
foreach(Thing t in group.Value) {
|
||||
if(t.Args[0] == 0) continue; //no goal
|
||||
|
||||
if(pathNodes.ContainsKey(t.Args[0])) {
|
||||
start = t.Position;
|
||||
if(correctHeight) start.z += getCorrectHeight(t);
|
||||
|
||||
foreach(Thing tt in pathNodes[t.Args[0]]) {
|
||||
end = tt.Position;
|
||||
if(correctHeight) end.z += getCorrectHeight(tt);
|
||||
lines.Add(new Line3D(start, end));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//process things with Thing_SetGoal
|
||||
if (result.ProcessThingsWithGoal) {
|
||||
foreach (Thing t in thingsWithGoal) {
|
||||
if (pathNodes.ContainsKey(t.Args[1])) {
|
||||
if (t.Args[0] == 0 || t.Args[0] == t.Tag) {
|
||||
start = t.Position;
|
||||
if (correctHeight) start.z += getCorrectHeight(t);
|
||||
|
||||
foreach(Thing tt in pathNodes[t.Args[1]]) {
|
||||
end = tt.Position;
|
||||
if(correctHeight) end.z += getCorrectHeight(tt);
|
||||
|
||||
lines.Add(new Line3D(start, end, Line3DType.ACTIVATOR));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//process interpolation points
|
||||
if (result.ProcessInterpolationPoints) {
|
||||
foreach (KeyValuePair<int, List<Thing>> group in interpolationPoints) {
|
||||
foreach(Thing t in group.Value) {
|
||||
int targetTag = t.Args[3] + t.Args[4] * 256;
|
||||
if(targetTag == 0) continue; //no goal
|
||||
|
||||
if(interpolationPoints.ContainsKey(targetTag)) {
|
||||
start = t.Position;
|
||||
if(correctHeight) start.z += getCorrectHeight(t);
|
||||
|
||||
foreach(Thing tt in interpolationPoints[targetTag]) {
|
||||
end = tt.Position;
|
||||
if(correctHeight) end.z += getCorrectHeight(tt);
|
||||
lines.Add(new Line3D(start, end));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//process cameras
|
||||
if (result.ProcessCameras) {
|
||||
foreach (Thing t in cameras) {
|
||||
int targetTag = t.Args[0] + t.Args[1] * 256;
|
||||
if (targetTag == 0) continue; //no goal
|
||||
|
||||
if(interpolationPoints.ContainsKey(targetTag)) {
|
||||
start = t.Position;
|
||||
if(correctHeight) start.z += getCorrectHeight(t);
|
||||
|
||||
foreach(Thing tt in interpolationPoints[targetTag]) {
|
||||
end = tt.Position;
|
||||
if(correctHeight) end.z += getCorrectHeight(tt);
|
||||
lines.Add(new Line3D(start, end, Line3DType.ACTIVATOR));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//process actor movers
|
||||
if(result.ProcessActorMovers) {
|
||||
foreach(Thing t in actorMovers) {
|
||||
int targetTag = t.Args[0] + t.Args[1] * 256;
|
||||
if(targetTag == 0) continue; //no goal
|
||||
|
||||
//add interpolation point target
|
||||
if(interpolationPoints.ContainsKey(targetTag)) {
|
||||
start = t.Position;
|
||||
if(correctHeight) start.z += getCorrectHeight(t);
|
||||
|
||||
foreach(Thing tt in interpolationPoints[targetTag]) {
|
||||
end = tt.Position;
|
||||
if(correctHeight) end.z += getCorrectHeight(tt);
|
||||
lines.Add(new Line3D(start, end, Line3DType.ACTIVATOR));
|
||||
}
|
||||
}
|
||||
|
||||
//add thing-to-move target
|
||||
if(actorMoverTargets.ContainsKey(t.Args[3])) {
|
||||
start = t.Position;
|
||||
if(correctHeight) start.z += getCorrectHeight(t);
|
||||
|
||||
foreach(Thing tt in actorMoverTargets[t.Args[3]]) {
|
||||
end = tt.Position;
|
||||
if(correctHeight) end.z += getCorrectHeight(tt);
|
||||
lines.Add(new Line3D(start, end, Line3DType.ACTIVATOR));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return lines;
|
||||
}
|
||||
|
||||
private static float getCorrectHeight(Thing thing) {
|
||||
ThingTypeInfo tti = General.Map.Data.GetThingInfo(thing.Type);
|
||||
float height = tti.Height / 2f;
|
||||
if (thing.Sector != null) height += thing.Sector.FloorHeight;
|
||||
return height;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -41,7 +41,7 @@ namespace CodeImp.DoomBuilder.GZBuilder.Data {
|
|||
t.Tag = tag;
|
||||
t.Action = action;
|
||||
|
||||
foreach(int i in args)
|
||||
for(int i = 0; i < args.Length; i++)
|
||||
t.Args[i] = args[i];
|
||||
|
||||
foreach (KeyValuePair<string, UniValue> group in fields) {
|
||||
|
|
|
@ -4,16 +4,30 @@ using System.Text;
|
|||
using CodeImp.DoomBuilder.Geometry;
|
||||
|
||||
namespace CodeImp.DoomBuilder.GZBuilder.Geometry {
|
||||
public class Line3D {
|
||||
|
||||
public enum Line3DType
|
||||
{
|
||||
DEFAULT,
|
||||
ACTIVATOR,
|
||||
}
|
||||
|
||||
public class Line3D {
|
||||
// Coordinates
|
||||
public Vector3D v1;
|
||||
public Vector3D v2;
|
||||
public Line3DType LineType { get { return lineType; } }
|
||||
private Line3DType lineType;
|
||||
|
||||
// Constructor
|
||||
public Line3D(Vector3D v1, Vector3D v2) {
|
||||
// Constructors
|
||||
public Line3D(Vector3D v1, Vector3D v2) {
|
||||
this.v1 = v1;
|
||||
this.v2 = v2;
|
||||
this.lineType = Line3DType.DEFAULT;
|
||||
}
|
||||
|
||||
public Line3D(Vector3D v1, Vector3D v2, Line3DType lineType) {
|
||||
this.v1 = v1;
|
||||
this.v2 = v2;
|
||||
this.lineType = lineType;
|
||||
}
|
||||
|
||||
public Vector3D GetDelta() { return v2 - v1; }
|
||||
|
|
|
@ -801,7 +801,7 @@ namespace CodeImp.DoomBuilder.IO
|
|||
case "true": return (bool)true;
|
||||
case "false": return (bool)false;
|
||||
case "null": return null;
|
||||
default: RaiseError(file, line, ERROR_KEYWORDUNKNOWN); return null;
|
||||
default: RaiseError(file, line, ERROR_KEYWORDUNKNOWN + "\nUnrecognized token: '" + val.Trim().ToLowerInvariant() + "'"); return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -609,7 +609,7 @@ namespace CodeImp.DoomBuilder.IO
|
|||
default:
|
||||
|
||||
// Unknown keyword
|
||||
RaiseError(line, ERROR_KEYWORDUNKNOWN);
|
||||
RaiseError(line, ERROR_KEYWORDUNKNOWN + "\nUnrecognized token: '" + val.Trim().ToLowerInvariant() + "'");
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -69,8 +69,8 @@ namespace CodeImp.DoomBuilder.Rendering
|
|||
void Present();
|
||||
|
||||
// Drawing methods
|
||||
void RenderArrows(List<Line3D> lines, PixelColor c); //mxd
|
||||
void PlotArrows(List<Line3D> lines, PixelColor c); //mxd
|
||||
void RenderArrow(Line3D line, PixelColor c); //mxd
|
||||
void PlotArrow(Line3D line, PixelColor c); //mxd
|
||||
void PlotLine(Vector2D start, Vector2D end, PixelColor c);
|
||||
void PlotLinedef(Linedef l, PixelColor c);
|
||||
void PlotLinedefSet(ICollection<Linedef> linedefs);
|
||||
|
|
|
@ -1446,27 +1446,27 @@ namespace CodeImp.DoomBuilder.Rendering
|
|||
}
|
||||
|
||||
//mxd
|
||||
public void RenderArrows(List<Line3D> lines, PixelColor c) {
|
||||
public void RenderArrow(Line3D line, PixelColor c) {
|
||||
float scaler = 20f / scale;
|
||||
foreach(Line3D l in lines) {
|
||||
RenderLine(l.v1, l.v2, 0.8f, c, true);
|
||||
float angle = l.GetAngle();
|
||||
//arrowhead
|
||||
RenderLine(l.v2, new Vector2D(l.v2.x - scaler * (float)Math.Sin(angle - 0.46f), l.v2.y + scaler * (float)Math.Cos(angle - 0.46f)), 0.8f, c, true);
|
||||
RenderLine(l.v2, new Vector2D(l.v2.x - scaler * (float)Math.Sin(angle + 0.46f), l.v2.y + scaler * (float)Math.Cos(angle + 0.46f)), 0.8f, c, true);
|
||||
}
|
||||
//foreach(Line3D l in lines) {
|
||||
RenderLine(line.v1, line.v2, 0.8f, c, true);
|
||||
float angle = line.GetAngle();
|
||||
//arrowhead
|
||||
RenderLine(line.v2, new Vector2D(line.v2.x - scaler * (float)Math.Sin(angle - 0.46f), line.v2.y + scaler * (float)Math.Cos(angle - 0.46f)), 0.8f, c, true);
|
||||
RenderLine(line.v2, new Vector2D(line.v2.x - scaler * (float)Math.Sin(angle + 0.46f), line.v2.y + scaler * (float)Math.Cos(angle + 0.46f)), 0.8f, c, true);
|
||||
//}
|
||||
}
|
||||
|
||||
//mxd
|
||||
public void PlotArrows(List<Line3D> lines, PixelColor c) {
|
||||
public void PlotArrow(Line3D line, PixelColor c) {
|
||||
float scaler = 16f / scale;
|
||||
foreach(Line3D l in lines) {
|
||||
PlotLine(l.v1, l.v2, c);
|
||||
float angle = l.GetAngle();
|
||||
//arrowhead
|
||||
PlotLine(l.v2, new Vector2D(l.v2.x - scaler * (float)Math.Sin(angle - 0.46f), l.v2.y + scaler * (float)Math.Cos(angle - 0.46f)), c);
|
||||
PlotLine(l.v2, new Vector2D(l.v2.x - scaler * (float)Math.Sin(angle + 0.46f), l.v2.y + scaler * (float)Math.Cos(angle + 0.46f)), c);
|
||||
}
|
||||
//foreach(Line3D l in lines) {
|
||||
PlotLine(line.v1, line.v2, c);
|
||||
float angle = line.GetAngle();
|
||||
//arrowhead
|
||||
PlotLine(line.v2, new Vector2D(line.v2.x - scaler * (float)Math.Sin(angle - 0.46f), line.v2.y + scaler * (float)Math.Cos(angle - 0.46f)), c);
|
||||
PlotLine(line.v2, new Vector2D(line.v2.x - scaler * (float)Math.Sin(angle + 0.46f), line.v2.y + scaler * (float)Math.Cos(angle + 0.46f)), c);
|
||||
//}
|
||||
}
|
||||
|
||||
// This renders a line with given color
|
||||
|
|
|
@ -560,8 +560,22 @@ namespace CodeImp.DoomBuilder.Rendering
|
|||
if (General.Settings.GZShowEventLines) {
|
||||
//mxd. gather links
|
||||
List<Line3D> lines = GZBuilder.Data.LinksCollector.GetThingLinks(thingsbydistance);
|
||||
if (lines.Count > 0)
|
||||
renderLinks(lines);
|
||||
if(lines.Count > 0) {
|
||||
List<Line3D> normalLines = new List<Line3D>();
|
||||
List<Line3D> activatorLines = new List<Line3D>();
|
||||
|
||||
foreach(Line3D l in lines){
|
||||
if(l.LineType == Line3DType.DEFAULT)
|
||||
normalLines.Add(l);
|
||||
else
|
||||
activatorLines.Add(l);
|
||||
}
|
||||
|
||||
if(normalLines.Count > 0)
|
||||
renderArrows(normalLines, General.Colors.InfoLine.ToColorValue());
|
||||
if(activatorLines.Count > 0)
|
||||
renderArrows(activatorLines, General.Colors.Selection3D.ToColorValue());
|
||||
}
|
||||
}
|
||||
|
||||
// ADDITIVE PASS
|
||||
|
@ -671,7 +685,7 @@ namespace CodeImp.DoomBuilder.Rendering
|
|||
}
|
||||
|
||||
//mxd
|
||||
private void renderLinks(List<Line3D> lines) {
|
||||
private void renderArrows(List<Line3D> lines, Color4 color) {
|
||||
//create vertices
|
||||
WorldVertex[] verts = new WorldVertex[lines.Count * 6];
|
||||
float scaler = 20f;
|
||||
|
@ -707,7 +721,7 @@ namespace CodeImp.DoomBuilder.Rendering
|
|||
ApplyMatrices3D();
|
||||
|
||||
// Setup color
|
||||
graphics.Shaders.World3D.VertexColor = General.Colors.InfoLine.ToColorValue();
|
||||
graphics.Shaders.World3D.VertexColor = color;
|
||||
|
||||
//render
|
||||
graphics.Shaders.World3D.ApplySettings();
|
||||
|
|
|
@ -77,6 +77,10 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
|
||||
// Checkbox
|
||||
notfortesting.Checked = res.notfortesting;
|
||||
|
||||
//mxd
|
||||
if(General.Map != null && General.Map.FilePathName != "")
|
||||
dirdialog.SelectedPath = Path.GetDirectoryName(General.Map.FilePathName);
|
||||
}
|
||||
|
||||
// OK clicked
|
||||
|
|
|
@ -164,8 +164,13 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
}
|
||||
|
||||
//mxd
|
||||
if(General.Settings.GZShowEventLines)
|
||||
renderer.RenderArrows(GZBuilder.Data.LinksCollector.GetThingLinks(General.Map.ThingsFilter.VisibleThings), General.Colors.InfoLine);
|
||||
if(General.Settings.GZShowEventLines) {
|
||||
List<Line3D> lines = GZBuilder.Data.LinksCollector.GetThingLinks(General.Map.ThingsFilter.VisibleThings);
|
||||
|
||||
foreach(Line3D l in lines) {
|
||||
renderer.RenderArrow(l, l.LineType == Line3DType.ACTIVATOR ? General.Colors.Selection : General.Colors.InfoLine);
|
||||
}
|
||||
}
|
||||
|
||||
renderer.Finish();
|
||||
}
|
||||
|
|
|
@ -497,8 +497,12 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
}
|
||||
}
|
||||
|
||||
if(General.Settings.GZShowEventLines)
|
||||
renderer.PlotArrows(lines, General.Colors.InfoLine);//mxd
|
||||
if(General.Settings.GZShowEventLines) { //mxd
|
||||
//renderer.PlotArrows(lines, General.Colors.InfoLine);//mxd
|
||||
foreach(Line3D l in lines){
|
||||
renderer.PlotArrow(l, l.LineType == Line3DType.ACTIVATOR ? General.Colors.Selection : General.Colors.InfoLine);
|
||||
}
|
||||
}
|
||||
}
|
||||
// Linedefs?
|
||||
else if(asso.type == UniversalType.LinedefTag)
|
||||
|
@ -512,8 +516,12 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
}
|
||||
}
|
||||
|
||||
if(General.Settings.GZShowEventLines)
|
||||
renderer.PlotArrows(lines, General.Colors.InfoLine);//mxd
|
||||
if(General.Settings.GZShowEventLines) { //mxd
|
||||
//renderer.PlotArrows(lines, General.Colors.InfoLine);//mxd
|
||||
foreach(Line3D l in lines) {
|
||||
renderer.PlotArrow(l, l.LineType == Line3DType.ACTIVATOR ? General.Colors.Selection : General.Colors.InfoLine);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -535,8 +543,12 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
lines.Add(new Line3D(asso.Center, t.Position));//mxd
|
||||
}
|
||||
}
|
||||
if(General.Settings.GZShowEventLines)
|
||||
renderer.RenderArrows(lines, General.Colors.InfoLine);//mxd
|
||||
if(General.Settings.GZShowEventLines) { //mxd
|
||||
//renderer.RenderArrows(lines, General.Colors.InfoLine);//mxd
|
||||
foreach(Line3D l in lines) {
|
||||
renderer.RenderArrow(l, l.LineType == Line3DType.ACTIVATOR ? General.Colors.Selection : General.Colors.InfoLine);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -566,8 +578,12 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
}
|
||||
}
|
||||
}
|
||||
if(General.Settings.GZShowEventLines)
|
||||
renderer.PlotArrows(lines, General.Colors.InfoLine); //mxd
|
||||
if(General.Settings.GZShowEventLines) { //mxd
|
||||
//renderer.PlotArrows(lines, General.Colors.InfoLine); //mxd
|
||||
foreach(Line3D l in lines) {
|
||||
renderer.PlotArrow(l, l.LineType == Line3DType.ACTIVATOR ? General.Colors.Selection : General.Colors.InfoLine);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -592,8 +608,12 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
}
|
||||
}
|
||||
|
||||
if(General.Settings.GZShowEventLines) //mxd
|
||||
renderer.PlotArrows(lines, General.Colors.InfoLine);
|
||||
if(General.Settings.GZShowEventLines) { //mxd
|
||||
//renderer.PlotArrows(lines, General.Colors.InfoLine);
|
||||
foreach(Line3D l in lines) {
|
||||
renderer.PlotArrow(l, l.LineType == Line3DType.ACTIVATOR ? General.Colors.Selection : General.Colors.InfoLine);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -625,8 +645,12 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
}
|
||||
}
|
||||
|
||||
if(General.Settings.GZShowEventLines)//mxd
|
||||
renderer.RenderArrows(lines, General.Colors.InfoLine);
|
||||
if(General.Settings.GZShowEventLines) {//mxd
|
||||
//renderer.RenderArrows(lines, General.Colors.InfoLine);
|
||||
foreach(Line3D l in lines) {
|
||||
renderer.RenderArrow(l, l.LineType == Line3DType.ACTIVATOR ? General.Colors.Selection : General.Colors.InfoLine);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
|
Loading…
Reference in a new issue