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;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Windows.Forms;
|
|
|
|
|
using CodeImp.DoomBuilder.Windows;
|
|
|
|
|
using CodeImp.DoomBuilder.Map;
|
|
|
|
|
using CodeImp.DoomBuilder.Rendering;
|
|
|
|
|
using CodeImp.DoomBuilder.Geometry;
|
|
|
|
|
using CodeImp.DoomBuilder.Editing;
|
|
|
|
|
using CodeImp.DoomBuilder.Actions;
|
|
|
|
|
using CodeImp.DoomBuilder.VisualModes;
|
2009-07-10 08:25:04 +00:00
|
|
|
|
using CodeImp.DoomBuilder.Config;
|
2012-07-16 09:45:21 +00:00
|
|
|
|
using CodeImp.DoomBuilder.GZBuilder.Data;
|
2013-03-18 13:52:27 +00:00
|
|
|
|
using CodeImp.DoomBuilder.Types;
|
|
|
|
|
using CodeImp.DoomBuilder.Data;
|
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;
|
2009-04-19 18:07:22 +00:00
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
namespace CodeImp.DoomBuilder.BuilderModes
|
|
|
|
|
{
|
2012-11-27 21:12:20 +00:00
|
|
|
|
[EditMode(DisplayName = "GZDB Visual Mode",
|
|
|
|
|
SwitchAction = "gzdbvisualmode", // Action name used to switch to this mode
|
|
|
|
|
ButtonImage = "VisualModeGZ.png", // Image resource name for the button
|
|
|
|
|
ButtonOrder = 1, // Position of the button (lower is more to the left)
|
2009-04-19 18:07:22 +00:00
|
|
|
|
ButtonGroup = "001_visual",
|
2012-11-27 21:12:20 +00:00
|
|
|
|
UseByDefault = true)]
|
2009-04-19 18:07:22 +00:00
|
|
|
|
|
|
|
|
|
public class BaseVisualMode : VisualMode
|
|
|
|
|
{
|
|
|
|
|
#region ================== Constants
|
|
|
|
|
// Object picking
|
2012-07-12 22:34:12 +00:00
|
|
|
|
private const float PICK_INTERVAL = 80.0f;
|
2009-04-19 18:07:22 +00:00
|
|
|
|
private const float PICK_RANGE = 0.98f;
|
|
|
|
|
|
|
|
|
|
// Gravity
|
|
|
|
|
private const float GRAVITY = -0.06f;
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region ================== Variables
|
2009-05-01 20:31:17 +00:00
|
|
|
|
|
2010-01-02 20:22:05 +00:00
|
|
|
|
// Gravity
|
2009-05-01 20:31:17 +00:00
|
|
|
|
private Vector3D gravity;
|
2010-01-02 20:22:05 +00:00
|
|
|
|
private float cameraflooroffset = 41f; // same as in doom
|
|
|
|
|
private float cameraceilingoffset = 10f;
|
2009-04-19 18:07:22 +00:00
|
|
|
|
|
|
|
|
|
// Object picking
|
|
|
|
|
private VisualPickResult target;
|
2012-07-12 22:34:12 +00:00
|
|
|
|
private float lastpicktime;
|
2009-04-19 18:07:22 +00:00
|
|
|
|
private bool locktarget;
|
2012-11-27 21:12:20 +00:00
|
|
|
|
|
2013-03-18 13:52:27 +00:00
|
|
|
|
private bool useSelectionFromClassicMode;//mxd
|
|
|
|
|
public bool UseSelectionFromClassicMode { get { return useSelectionFromClassicMode; } }
|
|
|
|
|
|
2012-11-27 21:12:20 +00:00
|
|
|
|
// This keeps extra element info
|
|
|
|
|
private Dictionary<Sector, SectorData> sectordata;
|
2013-03-18 13:52:27 +00:00
|
|
|
|
private Dictionary<Thing, ThingData> thingdata;
|
|
|
|
|
private Dictionary<Vertex, VertexData> vertexdata; //mxd
|
2013-07-31 12:38:47 +00:00
|
|
|
|
//private Dictionary<Thing, EffectDynamicLight> lightdata; //mxd
|
2009-04-19 18:07:22 +00:00
|
|
|
|
|
2009-05-01 20:31:17 +00:00
|
|
|
|
// This is true when a selection was made because the action is performed
|
|
|
|
|
// on an object that was not selected. In this case the previous selection
|
|
|
|
|
// is cleared and the targeted object is temporarely selected to perform
|
|
|
|
|
// the action on. After the action is completed, the object is deselected.
|
2009-05-02 14:59:05 +00:00
|
|
|
|
private bool singleselection;
|
2009-04-19 18:07:22 +00:00
|
|
|
|
|
2009-05-02 14:59:05 +00:00
|
|
|
|
// We keep these to determine if we need to make a new undo level
|
|
|
|
|
private bool selectionchanged;
|
2009-05-05 09:50:23 +00:00
|
|
|
|
private int lastundogroup;
|
2009-05-02 14:59:05 +00:00
|
|
|
|
private VisualActionResult actionresult;
|
2009-05-03 19:22:32 +00:00
|
|
|
|
private bool undocreated;
|
2009-05-01 20:31:17 +00:00
|
|
|
|
|
2009-05-03 19:22:32 +00:00
|
|
|
|
// List of selected objects when an action is performed
|
|
|
|
|
private List<IVisualEventReceiver> selectedobjects;
|
2012-07-16 09:45:21 +00:00
|
|
|
|
//mxd. Used in Cut/PasteSelection actions
|
|
|
|
|
private List<ThingCopyData> copyBuffer;
|
2013-03-18 13:52:27 +00:00
|
|
|
|
|
|
|
|
|
public static bool GZDoomRenderingEffects { get { return gzdoomRenderingEffects; } } //mxd
|
2012-11-27 21:12:20 +00:00
|
|
|
|
private static bool gzdoomRenderingEffects = true; //mxd
|
2013-03-18 13:52:27 +00:00
|
|
|
|
|
|
|
|
|
//mxd. Moved here from Tools
|
|
|
|
|
private struct SidedefAlignJob
|
|
|
|
|
{
|
|
|
|
|
public Sidedef sidedef;
|
|
|
|
|
public Sidedef controlSide; //mxd
|
|
|
|
|
|
|
|
|
|
public float offsetx;
|
2013-04-03 14:50:41 +00:00
|
|
|
|
public float scaleY; //mxd
|
2013-03-18 13:52:27 +00:00
|
|
|
|
|
|
|
|
|
// When this is true, the previous sidedef was on the left of
|
|
|
|
|
// this one and the texture X offset of this sidedef can be set
|
|
|
|
|
// directly. When this is false, the length of this sidedef
|
|
|
|
|
// must be subtracted from the X offset first.
|
|
|
|
|
public bool forward;
|
|
|
|
|
}
|
2009-05-03 19:22:32 +00:00
|
|
|
|
|
2009-04-19 18:07:22 +00:00
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region ================== Properties
|
|
|
|
|
|
2009-05-17 14:00:36 +00:00
|
|
|
|
public override object HighlightedObject
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
// Geometry picked?
|
|
|
|
|
if(target.picked is VisualGeometry)
|
|
|
|
|
{
|
|
|
|
|
VisualGeometry pickedgeo = (target.picked as VisualGeometry);
|
|
|
|
|
|
|
|
|
|
if(pickedgeo.Sidedef != null)
|
|
|
|
|
return pickedgeo.Sidedef;
|
|
|
|
|
else if(pickedgeo.Sector != null)
|
|
|
|
|
return pickedgeo.Sector;
|
|
|
|
|
else
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
// Thing picked?
|
|
|
|
|
else if(target.picked is VisualThing)
|
|
|
|
|
{
|
|
|
|
|
VisualThing pickedthing = (target.picked as VisualThing);
|
|
|
|
|
return pickedthing.Thing;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2013-05-29 14:18:49 +00:00
|
|
|
|
//mxd
|
|
|
|
|
public object HighlightedTarget { get { return target.picked; } }
|
|
|
|
|
|
2013-03-18 13:52:27 +00:00
|
|
|
|
new public IRenderer3D Renderer { get { return renderer; } }
|
2009-05-02 14:59:05 +00:00
|
|
|
|
|
|
|
|
|
public bool IsSingleSelection { get { return singleselection; } }
|
|
|
|
|
public bool SelectionChanged { get { return selectionchanged; } set { selectionchanged |= value; } }
|
2009-05-01 20:31:17 +00:00
|
|
|
|
|
2009-04-19 18:07:22 +00:00
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region ================== Constructor / Disposer
|
|
|
|
|
|
|
|
|
|
// Constructor
|
|
|
|
|
public BaseVisualMode()
|
|
|
|
|
{
|
|
|
|
|
// Initialize
|
|
|
|
|
this.gravity = new Vector3D(0.0f, 0.0f, 0.0f);
|
2009-07-07 11:29:56 +00:00
|
|
|
|
this.selectedobjects = new List<IVisualEventReceiver>();
|
2012-07-16 09:45:21 +00:00
|
|
|
|
//mxd
|
|
|
|
|
this.copyBuffer = new List<ThingCopyData>();
|
2009-04-19 18:07:22 +00:00
|
|
|
|
|
|
|
|
|
// We have no destructor
|
|
|
|
|
GC.SuppressFinalize(this);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Disposer
|
|
|
|
|
public override void Dispose()
|
|
|
|
|
{
|
|
|
|
|
// Not already disposed?
|
|
|
|
|
if(!isdisposed)
|
|
|
|
|
{
|
|
|
|
|
// Clean up
|
|
|
|
|
|
|
|
|
|
// Done
|
|
|
|
|
base.Dispose();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region ================== Methods
|
2012-11-27 21:12:20 +00:00
|
|
|
|
|
2009-07-12 09:32:53 +00:00
|
|
|
|
// This calculates brightness level
|
2009-07-12 09:58:05 +00:00
|
|
|
|
internal int CalculateBrightness(int level)
|
2009-07-12 09:32:53 +00:00
|
|
|
|
{
|
2009-07-12 09:58:05 +00:00
|
|
|
|
return renderer.CalculateBrightness(level);
|
2009-07-12 09:32:53 +00:00
|
|
|
|
}
|
2012-06-02 20:25:46 +00:00
|
|
|
|
|
|
|
|
|
//mxd. This calculates brightness level with doom-style shading
|
|
|
|
|
internal int CalculateBrightness(int level, Sidedef sd) {
|
|
|
|
|
return renderer.CalculateBrightness(level, sd);
|
|
|
|
|
}
|
2009-07-12 09:32:53 +00:00
|
|
|
|
|
2009-07-07 11:29:56 +00:00
|
|
|
|
// This adds a selected object
|
|
|
|
|
internal void AddSelectedObject(IVisualEventReceiver obj)
|
|
|
|
|
{
|
|
|
|
|
selectedobjects.Add(obj);
|
|
|
|
|
selectionchanged = true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// This removes a selected object
|
|
|
|
|
internal void RemoveSelectedObject(IVisualEventReceiver obj)
|
|
|
|
|
{
|
|
|
|
|
selectedobjects.Remove(obj);
|
|
|
|
|
selectionchanged = true;
|
|
|
|
|
}
|
|
|
|
|
|
2009-05-01 20:31:17 +00:00
|
|
|
|
// This is called before an action is performed
|
2009-05-05 09:50:23 +00:00
|
|
|
|
public void PreAction(int multiselectionundogroup)
|
2009-05-01 20:31:17 +00:00
|
|
|
|
{
|
2009-05-02 14:59:05 +00:00
|
|
|
|
actionresult = new VisualActionResult();
|
2009-05-01 20:31:17 +00:00
|
|
|
|
|
|
|
|
|
PickTargetUnlocked();
|
|
|
|
|
|
|
|
|
|
// If the action is not performed on a selected object, clear the
|
|
|
|
|
// current selection and make a temporary selection for the target.
|
2009-07-07 11:29:56 +00:00
|
|
|
|
if((target.picked != null) && !target.picked.Selected && (BuilderPlug.Me.VisualModeClearSelection || (selectedobjects.Count == 0)))
|
2009-05-01 20:31:17 +00:00
|
|
|
|
{
|
2009-05-02 14:59:05 +00:00
|
|
|
|
// Single object, no selection
|
|
|
|
|
singleselection = true;
|
2009-05-01 20:31:17 +00:00
|
|
|
|
ClearSelection();
|
2009-05-03 19:22:32 +00:00
|
|
|
|
undocreated = false;
|
2009-05-01 20:31:17 +00:00
|
|
|
|
}
|
2009-05-02 14:59:05 +00:00
|
|
|
|
else
|
|
|
|
|
{
|
2009-05-03 19:22:32 +00:00
|
|
|
|
singleselection = false;
|
|
|
|
|
|
2009-05-02 14:59:05 +00:00
|
|
|
|
// Check if we should make a new undo level
|
|
|
|
|
// We don't want to do this if this is the same action with the same
|
|
|
|
|
// selection and the action wants to group the undo levels
|
2009-05-05 09:50:23 +00:00
|
|
|
|
if((lastundogroup != multiselectionundogroup) || (lastundogroup == UndoGroup.None) ||
|
|
|
|
|
(multiselectionundogroup == UndoGroup.None) || selectionchanged)
|
2009-05-03 19:22:32 +00:00
|
|
|
|
{
|
|
|
|
|
// We want to create a new undo level, but not just yet
|
2009-05-05 09:50:23 +00:00
|
|
|
|
lastundogroup = multiselectionundogroup;
|
2009-05-03 19:22:32 +00:00
|
|
|
|
undocreated = false;
|
|
|
|
|
}
|
|
|
|
|
else
|
2009-05-02 14:59:05 +00:00
|
|
|
|
{
|
2009-05-03 19:22:32 +00:00
|
|
|
|
// We don't want to make a new undo level (changes will be combined)
|
|
|
|
|
undocreated = true;
|
2009-05-02 14:59:05 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2009-05-03 19:22:32 +00:00
|
|
|
|
}
|
|
|
|
|
|
2009-07-07 11:29:56 +00:00
|
|
|
|
// Called before an action is performed. This does not make an undo level
|
2009-05-03 19:22:32 +00:00
|
|
|
|
private void PreActionNoChange()
|
|
|
|
|
{
|
|
|
|
|
actionresult = new VisualActionResult();
|
|
|
|
|
singleselection = false;
|
|
|
|
|
undocreated = false;
|
2009-05-01 20:31:17 +00:00
|
|
|
|
}
|
2009-05-02 14:59:05 +00:00
|
|
|
|
|
2009-05-01 20:31:17 +00:00
|
|
|
|
// This is called after an action is performed
|
2009-05-02 14:59:05 +00:00
|
|
|
|
private void PostAction()
|
2009-05-01 20:31:17 +00:00
|
|
|
|
{
|
2009-05-02 14:59:05 +00:00
|
|
|
|
if(!string.IsNullOrEmpty(actionresult.displaystatus))
|
|
|
|
|
General.Interface.DisplayStatus(StatusType.Action, actionresult.displaystatus);
|
2009-05-04 06:13:56 +00:00
|
|
|
|
|
|
|
|
|
// Reset changed flags
|
|
|
|
|
foreach(KeyValuePair<Sector, VisualSector> vs in allsectors)
|
|
|
|
|
{
|
|
|
|
|
BaseVisualSector bvs = (vs.Value as BaseVisualSector);
|
2012-11-27 21:12:20 +00:00
|
|
|
|
foreach(VisualFloor vf in bvs.ExtraFloors) vf.Changed = false;
|
|
|
|
|
foreach(VisualCeiling vc in bvs.ExtraCeilings) vc.Changed = false;
|
2013-03-18 13:52:27 +00:00
|
|
|
|
foreach(VisualFloor vf in bvs.ExtraBackFloors) vf.Changed = false; //mxd
|
|
|
|
|
foreach(VisualCeiling vc in bvs.ExtraBackCeilings) vc.Changed = false; //mxd
|
2009-05-04 06:13:56 +00:00
|
|
|
|
bvs.Floor.Changed = false;
|
|
|
|
|
bvs.Ceiling.Changed = false;
|
|
|
|
|
}
|
2009-05-05 11:26:50 +00:00
|
|
|
|
|
2009-05-02 14:59:05 +00:00
|
|
|
|
selectionchanged = false;
|
|
|
|
|
|
2009-05-03 19:22:32 +00:00
|
|
|
|
if(singleselection)
|
|
|
|
|
ClearSelection();
|
|
|
|
|
|
2009-05-01 20:31:17 +00:00
|
|
|
|
UpdateChangedObjects();
|
|
|
|
|
ShowTargetInfo();
|
|
|
|
|
}
|
2009-05-02 14:59:05 +00:00
|
|
|
|
|
|
|
|
|
// This sets the result for an action
|
|
|
|
|
public void SetActionResult(VisualActionResult result)
|
|
|
|
|
{
|
|
|
|
|
actionresult = result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// This sets the result for an action
|
|
|
|
|
public void SetActionResult(string displaystatus)
|
|
|
|
|
{
|
|
|
|
|
actionresult = new VisualActionResult();
|
|
|
|
|
actionresult.displaystatus = displaystatus;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// This creates an undo, when only a single selection is made
|
|
|
|
|
// When a multi-selection is made, the undo is created by the PreAction function
|
2009-05-05 09:50:23 +00:00
|
|
|
|
public int CreateUndo(string description, int group, int grouptag)
|
2009-05-02 14:59:05 +00:00
|
|
|
|
{
|
2009-05-03 19:22:32 +00:00
|
|
|
|
if(!undocreated)
|
|
|
|
|
{
|
|
|
|
|
undocreated = true;
|
|
|
|
|
|
|
|
|
|
if(singleselection)
|
2009-05-05 09:50:23 +00:00
|
|
|
|
return General.Map.UndoRedo.CreateUndo(description, this, group, grouptag);
|
2009-05-03 19:22:32 +00:00
|
|
|
|
else
|
2009-05-05 09:50:23 +00:00
|
|
|
|
return General.Map.UndoRedo.CreateUndo(description, this, UndoGroup.None, 0);
|
2009-05-03 19:22:32 +00:00
|
|
|
|
}
|
2009-05-02 14:59:05 +00:00
|
|
|
|
else
|
2009-05-03 19:22:32 +00:00
|
|
|
|
{
|
2009-05-02 14:59:05 +00:00
|
|
|
|
return 0;
|
2009-05-03 19:22:32 +00:00
|
|
|
|
}
|
2009-05-02 14:59:05 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// This creates an undo, when only a single selection is made
|
|
|
|
|
// When a multi-selection is made, the undo is created by the PreAction function
|
2009-05-03 19:22:32 +00:00
|
|
|
|
public int CreateUndo(string description)
|
2009-05-02 14:59:05 +00:00
|
|
|
|
{
|
2009-05-03 19:22:32 +00:00
|
|
|
|
return CreateUndo(description, UndoGroup.None, 0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// This makes a list of the selected object
|
2009-07-07 11:29:56 +00:00
|
|
|
|
private void RebuildSelectedObjectsList()
|
2009-05-03 19:22:32 +00:00
|
|
|
|
{
|
|
|
|
|
// Make list of selected objects
|
|
|
|
|
selectedobjects = new List<IVisualEventReceiver>();
|
|
|
|
|
foreach(KeyValuePair<Sector, VisualSector> vs in allsectors)
|
|
|
|
|
{
|
2011-12-02 23:11:16 +00:00
|
|
|
|
if(vs.Value != null)
|
2009-05-03 19:22:32 +00:00
|
|
|
|
{
|
2011-12-02 23:11:16 +00:00
|
|
|
|
BaseVisualSector bvs = (BaseVisualSector)vs.Value;
|
|
|
|
|
if((bvs.Floor != null) && bvs.Floor.Selected) selectedobjects.Add(bvs.Floor);
|
|
|
|
|
if((bvs.Ceiling != null) && bvs.Ceiling.Selected) selectedobjects.Add(bvs.Ceiling);
|
|
|
|
|
foreach(Sidedef sd in vs.Key.Sidedefs)
|
2009-05-03 19:22:32 +00:00
|
|
|
|
{
|
2011-12-02 23:11:16 +00:00
|
|
|
|
List<VisualGeometry> sidedefgeos = bvs.GetSidedefGeometry(sd);
|
|
|
|
|
foreach(VisualGeometry sdg in sidedefgeos)
|
|
|
|
|
{
|
|
|
|
|
if(sdg.Selected) selectedobjects.Add((sdg as IVisualEventReceiver));
|
|
|
|
|
}
|
2009-05-03 19:22:32 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
foreach(KeyValuePair<Thing, VisualThing> vt in allthings)
|
|
|
|
|
{
|
2011-12-02 23:11:16 +00:00
|
|
|
|
if(vt.Value != null)
|
|
|
|
|
{
|
|
|
|
|
BaseVisualThing bvt = (BaseVisualThing)vt.Value;
|
|
|
|
|
if(bvt.Selected) selectedobjects.Add(bvt);
|
|
|
|
|
}
|
2009-05-03 19:22:32 +00:00
|
|
|
|
}
|
2013-03-18 13:52:27 +00:00
|
|
|
|
|
|
|
|
|
//mxd
|
|
|
|
|
if(General.Map.UDMF && General.Settings.GZShowVisualVertices) {
|
|
|
|
|
foreach(KeyValuePair<Vertex, VisualVertexPair> pair in vertices) {
|
|
|
|
|
if(pair.Value.Vertex1.Selected)
|
|
|
|
|
selectedobjects.Add((BaseVisualVertex)pair.Value.Vertex1);
|
|
|
|
|
if(pair.Value.Vertex2.Selected)
|
|
|
|
|
selectedobjects.Add((BaseVisualVertex)pair.Value.Vertex2);
|
|
|
|
|
}
|
|
|
|
|
}
|
2009-05-02 14:59:05 +00:00
|
|
|
|
}
|
2009-05-01 20:31:17 +00:00
|
|
|
|
|
2012-11-27 21:12:20 +00:00
|
|
|
|
//mxd. Need this to apply changes to 3d-floor even if control sector doesn't exist as BaseVisualSector
|
|
|
|
|
internal BaseVisualSector CreateBaseVisualSector(Sector s) {
|
|
|
|
|
BaseVisualSector vs = new BaseVisualSector(this, s);
|
|
|
|
|
if(vs != null) allsectors.Add(s, vs);
|
|
|
|
|
return vs;
|
|
|
|
|
}
|
|
|
|
|
|
2009-04-19 18:07:22 +00:00
|
|
|
|
// This creates a visual sector
|
|
|
|
|
protected override VisualSector CreateVisualSector(Sector s)
|
|
|
|
|
{
|
|
|
|
|
BaseVisualSector vs = new BaseVisualSector(this, s);
|
2013-07-29 12:01:06 +00:00
|
|
|
|
if (vs != null) allsectors.Add(s, vs); //mxd
|
2009-04-19 18:07:22 +00:00
|
|
|
|
return vs;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// This creates a visual thing
|
|
|
|
|
protected override VisualThing CreateVisualThing(Thing t)
|
|
|
|
|
{
|
|
|
|
|
BaseVisualThing vt = new BaseVisualThing(this, t);
|
2009-05-01 20:31:17 +00:00
|
|
|
|
return vt.Setup() ? vt : null;
|
2009-04-19 18:07:22 +00:00
|
|
|
|
}
|
2009-05-01 20:31:17 +00:00
|
|
|
|
|
2009-04-19 18:07:22 +00:00
|
|
|
|
// This locks the target so that it isn't changed until unlocked
|
|
|
|
|
public void LockTarget()
|
|
|
|
|
{
|
|
|
|
|
locktarget = true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// This unlocks the target so that is changes to the aimed geometry again
|
|
|
|
|
public void UnlockTarget()
|
|
|
|
|
{
|
|
|
|
|
locktarget = false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// This picks a new target, if not locked
|
|
|
|
|
private void PickTargetUnlocked()
|
|
|
|
|
{
|
|
|
|
|
if(!locktarget) PickTarget();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// This picks a new target
|
|
|
|
|
private void PickTarget()
|
|
|
|
|
{
|
|
|
|
|
// Find the object we are aiming at
|
|
|
|
|
Vector3D start = General.Map.VisualCamera.Position;
|
|
|
|
|
Vector3D delta = General.Map.VisualCamera.Target - General.Map.VisualCamera.Position;
|
|
|
|
|
delta = delta.GetFixedLength(General.Settings.ViewDistance * PICK_RANGE);
|
|
|
|
|
VisualPickResult newtarget = PickObject(start, start + delta);
|
|
|
|
|
|
|
|
|
|
// Should we update the info on panels?
|
|
|
|
|
bool updateinfo = (newtarget.picked != target.picked);
|
|
|
|
|
|
|
|
|
|
// Apply new target
|
|
|
|
|
target = newtarget;
|
|
|
|
|
|
|
|
|
|
// Show target info
|
|
|
|
|
if(updateinfo) ShowTargetInfo();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// This shows the picked target information
|
|
|
|
|
public void ShowTargetInfo()
|
|
|
|
|
{
|
|
|
|
|
// Any result?
|
|
|
|
|
if(target.picked != null)
|
|
|
|
|
{
|
|
|
|
|
// Geometry picked?
|
|
|
|
|
if(target.picked is VisualGeometry)
|
|
|
|
|
{
|
|
|
|
|
VisualGeometry pickedgeo = (target.picked as VisualGeometry);
|
2012-11-27 21:12:20 +00:00
|
|
|
|
|
|
|
|
|
// Sidedef?
|
|
|
|
|
if(pickedgeo is BaseVisualGeometrySidedef)
|
|
|
|
|
{
|
|
|
|
|
BaseVisualGeometrySidedef pickedsidedef = (pickedgeo as BaseVisualGeometrySidedef);
|
2013-03-18 13:52:27 +00:00
|
|
|
|
General.Interface.ShowLinedefInfo(pickedsidedef.GetControlLinedef()); //mxd
|
2012-11-27 21:12:20 +00:00
|
|
|
|
}
|
|
|
|
|
// Sector?
|
|
|
|
|
else if(pickedgeo is BaseVisualGeometrySector)
|
|
|
|
|
{
|
|
|
|
|
BaseVisualGeometrySector pickedsector = (pickedgeo as BaseVisualGeometrySector);
|
|
|
|
|
General.Interface.ShowSectorInfo(pickedsector.Level.sector);
|
|
|
|
|
}
|
2009-04-19 18:07:22 +00:00
|
|
|
|
else
|
2012-11-27 21:12:20 +00:00
|
|
|
|
{
|
2009-04-19 18:07:22 +00:00
|
|
|
|
General.Interface.HideInfo();
|
2012-11-27 21:12:20 +00:00
|
|
|
|
}
|
2013-03-18 13:52:27 +00:00
|
|
|
|
}
|
|
|
|
|
else if(target.picked is VisualThing)
|
|
|
|
|
{ // Thing picked?
|
2009-04-19 18:07:22 +00:00
|
|
|
|
VisualThing pickedthing = (target.picked as VisualThing);
|
|
|
|
|
General.Interface.ShowThingInfo(pickedthing.Thing);
|
2013-03-18 13:52:27 +00:00
|
|
|
|
}
|
|
|
|
|
else if(target.picked is VisualVertex) //mxd
|
|
|
|
|
{
|
|
|
|
|
VisualVertex pickedvert = (target.picked as VisualVertex);
|
|
|
|
|
General.Interface.ShowVertexInfo(pickedvert.Vertex);
|
2009-04-19 18:07:22 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
General.Interface.HideInfo();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2009-05-01 20:31:17 +00:00
|
|
|
|
// This updates the VisualSectors and VisualThings that have their Changed property set
|
2012-11-27 21:12:20 +00:00
|
|
|
|
private void UpdateChangedObjects()
|
2009-05-01 20:31:17 +00:00
|
|
|
|
{
|
|
|
|
|
foreach(KeyValuePair<Sector, VisualSector> vs in allsectors)
|
|
|
|
|
{
|
2011-12-02 23:11:16 +00:00
|
|
|
|
if(vs.Value != null)
|
|
|
|
|
{
|
|
|
|
|
BaseVisualSector bvs = (BaseVisualSector)vs.Value;
|
|
|
|
|
if(bvs.Changed) bvs.Rebuild();
|
|
|
|
|
}
|
2009-05-01 20:31:17 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
foreach(KeyValuePair<Thing, VisualThing> vt in allthings)
|
|
|
|
|
{
|
2011-12-02 23:11:16 +00:00
|
|
|
|
if(vt.Value != null)
|
|
|
|
|
{
|
|
|
|
|
BaseVisualThing bvt = (BaseVisualThing)vt.Value;
|
|
|
|
|
if(bvt.Changed) bvt.Rebuild();
|
|
|
|
|
}
|
2009-05-01 20:31:17 +00:00
|
|
|
|
}
|
2013-03-18 13:52:27 +00:00
|
|
|
|
|
|
|
|
|
//mxd
|
|
|
|
|
if(General.Map.UDMF) {
|
|
|
|
|
foreach(KeyValuePair<Vertex, VisualVertexPair> pair in vertices)
|
|
|
|
|
pair.Value.Update();
|
|
|
|
|
}
|
2009-05-01 20:31:17 +00:00
|
|
|
|
}
|
2012-06-29 14:03:35 +00:00
|
|
|
|
|
|
|
|
|
//mxd
|
2012-06-29 18:58:18 +00:00
|
|
|
|
protected override void moveSelectedThings(Vector2D direction, bool absolutePosition) {
|
2012-07-16 09:45:21 +00:00
|
|
|
|
List<VisualThing> visualThings = GetSelectedVisualThings(true);
|
2013-07-29 12:01:06 +00:00
|
|
|
|
if (visualThings.Count == 0) return;
|
2012-06-29 14:03:35 +00:00
|
|
|
|
|
2012-08-05 19:18:05 +00:00
|
|
|
|
PreAction(UndoGroup.ThingMove);
|
2012-07-16 09:45:21 +00:00
|
|
|
|
|
|
|
|
|
Vector3D[] coords = new Vector3D[visualThings.Count];
|
|
|
|
|
for (int i = 0; i < visualThings.Count; i++)
|
|
|
|
|
coords[i] = visualThings[i].Thing.Position;
|
|
|
|
|
|
|
|
|
|
//move things...
|
|
|
|
|
Vector3D[] translatedCoords = translateCoordinates(coords, direction, absolutePosition);
|
|
|
|
|
for (int i = 0; i < visualThings.Count; i++) {
|
|
|
|
|
BaseVisualThing t = visualThings[i] as BaseVisualThing;
|
|
|
|
|
t.OnMove(translatedCoords[i]);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
PostAction();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//mxd
|
|
|
|
|
private Vector3D[] translateCoordinates(Vector3D[] coordinates, Vector2D direction, bool absolutePosition) {
|
|
|
|
|
if (coordinates.Length == 0) return null;
|
|
|
|
|
|
|
|
|
|
direction.x = (float)Math.Round(direction.x);
|
|
|
|
|
direction.y = (float)Math.Round(direction.y);
|
|
|
|
|
|
|
|
|
|
Vector3D[] translatedCoords = new Vector3D[coordinates.Length];
|
|
|
|
|
|
2012-06-29 18:58:18 +00:00
|
|
|
|
//move things...
|
|
|
|
|
if (!absolutePosition) { //...relatively (that's easy)
|
2013-04-11 09:27:16 +00:00
|
|
|
|
int camAngle = (int)Math.Round(Angle2D.RadToDeg(General.Map.VisualCamera.AngleXY));// * 180 / Math.PI);
|
2013-04-09 10:56:05 +00:00
|
|
|
|
int sector = General.ClampAngle(camAngle - 45) / 90;
|
2013-04-11 09:27:16 +00:00
|
|
|
|
direction = direction.GetRotated(sector * Angle2D.PIHALF);
|
2012-06-29 18:58:18 +00:00
|
|
|
|
|
2012-07-16 09:45:21 +00:00
|
|
|
|
for (int i = 0; i < coordinates.Length; i++)
|
|
|
|
|
translatedCoords[i] = coordinates[i] + new Vector3D(direction);
|
2012-06-29 18:58:18 +00:00
|
|
|
|
|
2012-07-16 09:45:21 +00:00
|
|
|
|
return translatedCoords;
|
|
|
|
|
}
|
2012-06-29 18:58:18 +00:00
|
|
|
|
|
2012-07-16 09:45:21 +00:00
|
|
|
|
//...to specified location preserving relative positioning (that's harder)
|
|
|
|
|
if (coordinates.Length == 1) {//just move it there
|
|
|
|
|
translatedCoords[0] = new Vector3D(direction.x, direction.y, coordinates[0].z);
|
|
|
|
|
return translatedCoords;
|
|
|
|
|
}
|
2012-06-29 18:58:18 +00:00
|
|
|
|
|
2012-07-16 09:45:21 +00:00
|
|
|
|
//we need some reference
|
|
|
|
|
float minX = coordinates[0].x;
|
|
|
|
|
float maxX = minX;
|
|
|
|
|
float minY = coordinates[0].y;
|
|
|
|
|
float maxY = minY;
|
|
|
|
|
|
|
|
|
|
//get bounding coordinates for selected things
|
|
|
|
|
for (int i = 1; i < coordinates.Length; i++) {
|
|
|
|
|
if (coordinates[i].x < minX)
|
|
|
|
|
minX = coordinates[i].x;
|
|
|
|
|
else if (coordinates[i].x > maxX)
|
|
|
|
|
maxX = coordinates[i].x;
|
|
|
|
|
|
|
|
|
|
if (coordinates[i].y < minY)
|
|
|
|
|
minY = coordinates[i].y;
|
|
|
|
|
else if (coordinates[i].y > maxY)
|
|
|
|
|
maxY = coordinates[i].y;
|
2012-06-29 14:03:35 +00:00
|
|
|
|
}
|
2012-07-16 09:45:21 +00:00
|
|
|
|
|
|
|
|
|
Vector2D selectionCenter = new Vector2D(minX + (maxX - minX) / 2, minY + (maxY - minY) / 2);
|
|
|
|
|
|
|
|
|
|
//move them
|
|
|
|
|
for (int i = 0; i < coordinates.Length; i++)
|
|
|
|
|
translatedCoords[i] = new Vector3D((float)Math.Round(direction.x - (selectionCenter.x - coordinates[i].x)), (float)Math.Round(direction.y - (selectionCenter.y - coordinates[i].y)), (float)Math.Round(coordinates[i].z));
|
|
|
|
|
|
|
|
|
|
return translatedCoords;
|
2012-06-29 14:03:35 +00:00
|
|
|
|
}
|
2013-04-01 11:06:01 +00:00
|
|
|
|
|
|
|
|
|
//mxd
|
|
|
|
|
internal void SelectSideParts(Sidedef side, bool toggleTop, bool toggleMid, bool toggleBottom, bool select, bool withSameTexture, bool withSameHeight) {
|
|
|
|
|
BaseVisualSector vs = GetVisualSector(side.Sector) as BaseVisualSector;
|
|
|
|
|
|
|
|
|
|
if(toggleTop && vs.Sides[side].upper != null &&
|
|
|
|
|
((select && !vs.Sides[side].upper.Selected) || (!select && vs.Sides[side].upper.Selected))) {
|
|
|
|
|
vs.Sides[side].upper.SelectNeighbours(select, withSameTexture, withSameHeight);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(toggleMid && vs.Sides[side].middlesingle != null &&
|
|
|
|
|
((select && !vs.Sides[side].middlesingle.Selected) || (!select && vs.Sides[side].middlesingle.Selected))) {
|
|
|
|
|
vs.Sides[side].middlesingle.SelectNeighbours(select, withSameTexture, withSameHeight);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(toggleMid && vs.Sides[side].middledouble != null &&
|
|
|
|
|
((select && !vs.Sides[side].middledouble.Selected) || (!select && vs.Sides[side].middledouble.Selected))) {
|
|
|
|
|
vs.Sides[side].middledouble.SelectNeighbours(select, withSameTexture, withSameHeight);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(toggleBottom && vs.Sides[side].lower != null &&
|
|
|
|
|
((select && !vs.Sides[side].lower.Selected) || (!select && vs.Sides[side].lower.Selected))) {
|
|
|
|
|
vs.Sides[side].lower.SelectNeighbours(select, withSameTexture, withSameHeight);
|
|
|
|
|
}
|
|
|
|
|
}
|
2013-07-09 11:29:10 +00:00
|
|
|
|
|
|
|
|
|
//mxd
|
|
|
|
|
private void updateSelectionInfo() {
|
|
|
|
|
int numWalls = 0;
|
|
|
|
|
int numFloors = 0;
|
|
|
|
|
int numCeilings = 0;
|
|
|
|
|
int numThings = 0;
|
|
|
|
|
int numVerts = 0;
|
|
|
|
|
|
|
|
|
|
foreach(IVisualEventReceiver obj in selectedobjects) {
|
|
|
|
|
if(!obj.IsSelected()) continue;
|
|
|
|
|
|
|
|
|
|
if(obj is BaseVisualThing) numThings++;
|
|
|
|
|
else if(obj is BaseVisualVertex) numVerts++;
|
|
|
|
|
else if(obj is VisualCeiling) numCeilings++;
|
|
|
|
|
else if(obj is VisualFloor) numFloors++;
|
|
|
|
|
else if(obj is VisualMiddleSingle || obj is VisualMiddleDouble || obj is VisualLower || obj is VisualUpper || obj is VisualMiddle3D || obj is VisualMiddleBack)
|
|
|
|
|
numWalls++;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
string result = "";
|
|
|
|
|
|
|
|
|
|
if(numWalls > 0) result = numWalls + (numWalls > 1 ? " sidedefs" : " sidedef");
|
|
|
|
|
if(numFloors > 0) result += (result.Length > 0 ? ", " : "") + numFloors + (numFloors > 1 ? " floors" : " floor");
|
|
|
|
|
if(numCeilings > 0) result += (result.Length > 0 ? ", " : "") + numCeilings + (numCeilings > 1 ? " ceilings" : " ceiling");
|
|
|
|
|
if(numThings > 0) result += (result.Length > 0 ? ", " : "") + numThings + (numThings > 1 ? " things" : " thing");
|
|
|
|
|
if(numVerts > 0) result += (result.Length > 0 ? ", " : "") + numVerts + (numVerts > 1 ? " vertices" : " vertex");
|
|
|
|
|
|
|
|
|
|
if(!string.IsNullOrEmpty(result)) {
|
|
|
|
|
int pos = result.LastIndexOf(",");
|
|
|
|
|
if(pos != -1) result = result.Remove(pos, 1).Insert(pos, " and");
|
|
|
|
|
result += " selected";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
General.Interface.DisplayStatus(StatusType.Selection, result);
|
|
|
|
|
}
|
2013-07-19 15:30:58 +00:00
|
|
|
|
|
|
|
|
|
//mxd
|
|
|
|
|
internal void StartRealtimeInterfaceUpdate(SelectionType selectionType) {
|
|
|
|
|
if(selectionType == SelectionType.Sectors || selectionType == SelectionType.Linedefs || selectionType == SelectionType.All) {
|
|
|
|
|
General.Interface.OnEditFormValuesChanged += new EventHandler(Interface_OnSectorEditFormValuesChanged);
|
|
|
|
|
} else {
|
|
|
|
|
General.Interface.OnEditFormValuesChanged += new EventHandler(Interface_OnEditFormValuesChanged);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//mxd
|
|
|
|
|
internal void StopRealtimeInterfaceUpdate(SelectionType selectionType) {
|
|
|
|
|
if(selectionType == SelectionType.Sectors || selectionType == SelectionType.Linedefs || selectionType == SelectionType.All) {
|
|
|
|
|
General.Interface.OnEditFormValuesChanged -= Interface_OnSectorEditFormValuesChanged;
|
|
|
|
|
} else {
|
|
|
|
|
General.Interface.OnEditFormValuesChanged -= Interface_OnEditFormValuesChanged;
|
|
|
|
|
}
|
|
|
|
|
}
|
2009-05-01 20:31:17 +00:00
|
|
|
|
|
2009-04-19 18:07:22 +00:00
|
|
|
|
#endregion
|
2012-11-27 21:12:20 +00:00
|
|
|
|
|
|
|
|
|
#region ================== Extended Methods
|
|
|
|
|
|
|
|
|
|
// This requests a sector's extra data
|
|
|
|
|
internal SectorData GetSectorData(Sector s)
|
|
|
|
|
{
|
|
|
|
|
// Make fresh sector data when it doesn't exist yet
|
|
|
|
|
if(!sectordata.ContainsKey(s))
|
|
|
|
|
sectordata[s] = new SectorData(this, s);
|
|
|
|
|
|
|
|
|
|
return sectordata[s];
|
|
|
|
|
}
|
2009-04-19 18:07:22 +00:00
|
|
|
|
|
2012-11-27 21:12:20 +00:00
|
|
|
|
// This requests a things's extra data
|
|
|
|
|
internal ThingData GetThingData(Thing t)
|
|
|
|
|
{
|
|
|
|
|
// Make fresh sector data when it doesn't exist yet
|
|
|
|
|
if(!thingdata.ContainsKey(t))
|
|
|
|
|
thingdata[t] = new ThingData(this, t);
|
|
|
|
|
|
|
|
|
|
return thingdata[t];
|
|
|
|
|
}
|
2013-03-18 13:52:27 +00:00
|
|
|
|
|
|
|
|
|
//mxd
|
|
|
|
|
internal VertexData GetVertexData(Vertex v) {
|
|
|
|
|
if(!vertexdata.ContainsKey(v))
|
|
|
|
|
vertexdata[v] = new VertexData(this, v);
|
|
|
|
|
return vertexdata[v];
|
|
|
|
|
}
|
|
|
|
|
|
2013-07-31 12:38:47 +00:00
|
|
|
|
//mxd
|
|
|
|
|
/*internal EffectDynamicLight GetDynamicLightData(Thing t) {
|
|
|
|
|
if(!lightdata.ContainsKey(t))
|
|
|
|
|
lightdata[t] = new EffectDynamicLight(this, t);
|
|
|
|
|
return lightdata[t];
|
|
|
|
|
}*/
|
|
|
|
|
|
2013-03-18 13:52:27 +00:00
|
|
|
|
//mxd
|
|
|
|
|
internal void UpdateVertexHandle(Vertex v) {
|
|
|
|
|
if(!vertices.ContainsKey(v))
|
|
|
|
|
vertices.Add(v, new VisualVertexPair(new BaseVisualVertex(this, v, true), new BaseVisualVertex(this, v, false)));
|
|
|
|
|
else
|
2013-03-22 12:53:34 +00:00
|
|
|
|
vertices[v].Changed = true;
|
2013-03-18 13:52:27 +00:00
|
|
|
|
}
|
2009-04-19 18:07:22 +00:00
|
|
|
|
|
2012-11-27 21:12:20 +00:00
|
|
|
|
// This rebuilds the sector data
|
|
|
|
|
// This requires that the blockmap is up-to-date!
|
|
|
|
|
internal void RebuildElementData()
|
|
|
|
|
{
|
2013-03-18 13:52:27 +00:00
|
|
|
|
//mxd
|
|
|
|
|
if (!gzdoomRenderingEffects) {
|
|
|
|
|
if(sectordata != null && sectordata.Count > 0) {
|
|
|
|
|
//rebuild sectors with effects
|
|
|
|
|
foreach(KeyValuePair<Sector, SectorData> group in sectordata)
|
|
|
|
|
group.Value.Reset();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//remove all vertex handles from selection
|
|
|
|
|
if(vertices != null && vertices.Count > 0) {
|
|
|
|
|
foreach(IVisualEventReceiver i in selectedobjects){
|
|
|
|
|
if(i is BaseVisualVertex) RemoveSelectedObject(i);
|
|
|
|
|
}
|
|
|
|
|
}
|
2012-11-27 21:12:20 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Dictionary<int, List<Sector>> sectortags = new Dictionary<int, List<Sector>>();
|
|
|
|
|
sectordata = new Dictionary<Sector, SectorData>(General.Map.Map.Sectors.Count);
|
|
|
|
|
thingdata = new Dictionary<Thing, ThingData>(General.Map.Map.Things.Count);
|
2013-07-31 12:38:47 +00:00
|
|
|
|
//lightdata = new Dictionary<Thing, EffectDynamicLight>(General.Map.Map.Things.Count); //mxd
|
2012-11-27 21:12:20 +00:00
|
|
|
|
|
2013-03-18 13:52:27 +00:00
|
|
|
|
if(General.Map.UDMF) {
|
|
|
|
|
vertexdata = new Dictionary<Vertex, VertexData>(General.Map.Map.Vertices.Count); //mxd
|
|
|
|
|
vertices.Clear();
|
|
|
|
|
}
|
|
|
|
|
|
2012-11-27 21:12:20 +00:00
|
|
|
|
if (!gzdoomRenderingEffects) return; //mxd
|
|
|
|
|
|
|
|
|
|
// Find all sector who's tag is not 0 and hash them so that we can find them quicly
|
|
|
|
|
foreach(Sector s in General.Map.Map.Sectors)
|
|
|
|
|
{
|
|
|
|
|
if(s.Tag != 0)
|
|
|
|
|
{
|
|
|
|
|
if(!sectortags.ContainsKey(s.Tag)) sectortags[s.Tag] = new List<Sector>();
|
|
|
|
|
sectortags[s.Tag].Add(s);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Find sectors with 3 vertices, because they can be sloped
|
|
|
|
|
foreach(Sector s in General.Map.Map.Sectors)
|
|
|
|
|
{
|
2013-03-18 13:52:27 +00:00
|
|
|
|
// ========== Thing vertex slope, vertices with UDMF vertex offsets ==========
|
2012-11-27 21:12:20 +00:00
|
|
|
|
if(s.Sidedefs.Count == 3)
|
|
|
|
|
{
|
2013-03-18 13:52:27 +00:00
|
|
|
|
if(General.Map.UDMF) //mxd
|
|
|
|
|
GetSectorData(s).AddEffectVertexOffset();
|
|
|
|
|
|
|
|
|
|
List<Thing> slopeceilingthings = new List<Thing>(3);
|
|
|
|
|
List<Thing> slopefloorthings = new List<Thing>(3);
|
|
|
|
|
foreach(Sidedef sd in s.Sidedefs) {
|
|
|
|
|
Vertex v = sd.IsFront ? sd.Line.End : 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);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 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);
|
|
|
|
|
}
|
2012-11-27 21:12:20 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Find interesting linedefs (such as line slopes)
|
|
|
|
|
foreach(Linedef l in General.Map.Map.Linedefs)
|
|
|
|
|
{
|
|
|
|
|
// ========== Plane Align (see http://zdoom.org/wiki/Plane_Align) ==========
|
|
|
|
|
if(l.Action == 181)
|
|
|
|
|
{
|
|
|
|
|
// Slope front
|
|
|
|
|
if(((l.Args[0] == 1) || (l.Args[1] == 1)) && (l.Front != null))
|
|
|
|
|
{
|
|
|
|
|
SectorData sd = GetSectorData(l.Front.Sector);
|
|
|
|
|
sd.AddEffectLineSlope(l);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Slope back
|
|
|
|
|
if(((l.Args[0] == 2) || (l.Args[1] == 2)) && (l.Back != null))
|
|
|
|
|
{
|
|
|
|
|
SectorData sd = GetSectorData(l.Back.Sector);
|
|
|
|
|
sd.AddEffectLineSlope(l);
|
|
|
|
|
}
|
|
|
|
|
}
|
2013-04-16 12:52:40 +00:00
|
|
|
|
// ========== Plane Copy (mxd) (see http://zdoom.org/wiki/Plane_Copy) ==========
|
|
|
|
|
else if(l.Action == 118)
|
|
|
|
|
{
|
|
|
|
|
//check sodding flags...
|
|
|
|
|
bool floorCopyToBack = false;
|
|
|
|
|
bool floorCopyToFront = false;
|
|
|
|
|
bool ceilingCopyToBack = false;
|
|
|
|
|
bool ceilingCopyToFront = false;
|
|
|
|
|
|
|
|
|
|
if(l.Args[4] > 0 && l.Args[4] != 3 && l.Args[4] != 12) {
|
|
|
|
|
floorCopyToBack = (l.Args[4] & 1) == 1;
|
|
|
|
|
floorCopyToFront = (l.Args[4] & 2) == 2;
|
|
|
|
|
ceilingCopyToBack = (l.Args[4] & 4) == 4;
|
|
|
|
|
ceilingCopyToFront = (l.Args[4] & 8) == 8;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Copy slope to front sector
|
|
|
|
|
//Flags: Back floor to front sector or Back ceiling to front sector
|
|
|
|
|
if(l.Front != null) {
|
|
|
|
|
if((l.Args[0] > 0 || l.Args[1] > 0) || (floorCopyToFront && l.Args[2] > 0) || (ceilingCopyToFront && l.Args[3] > 0)) {
|
|
|
|
|
SectorData sd = GetSectorData(l.Front.Sector);
|
|
|
|
|
sd.AddEffectPlaneClopySlope(l, true);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Copy slope to back sector
|
|
|
|
|
//Flags: Copy front floor to back sector or Front ceiling to back sector
|
|
|
|
|
if(l.Back != null) {
|
|
|
|
|
if((l.Args[2] > 0 || l.Args[3] > 0) || (floorCopyToBack && l.Args[0] > 0) || (ceilingCopyToBack && l.Args[1] > 0)) {
|
|
|
|
|
SectorData sd = GetSectorData(l.Back.Sector);
|
|
|
|
|
sd.AddEffectPlaneClopySlope(l, false);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2012-11-27 21:12:20 +00:00
|
|
|
|
// ========== Sector 3D floor (see http://zdoom.org/wiki/Sector_Set3dFloor) ==========
|
|
|
|
|
else if((l.Action == 160) && (l.Front != null))
|
|
|
|
|
{
|
2013-05-20 10:43:34 +00:00
|
|
|
|
//mxd. Added hi-tag/line ID check
|
|
|
|
|
int sectortag = (l.Args[1] & (int)Effect3DFloor.FloorTypes.HiTagIsLineID) != 0 ? l.Args[0] : l.Args[0] + (l.Args[4] << 8);
|
2012-11-27 21:12:20 +00:00
|
|
|
|
if(sectortags.ContainsKey(sectortag))
|
|
|
|
|
{
|
|
|
|
|
List<Sector> sectors = sectortags[sectortag];
|
|
|
|
|
foreach(Sector s in sectors)
|
|
|
|
|
{
|
|
|
|
|
SectorData sd = GetSectorData(s);
|
|
|
|
|
sd.AddEffect3DFloor(l);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// ========== Transfer Brightness (see http://zdoom.org/wiki/ExtraFloor_LightOnly) =========
|
|
|
|
|
else if((l.Action == 50) && (l.Front != null))
|
|
|
|
|
{
|
|
|
|
|
if(sectortags.ContainsKey(l.Args[0]))
|
|
|
|
|
{
|
|
|
|
|
List<Sector> sectors = sectortags[l.Args[0]];
|
|
|
|
|
foreach(Sector s in sectors)
|
|
|
|
|
{
|
|
|
|
|
SectorData sd = GetSectorData(s);
|
|
|
|
|
sd.AddEffectBrightnessLevel(l);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Find interesting things (such as sector slopes)
|
|
|
|
|
foreach(Thing t in General.Map.Map.Things)
|
|
|
|
|
{
|
|
|
|
|
// ========== Copy slope ==========
|
|
|
|
|
if((t.Type == 9510) || (t.Type == 9511))
|
|
|
|
|
{
|
|
|
|
|
t.DetermineSector(blockmap);
|
|
|
|
|
if(t.Sector != null)
|
|
|
|
|
{
|
|
|
|
|
SectorData sd = GetSectorData(t.Sector);
|
|
|
|
|
sd.AddEffectCopySlope(t);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// ========== Thing line slope ==========
|
|
|
|
|
else if((t.Type == 9500) || (t.Type == 9501))
|
|
|
|
|
{
|
|
|
|
|
t.DetermineSector(blockmap);
|
|
|
|
|
if(t.Sector != null)
|
|
|
|
|
{
|
|
|
|
|
SectorData sd = GetSectorData(t.Sector);
|
|
|
|
|
sd.AddEffectThingLineSlope(t);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region ================== Events
|
|
|
|
|
|
2009-04-26 21:21:55 +00:00
|
|
|
|
// Help!
|
|
|
|
|
public override void OnHelp()
|
|
|
|
|
{
|
|
|
|
|
General.ShowHelp("e_visual.html");
|
|
|
|
|
}
|
2009-06-17 21:56:07 +00:00
|
|
|
|
|
2010-01-02 20:22:05 +00:00
|
|
|
|
// When entering this mode
|
|
|
|
|
public override void OnEngage()
|
|
|
|
|
{
|
|
|
|
|
base.OnEngage();
|
2013-03-18 13:52:27 +00:00
|
|
|
|
|
|
|
|
|
//mxd
|
|
|
|
|
useSelectionFromClassicMode = BuilderPlug.Me.SyncSelection ? !General.Interface.ShiftState : General.Interface.ShiftState;
|
2013-07-09 11:29:10 +00:00
|
|
|
|
if(useSelectionFromClassicMode) updateSelectionInfo();
|
|
|
|
|
|
2010-01-02 20:22:05 +00:00
|
|
|
|
// Read settings
|
|
|
|
|
cameraflooroffset = General.Map.Config.ReadSetting("cameraflooroffset", cameraflooroffset);
|
|
|
|
|
cameraceilingoffset = General.Map.Config.ReadSetting("cameraceilingoffset", cameraceilingoffset);
|
2012-11-27 21:12:20 +00:00
|
|
|
|
|
|
|
|
|
RebuildElementData();
|
2010-01-02 20:22:05 +00:00
|
|
|
|
}
|
|
|
|
|
|
2009-06-17 21:56:07 +00:00
|
|
|
|
// When returning to another mode
|
|
|
|
|
public override void OnDisengage()
|
|
|
|
|
{
|
|
|
|
|
base.OnDisengage();
|
2013-03-18 13:52:27 +00:00
|
|
|
|
|
|
|
|
|
//mxd
|
|
|
|
|
if(BuilderPlug.Me.SyncSelection ? !General.Interface.ShiftState : General.Interface.ShiftState) {
|
|
|
|
|
//clear previously selected stuff
|
|
|
|
|
General.Map.Map.ClearAllSelected();
|
|
|
|
|
|
|
|
|
|
//refill selection
|
|
|
|
|
List<Sector> selectedSectors = new List<Sector>();
|
|
|
|
|
List<Linedef> selectedLines = new List<Linedef>();
|
|
|
|
|
List<Vertex> selectedVertices = new List<Vertex>();
|
|
|
|
|
|
|
|
|
|
foreach(IVisualEventReceiver obj in selectedobjects) {
|
|
|
|
|
if(obj is BaseVisualThing) {
|
|
|
|
|
((BaseVisualThing)obj).Thing.Selected = true;
|
|
|
|
|
} else if(obj is VisualFloor || obj is VisualCeiling) {
|
|
|
|
|
VisualGeometry vg = (VisualGeometry)obj;
|
|
|
|
|
|
|
|
|
|
if(vg.Sector != null && vg.Sector.Sector != null && !selectedSectors.Contains(vg.Sector.Sector)) {
|
|
|
|
|
selectedSectors.Add(vg.Sector.Sector);
|
|
|
|
|
|
|
|
|
|
foreach(Sidedef s in vg.Sector.Sector.Sidedefs){
|
|
|
|
|
if(!selectedLines.Contains(s.Line))
|
|
|
|
|
selectedLines.Add(s.Line);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} else if(obj is VisualLower || obj is VisualUpper || obj is VisualMiddleDouble || obj is VisualMiddleSingle || obj is VisualMiddle3D) {
|
|
|
|
|
VisualGeometry vg = (VisualGeometry)obj;
|
|
|
|
|
|
|
|
|
|
if(vg.Sidedef != null && !selectedLines.Contains(vg.Sidedef.Line))
|
|
|
|
|
selectedLines.Add(vg.Sidedef.Line);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
foreach(Sector s in selectedSectors)
|
|
|
|
|
s.Selected = true;
|
|
|
|
|
|
|
|
|
|
foreach(Linedef l in selectedLines) {
|
|
|
|
|
l.Selected = true;
|
|
|
|
|
|
|
|
|
|
if(!selectedVertices.Contains(l.Start))
|
|
|
|
|
selectedVertices.Add(l.Start);
|
|
|
|
|
if(!selectedVertices.Contains(l.End))
|
|
|
|
|
selectedVertices.Add(l.End);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
foreach(Vertex v in selectedVertices)
|
|
|
|
|
v.Selected = true;
|
|
|
|
|
}
|
|
|
|
|
|
2012-07-16 09:45:21 +00:00
|
|
|
|
copyBuffer.Clear(); //mxd
|
2009-06-17 21:56:07 +00:00
|
|
|
|
General.Map.Map.Update();
|
|
|
|
|
}
|
2009-04-26 21:21:55 +00:00
|
|
|
|
|
2009-04-19 18:07:22 +00:00
|
|
|
|
// Processing
|
2012-07-12 22:34:12 +00:00
|
|
|
|
public override void OnProcess(float deltatime)
|
2009-04-19 18:07:22 +00:00
|
|
|
|
{
|
|
|
|
|
// Process things?
|
|
|
|
|
base.ProcessThings = (BuilderPlug.Me.ShowVisualThings != 0);
|
|
|
|
|
|
|
|
|
|
// Setup the move multiplier depending on gravity
|
|
|
|
|
Vector3D movemultiplier = new Vector3D(1.0f, 1.0f, 1.0f);
|
|
|
|
|
if(BuilderPlug.Me.UseGravity) movemultiplier.z = 0.0f;
|
|
|
|
|
General.Map.VisualCamera.MoveMultiplier = movemultiplier;
|
|
|
|
|
|
|
|
|
|
// Apply gravity?
|
|
|
|
|
if(BuilderPlug.Me.UseGravity && (General.Map.VisualCamera.Sector != null))
|
|
|
|
|
{
|
2012-11-27 21:12:20 +00:00
|
|
|
|
SectorData sd = GetSectorData(General.Map.VisualCamera.Sector);
|
|
|
|
|
if(!sd.Updated) sd.Update();
|
|
|
|
|
|
2009-04-19 18:07:22 +00:00
|
|
|
|
// Camera below floor level?
|
2012-11-27 21:12:20 +00:00
|
|
|
|
Vector3D feetposition = General.Map.VisualCamera.Position;
|
|
|
|
|
SectorLevel floorlevel = sd.GetFloorBelow(feetposition) ?? sd.LightLevels[0];
|
|
|
|
|
float floorheight = floorlevel.plane.GetZ(General.Map.VisualCamera.Position);
|
|
|
|
|
if(General.Map.VisualCamera.Position.z < (floorheight + cameraflooroffset + 0.1f))
|
2009-04-19 18:07:22 +00:00
|
|
|
|
{
|
|
|
|
|
// Stay above floor
|
|
|
|
|
gravity = new Vector3D(0.0f, 0.0f, 0.0f);
|
|
|
|
|
General.Map.VisualCamera.Position = new Vector3D(General.Map.VisualCamera.Position.x,
|
|
|
|
|
General.Map.VisualCamera.Position.y,
|
2012-11-27 21:12:20 +00:00
|
|
|
|
floorheight + cameraflooroffset);
|
2009-04-19 18:07:22 +00:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
// Fall down
|
2012-11-27 21:12:20 +00:00
|
|
|
|
gravity.z += GRAVITY * deltatime;
|
|
|
|
|
if(gravity.z > 3.0f) gravity.z = 3.0f;
|
|
|
|
|
|
|
|
|
|
// Test if we don't go through a floor
|
|
|
|
|
if((General.Map.VisualCamera.Position.z + gravity.z) < (floorheight + cameraflooroffset + 0.1f))
|
|
|
|
|
{
|
|
|
|
|
// Stay above floor
|
|
|
|
|
gravity = new Vector3D(0.0f, 0.0f, 0.0f);
|
|
|
|
|
General.Map.VisualCamera.Position = new Vector3D(General.Map.VisualCamera.Position.x,
|
|
|
|
|
General.Map.VisualCamera.Position.y,
|
|
|
|
|
floorheight + cameraflooroffset);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
// Apply gravity vector
|
|
|
|
|
General.Map.VisualCamera.Position += gravity;
|
|
|
|
|
}
|
2009-04-19 18:07:22 +00:00
|
|
|
|
}
|
2012-11-27 21:12:20 +00:00
|
|
|
|
|
|
|
|
|
// Camera above ceiling?
|
|
|
|
|
feetposition = General.Map.VisualCamera.Position - new Vector3D(0, 0, cameraflooroffset - 7.0f);
|
|
|
|
|
SectorLevel ceillevel = sd.GetCeilingAbove(feetposition) ?? sd.LightLevels[sd.LightLevels.Count - 1];
|
|
|
|
|
float ceilheight = ceillevel.plane.GetZ(General.Map.VisualCamera.Position);
|
|
|
|
|
if(General.Map.VisualCamera.Position.z > (ceilheight - cameraceilingoffset - 0.01f))
|
2009-04-19 18:07:22 +00:00
|
|
|
|
{
|
|
|
|
|
// Stay below ceiling
|
|
|
|
|
General.Map.VisualCamera.Position = new Vector3D(General.Map.VisualCamera.Position.x,
|
|
|
|
|
General.Map.VisualCamera.Position.y,
|
2012-11-27 21:12:20 +00:00
|
|
|
|
ceilheight - cameraceilingoffset);
|
2009-04-19 18:07:22 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
gravity = new Vector3D(0.0f, 0.0f, 0.0f);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Do processing
|
|
|
|
|
base.OnProcess(deltatime);
|
|
|
|
|
|
|
|
|
|
// Process visible geometry
|
|
|
|
|
foreach(IVisualEventReceiver g in visiblegeometry)
|
|
|
|
|
{
|
|
|
|
|
g.OnProcess(deltatime);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Time to pick a new target?
|
2012-07-10 14:14:53 +00:00
|
|
|
|
if(General.Clock.CurrentTime > (lastpicktime + PICK_INTERVAL))
|
2009-04-19 18:07:22 +00:00
|
|
|
|
{
|
|
|
|
|
PickTargetUnlocked();
|
2012-07-10 14:14:53 +00:00
|
|
|
|
lastpicktime = General.Clock.CurrentTime;
|
2009-04-19 18:07:22 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// The mouse is always in motion
|
|
|
|
|
MouseEventArgs args = new MouseEventArgs(General.Interface.MouseButtons, 0, 0, 0, 0);
|
|
|
|
|
OnMouseMove(args);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// This draws a frame
|
|
|
|
|
public override void OnRedrawDisplay()
|
|
|
|
|
{
|
|
|
|
|
// Start drawing
|
|
|
|
|
if(renderer.Start())
|
|
|
|
|
{
|
|
|
|
|
// Use fog!
|
|
|
|
|
renderer.SetFogMode(true);
|
|
|
|
|
|
|
|
|
|
// Set target for highlighting
|
2012-11-22 09:37:57 +00:00
|
|
|
|
renderer.ShowSelection = General.Settings.GZOldHighlightMode || BuilderPlug.Me.UseHighlight; //mxd
|
2012-10-08 13:07:56 +00:00
|
|
|
|
|
2012-11-27 21:12:20 +00:00
|
|
|
|
if(BuilderPlug.Me.UseHighlight)
|
|
|
|
|
renderer.SetHighlightedObject(target.picked);
|
2009-04-19 18:07:22 +00:00
|
|
|
|
|
|
|
|
|
// Begin with geometry
|
|
|
|
|
renderer.StartGeometry();
|
|
|
|
|
|
|
|
|
|
// Render all visible sectors
|
|
|
|
|
foreach(VisualGeometry g in visiblegeometry)
|
|
|
|
|
renderer.AddSectorGeometry(g);
|
|
|
|
|
|
|
|
|
|
if(BuilderPlug.Me.ShowVisualThings != 0)
|
|
|
|
|
{
|
|
|
|
|
// Render things in cages?
|
|
|
|
|
renderer.DrawThingCages = ((BuilderPlug.Me.ShowVisualThings & 2) != 0);
|
|
|
|
|
|
|
|
|
|
// Render all visible things
|
|
|
|
|
foreach(VisualThing t in visiblethings)
|
|
|
|
|
renderer.AddThingGeometry(t);
|
|
|
|
|
}
|
2013-03-18 13:52:27 +00:00
|
|
|
|
|
|
|
|
|
//mxd
|
|
|
|
|
if(General.Map.UDMF && General.Settings.GZShowVisualVertices && vertices.Count > 0) {
|
|
|
|
|
List<VisualVertex> verts = new List<VisualVertex>();
|
|
|
|
|
|
|
|
|
|
foreach(KeyValuePair<Vertex, VisualVertexPair> pair in vertices)
|
|
|
|
|
verts.AddRange(pair.Value.Vertices);
|
|
|
|
|
|
|
|
|
|
renderer.AddVisualVertices(verts.ToArray());
|
|
|
|
|
}
|
2009-04-19 18:07:22 +00:00
|
|
|
|
|
|
|
|
|
// Done rendering geometry
|
|
|
|
|
renderer.FinishGeometry();
|
|
|
|
|
|
|
|
|
|
// Render crosshair
|
|
|
|
|
renderer.RenderCrosshair();
|
|
|
|
|
|
|
|
|
|
// Present!
|
|
|
|
|
renderer.Finish();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// After resources were reloaded
|
|
|
|
|
protected override void ResourcesReloaded()
|
|
|
|
|
{
|
|
|
|
|
base.ResourcesReloaded();
|
2012-11-27 21:12:20 +00:00
|
|
|
|
RebuildElementData();
|
2009-04-19 18:07:22 +00:00
|
|
|
|
PickTarget();
|
|
|
|
|
}
|
|
|
|
|
|
2009-06-16 08:49:14 +00:00
|
|
|
|
// This usually happens when geometry is changed by undo, redo, cut or paste actions
|
|
|
|
|
// and uses the marks to check what needs to be reloaded.
|
2009-06-11 21:21:20 +00:00
|
|
|
|
protected override void ResourcesReloadedPartial()
|
|
|
|
|
{
|
2009-06-16 08:49:14 +00:00
|
|
|
|
bool sectorsmarked = false;
|
|
|
|
|
|
2009-07-07 15:11:09 +00:00
|
|
|
|
if(General.Map.UndoRedo.GeometryChanged)
|
2009-06-16 08:49:14 +00:00
|
|
|
|
{
|
|
|
|
|
// Let the core do this (it will just dispose the sectors that were changed)
|
|
|
|
|
base.ResourcesReloadedPartial();
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
// Neighbour sectors must be updated as well
|
|
|
|
|
foreach(Sector s in General.Map.Map.Sectors)
|
|
|
|
|
{
|
|
|
|
|
if(s.Marked)
|
|
|
|
|
{
|
|
|
|
|
sectorsmarked = true;
|
|
|
|
|
foreach(Sidedef sd in s.Sidedefs)
|
2009-06-27 09:45:35 +00:00
|
|
|
|
{
|
|
|
|
|
sd.Marked = true;
|
2009-06-16 08:49:14 +00:00
|
|
|
|
if(sd.Other != null) sd.Other.Marked = true;
|
2009-06-27 09:45:35 +00:00
|
|
|
|
}
|
2009-06-16 08:49:14 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Go for all sidedefs to update
|
|
|
|
|
foreach(Sidedef sd in General.Map.Map.Sidedefs)
|
|
|
|
|
{
|
2009-06-16 18:28:33 +00:00
|
|
|
|
if(sd.Marked && VisualSectorExists(sd.Sector))
|
2009-06-16 08:49:14 +00:00
|
|
|
|
{
|
|
|
|
|
BaseVisualSector vs = (BaseVisualSector)GetVisualSector(sd.Sector);
|
|
|
|
|
VisualSidedefParts parts = vs.GetSidedefParts(sd);
|
|
|
|
|
parts.SetupAllParts();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Go for all sectors to update
|
|
|
|
|
foreach(Sector s in General.Map.Map.Sectors)
|
|
|
|
|
{
|
2012-11-27 21:12:20 +00:00
|
|
|
|
if(s.Marked)
|
2009-06-16 08:49:14 +00:00
|
|
|
|
{
|
2012-11-27 21:12:20 +00:00
|
|
|
|
SectorData sd = GetSectorData(s);
|
|
|
|
|
sd.Reset();
|
|
|
|
|
|
|
|
|
|
// UpdateSectorGeometry for associated sectors (sd.UpdateAlso) as well!
|
|
|
|
|
foreach(KeyValuePair<Sector, bool> us in sd.UpdateAlso)
|
|
|
|
|
{
|
|
|
|
|
if(VisualSectorExists(us.Key))
|
|
|
|
|
{
|
|
|
|
|
BaseVisualSector vs = (BaseVisualSector)GetVisualSector(us.Key);
|
|
|
|
|
vs.UpdateSectorGeometry(us.Value);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// And update for this sector ofcourse
|
|
|
|
|
if(VisualSectorExists(s))
|
|
|
|
|
{
|
|
|
|
|
BaseVisualSector vs = (BaseVisualSector)GetVisualSector(s);
|
|
|
|
|
vs.UpdateSectorGeometry(false);
|
|
|
|
|
}
|
2009-06-16 08:49:14 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(!sectorsmarked)
|
|
|
|
|
{
|
|
|
|
|
// No sectors or geometry changed. So we only have
|
|
|
|
|
// to update things when they have changed.
|
|
|
|
|
foreach(KeyValuePair<Thing, VisualThing> vt in allthings)
|
2011-12-02 23:11:16 +00:00
|
|
|
|
if((vt.Value != null) && vt.Key.Marked) (vt.Value as BaseVisualThing).Rebuild();
|
2009-06-16 08:49:14 +00:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
// Things depend on the sector they are in and because we can't
|
|
|
|
|
// easily determine which ones changed, we dispose all things
|
|
|
|
|
foreach(KeyValuePair<Thing, VisualThing> vt in allthings)
|
2011-12-02 23:11:16 +00:00
|
|
|
|
if(vt.Value != null) vt.Value.Dispose();
|
2009-07-05 09:40:18 +00:00
|
|
|
|
|
|
|
|
|
// Apply new lists
|
|
|
|
|
allthings = new Dictionary<Thing, VisualThing>(allthings.Count);
|
2009-06-16 08:49:14 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Clear visibility collections
|
|
|
|
|
visiblesectors.Clear();
|
|
|
|
|
visibleblocks.Clear();
|
|
|
|
|
visiblegeometry.Clear();
|
|
|
|
|
visiblethings.Clear();
|
|
|
|
|
|
|
|
|
|
// Make new blockmap
|
2010-08-01 18:49:46 +00:00
|
|
|
|
if(sectorsmarked || General.Map.UndoRedo.PopulationChanged)
|
2009-07-05 09:40:18 +00:00
|
|
|
|
FillBlockMap();
|
2009-06-16 08:49:14 +00:00
|
|
|
|
|
2012-11-27 21:12:20 +00:00
|
|
|
|
RebuildElementData();
|
|
|
|
|
UpdateChangedObjects();
|
|
|
|
|
|
2009-06-16 08:49:14 +00:00
|
|
|
|
// Visibility culling (this re-creates the needed resources)
|
|
|
|
|
DoCulling();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Determine what we're aiming at now
|
2009-06-11 21:21:20 +00:00
|
|
|
|
PickTarget();
|
|
|
|
|
}
|
|
|
|
|
|
2009-04-19 18:07:22 +00:00
|
|
|
|
// Mouse moves
|
|
|
|
|
public override void OnMouseMove(MouseEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
base.OnMouseMove(e);
|
2009-07-07 11:29:56 +00:00
|
|
|
|
GetTargetEventReceiver(true).OnMouseMove(e);
|
2009-04-19 18:07:22 +00:00
|
|
|
|
}
|
|
|
|
|
|
2009-05-05 09:50:23 +00:00
|
|
|
|
// Undo performed
|
|
|
|
|
public override void OnUndoEnd()
|
|
|
|
|
{
|
2012-11-27 21:12:20 +00:00
|
|
|
|
base.OnUndoEnd();
|
|
|
|
|
|
2013-03-18 13:52:27 +00:00
|
|
|
|
//mxd. Effects may've become invalid
|
|
|
|
|
if(gzdoomRenderingEffects && sectordata != null && sectordata.Count > 0)
|
|
|
|
|
RebuildElementData();
|
|
|
|
|
|
|
|
|
|
//mxd. As well as geometry...
|
2012-11-27 21:12:20 +00:00
|
|
|
|
foreach(KeyValuePair<Sector, VisualSector> group in visiblesectors){
|
|
|
|
|
if (group.Value is BaseVisualSector)
|
|
|
|
|
((BaseVisualSector)group.Value).Rebuild();
|
|
|
|
|
}
|
|
|
|
|
|
2009-07-07 11:29:56 +00:00
|
|
|
|
RebuildSelectedObjectsList();
|
|
|
|
|
|
2009-05-05 09:50:23 +00:00
|
|
|
|
// We can't group with this undo level anymore
|
|
|
|
|
lastundogroup = UndoGroup.None;
|
2013-07-09 11:29:10 +00:00
|
|
|
|
|
|
|
|
|
//mxd
|
|
|
|
|
updateSelectionInfo();
|
2009-05-05 09:50:23 +00:00
|
|
|
|
}
|
|
|
|
|
|
2009-07-07 11:29:56 +00:00
|
|
|
|
// Redo performed
|
|
|
|
|
public override void OnRedoEnd()
|
|
|
|
|
{
|
|
|
|
|
base.OnRedoEnd();
|
2012-11-27 21:12:20 +00:00
|
|
|
|
|
2013-03-18 13:52:27 +00:00
|
|
|
|
//mxd. Effects may've become invalid
|
|
|
|
|
if(sectordata != null && sectordata.Count > 0)
|
|
|
|
|
RebuildElementData();
|
|
|
|
|
|
|
|
|
|
//mxd. As well as geometry...
|
2012-11-27 21:12:20 +00:00
|
|
|
|
foreach (KeyValuePair<Sector, VisualSector> group in visiblesectors) {
|
|
|
|
|
if (group.Value is BaseVisualSector)
|
|
|
|
|
((BaseVisualSector)group.Value).Rebuild();
|
|
|
|
|
}
|
|
|
|
|
|
2009-07-07 11:29:56 +00:00
|
|
|
|
RebuildSelectedObjectsList();
|
2013-07-09 11:29:10 +00:00
|
|
|
|
|
|
|
|
|
//mxd
|
|
|
|
|
updateSelectionInfo();
|
2009-07-07 11:29:56 +00:00
|
|
|
|
}
|
2013-07-19 15:30:58 +00:00
|
|
|
|
|
|
|
|
|
//mxd
|
|
|
|
|
private void Interface_OnSectorEditFormValuesChanged(object sender, EventArgs e) {
|
|
|
|
|
if(allsectors == null) return;
|
|
|
|
|
|
|
|
|
|
// Reset changed flags
|
|
|
|
|
foreach(KeyValuePair<Sector, VisualSector> vs in allsectors) {
|
|
|
|
|
BaseVisualSector bvs = (vs.Value as BaseVisualSector);
|
|
|
|
|
foreach(VisualFloor vf in bvs.ExtraFloors)
|
|
|
|
|
vf.Changed = false;
|
|
|
|
|
foreach(VisualCeiling vc in bvs.ExtraCeilings)
|
|
|
|
|
vc.Changed = false;
|
|
|
|
|
foreach(VisualFloor vf in bvs.ExtraBackFloors)
|
|
|
|
|
vf.Changed = false;
|
|
|
|
|
foreach(VisualCeiling vc in bvs.ExtraBackCeilings)
|
|
|
|
|
vc.Changed = false;
|
|
|
|
|
bvs.Floor.Changed = false;
|
|
|
|
|
bvs.Ceiling.Changed = false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
UpdateChangedObjects();
|
|
|
|
|
ShowTargetInfo();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//mxd
|
|
|
|
|
private void Interface_OnEditFormValuesChanged(object sender, EventArgs e) {
|
|
|
|
|
UpdateChangedObjects();
|
|
|
|
|
ShowTargetInfo();
|
|
|
|
|
}
|
2009-07-07 11:29:56 +00:00
|
|
|
|
|
2009-04-19 18:07:22 +00:00
|
|
|
|
#endregion
|
|
|
|
|
|
2009-05-03 19:22:32 +00:00
|
|
|
|
#region ================== Action Assist
|
|
|
|
|
|
|
|
|
|
// Because some actions can only be called on a single (the targeted) object because
|
|
|
|
|
// they show a dialog window or something, these functions help applying the result
|
|
|
|
|
// to all compatible selected objects.
|
|
|
|
|
|
|
|
|
|
// Apply texture offsets
|
|
|
|
|
public void ApplyTextureOffsetChange(int dx, int dy)
|
|
|
|
|
{
|
2009-05-04 06:13:56 +00:00
|
|
|
|
Dictionary<Sidedef, int> donesides = new Dictionary<Sidedef, int>(selectedobjects.Count);
|
2013-03-18 13:52:27 +00:00
|
|
|
|
List<IVisualEventReceiver> objs = GetSelectedObjects(false, true, false, false);
|
2009-07-11 10:28:58 +00:00
|
|
|
|
foreach(IVisualEventReceiver i in objs)
|
2009-05-03 19:22:32 +00:00
|
|
|
|
{
|
2009-05-04 06:13:56 +00:00
|
|
|
|
if(i is BaseVisualGeometrySidedef)
|
|
|
|
|
{
|
|
|
|
|
if(!donesides.ContainsKey((i as BaseVisualGeometrySidedef).Sidedef))
|
|
|
|
|
{
|
2013-04-26 12:32:51 +00:00
|
|
|
|
i.OnChangeTextureOffset(dx, dy, false);
|
2009-05-04 06:13:56 +00:00
|
|
|
|
donesides.Add((i as BaseVisualGeometrySidedef).Sidedef, 0);
|
|
|
|
|
}
|
|
|
|
|
}
|
2009-05-03 19:22:32 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2012-11-27 21:12:20 +00:00
|
|
|
|
// Apply flat offsets
|
|
|
|
|
public void ApplyFlatOffsetChange(int dx, int dy)
|
|
|
|
|
{
|
|
|
|
|
Dictionary<Sector, int> donesectors = new Dictionary<Sector, int>(selectedobjects.Count);
|
2013-03-18 13:52:27 +00:00
|
|
|
|
List<IVisualEventReceiver> objs = GetSelectedObjects(true, false, false, false);
|
2012-11-27 21:12:20 +00:00
|
|
|
|
foreach(IVisualEventReceiver i in objs)
|
|
|
|
|
{
|
|
|
|
|
if(i is BaseVisualGeometrySector)
|
|
|
|
|
{
|
|
|
|
|
if(!donesectors.ContainsKey((i as BaseVisualGeometrySector).Sector.Sector))
|
|
|
|
|
{
|
2013-04-26 12:32:51 +00:00
|
|
|
|
i.OnChangeTextureOffset(dx, dy, false);
|
2012-11-27 21:12:20 +00:00
|
|
|
|
donesectors.Add((i as BaseVisualGeometrySector).Sector.Sector, 0);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2009-05-03 19:22:32 +00:00
|
|
|
|
// Apply upper unpegged flag
|
|
|
|
|
public void ApplyUpperUnpegged(bool set)
|
|
|
|
|
{
|
2013-03-18 13:52:27 +00:00
|
|
|
|
List<IVisualEventReceiver> objs = GetSelectedObjects(false, true, false, false);
|
2009-07-11 10:28:58 +00:00
|
|
|
|
foreach(IVisualEventReceiver i in objs)
|
2009-05-03 19:22:32 +00:00
|
|
|
|
{
|
|
|
|
|
i.ApplyUpperUnpegged(set);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Apply lower unpegged flag
|
|
|
|
|
public void ApplyLowerUnpegged(bool set)
|
|
|
|
|
{
|
2013-03-18 13:52:27 +00:00
|
|
|
|
List<IVisualEventReceiver> objs = GetSelectedObjects(false, true, false, false);
|
2009-07-11 10:28:58 +00:00
|
|
|
|
foreach(IVisualEventReceiver i in objs)
|
2009-05-03 19:22:32 +00:00
|
|
|
|
{
|
|
|
|
|
i.ApplyLowerUnpegged(set);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Apply texture change
|
|
|
|
|
public void ApplySelectTexture(string texture, bool flat)
|
|
|
|
|
{
|
2009-07-11 10:28:58 +00:00
|
|
|
|
List<IVisualEventReceiver> objs;
|
|
|
|
|
|
2009-05-03 19:22:32 +00:00
|
|
|
|
if(General.Map.Config.MixTexturesFlats)
|
|
|
|
|
{
|
|
|
|
|
// Apply on all compatible types
|
2013-03-18 13:52:27 +00:00
|
|
|
|
objs = GetSelectedObjects(true, true, false, false);
|
2009-05-03 19:22:32 +00:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2009-07-11 10:28:58 +00:00
|
|
|
|
// We don't want to mix textures and flats, so apply only on the appropriate type
|
2013-03-18 13:52:27 +00:00
|
|
|
|
objs = GetSelectedObjects(flat, !flat, false, false);
|
2009-07-11 10:28:58 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
foreach(IVisualEventReceiver i in objs)
|
|
|
|
|
{
|
|
|
|
|
i.ApplyTexture(texture);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// This returns all selected objects
|
2013-03-18 13:52:27 +00:00
|
|
|
|
internal List<IVisualEventReceiver> GetSelectedObjects(bool includesectors, bool includesidedefs, bool includethings, bool includevertices)
|
2009-07-11 10:28:58 +00:00
|
|
|
|
{
|
|
|
|
|
List<IVisualEventReceiver> objs = new List<IVisualEventReceiver>();
|
|
|
|
|
foreach(IVisualEventReceiver i in selectedobjects)
|
|
|
|
|
{
|
|
|
|
|
if((i is BaseVisualGeometrySector) && includesectors) objs.Add(i);
|
|
|
|
|
else if((i is BaseVisualGeometrySidedef) && includesidedefs) objs.Add(i);
|
|
|
|
|
else if((i is BaseVisualThing) && includethings) objs.Add(i);
|
2013-05-02 07:47:22 +00:00
|
|
|
|
else if((i is BaseVisualVertex) && includevertices) objs.Add(i);//mxd
|
2009-07-11 10:28:58 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Add highlight?
|
|
|
|
|
if(selectedobjects.Count == 0)
|
|
|
|
|
{
|
|
|
|
|
IVisualEventReceiver i = (target.picked as IVisualEventReceiver);
|
|
|
|
|
if((i is BaseVisualGeometrySector) && includesectors) objs.Add(i);
|
|
|
|
|
else if((i is BaseVisualGeometrySidedef) && includesidedefs) objs.Add(i);
|
|
|
|
|
else if((i is BaseVisualThing) && includethings) objs.Add(i);
|
2013-05-02 07:47:22 +00:00
|
|
|
|
else if((i is BaseVisualVertex) && includevertices) objs.Add(i);//mxd
|
2009-05-03 19:22:32 +00:00
|
|
|
|
}
|
2009-07-11 10:28:58 +00:00
|
|
|
|
|
|
|
|
|
return objs;
|
2009-05-03 19:22:32 +00:00
|
|
|
|
}
|
|
|
|
|
|
2009-05-05 19:12:36 +00:00
|
|
|
|
// This returns all selected sectors, no doubles
|
2009-05-03 19:22:32 +00:00
|
|
|
|
public List<Sector> GetSelectedSectors()
|
|
|
|
|
{
|
2009-05-05 19:12:36 +00:00
|
|
|
|
Dictionary<Sector, int> added = new Dictionary<Sector, int>();
|
2009-05-03 19:22:32 +00:00
|
|
|
|
List<Sector> sectors = new List<Sector>();
|
|
|
|
|
foreach(IVisualEventReceiver i in selectedobjects)
|
|
|
|
|
{
|
2009-05-05 19:12:36 +00:00
|
|
|
|
if(i is BaseVisualGeometrySector)
|
|
|
|
|
{
|
2012-11-27 21:12:20 +00:00
|
|
|
|
Sector s = (i as BaseVisualGeometrySector).Level.sector;
|
2009-05-05 19:12:36 +00:00
|
|
|
|
if(!added.ContainsKey(s))
|
|
|
|
|
{
|
|
|
|
|
sectors.Add(s);
|
|
|
|
|
added.Add(s, 0);
|
|
|
|
|
}
|
|
|
|
|
}
|
2009-05-03 19:22:32 +00:00
|
|
|
|
}
|
2009-07-11 10:28:58 +00:00
|
|
|
|
|
|
|
|
|
// Add highlight?
|
|
|
|
|
if((selectedobjects.Count == 0) && (target.picked is BaseVisualGeometrySector))
|
|
|
|
|
{
|
2012-11-27 21:12:20 +00:00
|
|
|
|
Sector s = (target.picked as BaseVisualGeometrySector).Level.sector;
|
2009-07-11 10:28:58 +00:00
|
|
|
|
if(!added.ContainsKey(s))
|
|
|
|
|
sectors.Add(s);
|
|
|
|
|
}
|
|
|
|
|
|
2009-05-03 19:22:32 +00:00
|
|
|
|
return sectors;
|
|
|
|
|
}
|
|
|
|
|
|
2009-05-05 19:12:36 +00:00
|
|
|
|
// This returns all selected linedefs, no doubles
|
2009-05-03 19:22:32 +00:00
|
|
|
|
public List<Linedef> GetSelectedLinedefs()
|
|
|
|
|
{
|
2009-05-05 19:12:36 +00:00
|
|
|
|
Dictionary<Linedef, int> added = new Dictionary<Linedef, int>();
|
2009-05-03 19:22:32 +00:00
|
|
|
|
List<Linedef> linedefs = new List<Linedef>();
|
|
|
|
|
foreach(IVisualEventReceiver i in selectedobjects)
|
|
|
|
|
{
|
2009-05-05 19:12:36 +00:00
|
|
|
|
if(i is BaseVisualGeometrySidedef)
|
|
|
|
|
{
|
2013-03-18 13:52:27 +00:00
|
|
|
|
//Linedef l = (i as BaseVisualGeometrySidedef).Sidedef.Line;
|
|
|
|
|
Linedef l = (i as BaseVisualGeometrySidedef).GetControlLinedef(); //mxd
|
2009-05-05 19:12:36 +00:00
|
|
|
|
if(!added.ContainsKey(l))
|
|
|
|
|
{
|
|
|
|
|
linedefs.Add(l);
|
|
|
|
|
added.Add(l, 0);
|
|
|
|
|
}
|
|
|
|
|
}
|
2009-05-03 19:22:32 +00:00
|
|
|
|
}
|
2009-07-11 10:28:58 +00:00
|
|
|
|
|
|
|
|
|
// Add highlight?
|
|
|
|
|
if((selectedobjects.Count == 0) && (target.picked is BaseVisualGeometrySidedef))
|
|
|
|
|
{
|
2013-03-18 13:52:27 +00:00
|
|
|
|
//Linedef l = (target.picked as BaseVisualGeometrySidedef).Sidedef.Line;
|
|
|
|
|
Linedef l = (target.picked as BaseVisualGeometrySidedef).GetControlLinedef(); //mxd
|
2009-07-11 10:28:58 +00:00
|
|
|
|
if(!added.ContainsKey(l))
|
|
|
|
|
linedefs.Add(l);
|
|
|
|
|
}
|
|
|
|
|
|
2009-05-03 19:22:32 +00:00
|
|
|
|
return linedefs;
|
|
|
|
|
}
|
|
|
|
|
|
2009-06-12 09:44:38 +00:00
|
|
|
|
// This returns all selected sidedefs, no doubles
|
|
|
|
|
public List<Sidedef> GetSelectedSidedefs()
|
|
|
|
|
{
|
|
|
|
|
Dictionary<Sidedef, int> added = new Dictionary<Sidedef, int>();
|
|
|
|
|
List<Sidedef> sidedefs = new List<Sidedef>();
|
|
|
|
|
foreach(IVisualEventReceiver i in selectedobjects)
|
|
|
|
|
{
|
|
|
|
|
if(i is BaseVisualGeometrySidedef)
|
|
|
|
|
{
|
|
|
|
|
Sidedef sd = (i as BaseVisualGeometrySidedef).Sidedef;
|
|
|
|
|
if(!added.ContainsKey(sd))
|
|
|
|
|
{
|
|
|
|
|
sidedefs.Add(sd);
|
|
|
|
|
added.Add(sd, 0);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2009-07-11 10:28:58 +00:00
|
|
|
|
|
|
|
|
|
// Add highlight?
|
|
|
|
|
if((selectedobjects.Count == 0) && (target.picked is BaseVisualGeometrySidedef))
|
|
|
|
|
{
|
|
|
|
|
Sidedef sd = (target.picked as BaseVisualGeometrySidedef).Sidedef;
|
|
|
|
|
if(!added.ContainsKey(sd))
|
|
|
|
|
sidedefs.Add(sd);
|
|
|
|
|
}
|
|
|
|
|
|
2009-06-12 09:44:38 +00:00
|
|
|
|
return sidedefs;
|
|
|
|
|
}
|
|
|
|
|
|
2009-05-05 19:12:36 +00:00
|
|
|
|
// This returns all selected things, no doubles
|
2009-05-03 19:22:32 +00:00
|
|
|
|
public List<Thing> GetSelectedThings()
|
|
|
|
|
{
|
2009-05-05 19:12:36 +00:00
|
|
|
|
Dictionary<Thing, int> added = new Dictionary<Thing, int>();
|
2009-05-03 19:22:32 +00:00
|
|
|
|
List<Thing> things = new List<Thing>();
|
|
|
|
|
foreach(IVisualEventReceiver i in selectedobjects)
|
|
|
|
|
{
|
2009-05-05 19:12:36 +00:00
|
|
|
|
if(i is BaseVisualThing)
|
|
|
|
|
{
|
|
|
|
|
Thing t = (i as BaseVisualThing).Thing;
|
|
|
|
|
if(!added.ContainsKey(t))
|
|
|
|
|
{
|
|
|
|
|
things.Add(t);
|
|
|
|
|
added.Add(t, 0);
|
|
|
|
|
}
|
|
|
|
|
}
|
2009-05-03 19:22:32 +00:00
|
|
|
|
}
|
2009-07-11 10:28:58 +00:00
|
|
|
|
|
|
|
|
|
// Add highlight?
|
|
|
|
|
if((selectedobjects.Count == 0) && (target.picked is BaseVisualThing))
|
|
|
|
|
{
|
|
|
|
|
Thing t = (target.picked as BaseVisualThing).Thing;
|
|
|
|
|
if(!added.ContainsKey(t))
|
|
|
|
|
things.Add(t);
|
|
|
|
|
}
|
|
|
|
|
|
2009-05-03 19:22:32 +00:00
|
|
|
|
return things;
|
|
|
|
|
}
|
2013-03-18 13:52:27 +00:00
|
|
|
|
|
|
|
|
|
//mxd. This returns all selected vertices, no doubles
|
|
|
|
|
public List<Vertex> GetSelectedVertices() {
|
|
|
|
|
Dictionary<Vertex, int> added = new Dictionary<Vertex, int>();
|
|
|
|
|
List<Vertex> verts = new List<Vertex>();
|
|
|
|
|
|
|
|
|
|
foreach(IVisualEventReceiver i in selectedobjects) {
|
|
|
|
|
if(i is BaseVisualVertex) {
|
|
|
|
|
Vertex v = (i as BaseVisualVertex).Vertex;
|
|
|
|
|
|
|
|
|
|
if(!added.ContainsKey(v)) {
|
|
|
|
|
verts.Add(v);
|
|
|
|
|
added.Add(v, 0);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Add highlight?
|
|
|
|
|
if((selectedobjects.Count == 0) && (target.picked is BaseVisualVertex)) {
|
|
|
|
|
Vertex v = (target.picked as BaseVisualVertex).Vertex;
|
|
|
|
|
if(!added.ContainsKey(v))
|
|
|
|
|
verts.Add(v);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return verts;
|
|
|
|
|
}
|
2009-07-07 11:29:56 +00:00
|
|
|
|
|
|
|
|
|
// This returns the IVisualEventReceiver on which the action must be performed
|
|
|
|
|
private IVisualEventReceiver GetTargetEventReceiver(bool targetonly)
|
|
|
|
|
{
|
|
|
|
|
if(target.picked != null)
|
|
|
|
|
{
|
|
|
|
|
if(singleselection || target.picked.Selected || targetonly)
|
|
|
|
|
{
|
|
|
|
|
return (IVisualEventReceiver)target.picked;
|
|
|
|
|
}
|
|
|
|
|
else if(selectedobjects.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
return selectedobjects[0];
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
return (IVisualEventReceiver)target.picked;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
return new NullVisualEventReceiver();
|
|
|
|
|
}
|
|
|
|
|
}
|
2012-07-05 13:48:08 +00:00
|
|
|
|
|
|
|
|
|
//mxd. Copied from BuilderModes.ThingsMode
|
|
|
|
|
// This creates a new thing
|
2012-07-16 09:45:21 +00:00
|
|
|
|
private Thing CreateThing(Vector2D pos) {
|
2012-07-05 13:48:08 +00:00
|
|
|
|
if (pos.x < General.Map.Config.LeftBoundary || pos.x > General.Map.Config.RightBoundary ||
|
|
|
|
|
pos.y > General.Map.Config.TopBoundary || pos.y < General.Map.Config.BottomBoundary) {
|
|
|
|
|
General.Interface.DisplayStatus(StatusType.Warning, "Failed to insert thing: outside of map boundaries.");
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Create thing
|
|
|
|
|
Thing t = General.Map.Map.CreateThing();
|
|
|
|
|
if (t != null) {
|
|
|
|
|
General.Settings.ApplyDefaultThingSettings(t);
|
|
|
|
|
t.Move(pos);
|
|
|
|
|
t.UpdateConfiguration();
|
|
|
|
|
General.Map.IsChanged = true;
|
2012-11-27 21:12:20 +00:00
|
|
|
|
|
2012-07-05 13:48:08 +00:00
|
|
|
|
// Update things filter so that it includes this thing
|
|
|
|
|
General.Map.ThingsFilter.Update();
|
|
|
|
|
|
|
|
|
|
// Snap to grid enabled?
|
|
|
|
|
if (General.Interface.SnapToGrid) {
|
|
|
|
|
// Snap to grid
|
|
|
|
|
t.SnapToGrid();
|
2012-11-27 21:12:20 +00:00
|
|
|
|
} else {
|
2012-07-05 13:48:08 +00:00
|
|
|
|
// Snap to map format accuracy
|
|
|
|
|
t.SnapToAccuracy();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return t;
|
|
|
|
|
}
|
2009-07-07 11:29:56 +00:00
|
|
|
|
|
2009-05-03 19:22:32 +00:00
|
|
|
|
#endregion
|
|
|
|
|
|
2009-04-19 18:07:22 +00:00
|
|
|
|
#region ================== Actions
|
|
|
|
|
|
2009-05-01 20:31:17 +00:00
|
|
|
|
[BeginAction("clearselection", BaseAction = true)]
|
|
|
|
|
public void ClearSelection()
|
|
|
|
|
{
|
2009-05-03 19:22:32 +00:00
|
|
|
|
selectedobjects = new List<IVisualEventReceiver>();
|
|
|
|
|
|
2009-05-01 20:31:17 +00:00
|
|
|
|
foreach(KeyValuePair<Sector, VisualSector> vs in allsectors)
|
|
|
|
|
{
|
2011-12-02 23:11:16 +00:00
|
|
|
|
if(vs.Value != null)
|
2009-05-01 20:31:17 +00:00
|
|
|
|
{
|
2011-12-02 23:11:16 +00:00
|
|
|
|
BaseVisualSector bvs = (BaseVisualSector)vs.Value;
|
|
|
|
|
if(bvs.Floor != null) bvs.Floor.Selected = false;
|
|
|
|
|
if(bvs.Ceiling != null) bvs.Ceiling.Selected = false;
|
2012-11-27 21:12:20 +00:00
|
|
|
|
foreach(VisualFloor vf in bvs.ExtraFloors) vf.Selected = false;
|
|
|
|
|
foreach(VisualCeiling vc in bvs.ExtraCeilings) vc.Selected = false;
|
2013-03-18 13:52:27 +00:00
|
|
|
|
foreach(VisualFloor vf in bvs.ExtraBackFloors) vf.Selected = false; //mxd
|
|
|
|
|
foreach(VisualCeiling vc in bvs.ExtraBackCeilings) vc.Selected = false; //mxd
|
|
|
|
|
|
2011-12-02 23:11:16 +00:00
|
|
|
|
foreach(Sidedef sd in vs.Key.Sidedefs)
|
2009-05-01 20:31:17 +00:00
|
|
|
|
{
|
2011-12-02 23:11:16 +00:00
|
|
|
|
List<VisualGeometry> sidedefgeos = bvs.GetSidedefGeometry(sd);
|
|
|
|
|
foreach(VisualGeometry sdg in sidedefgeos)
|
|
|
|
|
{
|
|
|
|
|
sdg.Selected = false;
|
|
|
|
|
}
|
2009-05-01 20:31:17 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
foreach(KeyValuePair<Thing, VisualThing> vt in allthings)
|
|
|
|
|
{
|
2011-12-02 23:11:16 +00:00
|
|
|
|
if(vt.Value != null)
|
|
|
|
|
{
|
|
|
|
|
BaseVisualThing bvt = (BaseVisualThing)vt.Value;
|
|
|
|
|
bvt.Selected = false;
|
|
|
|
|
}
|
2009-05-01 20:31:17 +00:00
|
|
|
|
}
|
2013-03-18 13:52:27 +00:00
|
|
|
|
|
|
|
|
|
//mxd
|
|
|
|
|
if(General.Map.UDMF) {
|
|
|
|
|
foreach(KeyValuePair<Vertex, VisualVertexPair> pair in vertices) {
|
|
|
|
|
pair.Value.Deselect();
|
|
|
|
|
}
|
|
|
|
|
}
|
2013-07-09 11:29:10 +00:00
|
|
|
|
|
|
|
|
|
//mxd
|
|
|
|
|
General.Interface.DisplayStatus(StatusType.Selection, string.Empty);
|
2009-05-01 20:31:17 +00:00
|
|
|
|
}
|
|
|
|
|
|
2009-04-19 18:07:22 +00:00
|
|
|
|
[BeginAction("visualselect", BaseAction = true)]
|
|
|
|
|
public void BeginSelect()
|
|
|
|
|
{
|
2009-05-03 19:22:32 +00:00
|
|
|
|
PreActionNoChange();
|
2009-04-19 18:07:22 +00:00
|
|
|
|
PickTargetUnlocked();
|
2009-07-07 11:29:56 +00:00
|
|
|
|
GetTargetEventReceiver(true).OnSelectBegin();
|
2009-05-03 19:22:32 +00:00
|
|
|
|
PostAction();
|
2009-04-19 18:07:22 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[EndAction("visualselect", BaseAction = true)]
|
|
|
|
|
public void EndSelect()
|
|
|
|
|
{
|
2009-07-11 10:28:58 +00:00
|
|
|
|
//PreActionNoChange();
|
2013-04-01 11:06:01 +00:00
|
|
|
|
IVisualEventReceiver target = GetTargetEventReceiver(true);
|
|
|
|
|
target.OnSelectEnd();
|
|
|
|
|
|
|
|
|
|
//mxd
|
|
|
|
|
if((General.Interface.ShiftState || General.Interface.CtrlState) && selectedobjects.Count > 0) {
|
|
|
|
|
IVisualEventReceiver[] selection = new IVisualEventReceiver[selectedobjects.Count];
|
|
|
|
|
selectedobjects.CopyTo(selection);
|
|
|
|
|
|
|
|
|
|
foreach(IVisualEventReceiver obj in selection)
|
|
|
|
|
obj.SelectNeighbours(target.IsSelected(), General.Interface.ShiftState, General.Interface.CtrlState);
|
|
|
|
|
}
|
|
|
|
|
|
2009-07-07 14:52:39 +00:00
|
|
|
|
Renderer.ShowSelection = true;
|
|
|
|
|
Renderer.ShowHighlight = true;
|
2009-05-03 19:22:32 +00:00
|
|
|
|
PostAction();
|
2013-07-09 11:29:10 +00:00
|
|
|
|
|
|
|
|
|
//mxd
|
|
|
|
|
updateSelectionInfo();
|
2009-04-19 18:07:22 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[BeginAction("visualedit", BaseAction = true)]
|
|
|
|
|
public void BeginEdit()
|
|
|
|
|
{
|
2009-05-05 09:50:23 +00:00
|
|
|
|
PreAction(UndoGroup.None);
|
2009-07-07 11:29:56 +00:00
|
|
|
|
GetTargetEventReceiver(false).OnEditBegin();
|
2009-05-03 19:22:32 +00:00
|
|
|
|
PostAction();
|
2009-04-19 18:07:22 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[EndAction("visualedit", BaseAction = true)]
|
|
|
|
|
public void EndEdit()
|
|
|
|
|
{
|
2009-07-11 10:28:58 +00:00
|
|
|
|
PreActionNoChange();
|
2009-07-07 11:29:56 +00:00
|
|
|
|
GetTargetEventReceiver(false).OnEditEnd();
|
2009-05-03 19:22:32 +00:00
|
|
|
|
PostAction();
|
2009-04-19 18:07:22 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[BeginAction("raisesector8")]
|
|
|
|
|
public void RaiseSector8()
|
|
|
|
|
{
|
2009-05-05 09:50:23 +00:00
|
|
|
|
PreAction(UndoGroup.SectorHeightChange);
|
2013-03-18 13:52:27 +00:00
|
|
|
|
List<IVisualEventReceiver> objs = GetSelectedObjects(true, true, true, true);
|
2009-07-11 10:28:58 +00:00
|
|
|
|
foreach(IVisualEventReceiver i in objs) i.OnChangeTargetHeight(8);
|
2009-05-03 19:22:32 +00:00
|
|
|
|
PostAction();
|
2009-04-19 18:07:22 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[BeginAction("lowersector8")]
|
|
|
|
|
public void LowerSector8()
|
|
|
|
|
{
|
2009-05-05 09:50:23 +00:00
|
|
|
|
PreAction(UndoGroup.SectorHeightChange);
|
2013-03-18 13:52:27 +00:00
|
|
|
|
List<IVisualEventReceiver> objs = GetSelectedObjects(true, true, true, true);
|
2009-07-11 10:28:58 +00:00
|
|
|
|
foreach(IVisualEventReceiver i in objs) i.OnChangeTargetHeight(-8);
|
2009-05-03 19:22:32 +00:00
|
|
|
|
PostAction();
|
2009-04-19 18:07:22 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[BeginAction("raisesector1")]
|
|
|
|
|
public void RaiseSector1()
|
|
|
|
|
{
|
2009-05-05 09:50:23 +00:00
|
|
|
|
PreAction(UndoGroup.SectorHeightChange);
|
2013-03-18 13:52:27 +00:00
|
|
|
|
List<IVisualEventReceiver> objs = GetSelectedObjects(true, true, true, true);
|
2009-07-11 10:28:58 +00:00
|
|
|
|
foreach(IVisualEventReceiver i in objs) i.OnChangeTargetHeight(1);
|
2009-05-03 19:22:32 +00:00
|
|
|
|
PostAction();
|
2009-04-19 18:07:22 +00:00
|
|
|
|
}
|
2012-11-27 21:12:20 +00:00
|
|
|
|
|
2009-04-19 18:07:22 +00:00
|
|
|
|
[BeginAction("lowersector1")]
|
|
|
|
|
public void LowerSector1()
|
|
|
|
|
{
|
2009-05-05 09:50:23 +00:00
|
|
|
|
PreAction(UndoGroup.SectorHeightChange);
|
2013-03-18 13:52:27 +00:00
|
|
|
|
List<IVisualEventReceiver> objs = GetSelectedObjects(true, true, true, true);
|
2009-07-11 10:28:58 +00:00
|
|
|
|
foreach(IVisualEventReceiver i in objs) i.OnChangeTargetHeight(-1);
|
2009-05-03 19:22:32 +00:00
|
|
|
|
PostAction();
|
2009-04-19 18:07:22 +00:00
|
|
|
|
}
|
|
|
|
|
|
2013-04-02 12:19:25 +00:00
|
|
|
|
//mxd
|
|
|
|
|
[BeginAction("raisesectortonearest")]
|
|
|
|
|
public void RaiseSectorToNearest() {
|
|
|
|
|
Dictionary<Sector, VisualFloor> floors = new Dictionary<Sector, VisualFloor>();
|
|
|
|
|
Dictionary<Sector, VisualCeiling> ceilings = new Dictionary<Sector, VisualCeiling>();
|
|
|
|
|
List<BaseVisualThing> things = new List<BaseVisualThing>();
|
2013-04-04 10:14:44 +00:00
|
|
|
|
bool withinSelection = General.Interface.CtrlState;
|
2013-04-02 12:19:25 +00:00
|
|
|
|
|
|
|
|
|
//get selection
|
|
|
|
|
if(selectedobjects.Count == 0) {
|
|
|
|
|
IVisualEventReceiver i = (target.picked as IVisualEventReceiver);
|
|
|
|
|
if(i is VisualFloor) {
|
|
|
|
|
VisualFloor vf = i as VisualFloor;
|
|
|
|
|
floors.Add(vf.Level.sector, vf);
|
|
|
|
|
} else if(i is VisualCeiling) {
|
|
|
|
|
VisualCeiling vc = i as VisualCeiling;
|
|
|
|
|
ceilings.Add(vc.Level.sector, vc);
|
|
|
|
|
} else if(i is BaseVisualThing) {
|
|
|
|
|
things.Add(i as BaseVisualThing);
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
foreach(IVisualEventReceiver i in selectedobjects) {
|
|
|
|
|
if(i is VisualFloor) {
|
|
|
|
|
VisualFloor vf = i as VisualFloor;
|
|
|
|
|
floors.Add(vf.Level.sector, vf);
|
|
|
|
|
} else if(i is VisualCeiling) {
|
|
|
|
|
VisualCeiling vc = i as VisualCeiling;
|
|
|
|
|
ceilings.Add(vc.Level.sector, vc);
|
|
|
|
|
} else if(i is BaseVisualThing) {
|
|
|
|
|
things.Add(i as BaseVisualThing);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2013-04-04 10:14:44 +00:00
|
|
|
|
//check what we have
|
2013-04-05 10:56:07 +00:00
|
|
|
|
if(floors.Count + ceilings.Count == 0 && (things.Count == 0 || !General.Map.FormatInterface.HasThingHeight)) {
|
2013-04-04 10:14:44 +00:00
|
|
|
|
General.Interface.DisplayStatus(StatusType.Warning, "No suitable objects found!");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(withinSelection) {
|
|
|
|
|
string s = string.Empty;
|
|
|
|
|
|
|
|
|
|
if(floors.Count == 1) s = "floors";
|
|
|
|
|
|
|
|
|
|
if(ceilings.Count == 1) {
|
|
|
|
|
if(!string.IsNullOrEmpty(s)) s += " and ";
|
|
|
|
|
s += "ceilings";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(!string.IsNullOrEmpty(s)){
|
|
|
|
|
General.Interface.DisplayStatus(StatusType.Warning, "Can't do: at least 2 selected " + s + " are required!");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2013-04-02 12:19:25 +00:00
|
|
|
|
//process floors...
|
|
|
|
|
int maxSelectedHeight = int.MinValue;
|
|
|
|
|
int minSelectedCeilingHeight = int.MaxValue;
|
2013-04-04 10:14:44 +00:00
|
|
|
|
int targetFloorHeight = int.MaxValue;
|
2013-04-02 12:19:25 +00:00
|
|
|
|
|
2013-04-04 10:14:44 +00:00
|
|
|
|
//get maximum floor and minimum ceiling heights from selection
|
2013-04-02 12:19:25 +00:00
|
|
|
|
foreach(KeyValuePair<Sector, VisualFloor> group in floors) {
|
|
|
|
|
if(group.Key.FloorHeight > maxSelectedHeight)
|
|
|
|
|
maxSelectedHeight = group.Key.FloorHeight;
|
|
|
|
|
|
|
|
|
|
if(group.Key.CeilHeight < minSelectedCeilingHeight)
|
|
|
|
|
minSelectedCeilingHeight = group.Key.CeilHeight;
|
|
|
|
|
}
|
|
|
|
|
|
2013-04-04 10:14:44 +00:00
|
|
|
|
if(withinSelection) {
|
|
|
|
|
//check heights
|
|
|
|
|
if(minSelectedCeilingHeight < maxSelectedHeight) {
|
|
|
|
|
General.Interface.DisplayStatus(StatusType.Warning, "Can't do: lowest ceiling is lower than highest floor!");
|
|
|
|
|
return;
|
|
|
|
|
} else {
|
|
|
|
|
targetFloorHeight = maxSelectedHeight;
|
2013-04-02 12:19:25 +00:00
|
|
|
|
}
|
2013-04-04 10:14:44 +00:00
|
|
|
|
} else {
|
|
|
|
|
//get next higher floor from surrounding unselected sectors
|
2013-04-02 12:19:25 +00:00
|
|
|
|
foreach(KeyValuePair<Sector, VisualFloor> group in floors) {
|
2013-04-04 10:14:44 +00:00
|
|
|
|
foreach(Sidedef side in group.Key.Sidedefs) {
|
|
|
|
|
if(side.Other == null || ceilings.ContainsKey(side.Other.Sector) || floors.ContainsKey(side.Other.Sector))
|
|
|
|
|
continue;
|
|
|
|
|
if(side.Other.Sector.FloorHeight > maxSelectedHeight && side.Other.Sector.FloorHeight < targetFloorHeight && side.Other.Sector.FloorHeight <= minSelectedCeilingHeight)
|
|
|
|
|
targetFloorHeight = side.Other.Sector.FloorHeight;
|
|
|
|
|
}
|
2013-04-02 12:19:25 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//ceilings...
|
|
|
|
|
maxSelectedHeight = int.MinValue;
|
2013-04-04 10:14:44 +00:00
|
|
|
|
int targetCeilingHeight = int.MaxValue;
|
2013-04-02 12:19:25 +00:00
|
|
|
|
|
|
|
|
|
//get highest ceiling height from selection
|
|
|
|
|
foreach(KeyValuePair<Sector, VisualCeiling> group in ceilings) {
|
|
|
|
|
if(group.Key.CeilHeight > maxSelectedHeight)
|
|
|
|
|
maxSelectedHeight = group.Key.CeilHeight;
|
|
|
|
|
}
|
|
|
|
|
|
2013-04-04 10:14:44 +00:00
|
|
|
|
if(withinSelection) {
|
|
|
|
|
//we are raising, so we don't need to check anything
|
|
|
|
|
targetCeilingHeight = maxSelectedHeight;
|
|
|
|
|
} else {
|
|
|
|
|
//get next higher ceiling from surrounding unselected sectors
|
|
|
|
|
foreach(KeyValuePair<Sector, VisualCeiling> group in ceilings) {
|
|
|
|
|
foreach(Sidedef side in group.Key.Sidedefs) {
|
|
|
|
|
if(side.Other == null || ceilings.ContainsKey(side.Other.Sector) || floors.ContainsKey(side.Other.Sector))
|
|
|
|
|
continue;
|
|
|
|
|
if(side.Other.Sector.CeilHeight < targetCeilingHeight && side.Other.Sector.CeilHeight > maxSelectedHeight)
|
|
|
|
|
targetCeilingHeight = side.Other.Sector.CeilHeight;
|
|
|
|
|
}
|
2013-04-02 12:19:25 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2013-04-04 10:14:44 +00:00
|
|
|
|
//CHECK VALUES
|
|
|
|
|
string alignFailDescription = string.Empty;
|
|
|
|
|
|
|
|
|
|
if(floors.Count > 0 && targetFloorHeight == int.MaxValue)
|
|
|
|
|
alignFailDescription = floors.Count > 1 ? "floors" : "floor";
|
|
|
|
|
|
|
|
|
|
if(ceilings.Count > 0 && targetCeilingHeight == int.MaxValue) {
|
|
|
|
|
if(!string.IsNullOrEmpty(alignFailDescription))
|
|
|
|
|
alignFailDescription += " and ";
|
|
|
|
|
|
|
|
|
|
alignFailDescription += ceilings.Count > 1 ? "ceilings" : "ceiling";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(!string.IsNullOrEmpty(alignFailDescription)) {
|
|
|
|
|
General.Interface.DisplayStatus(StatusType.Warning, "Unable to align selected " + alignFailDescription + "!");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//APPLY VALUES
|
2013-04-05 10:56:07 +00:00
|
|
|
|
PreAction(UndoGroup.SectorHeightChange);
|
|
|
|
|
|
2013-04-04 10:14:44 +00:00
|
|
|
|
//change floors heights
|
|
|
|
|
if(floors.Count > 0) {
|
|
|
|
|
foreach(KeyValuePair<Sector, VisualFloor> group in floors) {
|
|
|
|
|
if(targetFloorHeight != group.Key.FloorHeight)
|
|
|
|
|
group.Value.OnChangeTargetHeight(targetFloorHeight - group.Key.FloorHeight);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//change ceilings heights
|
|
|
|
|
if(ceilings.Count > 0) {
|
2013-04-02 12:19:25 +00:00
|
|
|
|
foreach(KeyValuePair<Sector, VisualCeiling> group in ceilings) {
|
2013-04-04 10:14:44 +00:00
|
|
|
|
if(targetCeilingHeight != group.Key.CeilHeight)
|
|
|
|
|
group.Value.OnChangeTargetHeight(targetCeilingHeight - group.Key.CeilHeight);
|
2013-04-02 12:19:25 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//and things. Just align them to ceiling
|
|
|
|
|
if(General.Map.FormatInterface.HasThingHeight) {
|
|
|
|
|
foreach(BaseVisualThing vt in things) {
|
|
|
|
|
if(vt.Thing.Sector == null) continue;
|
|
|
|
|
ThingTypeInfo ti = General.Map.Data.GetThingInfo(vt.Thing.Type);
|
|
|
|
|
int zvalue = (int)(vt.Thing.Sector.FloorHeight + vt.Thing.Position.z);
|
|
|
|
|
|
2013-04-05 10:56:07 +00:00
|
|
|
|
if(zvalue != vt.Thing.Sector.CeilHeight - ti.Height)
|
2013-04-02 12:19:25 +00:00
|
|
|
|
vt.OnChangeTargetHeight((int)(vt.Thing.Sector.CeilHeight - ti.Height) - zvalue);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
PostAction();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//mxd
|
|
|
|
|
[BeginAction("lowersectortonearest")]
|
|
|
|
|
public void LowerSectorToNearest() {
|
|
|
|
|
Dictionary<Sector, VisualFloor> floors = new Dictionary<Sector, VisualFloor>();
|
|
|
|
|
Dictionary<Sector, VisualCeiling> ceilings = new Dictionary<Sector, VisualCeiling>();
|
|
|
|
|
List<BaseVisualThing> things = new List<BaseVisualThing>();
|
2013-04-04 10:14:44 +00:00
|
|
|
|
bool withinSelection = General.Interface.CtrlState;
|
2013-04-02 12:19:25 +00:00
|
|
|
|
|
|
|
|
|
//get selection
|
|
|
|
|
if(selectedobjects.Count == 0) {
|
|
|
|
|
IVisualEventReceiver i = (target.picked as IVisualEventReceiver);
|
|
|
|
|
if(i is VisualFloor) {
|
|
|
|
|
VisualFloor vf = i as VisualFloor;
|
|
|
|
|
floors.Add(vf.Level.sector, vf);
|
|
|
|
|
} else if(i is VisualCeiling) {
|
|
|
|
|
VisualCeiling vc = i as VisualCeiling;
|
|
|
|
|
ceilings.Add(vc.Level.sector, vc);
|
|
|
|
|
} else if(i is BaseVisualThing) {
|
|
|
|
|
things.Add(i as BaseVisualThing);
|
|
|
|
|
}
|
|
|
|
|
}else{
|
|
|
|
|
foreach(IVisualEventReceiver i in selectedobjects) {
|
|
|
|
|
if(i is VisualFloor) {
|
|
|
|
|
VisualFloor vf = i as VisualFloor;
|
|
|
|
|
floors.Add(vf.Level.sector, vf);
|
|
|
|
|
} else if(i is VisualCeiling) {
|
|
|
|
|
VisualCeiling vc = i as VisualCeiling;
|
|
|
|
|
ceilings.Add(vc.Level.sector, vc);
|
|
|
|
|
} else if(i is BaseVisualThing) {
|
|
|
|
|
things.Add(i as BaseVisualThing);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2013-04-04 10:14:44 +00:00
|
|
|
|
//check what we have
|
2013-04-05 10:56:07 +00:00
|
|
|
|
if(floors.Count + ceilings.Count == 0 && (things.Count == 0 || !General.Map.FormatInterface.HasThingHeight)) {
|
2013-04-04 10:14:44 +00:00
|
|
|
|
General.Interface.DisplayStatus(StatusType.Warning, "No suitable objects found!");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(withinSelection) {
|
|
|
|
|
string s = string.Empty;
|
|
|
|
|
|
|
|
|
|
if(floors.Count == 1) s = "floors";
|
|
|
|
|
|
|
|
|
|
if(ceilings.Count == 1) {
|
|
|
|
|
if(!string.IsNullOrEmpty(s)) s += " and ";
|
|
|
|
|
s += "ceilings";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(!string.IsNullOrEmpty(s)) {
|
|
|
|
|
General.Interface.DisplayStatus(StatusType.Warning, "Can't do: at least 2 selected " + s + " are required!");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2013-04-02 12:19:25 +00:00
|
|
|
|
//process floors...
|
|
|
|
|
int minSelectedHeight = int.MaxValue;
|
2013-04-04 10:14:44 +00:00
|
|
|
|
int targetFloorHeight = int.MinValue;
|
2013-04-02 12:19:25 +00:00
|
|
|
|
|
|
|
|
|
//get minimum floor height from selection
|
|
|
|
|
foreach(KeyValuePair<Sector, VisualFloor> group in floors) {
|
|
|
|
|
if(group.Key.FloorHeight < minSelectedHeight)
|
|
|
|
|
minSelectedHeight = group.Key.FloorHeight;
|
|
|
|
|
}
|
2013-04-04 10:14:44 +00:00
|
|
|
|
|
|
|
|
|
if(withinSelection) {
|
|
|
|
|
//we are lowering, so we don't need to check anything
|
|
|
|
|
targetFloorHeight = minSelectedHeight;
|
|
|
|
|
} else {
|
|
|
|
|
//get next floor lower height from surrounding unselected sectors
|
2013-04-02 12:19:25 +00:00
|
|
|
|
foreach(KeyValuePair<Sector, VisualFloor> group in floors) {
|
2013-04-04 10:14:44 +00:00
|
|
|
|
foreach(Sidedef side in group.Key.Sidedefs) {
|
|
|
|
|
if(side.Other == null || ceilings.ContainsKey(side.Other.Sector) || floors.ContainsKey(side.Other.Sector))
|
|
|
|
|
continue;
|
|
|
|
|
if(side.Other.Sector.FloorHeight > targetFloorHeight && side.Other.Sector.FloorHeight < minSelectedHeight)
|
|
|
|
|
targetFloorHeight = side.Other.Sector.FloorHeight;
|
|
|
|
|
}
|
2013-04-02 12:19:25 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//ceilings...
|
|
|
|
|
minSelectedHeight = int.MaxValue;
|
|
|
|
|
int maxSelectedFloorHeight = int.MinValue;
|
2013-04-04 10:14:44 +00:00
|
|
|
|
int targetCeilingHeight = int.MinValue;
|
2013-04-02 12:19:25 +00:00
|
|
|
|
|
|
|
|
|
//get minimum ceiling and maximum floor heights from selection
|
|
|
|
|
foreach(KeyValuePair<Sector, VisualCeiling> group in ceilings) {
|
|
|
|
|
if(group.Key.CeilHeight < minSelectedHeight)
|
|
|
|
|
minSelectedHeight = group.Key.CeilHeight;
|
|
|
|
|
|
|
|
|
|
if(group.Key.FloorHeight > maxSelectedFloorHeight)
|
|
|
|
|
maxSelectedFloorHeight = group.Key.FloorHeight;
|
|
|
|
|
}
|
|
|
|
|
|
2013-04-04 10:14:44 +00:00
|
|
|
|
if(withinSelection) {
|
|
|
|
|
if(minSelectedHeight < maxSelectedFloorHeight) {
|
|
|
|
|
General.Interface.DisplayStatus(StatusType.Warning, "Can't do: lowest ceiling is lower than highest floor!");
|
|
|
|
|
return;
|
|
|
|
|
} else {
|
|
|
|
|
targetCeilingHeight = minSelectedHeight;
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
//get next lower ceiling height from surrounding unselected sectors
|
|
|
|
|
foreach(KeyValuePair<Sector, VisualCeiling> group in ceilings) {
|
|
|
|
|
foreach(Sidedef side in group.Key.Sidedefs) {
|
|
|
|
|
if(side.Other == null || ceilings.ContainsKey(side.Other.Sector) || floors.ContainsKey(side.Other.Sector))
|
|
|
|
|
continue;
|
|
|
|
|
if(side.Other.Sector.CeilHeight > targetCeilingHeight && side.Other.Sector.CeilHeight < minSelectedHeight && side.Other.Sector.CeilHeight >= maxSelectedFloorHeight)
|
|
|
|
|
targetCeilingHeight = side.Other.Sector.CeilHeight;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//CHECK VALUES:
|
|
|
|
|
string alignFailDescription = string.Empty;
|
|
|
|
|
|
|
|
|
|
if(floors.Count > 0 && targetFloorHeight == int.MinValue)
|
|
|
|
|
alignFailDescription = floors.Count > 1 ? "floors" : "floor";
|
|
|
|
|
|
|
|
|
|
if(ceilings.Count > 0 && targetCeilingHeight == int.MinValue) {
|
|
|
|
|
if(!string.IsNullOrEmpty(alignFailDescription))
|
|
|
|
|
alignFailDescription += " and ";
|
|
|
|
|
|
|
|
|
|
alignFailDescription += ceilings.Count > 1 ? "ceilings" : "ceiling";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(!string.IsNullOrEmpty(alignFailDescription)) {
|
|
|
|
|
General.Interface.DisplayStatus(StatusType.Warning, "Unable to align selected " + alignFailDescription + "!");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//APPLY VALUES:
|
2013-04-05 10:56:07 +00:00
|
|
|
|
PreAction(UndoGroup.SectorHeightChange);
|
|
|
|
|
|
2013-04-04 10:14:44 +00:00
|
|
|
|
//change floor height
|
|
|
|
|
if(floors.Count > 0) {
|
|
|
|
|
foreach(KeyValuePair<Sector, VisualFloor> group in floors) {
|
|
|
|
|
if(targetFloorHeight != group.Key.FloorHeight)
|
|
|
|
|
group.Value.OnChangeTargetHeight(targetFloorHeight - group.Key.FloorHeight);
|
2013-04-02 12:19:25 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//change ceiling height
|
2013-04-04 10:14:44 +00:00
|
|
|
|
if(ceilings.Count > 0) {
|
2013-04-02 12:19:25 +00:00
|
|
|
|
foreach(KeyValuePair<Sector, VisualCeiling> group in ceilings) {
|
2013-04-04 10:14:44 +00:00
|
|
|
|
if(targetCeilingHeight != group.Key.CeilHeight)
|
|
|
|
|
group.Value.OnChangeTargetHeight(targetCeilingHeight - group.Key.CeilHeight);
|
2013-04-02 12:19:25 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2013-04-04 10:14:44 +00:00
|
|
|
|
//process things. Just drop them to ground
|
2013-04-02 12:19:25 +00:00
|
|
|
|
if(General.Map.FormatInterface.HasThingHeight){
|
|
|
|
|
foreach(BaseVisualThing vt in things) {
|
|
|
|
|
if(vt.Thing.Sector == null) continue;
|
|
|
|
|
ThingTypeInfo ti = General.Map.Data.GetThingInfo(vt.Thing.Type);
|
|
|
|
|
|
2013-04-05 10:56:07 +00:00
|
|
|
|
if(vt.Thing.Position.z != 0)
|
2013-04-02 12:19:25 +00:00
|
|
|
|
vt.OnChangeTargetHeight((int)-vt.Thing.Position.z);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
PostAction();
|
|
|
|
|
}
|
|
|
|
|
|
2009-04-19 18:07:22 +00:00
|
|
|
|
[BeginAction("showvisualthings")]
|
|
|
|
|
public void ShowVisualThings()
|
|
|
|
|
{
|
|
|
|
|
BuilderPlug.Me.ShowVisualThings++;
|
|
|
|
|
if(BuilderPlug.Me.ShowVisualThings > 2) BuilderPlug.Me.ShowVisualThings = 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[BeginAction("raisebrightness8")]
|
|
|
|
|
public void RaiseBrightness8()
|
|
|
|
|
{
|
2009-05-05 09:50:23 +00:00
|
|
|
|
PreAction(UndoGroup.SectorBrightnessChange);
|
2013-03-18 13:52:27 +00:00
|
|
|
|
List<IVisualEventReceiver> objs = GetSelectedObjects(true, true, false, false);
|
2009-07-11 10:28:58 +00:00
|
|
|
|
foreach(IVisualEventReceiver i in objs) i.OnChangeTargetBrightness(true);
|
2009-05-03 19:22:32 +00:00
|
|
|
|
PostAction();
|
2009-04-19 18:07:22 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[BeginAction("lowerbrightness8")]
|
|
|
|
|
public void LowerBrightness8()
|
|
|
|
|
{
|
2009-05-05 09:50:23 +00:00
|
|
|
|
PreAction(UndoGroup.SectorBrightnessChange);
|
2013-03-18 13:52:27 +00:00
|
|
|
|
List<IVisualEventReceiver> objs = GetSelectedObjects(true, true, false, false);
|
2009-07-11 10:28:58 +00:00
|
|
|
|
foreach(IVisualEventReceiver i in objs) i.OnChangeTargetBrightness(false);
|
2009-05-03 19:22:32 +00:00
|
|
|
|
PostAction();
|
2009-04-19 18:07:22 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[BeginAction("movetextureleft")]
|
|
|
|
|
public void MoveTextureLeft1()
|
|
|
|
|
{
|
2012-11-27 21:12:20 +00:00
|
|
|
|
PreAction(UndoGroup.TextureOffsetChange);
|
2013-03-18 13:52:27 +00:00
|
|
|
|
List<IVisualEventReceiver> objs = GetSelectedObjects(true, true, false, false);
|
2013-04-26 12:32:51 +00:00
|
|
|
|
foreach (IVisualEventReceiver i in objs) i.OnChangeTextureOffset(-1, 0, true);
|
2012-11-27 21:12:20 +00:00
|
|
|
|
PostAction();
|
2009-04-19 18:07:22 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[BeginAction("movetextureright")]
|
|
|
|
|
public void MoveTextureRight1()
|
|
|
|
|
{
|
2012-11-27 21:12:20 +00:00
|
|
|
|
PreAction(UndoGroup.TextureOffsetChange);
|
2013-03-18 13:52:27 +00:00
|
|
|
|
List<IVisualEventReceiver> objs = GetSelectedObjects(true, true, false, false);
|
2013-04-26 12:32:51 +00:00
|
|
|
|
foreach (IVisualEventReceiver i in objs) i.OnChangeTextureOffset(1, 0, true);
|
2012-11-27 21:12:20 +00:00
|
|
|
|
PostAction();
|
2009-04-19 18:07:22 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[BeginAction("movetextureup")]
|
|
|
|
|
public void MoveTextureUp1()
|
|
|
|
|
{
|
2012-11-27 21:12:20 +00:00
|
|
|
|
PreAction(UndoGroup.TextureOffsetChange);
|
2013-03-18 13:52:27 +00:00
|
|
|
|
List<IVisualEventReceiver> objs = GetSelectedObjects(true, true, false, false);
|
2013-04-26 12:32:51 +00:00
|
|
|
|
foreach (IVisualEventReceiver i in objs) i.OnChangeTextureOffset(0, -1, true);
|
2012-11-27 21:12:20 +00:00
|
|
|
|
PostAction();
|
2009-04-19 18:07:22 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[BeginAction("movetexturedown")]
|
|
|
|
|
public void MoveTextureDown1()
|
|
|
|
|
{
|
2012-11-27 21:12:20 +00:00
|
|
|
|
PreAction(UndoGroup.TextureOffsetChange);
|
2013-03-18 13:52:27 +00:00
|
|
|
|
List<IVisualEventReceiver> objs = GetSelectedObjects(true, true, false, false);
|
2013-04-26 12:32:51 +00:00
|
|
|
|
foreach (IVisualEventReceiver i in objs) i.OnChangeTextureOffset(0, 1, true);
|
2012-11-27 21:12:20 +00:00
|
|
|
|
PostAction();
|
2009-04-19 18:07:22 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[BeginAction("movetextureleft8")]
|
|
|
|
|
public void MoveTextureLeft8()
|
|
|
|
|
{
|
2012-11-27 21:12:20 +00:00
|
|
|
|
PreAction(UndoGroup.TextureOffsetChange);
|
2013-03-18 13:52:27 +00:00
|
|
|
|
List<IVisualEventReceiver> objs = GetSelectedObjects(true, true, false, false);
|
2013-04-26 12:32:51 +00:00
|
|
|
|
foreach (IVisualEventReceiver i in objs) i.OnChangeTextureOffset(-8, 0, true);
|
2012-11-27 21:12:20 +00:00
|
|
|
|
PostAction();
|
2009-04-19 18:07:22 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[BeginAction("movetextureright8")]
|
|
|
|
|
public void MoveTextureRight8()
|
|
|
|
|
{
|
2012-11-27 21:12:20 +00:00
|
|
|
|
PreAction(UndoGroup.TextureOffsetChange);
|
2013-03-18 13:52:27 +00:00
|
|
|
|
List<IVisualEventReceiver> objs = GetSelectedObjects(true, true, false, false);
|
2013-04-26 12:32:51 +00:00
|
|
|
|
foreach (IVisualEventReceiver i in objs) i.OnChangeTextureOffset(8, 0, true);
|
2012-11-27 21:12:20 +00:00
|
|
|
|
PostAction();
|
2009-04-19 18:07:22 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[BeginAction("movetextureup8")]
|
|
|
|
|
public void MoveTextureUp8()
|
|
|
|
|
{
|
2012-11-27 21:12:20 +00:00
|
|
|
|
PreAction(UndoGroup.TextureOffsetChange);
|
2013-03-18 13:52:27 +00:00
|
|
|
|
List<IVisualEventReceiver> objs = GetSelectedObjects(true, true, false, false);
|
2013-04-26 12:32:51 +00:00
|
|
|
|
foreach (IVisualEventReceiver i in objs) i.OnChangeTextureOffset(0, -8, true);
|
2012-11-27 21:12:20 +00:00
|
|
|
|
PostAction();
|
2009-04-19 18:07:22 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[BeginAction("movetexturedown8")]
|
|
|
|
|
public void MoveTextureDown8()
|
|
|
|
|
{
|
2012-11-27 21:12:20 +00:00
|
|
|
|
PreAction(UndoGroup.TextureOffsetChange);
|
2013-03-18 13:52:27 +00:00
|
|
|
|
List<IVisualEventReceiver> objs = GetSelectedObjects(true, true, false, false);
|
2013-04-26 12:32:51 +00:00
|
|
|
|
foreach (IVisualEventReceiver i in objs) i.OnChangeTextureOffset(0, 8, true);
|
2012-11-27 21:12:20 +00:00
|
|
|
|
PostAction();
|
2009-04-19 18:07:22 +00:00
|
|
|
|
}
|
|
|
|
|
|
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
|
|
|
|
//mxd
|
|
|
|
|
[BeginAction("scaletextureupx")]
|
|
|
|
|
public void ScaleTextureUpX() {
|
|
|
|
|
PreAction(UndoGroup.TextureScaleChange);
|
|
|
|
|
List<IVisualEventReceiver> objs = GetSelectedObjects(true, true, false, false);
|
2013-07-09 11:29:10 +00:00
|
|
|
|
foreach(IVisualEventReceiver i in objs) i.OnChangeTextureScale(-0.1f, 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
|
|
|
|
PostAction();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//mxd
|
|
|
|
|
[BeginAction("scaletexturedownx")]
|
|
|
|
|
public void ScaleTextureDownX() {
|
|
|
|
|
PreAction(UndoGroup.TextureScaleChange);
|
|
|
|
|
List<IVisualEventReceiver> objs = GetSelectedObjects(true, true, false, false);
|
2013-07-09 11:29:10 +00:00
|
|
|
|
foreach(IVisualEventReceiver i in objs) i.OnChangeTextureScale(0.1f, 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
|
|
|
|
PostAction();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//mxd
|
|
|
|
|
[BeginAction("scaletextureupy")]
|
|
|
|
|
public void ScaleTextureUpY() {
|
|
|
|
|
PreAction(UndoGroup.TextureScaleChange);
|
|
|
|
|
List<IVisualEventReceiver> objs = GetSelectedObjects(true, true, false, false);
|
2013-07-09 11:29:10 +00:00
|
|
|
|
foreach(IVisualEventReceiver i in objs) i.OnChangeTextureScale(0, 0.1f);
|
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
|
|
|
|
PostAction();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//mxd
|
|
|
|
|
[BeginAction("scaletexturedowny")]
|
|
|
|
|
public void ScaleTextureDownY() {
|
|
|
|
|
PreAction(UndoGroup.TextureScaleChange);
|
|
|
|
|
List<IVisualEventReceiver> objs = GetSelectedObjects(true, true, false, false);
|
2013-07-09 11:29:10 +00:00
|
|
|
|
foreach(IVisualEventReceiver i in objs) i.OnChangeTextureScale(0, -0.1f);
|
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
|
|
|
|
PostAction();
|
|
|
|
|
}
|
|
|
|
|
|
2009-04-19 18:07:22 +00:00
|
|
|
|
[BeginAction("textureselect")]
|
|
|
|
|
public void TextureSelect()
|
|
|
|
|
{
|
2009-05-05 09:50:23 +00:00
|
|
|
|
PreAction(UndoGroup.None);
|
2009-04-19 18:07:22 +00:00
|
|
|
|
renderer.SetCrosshairBusy(true);
|
|
|
|
|
General.Interface.RedrawDisplay();
|
2009-07-07 11:29:56 +00:00
|
|
|
|
GetTargetEventReceiver(false).OnSelectTexture();
|
2009-05-01 20:31:17 +00:00
|
|
|
|
UpdateChangedObjects();
|
2009-04-19 18:07:22 +00:00
|
|
|
|
renderer.SetCrosshairBusy(false);
|
2009-05-03 19:22:32 +00:00
|
|
|
|
PostAction();
|
2009-04-19 18:07:22 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[BeginAction("texturecopy")]
|
|
|
|
|
public void TextureCopy()
|
|
|
|
|
{
|
2009-05-03 19:22:32 +00:00
|
|
|
|
PreActionNoChange();
|
2009-07-07 11:29:56 +00:00
|
|
|
|
GetTargetEventReceiver(false).OnCopyTexture();
|
2009-05-03 19:22:32 +00:00
|
|
|
|
PostAction();
|
2009-04-19 18:07:22 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[BeginAction("texturepaste")]
|
|
|
|
|
public void TexturePaste()
|
|
|
|
|
{
|
2009-05-05 09:50:23 +00:00
|
|
|
|
PreAction(UndoGroup.None);
|
2013-03-18 13:52:27 +00:00
|
|
|
|
List<IVisualEventReceiver> objs = GetSelectedObjects(true, true, false, false);
|
2009-07-11 10:28:58 +00:00
|
|
|
|
foreach(IVisualEventReceiver i in objs) i.OnPasteTexture();
|
2009-05-03 19:22:32 +00:00
|
|
|
|
PostAction();
|
2009-04-19 18:07:22 +00:00
|
|
|
|
}
|
|
|
|
|
|
2013-04-04 10:14:44 +00:00
|
|
|
|
//mxd
|
|
|
|
|
[BeginAction("visualautoalign")]
|
|
|
|
|
public void TextureAutoAlign() {
|
|
|
|
|
PreAction(UndoGroup.None);
|
|
|
|
|
renderer.SetCrosshairBusy(true);
|
|
|
|
|
General.Interface.RedrawDisplay();
|
|
|
|
|
GetTargetEventReceiver(false).OnTextureAlign(true, true);
|
|
|
|
|
UpdateChangedObjects();
|
|
|
|
|
renderer.SetCrosshairBusy(false);
|
|
|
|
|
PostAction();
|
|
|
|
|
}
|
|
|
|
|
|
2009-04-19 18:07:22 +00:00
|
|
|
|
[BeginAction("visualautoalignx")]
|
|
|
|
|
public void TextureAutoAlignX()
|
|
|
|
|
{
|
2009-05-05 09:50:23 +00:00
|
|
|
|
PreAction(UndoGroup.None);
|
2009-04-19 18:07:22 +00:00
|
|
|
|
renderer.SetCrosshairBusy(true);
|
|
|
|
|
General.Interface.RedrawDisplay();
|
2009-07-07 11:29:56 +00:00
|
|
|
|
GetTargetEventReceiver(false).OnTextureAlign(true, false);
|
2009-05-01 20:31:17 +00:00
|
|
|
|
UpdateChangedObjects();
|
2009-04-19 18:07:22 +00:00
|
|
|
|
renderer.SetCrosshairBusy(false);
|
2009-05-03 19:22:32 +00:00
|
|
|
|
PostAction();
|
2009-04-19 18:07:22 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[BeginAction("visualautoaligny")]
|
|
|
|
|
public void TextureAutoAlignY()
|
|
|
|
|
{
|
2009-05-05 09:50:23 +00:00
|
|
|
|
PreAction(UndoGroup.None);
|
2009-04-19 18:07:22 +00:00
|
|
|
|
renderer.SetCrosshairBusy(true);
|
|
|
|
|
General.Interface.RedrawDisplay();
|
2009-07-07 11:29:56 +00:00
|
|
|
|
GetTargetEventReceiver(false).OnTextureAlign(false, true);
|
2009-05-01 20:31:17 +00:00
|
|
|
|
UpdateChangedObjects();
|
2009-04-19 18:07:22 +00:00
|
|
|
|
renderer.SetCrosshairBusy(false);
|
2009-05-03 19:22:32 +00:00
|
|
|
|
PostAction();
|
2009-04-19 18:07:22 +00:00
|
|
|
|
}
|
|
|
|
|
|
2013-05-02 07:47:22 +00:00
|
|
|
|
//mxd
|
|
|
|
|
[BeginAction("visualfittextures")]
|
|
|
|
|
public void TextureFit() {
|
|
|
|
|
PreAction(UndoGroup.None);
|
|
|
|
|
List<IVisualEventReceiver> objs = GetSelectedObjects(false, true, false, false);
|
|
|
|
|
foreach(IVisualEventReceiver i in objs) i.OnTextureFit(true, true);
|
|
|
|
|
PostAction();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//mxd
|
|
|
|
|
[BeginAction("visualfittexturesx")]
|
|
|
|
|
public void TextureFitX() {
|
|
|
|
|
PreAction(UndoGroup.None);
|
|
|
|
|
List<IVisualEventReceiver> objs = GetSelectedObjects(false, true, false, false);
|
|
|
|
|
foreach(IVisualEventReceiver i in objs) i.OnTextureFit(true, false);
|
|
|
|
|
PostAction();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//mxd
|
|
|
|
|
[BeginAction("visualfittexturesy")]
|
|
|
|
|
public void TextureFitY() {
|
|
|
|
|
PreAction(UndoGroup.None);
|
|
|
|
|
List<IVisualEventReceiver> objs = GetSelectedObjects(false, true, false, false);
|
|
|
|
|
foreach(IVisualEventReceiver i in objs) i.OnTextureFit(false, true);
|
|
|
|
|
PostAction();
|
|
|
|
|
}
|
|
|
|
|
|
2009-04-19 18:07:22 +00:00
|
|
|
|
[BeginAction("toggleupperunpegged")]
|
|
|
|
|
public void ToggleUpperUnpegged()
|
|
|
|
|
{
|
2009-05-05 09:50:23 +00:00
|
|
|
|
PreAction(UndoGroup.None);
|
2009-07-07 11:29:56 +00:00
|
|
|
|
GetTargetEventReceiver(false).OnToggleUpperUnpegged();
|
2009-05-03 19:22:32 +00:00
|
|
|
|
PostAction();
|
2009-04-19 18:07:22 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[BeginAction("togglelowerunpegged")]
|
|
|
|
|
public void ToggleLowerUnpegged()
|
|
|
|
|
{
|
2009-05-05 09:50:23 +00:00
|
|
|
|
PreAction(UndoGroup.None);
|
2009-07-07 11:29:56 +00:00
|
|
|
|
GetTargetEventReceiver(false).OnToggleLowerUnpegged();
|
2009-05-03 19:22:32 +00:00
|
|
|
|
PostAction();
|
2009-04-19 18:07:22 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[BeginAction("togglegravity")]
|
|
|
|
|
public void ToggleGravity()
|
|
|
|
|
{
|
|
|
|
|
BuilderPlug.Me.UseGravity = !BuilderPlug.Me.UseGravity;
|
|
|
|
|
string onoff = BuilderPlug.Me.UseGravity ? "ON" : "OFF";
|
|
|
|
|
General.Interface.DisplayStatus(StatusType.Action, "Gravity is now " + onoff + ".");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[BeginAction("togglebrightness")]
|
|
|
|
|
public void ToggleBrightness()
|
|
|
|
|
{
|
|
|
|
|
renderer.FullBrightness = !renderer.FullBrightness;
|
|
|
|
|
string onoff = renderer.FullBrightness ? "ON" : "OFF";
|
|
|
|
|
General.Interface.DisplayStatus(StatusType.Action, "Full Brightness is now " + onoff + ".");
|
|
|
|
|
}
|
2012-11-27 21:12:20 +00:00
|
|
|
|
|
2009-07-07 14:52:39 +00:00
|
|
|
|
[BeginAction("togglehighlight")]
|
|
|
|
|
public void ToggleHighlight()
|
|
|
|
|
{
|
|
|
|
|
BuilderPlug.Me.UseHighlight = !BuilderPlug.Me.UseHighlight;
|
|
|
|
|
string onoff = BuilderPlug.Me.UseHighlight ? "ON" : "OFF";
|
|
|
|
|
General.Interface.DisplayStatus(StatusType.Action, "Highlight is now " + onoff + ".");
|
|
|
|
|
}
|
2012-11-27 21:12:20 +00:00
|
|
|
|
|
2009-04-19 18:07:22 +00:00
|
|
|
|
[BeginAction("resettexture")]
|
|
|
|
|
public void ResetTexture()
|
|
|
|
|
{
|
2009-05-05 09:50:23 +00:00
|
|
|
|
PreAction(UndoGroup.None);
|
2013-03-18 13:52:27 +00:00
|
|
|
|
List<IVisualEventReceiver> objs = GetSelectedObjects(true, true, false, false);
|
2009-07-11 10:28:58 +00:00
|
|
|
|
foreach(IVisualEventReceiver i in objs) i.OnResetTextureOffset();
|
2009-05-03 19:22:32 +00:00
|
|
|
|
PostAction();
|
2009-04-19 18:07:22 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[BeginAction("floodfilltextures")]
|
|
|
|
|
public void FloodfillTextures()
|
|
|
|
|
{
|
2009-05-05 09:50:23 +00:00
|
|
|
|
PreAction(UndoGroup.None);
|
2009-07-07 11:29:56 +00:00
|
|
|
|
GetTargetEventReceiver(false).OnTextureFloodfill();
|
2009-05-03 19:22:32 +00:00
|
|
|
|
PostAction();
|
2009-04-19 18:07:22 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[BeginAction("texturecopyoffsets")]
|
|
|
|
|
public void TextureCopyOffsets()
|
|
|
|
|
{
|
2009-05-03 19:22:32 +00:00
|
|
|
|
PreActionNoChange();
|
2009-07-07 11:29:56 +00:00
|
|
|
|
GetTargetEventReceiver(false).OnCopyTextureOffsets();
|
2009-05-03 19:22:32 +00:00
|
|
|
|
PostAction();
|
2009-04-19 18:07:22 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[BeginAction("texturepasteoffsets")]
|
|
|
|
|
public void TexturePasteOffsets()
|
|
|
|
|
{
|
2009-05-05 09:50:23 +00:00
|
|
|
|
PreAction(UndoGroup.None);
|
2013-03-18 13:52:27 +00:00
|
|
|
|
List<IVisualEventReceiver> objs = GetSelectedObjects(true, true, false, false);
|
2009-07-11 10:28:58 +00:00
|
|
|
|
foreach(IVisualEventReceiver i in objs) i.OnPasteTextureOffsets();
|
2009-05-03 19:22:32 +00:00
|
|
|
|
PostAction();
|
2009-04-19 18:07:22 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[BeginAction("copyproperties")]
|
|
|
|
|
public void CopyProperties()
|
|
|
|
|
{
|
2009-05-03 19:22:32 +00:00
|
|
|
|
PreActionNoChange();
|
2009-07-07 11:29:56 +00:00
|
|
|
|
GetTargetEventReceiver(false).OnCopyProperties();
|
2009-05-03 19:22:32 +00:00
|
|
|
|
PostAction();
|
2009-04-19 18:07:22 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[BeginAction("pasteproperties")]
|
|
|
|
|
public void PasteProperties()
|
|
|
|
|
{
|
2009-05-05 09:50:23 +00:00
|
|
|
|
PreAction(UndoGroup.None);
|
2013-03-18 13:52:27 +00:00
|
|
|
|
List<IVisualEventReceiver> objs = GetSelectedObjects(true, true, true, true);
|
2009-07-11 10:28:58 +00:00
|
|
|
|
foreach(IVisualEventReceiver i in objs) i.OnPasteProperties();
|
2009-05-03 19:22:32 +00:00
|
|
|
|
PostAction();
|
2009-04-19 18:07:22 +00:00
|
|
|
|
}
|
|
|
|
|
|
2013-03-18 13:52:27 +00:00
|
|
|
|
//mxd. now we can insert things in Visual modes
|
2012-07-05 13:48:08 +00:00
|
|
|
|
[BeginAction("insertitem", BaseAction = true)]
|
2012-11-27 21:12:20 +00:00
|
|
|
|
public void InsertThing()
|
|
|
|
|
{
|
2013-05-29 14:18:49 +00:00
|
|
|
|
Vector2D hitpos = GetHitPosition();
|
2012-07-05 13:48:08 +00:00
|
|
|
|
|
|
|
|
|
if (!hitpos.IsFinite()) {
|
2012-11-27 21:12:20 +00:00
|
|
|
|
General.Interface.DisplayStatus(StatusType.Warning, "Cannot insert thing here!");
|
2012-07-05 13:48:08 +00:00
|
|
|
|
return;
|
|
|
|
|
}
|
2012-11-27 21:12:20 +00:00
|
|
|
|
|
2012-07-05 13:48:08 +00:00
|
|
|
|
ClearSelection();
|
|
|
|
|
PreActionNoChange();
|
2012-11-27 21:12:20 +00:00
|
|
|
|
General.Map.UndoRedo.ClearAllRedos();
|
2012-07-05 13:48:08 +00:00
|
|
|
|
General.Map.UndoRedo.CreateUndo("Insert thing");
|
|
|
|
|
|
2012-07-16 09:45:21 +00:00
|
|
|
|
Thing t = CreateThing(new Vector2D(hitpos.x, hitpos.y));
|
2012-07-05 13:48:08 +00:00
|
|
|
|
|
|
|
|
|
if (t == null) {
|
|
|
|
|
General.Map.UndoRedo.WithdrawUndo();
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Edit the thing?
|
|
|
|
|
if (BuilderPlug.Me.EditNewThing)
|
|
|
|
|
General.Interface.ShowEditThings(new List<Thing> { t });
|
|
|
|
|
|
|
|
|
|
//add thing to blockmap
|
|
|
|
|
blockmap.AddThing(t);
|
|
|
|
|
|
|
|
|
|
General.Interface.DisplayStatus(StatusType.Action, "Inserted a new thing.");
|
|
|
|
|
PostAction();
|
2012-11-27 21:12:20 +00:00
|
|
|
|
}
|
2012-07-05 13:48:08 +00:00
|
|
|
|
|
2013-05-02 07:47:22 +00:00
|
|
|
|
//mxd
|
2012-11-27 21:12:20 +00:00
|
|
|
|
[BeginAction("deleteitem", BaseAction = true)]
|
2013-07-31 12:38:47 +00:00
|
|
|
|
public void Delete()
|
2012-11-27 21:12:20 +00:00
|
|
|
|
{
|
2013-07-31 12:38:47 +00:00
|
|
|
|
PreAction(UndoGroup.None);
|
|
|
|
|
List<IVisualEventReceiver> objs = GetSelectedObjects(true, true, true, true);
|
|
|
|
|
foreach(IVisualEventReceiver i in objs) i.OnDelete();
|
|
|
|
|
PostAction();
|
|
|
|
|
|
|
|
|
|
ClearSelection();
|
2012-11-27 21:12:20 +00:00
|
|
|
|
}
|
2012-07-16 09:45:21 +00:00
|
|
|
|
|
|
|
|
|
//mxd
|
|
|
|
|
[BeginAction("copyselection", BaseAction = true)]
|
|
|
|
|
public void CopySelection() {
|
2013-03-18 13:52:27 +00:00
|
|
|
|
List<IVisualEventReceiver> objs = GetSelectedObjects(false, false, true, false);
|
2012-07-16 09:45:21 +00:00
|
|
|
|
if (objs.Count == 0) {
|
|
|
|
|
General.Interface.DisplayStatus(StatusType.Warning, "Nothing to copy, select some Things first!");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
copyBuffer.Clear();
|
|
|
|
|
foreach (IVisualEventReceiver i in objs) {
|
|
|
|
|
VisualThing vt = i as VisualThing;
|
|
|
|
|
if (vt != null) copyBuffer.Add(new ThingCopyData(vt.Thing));
|
|
|
|
|
}
|
|
|
|
|
General.Interface.DisplayStatus(StatusType.Info, "Copied " + copyBuffer.Count + " Things");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//mxd
|
|
|
|
|
[BeginAction("cutselection", BaseAction = true)]
|
|
|
|
|
public void CutSelection() {
|
|
|
|
|
CopySelection();
|
2013-07-31 12:38:47 +00:00
|
|
|
|
|
|
|
|
|
//Create undo
|
|
|
|
|
string rest = copyBuffer.Count + " thing" + (copyBuffer.Count > 1 ? "s." : ".");
|
|
|
|
|
CreateUndo("Cut " + rest);
|
|
|
|
|
General.Interface.DisplayStatus(StatusType.Info, "Cut " + rest);
|
|
|
|
|
|
|
|
|
|
List<IVisualEventReceiver> objs = GetSelectedObjects(false, false, true, false);
|
|
|
|
|
foreach (IVisualEventReceiver i in objs) {
|
|
|
|
|
BaseVisualThing thing = i as BaseVisualThing;
|
|
|
|
|
thing.Thing.Fields.BeforeFieldsChange();
|
|
|
|
|
thing.Thing.Dispose();
|
|
|
|
|
thing.Dispose();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
General.Map.IsChanged = true;
|
|
|
|
|
General.Map.ThingsFilter.Update();
|
2012-07-16 09:45:21 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//mxd. We'll just use currently selected objects
|
|
|
|
|
[BeginAction("pasteselection", BaseAction = true)]
|
|
|
|
|
public void PasteSelection() {
|
2012-11-27 21:12:20 +00:00
|
|
|
|
if(copyBuffer.Count == 0){
|
2012-07-16 09:45:21 +00:00
|
|
|
|
General.Interface.DisplayStatus(StatusType.Warning, "Nothing to paste, cut or copy some Things first!");
|
|
|
|
|
return;
|
|
|
|
|
}
|
2012-11-27 21:12:20 +00:00
|
|
|
|
|
2013-05-29 14:18:49 +00:00
|
|
|
|
Vector2D hitpos = GetHitPosition();
|
2012-07-16 09:45:21 +00:00
|
|
|
|
|
|
|
|
|
if (!hitpos.IsFinite()) {
|
|
|
|
|
General.Interface.DisplayStatus(StatusType.Warning, "Cannot paste here!");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
string rest = copyBuffer.Count + " thing" + (copyBuffer.Count > 1 ? "s." : ".");
|
2013-07-31 12:38:47 +00:00
|
|
|
|
General.Map.UndoRedo.CreateUndo("Paste " + rest);
|
2012-07-16 09:45:21 +00:00
|
|
|
|
General.Interface.DisplayStatus(StatusType.Info, "Pasted " + rest);
|
2012-11-27 21:12:20 +00:00
|
|
|
|
|
2012-07-16 09:45:21 +00:00
|
|
|
|
PreActionNoChange();
|
|
|
|
|
ClearSelection();
|
|
|
|
|
|
|
|
|
|
//get translated positions
|
|
|
|
|
Vector3D[] coords = new Vector3D[copyBuffer.Count];
|
2012-11-27 21:12:20 +00:00
|
|
|
|
for (int i = 0; i < copyBuffer.Count; i++ )
|
2012-07-16 09:45:21 +00:00
|
|
|
|
coords[i] = copyBuffer[i].Position;
|
|
|
|
|
|
|
|
|
|
Vector3D[] translatedCoords = translateCoordinates(coords, hitpos, true);
|
|
|
|
|
|
|
|
|
|
//create things from copyBuffer
|
|
|
|
|
for (int i = 0; i < copyBuffer.Count; i++) {
|
|
|
|
|
Thing t = CreateThing(new Vector2D());
|
|
|
|
|
if (t != null) {
|
|
|
|
|
copyBuffer[i].ApplyTo(t);
|
|
|
|
|
t.Move(translatedCoords[i]);
|
|
|
|
|
//add thing to blockmap
|
|
|
|
|
blockmap.AddThing(t);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
PostAction();
|
|
|
|
|
}
|
2012-08-05 19:18:05 +00:00
|
|
|
|
|
|
|
|
|
//mxd. rotate clockwise
|
|
|
|
|
[BeginAction("rotatethingscw")]
|
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
|
|
|
|
public void RotateCW() {
|
|
|
|
|
rotateThingsAndTextures(5);
|
2012-08-05 19:18:05 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//mxd. rotate counterclockwise
|
|
|
|
|
[BeginAction("rotatethingsccw")]
|
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
|
|
|
|
public void RotateCCW() {
|
|
|
|
|
rotateThingsAndTextures(-5);
|
|
|
|
|
}
|
2012-08-05 19:18:05 +00:00
|
|
|
|
|
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
|
|
|
|
//mxd
|
|
|
|
|
private void rotateThingsAndTextures(int increment) {
|
|
|
|
|
PreAction(UndoGroup.ThingRotate);
|
2012-08-05 19:18:05 +00:00
|
|
|
|
|
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
|
|
|
|
List<IVisualEventReceiver> selection = GetSelectedObjects(true, false, true, false);
|
|
|
|
|
if(selection.Count == 0) return;
|
2012-08-05 19:18:05 +00:00
|
|
|
|
|
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
|
|
|
|
foreach(IVisualEventReceiver obj in selection) {
|
|
|
|
|
if(obj is BaseVisualThing) {
|
|
|
|
|
BaseVisualThing t = obj as BaseVisualThing;
|
|
|
|
|
t.Rotate(General.ClampAngle(t.Thing.AngleDoom + increment));
|
|
|
|
|
}else if(obj is VisualFloor) {
|
|
|
|
|
VisualFloor vf = obj as VisualFloor;
|
|
|
|
|
vf.OnChangeTextureRotation(General.ClampAngle(vf.GetControlSector().Fields.GetValue("rotationfloor", 0.0f) + increment));
|
|
|
|
|
} else if(obj is VisualCeiling) {
|
|
|
|
|
VisualCeiling vc = obj as VisualCeiling;
|
|
|
|
|
vc.OnChangeTextureRotation(General.ClampAngle(vc.GetControlSector().Fields.GetValue("rotationceiling", 0.0f) + increment));
|
|
|
|
|
}
|
|
|
|
|
}
|
2012-08-05 19:18:05 +00:00
|
|
|
|
|
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
|
|
|
|
PostAction();
|
|
|
|
|
}
|
2012-11-27 21:12:20 +00:00
|
|
|
|
|
|
|
|
|
//mxd
|
|
|
|
|
[BeginAction("togglegzdoomrenderingeffects")]
|
|
|
|
|
public void ToggleGZDoomRenderingEffects() {
|
|
|
|
|
gzdoomRenderingEffects = !gzdoomRenderingEffects;
|
|
|
|
|
RebuildElementData();
|
|
|
|
|
UpdateChangedObjects();
|
|
|
|
|
General.Interface.DisplayStatus(StatusType.Info, "(G)ZDoom rendering effects are " + (gzdoomRenderingEffects ? "ENABLED" : "DISABLED"));
|
|
|
|
|
}
|
2013-03-18 13:52:27 +00:00
|
|
|
|
|
|
|
|
|
//mxd
|
|
|
|
|
[BeginAction("thingaligntowall")]
|
|
|
|
|
public void AlignThingsToWall() {
|
|
|
|
|
List<VisualThing> visualThings = GetSelectedVisualThings(true);
|
|
|
|
|
|
|
|
|
|
if(visualThings.Count == 0) {
|
|
|
|
|
General.Interface.DisplayStatus(StatusType.Warning, "This action requires selected Things!");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
List<Thing> things = new List<Thing>();
|
|
|
|
|
|
|
|
|
|
foreach(VisualThing vt in visualThings)
|
|
|
|
|
things.Add(vt.Thing);
|
|
|
|
|
|
|
|
|
|
// Make undo
|
|
|
|
|
if(things.Count > 1) {
|
|
|
|
|
General.Map.UndoRedo.CreateUndo("Align " + things.Count + " things");
|
|
|
|
|
General.Interface.DisplayStatus(StatusType.Action, "Aligned " + things.Count + " things.");
|
|
|
|
|
} else {
|
|
|
|
|
General.Map.UndoRedo.CreateUndo("Align thing");
|
|
|
|
|
General.Interface.DisplayStatus(StatusType.Action, "Aligned a thing.");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//align things
|
|
|
|
|
int thingsCount = General.Map.Map.Things.Count;
|
|
|
|
|
|
|
|
|
|
foreach(Thing t in things) {
|
|
|
|
|
List<Linedef> excludedLines = new List<Linedef>();
|
|
|
|
|
bool aligned = false;
|
|
|
|
|
|
|
|
|
|
do {
|
|
|
|
|
Linedef l = General.Map.Map.NearestLinedef(t.Position, excludedLines);
|
|
|
|
|
aligned = Tools.TryAlignThingToLine(t, l);
|
|
|
|
|
|
|
|
|
|
if(!aligned) {
|
|
|
|
|
excludedLines.Add(l);
|
|
|
|
|
|
|
|
|
|
if(excludedLines.Count == thingsCount) {
|
|
|
|
|
ThingTypeInfo tti = General.Map.Data.GetThingInfo(t.Type);
|
|
|
|
|
General.ErrorLogger.Add(ErrorType.Warning, "Unable to align Thing <20>" + t.Index + " (" + tti.Title + ") to any linedef in a map!");
|
|
|
|
|
aligned = true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} while(!aligned);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//apply changes to Visual Things
|
|
|
|
|
for(int i = 0; i < visualThings.Count; i++) {
|
|
|
|
|
BaseVisualThing t = visualThings[i] as BaseVisualThing;
|
|
|
|
|
t.Changed = true;
|
|
|
|
|
|
|
|
|
|
// Update what must be updated
|
|
|
|
|
ThingData td = GetThingData(t.Thing);
|
|
|
|
|
foreach(KeyValuePair<Sector, bool> s in td.UpdateAlso) {
|
|
|
|
|
if(VisualSectorExists(s.Key)) {
|
|
|
|
|
BaseVisualSector vs = (BaseVisualSector)GetVisualSector(s.Key);
|
|
|
|
|
vs.UpdateSectorGeometry(s.Value);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
UpdateChangedObjects();
|
|
|
|
|
ShowTargetInfo();
|
|
|
|
|
}
|
2013-04-26 12:32:51 +00:00
|
|
|
|
|
|
|
|
|
//mxd
|
|
|
|
|
[BeginAction("toggleslope")]
|
|
|
|
|
public void ToggleSlope() {
|
|
|
|
|
List<VisualGeometry> selection = GetSelectedSurfaces();
|
|
|
|
|
|
|
|
|
|
if(selection.Count == 0) {
|
|
|
|
|
General.Interface.DisplayStatus(StatusType.Warning, "Toggle Slope action requires selected surfaces!");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool update = false;
|
|
|
|
|
List<BaseVisualSector> toUpdate = new List<BaseVisualSector>();
|
|
|
|
|
General.Map.UndoRedo.CreateUndo("Toggle Slope");
|
|
|
|
|
|
|
|
|
|
//check selection
|
|
|
|
|
foreach(VisualGeometry vg in selection) {
|
|
|
|
|
update = false;
|
|
|
|
|
|
|
|
|
|
//assign/remove action
|
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(vg.GeometryType == VisualGeometryType.WALL_LOWER) {
|
2013-04-26 12:32:51 +00:00
|
|
|
|
if(vg.Sidedef.Line.Action == 0 || (vg.Sidedef.Line.Action == 181 && vg.Sidedef.Line.Args[0] == 0)) {
|
|
|
|
|
//check if the sector already has floor slopes
|
|
|
|
|
foreach(Sidedef side in vg.Sidedef.Sector.Sidedefs) {
|
2013-05-02 07:47:22 +00:00
|
|
|
|
if(side == vg.Sidedef || side.Line.Action != 181) continue;
|
2013-04-26 12:32:51 +00:00
|
|
|
|
|
|
|
|
|
int arg = (side == side.Line.Front ? 1 : 2);
|
|
|
|
|
|
|
|
|
|
if(side.Line.Args[0] == arg) {
|
|
|
|
|
//if only floor is affected, remove action
|
|
|
|
|
if(side.Line.Args[1] == 0)
|
|
|
|
|
side.Line.Action = 0;
|
|
|
|
|
else //clear floor alignment
|
|
|
|
|
side.Line.Args[0] = 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//set action
|
|
|
|
|
vg.Sidedef.Line.Action = 181;
|
|
|
|
|
vg.Sidedef.Line.Args[0] = (vg.Sidedef == vg.Sidedef.Line.Front ? 1 : 2);
|
|
|
|
|
update = true;
|
|
|
|
|
}
|
|
|
|
|
} else if(vg.GeometryType == VisualGeometryType.WALL_UPPER) {
|
|
|
|
|
if(vg.Sidedef.Line.Action == 0 || (vg.Sidedef.Line.Action == 181 && vg.Sidedef.Line.Args[1] == 0)) {
|
|
|
|
|
//check if the sector already has ceiling slopes
|
|
|
|
|
foreach(Sidedef side in vg.Sidedef.Sector.Sidedefs) {
|
2013-05-02 07:47:22 +00:00
|
|
|
|
if(side == vg.Sidedef || side.Line.Action != 181) continue;
|
2013-04-26 12:32:51 +00:00
|
|
|
|
|
|
|
|
|
int arg = (side == side.Line.Front ? 1 : 2);
|
|
|
|
|
|
|
|
|
|
if(side.Line.Args[1] == arg) {
|
|
|
|
|
//if only ceiling is affected, remove action
|
|
|
|
|
if(side.Line.Args[0] == 0)
|
|
|
|
|
side.Line.Action = 0;
|
|
|
|
|
else //clear ceiling alignment
|
|
|
|
|
side.Line.Args[1] = 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//set action
|
|
|
|
|
vg.Sidedef.Line.Action = 181;
|
|
|
|
|
vg.Sidedef.Line.Args[1] = (vg.Sidedef == vg.Sidedef.Line.Front ? 1 : 2);
|
|
|
|
|
update = true;
|
|
|
|
|
}
|
|
|
|
|
} else if(vg.GeometryType == VisualGeometryType.CEILING) {
|
|
|
|
|
//check if the sector has ceiling slopes
|
|
|
|
|
foreach(Sidedef side in vg.Sector.Sector.Sidedefs) {
|
2013-05-02 07:47:22 +00:00
|
|
|
|
if(side.Line.Action != 181) continue;
|
2013-04-26 12:32:51 +00:00
|
|
|
|
|
|
|
|
|
int arg = (side == side.Line.Front ? 1 : 2);
|
|
|
|
|
|
|
|
|
|
if(side.Line.Args[1] == arg) {
|
|
|
|
|
//if only ceiling is affected, remove action
|
|
|
|
|
if(side.Line.Args[0] == 0)
|
|
|
|
|
side.Line.Action = 0;
|
|
|
|
|
else //clear ceiling alignment
|
|
|
|
|
side.Line.Args[1] = 0;
|
|
|
|
|
|
|
|
|
|
update = true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} else if(vg.GeometryType == VisualGeometryType.FLOOR) {
|
|
|
|
|
//check if the sector has floor slopes
|
|
|
|
|
foreach(Sidedef side in vg.Sector.Sector.Sidedefs) {
|
2013-05-02 07:47:22 +00:00
|
|
|
|
if(side.Line.Action != 181) continue;
|
2013-04-26 12:32:51 +00:00
|
|
|
|
|
|
|
|
|
int arg = (side == side.Line.Front ? 1 : 2);
|
|
|
|
|
|
|
|
|
|
if(side.Line.Args[0] == arg) {
|
|
|
|
|
//if only floor is affected, remove action
|
|
|
|
|
if(side.Line.Args[1] == 0)
|
|
|
|
|
side.Line.Action = 0;
|
|
|
|
|
else //clear floor alignment
|
|
|
|
|
side.Line.Args[0] = 0;
|
|
|
|
|
|
|
|
|
|
update = true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//add to update list
|
2013-05-02 07:47:22 +00:00
|
|
|
|
if(update) toUpdate.Add(vg.Sector as BaseVisualSector);
|
2013-04-26 12:32:51 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//update changed geometry
|
|
|
|
|
if(toUpdate.Count > 0) {
|
|
|
|
|
RebuildElementData();
|
|
|
|
|
|
|
|
|
|
foreach(BaseVisualSector vs in toUpdate)
|
|
|
|
|
vs.UpdateSectorGeometry(true);
|
|
|
|
|
|
|
|
|
|
UpdateChangedObjects();
|
|
|
|
|
ClearSelection();
|
|
|
|
|
ShowTargetInfo();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
General.Interface.DisplayStatus(StatusType.Action, "Toggled Slope for " + toUpdate.Count + (toUpdate.Count == 1 ? " surface." : " surfaces."));
|
|
|
|
|
}
|
2009-04-19 18:07:22 +00:00
|
|
|
|
|
|
|
|
|
#endregion
|
2013-03-18 13:52:27 +00:00
|
|
|
|
|
|
|
|
|
#region ================== Texture Alignment
|
|
|
|
|
|
|
|
|
|
//mxd
|
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
|
|
|
|
internal void AutoAlignTextures(BaseVisualGeometrySidedef start, ImageData texture, bool alignx, bool aligny, bool resetsidemarks) {
|
2013-03-18 13:52:27 +00:00
|
|
|
|
if(General.Map.UDMF)
|
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
|
|
|
|
autoAlignTexturesUDMF(start, texture, alignx, aligny, resetsidemarks);
|
2013-03-18 13:52:27 +00:00
|
|
|
|
else
|
|
|
|
|
autoAlignTextures(start, texture, alignx, aligny, resetsidemarks);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//mxd. Moved here from Tools
|
|
|
|
|
// This performs texture alignment along all walls that match with the same texture
|
|
|
|
|
// NOTE: This method uses the sidedefs marking to indicate which sides have been aligned
|
|
|
|
|
// When resetsidemarks is set to true, all sidedefs will first be marked false (not aligned).
|
|
|
|
|
// Setting resetsidemarks to false is usefull to align only within a specific selection
|
|
|
|
|
// (set the marked property to true for the sidedefs outside the selection)
|
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
|
|
|
|
private void autoAlignTextures(BaseVisualGeometrySidedef start, ImageData texture, bool alignx, bool aligny, bool resetsidemarks) {
|
2013-03-18 13:52:27 +00:00
|
|
|
|
Stack<SidedefAlignJob> todo = new Stack<SidedefAlignJob>(50);
|
|
|
|
|
float scalex = (General.Map.Config.ScaledTextureOffsets && !texture.WorldPanning) ? texture.Scale.x : 1.0f;
|
|
|
|
|
float scaley = (General.Map.Config.ScaledTextureOffsets && !texture.WorldPanning) ? texture.Scale.y : 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
|
|
|
|
// Mark all sidedefs false (they will be marked true when the texture is aligned). mxd. Don't seem to be used anywhere...
|
2013-03-18 13:52:27 +00:00
|
|
|
|
if(resetsidemarks)
|
|
|
|
|
General.Map.Map.ClearMarkedSidedefs(false);
|
|
|
|
|
|
|
|
|
|
// Begin with first sidedef
|
|
|
|
|
SidedefAlignJob first = new SidedefAlignJob();
|
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
|
|
|
|
first.sidedef = start.Sidedef;
|
|
|
|
|
first.offsetx = start.Sidedef.OffsetX;
|
|
|
|
|
int ystartalign = start.Sidedef.OffsetY; //mxd
|
2013-03-18 13:52:27 +00:00
|
|
|
|
|
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
|
|
|
|
//mxd
|
|
|
|
|
if(start.GeometryType == VisualGeometryType.WALL_MIDDLE_3D) {
|
|
|
|
|
first.controlSide = start.GetControlLinedef().Front;
|
|
|
|
|
first.offsetx += first.controlSide.OffsetX;
|
|
|
|
|
ystartalign += first.controlSide.OffsetY;
|
|
|
|
|
} else {
|
|
|
|
|
first.controlSide = start.Sidedef;
|
|
|
|
|
}
|
2013-03-18 13:52:27 +00:00
|
|
|
|
|
|
|
|
|
first.forward = true;
|
|
|
|
|
todo.Push(first);
|
|
|
|
|
|
|
|
|
|
// Continue until nothing more to align
|
|
|
|
|
while(todo.Count > 0) {
|
|
|
|
|
// Get the align job to do
|
|
|
|
|
SidedefAlignJob j = todo.Pop();
|
|
|
|
|
|
|
|
|
|
if(j.forward) {
|
|
|
|
|
Vertex v;
|
|
|
|
|
int forwardoffset;
|
|
|
|
|
int backwardoffset;
|
|
|
|
|
|
|
|
|
|
// Apply alignment
|
|
|
|
|
if(alignx)
|
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
|
|
|
|
j.controlSide.OffsetX = (int)j.offsetx;
|
2013-03-18 13:52:27 +00:00
|
|
|
|
if(aligny)
|
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
|
|
|
|
j.sidedef.OffsetY = (int)Math.Round((first.controlSide.Sector.CeilHeight - j.controlSide.Sector.CeilHeight) / scaley) + ystartalign;
|
2013-03-18 13:52:27 +00:00
|
|
|
|
forwardoffset = (int)j.offsetx + (int)Math.Round(j.sidedef.Line.Length / scalex);
|
|
|
|
|
backwardoffset = (int)j.offsetx;
|
|
|
|
|
|
|
|
|
|
j.sidedef.Marked = true;
|
|
|
|
|
|
|
|
|
|
// Wrap the value within the width of the texture (to prevent ridiculous values)
|
|
|
|
|
// NOTE: We don't use ScaledWidth here because the texture offset is in pixels, not mappixels
|
|
|
|
|
if(texture.IsImageLoaded) {
|
|
|
|
|
if(alignx)
|
|
|
|
|
j.sidedef.OffsetX %= texture.Width;
|
|
|
|
|
if(aligny)
|
|
|
|
|
j.sidedef.OffsetY %= texture.Height;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Add sidedefs forward (connected to the right vertex)
|
|
|
|
|
v = j.sidedef.IsFront ? j.sidedef.Line.End : j.sidedef.Line.Start;
|
2013-04-03 14:50:41 +00:00
|
|
|
|
AddSidedefsForAlignment(todo, v, true, forwardoffset, 1.0f, texture.LongName, false);
|
2013-03-18 13:52:27 +00:00
|
|
|
|
|
|
|
|
|
// Add sidedefs backward (connected to the left vertex)
|
|
|
|
|
v = j.sidedef.IsFront ? j.sidedef.Line.Start : j.sidedef.Line.End;
|
2013-04-03 14:50:41 +00:00
|
|
|
|
AddSidedefsForAlignment(todo, v, false, backwardoffset, 1.0f, texture.LongName, false);
|
2013-03-18 13:52:27 +00:00
|
|
|
|
} else {
|
|
|
|
|
Vertex v;
|
|
|
|
|
int forwardoffset;
|
|
|
|
|
int backwardoffset;
|
|
|
|
|
|
|
|
|
|
// Apply alignment
|
|
|
|
|
if(alignx)
|
|
|
|
|
j.sidedef.OffsetX = (int)j.offsetx - (int)Math.Round(j.sidedef.Line.Length / scalex);
|
|
|
|
|
if(aligny)
|
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
|
|
|
|
j.sidedef.OffsetY = (int)Math.Round((first.controlSide.Sector.CeilHeight - j.controlSide.Sector.CeilHeight) / scaley) + ystartalign;
|
2013-03-18 13:52:27 +00:00
|
|
|
|
forwardoffset = (int)j.offsetx;
|
|
|
|
|
backwardoffset = (int)j.offsetx - (int)Math.Round(j.sidedef.Line.Length / scalex);
|
|
|
|
|
|
|
|
|
|
j.sidedef.Marked = true;
|
|
|
|
|
|
|
|
|
|
// Wrap the value within the width of the texture (to prevent ridiculous values)
|
|
|
|
|
// NOTE: We don't use ScaledWidth here because the texture offset is in pixels, not mappixels
|
|
|
|
|
if(texture.IsImageLoaded) {
|
|
|
|
|
if(alignx)
|
|
|
|
|
j.sidedef.OffsetX %= texture.Width;
|
|
|
|
|
if(aligny)
|
|
|
|
|
j.sidedef.OffsetY %= texture.Height;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Add sidedefs backward (connected to the left vertex)
|
|
|
|
|
v = j.sidedef.IsFront ? j.sidedef.Line.Start : j.sidedef.Line.End;
|
2013-04-03 14:50:41 +00:00
|
|
|
|
AddSidedefsForAlignment(todo, v, false, backwardoffset, 1.0f, texture.LongName, false);
|
2013-03-18 13:52:27 +00:00
|
|
|
|
|
|
|
|
|
// Add sidedefs forward (connected to the right vertex)
|
|
|
|
|
v = j.sidedef.IsFront ? j.sidedef.Line.End : j.sidedef.Line.Start;
|
2013-04-03 14:50:41 +00:00
|
|
|
|
AddSidedefsForAlignment(todo, v, true, forwardoffset, 1.0f, texture.LongName, false);
|
2013-03-18 13:52:27 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//mxd. Moved here from GZDoomEditing plugin
|
|
|
|
|
// This performs UDMF texture alignment along all walls that match with the same texture
|
|
|
|
|
// NOTE: This method uses the sidedefs marking to indicate which sides have been aligned
|
|
|
|
|
// When resetsidemarks is set to true, all sidedefs will first be marked false (not aligned).
|
|
|
|
|
// Setting resetsidemarks to false is usefull to align only within a specific selection
|
|
|
|
|
// (set the marked property to true for the sidedefs outside the selection)
|
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
|
|
|
|
private void autoAlignTexturesUDMF(BaseVisualGeometrySidedef start, ImageData texture, bool alignx, bool aligny, bool resetsidemarks) {
|
|
|
|
|
// Mark all sidedefs false (they will be marked true when the texture is aligned)
|
|
|
|
|
if(resetsidemarks) General.Map.Map.ClearMarkedSidedefs(false);
|
|
|
|
|
if(!texture.IsImageLoaded) return;
|
|
|
|
|
|
2013-03-18 13:52:27 +00:00
|
|
|
|
Stack<SidedefAlignJob> todo = new Stack<SidedefAlignJob>(50);
|
|
|
|
|
float scalex = (General.Map.Config.ScaledTextureOffsets && !texture.WorldPanning) ? texture.Scale.x : 1.0f;
|
|
|
|
|
float scaley = (General.Map.Config.ScaledTextureOffsets && !texture.WorldPanning) ? texture.Scale.y : 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
|
|
|
|
Sidedef startControlSide = (start.GeometryType == VisualGeometryType.WALL_MIDDLE_3D ? start.GetControlLinedef().Front : start.Sidedef);
|
2013-03-18 13:52:27 +00:00
|
|
|
|
|
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
|
|
|
|
//mxd
|
|
|
|
|
List<BaseVisualGeometrySidedef> selectedVisualSides = new List<BaseVisualGeometrySidedef>();
|
|
|
|
|
if(!singleselection) {
|
|
|
|
|
foreach(IVisualEventReceiver i in selectedobjects) {
|
|
|
|
|
if(i is BaseVisualGeometrySidedef) {
|
|
|
|
|
BaseVisualGeometrySidedef sd = i as BaseVisualGeometrySidedef;
|
|
|
|
|
if(!selectedVisualSides.Contains(sd)) selectedVisualSides.Add(sd);
|
|
|
|
|
}
|
|
|
|
|
}
|
2013-03-18 13:52:27 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
SidedefAlignJob first = new SidedefAlignJob();
|
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
|
|
|
|
|
|
|
|
|
//mxd. scaleY
|
|
|
|
|
switch(start.GeometryType) {
|
|
|
|
|
case VisualGeometryType.WALL_UPPER:
|
|
|
|
|
first.scaleY = start.Sidedef.Fields.GetValue("scaley_top", 1.0f);
|
2013-03-18 13:52:27 +00:00
|
|
|
|
break;
|
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
|
|
|
|
case VisualGeometryType.WALL_MIDDLE:
|
|
|
|
|
case VisualGeometryType.WALL_MIDDLE_3D:
|
|
|
|
|
first.scaleY = startControlSide.Fields.GetValue("scaley_mid", 1.0f);
|
2013-04-03 14:50:41 +00:00
|
|
|
|
break;
|
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
|
|
|
|
case VisualGeometryType.WALL_LOWER:
|
|
|
|
|
first.scaleY = start.Sidedef.Fields.GetValue("scaley_bottom", 1.0f);
|
2013-03-18 13:52:27 +00:00
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
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
|
|
|
|
// Determine the Y alignment
|
|
|
|
|
float ystartalign = start.Sidedef.OffsetY;
|
|
|
|
|
switch(start.GeometryType) {
|
|
|
|
|
case VisualGeometryType.WALL_UPPER:
|
|
|
|
|
ystartalign += GetTopOffsetY(start.Sidedef, start.Sidedef.Fields.GetValue("offsety_top", 0.0f), first.scaleY, false);//mxd
|
|
|
|
|
break;
|
|
|
|
|
case VisualGeometryType.WALL_MIDDLE:
|
|
|
|
|
ystartalign += GetMiddleOffsetY(start.Sidedef, start.Sidedef.Fields.GetValue("offsety_mid", 0.0f), first.scaleY, false);//mxd
|
|
|
|
|
break;
|
|
|
|
|
case VisualGeometryType.WALL_MIDDLE_3D: //mxd. 3d-floors are not affected by Lower/Upper unpegged flags
|
|
|
|
|
ystartalign += startControlSide.OffsetY - (start.Sidedef.Sector.CeilHeight - startControlSide.Sector.CeilHeight);
|
|
|
|
|
ystartalign += start.Sidedef.Fields.GetValue("offsety_mid", 0.0f);
|
|
|
|
|
ystartalign += startControlSide.Fields.GetValue("offsety_mid", 0.0f);
|
|
|
|
|
break;
|
|
|
|
|
case VisualGeometryType.WALL_LOWER:
|
|
|
|
|
ystartalign += GetBottomOffsetY(start.Sidedef, start.Sidedef.Fields.GetValue("offsety_bottom", 0.0f), first.scaleY, false);//mxd
|
|
|
|
|
break;
|
2013-03-18 13:52:27 +00:00
|
|
|
|
}
|
|
|
|
|
|
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
|
|
|
|
// Begin with first sidedef
|
|
|
|
|
first.sidedef = start.Sidedef;
|
|
|
|
|
first.offsetx = start.Sidedef.OffsetX;
|
|
|
|
|
switch(start.GeometryType) {
|
|
|
|
|
case VisualGeometryType.WALL_UPPER:
|
|
|
|
|
first.offsetx += start.Sidedef.Fields.GetValue("offsetx_top", 0.0f);
|
|
|
|
|
break;
|
|
|
|
|
case VisualGeometryType.WALL_MIDDLE:
|
|
|
|
|
first.offsetx += start.Sidedef.Fields.GetValue("offsetx_mid", 0.0f);
|
2013-04-03 14:50:41 +00:00
|
|
|
|
break;
|
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
|
|
|
|
case VisualGeometryType.WALL_MIDDLE_3D: //mxd. Yup, 4 sets of texture offsets are used
|
|
|
|
|
first.offsetx += start.Sidedef.Fields.GetValue("offsetx_mid", 0.0f);
|
|
|
|
|
first.offsetx += startControlSide.OffsetX;
|
|
|
|
|
first.offsetx += startControlSide.Fields.GetValue("offsetx_mid", 0.0f);
|
2013-04-03 14:50:41 +00:00
|
|
|
|
break;
|
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
|
|
|
|
case VisualGeometryType.WALL_LOWER:
|
|
|
|
|
first.offsetx += start.Sidedef.Fields.GetValue("offsetx_bottom", 0.0f);
|
2013-04-03 14:50:41 +00:00
|
|
|
|
break;
|
|
|
|
|
}
|
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
|
|
|
|
first.forward = true;
|
|
|
|
|
first.controlSide = startControlSide; //mxd
|
2013-03-18 13:52:27 +00:00
|
|
|
|
todo.Push(first);
|
|
|
|
|
|
|
|
|
|
// Continue until nothing more to align
|
|
|
|
|
while(todo.Count > 0) {
|
|
|
|
|
Vertex v;
|
|
|
|
|
float forwardoffset;
|
|
|
|
|
float backwardoffset;
|
|
|
|
|
float offsetscalex = 1.0f;
|
|
|
|
|
|
|
|
|
|
// Get the align job to do
|
|
|
|
|
SidedefAlignJob j = todo.Pop();
|
|
|
|
|
|
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
|
|
|
|
bool matchtop = (!j.sidedef.Marked && (j.sidedef.LongHighTexture == texture.LongName) && j.sidedef.HighRequired());
|
|
|
|
|
bool matchbottom = (!j.sidedef.Marked && (j.sidedef.LongLowTexture == texture.LongName) && j.sidedef.LowRequired());
|
2013-07-31 12:38:47 +00:00
|
|
|
|
bool matchmid = ((j.controlSide.LongMiddleTexture == texture.LongName) && (j.controlSide.MiddleRequired() || ((j.controlSide.MiddleTexture.Length > 0) && (j.controlSide.MiddleTexture != "-")))); //mxd
|
2013-03-18 13:52:27 +00:00
|
|
|
|
|
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
|
|
|
|
//mxd. If there's a selection, check if matched part is actually selected
|
|
|
|
|
if(!singleselection) {
|
|
|
|
|
if(matchtop) matchtop = sidePartIsSelected(selectedVisualSides, j.sidedef, VisualGeometryType.WALL_UPPER);
|
|
|
|
|
if(matchbottom) matchbottom = sidePartIsSelected(selectedVisualSides, j.sidedef, VisualGeometryType.WALL_LOWER);
|
|
|
|
|
if(matchmid) matchmid = sidePartIsSelected(selectedVisualSides, j.sidedef, VisualGeometryType.WALL_MIDDLE) ||
|
|
|
|
|
sidePartIsSelected(selectedVisualSides, j.sidedef, VisualGeometryType.WALL_MIDDLE_3D);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(!matchbottom && !matchtop && !matchmid) continue; //mxd
|
|
|
|
|
|
2013-03-18 13:52:27 +00:00
|
|
|
|
if(matchtop)
|
|
|
|
|
offsetscalex = j.sidedef.Fields.GetValue("scalex_top", 1.0f);
|
|
|
|
|
else if(matchbottom)
|
|
|
|
|
offsetscalex = j.sidedef.Fields.GetValue("scalex_bottom", 1.0f);
|
|
|
|
|
else if(matchmid)
|
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
|
|
|
|
offsetscalex = j.controlSide.Fields.GetValue("scalex_mid", 1.0f);
|
|
|
|
|
|
2013-04-03 14:50:41 +00:00
|
|
|
|
j.sidedef.Fields.BeforeFieldsChange();
|
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
|
|
|
|
j.controlSide.Fields.BeforeFieldsChange(); //mxd
|
|
|
|
|
|
|
|
|
|
//mxd. Apply scaleY
|
|
|
|
|
if(matchtop) UDMFTools.SetFloat(j.sidedef.Fields, "scaley_top", j.scaleY, 1.0f, false);
|
|
|
|
|
if(matchmid) UDMFTools.SetFloat(j.controlSide.Fields, "scaley_mid", j.scaleY, 1.0f, false);
|
|
|
|
|
if(matchbottom) UDMFTools.SetFloat(j.sidedef.Fields, "scaley_bottom", j.scaleY, 1.0f, false);
|
2013-04-03 14:50:41 +00:00
|
|
|
|
|
2013-03-18 13:52:27 +00:00
|
|
|
|
if(j.forward) {
|
|
|
|
|
// Apply alignment
|
|
|
|
|
if(alignx) {
|
|
|
|
|
float offset = j.offsetx;
|
|
|
|
|
offset -= j.sidedef.OffsetX;
|
|
|
|
|
|
|
|
|
|
if(matchtop)
|
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
|
|
|
|
j.sidedef.Fields["offsetx_top"] = new UniValue(UniversalType.Float, offset % (float)texture.Width);
|
2013-03-18 13:52:27 +00:00
|
|
|
|
if(matchbottom)
|
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
|
|
|
|
j.sidedef.Fields["offsetx_bottom"] = new UniValue(UniversalType.Float, offset % (float)texture.Width);
|
|
|
|
|
if(matchmid) {
|
|
|
|
|
if(j.sidedef.Index != j.controlSide.Index) { //mxd. if it's a part of 3d-floor
|
|
|
|
|
offset -= j.controlSide.OffsetX;
|
|
|
|
|
offset -= j.controlSide.Fields.GetValue("offsetx_mid", 0.0f);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
j.sidedef.Fields["offsetx_mid"] = new UniValue(UniversalType.Float, offset % (float)texture.Width);
|
|
|
|
|
}
|
2013-03-18 13:52:27 +00:00
|
|
|
|
}
|
|
|
|
|
|
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(aligny) {
|
|
|
|
|
float offset = ((float)(start.Sidedef.Sector.CeilHeight - j.controlSide.Sector.CeilHeight) / scaley) * j.scaleY + ystartalign; //mxd
|
|
|
|
|
offset -= j.sidedef.OffsetY; //mxd
|
|
|
|
|
offset = (float)Math.Round(offset); //mxd
|
|
|
|
|
|
2013-03-18 13:52:27 +00:00
|
|
|
|
if(matchtop)
|
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
|
|
|
|
j.sidedef.Fields["offsety_top"] = new UniValue(UniversalType.Float, GetTopOffsetY(j.sidedef, offset, j.scaleY, true) % (float)texture.Height); //mxd
|
2013-03-18 13:52:27 +00:00
|
|
|
|
if(matchbottom)
|
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
|
|
|
|
j.sidedef.Fields["offsety_bottom"] = new UniValue(UniversalType.Float, GetBottomOffsetY(j.sidedef, offset, j.scaleY, true) % (float)texture.Height); //mxd
|
2013-03-18 13:52:27 +00:00
|
|
|
|
if(matchmid) {
|
|
|
|
|
//mxd. Side is part of a 3D floor?
|
|
|
|
|
if(j.sidedef.Index != j.controlSide.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
|
|
|
|
offset -= j.controlSide.OffsetY;
|
|
|
|
|
offset -= j.controlSide.Fields.GetValue("offsety_mid", 0.0f);
|
|
|
|
|
j.sidedef.Fields["offsety_mid"] = new UniValue(UniversalType.Float, offset % (float)texture.Height);
|
|
|
|
|
} else {
|
|
|
|
|
j.sidedef.Fields["offsety_mid"] = new UniValue(UniversalType.Float, GetMiddleOffsetY(j.sidedef, offset, j.scaleY, true) % (float)texture.Height);//mxd
|
2013-03-18 13:52:27 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
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
|
|
|
|
|
2013-03-18 13:52:27 +00:00
|
|
|
|
forwardoffset = j.offsetx + (int)Math.Round(j.sidedef.Line.Length / scalex * offsetscalex);
|
|
|
|
|
backwardoffset = j.offsetx;
|
|
|
|
|
|
|
|
|
|
// Done this sidedef
|
|
|
|
|
j.sidedef.Marked = 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
|
|
|
|
j.controlSide.Marked = true;
|
2013-03-18 13:52:27 +00:00
|
|
|
|
|
|
|
|
|
// Add sidedefs backward (connected to the left vertex)
|
|
|
|
|
v = j.sidedef.IsFront ? j.sidedef.Line.Start : j.sidedef.Line.End;
|
2013-04-03 14:50:41 +00:00
|
|
|
|
AddSidedefsForAlignment(todo, v, false, backwardoffset, j.scaleY, texture.LongName, true);
|
2013-03-18 13:52:27 +00:00
|
|
|
|
|
|
|
|
|
// Add sidedefs forward (connected to the right vertex)
|
|
|
|
|
v = j.sidedef.IsFront ? j.sidedef.Line.End : j.sidedef.Line.Start;
|
2013-04-03 14:50:41 +00:00
|
|
|
|
AddSidedefsForAlignment(todo, v, true, forwardoffset, j.scaleY, texture.LongName, true);
|
2013-03-18 13:52:27 +00:00
|
|
|
|
} else {
|
|
|
|
|
// Apply alignment
|
|
|
|
|
if(alignx) {
|
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
|
|
|
|
float offset = j.offsetx - (int)Math.Round(j.sidedef.Line.Length / scalex * offsetscalex);
|
2013-03-18 13:52:27 +00:00
|
|
|
|
offset -= j.sidedef.OffsetX;
|
|
|
|
|
|
|
|
|
|
if(matchtop)
|
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
|
|
|
|
j.sidedef.Fields["offsetx_top"] = new UniValue(UniversalType.Float, offset % (float)texture.Width);
|
2013-03-18 13:52:27 +00:00
|
|
|
|
if(matchbottom)
|
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
|
|
|
|
j.sidedef.Fields["offsetx_bottom"] = new UniValue(UniversalType.Float, offset % (float)texture.Width);
|
|
|
|
|
if(matchmid) {
|
|
|
|
|
if(j.sidedef.Index != j.controlSide.Index) { //mxd
|
|
|
|
|
offset -= j.controlSide.OffsetX;
|
|
|
|
|
offset -= j.controlSide.Fields.GetValue("offsetx_mid", 0.0f);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
j.sidedef.Fields["offsetx_mid"] = new UniValue(UniversalType.Float, offset % (float)texture.Width);
|
|
|
|
|
}
|
2013-03-18 13:52:27 +00:00
|
|
|
|
}
|
|
|
|
|
if(aligny) {
|
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
|
|
|
|
float offset = ((float)(start.Sidedef.Sector.CeilHeight - j.controlSide.Sector.CeilHeight) / scaley) * j.scaleY + ystartalign; //mxd
|
|
|
|
|
offset -= j.sidedef.OffsetY; //mxd
|
|
|
|
|
offset = (float)Math.Round(offset); //mxd
|
2013-03-18 13:52:27 +00:00
|
|
|
|
|
|
|
|
|
if(matchtop)
|
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
|
|
|
|
j.sidedef.Fields["offsety_top"] = new UniValue(UniversalType.Float, GetTopOffsetY(j.sidedef, offset, j.scaleY, true) % (float)texture.Height); //mxd
|
2013-03-18 13:52:27 +00:00
|
|
|
|
if(matchbottom)
|
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
|
|
|
|
j.sidedef.Fields["offsety_bottom"] = new UniValue(UniversalType.Float, GetBottomOffsetY(j.sidedef, offset, j.scaleY, true) % (float)texture.Height); //mxd
|
2013-03-18 13:52:27 +00:00
|
|
|
|
if(matchmid) {
|
|
|
|
|
//mxd. Side is part of a 3D floor?
|
|
|
|
|
if(j.sidedef.Index != j.controlSide.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
|
|
|
|
offset -= j.controlSide.OffsetY;
|
|
|
|
|
offset -= j.controlSide.Fields.GetValue("offsety_mid", 0.0f);
|
|
|
|
|
j.sidedef.Fields["offsety_mid"] = new UniValue(UniversalType.Float, offset % (float)texture.Height); //mxd
|
|
|
|
|
} else {
|
|
|
|
|
j.sidedef.Fields["offsety_mid"] = new UniValue(UniversalType.Float, GetMiddleOffsetY(j.sidedef, offset, j.scaleY, true) % (float)texture.Height); //mxd
|
2013-03-18 13:52:27 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
forwardoffset = j.offsetx;
|
|
|
|
|
backwardoffset = j.offsetx - (int)Math.Round(j.sidedef.Line.Length / scalex * offsetscalex);
|
|
|
|
|
|
|
|
|
|
// Done this sidedef
|
|
|
|
|
j.sidedef.Marked = 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
|
|
|
|
j.controlSide.Marked = true;
|
2013-03-18 13:52:27 +00:00
|
|
|
|
|
|
|
|
|
// Add sidedefs forward (connected to the right vertex)
|
|
|
|
|
v = j.sidedef.IsFront ? j.sidedef.Line.End : j.sidedef.Line.Start;
|
2013-04-03 14:50:41 +00:00
|
|
|
|
AddSidedefsForAlignment(todo, v, true, forwardoffset, j.scaleY, texture.LongName, true);
|
2013-03-18 13:52:27 +00:00
|
|
|
|
|
|
|
|
|
// Add sidedefs backward (connected to the left vertex)
|
|
|
|
|
v = j.sidedef.IsFront ? j.sidedef.Line.Start : j.sidedef.Line.End;
|
2013-04-03 14:50:41 +00:00
|
|
|
|
AddSidedefsForAlignment(todo, v, false, backwardoffset, j.scaleY, texture.LongName, true);
|
2013-03-18 13:52:27 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// This adds the matching, unmarked sidedefs from a vertex for texture alignment
|
2013-04-03 14:50:41 +00:00
|
|
|
|
private void AddSidedefsForAlignment(Stack<SidedefAlignJob> stack, Vertex v, bool forward, float offsetx, float scaleY, long texturelongname, bool udmf) {
|
2013-03-18 13:52:27 +00:00
|
|
|
|
foreach(Linedef ld in v.Linedefs) {
|
|
|
|
|
Sidedef side1 = forward ? ld.Front : ld.Back;
|
|
|
|
|
Sidedef side2 = forward ? ld.Back : ld.Front;
|
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
|
|
|
|
|
2013-03-18 13:52:27 +00:00
|
|
|
|
if((ld.Start == v) && (side1 != null) && !side1.Marked) {
|
|
|
|
|
List<Sidedef> controlSides = getControlSides(side1, udmf);//mxd
|
|
|
|
|
|
|
|
|
|
foreach(Sidedef s in controlSides) {
|
|
|
|
|
if(Tools.SidedefTextureMatch(s, texturelongname)) {
|
|
|
|
|
SidedefAlignJob nj = new SidedefAlignJob();
|
|
|
|
|
nj.forward = forward;
|
|
|
|
|
nj.offsetx = offsetx;
|
2013-04-03 14:50:41 +00:00
|
|
|
|
nj.scaleY = scaleY; //mxd
|
2013-03-18 13:52:27 +00:00
|
|
|
|
nj.sidedef = side1;
|
2013-04-03 14:50:41 +00:00
|
|
|
|
nj.controlSide = s; //mxd
|
2013-03-18 13:52:27 +00:00
|
|
|
|
stack.Push(nj);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} else if((ld.End == v) && (side2 != null) && !side2.Marked) {
|
|
|
|
|
List<Sidedef> controlSides = getControlSides(side2, udmf);//mxd
|
|
|
|
|
|
|
|
|
|
foreach(Sidedef s in controlSides) {
|
|
|
|
|
if(Tools.SidedefTextureMatch(s, texturelongname)) {
|
|
|
|
|
SidedefAlignJob nj = new SidedefAlignJob();
|
|
|
|
|
nj.forward = forward;
|
|
|
|
|
nj.offsetx = offsetx;
|
2013-04-03 14:50:41 +00:00
|
|
|
|
nj.scaleY = scaleY; //mxd
|
2013-03-18 13:52:27 +00:00
|
|
|
|
nj.sidedef = side2;
|
2013-04-03 14:50:41 +00:00
|
|
|
|
nj.controlSide = s; //mxd
|
2013-03-18 13:52:27 +00:00
|
|
|
|
stack.Push(nj);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
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
|
|
|
|
//mxd
|
|
|
|
|
private bool sidePartIsSelected(List<BaseVisualGeometrySidedef> selection, Sidedef side, VisualGeometryType geoType) {
|
|
|
|
|
foreach(BaseVisualGeometrySidedef vs in selection)
|
|
|
|
|
if(vs.GeometryType == geoType && vs.Sidedef.Index == side.Index) return true;
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
2013-04-03 14:50:41 +00:00
|
|
|
|
//mxd. This converts offsetY from/to "normalized" offset for given upper wall
|
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
|
|
|
|
internal float GetTopOffsetY(Sidedef side, float offset, float scaleY, bool fromNormalized) {
|
2013-04-03 14:50:41 +00:00
|
|
|
|
if(side.Line.IsFlagSet(General.Map.Config.UpperUnpeggedFlag) || side.Other == null || side.Other.Sector == null)
|
|
|
|
|
return offset;
|
|
|
|
|
|
|
|
|
|
//if we don't have UpperUnpegged flag, normalize offset
|
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
|
|
|
|
float surfaceHeight = (side.Sector.CeilHeight - side.Other.Sector.CeilHeight) * scaleY;
|
2013-04-03 14:50:41 +00:00
|
|
|
|
|
|
|
|
|
if(fromNormalized) return (float)Math.Round(offset + surfaceHeight);
|
|
|
|
|
return (float)Math.Round(offset - surfaceHeight);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//mxd. This converts offsetY from/to "normalized" offset for given middle wall
|
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
|
|
|
|
internal float GetMiddleOffsetY(Sidedef side, float offset, float scaleY, bool fromNormalized) {
|
2013-04-03 14:50:41 +00:00
|
|
|
|
if(!side.Line.IsFlagSet(General.Map.Config.LowerUnpeggedFlag) || side.Sector == null)
|
|
|
|
|
return offset;
|
|
|
|
|
|
|
|
|
|
//if we have LowerUnpegged flag, normalize offset
|
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
|
|
|
|
float surfaceHeight = (side.Sector.CeilHeight - side.Sector.FloorHeight) * scaleY;
|
2013-04-03 14:50:41 +00:00
|
|
|
|
|
|
|
|
|
if(fromNormalized) return (float)Math.Round(offset + surfaceHeight);
|
|
|
|
|
return (float)Math.Round(offset - surfaceHeight);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//mxd. This converts offsetY from/to "normalized" offset for given lower wall
|
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
|
|
|
|
internal float GetBottomOffsetY(Sidedef side, float offset, float scaleY, bool fromNormalized) {
|
2013-04-03 14:50:41 +00:00
|
|
|
|
if(side.Line.IsFlagSet(General.Map.Config.LowerUnpeggedFlag) || side.Other == null || side.Other.Sector == null)
|
|
|
|
|
return offset;
|
|
|
|
|
|
2013-05-02 07:47:22 +00:00
|
|
|
|
//normalize offset
|
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
|
|
|
|
float surfaceHeight = (side.Sector.CeilHeight - side.Other.Sector.FloorHeight) * scaleY;
|
|
|
|
|
|
2013-04-03 14:50:41 +00:00
|
|
|
|
if(fromNormalized) return (float)Math.Round(offset + surfaceHeight);
|
|
|
|
|
return (float)Math.Round(offset - surfaceHeight);
|
|
|
|
|
}
|
|
|
|
|
|
2013-03-18 13:52:27 +00:00
|
|
|
|
//mxd
|
|
|
|
|
private List<Sidedef> getControlSides(Sidedef side, bool udmf) {
|
|
|
|
|
if(side.Other == null) return new List<Sidedef>() { side };
|
|
|
|
|
if(side.Other.Sector.Tag == 0) return new List<Sidedef>() { side };
|
|
|
|
|
|
|
|
|
|
SectorData data = GetSectorData(side.Other.Sector);
|
|
|
|
|
if(data.ExtraFloors.Count == 0) return new List<Sidedef>() { side };
|
|
|
|
|
|
|
|
|
|
List<Sidedef> sides = new List<Sidedef>();
|
|
|
|
|
foreach(Effect3DFloor ef in data.ExtraFloors)
|
|
|
|
|
sides.Add(ef.Linedef.Front);
|
|
|
|
|
|
|
|
|
|
if(udmf)
|
|
|
|
|
sides.Add(side); //UDMF map format
|
|
|
|
|
else
|
|
|
|
|
sides.Insert(0, side); //Doom/Hexen map format: if a sidedef has lower/upper parts, they take predecence in alignment
|
|
|
|
|
|
|
|
|
|
return sides;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endregion
|
2009-04-19 18:07:22 +00:00
|
|
|
|
}
|
|
|
|
|
}
|