2009-07-12 09:32:53 +00:00
|
|
|
|
2009-04-19 18:07:22 +00:00
|
|
|
#region ================== Copyright (c) 2007 Pascal vd Heiden
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Copyright (c) 2007 Pascal vd Heiden, www.codeimp.com
|
|
|
|
* This program is released under GNU General Public License
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
#region ================== Namespaces
|
|
|
|
|
|
|
|
using System;
|
|
|
|
using System.Collections.Generic;
|
2012-11-27 21:12:20 +00:00
|
|
|
using System.Collections.ObjectModel;
|
2009-04-19 18:07:22 +00:00
|
|
|
using System.Drawing;
|
|
|
|
using CodeImp.DoomBuilder.Map;
|
|
|
|
using CodeImp.DoomBuilder.Geometry;
|
|
|
|
using CodeImp.DoomBuilder.Rendering;
|
2012-11-27 21:12:20 +00:00
|
|
|
using CodeImp.DoomBuilder.Types;
|
2009-04-19 18:07:22 +00:00
|
|
|
using CodeImp.DoomBuilder.VisualModes;
|
Visual mode, UDMF: added "Scale Texture Up (X)", "Scale Texture Down (X)", "Scale Texture Up (Y)", "Scale Texture Down (Y)" actions. Default keys are Num6, Num4, Num8, Num5.
Visual mode, UDMF: renamed "Rotate Thing Clockwise" and "Rotate Thing Counterclockwise" actions to "Rotate Clockwise" and "Rotate Counterclockwise". These actions can now be used to change rotation of floor/ceiling textures.
Visual mode, UDMF: "Reset Texture Offsets" action now also resets sidedef's scale and floor/ceiling's scale and rotation.
Visual mode, UDMF: control line's OffsetX and OffsetY were not taken into account when calculating texture offsets of 3d floors' sides.
Visual mode, UDMF: fixed a ton of bugs in Auto align functions.
Visual mode, UDMF: when using "Move Texture Left/Right/Up/Down by 1" actions texture offsets were not updated properly when texture's scale was < 1.0.
Visual mode, UDMF: OffsetX and OffsetY were not taken into account in "Fit Texture Width/Height" actions.
Dockers Panel: added Pin/Unpin button, which acts the same as "Preferences -> Interface -> Side panels -> Auto hide" checkbox.
Texture size labels can now be disabled by unchecking "Preferences -> Interface -> Show texture and flat sizes in browsers" checkbox.
Texture size labels now are not shown for unknown textures.
Most of texture size labels had incorrect bg color.
ZDoom_linedefs.cfg: action specials 223 and 224 had incorrect Arg0.
2013-06-24 14:21:13 +00:00
|
|
|
using CodeImp.DoomBuilder.GZBuilder.Tools;
|
2014-01-13 08:06:56 +00:00
|
|
|
using CodeImp.DoomBuilder.Data;
|
2009-04-19 18:07:22 +00:00
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
namespace CodeImp.DoomBuilder.BuilderModes
|
|
|
|
{
|
|
|
|
internal sealed class VisualFloor : BaseVisualGeometrySector
|
|
|
|
{
|
|
|
|
#region ================== Constants
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
#region ================== Variables
|
2013-03-18 13:52:27 +00:00
|
|
|
|
|
|
|
private bool innerSide; //mxd
|
|
|
|
|
2009-04-19 18:07:22 +00:00
|
|
|
#endregion
|
|
|
|
|
|
|
|
#region ================== Properties
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
#region ================== Constructor / Setup
|
|
|
|
|
|
|
|
// Constructor
|
|
|
|
public VisualFloor(BaseVisualMode mode, VisualSector vs) : base(mode, vs)
|
|
|
|
{
|
2013-09-11 09:47:53 +00:00
|
|
|
//mxd
|
2014-12-22 21:36:49 +00:00
|
|
|
geometrytype = VisualGeometryType.FLOOR;
|
|
|
|
partname = "floor";
|
2013-03-18 13:52:27 +00:00
|
|
|
|
|
|
|
//mxd
|
2014-12-03 23:15:26 +00:00
|
|
|
if(mode.UseSelectionFromClassicMode && vs != null && vs.Sector.Selected
|
|
|
|
&& (General.Map.ViewMode == ViewMode.FloorTextures || General.Map.ViewMode == ViewMode.Normal))
|
|
|
|
{
|
2013-03-18 13:52:27 +00:00
|
|
|
this.selected = true;
|
|
|
|
mode.AddSelectedObject(this);
|
|
|
|
}
|
2013-09-11 09:47:53 +00:00
|
|
|
|
|
|
|
// We have no destructor
|
2009-04-19 18:07:22 +00:00
|
|
|
GC.SuppressFinalize(this);
|
|
|
|
}
|
|
|
|
|
|
|
|
// This builds the geometry. Returns false when no geometry created.
|
2014-12-03 23:15:26 +00:00
|
|
|
public override bool Setup(SectorLevel level, Effect3DFloor extrafloor)
|
|
|
|
{
|
2013-03-18 13:52:27 +00:00
|
|
|
return Setup(level, extrafloor, innerSide);
|
|
|
|
}
|
|
|
|
|
|
|
|
//mxd
|
|
|
|
public bool Setup(SectorLevel level, Effect3DFloor extrafloor, bool innerSide)
|
2009-04-19 18:07:22 +00:00
|
|
|
{
|
2012-11-27 21:12:20 +00:00
|
|
|
Sector s = level.sector;
|
|
|
|
Vector2D texscale;
|
2013-03-18 13:52:27 +00:00
|
|
|
this.innerSide = innerSide;
|
2012-11-27 21:12:20 +00:00
|
|
|
|
|
|
|
base.Setup(level, extrafloor);
|
|
|
|
|
|
|
|
// Fetch ZDoom fields
|
|
|
|
float rotate = Angle2D.DegToRad(s.Fields.GetValue("rotationfloor", 0.0f));
|
|
|
|
Vector2D offset = new Vector2D(s.Fields.GetValue("xpanningfloor", 0.0f),
|
|
|
|
s.Fields.GetValue("ypanningfloor", 0.0f));
|
|
|
|
Vector2D scale = new Vector2D(s.Fields.GetValue("xscalefloor", 1.0f),
|
|
|
|
s.Fields.GetValue("yscalefloor", 1.0f));
|
2009-04-19 18:07:22 +00:00
|
|
|
|
2013-03-18 13:52:27 +00:00
|
|
|
//Load floor texture
|
2014-03-05 09:21:28 +00:00
|
|
|
if (s.LongFloorTexture != MapSet.EmptyLongName)
|
2013-07-31 12:38:47 +00:00
|
|
|
{
|
|
|
|
base.Texture = General.Map.Data.GetFlatImage(s.LongFloorTexture);
|
2014-01-13 08:06:56 +00:00
|
|
|
if(base.Texture == null || base.Texture is UnknownImage)
|
2013-07-31 12:38:47 +00:00
|
|
|
{
|
|
|
|
base.Texture = General.Map.Data.UnknownTexture3D;
|
2013-04-26 12:32:51 +00:00
|
|
|
setuponloadedtexture = s.LongFloorTexture;
|
2013-07-31 12:38:47 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (!base.Texture.IsImageLoaded)
|
|
|
|
setuponloadedtexture = s.LongFloorTexture;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
// Use missing texture
|
|
|
|
base.Texture = General.Map.Data.MissingTexture3D;
|
|
|
|
setuponloadedtexture = 0;
|
2013-04-26 12:32:51 +00:00
|
|
|
}
|
2012-11-27 21:12:20 +00:00
|
|
|
|
|
|
|
// Determine texture scale
|
|
|
|
if(base.Texture.IsImageLoaded)
|
|
|
|
texscale = new Vector2D(1.0f / base.Texture.ScaledWidth, 1.0f / base.Texture.ScaledHeight);
|
|
|
|
else
|
|
|
|
texscale = new Vector2D(1.0f / 64.0f, 1.0f / 64.0f);
|
|
|
|
|
2009-04-19 18:07:22 +00:00
|
|
|
// Make vertices
|
2012-11-27 21:12:20 +00:00
|
|
|
ReadOnlyCollection<Vector2D> triverts = base.Sector.Sector.Triangles.Vertices;
|
2014-09-22 09:04:30 +00:00
|
|
|
WorldVertex[] verts = new WorldVertex[triverts.Count];
|
2012-11-27 21:12:20 +00:00
|
|
|
for(int i = 0; i < triverts.Count; i++)
|
2009-04-19 18:07:22 +00:00
|
|
|
{
|
2012-11-27 21:12:20 +00:00
|
|
|
// Color shading
|
|
|
|
PixelColor c = PixelColor.FromInt(level.color);
|
|
|
|
verts[i].c = c.WithAlpha((byte)General.Clamp(level.alpha, 0, 255)).ToInt();
|
|
|
|
|
|
|
|
// Vertex coordinates
|
|
|
|
verts[i].x = triverts[i].x;
|
|
|
|
verts[i].y = triverts[i].y;
|
|
|
|
verts[i].z = level.plane.GetZ(triverts[i]); //(float)s.FloorHeight;
|
2009-04-19 18:07:22 +00:00
|
|
|
|
2012-11-27 21:12:20 +00:00
|
|
|
// Texture coordinates
|
|
|
|
Vector2D pos = triverts[i];
|
|
|
|
pos = pos.GetRotated(rotate);
|
|
|
|
pos.y = -pos.y;
|
|
|
|
pos = (pos + offset) * scale * texscale;
|
|
|
|
verts[i].u = pos.x;
|
|
|
|
verts[i].v = pos.y;
|
|
|
|
}
|
2009-04-19 18:07:22 +00:00
|
|
|
|
2012-11-27 21:12:20 +00:00
|
|
|
// The sector triangulation created clockwise triangles that
|
|
|
|
// are right up for the floor. For the ceiling we must flip
|
|
|
|
// the triangles upside down.
|
2013-03-18 13:52:27 +00:00
|
|
|
if((extrafloor != null) && !extrafloor.VavoomType && !innerSide)
|
2012-11-27 21:12:20 +00:00
|
|
|
SwapTriangleVertices(verts);
|
|
|
|
|
|
|
|
// Determine render pass
|
|
|
|
if(extrafloor != null)
|
|
|
|
{
|
2013-03-18 13:52:27 +00:00
|
|
|
if((extrafloor.Linedef.Args[2] & (int)Effect3DFloor.Flags.RenderAdditive) != 0) //mxd
|
|
|
|
this.RenderPass = RenderPass.Additive;
|
|
|
|
else if(level.alpha < 255)
|
2012-11-27 21:12:20 +00:00
|
|
|
this.RenderPass = RenderPass.Alpha;
|
|
|
|
else
|
|
|
|
this.RenderPass = RenderPass.Mask;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
this.RenderPass = RenderPass.Solid;
|
2009-04-19 18:07:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Apply vertices
|
|
|
|
base.SetVertices(verts);
|
|
|
|
return (verts.Length > 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
#region ================== Methods
|
2012-11-27 21:12:20 +00:00
|
|
|
|
|
|
|
// Return texture coordinates
|
|
|
|
protected override Point GetTextureOffset()
|
|
|
|
{
|
|
|
|
Point p = new Point();
|
|
|
|
p.X = (int)Sector.Sector.Fields.GetValue("xpanningfloor", 0.0f);
|
|
|
|
p.Y = (int)Sector.Sector.Fields.GetValue("ypanningfloor", 0.0f);
|
|
|
|
return p;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Move texture coordinates
|
|
|
|
protected override void MoveTextureOffset(Point xy)
|
|
|
|
{
|
2013-09-11 09:47:53 +00:00
|
|
|
//mxd
|
|
|
|
Sector s = GetControlSector();
|
|
|
|
s.Fields.BeforeFieldsChange();
|
2013-08-02 12:50:53 +00:00
|
|
|
float nx = (s.Fields.GetValue("xpanningfloor", 0.0f) + xy.X) % (Texture.ScaledWidth / s.Fields.GetValue("xscalefloor", 1.0f));
|
|
|
|
float ny = (s.Fields.GetValue("ypanningfloor", 0.0f) + xy.Y) % (Texture.ScaledHeight / s.Fields.GetValue("yscalefloor", 1.0f));
|
2013-09-11 09:47:53 +00:00
|
|
|
s.Fields["xpanningfloor"] = new UniValue(UniversalType.Float, nx);
|
|
|
|
s.Fields["ypanningfloor"] = new UniValue(UniversalType.Float, ny);
|
|
|
|
s.UpdateNeeded = true;
|
Visual mode, UDMF: added "Scale Texture Up (X)", "Scale Texture Down (X)", "Scale Texture Up (Y)", "Scale Texture Down (Y)" actions. Default keys are Num6, Num4, Num8, Num5.
Visual mode, UDMF: renamed "Rotate Thing Clockwise" and "Rotate Thing Counterclockwise" actions to "Rotate Clockwise" and "Rotate Counterclockwise". These actions can now be used to change rotation of floor/ceiling textures.
Visual mode, UDMF: "Reset Texture Offsets" action now also resets sidedef's scale and floor/ceiling's scale and rotation.
Visual mode, UDMF: control line's OffsetX and OffsetY were not taken into account when calculating texture offsets of 3d floors' sides.
Visual mode, UDMF: fixed a ton of bugs in Auto align functions.
Visual mode, UDMF: when using "Move Texture Left/Right/Up/Down by 1" actions texture offsets were not updated properly when texture's scale was < 1.0.
Visual mode, UDMF: OffsetX and OffsetY were not taken into account in "Fit Texture Width/Height" actions.
Dockers Panel: added Pin/Unpin button, which acts the same as "Preferences -> Interface -> Side panels -> Auto hide" checkbox.
Texture size labels can now be disabled by unchecking "Preferences -> Interface -> Show texture and flat sizes in browsers" checkbox.
Texture size labels now are not shown for unknown textures.
Most of texture size labels had incorrect bg color.
ZDoom_linedefs.cfg: action specials 223 and 224 had incorrect Arg0.
2013-06-24 14:21:13 +00:00
|
|
|
|
|
|
|
mode.SetActionResult("Changed floor texture offsets to " + nx + ", " + ny + ".");
|
|
|
|
}
|
|
|
|
|
|
|
|
//mxd. Texture scale change
|
2014-12-03 23:15:26 +00:00
|
|
|
protected override void ChangeTextureScale(float incrementX, float incrementY)
|
|
|
|
{
|
Visual mode, UDMF: added "Scale Texture Up (X)", "Scale Texture Down (X)", "Scale Texture Up (Y)", "Scale Texture Down (Y)" actions. Default keys are Num6, Num4, Num8, Num5.
Visual mode, UDMF: renamed "Rotate Thing Clockwise" and "Rotate Thing Counterclockwise" actions to "Rotate Clockwise" and "Rotate Counterclockwise". These actions can now be used to change rotation of floor/ceiling textures.
Visual mode, UDMF: "Reset Texture Offsets" action now also resets sidedef's scale and floor/ceiling's scale and rotation.
Visual mode, UDMF: control line's OffsetX and OffsetY were not taken into account when calculating texture offsets of 3d floors' sides.
Visual mode, UDMF: fixed a ton of bugs in Auto align functions.
Visual mode, UDMF: when using "Move Texture Left/Right/Up/Down by 1" actions texture offsets were not updated properly when texture's scale was < 1.0.
Visual mode, UDMF: OffsetX and OffsetY were not taken into account in "Fit Texture Width/Height" actions.
Dockers Panel: added Pin/Unpin button, which acts the same as "Preferences -> Interface -> Side panels -> Auto hide" checkbox.
Texture size labels can now be disabled by unchecking "Preferences -> Interface -> Show texture and flat sizes in browsers" checkbox.
Texture size labels now are not shown for unknown textures.
Most of texture size labels had incorrect bg color.
ZDoom_linedefs.cfg: action specials 223 and 224 had incorrect Arg0.
2013-06-24 14:21:13 +00:00
|
|
|
Sector s = GetControlSector();
|
|
|
|
float scaleX = s.Fields.GetValue("xscalefloor", 1.0f);
|
|
|
|
float scaleY = s.Fields.GetValue("yscalefloor", 1.0f);
|
|
|
|
|
|
|
|
s.Fields.BeforeFieldsChange();
|
|
|
|
|
2014-12-03 23:15:26 +00:00
|
|
|
if(incrementX != 0)
|
|
|
|
{
|
Visual mode, UDMF: added "Scale Texture Up (X)", "Scale Texture Down (X)", "Scale Texture Up (Y)", "Scale Texture Down (Y)" actions. Default keys are Num6, Num4, Num8, Num5.
Visual mode, UDMF: renamed "Rotate Thing Clockwise" and "Rotate Thing Counterclockwise" actions to "Rotate Clockwise" and "Rotate Counterclockwise". These actions can now be used to change rotation of floor/ceiling textures.
Visual mode, UDMF: "Reset Texture Offsets" action now also resets sidedef's scale and floor/ceiling's scale and rotation.
Visual mode, UDMF: control line's OffsetX and OffsetY were not taken into account when calculating texture offsets of 3d floors' sides.
Visual mode, UDMF: fixed a ton of bugs in Auto align functions.
Visual mode, UDMF: when using "Move Texture Left/Right/Up/Down by 1" actions texture offsets were not updated properly when texture's scale was < 1.0.
Visual mode, UDMF: OffsetX and OffsetY were not taken into account in "Fit Texture Width/Height" actions.
Dockers Panel: added Pin/Unpin button, which acts the same as "Preferences -> Interface -> Side panels -> Auto hide" checkbox.
Texture size labels can now be disabled by unchecking "Preferences -> Interface -> Show texture and flat sizes in browsers" checkbox.
Texture size labels now are not shown for unknown textures.
Most of texture size labels had incorrect bg color.
ZDoom_linedefs.cfg: action specials 223 and 224 had incorrect Arg0.
2013-06-24 14:21:13 +00:00
|
|
|
if(scaleX + incrementX == 0)
|
|
|
|
scaleX *= -1;
|
|
|
|
else
|
|
|
|
scaleX += incrementX;
|
2013-08-10 11:28:51 +00:00
|
|
|
UDMFTools.SetFloat(s.Fields, "xscalefloor", scaleX, 1.0f);
|
Visual mode, UDMF: added "Scale Texture Up (X)", "Scale Texture Down (X)", "Scale Texture Up (Y)", "Scale Texture Down (Y)" actions. Default keys are Num6, Num4, Num8, Num5.
Visual mode, UDMF: renamed "Rotate Thing Clockwise" and "Rotate Thing Counterclockwise" actions to "Rotate Clockwise" and "Rotate Counterclockwise". These actions can now be used to change rotation of floor/ceiling textures.
Visual mode, UDMF: "Reset Texture Offsets" action now also resets sidedef's scale and floor/ceiling's scale and rotation.
Visual mode, UDMF: control line's OffsetX and OffsetY were not taken into account when calculating texture offsets of 3d floors' sides.
Visual mode, UDMF: fixed a ton of bugs in Auto align functions.
Visual mode, UDMF: when using "Move Texture Left/Right/Up/Down by 1" actions texture offsets were not updated properly when texture's scale was < 1.0.
Visual mode, UDMF: OffsetX and OffsetY were not taken into account in "Fit Texture Width/Height" actions.
Dockers Panel: added Pin/Unpin button, which acts the same as "Preferences -> Interface -> Side panels -> Auto hide" checkbox.
Texture size labels can now be disabled by unchecking "Preferences -> Interface -> Show texture and flat sizes in browsers" checkbox.
Texture size labels now are not shown for unknown textures.
Most of texture size labels had incorrect bg color.
ZDoom_linedefs.cfg: action specials 223 and 224 had incorrect Arg0.
2013-06-24 14:21:13 +00:00
|
|
|
}
|
|
|
|
|
2014-12-03 23:15:26 +00:00
|
|
|
if(incrementY != 0)
|
|
|
|
{
|
Visual mode, UDMF: added "Scale Texture Up (X)", "Scale Texture Down (X)", "Scale Texture Up (Y)", "Scale Texture Down (Y)" actions. Default keys are Num6, Num4, Num8, Num5.
Visual mode, UDMF: renamed "Rotate Thing Clockwise" and "Rotate Thing Counterclockwise" actions to "Rotate Clockwise" and "Rotate Counterclockwise". These actions can now be used to change rotation of floor/ceiling textures.
Visual mode, UDMF: "Reset Texture Offsets" action now also resets sidedef's scale and floor/ceiling's scale and rotation.
Visual mode, UDMF: control line's OffsetX and OffsetY were not taken into account when calculating texture offsets of 3d floors' sides.
Visual mode, UDMF: fixed a ton of bugs in Auto align functions.
Visual mode, UDMF: when using "Move Texture Left/Right/Up/Down by 1" actions texture offsets were not updated properly when texture's scale was < 1.0.
Visual mode, UDMF: OffsetX and OffsetY were not taken into account in "Fit Texture Width/Height" actions.
Dockers Panel: added Pin/Unpin button, which acts the same as "Preferences -> Interface -> Side panels -> Auto hide" checkbox.
Texture size labels can now be disabled by unchecking "Preferences -> Interface -> Show texture and flat sizes in browsers" checkbox.
Texture size labels now are not shown for unknown textures.
Most of texture size labels had incorrect bg color.
ZDoom_linedefs.cfg: action specials 223 and 224 had incorrect Arg0.
2013-06-24 14:21:13 +00:00
|
|
|
if(scaleY + incrementY == 0)
|
|
|
|
scaleY *= -1;
|
|
|
|
else
|
|
|
|
scaleY += incrementY;
|
2013-08-10 11:28:51 +00:00
|
|
|
UDMFTools.SetFloat(s.Fields, "yscalefloor", scaleY, 1.0f);
|
Visual mode, UDMF: added "Scale Texture Up (X)", "Scale Texture Down (X)", "Scale Texture Up (Y)", "Scale Texture Down (Y)" actions. Default keys are Num6, Num4, Num8, Num5.
Visual mode, UDMF: renamed "Rotate Thing Clockwise" and "Rotate Thing Counterclockwise" actions to "Rotate Clockwise" and "Rotate Counterclockwise". These actions can now be used to change rotation of floor/ceiling textures.
Visual mode, UDMF: "Reset Texture Offsets" action now also resets sidedef's scale and floor/ceiling's scale and rotation.
Visual mode, UDMF: control line's OffsetX and OffsetY were not taken into account when calculating texture offsets of 3d floors' sides.
Visual mode, UDMF: fixed a ton of bugs in Auto align functions.
Visual mode, UDMF: when using "Move Texture Left/Right/Up/Down by 1" actions texture offsets were not updated properly when texture's scale was < 1.0.
Visual mode, UDMF: OffsetX and OffsetY were not taken into account in "Fit Texture Width/Height" actions.
Dockers Panel: added Pin/Unpin button, which acts the same as "Preferences -> Interface -> Side panels -> Auto hide" checkbox.
Texture size labels can now be disabled by unchecking "Preferences -> Interface -> Show texture and flat sizes in browsers" checkbox.
Texture size labels now are not shown for unknown textures.
Most of texture size labels had incorrect bg color.
ZDoom_linedefs.cfg: action specials 223 and 224 had incorrect Arg0.
2013-06-24 14:21:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//update geometry
|
2014-12-03 23:15:26 +00:00
|
|
|
OnTextureChanged();
|
Visual mode, UDMF: added "Scale Texture Up (X)", "Scale Texture Down (X)", "Scale Texture Up (Y)", "Scale Texture Down (Y)" actions. Default keys are Num6, Num4, Num8, Num5.
Visual mode, UDMF: renamed "Rotate Thing Clockwise" and "Rotate Thing Counterclockwise" actions to "Rotate Clockwise" and "Rotate Counterclockwise". These actions can now be used to change rotation of floor/ceiling textures.
Visual mode, UDMF: "Reset Texture Offsets" action now also resets sidedef's scale and floor/ceiling's scale and rotation.
Visual mode, UDMF: control line's OffsetX and OffsetY were not taken into account when calculating texture offsets of 3d floors' sides.
Visual mode, UDMF: fixed a ton of bugs in Auto align functions.
Visual mode, UDMF: when using "Move Texture Left/Right/Up/Down by 1" actions texture offsets were not updated properly when texture's scale was < 1.0.
Visual mode, UDMF: OffsetX and OffsetY were not taken into account in "Fit Texture Width/Height" actions.
Dockers Panel: added Pin/Unpin button, which acts the same as "Preferences -> Interface -> Side panels -> Auto hide" checkbox.
Texture size labels can now be disabled by unchecking "Preferences -> Interface -> Show texture and flat sizes in browsers" checkbox.
Texture size labels now are not shown for unknown textures.
Most of texture size labels had incorrect bg color.
ZDoom_linedefs.cfg: action specials 223 and 224 had incorrect Arg0.
2013-06-24 14:21:13 +00:00
|
|
|
|
|
|
|
s.UpdateNeeded = true;
|
|
|
|
s.UpdateCache();
|
2014-12-03 23:15:26 +00:00
|
|
|
if(s.Index != Sector.Sector.Index)
|
|
|
|
{
|
Visual mode, UDMF: added "Scale Texture Up (X)", "Scale Texture Down (X)", "Scale Texture Up (Y)", "Scale Texture Down (Y)" actions. Default keys are Num6, Num4, Num8, Num5.
Visual mode, UDMF: renamed "Rotate Thing Clockwise" and "Rotate Thing Counterclockwise" actions to "Rotate Clockwise" and "Rotate Counterclockwise". These actions can now be used to change rotation of floor/ceiling textures.
Visual mode, UDMF: "Reset Texture Offsets" action now also resets sidedef's scale and floor/ceiling's scale and rotation.
Visual mode, UDMF: control line's OffsetX and OffsetY were not taken into account when calculating texture offsets of 3d floors' sides.
Visual mode, UDMF: fixed a ton of bugs in Auto align functions.
Visual mode, UDMF: when using "Move Texture Left/Right/Up/Down by 1" actions texture offsets were not updated properly when texture's scale was < 1.0.
Visual mode, UDMF: OffsetX and OffsetY were not taken into account in "Fit Texture Width/Height" actions.
Dockers Panel: added Pin/Unpin button, which acts the same as "Preferences -> Interface -> Side panels -> Auto hide" checkbox.
Texture size labels can now be disabled by unchecking "Preferences -> Interface -> Show texture and flat sizes in browsers" checkbox.
Texture size labels now are not shown for unknown textures.
Most of texture size labels had incorrect bg color.
ZDoom_linedefs.cfg: action specials 223 and 224 had incorrect Arg0.
2013-06-24 14:21:13 +00:00
|
|
|
Sector.Sector.UpdateNeeded = true;
|
|
|
|
Sector.Sector.UpdateCache();
|
|
|
|
}
|
|
|
|
|
|
|
|
mode.SetActionResult("Floor scale changed to " + scaleX + ", " + scaleY);
|
2012-11-27 21:12:20 +00:00
|
|
|
}
|
2013-04-16 12:52:40 +00:00
|
|
|
|
|
|
|
//mxd
|
2014-12-03 23:15:26 +00:00
|
|
|
public override void OnResetTextureOffset()
|
|
|
|
{
|
2013-04-16 12:52:40 +00:00
|
|
|
if(!General.Map.UDMF) return;
|
|
|
|
|
|
|
|
mode.CreateUndo("Reset texture offsets");
|
|
|
|
mode.SetActionResult("Texture offsets reset.");
|
|
|
|
Sector.Sector.Fields.BeforeFieldsChange();
|
|
|
|
|
2014-12-22 21:36:49 +00:00
|
|
|
string[] keys = new[] { "xpanningfloor", "ypanningfloor", "xscalefloor", "yscalefloor", "rotationfloor" };
|
Visual mode, UDMF: added "Scale Texture Up (X)", "Scale Texture Down (X)", "Scale Texture Up (Y)", "Scale Texture Down (Y)" actions. Default keys are Num6, Num4, Num8, Num5.
Visual mode, UDMF: renamed "Rotate Thing Clockwise" and "Rotate Thing Counterclockwise" actions to "Rotate Clockwise" and "Rotate Counterclockwise". These actions can now be used to change rotation of floor/ceiling textures.
Visual mode, UDMF: "Reset Texture Offsets" action now also resets sidedef's scale and floor/ceiling's scale and rotation.
Visual mode, UDMF: control line's OffsetX and OffsetY were not taken into account when calculating texture offsets of 3d floors' sides.
Visual mode, UDMF: fixed a ton of bugs in Auto align functions.
Visual mode, UDMF: when using "Move Texture Left/Right/Up/Down by 1" actions texture offsets were not updated properly when texture's scale was < 1.0.
Visual mode, UDMF: OffsetX and OffsetY were not taken into account in "Fit Texture Width/Height" actions.
Dockers Panel: added Pin/Unpin button, which acts the same as "Preferences -> Interface -> Side panels -> Auto hide" checkbox.
Texture size labels can now be disabled by unchecking "Preferences -> Interface -> Show texture and flat sizes in browsers" checkbox.
Texture size labels now are not shown for unknown textures.
Most of texture size labels had incorrect bg color.
ZDoom_linedefs.cfg: action specials 223 and 224 had incorrect Arg0.
2013-06-24 14:21:13 +00:00
|
|
|
|
2014-12-03 23:15:26 +00:00
|
|
|
foreach(string key in keys)
|
|
|
|
{
|
|
|
|
if(Sector.Sector.Fields.ContainsKey(key))
|
|
|
|
{
|
Visual mode, UDMF: added "Scale Texture Up (X)", "Scale Texture Down (X)", "Scale Texture Up (Y)", "Scale Texture Down (Y)" actions. Default keys are Num6, Num4, Num8, Num5.
Visual mode, UDMF: renamed "Rotate Thing Clockwise" and "Rotate Thing Counterclockwise" actions to "Rotate Clockwise" and "Rotate Counterclockwise". These actions can now be used to change rotation of floor/ceiling textures.
Visual mode, UDMF: "Reset Texture Offsets" action now also resets sidedef's scale and floor/ceiling's scale and rotation.
Visual mode, UDMF: control line's OffsetX and OffsetY were not taken into account when calculating texture offsets of 3d floors' sides.
Visual mode, UDMF: fixed a ton of bugs in Auto align functions.
Visual mode, UDMF: when using "Move Texture Left/Right/Up/Down by 1" actions texture offsets were not updated properly when texture's scale was < 1.0.
Visual mode, UDMF: OffsetX and OffsetY were not taken into account in "Fit Texture Width/Height" actions.
Dockers Panel: added Pin/Unpin button, which acts the same as "Preferences -> Interface -> Side panels -> Auto hide" checkbox.
Texture size labels can now be disabled by unchecking "Preferences -> Interface -> Show texture and flat sizes in browsers" checkbox.
Texture size labels now are not shown for unknown textures.
Most of texture size labels had incorrect bg color.
ZDoom_linedefs.cfg: action specials 223 and 224 had incorrect Arg0.
2013-06-24 14:21:13 +00:00
|
|
|
Sector.Sector.Fields.Remove(key);
|
|
|
|
Sector.Sector.UpdateNeeded = true;
|
|
|
|
}
|
2013-04-16 12:52:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if(Sector.Sector.UpdateNeeded)
|
|
|
|
Sector.UpdateSectorGeometry(false);
|
|
|
|
}
|
2013-09-19 09:17:49 +00:00
|
|
|
|
|
|
|
//mxd
|
2014-12-03 23:15:26 +00:00
|
|
|
public override void OnResetLocalTextureOffset()
|
|
|
|
{
|
2013-09-19 09:17:49 +00:00
|
|
|
OnResetTextureOffset();
|
|
|
|
}
|
2009-04-19 18:07:22 +00:00
|
|
|
|
|
|
|
// Paste texture
|
|
|
|
public override void OnPasteTexture()
|
|
|
|
{
|
|
|
|
if(BuilderPlug.Me.CopiedFlat != null)
|
|
|
|
{
|
2014-01-13 08:44:31 +00:00
|
|
|
mode.CreateUndo("Paste floor '" + BuilderPlug.Me.CopiedFlat + "'");
|
|
|
|
mode.SetActionResult("Pasted flat '" + BuilderPlug.Me.CopiedFlat + "' on floor.");
|
2009-04-19 18:07:22 +00:00
|
|
|
SetTexture(BuilderPlug.Me.CopiedFlat);
|
2013-03-18 13:52:27 +00:00
|
|
|
|
|
|
|
//mxd. 3D floors may need updating...
|
2014-12-03 23:15:26 +00:00
|
|
|
OnTextureChanged();
|
2009-04-19 18:07:22 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-11-27 21:12:20 +00:00
|
|
|
// Call to change the height
|
|
|
|
public override void OnChangeTargetHeight(int amount)
|
|
|
|
{
|
|
|
|
// Only do this when not done yet in this call
|
|
|
|
// Because we may be able to select the same 3D floor multiple times through multiple sectors
|
|
|
|
SectorData sd = mode.GetSectorData(level.sector);
|
|
|
|
if(!sd.FloorChanged)
|
|
|
|
{
|
|
|
|
sd.FloorChanged = true;
|
|
|
|
base.OnChangeTargetHeight(amount);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-04-19 18:07:22 +00:00
|
|
|
// This changes the height
|
|
|
|
protected override void ChangeHeight(int amount)
|
|
|
|
{
|
2012-11-27 21:12:20 +00:00
|
|
|
mode.CreateUndo("Change floor height", UndoGroup.FloorHeightChange, level.sector.FixedIndex);
|
2014-10-17 11:55:08 +00:00
|
|
|
level.sector.FloorHeight += amount;
|
|
|
|
|
|
|
|
if(General.Map.UDMF)
|
|
|
|
{
|
|
|
|
//mxd. Modify vertex offsets?
|
|
|
|
if(level.sector.Sidedefs.Count == 3)
|
|
|
|
{
|
|
|
|
ChangeVertexHeight(amount);
|
|
|
|
}
|
|
|
|
|
|
|
|
//mxd. Modify slope offset?
|
|
|
|
if(level.sector.FloorSlope.GetLengthSq() > 0)
|
|
|
|
{
|
|
|
|
Vector3D center = new Vector3D(level.sector.BBox.X + level.sector.BBox.Width / 2,
|
|
|
|
level.sector.BBox.Y + level.sector.BBox.Height / 2,
|
|
|
|
level.sector.FloorHeight);
|
|
|
|
|
|
|
|
Plane p = new Plane(center,
|
|
|
|
level.sector.FloorSlope.GetAngleXY() + Angle2D.PIHALF,
|
|
|
|
-level.sector.FloorSlope.GetAngleZ(),
|
|
|
|
true);
|
|
|
|
|
|
|
|
level.sector.FloorSlopeOffset = p.Offset;
|
|
|
|
}
|
2014-02-03 11:19:12 +00:00
|
|
|
}
|
|
|
|
|
2012-11-27 21:12:20 +00:00
|
|
|
mode.SetActionResult("Changed floor height to " + level.sector.FloorHeight + ".");
|
2009-04-19 18:07:22 +00:00
|
|
|
}
|
|
|
|
|
2014-02-03 11:19:12 +00:00
|
|
|
//mxd
|
2014-10-17 11:55:08 +00:00
|
|
|
private void ChangeVertexHeight(int amount)
|
|
|
|
{
|
2014-02-03 11:19:12 +00:00
|
|
|
List<Vertex> verts = new List<Vertex>(3);
|
|
|
|
|
|
|
|
//do this only if all 3 verts have offsets
|
2014-10-17 11:55:08 +00:00
|
|
|
foreach(Sidedef side in level.sector.Sidedefs)
|
|
|
|
{
|
|
|
|
if(float.IsNaN(side.Line.Start.ZFloor) || float.IsNaN(side.Line.End.ZFloor)) return;
|
2014-02-03 11:19:12 +00:00
|
|
|
if(!verts.Contains(side.Line.Start)) verts.Add(side.Line.Start);
|
|
|
|
if(!verts.Contains(side.Line.End)) verts.Add(side.Line.End);
|
|
|
|
}
|
|
|
|
|
|
|
|
foreach (Vertex v in verts)
|
|
|
|
mode.GetVisualVertex(v, true).OnChangeTargetHeight(amount);
|
|
|
|
}
|
|
|
|
|
2013-09-11 09:47:53 +00:00
|
|
|
//mxd. Sector brightness change
|
2014-12-03 23:15:26 +00:00
|
|
|
public override void OnChangeTargetBrightness(bool up)
|
|
|
|
{
|
|
|
|
if (level != null)
|
|
|
|
{
|
2013-09-11 09:47:53 +00:00
|
|
|
if (level.sector != Sector.Sector) //this floor is part of 3D-floor
|
|
|
|
((BaseVisualSector)mode.GetVisualSector(level.sector)).Floor.OnChangeTargetBrightness(up);
|
|
|
|
else if (Sector.ExtraFloors.Count > 0) //this is actual floor of a sector with extrafloors
|
|
|
|
Sector.ExtraFloors[0].OnChangeTargetBrightness(up);
|
|
|
|
else
|
|
|
|
base.OnChangeTargetBrightness(up);
|
2014-12-03 23:15:26 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2013-09-11 09:47:53 +00:00
|
|
|
base.OnChangeTargetBrightness(up);
|
|
|
|
}
|
|
|
|
}
|
2012-11-27 21:12:20 +00:00
|
|
|
|
2009-04-19 18:07:22 +00:00
|
|
|
// This performs a fast test in object picking
|
|
|
|
public override bool PickFastReject(Vector3D from, Vector3D to, Vector3D dir)
|
|
|
|
{
|
2012-11-27 21:12:20 +00:00
|
|
|
// Check if our ray starts at the correct side of the plane
|
2013-03-18 13:52:27 +00:00
|
|
|
if((!innerSide && level.plane.Distance(from) > 0.0f) || (innerSide && level.plane.Distance(from) < 0.0f))
|
2009-04-19 18:07:22 +00:00
|
|
|
{
|
2012-11-27 21:12:20 +00:00
|
|
|
// Calculate the intersection
|
|
|
|
if(level.plane.GetIntersection(from, to, ref pickrayu))
|
|
|
|
{
|
|
|
|
if(pickrayu > 0.0f)
|
|
|
|
{
|
|
|
|
pickintersect = from + (to - from) * pickrayu;
|
|
|
|
|
|
|
|
// Intersection point within bbox?
|
|
|
|
RectangleF bbox = Sector.Sector.BBox;
|
|
|
|
return ((pickintersect.x >= bbox.Left) && (pickintersect.x <= bbox.Right) &&
|
|
|
|
(pickintersect.y >= bbox.Top) && (pickintersect.y <= bbox.Bottom));
|
|
|
|
}
|
|
|
|
}
|
2009-04-19 18:07:22 +00:00
|
|
|
}
|
2012-11-27 21:12:20 +00:00
|
|
|
|
|
|
|
return false;
|
2009-04-19 18:07:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// This performs an accurate test for object picking
|
|
|
|
public override bool PickAccurate(Vector3D from, Vector3D to, Vector3D dir, ref float u_ray)
|
|
|
|
{
|
|
|
|
u_ray = pickrayu;
|
|
|
|
|
|
|
|
// Check on which side of the nearest sidedef we are
|
|
|
|
Sidedef sd = MapSet.NearestSidedef(Sector.Sector.Sidedefs, pickintersect);
|
|
|
|
float side = sd.Line.SideOfLine(pickintersect);
|
|
|
|
return (((side <= 0.0f) && sd.IsFront) || ((side > 0.0f) && !sd.IsFront));
|
|
|
|
}
|
2009-05-06 07:26:12 +00:00
|
|
|
|
2009-04-19 18:07:22 +00:00
|
|
|
// Return texture name
|
|
|
|
public override string GetTextureName()
|
|
|
|
{
|
2012-11-27 21:12:20 +00:00
|
|
|
return level.sector.FloorTexture;
|
2009-04-19 18:07:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// This changes the texture
|
|
|
|
protected override void SetTexture(string texturename)
|
|
|
|
{
|
2012-11-27 21:12:20 +00:00
|
|
|
level.sector.SetFloorTexture(texturename);
|
2009-04-19 18:07:22 +00:00
|
|
|
General.Map.Data.UpdateUsedTextures();
|
|
|
|
}
|
2013-04-01 11:06:01 +00:00
|
|
|
|
|
|
|
//mxd
|
2014-09-22 09:04:30 +00:00
|
|
|
public override void SelectNeighbours(bool select, bool withSameTexture, bool withSameHeight)
|
|
|
|
{
|
|
|
|
if (!withSameTexture && !withSameHeight) return;
|
2013-04-01 11:06:01 +00:00
|
|
|
|
2014-09-22 11:51:49 +00:00
|
|
|
if (select && !selected)
|
|
|
|
{
|
2013-04-01 11:06:01 +00:00
|
|
|
selected = true;
|
|
|
|
mode.AddSelectedObject(this);
|
2014-09-22 09:04:30 +00:00
|
|
|
}
|
|
|
|
else if (!select && selected)
|
|
|
|
{
|
2013-04-01 11:06:01 +00:00
|
|
|
selected = false;
|
|
|
|
mode.RemoveSelectedObject(this);
|
|
|
|
}
|
|
|
|
|
|
|
|
List<Sector> neighbours = new List<Sector>();
|
2014-09-22 11:51:49 +00:00
|
|
|
bool regularorvavoom = extrafloor == null || (extrafloor != null && extrafloor.VavoomType);
|
2013-04-01 11:06:01 +00:00
|
|
|
|
|
|
|
//collect neighbour sectors
|
2014-09-22 09:04:30 +00:00
|
|
|
foreach(Sidedef side in Sector.Sector.Sidedefs)
|
|
|
|
{
|
|
|
|
if (side.Other != null && side.Other.Sector != Sector.Sector && !neighbours.Contains(side.Other.Sector))
|
|
|
|
{
|
|
|
|
BaseVisualSector vs = mode.GetVisualSector(side.Other.Sector) as BaseVisualSector;
|
|
|
|
if (vs == null) continue;
|
|
|
|
bool add;
|
2013-04-01 11:06:01 +00:00
|
|
|
|
2014-09-22 09:04:30 +00:00
|
|
|
// When current floor is part of a 3d floor, it looks like a ceiling, so we need to select adjacent ceilings
|
2014-09-22 11:51:49 +00:00
|
|
|
if (level.sector != Sector.Sector && !regularorvavoom)
|
2014-09-22 09:04:30 +00:00
|
|
|
{
|
|
|
|
add = (withSameTexture && side.Other.Sector.CeilTexture == level.sector.FloorTexture);
|
|
|
|
|
|
|
|
if (withSameHeight)
|
|
|
|
{
|
|
|
|
add = ((withSameTexture && add) || !withSameTexture) && side.Other.Sector.CeilHeight == level.sector.FloorHeight;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (add)
|
|
|
|
{
|
|
|
|
neighbours.Add(side.Other.Sector);
|
|
|
|
|
|
|
|
//(de)select regular visual ceiling?
|
|
|
|
if (select != vs.Ceiling.Selected)
|
|
|
|
{
|
|
|
|
vs.Ceiling.SelectNeighbours(select, withSameTexture, withSameHeight);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2014-09-22 11:51:49 +00:00
|
|
|
else // Regular floor or vavoom-type extrafloor
|
2014-09-22 09:04:30 +00:00
|
|
|
{
|
|
|
|
// (De)select adjacent floor
|
|
|
|
add = (withSameTexture && side.Other.Sector.FloorTexture == level.sector.FloorTexture);
|
|
|
|
|
|
|
|
if (withSameHeight)
|
|
|
|
{
|
|
|
|
add = ((withSameTexture && add) || !withSameTexture) && side.Other.Sector.FloorHeight == level.sector.FloorHeight;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (add)
|
|
|
|
{
|
|
|
|
neighbours.Add(side.Other.Sector);
|
|
|
|
|
|
|
|
//(de)select regular visual floor?
|
|
|
|
if (select != vs.Floor.Selected)
|
|
|
|
{
|
|
|
|
vs.Floor.SelectNeighbours(select, withSameTexture, withSameHeight);
|
|
|
|
}
|
|
|
|
}
|
2014-09-22 11:51:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// (De)select adjacent extra floors
|
2014-12-03 23:15:26 +00:00
|
|
|
foreach(VisualFloor ef in vs.ExtraFloors)
|
|
|
|
{
|
2014-09-22 11:51:49 +00:00
|
|
|
if (select == ef.Selected || ef.extrafloor.VavoomType != regularorvavoom) continue;
|
|
|
|
|
|
|
|
add = (withSameTexture && level.sector.FloorTexture == ef.level.sector.FloorTexture);
|
|
|
|
|
|
|
|
if (withSameHeight)
|
|
|
|
{
|
|
|
|
add = ((withSameTexture && add) || !withSameTexture) && level.sector.FloorHeight == ef.level.sector.FloorHeight;
|
|
|
|
}
|
2014-09-22 09:04:30 +00:00
|
|
|
|
2014-09-22 11:51:49 +00:00
|
|
|
if (add)
|
2014-09-22 09:04:30 +00:00
|
|
|
{
|
2014-09-22 11:51:49 +00:00
|
|
|
ef.SelectNeighbours(select, withSameTexture, withSameHeight);
|
|
|
|
}
|
|
|
|
}
|
2014-09-22 09:04:30 +00:00
|
|
|
|
2014-09-22 11:51:49 +00:00
|
|
|
// (De)select adjacent vavoom type extra ceilings
|
|
|
|
foreach(VisualCeiling ec in vs.ExtraCeilings)
|
|
|
|
{
|
|
|
|
if(select == ec.Selected || ec.ExtraFloor.VavoomType == regularorvavoom) continue;
|
2014-09-22 09:04:30 +00:00
|
|
|
|
2014-09-22 11:51:49 +00:00
|
|
|
add = (withSameTexture && level.sector.FloorTexture == ec.Level.sector.CeilTexture);
|
2014-09-22 09:04:30 +00:00
|
|
|
|
2014-09-22 11:51:49 +00:00
|
|
|
if (withSameHeight)
|
|
|
|
{
|
|
|
|
add = ((withSameTexture && add) || !withSameTexture) && level.sector.FloorHeight == ec.Level.sector.CeilHeight;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (add)
|
|
|
|
{
|
|
|
|
ec.SelectNeighbours(select, withSameTexture, withSameHeight);
|
2014-09-22 09:04:30 +00:00
|
|
|
}
|
|
|
|
}
|
2013-04-01 11:06:01 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2013-04-26 12:32:51 +00:00
|
|
|
|
|
|
|
//mxd
|
2014-12-03 23:15:26 +00:00
|
|
|
public void AlignTexture(bool alignx, bool aligny)
|
|
|
|
{
|
2013-04-26 12:32:51 +00:00
|
|
|
if(!General.Map.UDMF) return;
|
|
|
|
|
2013-05-29 14:18:49 +00:00
|
|
|
//is is a surface with line slope?
|
2013-04-26 12:32:51 +00:00
|
|
|
float slopeAngle = level.plane.Normal.GetAngleZ() - Angle2D.PIHALF;
|
|
|
|
|
2014-12-03 23:15:26 +00:00
|
|
|
if(slopeAngle == 0) //it's a horizontal plane
|
|
|
|
{
|
|
|
|
AlignTextureToClosestLine(alignx, aligny);
|
|
|
|
}
|
|
|
|
else //it can be a surface with line slope
|
|
|
|
{
|
2013-05-29 14:18:49 +00:00
|
|
|
Linedef slopeSource = null;
|
|
|
|
bool isFront = false;
|
|
|
|
|
2014-12-03 23:15:26 +00:00
|
|
|
foreach(Sidedef side in Sector.Sector.Sidedefs)
|
|
|
|
{
|
|
|
|
if(side.Line.Action == 181)
|
|
|
|
{
|
|
|
|
if(side.Line.Args[0] == 1 && side.Line.Front != null && side.Line.Front == side)
|
|
|
|
{
|
2013-05-29 14:18:49 +00:00
|
|
|
slopeSource = side.Line;
|
|
|
|
isFront = true;
|
|
|
|
break;
|
2014-12-03 23:15:26 +00:00
|
|
|
}
|
|
|
|
else if(side.Line.Args[0] == 2 && side.Line.Back != null && side.Line.Back == side)
|
|
|
|
{
|
2013-05-29 14:18:49 +00:00
|
|
|
slopeSource = side.Line;
|
|
|
|
break;
|
|
|
|
}
|
2013-04-26 12:32:51 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-05-29 14:18:49 +00:00
|
|
|
if(slopeSource != null && slopeSource.Front != null && slopeSource.Front.Sector != null && slopeSource.Back != null && slopeSource.Back.Sector != null)
|
2014-12-03 23:15:26 +00:00
|
|
|
AlignTextureToSlopeLine(slopeSource, slopeAngle, isFront, alignx, aligny);
|
2013-04-26 12:32:51 +00:00
|
|
|
else
|
2014-12-03 23:15:26 +00:00
|
|
|
AlignTextureToClosestLine(alignx, aligny);
|
2013-04-26 12:32:51 +00:00
|
|
|
}
|
|
|
|
}
|
2009-04-19 18:07:22 +00:00
|
|
|
|
|
|
|
#endregion
|
|
|
|
}
|
|
|
|
}
|