mirror of
https://git.do.srb2.org/STJr/UltimateZoneBuilder.git
synced 2025-02-20 10:53:19 +00:00
Visual mode: added support for DistanceCheck DECORATE property.
Updated ZDoom_DECORATE.cfg.
This commit is contained in:
parent
c3392f8399
commit
fd0e1c754a
4 changed files with 48 additions and 8 deletions
|
@ -572,6 +572,7 @@ properties
|
|||
Decal;
|
||||
StencilColor;
|
||||
FloatBobPhase;
|
||||
DistanceCheck;
|
||||
//Obituaries
|
||||
HitObituary;
|
||||
Obituary;
|
||||
|
|
|
@ -68,6 +68,7 @@ namespace CodeImp.DoomBuilder.Config
|
|||
private bool arrow;
|
||||
private float radius;
|
||||
private float height;
|
||||
private int distancechecksq; //mxd. Contains squared value or int.MaxValue when not set
|
||||
private bool hangs;
|
||||
private int blocking;
|
||||
private int errorcheck;
|
||||
|
@ -105,6 +106,7 @@ namespace CodeImp.DoomBuilder.Config
|
|||
public bool Arrow { get { return arrow; } }
|
||||
public float Radius { get { return radius; } }
|
||||
public float Height { get { return height; } }
|
||||
public int DistanceCheckSq { get { return distancechecksq; } } //mxd
|
||||
public bool Hangs { get { return hangs; } }
|
||||
public int Blocking { get { return blocking; } }
|
||||
public int ErrorCheck { get { return errorcheck; } }
|
||||
|
@ -148,6 +150,7 @@ namespace CodeImp.DoomBuilder.Config
|
|||
this.arrow = true;
|
||||
this.radius = 10f;
|
||||
this.height = 20f;
|
||||
this.distancechecksq = int.MaxValue; //mxd
|
||||
this.hangs = false;
|
||||
this.blocking = 0;
|
||||
this.errorcheck = 0;
|
||||
|
@ -177,6 +180,7 @@ namespace CodeImp.DoomBuilder.Config
|
|||
this.isknown = true;
|
||||
this.actor = null;
|
||||
this.bright = false; //mxd
|
||||
this.distancechecksq = int.MaxValue; //mxd
|
||||
|
||||
// Read properties
|
||||
this.title = cfg.ReadSetting("thingtypes." + cat.Name + "." + key + ".title", "<" + key + ">");
|
||||
|
@ -225,6 +229,7 @@ namespace CodeImp.DoomBuilder.Config
|
|||
this.classname = string.Empty; //mxd
|
||||
this.isknown = true;
|
||||
this.bright = false; //mxd
|
||||
this.distancechecksq = int.MaxValue; //mxd
|
||||
this.args = new ArgumentInfo[Linedef.NUM_ARGS];
|
||||
for(int i = 0; i < Linedef.NUM_ARGS; i++) this.args[i] = new ArgumentInfo(i);
|
||||
|
||||
|
@ -268,6 +273,7 @@ namespace CodeImp.DoomBuilder.Config
|
|||
this.classname = actor.ClassName; //mxd
|
||||
this.isknown = true;
|
||||
this.bright = false; //mxd
|
||||
this.distancechecksq = int.MaxValue; //mxd
|
||||
this.args = new ArgumentInfo[Linedef.NUM_ARGS];
|
||||
for(int i = 0; i < Linedef.NUM_ARGS; i++) this.args[i] = new ArgumentInfo(i);
|
||||
|
||||
|
@ -312,6 +318,7 @@ namespace CodeImp.DoomBuilder.Config
|
|||
this.classname = actor.ClassName; //mxd
|
||||
this.isknown = true;
|
||||
this.bright = false; //mxd
|
||||
this.distancechecksq = int.MaxValue; //mxd
|
||||
this.args = new ArgumentInfo[Linedef.NUM_ARGS];
|
||||
for(int i = 0; i < Linedef.NUM_ARGS; i++) this.args[i] = new ArgumentInfo(i);
|
||||
|
||||
|
@ -372,6 +379,7 @@ namespace CodeImp.DoomBuilder.Config
|
|||
this.arrow = other.arrow;
|
||||
this.radius = other.radius;
|
||||
this.height = other.height;
|
||||
this.distancechecksq = other.distancechecksq; //mxd
|
||||
this.hangs = other.hangs;
|
||||
this.blocking = other.blocking;
|
||||
this.errorcheck = other.errorcheck;
|
||||
|
@ -467,6 +475,13 @@ namespace CodeImp.DoomBuilder.Config
|
|||
if(actor.HasPropertyWithValue("radius")) radius = actor.GetPropertyValueInt("radius", 0);
|
||||
if(actor.HasPropertyWithValue("height")) height = actor.GetPropertyValueInt("height", 0);
|
||||
|
||||
//mxd. DistanceCheck. We'll need squared value
|
||||
if(actor.HasPropertyWithValue("distancecheck"))
|
||||
{
|
||||
distancechecksq = actor.GetPropertyValueInt("distancecheck", 0);
|
||||
distancechecksq = (distancechecksq == 0 ? int.MaxValue : distancechecksq * distancechecksq);
|
||||
}
|
||||
|
||||
//mxd. Renderstyle
|
||||
if(actor.HasPropertyWithValue("renderstyle") && !actor.HasProperty("$ignorerenderstyle"))
|
||||
renderstyle = actor.GetPropertyValueString("renderstyle", 0, true).ToLower();
|
||||
|
|
|
@ -842,6 +842,10 @@ namespace CodeImp.DoomBuilder.Rendering
|
|||
// Update buffer if needed
|
||||
t.Update();
|
||||
|
||||
//mxd. Check 3D distance
|
||||
if(t.Info.DistanceCheckSq < int.MaxValue && (t.Thing.Position - cameraposition).GetLengthSq() > t.Info.DistanceCheckSq)
|
||||
continue;
|
||||
|
||||
// Only do this sector when a vertexbuffer is created
|
||||
if(t.GeometryBuffer != null)
|
||||
{
|
||||
|
@ -1107,6 +1111,13 @@ namespace CodeImp.DoomBuilder.Rendering
|
|||
// Render things collected
|
||||
foreach(VisualThing t in thingspass)
|
||||
{
|
||||
// Update buffer if needed
|
||||
t.Update();
|
||||
|
||||
//mxd. Check 3D distance
|
||||
if(t.Info.DistanceCheckSq < int.MaxValue && (t.Thing.Position - cameraposition).GetLengthSq() > t.Info.DistanceCheckSq)
|
||||
continue;
|
||||
|
||||
t.UpdateSpriteFrame(); // Set correct texture, geobuffer and triangles count
|
||||
if(t.Texture is UnknownImage) continue;
|
||||
|
||||
|
@ -1145,9 +1156,6 @@ namespace CodeImp.DoomBuilder.Rendering
|
|||
curtexturename = t.Texture.LongName;
|
||||
}
|
||||
|
||||
// Update buffer if needed
|
||||
t.Update();
|
||||
|
||||
// Only do this sector when a vertexbuffer is created
|
||||
if(t.GeometryBuffer != null)
|
||||
{
|
||||
|
@ -1368,7 +1376,7 @@ namespace CodeImp.DoomBuilder.Rendering
|
|||
graphics.Device.SetRenderState(RenderState.BlendOperation, BlendOperation.Add);
|
||||
}
|
||||
|
||||
//mxd. render models
|
||||
//mxd. Render models
|
||||
private void RenderModels()
|
||||
{
|
||||
int shaderpass = (fullbrightness ? 1 : 4);
|
||||
|
@ -1382,7 +1390,12 @@ namespace CodeImp.DoomBuilder.Rendering
|
|||
{
|
||||
foreach(VisualThing t in group.Value)
|
||||
{
|
||||
// Update buffer if needed
|
||||
t.Update();
|
||||
|
||||
// Check 3D distance
|
||||
if(t.Info.DistanceCheckSq < int.MaxValue && (t.Thing.Position - cameraposition).GetLengthSq() > t.Info.DistanceCheckSq)
|
||||
continue;
|
||||
|
||||
Color4 vertexcolor = new Color4(t.VertexColor);
|
||||
|
||||
|
@ -1395,7 +1408,7 @@ namespace CodeImp.DoomBuilder.Rendering
|
|||
// Determine the shader pass we want to use for this object
|
||||
int wantedshaderpass = ((((t == highlighted) && showhighlight) || (t.Selected && showselection)) ? highshaderpass : shaderpass);
|
||||
|
||||
//mxd. if fog is enagled, switch to shader, which calculates it
|
||||
// If fog is enagled, switch to shader, which calculates it
|
||||
if(General.Settings.GZDrawFog && !fullbrightness && t.Thing.Sector != null && t.Thing.Sector.FogMode != SectorFogMode.NONE)
|
||||
wantedshaderpass += 8;
|
||||
|
||||
|
@ -1420,7 +1433,7 @@ namespace CodeImp.DoomBuilder.Rendering
|
|||
world = General.Map.Data.ModeldefEntries[t.Thing.Type].Transform * modelscale * modelrotation * t.Position;
|
||||
ApplyMatrices3D();
|
||||
|
||||
//mxd. Set variables for fog rendering
|
||||
// Set variables for fog rendering
|
||||
if(wantedshaderpass > 7)
|
||||
{
|
||||
graphics.Shaders.World3D.World = world;
|
||||
|
@ -1476,7 +1489,13 @@ namespace CodeImp.DoomBuilder.Rendering
|
|||
currentpass = t.RenderPass;
|
||||
}
|
||||
|
||||
// Update buffer if needed
|
||||
t.Update();
|
||||
|
||||
// Check 3D distance
|
||||
if(t.Info.DistanceCheckSq < int.MaxValue && (t.Thing.Position - cameraposition).GetLengthSq() > t.Info.DistanceCheckSq)
|
||||
continue;
|
||||
|
||||
Color4 vertexcolor = new Color4(t.VertexColor);
|
||||
|
||||
// Check if model is affected by dynamic lights and set color accordingly
|
||||
|
@ -1488,7 +1507,7 @@ namespace CodeImp.DoomBuilder.Rendering
|
|||
// Determine the shader pass we want to use for this object
|
||||
int wantedshaderpass = ((((t == highlighted) && showhighlight) || (t.Selected && showselection)) ? highshaderpass : shaderpass);
|
||||
|
||||
//mxd. if fog is enagled, switch to shader, which calculates it
|
||||
// If fog is enagled, switch to shader, which calculates it
|
||||
if(General.Settings.GZDrawFog && !fullbrightness && t.Thing.Sector != null && t.Thing.Sector.FogMode != SectorFogMode.NONE)
|
||||
wantedshaderpass += 8;
|
||||
|
||||
|
@ -1513,7 +1532,7 @@ namespace CodeImp.DoomBuilder.Rendering
|
|||
world = General.Map.Data.ModeldefEntries[t.Thing.Type].Transform * modelscale * modelrotation * t.Position;
|
||||
ApplyMatrices3D();
|
||||
|
||||
//mxd. Set variables for fog rendering
|
||||
// Set variables for fog rendering
|
||||
if(wantedshaderpass > 7)
|
||||
{
|
||||
graphics.Shaders.World3D.World = world;
|
||||
|
|
|
@ -513,6 +513,11 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
// This performs a fast test in object picking
|
||||
public override bool PickFastReject(Vector3D from, Vector3D to, Vector3D dir)
|
||||
{
|
||||
//mxd. Don't highlight when thing sprite is not rendered and thing cages are disabled
|
||||
if(!General.Map.Renderer3D.DrawThingCages && info.DistanceCheckSq < int.MaxValue
|
||||
&& (Thing.Position - General.Map.VisualCamera.Position).GetLengthSq() > info.DistanceCheckSq)
|
||||
return false;
|
||||
|
||||
float distance2 = Line2D.GetDistanceToLineSq(from, to, pos2d, false);
|
||||
return (distance2 <= cageradius2);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue