2009-04-19 18:07:22 +00:00
#region = = = = = = = = = = = = = = = = = = Copyright ( c ) 2007 Pascal vd Heiden
/ *
* Copyright ( c ) 2007 Pascal vd Heiden , www . codeimp . com
* This program is released under GNU General Public License
*
* This program is distributed in the hope that it will be useful ,
* but WITHOUT ANY WARRANTY ; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the
* GNU General Public License for more details .
*
* /
#endregion
#region = = = = = = = = = = = = = = = = = = Namespaces
using System ;
using System.Collections.Generic ;
2020-02-16 19:51:16 +00:00
using System.Diagnostics ;
2019-12-30 23:08:17 +00:00
using System.Linq ;
2009-04-19 18:07:22 +00:00
using System.Windows.Forms ;
Removed "Paste Properties Options" action.
Added "Paste Properties Special" actions in "Classic" and "Visual" categories. They work the same way as "Paste Special" action.
Added: "Copy Properties", "Paste Properties" and "Paste Properties Special" options are now shown in the Edit menu if current classic mode supports them.
Changed, Paste Properties Special window: only options relevant to current map format are now displayed.
Changed, Paste Properties Special window, UDMF: all UI-managed options are now available.
Fixed: MAPINFO parser was unable to process "include" directives.
Fixed, General interface: selection info was reset to "Nothing selected" after few seconds regardless of current selection.
Fixed, Visual mode: thing bounding boxes were not updated when changing things positions using Randomize mode.
Fixed, Visual mode: event lines were displayed at incorrect height when entering Visual mode for the first time.
Fixed, Texture Browser window: when MixTexturesFlats Game Configuration option is disabled, textures/flats are no longer shown in the Used group when flats/textures with the same names are used in the map.
Fixed(?): probably fixed an exception some users reported when trying to initialize a Classic mode after switching from Visual mode with "Sync cameras" option enabled.
Changed, Game configurations, Thing Categories: a block must have at least one thing category property to be recognized as a thing category.
Changed, Visplane Explorer: the plugin now outputs more info when it fails to initialize vpo.dll.
Cosmetic, Thing Edit window, Doom/Hexen map format: adjusted UI layout so thing flags control no longer displays scrollbars in Hexen map format.
Internal: merged methods from UDMFTools into UniFields, removed UDMFTools.
Updated Inno Setup script (added VC++ 2008 SP1 distributive).
Updated ZDoom_DECORATE.cfg (A_CheckBlock).
Updated documentation (added "System Requirements" page).
2015-10-09 12:38:12 +00:00
using CodeImp.DoomBuilder.BuilderModes.Interface ;
2009-04-19 18:07:22 +00:00
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 ;
2009-04-19 18:07:22 +00:00
#endregion
namespace CodeImp.DoomBuilder.BuilderModes
{
2020-11-01 10:31:57 +00:00
[ EditMode ( DisplayName = "Visual Mode" ,
2012-11-27 21:12:20 +00:00
SwitchAction = "gzdbvisualmode" , // Action name used to switch to this mode
2020-11-01 10:31:57 +00:00
ButtonImage = "VisualMode.png" , // Image resource name for the button
2012-11-27 21:12:20 +00:00
ButtonOrder = 1 , // Position of the button (lower is more to the left)
2009-04-19 18:07:22 +00:00
ButtonGroup = "001_visual" ,
2013-09-11 09:47:53 +00:00
UseByDefault = true ) ]
2009-04-19 18:07:22 +00:00
public class BaseVisualMode : VisualMode
{
#region = = = = = = = = = = = = = = = = = = Constants
// Object picking
2016-03-14 00:01:21 +00:00
private const long PICK_INTERVAL = 80 ;
2019-01-19 07:56:13 +00:00
private const long PICK_INTERVAL_PAINT_SELECT = 10 ; // biwa
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 ;
2020-05-23 08:37:42 +00:00
private double cameraflooroffset = 41.0 ; // same as in doom
private double cameraceilingoffset = 10.0 ;
2009-04-19 18:07:22 +00:00
// Object picking
private VisualPickResult target ;
2016-03-14 00:01:21 +00:00
private long lastpicktime ;
2009-04-19 18:07:22 +00:00
private bool locktarget ;
2013-03-18 13:52:27 +00:00
private bool useSelectionFromClassicMode ; //mxd
2014-10-28 14:35:59 +00:00
private readonly Timer selectioninfoupdatetimer ; //mxd
2013-03-18 13:52:27 +00:00
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 ;
2015-09-10 17:38:27 +00:00
2013-09-11 09:47:53 +00:00
//mxd. Used in Cut/PasteSelection actions
2015-09-10 17:38:27 +00:00
private readonly List < ThingCopyData > copybuffer ;
private Type lasthighlighttype ;
2013-03-18 13:52:27 +00:00
2019-01-19 07:56:13 +00:00
// biwa. Info for paint selection
protected bool paintselectpressed ;
protected Type paintselecttype = null ;
protected IVisualPickable highlighted ; // biwa
2013-03-18 13:52:27 +00:00
//mxd. Moved here from Tools
private struct SidedefAlignJob
{
public Sidedef sidedef ;
2020-05-21 12:20:02 +00:00
public double offsetx ;
public double scaleX ; //mxd
public double scaleY ; //mxd
2013-03-18 13:52:27 +00:00
2014-09-22 14:33:15 +00:00
private Sidedef controlside ; //mxd
2015-10-02 14:47:34 +00:00
public Sidedef controlSide
{
2014-09-22 14:33:15 +00:00
get
{
return controlside ;
}
set
{
controlside = value ;
ceilingheight = ( controlside . Index ! = sidedef . Index & & controlside . Line . Args [ 1 ] = = 0 ? controlside . Sector . FloorHeight : controlside . Sector . CeilHeight ) ;
}
}
private int ceilingheight ; //mxd
public int ceilingHeight { get { return ceilingheight ; } } //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?
2016-03-18 12:52:12 +00:00
VisualGeometry vg = target . picked as VisualGeometry ;
if ( vg ! = null )
2009-05-17 14:00:36 +00:00
{
2016-03-18 12:52:12 +00:00
if ( vg . Sidedef ! = null ) return vg . Sidedef ;
if ( vg . Sector ! = null ) return vg . Sector ;
2014-10-28 10:30:11 +00:00
return null ;
2009-05-17 14:00:36 +00:00
}
// Thing picked?
2016-03-18 12:52:12 +00:00
VisualThing vt = target . picked as VisualThing ;
if ( vt ! = null ) return vt . Thing ;
2014-10-28 10:30:11 +00:00
return null ;
2009-05-17 14:00:36 +00:00
}
}
2014-01-08 09:46:57 +00:00
public object HighlightedTarget { get { return target . picked ; } } //mxd
public bool UseSelectionFromClassicMode { get { return useSelectionFromClassicMode ; } } //mxd
2013-05-29 14:18:49 +00:00
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
2019-01-19 07:56:13 +00:00
public bool PaintSelectPressed { get { return paintselectpressed ; } } // biwa
public Type PaintSelectType { get { return paintselecttype ; } set { paintselecttype = value ; } } // biwa
public IVisualPickable Highlighted { get { return highlighted ; } } // biwa
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 > ( ) ;
2015-09-10 17:38:27 +00:00
2013-09-11 09:47:53 +00:00
//mxd
2015-09-10 17:38:27 +00:00
this . copybuffer = new List < ThingCopyData > ( ) ;
2014-10-28 10:30:11 +00:00
this . selectioninfoupdatetimer = new Timer ( ) ;
selectioninfoupdatetimer . Interval = 100 ;
selectioninfoupdatetimer . Tick + = SelectioninfoupdatetimerOnTick ;
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
2016-03-18 12:52:12 +00:00
selectioninfoupdatetimer . Dispose ( ) ; //mxd
2009-04-19 18:07:22 +00:00
// 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
2013-09-11 09:47:53 +00:00
//mxd. This calculates brightness level with doom-style shading
2014-10-28 10:30:11 +00:00
internal int CalculateBrightness ( int level , Sidedef sd )
{
2013-09-11 09:47:53 +00:00
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 ;
2014-10-28 10:30:11 +00:00
selectioninfoupdatetimer . Start ( ) ; //mxd
2009-07-07 11:29:56 +00:00
}
// This removes a selected object
internal void RemoveSelectedObject ( IVisualEventReceiver obj )
{
selectedobjects . Remove ( obj ) ;
selectionchanged = true ;
2014-10-28 10:30:11 +00:00
selectioninfoupdatetimer . Start ( ) ; //mxd
2009-07-07 11:29:56 +00:00
}
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 ( ) ;
2019-12-27 16:00:13 +00:00
2009-05-01 20:31:17 +00:00
PickTargetUnlocked ( ) ;
2019-12-27 16:00:13 +00:00
2009-05-01 20:31:17 +00:00
// If the action is not performed on a selected object, clear the
// current selection and make a temporary selection for the target.
2019-12-27 16:00:13 +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 ;
2019-12-27 16:00:13 +00:00
// Only clear the selection if anything is selected, since it can be very time consuming on huge maps
if ( BuilderPlug . Me . VisualModeClearSelection & & selectedobjects . Count > 0 )
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
2019-12-26 08:08:11 +00:00
foreach ( KeyValuePair < Sector , VisualSector > vs in allsectors )
2009-05-04 06:13:56 +00:00
{
2019-12-26 08:08:11 +00:00
BaseVisualSector bvs = ( BaseVisualSector ) vs . Value ;
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 ;
2019-12-27 16:00:13 +00:00
// Only clear the selection if anything is selected, since it can be very time consuming on huge maps
if ( singleselection & & selectedobjects . Count > 0 ) ClearSelection ( ) ;
2009-05-03 19:22:32 +00:00
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 )
{
2014-02-07 09:10:55 +00:00
actionresult = new VisualActionResult { displaystatus = displaystatus } ;
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-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 ) ;
2014-01-23 13:36:51 +00:00
return General . Map . UndoRedo . CreateUndo ( description , this , UndoGroup . None , 0 ) ;
2009-05-03 19:22:32 +00:00
}
2014-01-23 13:36:51 +00:00
return 0 ;
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 > ( ) ;
2019-12-26 08:08:11 +00:00
foreach ( KeyValuePair < Sector , VisualSector > vs in allsectors )
2009-05-03 19:22:32 +00:00
{
2019-12-26 08:08:11 +00:00
if ( vs . Value ! = null )
2009-05-03 19:22:32 +00:00
{
2019-12-26 08:08:11 +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 ) ;
2020-10-23 18:56:50 +00:00
// Also check extra floors
if ( bvs . ExtraFloors . Count > 0 )
foreach ( VisualFloor vf in bvs . ExtraFloors )
if ( vf . Selected ) selectedobjects . Add ( vf ) ;
if ( bvs . ExtraBackFloors . Count > 0 )
foreach ( VisualFloor vf in bvs . ExtraBackFloors )
if ( vf . Selected ) selectedobjects . Add ( vf ) ;
// Also check extra ceilings
if ( bvs . ExtraCeilings . Count > 0 )
foreach ( VisualCeiling vc in bvs . ExtraCeilings )
if ( vc . Selected ) selectedobjects . Add ( vc ) ;
if ( bvs . ExtraBackCeilings . Count > 0 )
foreach ( VisualCeiling vc in bvs . ExtraBackCeilings )
if ( vc . Selected ) selectedobjects . Add ( vc ) ;
foreach ( Sidedef sd in vs . Key . Sidedefs )
2009-05-03 19:22:32 +00:00
{
2019-12-26 08:08:11 +00:00
List < VisualGeometry > sidedefgeos = bvs . GetSidedefGeometry ( sd ) ;
foreach ( VisualGeometry sdg in sidedefgeos )
{
if ( sdg . Selected ) selectedobjects . Add ( ( IVisualEventReceiver ) sdg ) ;
}
2009-05-03 19:22:32 +00:00
}
}
}
2019-12-26 08:08:11 +00:00
foreach ( KeyValuePair < Thing , VisualThing > vt in allthings )
2009-05-03 19:22:32 +00:00
{
2019-12-26 08:08:11 +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
2014-10-28 10:30:11 +00:00
if ( General . Map . UDMF & & General . Settings . GZShowVisualVertices )
{
foreach ( KeyValuePair < Vertex , VisualVertexPair > pair in vertices )
{
2014-02-03 11:19:12 +00:00
if ( pair . Value . CeilingVertex . Selected )
selectedobjects . Add ( ( BaseVisualVertex ) pair . Value . CeilingVertex ) ;
if ( pair . Value . FloorVertex . Selected )
selectedobjects . Add ( ( BaseVisualVertex ) pair . Value . FloorVertex ) ;
2013-03-18 13:52:27 +00:00
}
}
2014-10-28 10:30:11 +00:00
2019-12-30 23:08:17 +00:00
if ( General . Map . UDMF )
{
foreach ( KeyValuePair < Sector , List < VisualSlope > > kvp in allslopehandles )
{
2021-01-30 21:45:08 +00:00
foreach ( BaseVisualSlope handle in kvp . Value )
if ( handle . Selected ) selectedobjects . Add ( handle ) ;
2019-12-30 23:08:17 +00:00
}
}
2014-10-28 10:30:11 +00:00
//mxd
UpdateSelectionInfo ( ) ;
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
2014-10-28 10:30:11 +00:00
internal BaseVisualSector CreateBaseVisualSector ( Sector s )
{
2012-11-27 21:12:20 +00:00
BaseVisualSector vs = new BaseVisualSector ( this , s ) ;
2019-12-26 08:08:11 +00:00
allsectors . Add ( s , vs ) ;
2012-11-27 21:12:20 +00:00
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 ) ;
2019-12-26 08:08:11 +00:00
allsectors . Add ( s , vs ) ; //mxd
2009-04-19 18:07:22 +00:00
return vs ;
}
2019-12-30 23:08:17 +00:00
internal VisualSlope CreateVisualSlopeHandle ( SectorLevel level , Sidedef sd , bool up )
{
VisualSidedefSlope handle = new VisualSidedefSlope ( this , level , sd , up ) ;
if ( ! allslopehandles . ContainsKey ( sd . Sector ) )
allslopehandles . Add ( sd . Sector , new List < VisualSlope > ( ) ) ;
2021-01-30 21:01:55 +00:00
if ( ! sidedefslopehandles . ContainsKey ( sd . Sector ) )
sidedefslopehandles . Add ( sd . Sector , new List < VisualSlope > ( ) ) ;
2019-12-30 23:08:17 +00:00
allslopehandles [ sd . Sector ] . Add ( handle ) ;
2021-01-30 21:01:55 +00:00
sidedefslopehandles [ sd . Sector ] . Add ( handle ) ;
return handle ;
}
internal VisualSlope CreateVisualSlopeHandle ( SectorLevel level , Vertex v , Sector s , bool up )
{
VisualVertexSlope handle = new VisualVertexSlope ( this , level , v , s , up ) ;
/ *
if ( ! allslopehandles . ContainsKey ( level . sector ) )
allslopehandles . Add ( level . sector , new List < VisualSlope > ( ) ) ;
if ( ! vertexslopehandles . ContainsKey ( level . sector ) )
vertexslopehandles . Add ( level . sector , new List < VisualSlope > ( ) ) ;
allslopehandles [ level . sector ] . Add ( handle ) ;
vertexslopehandles [ level . sector ] . Add ( handle ) ;
* /
if ( ! allslopehandles . ContainsKey ( s ) )
allslopehandles . Add ( s , new List < VisualSlope > ( ) ) ;
if ( ! vertexslopehandles . ContainsKey ( s ) )
vertexslopehandles . Add ( s , new List < VisualSlope > ( ) ) ;
allslopehandles [ s ] . Add ( handle ) ;
vertexslopehandles [ s ] . Add ( handle ) ;
2019-12-30 23:08:17 +00:00
return handle ;
}
2009-04-19 18:07:22 +00:00
// 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 ) ;
2020-02-24 11:54:59 +00:00
if ( updateinfo )
{
2021-02-06 13:51:00 +00:00
if ( target . picked is VisualSlope ) // Old target
{
// Don't render old slope handle anymore
if ( ! ( ( VisualSlope ) target . picked ) . Selected & & ! ( ( VisualSlope ) target . picked ) . Pivot )
renderslopehandles . Remove ( ( VisualSlope ) target . picked ) ;
// Clear smart pivot handles, otherwise it will keep being displayed
foreach ( KeyValuePair < Sector , List < VisualSlope > > kvp in allslopehandles )
foreach ( VisualSlope checkhandle in kvp . Value )
{
if ( checkhandle . SmartPivot )
{
checkhandle . SmartPivot = false ;
if ( ! checkhandle . Selected & & ! checkhandle . Pivot )
renderslopehandles . Remove ( checkhandle ) ;
}
}
}
2020-02-24 11:54:59 +00:00
if ( newtarget . picked is VisualSidedefSlope )
{
2021-02-06 13:51:00 +00:00
renderslopehandles . Add ( ( VisualSidedefSlope ) newtarget . picked ) ;
2020-02-24 11:54:59 +00:00
// Get the smart pivot handle for the targeted slope handle, so that it can be drawn
2021-01-30 21:01:55 +00:00
VisualSlope handle = VisualSidedefSlope . GetSmartPivotHandle ( ( VisualSidedefSlope ) newtarget . picked , this ) ;
2020-02-24 11:54:59 +00:00
if ( handle ! = null )
2021-02-06 13:51:00 +00:00
{
2020-02-24 11:54:59 +00:00
handle . SmartPivot = true ;
2021-02-06 13:51:00 +00:00
renderslopehandles . Add ( handle ) ;
}
2020-02-24 11:54:59 +00:00
}
2021-01-30 21:01:55 +00:00
else if ( newtarget . picked is VisualVertexSlope )
{
2021-02-06 13:51:00 +00:00
renderslopehandles . Add ( ( VisualVertexSlope ) newtarget . picked ) ;
2021-01-30 21:01:55 +00:00
// Get the smart pivot handle for the targeted slope handle, so that it can be drawn
VisualSlope handle = VisualVertexSlope . GetSmartPivotHandle ( ( VisualVertexSlope ) newtarget . picked , this ) ;
if ( handle ! = null )
2021-02-06 13:51:00 +00:00
{
2021-01-30 21:01:55 +00:00
handle . SmartPivot = true ;
2021-02-06 13:51:00 +00:00
renderslopehandles . Add ( handle ) ;
}
2020-02-24 11:54:59 +00:00
}
}
2009-04-19 18:07:22 +00:00
// Apply new target
target = newtarget ;
// Show target info
2020-02-24 11:54:59 +00:00
if ( updateinfo )
ShowTargetInfo ( ) ;
2009-04-19 18:07:22 +00:00
}
// This shows the picked target information
public void ShowTargetInfo ( )
{
// Any result?
if ( target . picked ! = null )
{
// Geometry picked?
if ( target . picked is VisualGeometry )
{
2016-03-18 12:52:12 +00:00
VisualGeometry pickedgeo = ( VisualGeometry ) target . picked ;
2012-11-27 21:12:20 +00:00
// Sidedef?
if ( pickedgeo is BaseVisualGeometrySidedef )
{
2016-03-18 12:52:12 +00:00
BaseVisualGeometrySidedef pickedsidedef = ( BaseVisualGeometrySidedef ) pickedgeo ;
2015-02-25 19:59:17 +00:00
General . Interface . ShowLinedefInfo ( pickedsidedef . GetControlLinedef ( ) , pickedsidedef . Sidedef ) ; //mxd
2012-11-27 21:12:20 +00:00
}
// Sector?
else if ( pickedgeo is BaseVisualGeometrySector )
{
2016-03-18 12:52:12 +00:00
BaseVisualGeometrySector pickedsector = ( BaseVisualGeometrySector ) pickedgeo ;
Fixed(?), Texture Browser: possibly fixed Texture Browser not showing up / locking edit forms when current map has a ton of textures (like 2000 or more) in a single texture group.
Changed, cosmetic, Sector Info panel, Visual mode: info about currently highlighted surface is now shown using different color.
Changed, cosmetic, Linedef Info panel, Visual mode, non-UDMF: texture offset labels for currently highlighted sidedef are now shown using different color.
Changed, cosmetic, Vertex Info panel, UDMF: floor and ceiling offset labels are now grayed out when they have default values.
2015-03-23 22:39:31 +00:00
bool isceiling = ( pickedsector is VisualCeiling ) ; //mxd
General . Interface . ShowSectorInfo ( pickedsector . Level . sector , isceiling , ! isceiling ) ;
2012-11-27 21:12:20 +00:00
}
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
}
2016-03-18 12:52:12 +00:00
// Thing picked?
2013-03-18 13:52:27 +00:00
else if ( target . picked is VisualThing )
2016-03-18 12:52:12 +00:00
{
VisualThing pickedthing = ( VisualThing ) target . picked ;
2009-04-19 18:07:22 +00:00
General . Interface . ShowThingInfo ( pickedthing . Thing ) ;
2013-03-18 13:52:27 +00:00
}
2016-03-18 12:52:12 +00:00
//mxd. Vertex picked?
else if ( target . picked is VisualVertex )
2013-03-18 13:52:27 +00:00
{
2016-03-18 12:52:12 +00:00
VisualVertex pickedvert = ( VisualVertex ) target . picked ;
2013-03-18 13:52:27 +00:00
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
2013-09-11 09:47:53 +00:00
private void UpdateChangedObjects ( )
2009-05-01 20:31:17 +00:00
{
2019-12-26 08:08:11 +00:00
foreach ( KeyValuePair < Sector , VisualSector > vs in allsectors )
2009-05-01 20:31:17 +00:00
{
2019-12-26 08:08:11 +00:00
if ( vs . Value ! = null )
{
BaseVisualSector bvs = ( BaseVisualSector ) vs . Value ;
2019-12-30 23:08:17 +00:00
if ( bvs . Changed )
{
bvs . Rebuild ( ) ;
// Also update slope handles
if ( allslopehandles . ContainsKey ( vs . Key ) )
2021-01-30 21:01:55 +00:00
foreach ( VisualSlope handle in allslopehandles [ vs . Key ] )
2020-01-02 19:32:37 +00:00
handle . Update ( ) ;
2019-12-30 23:08:17 +00:00
}
2019-12-26 08:08:11 +00:00
}
2009-05-01 20:31:17 +00:00
}
2019-12-26 08:08:11 +00:00
foreach ( KeyValuePair < Thing , VisualThing > vt in allthings )
2009-05-01 20:31:17 +00:00
{
2019-12-26 08:08:11 +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
2014-05-21 09:22:37 +00:00
if ( General . Map . UDMF )
{
2013-03-18 13:52:27 +00:00
foreach ( KeyValuePair < Vertex , VisualVertexPair > pair in vertices )
pair . Value . Update ( ) ;
}
2015-10-02 14:47:34 +00:00
//mxd. Update event lines (still better than updating them on every frame redraw)
2017-01-08 22:04:55 +00:00
renderer . SetEventLines ( LinksCollector . GetHelperShapes ( General . Map . ThingsFilter . VisibleThings , blockmap ) ) ;
2009-05-01 20:31:17 +00:00
}
2012-06-29 14:03:35 +00:00
2013-09-11 09:47:53 +00:00
//mxd
Added, Visual mode, DECORATE: "Alpha" and "DefaultAlpha" properties are now supported.
Added, Visual mode, DECORATE: "RenderStyle" property is now partially supported.
Added, Visual mode, DECORATE: +BRIGHT flag is now supported.
Added, Visual mode, UDMF: "Alpha" thing property is now supported.
Added, Visual mode, UDMF: "RenderStyle" thing property is now partially supported.
Added, Visual mode, Hexen map format and UDMF: "Translucent" and "Invisible" thing flags are now supported.
Added, Game Configurations: added "alpha" and "renderstyle" Thing and Thing Category properties.
Fixed, Visual mode: blockmap was not updated when moving things using "Move Thing Left/Right/Forward/Backward" and "Move Thing to Cursor Location" actions.
DECORATE parser: added a warning when unable to find actor's parent class.
Internal: current map format can now be checked using "General.Map.UDMF", "General.Map.HEXEN" and "General.Map.DOOM" properties.
Updated documentation ("Game Configuration - Things Settings" page).
2015-09-28 14:57:48 +00:00
protected override void MoveSelectedThings ( Vector2D direction , bool absoluteposition )
2014-11-13 09:43:39 +00:00
{
Added, Visual mode, DECORATE: "Alpha" and "DefaultAlpha" properties are now supported.
Added, Visual mode, DECORATE: "RenderStyle" property is now partially supported.
Added, Visual mode, DECORATE: +BRIGHT flag is now supported.
Added, Visual mode, UDMF: "Alpha" thing property is now supported.
Added, Visual mode, UDMF: "RenderStyle" thing property is now partially supported.
Added, Visual mode, Hexen map format and UDMF: "Translucent" and "Invisible" thing flags are now supported.
Added, Game Configurations: added "alpha" and "renderstyle" Thing and Thing Category properties.
Fixed, Visual mode: blockmap was not updated when moving things using "Move Thing Left/Right/Forward/Backward" and "Move Thing to Cursor Location" actions.
DECORATE parser: added a warning when unable to find actor's parent class.
Internal: current map format can now be checked using "General.Map.UDMF", "General.Map.HEXEN" and "General.Map.DOOM" properties.
Updated documentation ("Game Configuration - Things Settings" page).
2015-09-28 14:57:48 +00:00
List < VisualThing > visualthings = GetSelectedVisualThings ( true ) ;
2015-12-28 15:01:53 +00:00
if ( visualthings . Count = = 0 ) return ;
2012-06-29 14:03:35 +00:00
2013-09-11 09:47:53 +00:00
PreAction ( UndoGroup . ThingMove ) ;
2012-07-16 09:45:21 +00:00
Added, Visual mode, DECORATE: "Alpha" and "DefaultAlpha" properties are now supported.
Added, Visual mode, DECORATE: "RenderStyle" property is now partially supported.
Added, Visual mode, DECORATE: +BRIGHT flag is now supported.
Added, Visual mode, UDMF: "Alpha" thing property is now supported.
Added, Visual mode, UDMF: "RenderStyle" thing property is now partially supported.
Added, Visual mode, Hexen map format and UDMF: "Translucent" and "Invisible" thing flags are now supported.
Added, Game Configurations: added "alpha" and "renderstyle" Thing and Thing Category properties.
Fixed, Visual mode: blockmap was not updated when moving things using "Move Thing Left/Right/Forward/Backward" and "Move Thing to Cursor Location" actions.
DECORATE parser: added a warning when unable to find actor's parent class.
Internal: current map format can now be checked using "General.Map.UDMF", "General.Map.HEXEN" and "General.Map.DOOM" properties.
Updated documentation ("Game Configuration - Things Settings" page).
2015-09-28 14:57:48 +00:00
Vector3D [ ] coords = new Vector3D [ visualthings . Count ] ;
for ( int i = 0 ; i < visualthings . Count ; i + + )
coords [ i ] = visualthings [ i ] . Thing . Position ;
2012-07-16 09:45:21 +00:00
2013-09-11 09:47:53 +00:00
//move things...
Added, Visual mode, DECORATE: "Alpha" and "DefaultAlpha" properties are now supported.
Added, Visual mode, DECORATE: "RenderStyle" property is now partially supported.
Added, Visual mode, DECORATE: +BRIGHT flag is now supported.
Added, Visual mode, UDMF: "Alpha" thing property is now supported.
Added, Visual mode, UDMF: "RenderStyle" thing property is now partially supported.
Added, Visual mode, Hexen map format and UDMF: "Translucent" and "Invisible" thing flags are now supported.
Added, Game Configurations: added "alpha" and "renderstyle" Thing and Thing Category properties.
Fixed, Visual mode: blockmap was not updated when moving things using "Move Thing Left/Right/Forward/Backward" and "Move Thing to Cursor Location" actions.
DECORATE parser: added a warning when unable to find actor's parent class.
Internal: current map format can now be checked using "General.Map.UDMF", "General.Map.HEXEN" and "General.Map.DOOM" properties.
Updated documentation ("Game Configuration - Things Settings" page).
2015-09-28 14:57:48 +00:00
Vector3D [ ] translatedcoords = TranslateCoordinates ( coords , direction , absoluteposition ) ;
for ( int i = 0 ; i < visualthings . Count ; i + + )
2014-11-13 09:43:39 +00:00
{
2016-04-19 20:40:42 +00:00
BaseVisualThing t = ( BaseVisualThing ) visualthings [ i ] ;
Added, Visual mode, DECORATE: "Alpha" and "DefaultAlpha" properties are now supported.
Added, Visual mode, DECORATE: "RenderStyle" property is now partially supported.
Added, Visual mode, DECORATE: +BRIGHT flag is now supported.
Added, Visual mode, UDMF: "Alpha" thing property is now supported.
Added, Visual mode, UDMF: "RenderStyle" thing property is now partially supported.
Added, Visual mode, Hexen map format and UDMF: "Translucent" and "Invisible" thing flags are now supported.
Added, Game Configurations: added "alpha" and "renderstyle" Thing and Thing Category properties.
Fixed, Visual mode: blockmap was not updated when moving things using "Move Thing Left/Right/Forward/Backward" and "Move Thing to Cursor Location" actions.
DECORATE parser: added a warning when unable to find actor's parent class.
Internal: current map format can now be checked using "General.Map.UDMF", "General.Map.HEXEN" and "General.Map.DOOM" properties.
Updated documentation ("Game Configuration - Things Settings" page).
2015-09-28 14:57:48 +00:00
t . OnMove ( translatedcoords [ i ] ) ;
2013-09-11 09:47:53 +00:00
}
2012-07-16 09:45:21 +00:00
Added, Visual mode, DECORATE: "Alpha" and "DefaultAlpha" properties are now supported.
Added, Visual mode, DECORATE: "RenderStyle" property is now partially supported.
Added, Visual mode, DECORATE: +BRIGHT flag is now supported.
Added, Visual mode, UDMF: "Alpha" thing property is now supported.
Added, Visual mode, UDMF: "RenderStyle" thing property is now partially supported.
Added, Visual mode, Hexen map format and UDMF: "Translucent" and "Invisible" thing flags are now supported.
Added, Game Configurations: added "alpha" and "renderstyle" Thing and Thing Category properties.
Fixed, Visual mode: blockmap was not updated when moving things using "Move Thing Left/Right/Forward/Backward" and "Move Thing to Cursor Location" actions.
DECORATE parser: added a warning when unable to find actor's parent class.
Internal: current map format can now be checked using "General.Map.UDMF", "General.Map.HEXEN" and "General.Map.DOOM" properties.
Updated documentation ("Game Configuration - Things Settings" page).
2015-09-28 14:57:48 +00:00
// Things may've changed sectors...
FillBlockMap ( ) ;
2013-09-11 09:47:53 +00:00
PostAction ( ) ;
}
2012-07-16 09:45:21 +00:00
2013-09-11 09:47:53 +00:00
//mxd
2014-12-03 23:15:26 +00:00
private static Vector3D [ ] TranslateCoordinates ( Vector3D [ ] coordinates , Vector2D direction , bool absolutePosition )
2014-05-20 09:09:28 +00:00
{
2015-12-28 15:01:53 +00:00
if ( coordinates . Length = = 0 ) return null ;
2012-07-16 09:45:21 +00:00
2020-05-22 20:30:32 +00:00
direction . x = Math . Round ( direction . x ) ;
direction . y = Math . Round ( direction . y ) ;
2012-07-16 09:45:21 +00:00
2013-09-11 09:47:53 +00:00
Vector3D [ ] translatedCoords = new Vector3D [ coordinates . Length ] ;
2012-07-16 09:45:21 +00:00
2013-09-11 09:47:53 +00:00
//move things...
2015-12-28 15:01:53 +00:00
if ( ! absolutePosition ) //...relatively (that's easy)
2014-12-03 23:15:26 +00:00
{
2014-05-20 09:09:28 +00:00
int camAngle = ( int ) Math . Round ( Angle2D . RadToDeg ( General . Map . VisualCamera . AngleXY ) ) ;
2013-09-11 09:47:53 +00:00
int sector = General . ClampAngle ( camAngle - 45 ) / 90 ;
direction = direction . GetRotated ( sector * Angle2D . PIHALF ) ;
2012-06-29 18:58:18 +00:00
2015-12-28 15:01:53 +00:00
for ( int i = 0 ; i < coordinates . Length ; i + + )
2013-09-11 09:47:53 +00:00
translatedCoords [ i ] = coordinates [ i ] + new Vector3D ( direction ) ;
2012-06-29 18:58:18 +00:00
2013-09-11 09:47:53 +00:00
return translatedCoords ;
}
2012-06-29 18:58:18 +00:00
2013-09-11 09:47:53 +00:00
//...to specified location preserving relative positioning (that's harder)
2015-12-28 15:01:53 +00:00
if ( coordinates . Length = = 1 ) //just move it there
2014-12-03 23:15:26 +00:00
{
2013-09-11 09:47:53 +00:00
translatedCoords [ 0 ] = new Vector3D ( direction . x , direction . y , coordinates [ 0 ] . z ) ;
return translatedCoords ;
}
2012-06-29 18:58:18 +00:00
2013-09-11 09:47:53 +00:00
//we need some reference
2020-05-21 12:20:02 +00:00
double minX = coordinates [ 0 ] . x ;
double maxX = minX ;
double minY = coordinates [ 0 ] . y ;
double maxY = minY ;
2012-07-16 09:45:21 +00:00
2013-09-11 09:47:53 +00:00
//get bounding coordinates for selected things
2015-12-28 15:01:53 +00:00
for ( int i = 1 ; i < coordinates . Length ; i + + )
2014-12-03 23:15:26 +00:00
{
2015-12-28 15:01:53 +00:00
if ( coordinates [ i ] . x < minX )
2013-09-11 09:47:53 +00:00
minX = coordinates [ i ] . x ;
2015-12-28 15:01:53 +00:00
else if ( coordinates [ i ] . x > maxX )
2013-09-11 09:47:53 +00:00
maxX = coordinates [ i ] . x ;
2012-07-16 09:45:21 +00:00
2015-12-28 15:01:53 +00:00
if ( coordinates [ i ] . y < minY )
2013-09-11 09:47:53 +00:00
minY = coordinates [ i ] . y ;
2015-12-28 15:01:53 +00:00
else if ( coordinates [ i ] . y > maxY )
2013-09-11 09:47:53 +00:00
maxY = coordinates [ i ] . y ;
}
2012-07-16 09:45:21 +00:00
2013-09-11 09:47:53 +00:00
Vector2D selectionCenter = new Vector2D ( minX + ( maxX - minX ) / 2 , minY + ( maxY - minY ) / 2 ) ;
2012-07-16 09:45:21 +00:00
2013-09-11 09:47:53 +00:00
//move them
2015-12-28 15:01:53 +00:00
for ( int i = 0 ; i < coordinates . Length ; i + + )
2020-05-22 20:30:32 +00:00
translatedCoords [ i ] = new Vector3D ( Math . Round ( direction . x - ( selectionCenter . x - coordinates [ i ] . x ) ) , Math . Round ( direction . y - ( selectionCenter . y - coordinates [ i ] . y ) ) , Math . Round ( coordinates [ i ] . z ) ) ;
2012-07-16 09:45:21 +00:00
2013-09-11 09:47:53 +00:00
return translatedCoords ;
}
2013-04-01 11:06:01 +00:00
2013-07-09 11:29:10 +00:00
//mxd
2015-09-04 12:44:09 +00:00
public override void UpdateSelectionInfo ( )
2014-10-28 10:30:11 +00:00
{
2015-11-03 08:54:56 +00:00
// Collect info
2013-07-09 11:29:10 +00:00
int numWalls = 0 ;
int numFloors = 0 ;
int numCeilings = 0 ;
int numThings = 0 ;
int numVerts = 0 ;
2014-10-28 10:30:11 +00:00
foreach ( IVisualEventReceiver obj in selectedobjects )
{
2016-05-12 11:32:10 +00:00
if ( ! obj . Selected ) continue ;
2013-07-09 11:29:10 +00:00
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 + + ;
}
2014-01-23 13:36:51 +00:00
List < string > results = new List < string > ( ) ;
2015-10-02 14:47:34 +00:00
if ( numWalls > 0 ) results . Add ( numWalls + ( numWalls > 1 ? " sidedefs" : " sidedef" ) ) ;
if ( numFloors > 0 ) results . Add ( numFloors + ( numFloors > 1 ? " floors" : " floor" ) ) ;
if ( numCeilings > 0 ) results . Add ( numCeilings + ( numCeilings > 1 ? " ceilings" : " ceiling" ) ) ;
if ( numThings > 0 ) results . Add ( numThings + ( numThings > 1 ? " things" : " thing" ) ) ;
if ( numVerts > 0 ) results . Add ( numVerts + ( numVerts > 1 ? " vertices" : " vertex" ) ) ;
2013-07-09 11:29:10 +00:00
2015-11-03 08:54:56 +00:00
// Display results
string result = string . Empty ;
if ( results . Count > 0 )
2014-10-28 10:30:11 +00:00
{
2015-11-03 08:54:56 +00:00
result = string . Join ( ", " , results . ToArray ( ) ) ;
int pos = result . LastIndexOf ( "," , StringComparison . Ordinal ) ;
2013-07-09 11:29:10 +00:00
if ( pos ! = - 1 ) result = result . Remove ( pos , 1 ) . Insert ( pos , " and" ) ;
2015-11-03 08:54:56 +00:00
result + = " selected." ;
2013-07-09 11:29:10 +00:00
}
2015-11-03 08:54:56 +00:00
General . Interface . DisplayStatus ( StatusType . Selection , result ) ;
2013-07-09 11:29:10 +00:00
}
2013-07-19 15:30:58 +00:00
//mxd
2015-07-15 09:09:47 +00:00
internal void StartRealtimeInterfaceUpdate ( SelectionType selectiontype )
{
2015-12-28 15:01:53 +00:00
switch ( selectiontype )
2015-07-15 09:09:47 +00:00
{
case SelectionType . All :
case SelectionType . Linedefs :
case SelectionType . Sectors :
General . Interface . OnEditFormValuesChanged + = Interface_OnSectorEditFormValuesChanged ;
break ;
case SelectionType . Things :
General . Interface . OnEditFormValuesChanged + = Interface_OnThingEditFormValuesChanged ;
break ;
default :
General . Interface . OnEditFormValuesChanged + = Interface_OnEditFormValuesChanged ;
break ;
2013-07-19 15:30:58 +00:00
}
}
//mxd
2015-07-15 09:09:47 +00:00
internal void StopRealtimeInterfaceUpdate ( SelectionType selectiontype )
{
2015-10-02 14:47:34 +00:00
switch ( selectiontype )
2015-07-15 09:09:47 +00:00
{
case SelectionType . All :
case SelectionType . Linedefs :
case SelectionType . Sectors :
General . Interface . OnEditFormValuesChanged - = Interface_OnSectorEditFormValuesChanged ;
break ;
case SelectionType . Things :
General . Interface . OnEditFormValuesChanged - = Interface_OnThingEditFormValuesChanged ;
break ;
default :
General . Interface . OnEditFormValuesChanged - = Interface_OnEditFormValuesChanged ;
break ;
2013-07-19 15:30:58 +00:00
}
}
2020-06-01 07:50:35 +00:00
private List < VisualSidedefSlope > GetSlopeHandlePair ( )
{
List < VisualSidedefSlope > handles = GetSelectedSlopeHandles ( ) ;
// No handles selected, try to slope between highlighted handle and it smart pivot
if ( handles . Count = = 0 & & HighlightedTarget is VisualSidedefSlope )
{
VisualSidedefSlope handle = VisualSidedefSlope . GetSmartPivotHandle ( ( VisualSidedefSlope ) HighlightedTarget , this ) ;
if ( handle = = null )
{
General . Interface . DisplayStatus ( StatusType . Warning , "Couldn't find a smart pivot handle." ) ;
return handles ;
}
handles . Add ( ( VisualSidedefSlope ) HighlightedTarget ) ;
handles . Add ( handle ) ;
}
// One handle selected, try to slope between it and the highlighted handle or the selected one's smart pivot
else if ( handles . Count = = 1 )
{
if ( HighlightedTarget = = handles [ 0 ] | | ! ( HighlightedTarget is VisualSidedefSlope ) )
{
VisualSidedefSlope handle ;
if ( HighlightedTarget is VisualSidedefSlope )
handle = VisualSidedefSlope . GetSmartPivotHandle ( ( VisualSidedefSlope ) HighlightedTarget , this ) ;
else
handle = VisualSidedefSlope . GetSmartPivotHandle ( handles [ 0 ] , this ) ;
if ( handle = = null )
{
General . Interface . DisplayStatus ( StatusType . Warning , "Couldn't find a smart pivot handle." ) ;
return handles ;
}
handles . Add ( handle ) ;
}
else
{
handles . Add ( ( VisualSidedefSlope ) HighlightedTarget ) ;
}
}
// Return if more than two handles are selected
else if ( handles . Count > 2 )
{
General . Interface . DisplayStatus ( StatusType . Warning , "Too many slope handles selected." ) ;
return handles ;
}
// Everything else
else if ( handles . Count ! = 2 )
{
General . Interface . DisplayStatus ( StatusType . Warning , "No slope handles selected or highlighted." ) ;
return handles ;
}
return handles ;
}
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 ] ;
}
2016-01-26 22:29:12 +00:00
//mxd. This requests a sector's extra data or null if given sector doesn't have it
internal SectorData GetSectorDataEx ( Sector s )
{
return ( sectordata . ContainsKey ( s ) ? sectordata [ s ] : null ) ;
}
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
2014-12-03 23:15:26 +00:00
internal VertexData GetVertexData ( Vertex v )
{
2013-03-18 13:52:27 +00:00
if ( ! vertexdata . ContainsKey ( v ) )
vertexdata [ v ] = new VertexData ( this , v ) ;
return vertexdata [ v ] ;
}
2014-12-03 23:15:26 +00:00
internal BaseVisualVertex GetVisualVertex ( Vertex v , bool floor )
{
2014-02-03 11:19:12 +00:00
if ( ! vertices . ContainsKey ( v ) )
vertices . Add ( v , new VisualVertexPair ( new BaseVisualVertex ( this , v , false ) , new BaseVisualVertex ( this , v , true ) ) ) ;
2016-04-19 20:40:42 +00:00
return ( floor ? ( BaseVisualVertex ) vertices [ v ] . FloorVertex : ( BaseVisualVertex ) vertices [ v ] . CeilingVertex ) ;
2014-02-03 11:19:12 +00:00
}
2013-03-18 13:52:27 +00:00
//mxd
2014-12-03 23:15:26 +00:00
internal void UpdateVertexHandle ( Vertex v )
{
2013-03-18 13:52:27 +00:00
if ( ! vertices . ContainsKey ( v ) )
2014-02-03 11:19:12 +00:00
vertices . Add ( v , new VisualVertexPair ( new BaseVisualVertex ( this , v , false ) , new BaseVisualVertex ( this , v , true ) ) ) ;
2013-03-18 13:52:27 +00:00
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 ( )
{
2016-07-20 19:17:31 +00:00
HashSet < Sector > effectsectors = null ; //mxd
2019-10-06 19:56:55 +00:00
List < Linedef > [ ] slopelinedefpass = new List < Linedef > [ ] { new List < Linedef > ( ) , new List < Linedef > ( ) } ;
List < Thing > [ ] slopethingpass = new List < Thing > [ ] { new List < Thing > ( ) , new List < Thing > ( ) } ;
2013-09-03 09:34:28 +00:00
2019-10-06 19:56:55 +00:00
if ( ! General . Settings . EnhancedRenderingEffects ) //mxd
2014-12-03 23:15:26 +00:00
{
2016-07-20 19:17:31 +00:00
// Store all sectors with effects
2014-12-03 23:15:26 +00:00
if ( sectordata ! = null & & sectordata . Count > 0 )
2016-07-20 19:17:31 +00:00
effectsectors = new HashSet < Sector > ( sectordata . Keys ) ;
2013-03-18 13:52:27 +00:00
2016-07-20 19:17:31 +00:00
// Remove all vertex handles from selection
2014-12-03 23:15:26 +00:00
if ( vertices ! = null & & vertices . Count > 0 )
{
2018-01-22 11:20:12 +00:00
for ( int i = 0 ; i < selectedobjects . Count ; i + + )
{
if ( selectedobjects [ i ] is BaseVisualVertex )
{
RemoveSelectedObject ( selectedobjects [ i ] ) ;
i - - ;
}
}
2013-03-18 13:52:27 +00:00
}
2013-09-11 09:47:53 +00:00
}
2012-11-27 21:12:20 +00:00
2013-09-11 09:47:53 +00:00
Dictionary < int , List < Sector > > sectortags = new Dictionary < int , List < Sector > > ( ) ;
2019-10-06 19:56:55 +00:00
Dictionary < int , List < Linedef > > linetags = new Dictionary < int , List < Linedef > > ( ) ;
2013-09-11 09:47:53 +00:00
sectordata = new Dictionary < Sector , SectorData > ( General . Map . Map . Sectors . Count ) ;
thingdata = new Dictionary < Thing , ThingData > ( General . Map . Map . Things . Count ) ;
2013-09-03 09:34:28 +00:00
2016-07-20 19:17:31 +00:00
//mxd. Rebuild all sectors with effects
if ( effectsectors ! = null )
2014-12-03 23:15:26 +00:00
{
2016-07-20 19:17:31 +00:00
foreach ( Sector s in effectsectors )
2014-12-03 23:15:26 +00:00
{
2016-07-20 19:17:31 +00:00
if ( ! VisualSectorExists ( s ) ) continue ;
2013-09-03 09:34:28 +00:00
// The visual sector associated is now outdated
2016-07-20 19:17:31 +00:00
BaseVisualSector vs = ( BaseVisualSector ) GetVisualSector ( s ) ;
vs . UpdateSectorGeometry ( true ) ;
2013-09-03 09:34:28 +00:00
}
}
2012-11-27 21:12:20 +00:00
2014-12-03 23:15:26 +00:00
if ( General . Map . UDMF )
{
2013-03-18 13:52:27 +00:00
vertexdata = new Dictionary < Vertex , VertexData > ( General . Map . Map . Vertices . Count ) ; //mxd
vertices . Clear ( ) ;
}
2016-09-07 15:15:07 +00:00
if ( ! General . Settings . EnhancedRenderingEffects ) return ; //mxd
2012-11-27 21:12:20 +00:00
2016-07-20 19:17:31 +00:00
// Find all sector who's tag is not 0 and hash them so that we can find them quickly
2012-11-27 21:12:20 +00:00
foreach ( Sector s in General . Map . Map . Sectors )
{
2015-12-04 12:29:22 +00:00
foreach ( int tag in s . Tags )
2012-11-27 21:12:20 +00:00
{
2015-07-28 15:04:21 +00:00
if ( tag = = 0 ) continue ;
if ( ! sectortags . ContainsKey ( tag ) ) sectortags [ tag ] = new List < Sector > ( ) ;
sectortags [ tag ] . Add ( s ) ;
2012-11-27 21:12:20 +00:00
}
}
// Find interesting linedefs (such as line slopes)
2019-10-06 19:56:55 +00:00
// This also determines which slope lines belong to pass one and pass two. See https://zdoom.org/wiki/Slope
foreach ( Linedef l in General . Map . Map . Linedefs )
2012-11-27 21:12:20 +00:00
{
2019-10-06 19:56:55 +00:00
// Builds a cache of linedef ids/tags. Used for slope things. Use linedef tags in UDMF
if ( General . Map . UDMF )
{
foreach ( int tag in l . Tags )
{
if ( ! linetags . ContainsKey ( tag ) ) linetags [ tag ] = new List < Linedef > ( ) ;
linetags [ tag ] . Add ( l ) ;
}
}
2016-07-20 19:17:31 +00:00
//mxd. Rewritten to use action ID instead of number
2019-10-06 19:56:55 +00:00
if ( l . Action = = 0 | | ! General . Map . Config . LinedefActions . ContainsKey ( l . Action ) ) continue ;
2016-07-20 19:17:31 +00:00
switch ( General . Map . Config . LinedefActions [ l . Action ] . Id . ToLowerInvariant ( ) )
2013-04-16 12:52:40 +00:00
{
2019-10-06 19:56:55 +00:00
// ========== Line Set Identification (121) (see https://zdoom.org/wiki/Line_SetIdentification) ==========
// Builds a cache of linedef ids/tags. Used for slope things. Only used for Hexen format
case "line_setidentification" :
int tag = l . Args [ 0 ] + l . Args [ 4 ] * 256 ;
if ( ! linetags . ContainsKey ( tag ) ) linetags [ tag ] = new List < Linedef > ( ) ;
linetags [ tag ] . Add ( l ) ;
break ;
2016-07-20 19:17:31 +00:00
// ========== Plane Align (181) (see http://zdoom.org/wiki/Plane_Align) ==========
case "plane_align" :
2019-10-06 19:56:55 +00:00
slopelinedefpass [ 0 ] . Add ( l ) ;
2015-04-01 12:51:26 +00:00
break ;
2013-04-16 12:52:40 +00:00
2016-07-20 19:17:31 +00:00
// ========== Plane Copy (118) (mxd) (see http://zdoom.org/wiki/Plane_Copy) ==========
2019-10-06 19:56:55 +00:00
case "plane_copy" :
slopelinedefpass [ 1 ] . Add ( l ) ;
2015-04-01 12:51:26 +00:00
break ;
2016-07-20 19:17:31 +00:00
// ========== Sector 3D floor (160) (see http://zdoom.org/wiki/Sector_Set3dFloor) ==========
case "sector_set3dfloor" :
2015-04-01 12:51:26 +00:00
if ( l . Front ! = null )
2012-11-27 21:12:20 +00:00
{
2015-04-01 12:51:26 +00:00
//mxd. Added hi-tag/line ID check
2015-07-26 23:35:34 +00:00
int sectortag = ( General . Map . UDMF | | ( l . Args [ 1 ] & ( int ) Effect3DFloor . FloorTypes . HiTagIsLineID ) ! = 0 ) ? l . Args [ 0 ] : l . Args [ 0 ] + ( l . Args [ 4 ] < < 8 ) ;
2015-04-01 12:51:26 +00:00
if ( sectortags . ContainsKey ( sectortag ) )
{
List < Sector > sectors = sectortags [ sectortag ] ;
foreach ( Sector s in sectors )
{
SectorData sd = GetSectorData ( s ) ;
sd . AddEffect3DFloor ( l ) ;
}
}
2012-11-27 21:12:20 +00:00
}
2015-04-01 12:51:26 +00:00
break ;
2016-07-20 19:17:31 +00:00
// ========== Transfer Brightness (50) (see http://zdoom.org/wiki/ExtraFloor_LightOnly) =========
case "extrafloor_lightonly" :
2015-04-01 12:51:26 +00:00
if ( l . Front ! = null & & sectortags . ContainsKey ( l . Args [ 0 ] ) )
2012-11-27 21:12:20 +00:00
{
2015-04-01 12:51:26 +00:00
List < Sector > sectors = sectortags [ l . Args [ 0 ] ] ;
foreach ( Sector s in sectors )
{
SectorData sd = GetSectorData ( s ) ;
sd . AddEffectBrightnessLevel ( l ) ;
}
2012-11-27 21:12:20 +00:00
}
2015-04-01 12:51:26 +00:00
break ;
2016-07-20 19:17:31 +00:00
// ========== mxd. Transfer Floor Brightness (210) (see http://www.zdoom.org/w/index.php?title=Transfer_FloorLight) =========
case "transfer_floorlight" :
2015-04-01 12:51:26 +00:00
if ( l . Front ! = null & & sectortags . ContainsKey ( l . Args [ 0 ] ) )
{
List < Sector > sectors = sectortags [ l . Args [ 0 ] ] ;
foreach ( Sector s in sectors )
{
SectorData sd = GetSectorData ( s ) ;
sd . AddEffectTransferFloorBrightness ( l ) ;
}
}
break ;
2016-07-20 19:17:31 +00:00
// ========== mxd. Transfer Ceiling Brightness (211) (see http://www.zdoom.org/w/index.php?title=Transfer_CeilingLight) =========
case "transfer_ceilinglight" :
2015-04-01 12:51:26 +00:00
if ( l . Front ! = null & & sectortags . ContainsKey ( l . Args [ 0 ] ) )
{
List < Sector > sectors = sectortags [ l . Args [ 0 ] ] ;
foreach ( Sector s in sectors )
{
SectorData sd = GetSectorData ( s ) ;
sd . AddEffectTransferCeilingBrightness ( l ) ;
}
}
break ;
2016-07-20 19:17:31 +00:00
// ========== mxd. BOOM: Set Tagged Floor Lighting to Lighting on 1st Sidedef's Sector (213) =========
case "boom_transfer_floorlight" :
if ( l . Front ! = null & & sectortags . ContainsKey ( l . Tag ) )
{
List < Sector > sectors = sectortags [ l . Tag ] ;
foreach ( Sector s in sectors )
{
SectorData sd = GetSectorData ( s ) ;
sd . AddEffectTransferFloorBrightness ( l ) ;
}
}
break ;
// ========== mxd. BOOM: Set Tagged Ceiling Lighting to Lighting on 1st Sidedef's Sector (261) =========
case "boom_transfer_ceilinglight" :
if ( l . Front ! = null & & sectortags . ContainsKey ( l . Tag ) )
{
List < Sector > sectors = sectortags [ l . Tag ] ;
foreach ( Sector s in sectors )
{
SectorData sd = GetSectorData ( s ) ;
sd . AddEffectTransferCeilingBrightness ( l ) ;
}
}
break ;
2012-11-27 21:12:20 +00:00
}
}
2019-10-06 19:56:55 +00:00
// Pass one for linedefs
foreach ( Linedef l in slopelinedefpass [ 0 ] )
{
//mxd. Rewritten to use action ID instead of number
if ( l . Action = = 0 | | ! General . Map . Config . LinedefActions . ContainsKey ( l . Action ) ) continue ;
switch ( General . Map . Config . LinedefActions [ l . Action ] . Id . ToLowerInvariant ( ) )
{
// ========== Plane Align (181) (see http://zdoom.org/wiki/Plane_Align) ==========
case "plane_align" :
if ( ( ( l . Args [ 0 ] = = 1 ) | | ( l . Args [ 1 ] = = 1 ) ) & & ( l . Front ! = null ) )
{
SectorData sd = GetSectorData ( l . Front . Sector ) ;
sd . AddEffectLineSlope ( l ) ;
}
if ( ( ( l . Args [ 0 ] = = 2 ) | | ( l . Args [ 1 ] = = 2 ) ) & & ( l . Back ! = null ) )
{
SectorData sd = GetSectorData ( l . Back . Sector ) ;
sd . AddEffectLineSlope ( l ) ;
}
break ;
}
}
2012-11-27 21:12:20 +00:00
// Find interesting things (such as sector slopes)
2019-10-06 19:56:55 +00:00
// Pass one of slope things, and determine which one are for pass two
2016-07-20 19:17:31 +00:00
//TODO: rewrite using classnames instead of numbers
2019-10-06 19:56:55 +00:00
foreach ( Thing t in General . Map . Map . Things )
2012-11-27 21:12:20 +00:00
{
2019-10-06 19:56:55 +00:00
switch ( t . Type )
2012-11-27 21:12:20 +00:00
{
2015-04-01 12:51:26 +00:00
// ========== Copy slope ==========
case 9511 :
case 9510 :
2019-10-06 19:56:55 +00:00
slopethingpass [ 1 ] . Add ( t ) ;
2015-04-01 12:51:26 +00:00
break ;
// ========== Thing line slope ==========
case 9501 :
case 9500 :
2019-10-06 19:56:55 +00:00
if ( linetags . ContainsKey ( t . Args [ 0 ] ) )
2015-04-01 12:51:26 +00:00
{
2020-10-22 19:11:12 +00:00
// Only slope each sector once, even when multiple lines of the same sector are tagged. See https://github.com/jewalky/UltimateDoomBuilder/issues/491
List < Sector > slopedsectors = new List < Sector > ( ) ;
2019-10-06 19:56:55 +00:00
foreach ( Linedef ld in linetags [ t . Args [ 0 ] ] )
{
if ( ld . Line . GetSideOfLine ( t . Position ) < 0.0f )
2020-04-10 10:11:42 +00:00
{
2020-10-22 19:11:12 +00:00
if ( ld . Front ! = null & & ! slopedsectors . Contains ( ld . Front . Sector ) )
{
2020-04-10 10:11:42 +00:00
GetSectorData ( ld . Front . Sector ) . AddEffectThingLineSlope ( t , ld . Front ) ;
2020-10-22 19:11:12 +00:00
slopedsectors . Add ( ld . Front . Sector ) ;
}
2020-04-10 10:11:42 +00:00
}
2020-10-22 19:11:12 +00:00
else if ( ld . Back ! = null & & ! slopedsectors . Contains ( ld . Back . Sector ) )
{
2019-10-06 19:56:55 +00:00
GetSectorData ( ld . Back . Sector ) . AddEffectThingLineSlope ( t , ld . Back ) ;
2020-10-22 19:11:12 +00:00
slopedsectors . Add ( ld . Back . Sector ) ;
}
2019-10-06 19:56:55 +00:00
}
2015-04-01 12:51:26 +00:00
}
break ;
// ========== Thing slope ==========
case 9503 :
case 9502 :
t . DetermineSector ( blockmap ) ;
2019-10-06 19:56:55 +00:00
if ( t . Sector ! = null )
2015-04-01 12:51:26 +00:00
{
SectorData sd = GetSectorData ( t . Sector ) ;
sd . AddEffectThingSlope ( t ) ;
}
break ;
2014-01-20 11:44:41 +00:00
}
2012-11-27 21:12:20 +00:00
}
2019-09-21 12:03:30 +00:00
2019-10-06 19:56:55 +00:00
// Pass two of slope things
//TODO: rewrite using classnames instead of numbers
foreach ( Thing t in slopethingpass [ 1 ] )
{
switch ( t . Type )
{
// ========== Copy slope ==========
case 9511 :
case 9510 :
t . DetermineSector ( blockmap ) ;
if ( t . Sector ! = null )
{
SectorData sd = GetSectorData ( t . Sector ) ;
sd . AddEffectCopySlope ( t ) ;
}
break ;
}
}
2019-09-21 12:03:30 +00:00
// Find sectors with 3 vertices, because they can be sloped
foreach ( Sector s in General . Map . Map . Sectors )
{
// ========== Thing vertex slope, vertices with UDMF vertex offsets ==========
if ( s . Sidedefs . Count = = 3 )
{
if ( General . Map . UDMF ) GetSectorData ( s ) . AddEffectVertexOffset ( ) ; //mxd
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 ;
2019-12-25 23:39:15 +00:00
// Check if a thing is at this vertex
foreach ( VisualBlockEntry block in blockmap . GetBlocks ( v . Position ) )
{
foreach ( Thing t in block . Things )
{
if ( ( Vector2D ) t . Position = = v . Position )
{
switch ( t . Type )
{
case 1504 : slopefloorthings . Add ( t ) ; break ;
case 1505 : slopeceilingthings . Add ( t ) ; break ;
}
}
}
}
2019-09-21 12:03:30 +00:00
}
// 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 ) ;
}
}
}
2019-10-06 19:56:55 +00:00
// Pass two for linedefs
foreach ( Linedef l in slopelinedefpass [ 1 ] )
{
if ( l . Action = = 0 | | ! General . Map . Config . LinedefActions . ContainsKey ( l . Action ) ) continue ;
switch ( General . Map . Config . LinedefActions [ l . Action ] . Id . ToLowerInvariant ( ) )
{
// ========== Plane Copy (118) (mxd) (see http://zdoom.org/wiki/Plane_Copy) ==========
case "plane_copy" :
{
//check the 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
if ( l . Front ! = null )
{
if ( ( l . Args [ 0 ] > 0 | | l . Args [ 1 ] > 0 ) | | ( l . Back ! = null & & ( floorCopyToFront | | ceilingCopyToFront ) ) )
{
SectorData sd = GetSectorData ( l . Front . Sector ) ;
sd . AddEffectPlaneClopySlope ( l , true ) ;
}
}
// Copy slope to back sector
if ( l . Back ! = null )
{
if ( ( l . Args [ 2 ] > 0 | | l . Args [ 3 ] > 0 ) | | ( l . Front ! = null & & ( floorCopyToBack | | ceilingCopyToBack ) ) )
{
SectorData sd = GetSectorData ( l . Back . Sector ) ;
sd . AddEffectPlaneClopySlope ( l , false ) ;
}
}
}
break ;
}
}
2019-12-30 23:08:17 +00:00
// Visual slope handles
foreach ( KeyValuePair < Sector , List < VisualSlope > > kvp in allslopehandles )
{
foreach ( VisualSlope handle in kvp . Value )
2021-01-30 21:01:55 +00:00
if ( handle ! = null & & handle . Selected )
2021-01-30 21:45:08 +00:00
if ( handle is BaseVisualSlope )
RemoveSelectedObject ( ( BaseVisualSlope ) handle ) ;
2019-12-30 23:08:17 +00:00
kvp . Value . Clear ( ) ;
}
allslopehandles . Clear ( ) ;
2021-01-30 21:01:55 +00:00
sidedefslopehandles . Clear ( ) ;
vertexslopehandles . Clear ( ) ;
2019-12-30 23:08:17 +00:00
2020-05-30 14:41:05 +00:00
BuildSlopeHandles ( General . Map . Map . Sectors . ToList ( ) ) ;
}
private void BuildSlopeHandles ( List < Sector > sectors )
{
2021-01-30 21:01:55 +00:00
if ( ! General . Map . UDMF )
return ;
foreach ( Sector s in sectors )
2019-12-30 23:08:17 +00:00
{
2021-01-30 21:01:55 +00:00
if ( s . IsDisposed )
continue ;
SectorData sectordata = GetSectorData ( s ) ;
sectordata . Update ( ) ;
// Clear old data
if ( allslopehandles . ContainsKey ( s ) ) allslopehandles . Remove ( s ) ;
if ( sidedefslopehandles . ContainsKey ( s ) ) sidedefslopehandles . Remove ( s ) ;
if ( vertexslopehandles . ContainsKey ( s ) ) vertexslopehandles . Remove ( s ) ;
// Create visual sidedef slope handles
foreach ( Sidedef sidedef in s . Sidedefs )
2019-12-30 23:08:17 +00:00
{
2021-01-30 21:01:55 +00:00
// Create handles for the regular floor and ceiling
CreateVisualSlopeHandle ( sectordata . Floor , sidedef , true ) ;
CreateVisualSlopeHandle ( sectordata . Ceiling , sidedef , false ) ;
// Create handles for 3D floors
if ( sectordata . ExtraFloors . Count > 0 )
2020-05-30 14:41:05 +00:00
{
2021-01-30 21:01:55 +00:00
foreach ( Effect3DFloor floor in sectordata . ExtraFloors )
{
CreateVisualSlopeHandle ( floor . Floor , sidedef , false ) ;
CreateVisualSlopeHandle ( floor . Ceiling , sidedef , true ) ;
}
2020-05-30 14:41:05 +00:00
}
2021-01-30 21:01:55 +00:00
}
}
2020-05-30 14:41:05 +00:00
2021-01-30 21:01:55 +00:00
// Create visual vertex slope handles
foreach ( Vertex v in General . Map . Map . Vertices )
{
if ( v . IsDisposed | | v . Linedefs . Count = = 0 )
continue ;
HashSet < Sector > vertexsectors = new HashSet < Sector > ( ) ;
// Find all sectors that have lines connected to this vertex
foreach ( Linedef ld in v . Linedefs )
{
if ( ld . IsDisposed )
continue ;
if ( ld . Front ! = null & & ! ld . Front . Sector . IsDisposed ) vertexsectors . Add ( ld . Front . Sector ) ;
if ( ld . Back ! = null & & ! ld . Front . Sector . IsDisposed ) vertexsectors . Add ( ld . Back . Sector ) ;
}
2019-12-30 23:08:17 +00:00
2021-01-30 21:01:55 +00:00
foreach ( Sector s in vertexsectors )
{
SectorData sectordata = GetSectorData ( s ) ;
2019-12-30 23:08:17 +00:00
sectordata . Update ( ) ;
2021-01-30 21:01:55 +00:00
// Create handles for the regular floor and ceiling
CreateVisualSlopeHandle ( sectordata . Floor , v , s , true ) ;
CreateVisualSlopeHandle ( sectordata . Ceiling , v , s , false ) ;
2020-05-30 14:41:05 +00:00
2021-01-30 21:01:55 +00:00
// Create handles for 3D floors
if ( sectordata . ExtraFloors . Count > 0 )
2019-12-30 23:08:17 +00:00
{
2021-01-30 21:01:55 +00:00
foreach ( Effect3DFloor floor in sectordata . ExtraFloors )
2019-12-30 23:08:17 +00:00
{
2021-01-30 21:01:55 +00:00
CreateVisualSlopeHandle ( floor . Floor , v , s , false ) ;
CreateVisualSlopeHandle ( floor . Ceiling , v , s , true ) ;
2019-12-30 23:08:17 +00:00
}
}
}
}
2012-11-27 21:12:20 +00:00
}
#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 ( )
{
2013-03-18 13:52:27 +00:00
//mxd
useSelectionFromClassicMode = BuilderPlug . Me . SyncSelection ? ! General . Interface . ShiftState : General . Interface . ShiftState ;
2014-10-28 10:30:11 +00:00
if ( useSelectionFromClassicMode ) UpdateSelectionInfo ( ) ;
2013-07-09 11:29:10 +00:00
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
2018-04-10 16:41:35 +00:00
//mxd. Update fog color (otherwise FogBoundaries won't be setup correctly)
foreach ( Sector s in General . Map . Map . Sectors )
s . UpdateFogColor ( ) ;
Cosmetic, actions: renamed "Lower Floor/Ceiling by 8 mp" to "Lower Floor/Ceiling/Thing by 8 mp", "Raise Floor/Ceiling by 8 mp" to "Raise Floor/Ceiling/Thing by 8 mp", "Lower Floor/Ceiling by 1 mp" to "Lower Floor/Ceiling/Thing by 1 mp", "Raise Floor/Ceiling by 1 mp" to "Raise Floor/Ceiling/Thing by 1 mp", "Lower Floor/Ceiling to adjacent sector" to "Lower Floor/Ceiling/Thing to adjacent Sector/Thing", "Raise Floor/Ceiling to adjacent sector" to "Raise Floor/Ceiling/Thing to adjacent Sector/Thing".
Updated, Visual mode, "Raise Floor/Ceiling/Thing to adjacent Sector/Thing" / "Lower Floor/Ceiling/Thing to adjacent Sector/Thing" actions: sectors across targeted sectors are now taken into account when determining target height.
Updated, Visual mode, "Raise Floor/Ceiling/Thing to adjacent Sector/Thing" / "Lower Floor/Ceiling/Thing to adjacent Sector/Thing" actions: the actions can now stack things on top of other things when their bounding boxes intersect.
Internal: cosmetic changes to shader update logic.
Internal: thing bounding box is now used when adding a thing to VisualBlockMap.
2015-12-10 14:34:34 +00:00
2019-09-21 12:03:30 +00:00
// biwa. We need a blockmap for the slope things. Can't wait until it's built in base.OnEngage
// This was the root cause for issue #160
FillBlockMap ( ) ;
2018-04-10 16:41:35 +00:00
// (Re)create special effects
RebuildElementData ( ) ;
2015-10-02 14:47:34 +00:00
2017-08-24 13:24:42 +00:00
//mxd. Update event lines
renderer . SetEventLines ( LinksCollector . GetHelperShapes ( General . Map . ThingsFilter . VisibleThings , blockmap ) ) ;
// [ZZ] this enables calling of this object from the outside world. Only after properly initialized pls.
base . OnEngage ( ) ;
}
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
2014-10-30 08:43:30 +00:00
if ( BuilderPlug . Me . SyncSelection ? ! General . Interface . ShiftState : General . Interface . ShiftState )
{
2013-03-18 13:52:27 +00:00
//clear previously selected stuff
General . Map . Map . ClearAllSelected ( ) ;
//refill selection
2015-09-10 17:38:27 +00:00
List < int > selectedsectorindices = new List < int > ( ) ;
List < int > selectedlineindices = new List < int > ( ) ;
List < int > selectedvertexindices = new List < int > ( ) ;
2013-03-18 13:52:27 +00:00
2014-10-30 08:43:30 +00:00
foreach ( IVisualEventReceiver obj in selectedobjects )
{
if ( obj is BaseVisualThing )
{
2013-03-18 13:52:27 +00:00
( ( BaseVisualThing ) obj ) . Thing . Selected = true ;
2014-10-30 08:43:30 +00:00
}
else if ( obj is VisualFloor | | obj is VisualCeiling )
{
2016-04-19 20:40:42 +00:00
VisualGeometry vg = ( VisualGeometry ) obj ;
2015-09-10 17:38:27 +00:00
if ( vg . Sector ! = null & & vg . Sector . Sector ! = null & & ! selectedsectorindices . Contains ( vg . Sector . Sector . Index ) )
{
selectedsectorindices . Add ( vg . Sector . Sector . Index ) ;
vg . Sector . Sector . Selected = true ;
}
2014-10-30 08:43:30 +00:00
}
else if ( obj is VisualLower | | obj is VisualUpper | | obj is VisualMiddleDouble
| | obj is VisualMiddleSingle | | obj is VisualMiddle3D )
{
2016-04-19 20:40:42 +00:00
VisualGeometry vg = ( VisualGeometry ) obj ;
2015-09-10 17:38:27 +00:00
if ( vg . Sidedef ! = null & & ! selectedlineindices . Contains ( vg . Sidedef . Line . Index ) )
{
selectedlineindices . Add ( vg . Sidedef . Line . Index ) ;
vg . Sidedef . Line . Selected = true ;
}
2013-03-18 13:52:27 +00:00
}
2015-09-10 17:38:27 +00:00
else if ( obj is VisualVertex )
2014-10-30 08:43:30 +00:00
{
2016-04-19 20:40:42 +00:00
VisualVertex v = ( VisualVertex ) obj ;
2015-09-10 17:38:27 +00:00
if ( ! selectedvertexindices . Contains ( v . Vertex . Index ) )
{
selectedvertexindices . Add ( v . Vertex . Index ) ;
v . Vertex . Selected = true ;
}
2014-10-30 08:43:30 +00:00
}
2013-03-18 13:52:27 +00:00
}
}
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
2016-03-14 00:01:21 +00:00
public override void OnProcess ( long deltatime )
2009-04-19 18:07:22 +00:00
{
2019-01-19 07:56:13 +00:00
long pickinterval = PICK_INTERVAL ; // biwa
2009-04-19 18:07:22 +00:00
// Process things?
base . ProcessThings = ( BuilderPlug . Me . ShowVisualThings ! = 0 ) ;
// Setup the move multiplier depending on gravity
2020-05-23 08:37:42 +00:00
Vector3D movemultiplier = new Vector3D ( 1.0 , 1.0 , 1.0 ) ;
if ( BuilderPlug . Me . UseGravity ) movemultiplier . z = 0.0 ;
2009-04-19 18:07:22 +00:00
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 ;
2014-07-18 11:25:08 +00:00
SectorLevel floorlevel = sd . GetFloorBelow ( feetposition ) ? ? sd . Floor ;
2020-05-21 12:20:02 +00:00
double floorheight = floorlevel . plane . GetZ ( General . Map . VisualCamera . Position ) ;
2020-05-23 08:37:42 +00:00
if ( General . Map . VisualCamera . Position . z < ( floorheight + cameraflooroffset + 0.1 ) )
2009-04-19 18:07:22 +00:00
{
// Stay above floor
2020-05-23 08:37:42 +00:00
gravity = new Vector3D ( 0.0 , 0.0 , 0.0 ) ;
2009-04-19 18:07:22 +00:00
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
2013-08-02 12:50:53 +00:00
gravity . z + = GRAVITY * General . Map . VisualCamera . Gravity * deltatime ;
2020-05-23 08:37:42 +00:00
if ( gravity . z > 3.0 ) gravity . z = 3.0 ;
2012-11-27 21:12:20 +00:00
// Test if we don't go through a floor
2020-05-23 08:37:42 +00:00
if ( ( General . Map . VisualCamera . Position . z + gravity . z ) < ( floorheight + cameraflooroffset + 0.1 ) )
2012-11-27 21:12:20 +00:00
{
// Stay above floor
2020-05-23 08:37:42 +00:00
gravity = new Vector3D ( 0.0 , 0.0 , 0.0 ) ;
2012-11-27 21:12:20 +00:00
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?
2020-05-23 08:37:42 +00:00
feetposition = General . Map . VisualCamera . Position - new Vector3D ( 0 , 0 , cameraflooroffset - 7.0 ) ;
2014-07-18 11:25:08 +00:00
SectorLevel ceillevel = sd . GetCeilingAbove ( feetposition ) ? ? sd . Ceiling ;
2020-05-21 12:20:02 +00:00
double ceilheight = ceillevel . plane . GetZ ( General . Map . VisualCamera . Position ) ;
2020-05-23 08:37:42 +00:00
if ( General . Map . VisualCamera . Position . z > ( ceilheight - cameraceilingoffset - 0.01 ) )
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
{
2020-05-23 08:37:42 +00:00
gravity = new Vector3D ( 0.0 , 0.0 , 0.0 ) ;
2009-04-19 18:07:22 +00:00
}
// Do processing
base . OnProcess ( deltatime ) ;
// Process visible geometry
foreach ( IVisualEventReceiver g in visiblegeometry )
{
g . OnProcess ( deltatime ) ;
}
2019-01-19 07:56:13 +00:00
// biwa. Use a lower pick interval for paint selection, to make it more reliable
if ( paintselectpressed )
pickinterval = PICK_INTERVAL_PAINT_SELECT ;
2009-04-19 18:07:22 +00:00
// Time to pick a new target?
2019-01-19 07:56:13 +00:00
if ( Clock . CurrentTime > ( lastpicktime + pickinterval ) )
2009-04-19 18:07:22 +00:00
{
PickTargetUnlocked ( ) ;
2014-05-20 09:09:28 +00:00
lastpicktime = 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 ) ;
}
2016-08-29 10:06:16 +00:00
//mxd
public override void OnClockReset ( )
{
base . OnClockReset ( ) ;
lastpicktime = 0 ;
}
2009-04-19 18:07:22 +00:00
// This draws a frame
public override void OnRedrawDisplay ( )
{
// Start drawing
if ( renderer . Start ( ) )
{
// Use fog!
renderer . SetFogMode ( true ) ;
// Set target for highlighting
2016-05-12 22:35:11 +00:00
renderer . ShowSelection = General . Settings . GZOldHighlightMode | | General . Settings . UseHighlight ; //mxd
2012-10-08 13:07:56 +00:00
2016-05-12 22:35:11 +00:00
if ( General . Settings . UseHighlight )
2012-11-27 21:12:20 +00:00
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
2019-12-21 04:43:16 +00:00
foreach ( VisualThing t in visiblethings )
2009-04-19 18:07:22 +00:00
renderer . AddThingGeometry ( t ) ;
}
2013-03-18 13:52:27 +00:00
//mxd
2014-12-03 23:15:26 +00:00
if ( General . Map . UDMF & & General . Settings . GZShowVisualVertices & & vertices . Count > 0 )
{
2013-03-18 13:52:27 +00:00
List < VisualVertex > verts = new List < VisualVertex > ( ) ;
foreach ( KeyValuePair < Vertex , VisualVertexPair > pair in vertices )
verts . AddRange ( pair . Value . Vertices ) ;
2015-10-02 14:47:34 +00:00
renderer . SetVisualVertices ( verts ) ;
2013-03-18 13:52:27 +00:00
}
2019-12-30 23:08:17 +00:00
2021-02-06 13:51:00 +00:00
renderer . SetVisualSlopeHandles ( renderslopehandles ) ;
2019-12-30 23:08:17 +00:00
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 ( ) ;
2016-01-14 22:15:54 +00:00
UpdateChangedObjects ( ) ; //mxd
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-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 ( ) ;
2020-05-30 14:41:05 +00:00
// The base doesn't know anything about slobe handles, so we have to clear them up ourself
if ( General . Map . UDMF )
{
List < Sector > removedsectors = new List < Sector > ( ) ;
// Get the sectors that were disposed...
foreach ( Sector s in allslopehandles . Keys )
{
if ( s . IsDisposed )
removedsectors . Add ( s ) ;
}
// ... so that we can remove their slope handles
foreach ( Sector s in removedsectors )
{
allslopehandles [ s ] . Clear ( ) ;
allslopehandles . Remove ( s ) ;
2021-01-30 21:01:55 +00:00
sidedefslopehandles [ s ] . Clear ( ) ;
sidedefslopehandles . Remove ( s ) ;
vertexslopehandles [ s ] . Clear ( ) ;
vertexslopehandles . Remove ( s ) ;
2020-05-30 14:41:05 +00:00
}
// Rebuild slope handles for the changed sectors
BuildSlopeHandles ( General . Map . Map . GetMarkedSectors ( true ) ) ;
}
2009-06-16 08:49:14 +00:00
}
else
{
2016-02-24 14:36:46 +00:00
bool sectorsmarked = false ;
2009-06-16 08:49:14 +00:00
// 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
{
2016-04-19 20:40:42 +00:00
BaseVisualSector vs = ( BaseVisualSector ) GetVisualSector ( sd . Sector ) ;
2009-06-16 08:49:14 +00:00
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
{
2016-04-19 20:40:42 +00:00
SectorData sd = GetSectorDataEx ( s ) ;
if ( sd ! = null )
2012-11-27 21:12:20 +00:00
{
2016-04-19 20:40:42 +00:00
sd . Reset ( false ) ; //mxd (changed Reset implementation)
// UpdateSectorGeometry for associated sectors (sd.UpdateAlso) as well!
foreach ( KeyValuePair < Sector , bool > us in sd . UpdateAlso )
2012-11-27 21:12:20 +00:00
{
2016-04-19 20:40:42 +00:00
if ( VisualSectorExists ( us . Key ) )
{
BaseVisualSector vs = ( BaseVisualSector ) GetVisualSector ( us . Key ) ;
vs . UpdateSectorGeometry ( us . Value ) ;
}
2012-11-27 21:12:20 +00:00
}
}
// And update for this sector ofcourse
if ( VisualSectorExists ( s ) )
{
2016-04-19 20:40:42 +00:00
BaseVisualSector vs = ( BaseVisualSector ) GetVisualSector ( s ) ;
2012-11-27 21:12:20 +00:00
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.
2016-02-24 14:36:46 +00:00
HashSet < Thing > toremove = new HashSet < Thing > ( ) ; //mxd
2019-12-26 08:08:11 +00:00
foreach ( KeyValuePair < Thing , VisualThing > vt in allthings )
2016-02-24 14:36:46 +00:00
{
2019-12-26 08:08:11 +00:00
if ( ( vt . Value ! = null ) & & vt . Key . Marked )
{
if ( vt . Key . IsDisposed ) toremove . Add ( vt . Key ) ; //mxd. Disposed things will cause problems
else ( ( BaseVisualThing ) vt . Value ) . Rebuild ( ) ;
}
2016-02-24 14:36:46 +00:00
}
//mxd. Remove disposed things
foreach ( Thing t in toremove )
{
2019-12-26 08:08:11 +00:00
if ( allthings [ t ] ! = null ) allthings [ t ] . Dispose ( ) ;
allthings . Remove ( t ) ;
2016-02-24 14:36:46 +00:00
}
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
2019-12-26 08:08:11 +00:00
foreach ( KeyValuePair < Thing , VisualThing > vt in allthings )
if ( vt . Value ! = null ) vt . Value . Dispose ( ) ;
// 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 ) ;
2014-01-08 09:46:57 +00:00
IVisualEventReceiver o = GetTargetEventReceiver ( true ) ;
o . OnMouseMove ( e ) ;
//mxd. Show hints!
2014-10-13 22:01:17 +00:00
if ( o . GetType ( ) ! = lasthighlighttype )
{
if ( General . Interface . ActiveDockerTabName = = "Help" )
{
2015-12-28 15:01:53 +00:00
if ( o is BaseVisualGeometrySidedef )
2014-10-13 22:01:17 +00:00
{
General . Hints . ShowHints ( this . GetType ( ) , "sidedefs" ) ;
}
2015-12-28 15:01:53 +00:00
else if ( o is BaseVisualGeometrySector )
2014-10-13 22:01:17 +00:00
{
General . Hints . ShowHints ( this . GetType ( ) , "sectors" ) ;
}
2015-12-28 15:01:53 +00:00
else if ( o is BaseVisualThing )
2014-10-13 22:01:17 +00:00
{
General . Hints . ShowHints ( this . GetType ( ) , "things" ) ;
}
2015-12-28 15:01:53 +00:00
else if ( o is BaseVisualVertex )
2014-10-13 22:01:17 +00:00
{
General . Hints . ShowHints ( this . GetType ( ) , "vertices" ) ;
}
else
{
General . Hints . ShowHints ( this . GetType ( ) , HintsManager . GENERAL ) ;
}
2014-01-08 09:46:57 +00:00
}
lasthighlighttype = o . GetType ( ) ;
}
2019-01-19 07:56:13 +00:00
// biwa
if ( o is NullVisualEventReceiver )
highlighted = null ;
else if ( o is VisualGeometry )
highlighted = ( VisualGeometry ) o ;
else if ( o is VisualThing )
highlighted = ( VisualThing ) o ;
2009-04-19 18:07:22 +00:00
}
2009-05-05 09:50:23 +00:00
// Undo performed
public override void OnUndoEnd ( )
{
2013-09-11 09:47:53 +00:00
base . OnUndoEnd ( ) ;
2012-11-27 21:12:20 +00:00
2013-09-11 09:47:53 +00:00
//mxd. Effects may've become invalid
2016-04-19 20:40:42 +00:00
if ( sectordata ! = null & & sectordata . Count > 0 ) RebuildElementData ( ) ;
2013-03-18 13:52:27 +00:00
//mxd. As well as geometry...
2019-12-21 04:43:16 +00:00
foreach ( VisualSector sector in visiblesectors )
2014-12-03 23:15:26 +00:00
{
2019-12-21 04:43:16 +00:00
BaseVisualSector vs = ( BaseVisualSector ) sector ;
2016-03-18 12:52:12 +00:00
if ( vs ! = null ) vs . Rebuild ( ) ;
2013-09-11 09:47:53 +00:00
}
2012-11-27 21:12:20 +00:00
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 ;
}
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
2016-04-19 20:40:42 +00:00
if ( sectordata ! = null & & sectordata . Count > 0 ) RebuildElementData ( ) ;
2013-03-18 13:52:27 +00:00
//mxd. As well as geometry...
2019-12-21 04:43:16 +00:00
foreach ( VisualSector sector in visiblesectors )
2014-12-03 23:15:26 +00:00
{
2019-12-21 04:43:16 +00:00
BaseVisualSector vs = ( BaseVisualSector ) sector ;
2016-03-18 12:52:12 +00:00
if ( vs ! = null ) vs . Rebuild ( ) ;
2013-09-11 09:47:53 +00:00
}
2012-11-27 21:12:20 +00:00
2009-07-07 11:29:56 +00:00
RebuildSelectedObjectsList ( ) ;
}
2013-07-19 15:30:58 +00:00
//mxd
2014-10-28 10:30:11 +00:00
private void Interface_OnSectorEditFormValuesChanged ( object sender , EventArgs e )
{
2019-12-26 08:08:11 +00:00
if ( allsectors = = null ) return ;
2013-07-19 15:30:58 +00:00
// Reset changed flags
2019-12-26 08:08:11 +00:00
foreach ( KeyValuePair < Sector , VisualSector > vs in allsectors )
2014-10-28 10:30:11 +00:00
{
2019-12-26 08:08:11 +00:00
BaseVisualSector bvs = ( BaseVisualSector ) vs . Value ;
2014-01-03 10:33:45 +00:00
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 ;
2013-07-19 15:30:58 +00:00
bvs . Floor . Changed = false ;
bvs . Ceiling . Changed = false ;
}
UpdateChangedObjects ( ) ;
ShowTargetInfo ( ) ;
}
2014-01-20 11:44:41 +00:00
//mxd
2014-10-28 10:30:11 +00:00
private void Interface_OnThingEditFormValuesChanged ( object sender , EventArgs e )
{
2014-01-20 11:44:41 +00:00
//update visual sectors, which are affected by certain things
List < Thing > things = GetSelectedThings ( ) ;
2014-12-03 23:15:26 +00:00
foreach ( Thing t in things )
{
if ( thingdata . ContainsKey ( t ) )
{
2014-01-20 11:44:41 +00:00
// Update what must be updated
ThingData td = GetThingData ( t ) ;
2014-12-03 23:15:26 +00:00
foreach ( KeyValuePair < Sector , bool > s in td . UpdateAlso )
{
if ( VisualSectorExists ( s . Key ) )
{
2016-04-19 20:40:42 +00:00
BaseVisualSector vs = ( BaseVisualSector ) GetVisualSector ( s . Key ) ;
2014-01-20 11:44:41 +00:00
vs . UpdateSectorGeometry ( s . Value ) ;
}
}
}
}
UpdateChangedObjects ( ) ;
ShowTargetInfo ( ) ;
}
2013-07-19 15:30:58 +00:00
//mxd
2014-10-28 10:30:11 +00:00
private void Interface_OnEditFormValuesChanged ( object sender , EventArgs e )
{
2013-07-19 15:30:58 +00:00
UpdateChangedObjects ( ) ;
ShowTargetInfo ( ) ;
}
2014-10-28 10:30:11 +00:00
2020-06-08 18:58:00 +00:00
private void Interface_OnUpdateChangedObjects ( object sender , EventArgs e )
{
UpdateChangedObjects ( ) ;
}
2014-10-28 10:30:11 +00:00
//mxd
private void SelectioninfoupdatetimerOnTick ( object sender , EventArgs eventArgs )
{
selectioninfoupdatetimer . Stop ( ) ;
UpdateSelectionInfo ( ) ;
}
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 )
{
2019-12-30 23:08:17 +00:00
List < IVisualEventReceiver > objs = GetSelectedObjects ( false , true , false , false , false ) ;
Fixed, Texture previews: texture size labels were displaying incorrect size or no size at all when showing TEXTURES textures with negative scale.
Fixed, Visual mode, UDMF: when several wall parts were selected, only one could be dragged with the mouse.
Fixed, Visual mode, Auto-align textures, UDMF: TEXTURES scale is now taken into account when aligning textures.
Fixed, Visual mode, Auto-align textures (Y), UDMF: nearest height matching is now applied to non-wrapped middle backsides.
Cosmetic changes in ZDoom_ACS.cfg.
2015-01-27 11:40:25 +00:00
//mxd. Because Upper/Middle/Lower textures offsets should be threated separately in UDMF
2016-09-05 18:36:22 +00:00
//MaxW. But they're not for Eternity, so this needs its own config setting
if ( General . Map . UDMF & & General . Map . Config . UseLocalSidedefTextureOffsets )
2014-12-03 23:15:26 +00:00
{
2016-04-19 20:40:42 +00:00
HashSet < BaseVisualGeometrySidedef > donesides = new HashSet < BaseVisualGeometrySidedef > ( ) ;
Fixed, Texture previews: texture size labels were displaying incorrect size or no size at all when showing TEXTURES textures with negative scale.
Fixed, Visual mode, UDMF: when several wall parts were selected, only one could be dragged with the mouse.
Fixed, Visual mode, Auto-align textures, UDMF: TEXTURES scale is now taken into account when aligning textures.
Fixed, Visual mode, Auto-align textures (Y), UDMF: nearest height matching is now applied to non-wrapped middle backsides.
Cosmetic changes in ZDoom_ACS.cfg.
2015-01-27 11:40:25 +00:00
foreach ( IVisualEventReceiver i in objs )
{
2016-04-19 20:40:42 +00:00
BaseVisualGeometrySidedef vs = ( BaseVisualGeometrySidedef ) i ; //mxd
if ( ! donesides . Contains ( vs ) )
Fixed, Texture previews: texture size labels were displaying incorrect size or no size at all when showing TEXTURES textures with negative scale.
Fixed, Visual mode, UDMF: when several wall parts were selected, only one could be dragged with the mouse.
Fixed, Visual mode, Auto-align textures, UDMF: TEXTURES scale is now taken into account when aligning textures.
Fixed, Visual mode, Auto-align textures (Y), UDMF: nearest height matching is now applied to non-wrapped middle backsides.
Cosmetic changes in ZDoom_ACS.cfg.
2015-01-27 11:40:25 +00:00
{
//mxd. added scaling by texture scale
if ( vs . Texture . UsedInMap ) //mxd. Otherwise it's MissingTexture3D and we probably don't want to drag that
vs . OnChangeTextureOffset ( ( int ) ( dx / vs . Texture . Scale . x ) , ( int ) ( dy / vs . Texture . Scale . y ) , false ) ;
2013-08-02 12:50:53 +00:00
2016-04-19 20:40:42 +00:00
donesides . Add ( vs ) ;
Fixed, Texture previews: texture size labels were displaying incorrect size or no size at all when showing TEXTURES textures with negative scale.
Fixed, Visual mode, UDMF: when several wall parts were selected, only one could be dragged with the mouse.
Fixed, Visual mode, Auto-align textures, UDMF: TEXTURES scale is now taken into account when aligning textures.
Fixed, Visual mode, Auto-align textures (Y), UDMF: nearest height matching is now applied to non-wrapped middle backsides.
Cosmetic changes in ZDoom_ACS.cfg.
2015-01-27 11:40:25 +00:00
}
}
}
else
{
2016-04-19 20:40:42 +00:00
HashSet < Sidedef > donesides = new HashSet < Sidedef > ( ) ;
Fixed, Texture previews: texture size labels were displaying incorrect size or no size at all when showing TEXTURES textures with negative scale.
Fixed, Visual mode, UDMF: when several wall parts were selected, only one could be dragged with the mouse.
Fixed, Visual mode, Auto-align textures, UDMF: TEXTURES scale is now taken into account when aligning textures.
Fixed, Visual mode, Auto-align textures (Y), UDMF: nearest height matching is now applied to non-wrapped middle backsides.
Cosmetic changes in ZDoom_ACS.cfg.
2015-01-27 11:40:25 +00:00
foreach ( IVisualEventReceiver i in objs )
2014-12-03 23:15:26 +00:00
{
2016-04-19 20:40:42 +00:00
BaseVisualGeometrySidedef vs = ( BaseVisualGeometrySidedef ) i ; //mxd
if ( ! donesides . Contains ( vs . Sidedef ) )
2009-05-04 06:13:56 +00:00
{
2013-08-02 12:50:53 +00:00
//mxd. added scaling by texture scale
if ( vs . Texture . UsedInMap ) //mxd. Otherwise it's MissingTexture3D and we probably don't want to drag that
vs . OnChangeTextureOffset ( ( int ) ( dx / vs . Texture . Scale . x ) , ( int ) ( dy / vs . Texture . Scale . y ) , false ) ;
Fixed, Texture previews: texture size labels were displaying incorrect size or no size at all when showing TEXTURES textures with negative scale.
Fixed, Visual mode, UDMF: when several wall parts were selected, only one could be dragged with the mouse.
Fixed, Visual mode, Auto-align textures, UDMF: TEXTURES scale is now taken into account when aligning textures.
Fixed, Visual mode, Auto-align textures (Y), UDMF: nearest height matching is now applied to non-wrapped middle backsides.
Cosmetic changes in ZDoom_ACS.cfg.
2015-01-27 11:40:25 +00:00
2016-04-19 20:40:42 +00:00
donesides . Add ( vs . Sidedef ) ;
2009-05-04 06:13:56 +00:00
}
}
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 )
{
2016-09-08 19:28:47 +00:00
HashSet < int > donesectors = new HashSet < int > ( ) ;
2019-12-30 23:08:17 +00:00
List < IVisualEventReceiver > objs = GetSelectedObjects ( true , false , false , false , false ) ;
2012-11-27 21:12:20 +00:00
foreach ( IVisualEventReceiver i in objs )
{
2016-04-19 20:40:42 +00:00
BaseVisualGeometrySector bvs = ( BaseVisualGeometrySector ) i ;
2016-09-08 19:28:47 +00:00
if ( bvs ! = null & & ! donesectors . Contains ( bvs . Sector . Sector . Index ) )
2012-11-27 21:12:20 +00:00
{
2016-09-08 19:28:47 +00:00
//mxd. Sector surface belongs to 3d-floor?
if ( bvs . Level . sector . Index ! = bvs . Sector . Sector . Index )
{
// Don't update control sector several times
if ( ! donesectors . Contains ( bvs . Level . sector . Index ) )
{
// Update the offsets
bvs . OnChangeTextureOffset ( dx , dy , false ) ;
// Update control sector
SectorData sd = GetSectorData ( bvs . Level . sector ) ;
sd . Update ( ) ;
BaseVisualSector vs = ( BaseVisualSector ) GetVisualSector ( bvs . Level . sector ) ;
vs . Rebuild ( ) ;
// Add to collection
donesectors . Add ( bvs . Level . sector . Index ) ;
// Update 3d-floors
List < Sector > updatealso = new List < Sector > ( sd . UpdateAlso . Keys ) ;
foreach ( Sector other in updatealso )
{
if ( ! donesectors . Contains ( other . Index ) )
{
BaseVisualSector vsother = ( BaseVisualSector ) GetVisualSector ( other ) ;
vsother . Rebuild ( ) ;
// Add to collection
donesectors . Add ( other . Index ) ;
}
}
}
}
else
{
//mxd. Regular sector surface. Just update the offsets
bvs . OnChangeTextureOffset ( dx , dy , false ) ;
//mxd. Add to collection
donesectors . Add ( bvs . Sector . Sector . Index ) ;
}
//mxd. Update sector geometry
bvs . Sector . Rebuild ( ) ;
2012-11-27 21:12:20 +00:00
}
}
}
2009-05-03 19:22:32 +00:00
// Apply upper unpegged flag
public void ApplyUpperUnpegged ( bool set )
{
2019-12-30 23:08:17 +00:00
List < IVisualEventReceiver > objs = GetSelectedObjects ( false , true , false , 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 )
{
2019-12-30 23:08:17 +00:00
List < IVisualEventReceiver > objs = GetSelectedObjects ( false , true , false , 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
2019-12-30 23:08:17 +00:00
objs = GetSelectedObjects ( true , true , false , 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
2019-12-30 23:08:17 +00:00
objs = GetSelectedObjects ( flat , ! flat , false , false , false ) ;
2009-07-11 10:28:58 +00:00
}
foreach ( IVisualEventReceiver i in objs )
{
i . ApplyTexture ( texture ) ;
}
}
2017-03-13 01:10:07 +00:00
// This returns all selected objects
2019-12-30 23:08:17 +00:00
internal List < IVisualEventReceiver > GetSelectedObjects ( bool includesectors , bool includesidedefs , bool includethings , bool includevertices , bool includeslopehandles )
2009-07-11 10:28:58 +00:00
{
List < IVisualEventReceiver > objs = new List < IVisualEventReceiver > ( ) ;
foreach ( IVisualEventReceiver i in selectedobjects )
{
2016-03-18 12:52:12 +00:00
if ( includesectors & & ( i is BaseVisualGeometrySector ) ) objs . Add ( i ) ;
else if ( includesidedefs & & ( i is BaseVisualGeometrySidedef ) ) objs . Add ( i ) ;
2016-01-16 12:46:44 +00:00
else if ( includethings & & ( i is BaseVisualThing ) ) objs . Add ( i ) ;
else if ( includevertices & & ( i is BaseVisualVertex ) ) objs . Add ( i ) ; //mxd
2019-12-30 23:08:17 +00:00
else if ( includeslopehandles & & ( i is VisualSlope ) ) objs . Add ( i ) ; // biwa
2009-07-11 10:28:58 +00:00
}
// Add highlight?
if ( selectedobjects . Count = = 0 )
{
IVisualEventReceiver i = ( target . picked as IVisualEventReceiver ) ;
2016-03-18 12:52:12 +00:00
if ( includesectors & & ( i is BaseVisualGeometrySector ) ) objs . Add ( i ) ;
else if ( includesidedefs & & ( i is BaseVisualGeometrySidedef ) ) objs . Add ( i ) ;
2016-01-16 12:46:44 +00:00
else if ( includethings & & ( i is BaseVisualThing ) ) objs . Add ( i ) ;
else if ( includevertices & & ( i is BaseVisualVertex ) ) objs . Add ( i ) ; //mxd
2019-12-30 23:08:17 +00:00
else if ( includeslopehandles & & ( i is VisualSlope ) ) objs . Add ( i ) ; // biwa
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
}
2015-01-07 22:14:28 +00:00
//mxd
2016-05-15 00:38:41 +00:00
private static IEnumerable < IVisualEventReceiver > RemoveDuplicateSidedefs ( IEnumerable < IVisualEventReceiver > objs )
2015-01-07 22:14:28 +00:00
{
2016-04-19 20:40:42 +00:00
HashSet < Sidedef > processed = new HashSet < Sidedef > ( ) ;
2015-01-07 22:14:28 +00:00
List < IVisualEventReceiver > result = new List < IVisualEventReceiver > ( ) ;
2016-05-15 00:38:41 +00:00
if ( General . Map . UDMF )
2015-01-07 22:14:28 +00:00
{
2016-05-15 00:38:41 +00:00
// For UDMF maps, we only need to remove duplicate extrafloor sidedefs
foreach ( IVisualEventReceiver i in objs )
2015-01-07 22:14:28 +00:00
{
2016-05-15 00:38:41 +00:00
if ( i is VisualMiddle3D )
{
VisualMiddle3D vm = i as VisualMiddle3D ;
if ( ! processed . Contains ( vm . Sidedef ) )
{
processed . Add ( vm . Sidedef ) ;
result . Add ( i ) ;
}
}
else
2015-01-07 22:14:28 +00:00
{
2016-03-18 12:52:12 +00:00
result . Add ( i ) ;
2015-01-07 22:14:28 +00:00
}
}
2016-05-15 00:38:41 +00:00
}
else
{
// For Doom/Hexen maps, we need to remove all duplicates
foreach ( IVisualEventReceiver i in objs )
2016-03-18 12:52:12 +00:00
{
2016-05-15 00:38:41 +00:00
BaseVisualGeometrySidedef sidedef = i as BaseVisualGeometrySidedef ;
if ( sidedef ! = null )
{
if ( ! processed . Contains ( sidedef . Sidedef ) )
{
processed . Add ( sidedef . Sidedef ) ;
result . Add ( i ) ;
}
}
else
{
result . Add ( i ) ;
}
2016-03-18 12:52:12 +00:00
}
2015-01-07 22:14:28 +00:00
}
return result ;
}
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 ( )
{
2016-04-19 20:40:42 +00:00
HashSet < Sector > added = new HashSet < Sector > ( ) ;
2009-05-03 19:22:32 +00:00
List < Sector > sectors = new List < Sector > ( ) ;
foreach ( IVisualEventReceiver i in selectedobjects )
{
2016-03-18 12:52:12 +00:00
BaseVisualGeometrySector sector = i as BaseVisualGeometrySector ;
2016-04-19 20:40:42 +00:00
if ( sector ! = null & & ! added . Contains ( sector . Level . sector ) )
2009-05-05 19:12:36 +00:00
{
2016-03-18 12:52:12 +00:00
sectors . Add ( sector . Level . sector ) ;
2016-04-19 20:40:42 +00:00
added . Add ( sector . Level . sector ) ;
2009-05-05 19:12:36 +00:00
}
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 ) )
{
2016-03-18 12:52:12 +00:00
Sector s = ( ( BaseVisualGeometrySector ) target . picked ) . Level . sector ;
2016-04-19 20:40:42 +00:00
if ( ! added . Contains ( s ) ) sectors . Add ( s ) ;
2009-07-11 10:28:58 +00:00
}
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 ( )
{
2016-04-19 20:40:42 +00:00
HashSet < Linedef > added = new HashSet < Linedef > ( ) ;
2009-05-03 19:22:32 +00:00
List < Linedef > linedefs = new List < Linedef > ( ) ;
foreach ( IVisualEventReceiver i in selectedobjects )
{
2016-03-18 12:52:12 +00:00
BaseVisualGeometrySidedef sidedef = i as BaseVisualGeometrySidedef ;
if ( sidedef ! = null )
2009-05-05 19:12:36 +00:00
{
2016-03-18 12:52:12 +00:00
Linedef l = sidedef . GetControlLinedef ( ) ; //mxd
2016-04-19 20:40:42 +00:00
if ( ! added . Contains ( l ) )
2009-05-05 19:12:36 +00:00
{
linedefs . Add ( l ) ;
2016-04-19 20:40:42 +00:00
added . Add ( l ) ;
2009-05-05 19:12:36 +00:00
}
}
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 ) )
{
2016-03-18 12:52:12 +00:00
Linedef l = ( ( BaseVisualGeometrySidedef ) target . picked ) . GetControlLinedef ( ) ; //mxd
2016-04-19 20:40:42 +00:00
if ( ! added . Contains ( l ) ) linedefs . Add ( l ) ;
2009-07-11 10:28:58 +00:00
}
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 ( )
{
2016-04-19 20:40:42 +00:00
HashSet < Sidedef > added = new HashSet < Sidedef > ( ) ;
2009-06-12 09:44:38 +00:00
List < Sidedef > sidedefs = new List < Sidedef > ( ) ;
foreach ( IVisualEventReceiver i in selectedobjects )
{
2016-03-18 12:52:12 +00:00
BaseVisualGeometrySidedef sidedef = i as BaseVisualGeometrySidedef ;
2016-04-19 20:40:42 +00:00
if ( sidedef ! = null & & ! added . Contains ( sidedef . Sidedef ) )
2009-06-12 09:44:38 +00:00
{
2016-03-18 12:52:12 +00:00
sidedefs . Add ( sidedef . Sidedef ) ;
2016-04-19 20:40:42 +00:00
added . Add ( sidedef . Sidedef ) ;
2009-06-12 09:44:38 +00:00
}
}
2009-07-11 10:28:58 +00:00
// Add highlight?
if ( ( selectedobjects . Count = = 0 ) & & ( target . picked is BaseVisualGeometrySidedef ) )
{
2016-03-18 12:52:12 +00:00
Sidedef sd = ( ( BaseVisualGeometrySidedef ) target . picked ) . Sidedef ;
2016-04-19 20:40:42 +00:00
if ( ! added . Contains ( sd ) ) sidedefs . Add ( sd ) ;
2009-07-11 10:28:58 +00:00
}
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 ( )
{
2016-04-19 20:40:42 +00:00
HashSet < Thing > added = new HashSet < Thing > ( ) ;
2009-05-03 19:22:32 +00:00
List < Thing > things = new List < Thing > ( ) ;
foreach ( IVisualEventReceiver i in selectedobjects )
{
2016-03-18 12:52:12 +00:00
BaseVisualThing thing = i as BaseVisualThing ;
2016-04-19 20:40:42 +00:00
if ( thing ! = null & & ! added . Contains ( thing . Thing ) )
2009-05-05 19:12:36 +00:00
{
2016-03-18 12:52:12 +00:00
things . Add ( thing . Thing ) ;
2016-04-19 20:40:42 +00:00
added . Add ( thing . Thing ) ;
2009-05-05 19:12:36 +00:00
}
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 ) )
{
2016-03-18 12:52:12 +00:00
Thing t = ( ( BaseVisualThing ) target . picked ) . Thing ;
2016-04-19 20:40:42 +00:00
if ( ! added . Contains ( t ) ) things . Add ( t ) ;
2009-07-11 10:28:58 +00:00
}
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
2014-12-03 23:15:26 +00:00
public List < Vertex > GetSelectedVertices ( )
{
2016-04-19 20:40:42 +00:00
HashSet < Vertex > added = new HashSet < Vertex > ( ) ;
2013-03-18 13:52:27 +00:00
List < Vertex > verts = new List < Vertex > ( ) ;
2016-04-19 20:40:42 +00:00
foreach ( IVisualEventReceiver i in selectedobjects )
2014-12-03 23:15:26 +00:00
{
2016-04-19 20:40:42 +00:00
BaseVisualVertex vertex = i as BaseVisualVertex ;
if ( vertex ! = null & & ! added . Contains ( vertex . Vertex ) )
2014-12-03 23:15:26 +00:00
{
2016-04-19 20:40:42 +00:00
verts . Add ( vertex . Vertex ) ;
added . Add ( vertex . Vertex ) ;
2013-03-18 13:52:27 +00:00
}
}
// Add highlight?
2014-12-03 23:15:26 +00:00
if ( ( selectedobjects . Count = = 0 ) & & ( target . picked is BaseVisualVertex ) )
{
2016-03-18 12:52:12 +00:00
Vertex v = ( ( BaseVisualVertex ) target . picked ) . Vertex ;
2016-04-19 20:40:42 +00:00
if ( ! added . Contains ( v ) ) verts . Add ( v ) ;
2013-03-18 13:52:27 +00:00
}
return verts ;
}
2020-02-23 11:44:59 +00:00
// This returns all selected slope handles, no doubles
private List < VisualSidedefSlope > GetSelectedSlopeHandles ( )
{
HashSet < VisualSidedefSlope > added = new HashSet < VisualSidedefSlope > ( ) ;
List < VisualSidedefSlope > handles = new List < VisualSidedefSlope > ( ) ;
foreach ( IVisualEventReceiver i in selectedobjects )
{
VisualSidedefSlope handle = i as VisualSidedefSlope ;
if ( handle ! = null & & ! added . Contains ( handle ) )
{
handles . Add ( handle ) ;
added . Add ( handle ) ;
}
}
// Add highlight?
if ( ( selectedobjects . Count = = 0 ) & & ( target . picked is VisualSidedefSlope ) )
{
VisualSidedefSlope handle = ( VisualSidedefSlope ) target . picked ;
if ( ! added . Contains ( handle ) ) handles . Add ( handle ) ;
}
return handles ;
}
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 )
{
2020-02-22 23:48:47 +00:00
if ( singleselection | | target . picked . Selected | | targetonly | | target . picked is VisualSlope )
2009-07-07 11:29:56 +00:00
{
2016-04-19 20:40:42 +00:00
return ( IVisualEventReceiver ) target . picked ;
2009-07-07 11:29:56 +00:00
}
2014-02-07 09:10:55 +00:00
if ( selectedobjects . Count > 0 )
2009-07-07 11:29:56 +00:00
{
return selectedobjects [ 0 ] ;
}
2014-02-07 09:10:55 +00:00
2016-04-19 20:40:42 +00:00
return ( IVisualEventReceiver ) target . picked ;
2009-07-07 11:29:56 +00:00
}
2014-02-07 09:10:55 +00:00
return new NullVisualEventReceiver ( ) ;
2009-07-07 11:29:56 +00:00
}
2012-07-05 13:48:08 +00:00
2013-09-11 09:47:53 +00:00
//mxd. Copied from BuilderModes.ThingsMode
// This creates a new thing
2014-05-20 09:09:28 +00:00
private static Thing CreateThing ( Vector2D pos )
{
2015-12-28 15:01:53 +00:00
if ( pos . x < General . Map . Config . LeftBoundary | | pos . x > General . Map . Config . RightBoundary | |
2014-12-03 23:15:26 +00:00
pos . y > General . Map . Config . TopBoundary | | pos . y < General . Map . Config . BottomBoundary )
{
2013-09-11 09:47:53 +00:00
General . Interface . DisplayStatus ( StatusType . Warning , "Failed to insert thing: outside of map boundaries." ) ;
return null ;
}
// Create thing
Thing t = General . Map . Map . CreateThing ( ) ;
2015-12-28 15:01:53 +00:00
if ( t ! = null )
2014-12-03 23:15:26 +00:00
{
2013-09-11 09:47:53 +00:00
General . Settings . ApplyDefaultThingSettings ( t ) ;
t . Move ( pos ) ;
t . UpdateConfiguration ( ) ;
General . Map . IsChanged = true ;
// Update things filter so that it includes this thing
General . Map . ThingsFilter . Update ( ) ;
// Snap to grid enabled?
2015-12-28 15:01:53 +00:00
if ( General . Interface . SnapToGrid )
2014-12-03 23:15:26 +00:00
{
2013-09-11 09:47:53 +00:00
// Snap to grid
t . SnapToGrid ( ) ;
2014-12-03 23:15:26 +00:00
}
else
{
2013-09-11 09:47:53 +00:00
// Snap to map format accuracy
t . SnapToAccuracy ( ) ;
}
}
return t ;
2017-03-13 01:10:07 +00:00
}
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
2017-03-13 01:10:07 +00:00
// [ZZ] I moved this out of ClearSelection because "cut selection" action needs this to only affect things.
2019-12-30 23:08:17 +00:00
private void ClearSelection ( bool clearsectors , bool clearsidedefs , bool clearthings , bool clearvertices , bool clearslopehandles , bool displaystatus )
2017-03-13 01:10:07 +00:00
{
selectedobjects . RemoveAll ( obj = >
{
return ( ( obj is BaseVisualGeometrySector & & clearsectors ) | |
( obj is BaseVisualGeometrySidedef & & clearsidedefs ) | |
( obj is BaseVisualThing & & clearthings ) | |
2019-12-30 23:08:17 +00:00
( obj is BaseVisualVertex & & clearvertices ) | |
( obj is VisualSlope & & clearslopehandles ) ) ;
2017-03-13 01:10:07 +00:00
} ) ;
//
2019-12-26 08:08:11 +00:00
foreach ( KeyValuePair < Sector , VisualSector > vs in allsectors )
2017-03-13 01:10:07 +00:00
{
2019-12-26 08:08:11 +00:00
if ( vs . Value ! = null )
2017-03-13 01:10:07 +00:00
{
2019-12-26 08:08:11 +00:00
BaseVisualSector bvs = ( BaseVisualSector ) vs . Value ;
if ( clearsectors )
{
if ( bvs . Floor ! = null ) bvs . Floor . Selected = false ;
if ( bvs . Ceiling ! = null ) bvs . Ceiling . Selected = false ;
foreach ( VisualFloor vf in bvs . ExtraFloors ) vf . Selected = false ;
foreach ( VisualCeiling vc in bvs . ExtraCeilings ) vc . Selected = false ;
foreach ( VisualFloor vf in bvs . ExtraBackFloors ) vf . Selected = false ; //mxd
foreach ( VisualCeiling vc in bvs . ExtraBackCeilings ) vc . Selected = false ; //mxd
}
2017-03-13 01:10:07 +00:00
2019-12-26 08:08:11 +00:00
if ( clearsidedefs )
2017-03-13 01:10:07 +00:00
{
2019-12-26 08:08:11 +00:00
foreach ( Sidedef sd in vs . Key . Sidedefs )
{
//mxd. VisualSidedefParts can contain references to visual geometry, which is not present in VisualSector.sidedefgeometry
bvs . GetSidedefParts ( sd ) . DeselectAllParts ( ) ;
}
2017-03-13 01:10:07 +00:00
}
}
}
if ( clearthings )
{
2019-12-26 08:08:11 +00:00
foreach ( KeyValuePair < Thing , VisualThing > vt in allthings )
2017-03-13 01:10:07 +00:00
{
2019-12-26 08:08:11 +00:00
if ( vt . Value ! = null )
{
BaseVisualThing bvt = ( BaseVisualThing ) vt . Value ;
bvt . Selected = false ;
}
2017-03-13 01:10:07 +00:00
}
}
//mxd
if ( clearvertices )
{
if ( General . Map . UDMF )
{
foreach ( KeyValuePair < Vertex , VisualVertexPair > pair in vertices ) pair . Value . Deselect ( ) ;
}
}
2019-12-30 23:08:17 +00:00
// biwa
if ( clearslopehandles )
{
if ( General . Map . UDMF )
{
foreach ( KeyValuePair < Sector , List < VisualSlope > > kvp in allslopehandles )
{
2021-01-30 21:01:55 +00:00
foreach ( VisualSlope handle in kvp . Value )
2019-12-30 23:08:17 +00:00
{
handle . Selected = false ;
handle . Pivot = false ;
}
}
2021-02-06 13:51:00 +00:00
renderslopehandles . Clear ( ) ;
2019-12-30 23:08:17 +00:00
}
}
//mxd
if ( displaystatus )
2017-03-13 01:10:07 +00:00
{
2019-12-27 16:00:13 +00:00
General . Interface . DisplayStatus ( StatusType . Selection , string . Empty ) ;
2017-03-13 01:10:07 +00:00
}
}
[BeginAction("clearselection", BaseAction = true)]
2009-05-01 20:31:17 +00:00
public void ClearSelection ( )
{
2019-12-30 23:08:17 +00:00
ClearSelection ( true , true , true , true , true , true ) ;
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 ( )
{
2013-04-01 11:06:01 +00:00
IVisualEventReceiver target = GetTargetEventReceiver ( true ) ;
target . OnSelectEnd ( ) ;
//mxd
2014-12-03 23:15:26 +00:00
if ( ( General . Interface . ShiftState | | General . Interface . CtrlState ) & & selectedobjects . Count > 0 )
{
2015-07-26 23:18:13 +00:00
if ( General . Interface . AltState )
{
2016-05-12 11:32:10 +00:00
target . SelectNeighbours ( target . Selected , General . Interface . ShiftState , General . Interface . CtrlState ) ;
2015-07-26 23:18:13 +00:00
}
else
{
IVisualEventReceiver [ ] selection = new IVisualEventReceiver [ selectedobjects . Count ] ;
selectedobjects . CopyTo ( selection ) ;
foreach ( IVisualEventReceiver obj in selection )
2016-05-12 11:32:10 +00:00
obj . SelectNeighbours ( target . Selected , General . Interface . ShiftState , General . Interface . CtrlState ) ;
2015-07-26 23:18:13 +00:00
}
2013-04-01 11:06:01 +00:00
}
2009-07-07 14:52:39 +00:00
Renderer . ShowSelection = true ;
Renderer . ShowHighlight = true ;
2009-05-03 19:22:32 +00:00
PostAction ( ) ;
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 ) ;
2019-12-30 23:08:17 +00:00
List < IVisualEventReceiver > objs = GetSelectedObjects ( true , true , true , true , true ) ;
bool hasvisualslopehandles = objs . Any ( o = > o is VisualSlope ) ;
foreach ( IVisualEventReceiver i in objs ) // If slope handles are selected only apply the action to them
if ( ! hasvisualslopehandles | | ( hasvisualslopehandles & & i is VisualSlope ) )
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 ) ;
2019-12-30 23:08:17 +00:00
List < IVisualEventReceiver > objs = GetSelectedObjects ( true , true , true , true , true ) ;
bool hasvisualslopehandles = objs . Any ( o = > o is VisualSlope ) ;
foreach ( IVisualEventReceiver i in objs ) // If slope handles are selected only apply the action to them
if ( ! hasvisualslopehandles | | ( hasvisualslopehandles & & i is VisualSlope ) )
i . OnChangeTargetHeight ( - 8 ) ;
2009-05-03 19:22:32 +00:00
PostAction ( ) ;
2009-04-19 18:07:22 +00:00
}
2018-06-07 08:32:36 +00:00
[BeginAction("raisesector1")]
public void RaiseSector1 ( ) {
PreAction ( UndoGroup . SectorHeightChange ) ;
2019-12-30 23:08:17 +00:00
List < IVisualEventReceiver > objs = GetSelectedObjects ( true , true , true , true , true ) ;
bool hasvisualslopehandles = objs . Any ( o = > o is VisualSlope ) ;
foreach ( IVisualEventReceiver i in objs ) // If slope handles are selected only apply the action to them
if ( ! hasvisualslopehandles | | ( hasvisualslopehandles & & i is VisualSlope ) )
i . OnChangeTargetHeight ( 1 ) ;
PostAction ( ) ;
2018-06-07 08:32:36 +00:00
}
[BeginAction("lowersector1")]
public void LowerSector1 ( ) {
PreAction ( UndoGroup . SectorHeightChange ) ;
2019-12-30 23:08:17 +00:00
List < IVisualEventReceiver > objs = GetSelectedObjects ( true , true , true , true , true ) ;
bool hasvisualslopehandles = objs . Any ( o = > o is VisualSlope ) ;
foreach ( IVisualEventReceiver i in objs ) // If slope handles are selected only apply the action to them
if ( ! hasvisualslopehandles | | ( hasvisualslopehandles & & i is VisualSlope ) )
i . OnChangeTargetHeight ( - 1 ) ;
PostAction ( ) ;
2018-06-07 08:32:36 +00:00
}
[BeginAction("raisesector128")]
public void RaiseSector128 ( ) {
PreAction ( UndoGroup . SectorHeightChange ) ;
2019-12-30 23:08:17 +00:00
List < IVisualEventReceiver > objs = GetSelectedObjects ( true , true , true , true , true ) ;
bool hasvisualslopehandles = objs . Any ( o = > o is VisualSlope ) ;
foreach ( IVisualEventReceiver i in objs ) // If slope handles are selected only apply the action to them
if ( ! hasvisualslopehandles | | ( hasvisualslopehandles & & i is VisualSlope ) )
i . OnChangeTargetHeight ( 128 ) ;
PostAction ( ) ;
2018-06-07 08:32:36 +00:00
}
[BeginAction("lowersector128")]
public void LowerSector128 ( ) {
PreAction ( UndoGroup . SectorHeightChange ) ;
2019-12-30 23:08:17 +00:00
List < IVisualEventReceiver > objs = GetSelectedObjects ( true , true , true , true , true ) ;
bool hasvisualslopehandles = objs . Any ( o = > o is VisualSlope ) ;
foreach ( IVisualEventReceiver i in objs ) // If slope handles are selected only apply the action to them
if ( ! hasvisualslopehandles | | ( hasvisualslopehandles & & i is VisualSlope ) )
i . OnChangeTargetHeight ( - 128 ) ;
PostAction ( ) ;
2018-06-07 08:32:36 +00:00
}
//mxd
[BeginAction("raisesectortonearest")]
2014-12-03 23:15:26 +00:00
public void RaiseSectorToNearest ( )
{
2020-03-19 15:16:08 +00:00
List < VisualSidedefSlope > selectedhandles = GetSelectedSlopeHandles ( ) ;
2013-04-02 12:19:25 +00:00
2020-03-19 15:16:08 +00:00
if ( selectedhandles . Count > 0 )
2014-12-03 23:15:26 +00:00
{
2020-03-19 15:16:08 +00:00
if ( selectedhandles . Count > 1 )
2014-12-03 23:15:26 +00:00
{
2020-03-19 15:16:08 +00:00
General . Interface . DisplayStatus ( StatusType . Warning , "Can only raise to nearest when one visual slope handle is selected" ) ;
return ;
}
2020-03-21 00:19:04 +00:00
int startheight = ( int ) Math . Round ( selectedhandles [ 0 ] . GetCenterPoint ( ) . z ) ;
2020-03-19 15:16:08 +00:00
int targetheight = int . MaxValue ;
2021-01-30 21:01:55 +00:00
foreach ( KeyValuePair < Sector , List < VisualSlope > > kvp in sidedefslopehandles )
2014-12-03 23:15:26 +00:00
{
2020-03-19 15:16:08 +00:00
foreach ( VisualSidedefSlope handle in kvp . Value )
{
if ( handle ! = selectedhandles [ 0 ] & & handle . Sidedef . Line = = selectedhandles [ 0 ] . Sidedef . Line )
{
2020-03-21 00:19:04 +00:00
int z = ( int ) Math . Round ( handle . GetCenterPoint ( ) . z ) ;
2020-03-19 15:16:08 +00:00
if ( z > startheight & & z < targetheight )
targetheight = z ;
}
}
}
if ( targetheight ! = int . MaxValue )
2014-12-03 23:15:26 +00:00
{
2020-03-19 15:16:08 +00:00
PreAction ( UndoGroup . SectorHeightChange ) ;
selectedhandles [ 0 ] . OnChangeTargetHeight ( targetheight - startheight ) ;
PostAction ( ) ;
2013-04-02 12:19:25 +00:00
}
2020-03-19 15:16:08 +00:00
else
{
General . Interface . DisplayStatus ( StatusType . Warning , "Can't raise: already at the highest level" ) ;
}
}
else
2014-12-03 23:15:26 +00:00
{
2020-03-19 15:16:08 +00:00
Dictionary < Sector , VisualFloor > floors = new Dictionary < Sector , VisualFloor > ( ) ;
Dictionary < Sector , VisualCeiling > ceilings = new Dictionary < Sector , VisualCeiling > ( ) ;
List < BaseVisualThing > things = new List < BaseVisualThing > ( ) ;
bool withinSelection = General . Interface . CtrlState ;
// Get selection
if ( selectedobjects . Count = = 0 )
2014-12-03 23:15:26 +00:00
{
2020-03-19 15:16:08 +00:00
if ( target . picked is VisualFloor )
2014-12-03 23:15:26 +00:00
{
2020-03-19 15:16:08 +00:00
VisualFloor vf = ( VisualFloor ) target . picked ;
2020-04-07 19:18:07 +00:00
floors [ vf . Level . sector ] = vf ;
2020-03-19 15:16:08 +00:00
}
else if ( target . picked is VisualCeiling )
2014-12-03 23:15:26 +00:00
{
2020-03-19 15:16:08 +00:00
VisualCeiling vc = ( VisualCeiling ) target . picked ;
2020-04-07 19:18:07 +00:00
ceilings [ vc . Level . sector ] = vc ;
2020-03-19 15:16:08 +00:00
}
else if ( target . picked is BaseVisualThing )
2014-12-03 23:15:26 +00:00
{
2020-03-19 15:16:08 +00:00
things . Add ( ( BaseVisualThing ) target . picked ) ;
2013-04-02 12:19:25 +00:00
}
}
2020-03-19 15:16:08 +00:00
else
2014-12-03 23:15:26 +00:00
{
2020-03-19 15:16:08 +00:00
foreach ( IVisualEventReceiver i in selectedobjects )
{
if ( i is VisualFloor )
{
VisualFloor vf = ( VisualFloor ) i ;
2020-04-07 19:18:07 +00:00
floors [ vf . Level . sector ] = vf ;
2020-03-19 15:16:08 +00:00
}
else if ( i is VisualCeiling )
{
VisualCeiling vc = ( VisualCeiling ) i ;
2020-04-07 19:18:07 +00:00
ceilings [ vc . Level . sector ] = vc ;
2020-03-19 15:16:08 +00:00
}
else if ( i is BaseVisualThing )
{
things . Add ( ( BaseVisualThing ) i ) ;
}
}
2013-04-04 10:14:44 +00:00
}
2020-03-19 15:16:08 +00:00
// Check what we have
if ( floors . Count + ceilings . Count = = 0 & & ( things . Count = = 0 | | ! General . Map . FormatInterface . HasThingHeight ) )
2014-12-03 23:15:26 +00:00
{
2020-03-19 15:16:08 +00:00
General . Interface . DisplayStatus ( StatusType . Warning , "No suitable objects found!" ) ;
2013-04-04 10:14:44 +00:00
return ;
}
2020-03-19 15:16:08 +00:00
if ( withinSelection )
{
string s = string . Empty ;
2013-12-03 13:12:12 +00:00
2020-03-19 15:16:08 +00:00
if ( floors . Count = = 1 ) s = "floors" ;
2013-12-03 13:12:12 +00:00
2020-03-19 15:16:08 +00:00
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-12-03 13:12:12 +00:00
}
2020-03-19 15:16:08 +00:00
// Process floors...
int maxSelectedHeight = int . MinValue ;
int minSelectedCeilingHeight = int . MaxValue ;
int targetCeilingHeight = int . MaxValue ;
2013-04-02 12:19:25 +00:00
2020-03-19 15:16:08 +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-02 12:19:25 +00:00
2020-03-19 15:16:08 +00:00
if ( withinSelection )
2014-12-03 23:15:26 +00:00
{
2020-03-19 15:16:08 +00:00
// We are raising, so we don't need to check anything
targetCeilingHeight = maxSelectedHeight ;
}
else
2014-12-03 23:15:26 +00:00
{
2020-03-19 15:16:08 +00:00
// Get next higher floor or ceiling from surrounding unselected sectors
foreach ( Sector s in BuilderModesTools . GetSectorsAround ( this , ceilings . Keys ) )
{
if ( s . FloorHeight < targetCeilingHeight & & s . FloorHeight > maxSelectedHeight )
targetCeilingHeight = s . FloorHeight ;
else if ( s . CeilHeight < targetCeilingHeight & & s . CeilHeight > maxSelectedHeight )
targetCeilingHeight = s . CeilHeight ;
}
2013-04-02 12:19:25 +00:00
}
2020-03-19 15:16:08 +00:00
// Ceilings...
maxSelectedHeight = int . MinValue ;
int targetFloorHeight = int . MaxValue ;
2013-04-04 10:14:44 +00:00
2020-03-19 15:16:08 +00:00
// Get maximum floor and minimum ceiling heights from selection
foreach ( KeyValuePair < Sector , VisualFloor > group in floors )
2014-12-03 23:15:26 +00:00
{
2020-03-19 15:16:08 +00:00
if ( group . Key . FloorHeight > maxSelectedHeight ) maxSelectedHeight = group . Key . FloorHeight ;
if ( group . Key . CeilHeight < minSelectedCeilingHeight ) minSelectedCeilingHeight = group . Key . CeilHeight ;
}
if ( withinSelection )
2014-12-03 23:15:26 +00:00
{
2020-03-19 15:16:08 +00:00
// Check heights
if ( minSelectedCeilingHeight < maxSelectedHeight )
{
General . Interface . DisplayStatus ( StatusType . Warning , "Can't do: lowest ceiling is lower than highest floor!" ) ;
return ;
}
targetFloorHeight = maxSelectedHeight ;
}
else
{
// Get next higher floor or ceiling from surrounding unselected sectors
foreach ( Sector s in BuilderModesTools . GetSectorsAround ( this , floors . Keys ) )
{
if ( s . FloorHeight > maxSelectedHeight & & s . FloorHeight < targetFloorHeight & & s . FloorHeight < = minSelectedCeilingHeight )
targetFloorHeight = s . FloorHeight ;
else if ( s . CeilHeight > maxSelectedHeight & & s . CeilHeight < targetFloorHeight & & s . CeilHeight < = minSelectedCeilingHeight )
targetFloorHeight = s . CeilHeight ;
}
2013-12-03 13:12:12 +00:00
}
2013-04-04 10:14:44 +00:00
2020-03-19 15:16:08 +00:00
//CHECK VALUES
string alignFailDescription = string . Empty ;
2013-04-04 10:14:44 +00:00
2020-03-19 15:16:08 +00:00
if ( floors . Count > 0 & & targetFloorHeight = = int . MaxValue )
{
// Raise to lowest ceiling?
if ( ! withinSelection & & minSelectedCeilingHeight > maxSelectedHeight )
{
targetFloorHeight = minSelectedCeilingHeight ;
}
else
{
alignFailDescription = floors . Count > 1 ? "floors" : "floor" ;
}
}
2013-04-04 10:14:44 +00:00
2020-03-19 15:16:08 +00:00
if ( ceilings . Count > 0 & & targetCeilingHeight = = int . MaxValue )
{
if ( ! string . IsNullOrEmpty ( alignFailDescription ) ) alignFailDescription + = " and " ;
alignFailDescription + = ceilings . Count > 1 ? "ceilings" : "ceiling" ;
}
2013-04-05 10:56:07 +00:00
2020-03-19 15:16:08 +00:00
if ( ! string . IsNullOrEmpty ( alignFailDescription ) )
2014-12-03 23:15:26 +00:00
{
2020-03-19 15:16:08 +00:00
General . Interface . DisplayStatus ( StatusType . Warning , "Unable to align selected " + alignFailDescription + "!" ) ;
return ;
2013-04-04 10:14:44 +00:00
}
2020-03-19 15:16:08 +00:00
//APPLY VALUES
PreAction ( UndoGroup . SectorHeightChange ) ;
// Change floors heights
if ( floors . Count > 0 )
2014-12-03 23:15:26 +00:00
{
2020-03-19 15:16:08 +00:00
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
}
2020-03-19 15:16:08 +00:00
// Change ceilings heights
if ( ceilings . Count > 0 )
2014-12-03 23:15:26 +00:00
{
2020-03-19 15:16:08 +00:00
foreach ( KeyValuePair < Sector , VisualCeiling > group in ceilings )
{
if ( targetCeilingHeight ! = group . Key . CeilHeight )
group . Value . OnChangeTargetHeight ( targetCeilingHeight - group . Key . CeilHeight ) ;
}
2013-04-02 12:19:25 +00:00
}
2020-03-19 15:16:08 +00:00
// Change things heights. Align to higher 3d floor or actual ceiling.
if ( General . Map . FormatInterface . HasThingHeight )
{
foreach ( BaseVisualThing vt in things )
{
if ( vt . Thing . Sector = = null ) continue ;
SectorData sd = GetSectorData ( vt . Thing . Sector ) ;
vt . OnMove ( new Vector3D ( vt . Thing . Position , BuilderModesTools . GetHigherThingZ ( this , sd , vt ) ) ) ;
}
}
PostAction ( ) ;
}
2013-04-02 12:19:25 +00:00
}
//mxd
[BeginAction("lowersectortonearest")]
2014-12-03 23:15:26 +00:00
public void LowerSectorToNearest ( )
{
2020-03-19 15:16:08 +00:00
List < VisualSidedefSlope > selectedhandles = GetSelectedSlopeHandles ( ) ;
2013-04-02 12:19:25 +00:00
2020-03-19 15:16:08 +00:00
if ( selectedhandles . Count > 0 )
2014-12-03 23:15:26 +00:00
{
2020-03-19 15:16:08 +00:00
if ( selectedhandles . Count > 1 )
2014-12-03 23:15:26 +00:00
{
2020-03-19 15:16:08 +00:00
General . Interface . DisplayStatus ( StatusType . Warning , "Can only lower to nearest when one visual slope handle is selected" ) ;
return ;
}
2020-03-21 00:19:04 +00:00
int startheight = ( int ) Math . Round ( selectedhandles [ 0 ] . GetCenterPoint ( ) . z ) ;
2020-03-19 15:16:08 +00:00
int targetheight = int . MinValue ;
2021-01-30 21:01:55 +00:00
foreach ( KeyValuePair < Sector , List < VisualSlope > > kvp in sidedefslopehandles )
2014-12-03 23:15:26 +00:00
{
2020-03-19 15:16:08 +00:00
foreach ( VisualSidedefSlope handle in kvp . Value )
{
if ( handle ! = selectedhandles [ 0 ] & & handle . Sidedef . Line = = selectedhandles [ 0 ] . Sidedef . Line )
{
2020-03-21 00:19:04 +00:00
int z = ( int ) Math . Round ( handle . GetCenterPoint ( ) . z ) ;
2020-03-19 15:16:08 +00:00
if ( z < startheight & & z > targetheight )
targetheight = z ;
}
}
}
if ( targetheight ! = int . MinValue )
2014-12-03 23:15:26 +00:00
{
2020-03-19 15:16:08 +00:00
PreAction ( UndoGroup . SectorHeightChange ) ;
selectedhandles [ 0 ] . OnChangeTargetHeight ( - ( startheight - targetheight ) ) ;
PostAction ( ) ;
}
else
{
General . Interface . DisplayStatus ( StatusType . Warning , "Can't lower: already at the lowest level" ) ;
2013-04-02 12:19:25 +00:00
}
2014-12-03 23:15:26 +00:00
}
else
{
2020-03-19 15:16:08 +00:00
Dictionary < Sector , VisualFloor > floors = new Dictionary < Sector , VisualFloor > ( ) ;
Dictionary < Sector , VisualCeiling > ceilings = new Dictionary < Sector , VisualCeiling > ( ) ;
List < BaseVisualThing > things = new List < BaseVisualThing > ( ) ;
bool withinSelection = General . Interface . CtrlState ;
// Get selection
if ( selectedobjects . Count = = 0 )
2014-12-03 23:15:26 +00:00
{
2020-03-19 15:16:08 +00:00
if ( target . picked is VisualFloor )
2014-12-03 23:15:26 +00:00
{
2020-03-19 15:16:08 +00:00
VisualFloor vf = ( VisualFloor ) target . picked ;
2020-04-07 19:18:07 +00:00
floors [ vf . Level . sector ] = vf ;
2020-03-19 15:16:08 +00:00
}
else if ( target . picked is VisualCeiling )
2014-12-03 23:15:26 +00:00
{
2020-03-19 15:16:08 +00:00
VisualCeiling vc = ( VisualCeiling ) target . picked ;
2020-04-07 19:18:07 +00:00
ceilings [ vc . Level . sector ] = vc ;
2020-03-19 15:16:08 +00:00
}
else if ( target . picked is BaseVisualThing )
2014-12-03 23:15:26 +00:00
{
2020-03-19 15:16:08 +00:00
things . Add ( ( BaseVisualThing ) target . picked ) ;
}
}
else
{
foreach ( IVisualEventReceiver i in selectedobjects )
{
if ( i is VisualFloor )
{
VisualFloor vf = ( VisualFloor ) i ;
2020-04-07 19:18:07 +00:00
floors [ vf . Level . sector ] = vf ;
2020-03-19 15:16:08 +00:00
}
else if ( i is VisualCeiling )
{
VisualCeiling vc = ( VisualCeiling ) i ;
2020-04-07 19:18:07 +00:00
ceilings [ vc . Level . sector ] = vc ;
2020-03-19 15:16:08 +00:00
}
else if ( i is BaseVisualThing )
{
things . Add ( ( BaseVisualThing ) i ) ;
}
2013-04-02 12:19:25 +00:00
}
}
2020-03-19 15:16:08 +00:00
// Check what we have
if ( floors . Count + ceilings . Count = = 0 & & ( things . Count = = 0 | | ! General . Map . FormatInterface . HasThingHeight ) )
{
General . Interface . DisplayStatus ( StatusType . Warning , "No suitable objects found!" ) ;
return ;
}
2013-04-04 10:14:44 +00:00
2020-03-19 15:16:08 +00:00
if ( withinSelection )
{
string s = string . Empty ;
2013-04-04 10:14:44 +00:00
2020-03-19 15:16:08 +00:00
if ( floors . Count = = 1 ) s = "floors" ;
2013-04-04 10:14:44 +00:00
2020-03-19 15:16:08 +00:00
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-04 10:14:44 +00:00
}
2020-03-19 15:16:08 +00:00
// Process floors...
int minSelectedHeight = int . MaxValue ;
int targetFloorHeight = int . MinValue ;
// Get minimum floor height from selection
foreach ( KeyValuePair < Sector , VisualFloor > group in floors )
2014-12-03 23:15:26 +00:00
{
2020-03-19 15:16:08 +00:00
if ( group . Key . FloorHeight < minSelectedHeight ) minSelectedHeight = group . Key . FloorHeight ;
2013-04-04 10:14:44 +00:00
}
2013-04-02 12:19:25 +00:00
2020-03-19 15:16:08 +00:00
if ( withinSelection )
2014-12-03 23:15:26 +00:00
{
2020-03-19 15:16:08 +00:00
// We are lowering, so we don't need to check anything
targetFloorHeight = minSelectedHeight ;
}
else
{
// Get next lower ceiling or floor from surrounding unselected sectors
foreach ( Sector s in BuilderModesTools . GetSectorsAround ( this , floors . Keys ) )
{
if ( s . CeilHeight > targetFloorHeight & & s . CeilHeight < minSelectedHeight )
targetFloorHeight = s . CeilHeight ;
else if ( s . FloorHeight > targetFloorHeight & & s . FloorHeight < minSelectedHeight )
targetFloorHeight = s . FloorHeight ;
}
2013-04-02 12:19:25 +00:00
}
2020-03-19 15:16:08 +00:00
// Ceilings...
minSelectedHeight = int . MaxValue ;
int maxSelectedFloorHeight = int . MinValue ;
int targetCeilingHeight = int . MinValue ;
2013-04-02 12:19:25 +00:00
2020-03-19 15:16:08 +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-02 12:19:25 +00:00
2020-03-19 15:16:08 +00:00
if ( withinSelection )
2014-12-03 23:15:26 +00:00
{
2020-03-19 15:16:08 +00:00
if ( minSelectedHeight < maxSelectedFloorHeight )
{
General . Interface . DisplayStatus ( StatusType . Warning , "Can't do: lowest ceiling is lower than highest floor!" ) ;
return ;
}
targetCeilingHeight = minSelectedHeight ;
}
else
2014-12-03 23:15:26 +00:00
{
2020-03-19 15:16:08 +00:00
// Get next lower ceiling or floor from surrounding unselected sectors
foreach ( Sector s in BuilderModesTools . GetSectorsAround ( this , ceilings . Keys ) )
{
if ( s . CeilHeight > targetCeilingHeight & & s . CeilHeight < minSelectedHeight & & s . CeilHeight > = maxSelectedFloorHeight )
targetCeilingHeight = s . CeilHeight ;
else if ( s . FloorHeight > targetCeilingHeight & & s . FloorHeight < minSelectedHeight & & s . FloorHeight > = maxSelectedFloorHeight )
targetCeilingHeight = s . FloorHeight ;
}
2013-04-04 10:14:44 +00:00
}
2020-03-19 15:16:08 +00:00
//CHECK VALUES:
string alignFailDescription = string . Empty ;
2013-04-04 10:14:44 +00:00
2020-03-19 15:16:08 +00:00
if ( floors . Count > 0 & & targetFloorHeight = = int . MinValue )
alignFailDescription = floors . Count > 1 ? "floors" : "floor" ;
2013-04-04 10:14:44 +00:00
2020-03-19 15:16:08 +00:00
if ( ceilings . Count > 0 & & targetCeilingHeight = = int . MinValue )
2014-12-03 23:15:26 +00:00
{
2020-03-19 15:16:08 +00:00
// Drop to highest floor?
if ( ! withinSelection & & maxSelectedFloorHeight < minSelectedHeight )
{
targetCeilingHeight = maxSelectedFloorHeight ;
}
else
{
if ( ! string . IsNullOrEmpty ( alignFailDescription ) ) alignFailDescription + = " and " ;
alignFailDescription + = ceilings . Count > 1 ? "ceilings" : "ceiling" ;
}
2013-12-03 13:12:12 +00:00
}
2013-04-04 10:14:44 +00:00
2020-03-19 15:16:08 +00:00
if ( ! string . IsNullOrEmpty ( alignFailDescription ) )
{
General . Interface . DisplayStatus ( StatusType . Warning , "Unable to align selected " + alignFailDescription + "!" ) ;
return ;
}
2013-04-04 10:14:44 +00:00
2020-03-19 15:16:08 +00:00
//APPLY VALUES:
PreAction ( UndoGroup . SectorHeightChange ) ;
2013-04-05 10:56:07 +00:00
2020-03-19 15:16:08 +00:00
// Change floor height
if ( floors . Count > 0 )
2014-12-03 23:15:26 +00:00
{
2020-03-19 15:16:08 +00:00
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
}
2020-03-19 15:16:08 +00:00
// Change ceiling height
if ( ceilings . Count > 0 )
2014-12-03 23:15:26 +00:00
{
2020-03-19 15:16:08 +00:00
foreach ( KeyValuePair < Sector , VisualCeiling > group in ceilings )
{
if ( targetCeilingHeight ! = group . Key . CeilHeight )
group . Value . OnChangeTargetHeight ( targetCeilingHeight - group . Key . CeilHeight ) ;
}
2013-04-02 12:19:25 +00:00
}
2020-03-19 15:16:08 +00:00
// Change things height. Drop to lower 3d floor or to actual sector's floor.
if ( General . Map . FormatInterface . HasThingHeight )
2014-12-03 23:15:26 +00:00
{
2020-03-19 15:16:08 +00:00
foreach ( BaseVisualThing vt in things )
{
if ( vt . Thing . Sector = = null ) continue ;
SectorData sd = GetSectorData ( vt . Thing . Sector ) ;
vt . OnMove ( new Vector3D ( vt . Thing . Position , BuilderModesTools . GetLowerThingZ ( this , sd , vt ) ) ) ;
}
2013-04-02 12:19:25 +00:00
}
2020-03-19 15:16:08 +00:00
PostAction ( ) ;
}
2013-04-02 12:19:25 +00:00
}
2014-01-03 10:33:45 +00:00
//mxd
[BeginAction("matchbrightness")]
2014-12-03 23:15:26 +00:00
public void MatchBrightness ( )
{
2014-01-03 10:33:45 +00:00
//check input
2015-12-28 15:01:53 +00:00
if ( ! General . Map . UDMF )
2014-12-03 23:15:26 +00:00
{
2014-01-03 10:33:45 +00:00
General . Interface . DisplayStatus ( StatusType . Warning , "'Match Brightness' action works only in UDMF map format!" ) ;
return ;
}
2015-12-28 15:01:53 +00:00
if ( selectedobjects . Count = = 0 )
2014-12-03 23:15:26 +00:00
{
2014-01-03 10:33:45 +00:00
General . Interface . DisplayStatus ( StatusType . Warning , "'Match Brightness' action requires a selection!" ) ;
return ;
}
2016-04-19 20:40:42 +00:00
IVisualEventReceiver highlighted = ( IVisualEventReceiver ) target . picked ;
2014-01-03 10:33:45 +00:00
2014-12-03 23:15:26 +00:00
if ( highlighted is BaseVisualThing )
{
2014-01-03 10:33:45 +00:00
General . Interface . DisplayStatus ( StatusType . Warning , "Highlight a surface, to which you want to match the brightness." ) ;
return ;
}
//get target brightness
2015-02-12 22:04:49 +00:00
int targetbrightness ;
2014-12-03 23:15:26 +00:00
if ( highlighted is VisualFloor )
{
2016-04-19 20:40:42 +00:00
VisualFloor v = ( VisualFloor ) highlighted ;
2015-02-12 22:04:49 +00:00
targetbrightness = v . Level . sector . Fields . GetValue ( "lightfloor" , 0 ) ;
2015-12-28 15:01:53 +00:00
if ( ! v . Level . sector . Fields . GetValue ( "lightfloorabsolute" , false ) )
2014-12-03 23:15:26 +00:00
{
2015-02-12 22:04:49 +00:00
targetbrightness + = v . Level . sector . Brightness ;
2014-01-03 10:33:45 +00:00
}
2014-12-03 23:15:26 +00:00
}
else if ( highlighted is VisualCeiling )
{
2016-04-19 20:40:42 +00:00
VisualCeiling v = ( VisualCeiling ) highlighted ;
2015-02-12 22:04:49 +00:00
targetbrightness = v . Level . sector . Fields . GetValue ( "lightceiling" , 0 ) ;
2014-12-03 23:15:26 +00:00
if ( ! v . Level . sector . Fields . GetValue ( "lightceilingabsolute" , false ) )
{
2015-02-12 22:04:49 +00:00
targetbrightness + = v . Level . sector . Brightness ;
2014-01-03 10:33:45 +00:00
}
2014-12-03 23:15:26 +00:00
}
else if ( highlighted is VisualUpper | | highlighted is VisualMiddleSingle | | highlighted is VisualMiddleDouble | | highlighted is VisualLower )
{
2016-04-19 20:40:42 +00:00
BaseVisualGeometrySidedef v = ( BaseVisualGeometrySidedef ) highlighted ;
2015-02-12 22:04:49 +00:00
targetbrightness = v . Sidedef . Fields . GetValue ( "light" , 0 ) ;
2014-12-03 23:15:26 +00:00
if ( ! v . Sidedef . Fields . GetValue ( "lightabsolute" , false ) )
{
2015-02-12 22:04:49 +00:00
targetbrightness + = v . Sidedef . Sector . Brightness ;
2014-01-03 10:33:45 +00:00
}
2014-12-03 23:15:26 +00:00
}
else if ( highlighted is VisualMiddle3D )
{
2016-04-19 20:40:42 +00:00
VisualMiddle3D v = ( VisualMiddle3D ) highlighted ;
2014-01-03 10:33:45 +00:00
Sidedef sd = v . GetControlLinedef ( ) . Front ;
2015-12-28 15:01:53 +00:00
if ( sd = = null )
2014-12-03 23:15:26 +00:00
{
2014-01-03 10:33:45 +00:00
General . Interface . DisplayStatus ( StatusType . Warning , "Highlight a surface, to which you want to match the brightness." ) ;
return ;
}
2015-02-12 22:04:49 +00:00
targetbrightness = sd . Fields . GetValue ( "light" , 0 ) ;
2014-12-03 23:15:26 +00:00
if ( ! sd . Fields . GetValue ( "lightabsolute" , false ) )
{
2015-02-12 22:04:49 +00:00
targetbrightness + = sd . Sector . Brightness ;
2014-01-03 10:33:45 +00:00
}
2014-12-03 23:15:26 +00:00
}
else
{
2014-01-03 10:33:45 +00:00
General . Interface . DisplayStatus ( StatusType . Warning , "Highlight a surface, to which you want to match the brightness." ) ;
return ;
}
//make undo
CreateUndo ( "Match Brightness" ) ;
2015-02-12 22:04:49 +00:00
targetbrightness = General . Clamp ( targetbrightness , 0 , 255 ) ;
2014-01-03 10:33:45 +00:00
//apply new brightness
2015-12-28 15:01:53 +00:00
foreach ( IVisualEventReceiver obj in selectedobjects )
2014-12-03 23:15:26 +00:00
{
2014-01-03 10:33:45 +00:00
if ( obj = = highlighted ) continue ;
2014-12-03 23:15:26 +00:00
if ( obj is VisualFloor )
{
2016-04-19 20:40:42 +00:00
VisualFloor v = ( VisualFloor ) obj ;
2014-01-03 10:33:45 +00:00
v . Level . sector . Fields . BeforeFieldsChange ( ) ;
v . Sector . Changed = true ;
2015-12-28 15:01:53 +00:00
if ( v . Level . sector . Fields . GetValue ( "lightfloorabsolute" , false ) )
2014-12-03 23:15:26 +00:00
{
2015-02-24 13:38:35 +00:00
v . Level . sector . Fields [ "lightfloor" ] = new UniValue ( UniversalType . Integer , targetbrightness ) ;
2014-12-03 23:15:26 +00:00
}
else
{
Removed "Paste Properties Options" action.
Added "Paste Properties Special" actions in "Classic" and "Visual" categories. They work the same way as "Paste Special" action.
Added: "Copy Properties", "Paste Properties" and "Paste Properties Special" options are now shown in the Edit menu if current classic mode supports them.
Changed, Paste Properties Special window: only options relevant to current map format are now displayed.
Changed, Paste Properties Special window, UDMF: all UI-managed options are now available.
Fixed: MAPINFO parser was unable to process "include" directives.
Fixed, General interface: selection info was reset to "Nothing selected" after few seconds regardless of current selection.
Fixed, Visual mode: thing bounding boxes were not updated when changing things positions using Randomize mode.
Fixed, Visual mode: event lines were displayed at incorrect height when entering Visual mode for the first time.
Fixed, Texture Browser window: when MixTexturesFlats Game Configuration option is disabled, textures/flats are no longer shown in the Used group when flats/textures with the same names are used in the map.
Fixed(?): probably fixed an exception some users reported when trying to initialize a Classic mode after switching from Visual mode with "Sync cameras" option enabled.
Changed, Game configurations, Thing Categories: a block must have at least one thing category property to be recognized as a thing category.
Changed, Visplane Explorer: the plugin now outputs more info when it fails to initialize vpo.dll.
Cosmetic, Thing Edit window, Doom/Hexen map format: adjusted UI layout so thing flags control no longer displays scrollbars in Hexen map format.
Internal: merged methods from UDMFTools into UniFields, removed UDMFTools.
Updated Inno Setup script (added VC++ 2008 SP1 distributive).
Updated ZDoom_DECORATE.cfg (A_CheckBlock).
Updated documentation (added "System Requirements" page).
2015-10-09 12:38:12 +00:00
UniFields . SetInteger ( v . Level . sector . Fields , "lightfloor" , targetbrightness - v . Level . sector . Brightness , 0 ) ;
2014-01-03 10:33:45 +00:00
}
v . Sector . UpdateSectorGeometry ( false ) ;
2014-12-03 23:15:26 +00:00
}
else if ( obj is VisualCeiling )
{
2016-04-19 20:40:42 +00:00
VisualCeiling v = ( VisualCeiling ) obj ;
2014-01-03 10:33:45 +00:00
v . Level . sector . Fields . BeforeFieldsChange ( ) ;
v . Sector . Changed = true ;
2015-02-24 13:38:35 +00:00
v . Sector . Sector . UpdateNeeded = true ;
2014-01-03 10:33:45 +00:00
2014-12-03 23:15:26 +00:00
if ( v . Level . sector . Fields . GetValue ( "lightceilingabsolute" , false ) )
{
2015-02-24 13:38:35 +00:00
v . Level . sector . Fields [ "lightceiling" ] = new UniValue ( UniversalType . Integer , targetbrightness ) ;
2014-12-03 23:15:26 +00:00
}
else
{
Removed "Paste Properties Options" action.
Added "Paste Properties Special" actions in "Classic" and "Visual" categories. They work the same way as "Paste Special" action.
Added: "Copy Properties", "Paste Properties" and "Paste Properties Special" options are now shown in the Edit menu if current classic mode supports them.
Changed, Paste Properties Special window: only options relevant to current map format are now displayed.
Changed, Paste Properties Special window, UDMF: all UI-managed options are now available.
Fixed: MAPINFO parser was unable to process "include" directives.
Fixed, General interface: selection info was reset to "Nothing selected" after few seconds regardless of current selection.
Fixed, Visual mode: thing bounding boxes were not updated when changing things positions using Randomize mode.
Fixed, Visual mode: event lines were displayed at incorrect height when entering Visual mode for the first time.
Fixed, Texture Browser window: when MixTexturesFlats Game Configuration option is disabled, textures/flats are no longer shown in the Used group when flats/textures with the same names are used in the map.
Fixed(?): probably fixed an exception some users reported when trying to initialize a Classic mode after switching from Visual mode with "Sync cameras" option enabled.
Changed, Game configurations, Thing Categories: a block must have at least one thing category property to be recognized as a thing category.
Changed, Visplane Explorer: the plugin now outputs more info when it fails to initialize vpo.dll.
Cosmetic, Thing Edit window, Doom/Hexen map format: adjusted UI layout so thing flags control no longer displays scrollbars in Hexen map format.
Internal: merged methods from UDMFTools into UniFields, removed UDMFTools.
Updated Inno Setup script (added VC++ 2008 SP1 distributive).
Updated ZDoom_DECORATE.cfg (A_CheckBlock).
Updated documentation (added "System Requirements" page).
2015-10-09 12:38:12 +00:00
UniFields . SetInteger ( v . Level . sector . Fields , "lightceiling" , targetbrightness - v . Level . sector . Brightness , 0 ) ;
2014-01-03 10:33:45 +00:00
}
v . Sector . UpdateSectorGeometry ( false ) ;
2014-12-03 23:15:26 +00:00
}
else if ( obj is VisualUpper | | obj is VisualMiddleSingle | | obj is VisualMiddleDouble | | obj is VisualLower )
{
2016-04-19 20:40:42 +00:00
BaseVisualGeometrySidedef v = ( BaseVisualGeometrySidedef ) obj ;
2014-01-03 10:33:45 +00:00
v . Sidedef . Fields . BeforeFieldsChange ( ) ;
v . Sector . Changed = true ;
2015-12-28 15:01:53 +00:00
if ( v . Sidedef . Fields . GetValue ( "lightabsolute" , false ) )
2014-12-03 23:15:26 +00:00
{
2015-02-24 13:38:35 +00:00
v . Sidedef . Fields [ "light" ] = new UniValue ( UniversalType . Integer , targetbrightness ) ;
2014-12-03 23:15:26 +00:00
}
else
{
Removed "Paste Properties Options" action.
Added "Paste Properties Special" actions in "Classic" and "Visual" categories. They work the same way as "Paste Special" action.
Added: "Copy Properties", "Paste Properties" and "Paste Properties Special" options are now shown in the Edit menu if current classic mode supports them.
Changed, Paste Properties Special window: only options relevant to current map format are now displayed.
Changed, Paste Properties Special window, UDMF: all UI-managed options are now available.
Fixed: MAPINFO parser was unable to process "include" directives.
Fixed, General interface: selection info was reset to "Nothing selected" after few seconds regardless of current selection.
Fixed, Visual mode: thing bounding boxes were not updated when changing things positions using Randomize mode.
Fixed, Visual mode: event lines were displayed at incorrect height when entering Visual mode for the first time.
Fixed, Texture Browser window: when MixTexturesFlats Game Configuration option is disabled, textures/flats are no longer shown in the Used group when flats/textures with the same names are used in the map.
Fixed(?): probably fixed an exception some users reported when trying to initialize a Classic mode after switching from Visual mode with "Sync cameras" option enabled.
Changed, Game configurations, Thing Categories: a block must have at least one thing category property to be recognized as a thing category.
Changed, Visplane Explorer: the plugin now outputs more info when it fails to initialize vpo.dll.
Cosmetic, Thing Edit window, Doom/Hexen map format: adjusted UI layout so thing flags control no longer displays scrollbars in Hexen map format.
Internal: merged methods from UDMFTools into UniFields, removed UDMFTools.
Updated Inno Setup script (added VC++ 2008 SP1 distributive).
Updated ZDoom_DECORATE.cfg (A_CheckBlock).
Updated documentation (added "System Requirements" page).
2015-10-09 12:38:12 +00:00
UniFields . SetInteger ( v . Sidedef . Fields , "light" , targetbrightness - v . Sidedef . Sector . Brightness , 0 ) ;
2014-01-03 10:33:45 +00:00
}
2015-02-12 22:04:49 +00:00
//Update 'lightfog' flag
Tools . UpdateLightFogFlag ( v . Sidedef ) ;
2014-01-03 10:33:45 +00:00
}
}
2015-02-12 22:04:49 +00:00
//Done
2014-01-03 10:33:45 +00:00
General . Interface . DisplayStatus ( StatusType . Action , "Matched brightness for " + selectedobjects . Count + " surfaces." ) ;
Interface_OnSectorEditFormValuesChanged ( this , EventArgs . Empty ) ;
}
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 ) ;
2019-12-30 23:08:17 +00:00
List < IVisualEventReceiver > objs = GetSelectedObjects ( true , true , false , 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 ) ;
2019-12-30 23:08:17 +00:00
List < IVisualEventReceiver > objs = GetSelectedObjects ( true , true , false , 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
}
2016-09-06 12:05:47 +00:00
[BeginAction("movetextureleft")] public void MoveTextureLeft1 ( ) { MoveTextureByOffset ( - 1 , 0 ) ; }
[BeginAction("movetextureright")] public void MoveTextureRight1 ( ) { MoveTextureByOffset ( 1 , 0 ) ; }
[BeginAction("movetextureup")] public void MoveTextureUp1 ( ) { MoveTextureByOffset ( 0 , - 1 ) ; }
[BeginAction("movetexturedown")] public void MoveTextureDown1 ( ) { MoveTextureByOffset ( 0 , 1 ) ; }
[BeginAction("movetextureleft8")] public void MoveTextureLeft8 ( ) { MoveTextureByOffset ( - 8 , 0 ) ; }
[BeginAction("movetextureright8")] public void MoveTextureRight8 ( ) { MoveTextureByOffset ( 8 , 0 ) ; }
[BeginAction("movetextureup8")] public void MoveTextureUp8 ( ) { MoveTextureByOffset ( 0 , - 8 ) ; }
[BeginAction("movetexturedown8")] public void MoveTextureDown8 ( ) { MoveTextureByOffset ( 0 , 8 ) ; }
2017-01-06 10:01:59 +00:00
[BeginAction("movetextureleftgs")] public void MoveTextureLeftGrid ( ) { MoveTextureByOffset ( - General . Map . Grid . GridSize , 0 ) ; } //mxd
[BeginAction("movetexturerightgs")] public void MoveTextureRightGrid ( ) { MoveTextureByOffset ( General . Map . Grid . GridSize , 0 ) ; } //mxd
[BeginAction("movetextureupgs")] public void MoveTextureUpGrid ( ) { MoveTextureByOffset ( 0 , - General . Map . Grid . GridSize ) ; } //mxd
[BeginAction("movetexturedowngs")] public void MoveTextureDownGrid ( ) { MoveTextureByOffset ( 0 , General . Map . Grid . GridSize ) ; } //mxd
2016-05-02 15:01:13 +00:00
//mxd
private void MoveTextureByOffset ( int ox , int oy )
2009-04-19 18:07:22 +00:00
{
2013-09-11 09:47:53 +00:00
PreAction ( UndoGroup . TextureOffsetChange ) ;
2019-12-30 23:08:17 +00:00
IEnumerable < IVisualEventReceiver > objs = RemoveDuplicateSidedefs ( GetSelectedObjects ( true , true , false , false , false ) ) ;
2016-05-02 15:01:13 +00:00
foreach ( IVisualEventReceiver i in objs ) i . OnChangeTextureOffset ( ox , oy , true ) ;
2013-09-11 09:47:53 +00:00
PostAction ( ) ;
2009-04-19 18:07:22 +00:00
}
Added, Visual mode, UDMF: added "Change Pitch Clockwise", "Change Pitch Counterclockwise", "Change Roll Clockwise" and "Change Roll Counterclockwise" actions.
Added, Visual mode, UDMF: added "Increase Scale" and "Decrease Scale" actions.
Added, Visual mode, UDMF: "Reset Texture Offsets" action now resets scale when used on things.
Added, Visual mode, UDMF: "Reset Local Texture Offsets" action now resets scale, pitch and roll when used on things.
Changed, Visual mode, UDMF: "Reset Texture Offsets" action now only resets texture offsets (previously it also reset texture scale).
Changed, Visual mode, UDMF: "Reset Local Texture Offsets" action now resets texture offsets, scale and brightness of sidedefs and also rotation of floors/ceilings.
Changed, Visual mode, UDMF: thing box arrow now displays pitch and roll for things, which have attached model and appropriate MODELDEF flags.
Changed, Thing Edit Form, UDMF: negative pitch and roll can now be entered.
Updated documentation.
2015-03-30 21:44:04 +00:00
//mxd
2016-09-06 12:05:47 +00:00
[BeginAction("scaleup")] public void ScaleTextureUp ( ) { ScaleTexture ( 1 , 1 ) ; }
[BeginAction("scaledown")] public void ScaleTextureDown ( ) { ScaleTexture ( - 1 , - 1 ) ; }
[BeginAction("scaleupx")] public void ScaleTextureUpX ( ) { ScaleTexture ( 1 , 0 ) ; }
[BeginAction("scaledownx")] public void ScaleTextureDownX ( ) { ScaleTexture ( - 1 , 0 ) ; }
[BeginAction("scaleupy")] public void ScaleTextureUpY ( ) { ScaleTexture ( 0 , 1 ) ; }
[BeginAction("scaledowny")] public void ScaleTextureDownY ( ) { ScaleTexture ( 0 , - 1 ) ; }
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
2016-09-06 12:05:47 +00:00
private void ScaleTexture ( int incrementx , int incrementy )
2014-12-03 23:15:26 +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
PreAction ( UndoGroup . TextureScaleChange ) ;
2019-12-30 23:08:17 +00:00
List < IVisualEventReceiver > objs = GetSelectedObjects ( true , true , true , false , false ) ;
2016-09-06 12:05:47 +00:00
foreach ( IVisualEventReceiver i in objs ) i . OnChangeScale ( incrementx , incrementy ) ;
Visual mode, UDMF: added "Scale Texture Up (X)", "Scale Texture Down (X)", "Scale Texture Up (Y)", "Scale Texture Down (Y)" actions. Default keys are Num6, Num4, Num8, Num5.
Visual mode, UDMF: renamed "Rotate Thing Clockwise" and "Rotate Thing Counterclockwise" actions to "Rotate Clockwise" and "Rotate Counterclockwise". These actions can now be used to change rotation of floor/ceiling textures.
Visual mode, UDMF: "Reset Texture Offsets" action now also resets sidedef's scale and floor/ceiling's scale and rotation.
Visual mode, UDMF: control line's OffsetX and OffsetY were not taken into account when calculating texture offsets of 3d floors' sides.
Visual mode, UDMF: fixed a ton of bugs in Auto align functions.
Visual mode, UDMF: when using "Move Texture Left/Right/Up/Down by 1" actions texture offsets were not updated properly when texture's scale was < 1.0.
Visual mode, UDMF: OffsetX and OffsetY were not taken into account in "Fit Texture Width/Height" actions.
Dockers Panel: added Pin/Unpin button, which acts the same as "Preferences -> Interface -> Side panels -> Auto hide" checkbox.
Texture size labels can now be disabled by unchecking "Preferences -> Interface -> Show texture and flat sizes in browsers" checkbox.
Texture size labels now are not shown for unknown textures.
Most of texture size labels had incorrect bg color.
ZDoom_linedefs.cfg: action specials 223 and 224 had incorrect Arg0.
2013-06-24 14:21:13 +00:00
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-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 ( ) ;
2016-06-19 00:09:53 +00:00
IVisualEventReceiver i = GetTargetEventReceiver ( true ) ;
i . OnCopyTexture ( ) ; //mxd
if ( ! ( i is VisualThing ) ) copybuffer . Clear ( ) ; //mxd. Not copying things any more...
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 ) ;
2019-12-30 23:08:17 +00:00
List < IVisualEventReceiver > objs = GetSelectedObjects ( true , true , false , 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")]
2014-12-03 23:15:26 +00:00
public void TextureAutoAlign ( )
{
2013-04-04 10:14:44 +00:00
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-09-03 09:34:28 +00:00
//mxd
[BeginAction("visualautoaligntoselection")]
2014-12-03 23:15:26 +00:00
public void TextureAlignToSelected ( )
{
2013-09-03 09:34:28 +00:00
PreAction ( UndoGroup . None ) ;
renderer . SetCrosshairBusy ( true ) ;
General . Interface . RedrawDisplay ( ) ;
2014-12-03 23:15:26 +00:00
AutoAlignTexturesToSelected ( true , true ) ;
2013-09-03 09:34:28 +00:00
UpdateChangedObjects ( ) ;
renderer . SetCrosshairBusy ( false ) ;
PostAction ( ) ;
}
//mxd
[BeginAction("visualautoaligntoselectionx")]
2014-12-03 23:15:26 +00:00
public void TextureAlignToSelectedX ( )
{
2013-09-03 09:34:28 +00:00
PreAction ( UndoGroup . None ) ;
renderer . SetCrosshairBusy ( true ) ;
General . Interface . RedrawDisplay ( ) ;
2014-12-03 23:15:26 +00:00
AutoAlignTexturesToSelected ( true , false ) ;
2013-09-03 09:34:28 +00:00
UpdateChangedObjects ( ) ;
renderer . SetCrosshairBusy ( false ) ;
PostAction ( ) ;
}
//mxd
[BeginAction("visualautoaligntoselectiony")]
2014-12-03 23:15:26 +00:00
public void TextureAlignToSelectedY ( )
{
2013-09-03 09:34:28 +00:00
PreAction ( UndoGroup . None ) ;
renderer . SetCrosshairBusy ( true ) ;
General . Interface . RedrawDisplay ( ) ;
2014-12-03 23:15:26 +00:00
AutoAlignTexturesToSelected ( false , true ) ;
2013-09-03 09:34:28 +00:00
UpdateChangedObjects ( ) ;
renderer . SetCrosshairBusy ( false ) ;
PostAction ( ) ;
}
//mxd
2014-12-03 23:15:26 +00:00
private void AutoAlignTexturesToSelected ( bool alignX , bool alignY )
{
2014-02-21 14:42:12 +00:00
string rest ;
2013-09-03 09:34:28 +00:00
if ( alignX & & alignY ) rest = "(X and Y)" ;
else if ( alignX ) rest = "(X)" ;
else rest = "(Y)" ;
CreateUndo ( "Auto-align textures to selected sidedefs " + rest ) ;
SetActionResult ( "Auto-aligned textures to selected sidedefs " + rest + "." ) ;
// Clear all marks, this will align everything it can
General . Map . Map . ClearMarkedSidedefs ( false ) ;
//get selection
2019-12-30 23:08:17 +00:00
List < IVisualEventReceiver > objs = GetSelectedObjects ( false , true , false , false , false ) ;
2013-09-03 09:34:28 +00:00
//align
2014-12-03 23:15:26 +00:00
foreach ( IVisualEventReceiver i in objs )
{
2016-04-19 20:40:42 +00:00
BaseVisualGeometrySidedef side = ( BaseVisualGeometrySidedef ) i ;
2013-09-03 09:34:28 +00:00
// Make sure the texture is loaded (we need the texture size)
2020-01-12 22:10:57 +00:00
if ( ! side . Texture . IsImageLoaded ) side . Texture . LoadImageNow ( ) ;
2013-09-03 09:34:28 +00:00
//Align textures
AutoAlignTextures ( side , side . Texture , alignX , alignY , false , false ) ;
// Get the changed sidedefs
List < Sidedef > changes = General . Map . Map . GetMarkedSidedefs ( true ) ;
2014-12-03 23:15:26 +00:00
foreach ( Sidedef sd in changes )
{
2013-09-03 09:34:28 +00:00
// Update the parts for this sidedef!
2014-12-03 23:15:26 +00:00
if ( VisualSectorExists ( sd . Sector ) )
{
2016-04-19 20:40:42 +00:00
BaseVisualSector vs = ( BaseVisualSector ) GetVisualSector ( sd . Sector ) ;
2013-09-03 09:34:28 +00:00
VisualSidedefParts parts = vs . GetSidedefParts ( sd ) ;
parts . SetupAllParts ( ) ;
}
}
}
}
2013-05-02 07:47:22 +00:00
//mxd
[BeginAction("visualfittextures")]
2014-12-22 21:36:49 +00:00
private void FitTextures ( )
2014-12-03 23:15:26 +00:00
{
2013-05-02 07:47:22 +00:00
PreAction ( UndoGroup . None ) ;
2014-12-22 21:36:49 +00:00
// Get selection
2019-12-30 23:08:17 +00:00
List < IVisualEventReceiver > objs = GetSelectedObjects ( false , true , false , false , false ) ;
2014-12-22 21:36:49 +00:00
List < BaseVisualGeometrySidedef > sides = new List < BaseVisualGeometrySidedef > ( ) ;
2016-04-19 20:40:42 +00:00
foreach ( IVisualEventReceiver i in objs )
2014-12-22 21:36:49 +00:00
{
2016-04-19 20:40:42 +00:00
BaseVisualGeometrySidedef side = ( BaseVisualGeometrySidedef ) i ;
if ( side ! = null ) sides . Add ( side ) ;
2014-12-22 21:36:49 +00:00
}
2013-05-02 07:47:22 +00:00
2014-12-22 21:36:49 +00:00
if ( sides . Count = = 0 )
{
General . Interface . DisplayStatus ( StatusType . Warning , "Fit Textures action requires selected sidedefs." ) ;
return ;
}
// Show form
FitTexturesForm form = new FitTexturesForm ( ) ;
// Undo changes?
2015-03-10 18:49:29 +00:00
if ( form . Setup ( sides ) & & form . ShowDialog ( ( Form ) General . Interface ) = = DialogResult . Cancel )
2014-12-22 21:36:49 +00:00
General . Map . UndoRedo . WithdrawUndo ( ) ;
2013-05-02 07:47:22 +00:00
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("resettexture")]
public void ResetTexture ( )
{
2009-05-05 09:50:23 +00:00
PreAction ( UndoGroup . None ) ;
2019-12-30 23:08:17 +00:00
List < IVisualEventReceiver > objs = GetSelectedObjects ( true , 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
}
2013-09-19 09:17:49 +00:00
[BeginAction("resettextureudmf")]
2014-12-03 23:15:26 +00:00
public void ResetLocalOffsets ( )
{
2013-09-19 09:17:49 +00:00
PreAction ( UndoGroup . None ) ;
2019-12-30 23:08:17 +00:00
List < IVisualEventReceiver > objs = GetSelectedObjects ( true , true , true , false , false ) ;
2013-09-19 09:17:49 +00:00
foreach ( IVisualEventReceiver i in objs ) i . OnResetLocalTextureOffset ( ) ;
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 ( ) ;
2014-02-03 11:19:12 +00:00
GetTargetEventReceiver ( true ) . OnCopyTextureOffsets ( ) ; //mxd
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 ) ;
2019-12-30 23:08:17 +00:00
List < IVisualEventReceiver > objs = GetSelectedObjects ( true , true , false , 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 ( ) ;
2014-02-03 11:19:12 +00:00
GetTargetEventReceiver ( true ) . OnCopyProperties ( ) ; //mxd
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 ) ;
2019-12-30 23:08:17 +00:00
List < IVisualEventReceiver > objs = GetSelectedObjects ( true , true , true , true , false ) ;
Removed "Paste Properties Options" action.
Added "Paste Properties Special" actions in "Classic" and "Visual" categories. They work the same way as "Paste Special" action.
Added: "Copy Properties", "Paste Properties" and "Paste Properties Special" options are now shown in the Edit menu if current classic mode supports them.
Changed, Paste Properties Special window: only options relevant to current map format are now displayed.
Changed, Paste Properties Special window, UDMF: all UI-managed options are now available.
Fixed: MAPINFO parser was unable to process "include" directives.
Fixed, General interface: selection info was reset to "Nothing selected" after few seconds regardless of current selection.
Fixed, Visual mode: thing bounding boxes were not updated when changing things positions using Randomize mode.
Fixed, Visual mode: event lines were displayed at incorrect height when entering Visual mode for the first time.
Fixed, Texture Browser window: when MixTexturesFlats Game Configuration option is disabled, textures/flats are no longer shown in the Used group when flats/textures with the same names are used in the map.
Fixed(?): probably fixed an exception some users reported when trying to initialize a Classic mode after switching from Visual mode with "Sync cameras" option enabled.
Changed, Game configurations, Thing Categories: a block must have at least one thing category property to be recognized as a thing category.
Changed, Visplane Explorer: the plugin now outputs more info when it fails to initialize vpo.dll.
Cosmetic, Thing Edit window, Doom/Hexen map format: adjusted UI layout so thing flags control no longer displays scrollbars in Hexen map format.
Internal: merged methods from UDMFTools into UniFields, removed UDMFTools.
Updated Inno Setup script (added VC++ 2008 SP1 distributive).
Updated ZDoom_DECORATE.cfg (A_CheckBlock).
Updated documentation (added "System Requirements" page).
2015-10-09 12:38:12 +00:00
foreach ( IVisualEventReceiver i in objs ) i . OnPasteProperties ( false ) ;
2009-05-03 19:22:32 +00:00
PostAction ( ) ;
2009-04-19 18:07:22 +00:00
}
Removed "Paste Properties Options" action.
Added "Paste Properties Special" actions in "Classic" and "Visual" categories. They work the same way as "Paste Special" action.
Added: "Copy Properties", "Paste Properties" and "Paste Properties Special" options are now shown in the Edit menu if current classic mode supports them.
Changed, Paste Properties Special window: only options relevant to current map format are now displayed.
Changed, Paste Properties Special window, UDMF: all UI-managed options are now available.
Fixed: MAPINFO parser was unable to process "include" directives.
Fixed, General interface: selection info was reset to "Nothing selected" after few seconds regardless of current selection.
Fixed, Visual mode: thing bounding boxes were not updated when changing things positions using Randomize mode.
Fixed, Visual mode: event lines were displayed at incorrect height when entering Visual mode for the first time.
Fixed, Texture Browser window: when MixTexturesFlats Game Configuration option is disabled, textures/flats are no longer shown in the Used group when flats/textures with the same names are used in the map.
Fixed(?): probably fixed an exception some users reported when trying to initialize a Classic mode after switching from Visual mode with "Sync cameras" option enabled.
Changed, Game configurations, Thing Categories: a block must have at least one thing category property to be recognized as a thing category.
Changed, Visplane Explorer: the plugin now outputs more info when it fails to initialize vpo.dll.
Cosmetic, Thing Edit window, Doom/Hexen map format: adjusted UI layout so thing flags control no longer displays scrollbars in Hexen map format.
Internal: merged methods from UDMFTools into UniFields, removed UDMFTools.
Updated Inno Setup script (added VC++ 2008 SP1 distributive).
Updated ZDoom_DECORATE.cfg (A_CheckBlock).
Updated documentation (added "System Requirements" page).
2015-10-09 12:38:12 +00:00
//mxd
[BeginAction("pastepropertieswithoptions")]
public void PastePropertiesWithOptions ( )
{
// Which options to show?
HashSet < int > added ;
var targettypes = new List < MapElementType > ( ) ;
var selection = new List < IVisualEventReceiver > ( ) ;
// Sectors selected?
2019-12-30 23:08:17 +00:00
var obj = GetSelectedObjects ( true , false , false , false , false ) ;
Removed "Paste Properties Options" action.
Added "Paste Properties Special" actions in "Classic" and "Visual" categories. They work the same way as "Paste Special" action.
Added: "Copy Properties", "Paste Properties" and "Paste Properties Special" options are now shown in the Edit menu if current classic mode supports them.
Changed, Paste Properties Special window: only options relevant to current map format are now displayed.
Changed, Paste Properties Special window, UDMF: all UI-managed options are now available.
Fixed: MAPINFO parser was unable to process "include" directives.
Fixed, General interface: selection info was reset to "Nothing selected" after few seconds regardless of current selection.
Fixed, Visual mode: thing bounding boxes were not updated when changing things positions using Randomize mode.
Fixed, Visual mode: event lines were displayed at incorrect height when entering Visual mode for the first time.
Fixed, Texture Browser window: when MixTexturesFlats Game Configuration option is disabled, textures/flats are no longer shown in the Used group when flats/textures with the same names are used in the map.
Fixed(?): probably fixed an exception some users reported when trying to initialize a Classic mode after switching from Visual mode with "Sync cameras" option enabled.
Changed, Game configurations, Thing Categories: a block must have at least one thing category property to be recognized as a thing category.
Changed, Visplane Explorer: the plugin now outputs more info when it fails to initialize vpo.dll.
Cosmetic, Thing Edit window, Doom/Hexen map format: adjusted UI layout so thing flags control no longer displays scrollbars in Hexen map format.
Internal: merged methods from UDMFTools into UniFields, removed UDMFTools.
Updated Inno Setup script (added VC++ 2008 SP1 distributive).
Updated ZDoom_DECORATE.cfg (A_CheckBlock).
Updated documentation (added "System Requirements" page).
2015-10-09 12:38:12 +00:00
if ( obj . Count > 0 )
{
targettypes . Add ( MapElementType . SECTOR ) ;
// Don't add duplicates
added = new HashSet < int > ( ) ;
foreach ( IVisualEventReceiver receiver in obj )
{
2016-04-19 20:40:42 +00:00
VisualGeometry vg = ( VisualGeometry ) receiver ;
Removed "Paste Properties Options" action.
Added "Paste Properties Special" actions in "Classic" and "Visual" categories. They work the same way as "Paste Special" action.
Added: "Copy Properties", "Paste Properties" and "Paste Properties Special" options are now shown in the Edit menu if current classic mode supports them.
Changed, Paste Properties Special window: only options relevant to current map format are now displayed.
Changed, Paste Properties Special window, UDMF: all UI-managed options are now available.
Fixed: MAPINFO parser was unable to process "include" directives.
Fixed, General interface: selection info was reset to "Nothing selected" after few seconds regardless of current selection.
Fixed, Visual mode: thing bounding boxes were not updated when changing things positions using Randomize mode.
Fixed, Visual mode: event lines were displayed at incorrect height when entering Visual mode for the first time.
Fixed, Texture Browser window: when MixTexturesFlats Game Configuration option is disabled, textures/flats are no longer shown in the Used group when flats/textures with the same names are used in the map.
Fixed(?): probably fixed an exception some users reported when trying to initialize a Classic mode after switching from Visual mode with "Sync cameras" option enabled.
Changed, Game configurations, Thing Categories: a block must have at least one thing category property to be recognized as a thing category.
Changed, Visplane Explorer: the plugin now outputs more info when it fails to initialize vpo.dll.
Cosmetic, Thing Edit window, Doom/Hexen map format: adjusted UI layout so thing flags control no longer displays scrollbars in Hexen map format.
Internal: merged methods from UDMFTools into UniFields, removed UDMFTools.
Updated Inno Setup script (added VC++ 2008 SP1 distributive).
Updated ZDoom_DECORATE.cfg (A_CheckBlock).
Updated documentation (added "System Requirements" page).
2015-10-09 12:38:12 +00:00
if ( vg ! = null & & ! added . Contains ( vg . Sector . GetHashCode ( ) ) )
{
selection . Add ( receiver ) ;
added . Add ( vg . Sector . GetHashCode ( ) ) ;
}
}
}
// Sidedefs selected?
2019-12-30 23:08:17 +00:00
obj = GetSelectedObjects ( false , true , false , false , false ) ;
Removed "Paste Properties Options" action.
Added "Paste Properties Special" actions in "Classic" and "Visual" categories. They work the same way as "Paste Special" action.
Added: "Copy Properties", "Paste Properties" and "Paste Properties Special" options are now shown in the Edit menu if current classic mode supports them.
Changed, Paste Properties Special window: only options relevant to current map format are now displayed.
Changed, Paste Properties Special window, UDMF: all UI-managed options are now available.
Fixed: MAPINFO parser was unable to process "include" directives.
Fixed, General interface: selection info was reset to "Nothing selected" after few seconds regardless of current selection.
Fixed, Visual mode: thing bounding boxes were not updated when changing things positions using Randomize mode.
Fixed, Visual mode: event lines were displayed at incorrect height when entering Visual mode for the first time.
Fixed, Texture Browser window: when MixTexturesFlats Game Configuration option is disabled, textures/flats are no longer shown in the Used group when flats/textures with the same names are used in the map.
Fixed(?): probably fixed an exception some users reported when trying to initialize a Classic mode after switching from Visual mode with "Sync cameras" option enabled.
Changed, Game configurations, Thing Categories: a block must have at least one thing category property to be recognized as a thing category.
Changed, Visplane Explorer: the plugin now outputs more info when it fails to initialize vpo.dll.
Cosmetic, Thing Edit window, Doom/Hexen map format: adjusted UI layout so thing flags control no longer displays scrollbars in Hexen map format.
Internal: merged methods from UDMFTools into UniFields, removed UDMFTools.
Updated Inno Setup script (added VC++ 2008 SP1 distributive).
Updated ZDoom_DECORATE.cfg (A_CheckBlock).
Updated documentation (added "System Requirements" page).
2015-10-09 12:38:12 +00:00
if ( obj . Count > 0 )
{
targettypes . Add ( MapElementType . SIDEDEF ) ;
// Don't add duplicates
added = new HashSet < int > ( ) ;
foreach ( IVisualEventReceiver receiver in obj )
{
2016-04-19 20:40:42 +00:00
VisualGeometry vg = ( VisualGeometry ) receiver ;
Removed "Paste Properties Options" action.
Added "Paste Properties Special" actions in "Classic" and "Visual" categories. They work the same way as "Paste Special" action.
Added: "Copy Properties", "Paste Properties" and "Paste Properties Special" options are now shown in the Edit menu if current classic mode supports them.
Changed, Paste Properties Special window: only options relevant to current map format are now displayed.
Changed, Paste Properties Special window, UDMF: all UI-managed options are now available.
Fixed: MAPINFO parser was unable to process "include" directives.
Fixed, General interface: selection info was reset to "Nothing selected" after few seconds regardless of current selection.
Fixed, Visual mode: thing bounding boxes were not updated when changing things positions using Randomize mode.
Fixed, Visual mode: event lines were displayed at incorrect height when entering Visual mode for the first time.
Fixed, Texture Browser window: when MixTexturesFlats Game Configuration option is disabled, textures/flats are no longer shown in the Used group when flats/textures with the same names are used in the map.
Fixed(?): probably fixed an exception some users reported when trying to initialize a Classic mode after switching from Visual mode with "Sync cameras" option enabled.
Changed, Game configurations, Thing Categories: a block must have at least one thing category property to be recognized as a thing category.
Changed, Visplane Explorer: the plugin now outputs more info when it fails to initialize vpo.dll.
Cosmetic, Thing Edit window, Doom/Hexen map format: adjusted UI layout so thing flags control no longer displays scrollbars in Hexen map format.
Internal: merged methods from UDMFTools into UniFields, removed UDMFTools.
Updated Inno Setup script (added VC++ 2008 SP1 distributive).
Updated ZDoom_DECORATE.cfg (A_CheckBlock).
Updated documentation (added "System Requirements" page).
2015-10-09 12:38:12 +00:00
if ( vg ! = null & & ! added . Contains ( vg . Sidedef . Line . GetHashCode ( ) ) )
{
selection . Add ( receiver ) ;
added . Add ( vg . Sidedef . Line . GetHashCode ( ) ) ;
}
}
}
// Things selected?
2019-12-30 23:08:17 +00:00
obj = GetSelectedObjects ( false , false , true , false , false ) ;
Removed "Paste Properties Options" action.
Added "Paste Properties Special" actions in "Classic" and "Visual" categories. They work the same way as "Paste Special" action.
Added: "Copy Properties", "Paste Properties" and "Paste Properties Special" options are now shown in the Edit menu if current classic mode supports them.
Changed, Paste Properties Special window: only options relevant to current map format are now displayed.
Changed, Paste Properties Special window, UDMF: all UI-managed options are now available.
Fixed: MAPINFO parser was unable to process "include" directives.
Fixed, General interface: selection info was reset to "Nothing selected" after few seconds regardless of current selection.
Fixed, Visual mode: thing bounding boxes were not updated when changing things positions using Randomize mode.
Fixed, Visual mode: event lines were displayed at incorrect height when entering Visual mode for the first time.
Fixed, Texture Browser window: when MixTexturesFlats Game Configuration option is disabled, textures/flats are no longer shown in the Used group when flats/textures with the same names are used in the map.
Fixed(?): probably fixed an exception some users reported when trying to initialize a Classic mode after switching from Visual mode with "Sync cameras" option enabled.
Changed, Game configurations, Thing Categories: a block must have at least one thing category property to be recognized as a thing category.
Changed, Visplane Explorer: the plugin now outputs more info when it fails to initialize vpo.dll.
Cosmetic, Thing Edit window, Doom/Hexen map format: adjusted UI layout so thing flags control no longer displays scrollbars in Hexen map format.
Internal: merged methods from UDMFTools into UniFields, removed UDMFTools.
Updated Inno Setup script (added VC++ 2008 SP1 distributive).
Updated ZDoom_DECORATE.cfg (A_CheckBlock).
Updated documentation (added "System Requirements" page).
2015-10-09 12:38:12 +00:00
if ( obj . Count > 0 )
{
targettypes . Add ( MapElementType . THING ) ;
// Don't add duplicates
added = new HashSet < int > ( ) ;
foreach ( IVisualEventReceiver receiver in obj )
{
2016-04-19 20:40:42 +00:00
VisualThing vt = ( VisualThing ) receiver ;
Removed "Paste Properties Options" action.
Added "Paste Properties Special" actions in "Classic" and "Visual" categories. They work the same way as "Paste Special" action.
Added: "Copy Properties", "Paste Properties" and "Paste Properties Special" options are now shown in the Edit menu if current classic mode supports them.
Changed, Paste Properties Special window: only options relevant to current map format are now displayed.
Changed, Paste Properties Special window, UDMF: all UI-managed options are now available.
Fixed: MAPINFO parser was unable to process "include" directives.
Fixed, General interface: selection info was reset to "Nothing selected" after few seconds regardless of current selection.
Fixed, Visual mode: thing bounding boxes were not updated when changing things positions using Randomize mode.
Fixed, Visual mode: event lines were displayed at incorrect height when entering Visual mode for the first time.
Fixed, Texture Browser window: when MixTexturesFlats Game Configuration option is disabled, textures/flats are no longer shown in the Used group when flats/textures with the same names are used in the map.
Fixed(?): probably fixed an exception some users reported when trying to initialize a Classic mode after switching from Visual mode with "Sync cameras" option enabled.
Changed, Game configurations, Thing Categories: a block must have at least one thing category property to be recognized as a thing category.
Changed, Visplane Explorer: the plugin now outputs more info when it fails to initialize vpo.dll.
Cosmetic, Thing Edit window, Doom/Hexen map format: adjusted UI layout so thing flags control no longer displays scrollbars in Hexen map format.
Internal: merged methods from UDMFTools into UniFields, removed UDMFTools.
Updated Inno Setup script (added VC++ 2008 SP1 distributive).
Updated ZDoom_DECORATE.cfg (A_CheckBlock).
Updated documentation (added "System Requirements" page).
2015-10-09 12:38:12 +00:00
if ( vt ! = null & & ! added . Contains ( vt . Thing . GetHashCode ( ) ) )
{
selection . Add ( receiver ) ;
added . Add ( vt . Thing . GetHashCode ( ) ) ;
}
}
}
// Vertices selected?
2019-12-30 23:08:17 +00:00
obj = GetSelectedObjects ( false , false , false , true , false ) ;
Removed "Paste Properties Options" action.
Added "Paste Properties Special" actions in "Classic" and "Visual" categories. They work the same way as "Paste Special" action.
Added: "Copy Properties", "Paste Properties" and "Paste Properties Special" options are now shown in the Edit menu if current classic mode supports them.
Changed, Paste Properties Special window: only options relevant to current map format are now displayed.
Changed, Paste Properties Special window, UDMF: all UI-managed options are now available.
Fixed: MAPINFO parser was unable to process "include" directives.
Fixed, General interface: selection info was reset to "Nothing selected" after few seconds regardless of current selection.
Fixed, Visual mode: thing bounding boxes were not updated when changing things positions using Randomize mode.
Fixed, Visual mode: event lines were displayed at incorrect height when entering Visual mode for the first time.
Fixed, Texture Browser window: when MixTexturesFlats Game Configuration option is disabled, textures/flats are no longer shown in the Used group when flats/textures with the same names are used in the map.
Fixed(?): probably fixed an exception some users reported when trying to initialize a Classic mode after switching from Visual mode with "Sync cameras" option enabled.
Changed, Game configurations, Thing Categories: a block must have at least one thing category property to be recognized as a thing category.
Changed, Visplane Explorer: the plugin now outputs more info when it fails to initialize vpo.dll.
Cosmetic, Thing Edit window, Doom/Hexen map format: adjusted UI layout so thing flags control no longer displays scrollbars in Hexen map format.
Internal: merged methods from UDMFTools into UniFields, removed UDMFTools.
Updated Inno Setup script (added VC++ 2008 SP1 distributive).
Updated ZDoom_DECORATE.cfg (A_CheckBlock).
Updated documentation (added "System Requirements" page).
2015-10-09 12:38:12 +00:00
if ( obj . Count > 0 )
{
targettypes . Add ( MapElementType . VERTEX ) ;
// Don't add duplicates
added = new HashSet < int > ( ) ;
foreach ( IVisualEventReceiver receiver in obj )
{
2016-04-19 20:40:42 +00:00
VisualVertex vv = ( VisualVertex ) receiver ;
Removed "Paste Properties Options" action.
Added "Paste Properties Special" actions in "Classic" and "Visual" categories. They work the same way as "Paste Special" action.
Added: "Copy Properties", "Paste Properties" and "Paste Properties Special" options are now shown in the Edit menu if current classic mode supports them.
Changed, Paste Properties Special window: only options relevant to current map format are now displayed.
Changed, Paste Properties Special window, UDMF: all UI-managed options are now available.
Fixed: MAPINFO parser was unable to process "include" directives.
Fixed, General interface: selection info was reset to "Nothing selected" after few seconds regardless of current selection.
Fixed, Visual mode: thing bounding boxes were not updated when changing things positions using Randomize mode.
Fixed, Visual mode: event lines were displayed at incorrect height when entering Visual mode for the first time.
Fixed, Texture Browser window: when MixTexturesFlats Game Configuration option is disabled, textures/flats are no longer shown in the Used group when flats/textures with the same names are used in the map.
Fixed(?): probably fixed an exception some users reported when trying to initialize a Classic mode after switching from Visual mode with "Sync cameras" option enabled.
Changed, Game configurations, Thing Categories: a block must have at least one thing category property to be recognized as a thing category.
Changed, Visplane Explorer: the plugin now outputs more info when it fails to initialize vpo.dll.
Cosmetic, Thing Edit window, Doom/Hexen map format: adjusted UI layout so thing flags control no longer displays scrollbars in Hexen map format.
Internal: merged methods from UDMFTools into UniFields, removed UDMFTools.
Updated Inno Setup script (added VC++ 2008 SP1 distributive).
Updated ZDoom_DECORATE.cfg (A_CheckBlock).
Updated documentation (added "System Requirements" page).
2015-10-09 12:38:12 +00:00
if ( vv ! = null & & ! added . Contains ( vv . Vertex . GetHashCode ( ) ) )
{
selection . Add ( receiver ) ;
added . Add ( vv . Vertex . GetHashCode ( ) ) ;
}
}
}
// Anything selected?
if ( selection . Count = = 0 )
{
General . Interface . DisplayStatus ( StatusType . Warning , "This action requires highlight or selection!" ) ;
return ;
}
// Show the form
PastePropertiesOptionsForm form = new PastePropertiesOptionsForm ( ) ;
if ( form . Setup ( targettypes ) & & form . ShowDialog ( General . Interface ) = = DialogResult . OK )
{
// Paste properties
PreAction ( UndoGroup . None ) ;
foreach ( IVisualEventReceiver i in selection ) i . OnPasteProperties ( true ) ;
PostAction ( ) ;
}
}
2013-09-11 09:47:53 +00:00
//mxd. now we can insert things in Visual modes
[BeginAction("insertitem", BaseAction = true)]
2012-11-27 21:12:20 +00:00
public void InsertThing ( )
{
2013-09-11 09:47:53 +00:00
Vector2D hitpos = GetHitPosition ( ) ;
2012-07-05 13:48:08 +00:00
Removed "Paste Properties Options" action.
Added "Paste Properties Special" actions in "Classic" and "Visual" categories. They work the same way as "Paste Special" action.
Added: "Copy Properties", "Paste Properties" and "Paste Properties Special" options are now shown in the Edit menu if current classic mode supports them.
Changed, Paste Properties Special window: only options relevant to current map format are now displayed.
Changed, Paste Properties Special window, UDMF: all UI-managed options are now available.
Fixed: MAPINFO parser was unable to process "include" directives.
Fixed, General interface: selection info was reset to "Nothing selected" after few seconds regardless of current selection.
Fixed, Visual mode: thing bounding boxes were not updated when changing things positions using Randomize mode.
Fixed, Visual mode: event lines were displayed at incorrect height when entering Visual mode for the first time.
Fixed, Texture Browser window: when MixTexturesFlats Game Configuration option is disabled, textures/flats are no longer shown in the Used group when flats/textures with the same names are used in the map.
Fixed(?): probably fixed an exception some users reported when trying to initialize a Classic mode after switching from Visual mode with "Sync cameras" option enabled.
Changed, Game configurations, Thing Categories: a block must have at least one thing category property to be recognized as a thing category.
Changed, Visplane Explorer: the plugin now outputs more info when it fails to initialize vpo.dll.
Cosmetic, Thing Edit window, Doom/Hexen map format: adjusted UI layout so thing flags control no longer displays scrollbars in Hexen map format.
Internal: merged methods from UDMFTools into UniFields, removed UDMFTools.
Updated Inno Setup script (added VC++ 2008 SP1 distributive).
Updated ZDoom_DECORATE.cfg (A_CheckBlock).
Updated documentation (added "System Requirements" page).
2015-10-09 12:38:12 +00:00
if ( ! hitpos . IsFinite ( ) )
2014-12-03 23:15:26 +00:00
{
2013-09-11 09:47:53 +00:00
General . Interface . DisplayStatus ( StatusType . Warning , "Cannot insert thing here!" ) ;
return ;
}
ClearSelection ( ) ;
PreActionNoChange ( ) ;
General . Map . UndoRedo . ClearAllRedos ( ) ;
General . Map . UndoRedo . CreateUndo ( "Insert thing" ) ;
2012-07-05 13:48:08 +00:00
2013-09-11 09:47:53 +00:00
Thing t = CreateThing ( new Vector2D ( hitpos . x , hitpos . y ) ) ;
2012-07-05 13:48:08 +00:00
Removed "Paste Properties Options" action.
Added "Paste Properties Special" actions in "Classic" and "Visual" categories. They work the same way as "Paste Special" action.
Added: "Copy Properties", "Paste Properties" and "Paste Properties Special" options are now shown in the Edit menu if current classic mode supports them.
Changed, Paste Properties Special window: only options relevant to current map format are now displayed.
Changed, Paste Properties Special window, UDMF: all UI-managed options are now available.
Fixed: MAPINFO parser was unable to process "include" directives.
Fixed, General interface: selection info was reset to "Nothing selected" after few seconds regardless of current selection.
Fixed, Visual mode: thing bounding boxes were not updated when changing things positions using Randomize mode.
Fixed, Visual mode: event lines were displayed at incorrect height when entering Visual mode for the first time.
Fixed, Texture Browser window: when MixTexturesFlats Game Configuration option is disabled, textures/flats are no longer shown in the Used group when flats/textures with the same names are used in the map.
Fixed(?): probably fixed an exception some users reported when trying to initialize a Classic mode after switching from Visual mode with "Sync cameras" option enabled.
Changed, Game configurations, Thing Categories: a block must have at least one thing category property to be recognized as a thing category.
Changed, Visplane Explorer: the plugin now outputs more info when it fails to initialize vpo.dll.
Cosmetic, Thing Edit window, Doom/Hexen map format: adjusted UI layout so thing flags control no longer displays scrollbars in Hexen map format.
Internal: merged methods from UDMFTools into UniFields, removed UDMFTools.
Updated Inno Setup script (added VC++ 2008 SP1 distributive).
Updated ZDoom_DECORATE.cfg (A_CheckBlock).
Updated documentation (added "System Requirements" page).
2015-10-09 12:38:12 +00:00
if ( t = = null )
2014-12-03 23:15:26 +00:00
{
2013-09-11 09:47:53 +00:00
General . Map . UndoRedo . WithdrawUndo ( ) ;
return ;
}
2012-07-05 13:48:08 +00:00
2013-09-11 09:47:53 +00:00
// Edit the thing?
Removed "Paste Properties Options" action.
Added "Paste Properties Special" actions in "Classic" and "Visual" categories. They work the same way as "Paste Special" action.
Added: "Copy Properties", "Paste Properties" and "Paste Properties Special" options are now shown in the Edit menu if current classic mode supports them.
Changed, Paste Properties Special window: only options relevant to current map format are now displayed.
Changed, Paste Properties Special window, UDMF: all UI-managed options are now available.
Fixed: MAPINFO parser was unable to process "include" directives.
Fixed, General interface: selection info was reset to "Nothing selected" after few seconds regardless of current selection.
Fixed, Visual mode: thing bounding boxes were not updated when changing things positions using Randomize mode.
Fixed, Visual mode: event lines were displayed at incorrect height when entering Visual mode for the first time.
Fixed, Texture Browser window: when MixTexturesFlats Game Configuration option is disabled, textures/flats are no longer shown in the Used group when flats/textures with the same names are used in the map.
Fixed(?): probably fixed an exception some users reported when trying to initialize a Classic mode after switching from Visual mode with "Sync cameras" option enabled.
Changed, Game configurations, Thing Categories: a block must have at least one thing category property to be recognized as a thing category.
Changed, Visplane Explorer: the plugin now outputs more info when it fails to initialize vpo.dll.
Cosmetic, Thing Edit window, Doom/Hexen map format: adjusted UI layout so thing flags control no longer displays scrollbars in Hexen map format.
Internal: merged methods from UDMFTools into UniFields, removed UDMFTools.
Updated Inno Setup script (added VC++ 2008 SP1 distributive).
Updated ZDoom_DECORATE.cfg (A_CheckBlock).
Updated documentation (added "System Requirements" page).
2015-10-09 12:38:12 +00:00
if ( BuilderPlug . Me . EditNewThing ) General . Interface . ShowEditThings ( new List < Thing > { t } ) ;
2012-07-05 13:48:08 +00:00
2013-09-11 09:47:53 +00:00
//add thing to blockmap
blockmap . AddThing ( t ) ;
2012-07-05 13:48:08 +00:00
2013-09-11 09:47:53 +00:00
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-09-11 09:47:53 +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 ) ;
2019-12-30 23:08:17 +00:00
List < IVisualEventReceiver > objs = GetSelectedObjects ( true , true , true , true , false ) ;
2017-03-13 01:26:50 +00:00
foreach ( IVisualEventReceiver i in objs )
{
if ( i is BaseVisualThing )
2019-12-21 04:43:16 +00:00
visiblethings . Remove ( ( BaseVisualThing ) i ) ; // [ZZ] if any
2017-03-13 01:26:50 +00:00
i . OnDelete ( ) ;
}
2017-03-13 01:10:07 +00:00
PostAction ( ) ;
2013-07-31 12:38:47 +00:00
ClearSelection ( ) ;
2012-11-27 21:12:20 +00:00
}
2012-07-16 09:45:21 +00:00
2013-09-11 09:47:53 +00:00
//mxd
[BeginAction("copyselection", BaseAction = true)]
2014-12-03 23:15:26 +00:00
public void CopySelection ( )
{
2019-12-30 23:08:17 +00:00
List < IVisualEventReceiver > objs = GetSelectedObjects ( false , false , true , false , false ) ;
2015-12-28 15:01:53 +00:00
if ( objs . Count = = 0 ) return ;
2013-09-11 09:47:53 +00:00
2015-09-10 17:38:27 +00:00
copybuffer . Clear ( ) ;
2015-12-28 15:01:53 +00:00
foreach ( IVisualEventReceiver i in objs )
2014-12-03 23:15:26 +00:00
{
2016-04-19 20:40:42 +00:00
VisualThing vt = ( VisualThing ) i ;
2015-12-28 15:01:53 +00:00
if ( vt ! = null ) copybuffer . Add ( new ThingCopyData ( vt . Thing ) ) ;
2013-09-11 09:47:53 +00:00
}
2016-06-19 00:09:53 +00:00
string rest = copybuffer . Count + ( copybuffer . Count > 1 ? " things." : " thing." ) ;
General . Interface . DisplayStatus ( StatusType . Info , "Copied " + rest ) ;
2013-09-11 09:47:53 +00:00
}
//mxd
[BeginAction("cutselection", BaseAction = true)]
2014-12-03 23:15:26 +00:00
public void CutSelection ( )
{
2013-09-11 09:47:53 +00:00
CopySelection ( ) ;
2013-07-31 12:38:47 +00:00
//Create undo
2016-06-19 00:09:53 +00:00
string rest = copybuffer . Count + ( copybuffer . Count > 1 ? " things." : " thing." ) ;
2013-07-31 12:38:47 +00:00
CreateUndo ( "Cut " + rest ) ;
General . Interface . DisplayStatus ( StatusType . Info , "Cut " + rest ) ;
2019-12-30 23:08:17 +00:00
List < IVisualEventReceiver > objs = GetSelectedObjects ( false , false , true , false , false ) ;
2015-12-28 15:01:53 +00:00
foreach ( IVisualEventReceiver i in objs )
2014-12-03 23:15:26 +00:00
{
2016-04-19 20:40:42 +00:00
BaseVisualThing thing = ( BaseVisualThing ) i ;
2019-12-21 04:43:16 +00:00
visiblethings . Remove ( thing ) ; // [ZZ] if any
2017-03-13 01:26:50 +00:00
thing . Thing . Fields . BeforeFieldsChange ( ) ;
2013-07-31 12:38:47 +00:00
thing . Thing . Dispose ( ) ;
thing . Dispose ( ) ;
}
General . Map . IsChanged = true ;
General . Map . ThingsFilter . Update ( ) ;
2015-10-02 14:47:34 +00:00
2017-03-13 01:10:07 +00:00
// [ZZ] Clear selected things.
2019-12-30 23:08:17 +00:00
ClearSelection ( false , false , true , false , false , false ) ;
2017-03-13 01:10:07 +00:00
// Update event lines
renderer . SetEventLines ( LinksCollector . GetHelperShapes ( General . Map . ThingsFilter . VisibleThings , blockmap ) ) ;
2013-09-11 09:47:53 +00:00
}
//mxd. We'll just use currently selected objects
[BeginAction("pasteselection", BaseAction = true)]
2014-12-03 23:15:26 +00:00
public void PasteSelection ( )
{
2015-09-10 17:38:27 +00:00
if ( copybuffer . Count = = 0 )
2014-12-03 23:15:26 +00:00
{
2016-06-19 00:09:53 +00:00
TexturePaste ( ) ; // I guess we may paste a texture or two instead
2013-09-11 09:47:53 +00:00
return ;
}
Vector2D hitpos = GetHitPosition ( ) ;
2015-12-28 15:01:53 +00:00
if ( ! hitpos . IsFinite ( ) )
2014-12-03 23:15:26 +00:00
{
2013-09-11 09:47:53 +00:00
General . Interface . DisplayStatus ( StatusType . Warning , "Cannot paste here!" ) ;
return ;
}
2016-06-19 00:09:53 +00:00
string rest = copybuffer . Count + ( copybuffer . Count > 1 ? " things." : " thing." ) ;
2013-07-31 12:38:47 +00:00
General . Map . UndoRedo . CreateUndo ( "Paste " + rest ) ;
2013-09-11 09:47:53 +00:00
General . Interface . DisplayStatus ( StatusType . Info , "Pasted " + rest ) ;
PreActionNoChange ( ) ;
ClearSelection ( ) ;
//get translated positions
2015-09-10 17:38:27 +00:00
Vector3D [ ] coords = new Vector3D [ copybuffer . Count ] ;
2015-12-28 15:01:53 +00:00
for ( int i = 0 ; i < copybuffer . Count ; i + + )
2015-09-10 17:38:27 +00:00
coords [ i ] = copybuffer [ i ] . Position ;
2013-09-11 09:47:53 +00:00
2014-12-03 23:15:26 +00:00
Vector3D [ ] translatedCoords = TranslateCoordinates ( coords , hitpos , true ) ;
2013-09-11 09:47:53 +00:00
//create things from copyBuffer
2015-10-02 14:47:34 +00:00
for ( int i = 0 ; i < copybuffer . Count ; i + + )
2014-12-03 23:15:26 +00:00
{
2013-09-11 09:47:53 +00:00
Thing t = CreateThing ( new Vector2D ( ) ) ;
2015-12-28 15:01:53 +00:00
if ( t ! = null )
2014-12-03 23:15:26 +00:00
{
2015-09-10 17:38:27 +00:00
copybuffer [ i ] . ApplyTo ( t ) ;
2013-09-11 09:47:53 +00:00
t . Move ( translatedCoords [ i ] ) ;
//add thing to blockmap
blockmap . AddThing ( t ) ;
}
}
2015-10-02 14:47:34 +00:00
General . Map . IsChanged = true ;
General . Map . ThingsFilter . Update ( ) ;
2013-09-11 09:47:53 +00:00
PostAction ( ) ;
}
Added, Visual mode, UDMF: added "Change Pitch Clockwise", "Change Pitch Counterclockwise", "Change Roll Clockwise" and "Change Roll Counterclockwise" actions.
Added, Visual mode, UDMF: added "Increase Scale" and "Decrease Scale" actions.
Added, Visual mode, UDMF: "Reset Texture Offsets" action now resets scale when used on things.
Added, Visual mode, UDMF: "Reset Local Texture Offsets" action now resets scale, pitch and roll when used on things.
Changed, Visual mode, UDMF: "Reset Texture Offsets" action now only resets texture offsets (previously it also reset texture scale).
Changed, Visual mode, UDMF: "Reset Local Texture Offsets" action now resets texture offsets, scale and brightness of sidedefs and also rotation of floors/ceilings.
Changed, Visual mode, UDMF: thing box arrow now displays pitch and roll for things, which have attached model and appropriate MODELDEF flags.
Changed, Thing Edit Form, UDMF: negative pitch and roll can now be entered.
Updated documentation.
2015-03-30 21:44:04 +00:00
//mxd. Rotate clockwise
2014-04-02 10:57:52 +00:00
[BeginAction("rotateclockwise")]
2014-12-03 23:15:26 +00:00
public void RotateCW ( )
{
2016-06-15 22:02:51 +00:00
RotateThingsAndTextures ( General . Map . Config . DoomThingRotationAngles ? 45 : 5 , 5 ) ;
2013-09-11 09:47:53 +00:00
}
2012-08-05 19:18:05 +00:00
Added, Visual mode, UDMF: added "Change Pitch Clockwise", "Change Pitch Counterclockwise", "Change Roll Clockwise" and "Change Roll Counterclockwise" actions.
Added, Visual mode, UDMF: added "Increase Scale" and "Decrease Scale" actions.
Added, Visual mode, UDMF: "Reset Texture Offsets" action now resets scale when used on things.
Added, Visual mode, UDMF: "Reset Local Texture Offsets" action now resets scale, pitch and roll when used on things.
Changed, Visual mode, UDMF: "Reset Texture Offsets" action now only resets texture offsets (previously it also reset texture scale).
Changed, Visual mode, UDMF: "Reset Local Texture Offsets" action now resets texture offsets, scale and brightness of sidedefs and also rotation of floors/ceilings.
Changed, Visual mode, UDMF: thing box arrow now displays pitch and roll for things, which have attached model and appropriate MODELDEF flags.
Changed, Thing Edit Form, UDMF: negative pitch and roll can now be entered.
Updated documentation.
2015-03-30 21:44:04 +00:00
//mxd. Rotate counterclockwise
2014-04-02 10:57:52 +00:00
[BeginAction("rotatecounterclockwise")]
2014-12-03 23:15:26 +00:00
public void RotateCCW ( )
{
2016-06-15 22:02:51 +00:00
RotateThingsAndTextures ( General . Map . Config . DoomThingRotationAngles ? - 45 : - 5 , - 5 ) ;
2013-09-11 09:47:53 +00:00
}
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
2016-06-15 22:02:51 +00:00
private void RotateThingsAndTextures ( int thingangleincrement , int textureangleincrement )
2014-12-03 23:15:26 +00:00
{
Added, Visual mode, UDMF: added "Change Pitch Clockwise", "Change Pitch Counterclockwise", "Change Roll Clockwise" and "Change Roll Counterclockwise" actions.
Added, Visual mode, UDMF: added "Increase Scale" and "Decrease Scale" actions.
Added, Visual mode, UDMF: "Reset Texture Offsets" action now resets scale when used on things.
Added, Visual mode, UDMF: "Reset Local Texture Offsets" action now resets scale, pitch and roll when used on things.
Changed, Visual mode, UDMF: "Reset Texture Offsets" action now only resets texture offsets (previously it also reset texture scale).
Changed, Visual mode, UDMF: "Reset Local Texture Offsets" action now resets texture offsets, scale and brightness of sidedefs and also rotation of floors/ceilings.
Changed, Visual mode, UDMF: thing box arrow now displays pitch and roll for things, which have attached model and appropriate MODELDEF flags.
Changed, Thing Edit Form, UDMF: negative pitch and roll can now be entered.
Updated documentation.
2015-03-30 21:44:04 +00:00
PreAction ( UndoGroup . ThingAngleChange ) ;
2012-08-05 19:18:05 +00:00
2019-12-30 23:08:17 +00:00
List < IVisualEventReceiver > selection = GetSelectedObjects ( true , false , true , false , false ) ;
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 ( selection . Count = = 0 ) return ;
2012-08-05 19:18:05 +00:00
2014-12-03 23:15:26 +00:00
foreach ( IVisualEventReceiver obj in selection )
{
if ( obj is BaseVisualThing )
{
2016-04-19 20:40:42 +00:00
BaseVisualThing t = ( BaseVisualThing ) obj ;
2016-06-15 22:02:51 +00:00
int newangle = t . Thing . AngleDoom + thingangleincrement ;
if ( General . Map . Config . DoomThingRotationAngles ) newangle = newangle / 45 * 45 ;
t . SetAngle ( General . ClampAngle ( newangle ) ) ;
2016-05-02 15:01:13 +00:00
// Visual sectors may be affected by this thing...
if ( thingdata . ContainsKey ( t . Thing ) )
{
// 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 ) ;
}
}
}
2014-12-03 23:15:26 +00:00
}
else if ( obj is VisualFloor )
{
2016-04-19 20:40:42 +00:00
VisualFloor vf = ( VisualFloor ) obj ;
2020-05-22 19:39:18 +00:00
vf . OnChangeTextureRotation ( General . ClampAngle ( vf . GetControlSector ( ) . Fields . GetValue ( "rotationfloor" , 0.0 ) + textureangleincrement ) ) ;
2014-12-03 23:15:26 +00:00
}
else if ( obj is VisualCeiling )
{
2016-04-19 20:40:42 +00:00
VisualCeiling vc = ( VisualCeiling ) obj ;
2020-05-22 19:39:18 +00:00
vc . OnChangeTextureRotation ( General . ClampAngle ( vc . GetControlSector ( ) . Fields . GetValue ( "rotationceiling" , 0.0 ) + textureangleincrement ) ) ;
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
}
}
2012-08-05 19:18:05 +00:00
Added, Visual mode, UDMF: added "Change Pitch Clockwise", "Change Pitch Counterclockwise", "Change Roll Clockwise" and "Change Roll Counterclockwise" actions.
Added, Visual mode, UDMF: added "Increase Scale" and "Decrease Scale" actions.
Added, Visual mode, UDMF: "Reset Texture Offsets" action now resets scale when used on things.
Added, Visual mode, UDMF: "Reset Local Texture Offsets" action now resets scale, pitch and roll when used on things.
Changed, Visual mode, UDMF: "Reset Texture Offsets" action now only resets texture offsets (previously it also reset texture scale).
Changed, Visual mode, UDMF: "Reset Local Texture Offsets" action now resets texture offsets, scale and brightness of sidedefs and also rotation of floors/ceilings.
Changed, Visual mode, UDMF: thing box arrow now displays pitch and roll for things, which have attached model and appropriate MODELDEF flags.
Changed, Thing Edit Form, UDMF: negative pitch and roll can now be entered.
Updated documentation.
2015-03-30 21:44:04 +00:00
PostAction ( ) ;
}
//mxd. Change pitch clockwise
[BeginAction("pitchclockwise")]
public void PitchCW ( )
{
ChangeThingsPitch ( - 5 ) ;
}
//mxd. Change pitch counterclockwise
[BeginAction("pitchcounterclockwise")]
public void PitchCCW ( )
{
ChangeThingsPitch ( 5 ) ;
}
//mxd
private void ChangeThingsPitch ( int increment )
{
PreAction ( UndoGroup . ThingPitchChange ) ;
2019-12-30 23:08:17 +00:00
List < IVisualEventReceiver > selection = GetSelectedObjects ( false , false , true , false , false ) ;
Added, Visual mode, UDMF: added "Change Pitch Clockwise", "Change Pitch Counterclockwise", "Change Roll Clockwise" and "Change Roll Counterclockwise" actions.
Added, Visual mode, UDMF: added "Increase Scale" and "Decrease Scale" actions.
Added, Visual mode, UDMF: "Reset Texture Offsets" action now resets scale when used on things.
Added, Visual mode, UDMF: "Reset Local Texture Offsets" action now resets scale, pitch and roll when used on things.
Changed, Visual mode, UDMF: "Reset Texture Offsets" action now only resets texture offsets (previously it also reset texture scale).
Changed, Visual mode, UDMF: "Reset Local Texture Offsets" action now resets texture offsets, scale and brightness of sidedefs and also rotation of floors/ceilings.
Changed, Visual mode, UDMF: thing box arrow now displays pitch and roll for things, which have attached model and appropriate MODELDEF flags.
Changed, Thing Edit Form, UDMF: negative pitch and roll can now be entered.
Updated documentation.
2015-03-30 21:44:04 +00:00
if ( selection . Count = = 0 ) return ;
foreach ( IVisualEventReceiver obj in selection )
{
2016-04-19 20:40:42 +00:00
BaseVisualThing t = ( BaseVisualThing ) obj ;
if ( t ! = null ) t . SetPitch ( General . ClampAngle ( t . Thing . Pitch + increment ) ) ;
Added, Visual mode, UDMF: added "Change Pitch Clockwise", "Change Pitch Counterclockwise", "Change Roll Clockwise" and "Change Roll Counterclockwise" actions.
Added, Visual mode, UDMF: added "Increase Scale" and "Decrease Scale" actions.
Added, Visual mode, UDMF: "Reset Texture Offsets" action now resets scale when used on things.
Added, Visual mode, UDMF: "Reset Local Texture Offsets" action now resets scale, pitch and roll when used on things.
Changed, Visual mode, UDMF: "Reset Texture Offsets" action now only resets texture offsets (previously it also reset texture scale).
Changed, Visual mode, UDMF: "Reset Local Texture Offsets" action now resets texture offsets, scale and brightness of sidedefs and also rotation of floors/ceilings.
Changed, Visual mode, UDMF: thing box arrow now displays pitch and roll for things, which have attached model and appropriate MODELDEF flags.
Changed, Thing Edit Form, UDMF: negative pitch and roll can now be entered.
Updated documentation.
2015-03-30 21:44:04 +00:00
}
PostAction ( ) ;
}
//mxd. Change pitch clockwise
[BeginAction("rollclockwise")]
public void RollCW ( )
{
ChangeThingsRoll ( - 5 ) ;
}
//mxd. Change pitch counterclockwise
[BeginAction("rollcounterclockwise")]
public void RollCCW ( )
{
ChangeThingsRoll ( 5 ) ;
}
//mxd
private void ChangeThingsRoll ( int increment )
{
PreAction ( UndoGroup . ThingRollChange ) ;
2019-12-30 23:08:17 +00:00
List < IVisualEventReceiver > selection = GetSelectedObjects ( false , false , true , false , false ) ;
Added, Visual mode, UDMF: added "Change Pitch Clockwise", "Change Pitch Counterclockwise", "Change Roll Clockwise" and "Change Roll Counterclockwise" actions.
Added, Visual mode, UDMF: added "Increase Scale" and "Decrease Scale" actions.
Added, Visual mode, UDMF: "Reset Texture Offsets" action now resets scale when used on things.
Added, Visual mode, UDMF: "Reset Local Texture Offsets" action now resets scale, pitch and roll when used on things.
Changed, Visual mode, UDMF: "Reset Texture Offsets" action now only resets texture offsets (previously it also reset texture scale).
Changed, Visual mode, UDMF: "Reset Local Texture Offsets" action now resets texture offsets, scale and brightness of sidedefs and also rotation of floors/ceilings.
Changed, Visual mode, UDMF: thing box arrow now displays pitch and roll for things, which have attached model and appropriate MODELDEF flags.
Changed, Thing Edit Form, UDMF: negative pitch and roll can now be entered.
Updated documentation.
2015-03-30 21:44:04 +00:00
if ( selection . Count = = 0 ) return ;
foreach ( IVisualEventReceiver obj in selection )
{
2016-04-19 20:40:42 +00:00
BaseVisualThing t = ( BaseVisualThing ) obj ;
if ( t ! = null ) t . SetRoll ( General . ClampAngle ( t . Thing . Roll + increment ) ) ;
Added, Visual mode, UDMF: added "Change Pitch Clockwise", "Change Pitch Counterclockwise", "Change Roll Clockwise" and "Change Roll Counterclockwise" actions.
Added, Visual mode, UDMF: added "Increase Scale" and "Decrease Scale" actions.
Added, Visual mode, UDMF: "Reset Texture Offsets" action now resets scale when used on things.
Added, Visual mode, UDMF: "Reset Local Texture Offsets" action now resets scale, pitch and roll when used on things.
Changed, Visual mode, UDMF: "Reset Texture Offsets" action now only resets texture offsets (previously it also reset texture scale).
Changed, Visual mode, UDMF: "Reset Local Texture Offsets" action now resets texture offsets, scale and brightness of sidedefs and also rotation of floors/ceilings.
Changed, Visual mode, UDMF: thing box arrow now displays pitch and roll for things, which have attached model and appropriate MODELDEF flags.
Changed, Thing Edit Form, UDMF: negative pitch and roll can now be entered.
Updated documentation.
2015-03-30 21:44:04 +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
2013-09-11 09:47:53 +00:00
//mxd
2016-09-07 15:15:07 +00:00
[BeginAction("gztoggleenhancedrendering", BaseAction = true)]
public void ToggleEnhancedRendering ( )
2014-10-20 12:16:51 +00:00
{
2016-09-07 15:15:07 +00:00
// Actual toggling is done in MainForm.ToggleEnhancedRendering(), so we only need to update the view here
2013-09-11 09:47:53 +00:00
RebuildElementData ( ) ;
UpdateChangedObjects ( ) ;
}
2013-03-18 13:52:27 +00:00
//mxd
[BeginAction("thingaligntowall")]
2014-12-03 23:15:26 +00:00
public void AlignThingsToWall ( )
{
2013-03-18 13:52:27 +00:00
List < VisualThing > visualThings = GetSelectedVisualThings ( true ) ;
2014-12-03 23:15:26 +00:00
if ( visualThings . Count = = 0 )
{
2013-03-18 13:52:27 +00:00
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
2014-12-03 23:15:26 +00:00
if ( things . Count > 1 )
{
2013-03-18 13:52:27 +00:00
General . Map . UndoRedo . CreateUndo ( "Align " + things . Count + " things" ) ;
General . Interface . DisplayStatus ( StatusType . Action , "Aligned " + things . Count + " things." ) ;
2014-12-03 23:15:26 +00:00
}
else
{
2013-03-18 13:52:27 +00:00
General . Map . UndoRedo . CreateUndo ( "Align thing" ) ;
General . Interface . DisplayStatus ( StatusType . Action , "Aligned a thing." ) ;
}
//align things
2014-12-03 23:15:26 +00:00
foreach ( Thing t in things )
{
2016-04-29 21:38:43 +00:00
HashSet < Linedef > excludedLines = new HashSet < Linedef > ( ) ;
2014-02-07 09:10:55 +00:00
bool aligned ;
2013-03-18 13:52:27 +00:00
2014-12-03 23:15:26 +00:00
do
{
2013-03-18 13:52:27 +00:00
Linedef l = General . Map . Map . NearestLinedef ( t . Position , excludedLines ) ;
aligned = Tools . TryAlignThingToLine ( t , l ) ;
2014-12-03 23:15:26 +00:00
if ( ! aligned )
{
2013-03-18 13:52:27 +00:00
excludedLines . Add ( l ) ;
2016-04-29 21:38:43 +00:00
if ( excludedLines . Count = = General . Map . Map . Linedefs . Count )
2014-12-03 23:15:26 +00:00
{
2013-03-18 13:52:27 +00:00
ThingTypeInfo tti = General . Map . Data . GetThingInfo ( t . Type ) ;
2016-02-22 08:04:06 +00:00
General . ErrorLogger . Add ( ErrorType . Warning , "Unable to align " + tti . Title + " (index " + t . Index + ") to any linedef!" ) ;
2013-03-18 13:52:27 +00:00
aligned = true ;
}
}
} while ( ! aligned ) ;
}
//apply changes to Visual Things
2014-12-03 23:15:26 +00:00
for ( int i = 0 ; i < visualThings . Count ; i + + )
{
2016-04-19 20:40:42 +00:00
BaseVisualThing t = ( BaseVisualThing ) visualThings [ i ] ;
2013-03-18 13:52:27 +00:00
t . Changed = true ;
// Update what must be updated
ThingData td = GetThingData ( t . Thing ) ;
2014-12-03 23:15:26 +00:00
foreach ( KeyValuePair < Sector , bool > s in td . UpdateAlso )
{
if ( VisualSectorExists ( s . Key ) )
{
2013-03-18 13:52:27 +00:00
BaseVisualSector vs = ( BaseVisualSector ) GetVisualSector ( s . Key ) ;
vs . UpdateSectorGeometry ( s . Value ) ;
}
}
}
UpdateChangedObjects ( ) ;
ShowTargetInfo ( ) ;
}
2013-04-26 12:32:51 +00:00
2013-08-08 11:04:13 +00:00
//mxd
[BeginAction("lookthroughthing")]
2014-12-03 23:15:26 +00:00
public void LookThroughThing ( )
{
2013-08-08 11:04:13 +00:00
List < VisualThing > visualThings = GetSelectedVisualThings ( true ) ;
2014-12-03 23:15:26 +00:00
if ( visualThings . Count ! = 1 )
{
2013-08-08 11:04:13 +00:00
General . Interface . DisplayStatus ( StatusType . Warning , "Look Through Selection action requires 1 selected Thing!" ) ;
return ;
}
//set position and angles
Thing t = visualThings [ 0 ] . Thing ;
2014-12-03 23:15:26 +00:00
if ( ( t . Type = = 9072 | | t . Type = = 9073 ) & & t . Args [ 3 ] > 0 ) //AimingCamera or MovingCamera with target?
{
2013-08-08 11:04:13 +00:00
//position
2014-12-03 23:15:26 +00:00
if ( t . Type = = 9072 & & ( t . Args [ 0 ] > 0 | | t . Args [ 1 ] > 0 ) ) //positon MovingCamera at targeted interpolation point
{
2013-08-08 11:04:13 +00:00
int ipTag = t . Args [ 0 ] + ( t . Args [ 1 ] < < 8 ) ;
Thing ip = null ;
//find interpolation point
2014-12-03 23:15:26 +00:00
foreach ( Thing tgt in General . Map . Map . Things )
{
if ( tgt . Tag = = ipTag & & tgt . Type = = 9070 )
{
2013-08-08 11:04:13 +00:00
ip = tgt ;
break ;
}
}
2014-12-03 23:15:26 +00:00
if ( ip ! = null )
{
2013-08-10 11:28:51 +00:00
VisualThing vTarget = ! VisualThingExists ( ip ) ? CreateVisualThing ( ip ) : GetVisualThing ( ip ) ;
2014-02-07 09:10:55 +00:00
Vector3D targetPos ;
2014-12-03 23:15:26 +00:00
if ( vTarget = = null )
{
2013-08-08 11:04:13 +00:00
targetPos = ip . Position ;
if ( ip . Sector ! = null ) targetPos . z + = ip . Sector . FloorHeight ;
2014-12-03 23:15:26 +00:00
}
else
{
2013-08-08 11:04:13 +00:00
targetPos = vTarget . CenterV3D ;
}
General . Map . VisualCamera . Position = targetPos ; //position at interpolation point
2014-12-03 23:15:26 +00:00
}
else
{
2013-08-08 11:04:13 +00:00
General . Map . VisualCamera . Position = visualThings [ 0 ] . CenterV3D ; //position at camera
}
2014-12-03 23:15:26 +00:00
}
else
{
2013-08-08 11:04:13 +00:00
General . Map . VisualCamera . Position = visualThings [ 0 ] . CenterV3D ; //position at camera
}
//angle
Thing target = null ;
2014-12-03 23:15:26 +00:00
foreach ( Thing tgt in General . Map . Map . Things )
{
if ( tgt . Tag = = t . Args [ 3 ] )
{
2013-08-08 11:04:13 +00:00
target = tgt ;
break ;
}
}
2015-12-28 15:01:53 +00:00
if ( target = = null )
2014-12-03 23:15:26 +00:00
{
2013-08-08 11:04:13 +00:00
General . Interface . DisplayStatus ( StatusType . Warning , "Camera target with Tag " + t . Args [ 3 ] + " does not exist!" ) ;
General . Map . VisualCamera . AngleXY = t . Angle - Angle2D . PI ;
General . Map . VisualCamera . AngleZ = Angle2D . PI ;
2014-12-03 23:15:26 +00:00
}
else
{
2013-08-10 11:28:51 +00:00
VisualThing vTarget = ! VisualThingExists ( target ) ? CreateVisualThing ( target ) : GetVisualThing ( target ) ;
2014-02-07 09:10:55 +00:00
Vector3D targetPos ;
2014-12-03 23:15:26 +00:00
if ( vTarget = = null )
{
2013-08-08 11:04:13 +00:00
targetPos = target . Position ;
if ( target . Sector ! = null ) targetPos . z + = target . Sector . FloorHeight ;
2014-12-03 23:15:26 +00:00
}
else
{
2013-08-08 11:04:13 +00:00
targetPos = vTarget . CenterV3D ;
}
bool pitch = ( t . Args [ 2 ] & 4 ) ! = 0 ;
Vector3D delta = General . Map . VisualCamera . Position - targetPos ;
General . Map . VisualCamera . AngleXY = delta . GetAngleXY ( ) ;
General . Map . VisualCamera . AngleZ = pitch ? - delta . GetAngleZ ( ) : Angle2D . PI ;
}
2014-12-03 23:15:26 +00:00
}
else if ( ( t . Type = = 9025 | | t . Type = = 9073 | | t . Type = = 9070 ) & & t . Args [ 0 ] ! = 0 ) //InterpolationPoint, SecurityCamera or AimingCamera with pitch?
{
2013-08-08 11:04:13 +00:00
General . Map . VisualCamera . Position = visualThings [ 0 ] . CenterV3D ; //position at camera
General . Map . VisualCamera . AngleXY = t . Angle - Angle2D . PI ;
General . Map . VisualCamera . AngleZ = Angle2D . PI + Angle2D . DegToRad ( t . Args [ 0 ] ) ;
2014-12-03 23:15:26 +00:00
}
else //nope, just a generic thing
{
2013-08-08 11:04:13 +00:00
General . Map . VisualCamera . Position = visualThings [ 0 ] . CenterV3D ; //position at thing
General . Map . VisualCamera . AngleXY = t . Angle - Angle2D . PI ;
General . Map . VisualCamera . AngleZ = Angle2D . PI ;
}
}
2013-04-26 12:32:51 +00:00
//mxd
[BeginAction("toggleslope")]
2014-12-03 23:15:26 +00:00
public void ToggleSlope ( )
{
2013-04-26 12:32:51 +00:00
List < VisualGeometry > selection = GetSelectedSurfaces ( ) ;
2014-12-03 23:15:26 +00:00
if ( selection . Count = = 0 )
{
2013-04-26 12:32:51 +00:00
General . Interface . DisplayStatus ( StatusType . Warning , "Toggle Slope action requires selected surfaces!" ) ;
return ;
}
List < BaseVisualSector > toUpdate = new List < BaseVisualSector > ( ) ;
General . Map . UndoRedo . CreateUndo ( "Toggle Slope" ) ;
//check selection
2014-12-03 23:15:26 +00:00
foreach ( VisualGeometry vg in selection )
{
2015-12-28 15:01:53 +00:00
bool update = false ;
2013-04-26 12:32:51 +00:00
//assign/remove action
2014-12-03 23:15:26 +00:00
if ( vg . GeometryType = = VisualGeometryType . WALL_LOWER )
{
if ( vg . Sidedef . Line . Action = = 0 | | ( vg . Sidedef . Line . Action = = 181 & & vg . Sidedef . Line . Args [ 0 ] = = 0 ) )
{
2013-04-26 12:32:51 +00:00
//check if the sector already has floor slopes
2014-12-03 23:15:26 +00:00
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 ) ;
2014-12-03 23:15:26 +00:00
if ( side . Line . Args [ 0 ] = = arg )
{
2013-04-26 12:32:51 +00:00
//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 ;
}
2014-12-03 23:15:26 +00:00
}
else if ( vg . GeometryType = = VisualGeometryType . WALL_UPPER )
{
if ( vg . Sidedef . Line . Action = = 0 | | ( vg . Sidedef . Line . Action = = 181 & & vg . Sidedef . Line . Args [ 1 ] = = 0 ) )
{
2013-04-26 12:32:51 +00:00
//check if the sector already has ceiling slopes
2014-12-03 23:15:26 +00:00
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 ) ;
2014-12-03 23:15:26 +00:00
if ( side . Line . Args [ 1 ] = = arg )
{
2013-04-26 12:32:51 +00:00
//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 ;
}
2014-12-03 23:15:26 +00:00
}
else if ( vg . GeometryType = = VisualGeometryType . CEILING )
{
2013-04-26 12:32:51 +00:00
//check if the sector has ceiling slopes
2014-12-03 23:15:26 +00:00
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 ) ;
2014-12-03 23:15:26 +00:00
if ( side . Line . Args [ 1 ] = = arg )
{
2013-04-26 12:32:51 +00:00
//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 ;
}
}
2014-12-03 23:15:26 +00:00
}
else if ( vg . GeometryType = = VisualGeometryType . FLOOR )
{
2013-04-26 12:32:51 +00:00
//check if the sector has floor slopes
2014-12-03 23:15:26 +00:00
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 ) ;
2014-12-03 23:15:26 +00:00
if ( side . Line . Args [ 0 ] = = arg )
{
2013-04-26 12:32:51 +00:00
//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
2016-04-19 20:40:42 +00:00
if ( update ) toUpdate . Add ( ( BaseVisualSector ) vg . Sector ) ;
2013-04-26 12:32:51 +00:00
}
//update changed geometry
2014-12-03 23:15:26 +00:00
if ( toUpdate . Count > 0 )
{
2013-04-26 12:32:51 +00:00
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." ) ) ;
}
2016-06-13 23:37:55 +00:00
//mxd
[BeginAction("alphabasedtexturehighlighting")]
public void ToggleAlphaBasedTextureHighlighting ( )
{
BuilderPlug . Me . AlphaBasedTextureHighlighting = ! BuilderPlug . Me . AlphaBasedTextureHighlighting ;
General . Interface . DisplayStatus ( StatusType . Info , "Alpha-based textures highlighting is " + ( BuilderPlug . Me . AlphaBasedTextureHighlighting ? "ENABLED" : "DISABLED" ) ) ;
}
2019-01-19 07:56:13 +00:00
// biwa
[BeginAction("visualpaintselect")]
protected virtual void OnPaintSelectBegin ( )
{
paintselectpressed = true ;
GetTargetEventReceiver ( true ) . OnPaintSelectBegin ( ) ;
}
// biwa
[EndAction("visualpaintselect")]
protected virtual void OnPaintSelectEnd ( )
{
paintselectpressed = false ;
paintselecttype = null ;
GetTargetEventReceiver ( true ) . OnPaintSelectEnd ( ) ;
}
2020-02-19 20:59:42 +00:00
[BeginAction("togglevisualslopepicking")]
2021-01-30 21:01:55 +00:00
public void ToggleVisualSidedefSlopePicking ( )
2020-02-19 20:59:42 +00:00
{
2021-01-30 21:01:55 +00:00
if ( pickingmode ! = PickingMode . SidedefSlopeHandles )
pickingmode = PickingMode . SidedefSlopeHandles ;
2020-02-19 20:59:42 +00:00
else
2020-02-24 11:54:59 +00:00
{
2020-02-19 20:59:42 +00:00
pickingmode = PickingMode . Default ;
2020-02-24 11:54:59 +00:00
// Clear smart pivot handles, otherwise it will keep being displayed
foreach ( KeyValuePair < Sector , List < VisualSlope > > kvp in allslopehandles )
2021-01-30 21:01:55 +00:00
foreach ( VisualSlope checkhandle in kvp . Value )
2021-02-06 13:51:00 +00:00
if ( checkhandle . SmartPivot & & ! ( checkhandle . Selected | | checkhandle . Pivot ) )
{
checkhandle . SmartPivot = false ;
renderslopehandles . Remove ( checkhandle ) ;
}
2020-02-24 11:54:59 +00:00
}
2020-02-19 20:59:42 +00:00
}
2021-01-30 21:01:55 +00:00
[BeginAction("togglevisualvertexslopepicking")]
public void ToggleVisualVertexSlopePicking ( )
{
if ( pickingmode ! = PickingMode . VertexSlopeHandles )
pickingmode = PickingMode . VertexSlopeHandles ;
else
{
pickingmode = PickingMode . Default ;
// Clear smart pivot handles, otherwise it will keep being displayed
foreach ( KeyValuePair < Sector , List < VisualSlope > > kvp in allslopehandles )
foreach ( VisualSlope checkhandle in kvp . Value )
2021-02-06 13:51:00 +00:00
{
if ( checkhandle . SmartPivot & & ! ( checkhandle . Selected | | checkhandle . Pivot ) )
{
checkhandle . SmartPivot = false ;
renderslopehandles . Remove ( checkhandle ) ;
}
}
2021-01-30 21:01:55 +00:00
}
}
2020-12-27 22:13:56 +00:00
[BeginAction("resetslope")]
public void ResetSlope ( )
{
List < IVisualEventReceiver > selectedsectors = GetSelectedObjects ( true , false , false , false , false ) ;
if ( selectedsectors . Count = = 0 )
{
General . Interface . DisplayStatus ( StatusType . Warning , "You need to select at least one floor or ceiling to reset slope." ) ;
return ;
}
General . Map . UndoRedo . CreateUndo ( "Reset plane slope" ) ;
int numfloors = 0 ;
int numceilings = 0 ;
// Reset slope
foreach ( BaseVisualGeometrySector bvgs in selectedsectors )
{
SectorLevel level = bvgs . Level ;
bool applytoceiling = false ;
if ( level . extrafloor )
{
// The top side of 3D floors is the ceiling of the sector, but it's a "floor" in UDB, so the
// ceiling of the control sector has to be modified
if ( level . type = = SectorLevelType . Floor )
applytoceiling = true ;
}
else
{
if ( level . type = = SectorLevelType . Ceiling )
applytoceiling = true ;
}
if ( applytoceiling )
{
2020-12-27 22:47:45 +00:00
level . sector . CeilSlopeOffset = double . NaN ;
level . sector . CeilSlope = new Vector3D ( ) ;
2020-12-27 22:13:56 +00:00
numceilings + + ;
}
else
{
2020-12-27 22:47:45 +00:00
level . sector . FloorSlopeOffset = double . NaN ;
level . sector . FloorSlope = new Vector3D ( ) ;
2020-12-27 22:13:56 +00:00
numfloors + + ;
}
// Rebuild sector
BaseVisualSector vs ;
if ( VisualSectorExists ( level . sector ) )
{
vs = ( BaseVisualSector ) GetVisualSector ( level . sector ) ;
}
else
{
vs = CreateBaseVisualSector ( level . sector ) ;
}
if ( vs ! = null ) vs . UpdateSectorGeometry ( true ) ;
}
string ptype = "plane" ;
if ( numfloors = = 0 ) ptype = "ceiling" ;
else if ( numceilings = = 0 ) ptype = "floor" ;
UpdateChangedObjects ( ) ;
General . Interface . DisplayStatus ( StatusType . Action , string . Format ( "{1} {0} slopes reset." , ptype , numfloors + numceilings ) ) ;
}
2020-02-23 11:44:59 +00:00
[BeginAction("slopebetweenhandles")]
public void SlopeBetweenHandles ( )
{
2020-02-24 12:57:26 +00:00
List < IVisualEventReceiver > selectedsectors = GetSelectedObjects ( true , false , false , false , false ) ;
if ( selectedsectors . Count = = 0 )
2020-02-23 11:44:59 +00:00
{
2020-02-24 12:57:26 +00:00
General . Interface . DisplayStatus ( StatusType . Warning , "You need to select floors or ceilings to slope between slope handles." ) ;
2020-02-23 11:44:59 +00:00
return ;
}
2020-06-01 07:50:35 +00:00
List < VisualSidedefSlope > handles = GetSlopeHandlePair ( ) ;
2020-02-24 12:57:26 +00:00
2020-06-01 07:50:35 +00:00
if ( handles . Count ! = 2 )
2020-02-24 12:57:26 +00:00
{
2020-06-01 07:50:35 +00:00
General . Interface . DisplayStatus ( StatusType . Warning , "You need to select exactly two slope handles." ) ;
2020-02-23 11:44:59 +00:00
return ;
}
General . Map . UndoRedo . CreateUndo ( "Slope between slope handles" ) ;
// Create the new plane
Vector3D p1 = new Vector3D ( handles [ 0 ] . Sidedef . Line . Start . Position , handles [ 0 ] . Level . plane . GetZ ( handles [ 0 ] . Sidedef . Line . Start . Position ) ) ;
Vector3D p2 = new Vector3D ( handles [ 0 ] . Sidedef . Line . End . Position , handles [ 0 ] . Level . plane . GetZ ( handles [ 0 ] . Sidedef . Line . End . Position ) ) ;
Vector3D p3 = new Vector3D ( handles [ 1 ] . Sidedef . Line . Line . GetCoordinatesAt ( 0.5f ) , handles [ 1 ] . Level . plane . GetZ ( handles [ 1 ] . Sidedef . Line . Line . GetCoordinatesAt ( 0.5f ) ) ) ;
Plane plane = new Plane ( p1 , p2 , p3 , true ) ;
// Apply slope
foreach ( BaseVisualGeometrySector bvgs in selectedsectors )
{
VisualSidedefSlope . ApplySlope ( bvgs . Level , plane , this ) ;
bvgs . Sector . UpdateSectorGeometry ( true ) ;
}
UpdateChangedObjects ( ) ;
General . Interface . DisplayStatus ( StatusType . Action , "Sloped between slope handles." ) ;
}
2020-06-08 18:58:00 +00:00
/// <summary>
/// Applies plane equation slopes to selected sectors, based on the selected slope handles
/// </summary>
2020-06-01 07:50:35 +00:00
[BeginAction("archbetweenhandles")]
public void ArchBetweenHandles ( )
{
List < IVisualEventReceiver > selectedsectors = GetSelectedObjects ( true , false , false , false , false ) ;
2020-06-01 19:57:17 +00:00
2020-06-01 07:50:35 +00:00
if ( selectedsectors . Count < 2 )
{
General . Interface . DisplayStatus ( StatusType . Warning , "You need to select at least two floors and ceilings to slope arch between slope handles." ) ;
return ;
}
List < VisualSidedefSlope > handles = GetSlopeHandlePair ( ) ;
if ( handles . Count ! = 2 )
{
General . Interface . DisplayStatus ( StatusType . Warning , "You need to select exactly two slope handles." ) ;
return ;
}
2020-06-01 15:16:13 +00:00
General . Map . UndoRedo . CreateUndo ( "Arch between slope handles" ) ;
2020-06-01 07:50:35 +00:00
2020-06-07 16:01:19 +00:00
Vector3D p1 = handles [ 0 ] . GetCenterPoint ( ) ;
Vector3D p2 = handles [ 1 ] . GetCenterPoint ( ) ;
2020-06-08 18:58:00 +00:00
double linelength = Line2D . GetLength ( p2 . x - p1 . x , p2 . y - p1 . y ) ;
2020-06-07 16:01:19 +00:00
double zdiff = Math . Abs ( p1 . z - p2 . z ) ;
2020-06-08 18:58:00 +00:00
double theta ;
double offsetangle ;
2020-06-07 16:01:19 +00:00
2020-06-08 18:58:00 +00:00
// Compute theta and the offset angle. Special handling if the slope handles are at the same height
if ( zdiff = = 0.0 )
{
theta = Math . PI ;
offsetangle = 0.0 ;
}
else
{
theta = Math . Atan ( zdiff / linelength ) * 2 ;
offsetangle = Math . PI / 2.0 ;
2020-06-07 16:01:19 +00:00
2020-06-08 18:58:00 +00:00
if ( p2 . z < p1 . z )
offsetangle - = theta ;
}
2020-06-01 19:57:17 +00:00
2020-06-08 18:58:00 +00:00
SlopeArcher sa = new SlopeArcher ( this , selectedsectors , handles [ 0 ] , handles [ 1 ] , theta , offsetangle , 1.0 ) ;
2020-06-03 21:34:22 +00:00
2020-06-07 16:01:19 +00:00
SlopeArchForm saf = new SlopeArchForm ( sa ) ;
2020-06-03 21:34:22 +00:00
saf . UpdateChangedObjects + = Interface_OnUpdateChangedObjects ;
2020-06-01 19:57:17 +00:00
DialogResult result = saf . ShowDialog ( ) ;
2020-06-03 21:34:22 +00:00
saf . UpdateChangedObjects - = Interface_OnUpdateChangedObjects ;
2020-06-01 19:57:17 +00:00
if ( result = = DialogResult . Cancel )
General . Map . UndoRedo . WithdrawUndo ( ) ;
2020-06-08 18:58:00 +00:00
else
{
UpdateChangedObjects ( ) ;
2020-06-01 19:57:17 +00:00
2020-06-08 18:58:00 +00:00
General . Interface . DisplayStatus ( StatusType . Action , "Arched between slope handles." ) ;
}
2020-06-01 07:50:35 +00:00
}
2020-09-27 12:46:16 +00:00
/// <summary>
/// Applies the Visual Mode's current camera pitch and yaw to the selected things
/// </summary>
[BeginAction("applycamerarotationtothings")]
public void ApplyCameraRotationToThings ( )
{
List < Thing > things = GetSelectedThings ( ) ;
if ( things . Count = = 0 )
{
General . Interface . DisplayStatus ( StatusType . Warning , "Can't apply camera rotation to things: no things selected." ) ;
return ;
}
General . Map . UndoRedo . CreateUndo ( "Apply camera rotation to things" ) ;
foreach ( Thing t in things )
{
2020-09-28 14:18:36 +00:00
t . Rotate ( General . Map . VisualCamera . AngleXY - Angle2D . PI ) ;
t . SetPitch ( ( int ) Angle2D . RadToDeg ( General . Map . VisualCamera . AngleZ - Angle2D . PI ) ) ;
2020-09-27 12:46:16 +00:00
}
}
2009-04-19 18:07:22 +00:00
#endregion
2013-03-18 13:52:27 +00:00
#region = = = = = = = = = = = = = = = = = = Texture Alignment
2013-09-03 09:34:28 +00:00
//mxd. If checkSelectedSidedefParts is set to true, only selected linedef parts will be aligned (when a sidedef has both top and bottom parts, but only bottom is selected, top texture won't be aligned)
2014-12-03 23:15:26 +00:00
internal void AutoAlignTextures ( BaseVisualGeometrySidedef start , ImageData texture , bool alignx , bool aligny , bool resetsidemarks , bool checkSelectedSidedefParts )
{
2016-09-05 18:36:22 +00:00
if ( General . Map . UDMF & & General . Map . Config . UseLocalSidedefTextureOffsets )
2015-02-12 22:04:49 +00:00
AutoAlignTexturesUDMF ( start , texture , alignx , aligny , resetsidemarks , checkSelectedSidedefParts ) ;
2013-03-18 13:52:27 +00:00
else
2014-12-03 23:15:26 +00:00
AutoAlignTextures ( start , texture , alignx , aligny , resetsidemarks ) ;
2013-03-18 13:52:27 +00:00
}
//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)
2014-12-03 23:15:26 +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 ) ;
2020-05-21 12:20:02 +00:00
double scalex = ( General . Map . Config . ScaledTextureOffsets & & ! texture . WorldPanning ) ? texture . Scale . x : 1.0f ;
double scaley = ( General . Map . Config . ScaledTextureOffsets & & ! texture . WorldPanning ) ? texture . Scale . y : 1.0f ;
2013-03-18 13:52:27 +00:00
2013-09-03 09:34:28 +00:00
// Mark all sidedefs false (they will be marked true when the texture is aligned).
if ( resetsidemarks ) General . Map . Map . ClearMarkedSidedefs ( false ) ;
2013-03-18 13:52:27 +00:00
// 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
2014-12-03 23:15:26 +00:00
if ( start . GeometryType = = VisualGeometryType . WALL_MIDDLE_3D )
{
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 . controlSide = start . GetControlLinedef ( ) . Front ;
first . offsetx + = first . controlSide . OffsetX ;
ystartalign + = first . controlSide . OffsetY ;
2014-12-03 23:15:26 +00:00
}
else
{
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 . controlSide = start . Sidedef ;
}
2013-03-18 13:52:27 +00:00
Sectors, Linedefs, Things modes: optimized text label rendering.
Fixed, Things mode: in some cases selection labels were not updated after editing a thing.
Fixed, Things mode: selection labels were positioned incorrectly on things with FixedSize setting.
Fixed, Sectors mode: fixed a crash when selecting self-referencing sector when selection labels were enabled.
Fixed, Visual mode: in some cases Auto-align texture actions were not working when "use long texture names" Map Options setting was enabled.
Fixed, MD2/MD3 loader: available animation frames upper bound check was performed incorrectly, which would cause a crash in some very special cases.
Fixed, Game configurations: most Hexen/ZDoom teleport actions use TeleportDests as teleport targets, not MapSpots.
2016-04-05 22:24:36 +00:00
//mxd
HashSet < long > texturehashes = new HashSet < long > { texture . LongName } ;
2013-03-18 13:52:27 +00:00
first . forward = true ;
todo . Push ( first ) ;
// Continue until nothing more to align
2014-12-03 23:15:26 +00:00
while ( todo . Count > 0 )
{
2013-03-18 13:52:27 +00:00
// Get the align job to do
SidedefAlignJob j = todo . Pop ( ) ;
2019-10-18 22:29:14 +00:00
// Make sure to not align already aligned textures. This prevents unexpected
// results when aligning textures on circular shapes
if ( j . sidedef . Marked )
continue ;
2014-12-03 23:15:26 +00:00
if ( j . forward )
{
2013-03-18 13:52:27 +00:00
// Apply alignment
2014-12-03 23:15:26 +00:00
if ( alignx ) j . controlSide . OffsetX = ( int ) j . offsetx ;
if ( aligny ) j . sidedef . OffsetY = ( int ) Math . Round ( ( first . ceilingHeight - j . ceilingHeight ) / scaley ) + ystartalign ;
2014-03-06 11:45:20 +00:00
int forwardoffset = ( int ) j . offsetx + ( int ) Math . Round ( j . sidedef . Line . Length / scalex ) ;
int backwardoffset = ( int ) j . offsetx ;
2013-03-18 13:52:27 +00:00
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
2016-05-12 11:32:10 +00:00
if ( texture . IsImageLoaded & & BuilderModesTools . SidedefTextureMatch ( this , j . sidedef , texturehashes ) )
2014-12-03 23:15:26 +00:00
{
2014-01-16 13:08:41 +00:00
if ( alignx ) j . sidedef . OffsetX % = texture . Width ;
if ( aligny ) j . sidedef . OffsetY % = texture . Height ;
2013-03-18 13:52:27 +00:00
}
// Add sidedefs backward (connected to the left vertex)
2019-10-18 22:29:14 +00:00
Vertex v = j . sidedef . IsFront ? j . sidedef . Line . Start : j . sidedef . Line . End ;
Sectors, Linedefs, Things modes: optimized text label rendering.
Fixed, Things mode: in some cases selection labels were not updated after editing a thing.
Fixed, Things mode: selection labels were positioned incorrectly on things with FixedSize setting.
Fixed, Sectors mode: fixed a crash when selecting self-referencing sector when selection labels were enabled.
Fixed, Visual mode: in some cases Auto-align texture actions were not working when "use long texture names" Map Options setting was enabled.
Fixed, MD2/MD3 loader: available animation frames upper bound check was performed incorrectly, which would cause a crash in some very special cases.
Fixed, Game configurations: most Hexen/ZDoom teleport actions use TeleportDests as teleport targets, not MapSpots.
2016-04-05 22:24:36 +00:00
AddSidedefsForAlignment ( todo , v , false , backwardoffset , 1.0f , texturehashes , false ) ;
2019-10-18 22:29:14 +00:00
// Add sidedefs forward (connected to the right vertex)
v = j . sidedef . IsFront ? j . sidedef . Line . End : j . sidedef . Line . Start ;
AddSidedefsForAlignment ( todo , v , true , forwardoffset , 1.0f , texturehashes , false ) ;
}
2014-12-03 23:15:26 +00:00
else
{
2013-03-18 13:52:27 +00:00
// Apply alignment
2014-12-03 23:15:26 +00:00
if ( alignx ) j . controlSide . OffsetX = ( int ) j . offsetx - ( int ) Math . Round ( j . sidedef . Line . Length / scalex ) ;
if ( aligny ) j . sidedef . OffsetY = ( int ) Math . Round ( ( first . ceilingHeight - j . ceilingHeight ) / scaley ) + ystartalign ;
2014-03-06 11:45:20 +00:00
int forwardoffset = ( int ) j . offsetx ;
int backwardoffset = ( int ) j . offsetx - ( int ) Math . Round ( j . sidedef . Line . Length / scalex ) ;
2013-03-18 13:52:27 +00:00
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
2016-05-12 11:32:10 +00:00
if ( texture . IsImageLoaded & & BuilderModesTools . SidedefTextureMatch ( this , j . sidedef , texturehashes ) )
2014-12-03 23:15:26 +00:00
{
2014-01-16 13:08:41 +00:00
if ( alignx ) j . sidedef . OffsetX % = texture . Width ;
if ( aligny ) j . sidedef . OffsetY % = texture . Height ;
2013-03-18 13:52:27 +00:00
}
// Add sidedefs forward (connected to the right vertex)
2019-10-18 22:29:14 +00:00
Vertex v = j . sidedef . IsFront ? j . sidedef . Line . End : j . sidedef . Line . Start ;
Sectors, Linedefs, Things modes: optimized text label rendering.
Fixed, Things mode: in some cases selection labels were not updated after editing a thing.
Fixed, Things mode: selection labels were positioned incorrectly on things with FixedSize setting.
Fixed, Sectors mode: fixed a crash when selecting self-referencing sector when selection labels were enabled.
Fixed, Visual mode: in some cases Auto-align texture actions were not working when "use long texture names" Map Options setting was enabled.
Fixed, MD2/MD3 loader: available animation frames upper bound check was performed incorrectly, which would cause a crash in some very special cases.
Fixed, Game configurations: most Hexen/ZDoom teleport actions use TeleportDests as teleport targets, not MapSpots.
2016-04-05 22:24:36 +00:00
AddSidedefsForAlignment ( todo , v , true , forwardoffset , 1.0f , texturehashes , false ) ;
2019-10-18 22:29:14 +00:00
// Add sidedefs backward (connected to the left vertex)
v = j . sidedef . IsFront ? j . sidedef . Line . Start : j . sidedef . Line . End ;
AddSidedefsForAlignment ( todo , v , false , backwardoffset , 1.0f , texturehashes , 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)
2016-05-12 11:32:10 +00:00
private void AutoAlignTexturesUDMF ( BaseVisualGeometrySidedef start , ImageData texture , bool alignx , bool aligny , bool resetsidemarks , bool checkselectedsidedefparts )
2014-12-03 23:15:26 +00:00
{
2020-06-16 17:11:03 +00:00
HashSet < long > alignedsides = new HashSet < long > ( 100 ) ;
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)
if ( resetsidemarks ) General . Map . Map . ClearMarkedSidedefs ( false ) ;
if ( ! texture . IsImageLoaded ) return ;
2019-04-14 16:24:37 +00:00
bool worldpanning = texture . WorldPanning | | General . Map . Data . MapInfo . ForceWorldPanning ;
2013-03-18 13:52:27 +00:00
Stack < SidedefAlignJob > todo = new Stack < SidedefAlignJob > ( 50 ) ;
2020-05-21 12:20:02 +00:00
double scalex = ( General . Map . Config . ScaledTextureOffsets & & ! texture . WorldPanning ) ? texture . Scale . x : 1.0f ;
double scaley = ( General . Map . Config . ScaledTextureOffsets & & ! texture . WorldPanning ) ? texture . Scale . y : 1.0f ;
2013-03-18 13:52:27 +00:00
2016-05-12 11:32:10 +00:00
SidedefAlignJob first = new SidedefAlignJob { sidedef = start . Sidedef , offsetx = start . Sidedef . OffsetX } ;
first . controlSide = ( start . GeometryType = = VisualGeometryType . WALL_MIDDLE_3D ? start . GetControlLinedef ( ) . Front : start . Sidedef ) ;
2013-03-18 13:52:27 +00:00
Sectors, Linedefs, Things modes: optimized text label rendering.
Fixed, Things mode: in some cases selection labels were not updated after editing a thing.
Fixed, Things mode: selection labels were positioned incorrectly on things with FixedSize setting.
Fixed, Sectors mode: fixed a crash when selecting self-referencing sector when selection labels were enabled.
Fixed, Visual mode: in some cases Auto-align texture actions were not working when "use long texture names" Map Options setting was enabled.
Fixed, MD2/MD3 loader: available animation frames upper bound check was performed incorrectly, which would cause a crash in some very special cases.
Fixed, Game configurations: most Hexen/ZDoom teleport actions use TeleportDests as teleport targets, not MapSpots.
2016-04-05 22:24:36 +00:00
//mxd. We potentially need to deal with 2 textures (because of long and short texture names)...
HashSet < long > texturehashes = new HashSet < long > { texture . LongName } ;
switch ( start . GeometryType )
{
case VisualGeometryType . WALL_LOWER :
texturehashes . Add ( first . controlSide . LongLowTexture ) ;
break ;
case VisualGeometryType . WALL_MIDDLE :
case VisualGeometryType . WALL_MIDDLE_3D :
texturehashes . Add ( first . controlSide . LongMiddleTexture ) ;
break ;
case VisualGeometryType . WALL_UPPER :
texturehashes . Add ( first . controlSide . LongHighTexture ) ;
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
//mxd
List < BaseVisualGeometrySidedef > selectedVisualSides = new List < BaseVisualGeometrySidedef > ( ) ;
2016-05-12 11:32:10 +00:00
if ( checkselectedsidedefparts & & ! singleselection )
2014-12-03 23:15:26 +00:00
{
2016-04-19 20:40:42 +00:00
foreach ( IVisualEventReceiver i in selectedobjects )
2014-12-03 23:15:26 +00:00
{
2016-05-08 18:45:26 +00:00
BaseVisualGeometrySidedef side = i as BaseVisualGeometrySidedef ;
2016-04-19 20:40:42 +00:00
if ( side ! = null & & ! selectedVisualSides . Contains ( side ) ) selectedVisualSides . Add ( side ) ;
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
}
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
2015-02-12 22:04:49 +00:00
//mxd. Scale
2014-12-03 23:15:26 +00:00
switch ( start . GeometryType )
{
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_UPPER :
2020-05-22 19:39:18 +00:00
first . scaleX = start . Sidedef . Fields . GetValue ( "scalex_top" , 1.0 ) ;
first . scaleY = start . Sidedef . Fields . GetValue ( "scaley_top" , 1.0 ) ;
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 :
2020-05-22 19:39:18 +00:00
first . scaleX = first . controlSide . Fields . GetValue ( "scalex_mid" , 1.0 ) ;
first . scaleY = first . controlSide . Fields . GetValue ( "scaley_mid" , 1.0 ) ;
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 :
2020-05-22 19:39:18 +00:00
first . scaleX = start . Sidedef . Fields . GetValue ( "scalex_bottom" , 1.0 ) ;
first . scaleY = start . Sidedef . Fields . GetValue ( "scaley_bottom" , 1.0 ) ;
2013-03-18 13:52:27 +00:00
break ;
}
2019-04-14 16:24:37 +00:00
// biwa
2020-05-21 12:20:02 +00:00
double vwidth = worldpanning ? texture . ScaledWidth / first . scaleX : texture . Width ;
double vheight = worldpanning ? texture . ScaledHeight / first . scaleY : texture . Height ;
2019-04-14 16:24:37 +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
// Determine the Y alignment
2020-05-21 12:20:02 +00:00
double ystartalign = start . Sidedef . OffsetY ;
2014-12-03 23:15:26 +00:00
switch ( start . GeometryType )
{
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_UPPER :
2020-05-22 19:39:18 +00:00
ystartalign + = Tools . GetSidedefTopOffsetY ( start . Sidedef , start . Sidedef . Fields . GetValue ( "offsety_top" , 0.0 ) , worldpanning ? 1.0 : first . scaleY / scaley , false ) ; //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
break ;
case VisualGeometryType . WALL_MIDDLE :
2020-05-22 19:39:18 +00:00
ystartalign + = Tools . GetSidedefMiddleOffsetY ( start . Sidedef , start . Sidedef . Fields . GetValue ( "offsety_mid" , 0.0 ) , worldpanning ? 1.0 : first . scaleY / scaley , false ) ; //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
break ;
case VisualGeometryType . WALL_MIDDLE_3D : //mxd. 3d-floors are not affected by Lower/Upper unpegged flags
2014-09-22 14:33:15 +00:00
ystartalign + = first . controlSide . OffsetY - ( start . Sidedef . Sector . CeilHeight - first . ceilingHeight ) ;
2020-05-22 19:39:18 +00:00
ystartalign + = start . Sidedef . Fields . GetValue ( "offsety_mid" , 0.0 ) ;
ystartalign + = first . controlSide . Fields . GetValue ( "offsety_mid" , 0.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
break ;
case VisualGeometryType . WALL_LOWER :
2020-05-22 19:39:18 +00:00
ystartalign + = Tools . GetSidedefBottomOffsetY ( start . Sidedef , start . Sidedef . Fields . GetValue ( "offsety_bottom" , 0.0 ) , worldpanning ? 1.0 : first . scaleY / scaley , false ) ; //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
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
2014-12-03 23:15:26 +00:00
switch ( start . GeometryType )
{
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_UPPER :
2020-05-22 19:39:18 +00:00
first . offsetx + = start . Sidedef . Fields . GetValue ( "offsetx_top" , 0.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
break ;
case VisualGeometryType . WALL_MIDDLE :
2020-05-22 19:39:18 +00:00
first . offsetx + = start . Sidedef . Fields . GetValue ( "offsetx_mid" , 0.0 ) ;
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
2020-05-22 19:39:18 +00:00
first . offsetx + = start . Sidedef . Fields . GetValue ( "offsetx_mid" , 0.0 ) ;
2014-09-22 14:33:15 +00:00
first . offsetx + = first . controlSide . OffsetX ;
2020-05-22 19:39:18 +00:00
first . offsetx + = first . controlSide . Fields . GetValue ( "offsetx_mid" , 0.0 ) ;
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 :
2020-05-22 19:39:18 +00:00
first . offsetx + = start . Sidedef . Fields . GetValue ( "offsetx_bottom" , 0.0 ) ;
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 ;
2013-03-18 13:52:27 +00:00
todo . Push ( first ) ;
// Continue until nothing more to align
2014-12-03 23:15:26 +00:00
while ( todo . Count > 0 )
{
2013-03-18 13:52:27 +00:00
Vertex v ;
2020-05-21 12:20:02 +00:00
double forwardoffset , backwardoffset ;
2016-05-12 11:32:10 +00:00
bool matchtop = false ;
bool matchmid = false ;
bool matchbottom = false ;
2013-03-18 13:52:27 +00:00
// Get the align job to do
SidedefAlignJob j = todo . Pop ( ) ;
2020-06-16 17:11:03 +00:00
// Make sure that each combination of sidedef and control side is only aligned once.
// This prevents unexpected results when aligning textures on circular shapes
long checksum = ( long ) j . sidedef . Index < < 32 | ( long ) j . controlSide . Index ;
if ( alignedsides . Contains ( checksum ) )
2019-10-18 22:29:14 +00:00
continue ;
2020-06-16 17:11:03 +00:00
else
alignedsides . Add ( checksum ) ;
2019-10-18 22:29:14 +00:00
2016-05-12 11:32:10 +00:00
//mxd. Get visual parts
2019-10-18 22:29:14 +00:00
if ( VisualSectorExists ( j . sidedef . Sector ) )
2014-12-03 23:15:26 +00:00
{
2016-05-12 11:32:10 +00:00
VisualSidedefParts parts = ( ( BaseVisualSector ) GetVisualSector ( j . sidedef . Sector ) ) . GetSidedefParts ( j . sidedef ) ;
2020-06-09 20:10:15 +00:00
//VisualSidedefParts controlparts = (j.sidedef != j.controlSide ? ((BaseVisualSector)GetVisualSector(j.controlSide.Sector)).GetSidedefParts(j.controlSide) : parts);
2016-05-12 11:32:10 +00:00
matchtop = ( ! j . sidedef . Marked & & ( ! singleselection | | texturehashes . Contains ( j . sidedef . LongHighTexture ) ) & & ( parts . upper ! = null & & parts . upper . Triangles > 0 ) ) ;
matchbottom = ( ! j . sidedef . Marked & & ( ! singleselection | | texturehashes . Contains ( j . sidedef . LongLowTexture ) ) & & ( parts . lower ! = null & & parts . lower . Triangles > 0 ) ) ;
matchmid = ( ( ! singleselection | | texturehashes . Contains ( j . controlSide . LongMiddleTexture ) )
2020-06-09 20:10:15 +00:00
& & ( ( parts . middledouble ! = null & & parts . middledouble . Triangles > 0 ) | | ( parts . middlesingle ! = null & & parts . middlesingle . Triangles > 0 ) ) ) ; //mxd
// "Normal" sidedef parts didn't match? Check 3D floors
if ( matchmid = = false & & parts . middle3d ! = null & & parts . middle3d . Count > 0 )
{
foreach ( VisualMiddle3D vm3d in parts . middle3d )
{
if ( vm3d . Triangles > 0 & & texturehashes . Contains ( vm3d . Texture . LongName ) )
{
matchmid = true ;
break ;
}
}
}
2016-05-12 11:32:10 +00:00
//mxd. If there's a selection, check if matched part is actually selected
if ( checkselectedsidedefparts & & ! singleselection )
{
if ( matchtop ) matchtop = parts . upper . Selected ;
if ( matchbottom ) matchbottom = parts . lower . Selected ;
if ( matchmid ) matchmid = ( ( parts . middledouble ! = null & & parts . middledouble . Selected )
| | ( parts . middlesingle ! = null & & parts . middlesingle . Selected )
| | SidePartIsSelected ( selectedVisualSides , j . sidedef , VisualGeometryType . WALL_MIDDLE_3D ) ) ;
}
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 ( ! matchbottom & & ! matchtop & & ! matchmid ) continue ; //mxd
2015-04-16 13:03:12 +00:00
//mxd. We want to skip realigning of the starting wall part
if ( matchtop ) matchtop = ( j . sidedef ! = start . Sidedef | | start . GeometryType ! = VisualGeometryType . WALL_UPPER ) ;
if ( matchmid ) matchmid = ( j . sidedef ! = start . Sidedef | | ( start . GeometryType ! = VisualGeometryType . WALL_MIDDLE & & start . GeometryType ! = VisualGeometryType . WALL_MIDDLE_3D ) ) ;
if ( matchbottom ) matchbottom = ( j . sidedef ! = start . Sidedef | | start . GeometryType ! = VisualGeometryType . WALL_LOWER ) ;
if ( matchbottom | | matchtop | | matchmid )
{
j . sidedef . Fields . BeforeFieldsChange ( ) ;
2015-06-22 09:17:40 +00:00
if ( j . sidedef . Index ! = j . controlSide . Index ) j . controlSide . Fields . BeforeFieldsChange ( ) ; //mxd
2015-04-16 13:03:12 +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
2015-02-12 22:04:49 +00:00
//mxd. Apply Scale
if ( matchtop )
{
2020-05-22 20:30:32 +00:00
UniFields . SetFloat ( j . sidedef . Fields , "scalex_top" , first . scaleX , 1.0 ) ;
UniFields . SetFloat ( j . sidedef . Fields , "scaley_top" , j . scaleY , 1.0 ) ;
2015-02-12 22:04:49 +00:00
}
if ( matchmid )
{
2020-05-22 20:30:32 +00:00
UniFields . SetFloat ( j . controlSide . Fields , "scalex_mid" , first . scaleX , 1.0 ) ;
UniFields . SetFloat ( j . controlSide . Fields , "scaley_mid" , j . scaleY , 1.0 ) ;
2015-02-12 22:04:49 +00:00
}
if ( matchbottom )
{
2020-05-22 20:30:32 +00:00
UniFields . SetFloat ( j . sidedef . Fields , "scalex_bottom" , first . scaleX , 1.0 ) ;
UniFields . SetFloat ( j . sidedef . Fields , "scaley_bottom" , j . scaleY , 1.0 ) ;
2015-02-12 22:04:49 +00:00
}
2013-04-03 14:50:41 +00:00
2014-12-03 23:15:26 +00:00
if ( j . forward )
{
2013-03-18 13:52:27 +00:00
// Apply alignment
2014-12-03 23:15:26 +00:00
if ( alignx )
{
2020-05-21 12:20:02 +00:00
double offset = j . offsetx ;
2013-03-18 13:52:27 +00:00
offset - = j . sidedef . OffsetX ;
if ( matchtop )
2016-09-02 19:18:37 +00:00
{
ImageData tex = General . Map . Data . GetTextureImage ( j . sidedef . LongHighTexture ) ;
int texwidth = ( tex ! = null & & tex . IsImageLoaded ) ? tex . Width : 1 ;
2020-05-22 19:39:18 +00:00
j . sidedef . Fields [ "offsetx_top" ] = new UniValue ( UniversalType . Float , Math . Round ( offset % vwidth , General . Map . FormatInterface . VertexDecimals ) ) ;
2016-09-02 19:18:37 +00:00
}
2013-03-18 13:52:27 +00:00
if ( matchbottom )
2016-09-02 19:18:37 +00:00
{
ImageData tex = General . Map . Data . GetTextureImage ( j . sidedef . LongLowTexture ) ;
int texwidth = ( tex ! = null & & tex . IsImageLoaded ) ? tex . Width : 1 ;
2020-05-22 19:39:18 +00:00
j . sidedef . Fields [ "offsetx_bottom" ] = new UniValue ( UniversalType . Float , Math . Round ( offset % vwidth , General . Map . FormatInterface . VertexDecimals ) ) ;
2016-09-02 19:18:37 +00:00
}
2014-12-03 23:15:26 +00:00
if ( matchmid )
{
if ( j . sidedef . Index ! = j . controlSide . Index ) //mxd. if it's a part of 3d-floor
{
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 . OffsetX ;
2020-05-22 19:39:18 +00:00
offset - = j . controlSide . Fields . GetValue ( "offsetx_mid" , 0.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
}
2016-09-02 19:18:37 +00:00
ImageData tex = General . Map . Data . GetTextureImage ( j . controlSide . LongMiddleTexture ) ;
int texwidth = ( tex ! = null & & tex . IsImageLoaded ) ? tex . Width : 1 ;
2020-05-22 19:39:18 +00:00
j . sidedef . Fields [ "offsetx_mid" ] = new UniValue ( UniversalType . Float , Math . Round ( offset % vwidth , General . Map . FormatInterface . VertexDecimals ) ) ;
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
}
2014-12-03 23:15:26 +00:00
if ( aligny )
{
2020-05-21 12:20:02 +00:00
double offset ;
2019-04-14 16:24:37 +00:00
if ( ! texture . WorldPanning & & ! General . Map . Data . MapInfo . ForceWorldPanning )
2020-01-02 00:32:55 +00:00
offset = ( ( start . Sidedef . Sector . CeilHeight - j . ceilingHeight ) / scaley ) * Math . Abs ( j . scaleY ) + ystartalign - j . sidedef . OffsetY ; //mxd
2019-04-14 16:24:37 +00:00
else
offset = ( start . Sidedef . Sector . CeilHeight - j . ceilingHeight + ystartalign - j . sidedef . OffsetY ) ;
if ( matchtop )
2016-09-02 19:18:37 +00:00
{
ImageData tex = General . Map . Data . GetTextureImage ( j . sidedef . LongHighTexture ) ;
int texheight = ( tex ! = null & & tex . IsImageLoaded ) ? tex . Height : 1 ;
2020-05-21 12:20:02 +00:00
double scale = ! worldpanning ? j . scaleY / scaley : 1.0f ;
2019-04-14 16:24:37 +00:00
j . sidedef . Fields [ "offsety_top" ] = new UniValue ( UniversalType . Float ,
2020-05-22 19:39:18 +00:00
Math . Round ( Tools . GetSidedefTopOffsetY ( j . sidedef , offset , scale , true ) % vheight , General . Map . FormatInterface . VertexDecimals ) ) ; //mxd
2019-04-14 16:24:37 +00:00
2016-09-02 19:18:37 +00:00
}
2019-04-14 16:24:37 +00:00
if ( matchbottom )
2016-09-02 19:18:37 +00:00
{
ImageData tex = General . Map . Data . GetTextureImage ( j . sidedef . LongLowTexture ) ;
int texheight = ( tex ! = null & & tex . IsImageLoaded ) ? tex . Height : 1 ;
2020-05-21 12:20:02 +00:00
double scale = ! worldpanning ? j . scaleY / scaley : 1.0f ;
2019-04-14 16:24:37 +00:00
2016-09-02 19:18:37 +00:00
j . sidedef . Fields [ "offsety_bottom" ] = new UniValue ( UniversalType . Float ,
2020-05-22 19:39:18 +00:00
Math . Round ( Tools . GetSidedefBottomOffsetY ( j . sidedef , offset , scale , true ) % vheight , General . Map . FormatInterface . VertexDecimals ) ) ; //mxd
2016-09-02 19:18:37 +00:00
}
2014-12-03 23:15:26 +00:00
if ( matchmid )
{
2013-03-18 13:52:27 +00:00
//mxd. Side is part of a 3D floor?
2014-12-03 23:15:26 +00:00
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 ;
2020-05-22 19:39:18 +00:00
offset - = j . controlSide . Fields . GetValue ( "offsety_mid" , 0.0 ) ;
2016-09-02 19:18:37 +00:00
ImageData tex = General . Map . Data . GetTextureImage ( j . controlSide . LongMiddleTexture ) ;
int texheight = ( tex ! = null & & tex . IsImageLoaded ) ? tex . Height : 1 ;
j . sidedef . Fields [ "offsety_mid" ] = new UniValue ( UniversalType . Float ,
2020-05-22 19:39:18 +00:00
Math . Round ( offset % vheight , General . Map . FormatInterface . VertexDecimals ) ) ;
2014-12-03 23:15:26 +00:00
}
2015-01-20 07:58:47 +00:00
else
2014-12-03 23:15:26 +00:00
{
2016-09-02 19:18:37 +00:00
ImageData tex = General . Map . Data . GetTextureImage ( j . sidedef . LongMiddleTexture ) ;
2020-05-21 12:20:02 +00:00
double scale = ! worldpanning ? j . scaleY / scaley : 1.0f ;
2019-04-14 16:24:37 +00:00
offset = Tools . GetSidedefMiddleOffsetY ( j . sidedef , offset , scale , true ) ;
2013-11-06 13:07:48 +00:00
2019-04-14 16:24:37 +00:00
if ( tex ! = null & & tex . IsImageLoaded )
2014-12-03 23:15:26 +00:00
{
2016-09-02 19:18:37 +00:00
bool startisnonwrappedmidtex = ( start . Sidedef . Other ! = null & & start . GeometryType = = VisualGeometryType . WALL_MIDDLE & & ! start . Sidedef . IsFlagSet ( "wrapmidtex" ) & & ! start . Sidedef . Line . IsFlagSet ( "wrapmidtex" ) ) ;
bool cursideisnonwrappedmidtex = ( j . sidedef . Other ! = null & & ! j . sidedef . IsFlagSet ( "wrapmidtex" ) & & ! j . sidedef . Line . IsFlagSet ( "wrapmidtex" ) ) ;
//mxd. Only clamp when the texture is wrapped
2019-04-14 16:24:37 +00:00
if ( ! cursideisnonwrappedmidtex ) offset % = vheight ;
2014-12-22 21:36:49 +00:00
2016-09-02 19:18:37 +00:00
if ( ! startisnonwrappedmidtex & & cursideisnonwrappedmidtex )
2014-12-22 21:36:49 +00:00
{
2016-09-02 19:18:37 +00:00
//mxd. This should be doublesided non-wrapped line. Find the nearset aligned position
2020-05-21 12:20:02 +00:00
double curoffset = UniFields . GetFloat ( j . sidedef . Fields , "offsety_mid" ) + j . sidedef . OffsetY ;
2020-05-22 19:39:18 +00:00
offset + = vheight * Math . Round ( curoffset / vheight - 0.5f * Math . Sign ( j . scaleY ) ) ;
2016-09-02 19:18:37 +00:00
// Make sure the surface stays between floor and ceiling
if ( j . sidedef . Line . IsFlagSet ( General . Map . Config . LowerUnpeggedFlag ) | | Math . Sign ( j . scaleY ) = = - 1 )
{
2019-04-14 16:24:37 +00:00
if ( offset < - vheight )
offset + = vheight ;
2016-09-02 19:18:37 +00:00
else if ( offset > j . sidedef . GetMiddleHeight ( ) )
2019-04-14 16:24:37 +00:00
offset - = vheight ;
2016-09-02 19:18:37 +00:00
}
else
{
2019-04-14 16:24:37 +00:00
if ( offset < - ( j . sidedef . GetMiddleHeight ( ) + vheight ) )
offset + = vheight ;
else if ( offset > vheight )
offset - = vheight ;
2016-09-02 19:18:37 +00:00
}
2014-12-22 21:36:49 +00:00
}
2013-11-06 13:07:48 +00:00
}
2016-09-02 19:18:37 +00:00
j . sidedef . Fields [ "offsety_mid" ] = new UniValue ( UniversalType . Float ,
2020-05-22 20:30:32 +00:00
Math . Round ( offset , General . Map . FormatInterface . VertexDecimals ) ) ; //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
backwardoffset = j . offsetx ;
2020-04-02 20:46:40 +00:00
if ( ! worldpanning )
{
// If the texture gets replaced with a "hires" texture it adds more fuckery
if ( texture is HiResImage )
2020-05-22 20:30:32 +00:00
forwardoffset = j . offsetx + Math . Round ( ( Math . Round ( j . sidedef . Line . Length ) / scalex ) % vwidth , General . Map . FormatInterface . VertexDecimals ) ;
2020-04-02 20:46:40 +00:00
else
2020-05-22 20:30:32 +00:00
forwardoffset = j . offsetx + Math . Round ( ( Math . Round ( j . sidedef . Line . Length ) / scalex * Math . Abs ( first . scaleX ) ) % vwidth , General . Map . FormatInterface . VertexDecimals ) ;
2020-04-02 20:46:40 +00:00
}
2019-04-14 16:24:37 +00:00
else
2020-05-22 20:30:32 +00:00
forwardoffset = Math . Round ( ( j . offsetx + Math . Round ( j . sidedef . Line . Length ) ) % vwidth , General . Map . FormatInterface . VertexDecimals ) ;
2019-04-14 16:24:37 +00:00
2013-03-18 13:52:27 +00:00
// 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 ;
Sectors, Linedefs, Things modes: optimized text label rendering.
Fixed, Things mode: in some cases selection labels were not updated after editing a thing.
Fixed, Things mode: selection labels were positioned incorrectly on things with FixedSize setting.
Fixed, Sectors mode: fixed a crash when selecting self-referencing sector when selection labels were enabled.
Fixed, Visual mode: in some cases Auto-align texture actions were not working when "use long texture names" Map Options setting was enabled.
Fixed, MD2/MD3 loader: available animation frames upper bound check was performed incorrectly, which would cause a crash in some very special cases.
Fixed, Game configurations: most Hexen/ZDoom teleport actions use TeleportDests as teleport targets, not MapSpots.
2016-04-05 22:24:36 +00:00
AddSidedefsForAlignment ( todo , v , false , backwardoffset , j . scaleY , texturehashes , 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 ;
Sectors, Linedefs, Things modes: optimized text label rendering.
Fixed, Things mode: in some cases selection labels were not updated after editing a thing.
Fixed, Things mode: selection labels were positioned incorrectly on things with FixedSize setting.
Fixed, Sectors mode: fixed a crash when selecting self-referencing sector when selection labels were enabled.
Fixed, Visual mode: in some cases Auto-align texture actions were not working when "use long texture names" Map Options setting was enabled.
Fixed, MD2/MD3 loader: available animation frames upper bound check was performed incorrectly, which would cause a crash in some very special cases.
Fixed, Game configurations: most Hexen/ZDoom teleport actions use TeleportDests as teleport targets, not MapSpots.
2016-04-05 22:24:36 +00:00
AddSidedefsForAlignment ( todo , v , true , forwardoffset , j . scaleY , texturehashes , true ) ;
2014-12-03 23:15:26 +00:00
}
2019-04-14 16:24:37 +00:00
else // backward
2014-12-03 23:15:26 +00:00
{
2013-03-18 13:52:27 +00:00
// Apply alignment
2014-12-03 23:15:26 +00:00
if ( alignx )
{
2020-05-22 19:39:18 +00:00
double offset ;
2019-04-14 16:24:37 +00:00
if ( ! worldpanning )
2020-04-02 20:46:40 +00:00
{
// If the texture gets replaced with a "hires" texture it adds more fuckery
if ( texture is HiResImage )
2020-05-22 20:30:32 +00:00
offset = Math . Round ( ( j . offsetx - j . sidedef . OffsetX - Math . Round ( j . sidedef . Line . Length ) / scalex ) % vwidth , General . Map . FormatInterface . VertexDecimals ) ;
2020-04-02 20:46:40 +00:00
else
2020-05-22 20:30:32 +00:00
offset = Math . Round ( ( j . offsetx - j . sidedef . OffsetX - Math . Round ( j . sidedef . Line . Length ) / scalex * first . scaleX ) % vwidth , General . Map . FormatInterface . VertexDecimals ) ;
2020-04-02 20:46:40 +00:00
}
2019-04-14 16:24:37 +00:00
else
2020-05-22 20:30:32 +00:00
offset = Math . Round ( ( j . offsetx - j . sidedef . OffsetX - Math . Round ( j . sidedef . Line . Length ) ) % vwidth , General . Map . FormatInterface . VertexDecimals ) ;
2013-03-18 13:52:27 +00:00
if ( matchtop )
2016-09-02 19:18:37 +00:00
{
ImageData tex = General . Map . Data . GetTextureImage ( j . sidedef . LongHighTexture ) ;
int texwidth = ( tex ! = null & & tex . IsImageLoaded ) ? tex . Width : 1 ;
j . sidedef . Fields [ "offsetx_top" ] = new UniValue ( UniversalType . Float ,
2020-05-22 19:39:18 +00:00
Math . Round ( offset % vwidth , General . Map . FormatInterface . VertexDecimals ) ) ;
2016-09-02 19:18:37 +00:00
}
2013-03-18 13:52:27 +00:00
if ( matchbottom )
2016-09-02 19:18:37 +00:00
{
ImageData tex = General . Map . Data . GetTextureImage ( j . sidedef . LongLowTexture ) ;
int texwidth = ( tex ! = null & & tex . IsImageLoaded ) ? tex . Width : 1 ;
j . sidedef . Fields [ "offsetx_bottom" ] = new UniValue ( UniversalType . Float ,
2020-05-22 19:39:18 +00:00
Math . Round ( offset % vwidth , General . Map . FormatInterface . VertexDecimals ) ) ;
2016-09-02 19:18:37 +00:00
}
2014-12-03 23:15:26 +00:00
if ( matchmid )
{
if ( j . sidedef . Index ! = j . controlSide . Index ) //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
offset - = j . controlSide . OffsetX ;
2020-05-22 19:39:18 +00:00
offset - = j . controlSide . Fields . GetValue ( "offsetx_mid" , 0.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
}
2016-09-02 19:18:37 +00:00
ImageData tex = General . Map . Data . GetTextureImage ( j . controlSide . LongMiddleTexture ) ;
int texwidth = ( tex ! = null & & tex . IsImageLoaded ) ? tex . Width : 1 ;
j . sidedef . Fields [ "offsetx_mid" ] = new UniValue ( UniversalType . Float ,
2020-05-22 19:39:18 +00:00
Math . Round ( offset % vwidth , General . Map . FormatInterface . VertexDecimals ) ) ;
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
}
2015-04-16 13:03:12 +00:00
2014-12-03 23:15:26 +00:00
if ( aligny )
{
2020-05-21 12:20:02 +00:00
double offset = ( ( start . Sidedef . Sector . CeilHeight - j . ceilingHeight ) / scaley ) * Math . Abs ( j . scaleY ) + ystartalign ; //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
offset - = j . sidedef . OffsetY ; //mxd
2013-03-18 13:52:27 +00:00
if ( matchtop )
2016-09-02 19:18:37 +00:00
{
ImageData tex = General . Map . Data . GetTextureImage ( j . sidedef . LongHighTexture ) ;
int texheight = ( tex ! = null & & tex . IsImageLoaded ) ? tex . Height : 1 ;
2020-05-21 12:20:02 +00:00
double scale = ! worldpanning ? j . scaleY / scaley : 1.0f ;
2019-04-14 16:24:37 +00:00
2016-09-02 19:18:37 +00:00
j . sidedef . Fields [ "offsety_top" ] = new UniValue ( UniversalType . Float ,
2020-05-21 12:20:02 +00:00
Math . Round ( Tools . GetSidedefTopOffsetY ( j . sidedef , offset , scale , true ) % vheight , General . Map . FormatInterface . VertexDecimals ) ) ; //mxd
2016-09-02 19:18:37 +00:00
}
2013-03-18 13:52:27 +00:00
if ( matchbottom )
2016-09-02 19:18:37 +00:00
{
ImageData tex = General . Map . Data . GetTextureImage ( j . sidedef . LongLowTexture ) ;
int texheight = ( tex ! = null & & tex . IsImageLoaded ) ? tex . Height : 1 ;
2020-05-21 12:20:02 +00:00
double scale = ! worldpanning ? j . scaleY / scaley : 1.0f ;
2019-04-14 16:24:37 +00:00
2016-09-02 19:18:37 +00:00
j . sidedef . Fields [ "offsety_bottom" ] = new UniValue ( UniversalType . Float ,
2020-05-21 12:20:02 +00:00
Math . Round ( Tools . GetSidedefBottomOffsetY ( j . sidedef , offset , scale , true ) % vheight , General . Map . FormatInterface . VertexDecimals ) ) ; //mxd
2016-09-02 19:18:37 +00:00
}
2014-12-03 23:15:26 +00:00
if ( matchmid )
{
2013-03-18 13:52:27 +00:00
//mxd. Side is part of a 3D floor?
2014-12-03 23:15:26 +00:00
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 ;
2020-05-22 19:39:18 +00:00
offset - = j . controlSide . Fields . GetValue ( "offsety_mid" , 0.0 ) ;
2016-09-02 19:18:37 +00:00
ImageData tex = General . Map . Data . GetTextureImage ( j . controlSide . LongMiddleTexture ) ;
int texheight = ( tex ! = null & & tex . IsImageLoaded ) ? tex . Height : 1 ;
j . sidedef . Fields [ "offsety_mid" ] = new UniValue ( UniversalType . Float ,
2020-05-21 12:20:02 +00:00
Math . Round ( offset % vheight , General . Map . FormatInterface . VertexDecimals ) ) ; //mxd
2014-12-03 23:15:26 +00:00
}
else
{
2016-09-02 19:18:37 +00:00
ImageData tex = General . Map . Data . GetTextureImage ( j . sidedef . LongMiddleTexture ) ;
2020-05-22 20:30:32 +00:00
double scale = ! worldpanning ? j . scaleY / scaley : 1.0 ;
2019-04-14 16:24:37 +00:00
offset = Tools . GetSidedefMiddleOffsetY ( j . sidedef , offset , scale , true ) ;
Fixed, Texture previews: texture size labels were displaying incorrect size or no size at all when showing TEXTURES textures with negative scale.
Fixed, Visual mode, UDMF: when several wall parts were selected, only one could be dragged with the mouse.
Fixed, Visual mode, Auto-align textures, UDMF: TEXTURES scale is now taken into account when aligning textures.
Fixed, Visual mode, Auto-align textures (Y), UDMF: nearest height matching is now applied to non-wrapped middle backsides.
Cosmetic changes in ZDoom_ACS.cfg.
2015-01-27 11:40:25 +00:00
2016-09-02 19:18:37 +00:00
if ( tex ! = null & & tex . IsImageLoaded )
Fixed, Texture previews: texture size labels were displaying incorrect size or no size at all when showing TEXTURES textures with negative scale.
Fixed, Visual mode, UDMF: when several wall parts were selected, only one could be dragged with the mouse.
Fixed, Visual mode, Auto-align textures, UDMF: TEXTURES scale is now taken into account when aligning textures.
Fixed, Visual mode, Auto-align textures (Y), UDMF: nearest height matching is now applied to non-wrapped middle backsides.
Cosmetic changes in ZDoom_ACS.cfg.
2015-01-27 11:40:25 +00:00
{
2016-09-02 19:18:37 +00:00
bool startisnonwrappedmidtex = ( start . Sidedef . Other ! = null & & start . GeometryType = = VisualGeometryType . WALL_MIDDLE & & ! start . Sidedef . IsFlagSet ( "wrapmidtex" ) & & ! start . Sidedef . Line . IsFlagSet ( "wrapmidtex" ) ) ;
bool cursideisnonwrappedmidtex = ( j . sidedef . Other ! = null & & ! j . sidedef . IsFlagSet ( "wrapmidtex" ) & & ! j . sidedef . Line . IsFlagSet ( "wrapmidtex" ) ) ;
//mxd. Only clamp when the texture is wrapped
2019-04-14 16:24:37 +00:00
if ( ! cursideisnonwrappedmidtex ) offset % = vheight ;
Fixed, Texture previews: texture size labels were displaying incorrect size or no size at all when showing TEXTURES textures with negative scale.
Fixed, Visual mode, UDMF: when several wall parts were selected, only one could be dragged with the mouse.
Fixed, Visual mode, Auto-align textures, UDMF: TEXTURES scale is now taken into account when aligning textures.
Fixed, Visual mode, Auto-align textures (Y), UDMF: nearest height matching is now applied to non-wrapped middle backsides.
Cosmetic changes in ZDoom_ACS.cfg.
2015-01-27 11:40:25 +00:00
2016-09-02 19:18:37 +00:00
if ( ! startisnonwrappedmidtex & & cursideisnonwrappedmidtex )
Fixed, Texture previews: texture size labels were displaying incorrect size or no size at all when showing TEXTURES textures with negative scale.
Fixed, Visual mode, UDMF: when several wall parts were selected, only one could be dragged with the mouse.
Fixed, Visual mode, Auto-align textures, UDMF: TEXTURES scale is now taken into account when aligning textures.
Fixed, Visual mode, Auto-align textures (Y), UDMF: nearest height matching is now applied to non-wrapped middle backsides.
Cosmetic changes in ZDoom_ACS.cfg.
2015-01-27 11:40:25 +00:00
{
2016-09-02 19:18:37 +00:00
//mxd. This should be doublesided non-wrapped line. Find the nearset aligned position
2020-05-21 12:20:02 +00:00
double curoffset = UniFields . GetFloat ( j . sidedef . Fields , "offsety_mid" ) + j . sidedef . OffsetY ;
offset + = tex . Height * Math . Round ( curoffset / vheight - 0.5f * Math . Sign ( j . scaleY ) ) ;
2016-09-02 19:18:37 +00:00
// Make sure the surface stays between floor and ceiling
if ( j . sidedef . Line . IsFlagSet ( General . Map . Config . LowerUnpeggedFlag ) | | Math . Sign ( j . scaleY ) = = - 1 )
{
2019-04-14 16:24:37 +00:00
if ( offset < - vheight )
offset + = vheight ;
2016-09-02 19:18:37 +00:00
else if ( offset > j . sidedef . GetMiddleHeight ( ) )
2019-04-14 16:24:37 +00:00
offset - = vheight ;
2016-09-02 19:18:37 +00:00
}
else
{
2019-04-14 16:24:37 +00:00
if ( offset < - ( j . sidedef . GetMiddleHeight ( ) + vheight ) )
offset + = vheight ;
else if ( offset > vheight )
offset - = vheight ;
2016-09-02 19:18:37 +00:00
}
Fixed, Texture previews: texture size labels were displaying incorrect size or no size at all when showing TEXTURES textures with negative scale.
Fixed, Visual mode, UDMF: when several wall parts were selected, only one could be dragged with the mouse.
Fixed, Visual mode, Auto-align textures, UDMF: TEXTURES scale is now taken into account when aligning textures.
Fixed, Visual mode, Auto-align textures (Y), UDMF: nearest height matching is now applied to non-wrapped middle backsides.
Cosmetic changes in ZDoom_ACS.cfg.
2015-01-27 11:40:25 +00:00
}
}
2016-09-02 19:18:37 +00:00
j . sidedef . Fields [ "offsety_mid" ] = new UniValue ( UniversalType . Float ,
2020-05-21 12:20:02 +00:00
Math . Round ( offset , General . Map . FormatInterface . VertexDecimals ) ) ; //mxd
2013-03-18 13:52:27 +00:00
}
}
}
2015-04-16 13:03:12 +00:00
2013-03-18 13:52:27 +00:00
forwardoffset = j . offsetx ;
2019-04-14 16:24:37 +00:00
if ( ! worldpanning )
2020-04-02 20:46:40 +00:00
{
// If the texture gets replaced with a "hires" texture it adds more fuckery
if ( texture is HiResImage )
2020-05-22 20:30:32 +00:00
backwardoffset = Math . Round ( ( j . offsetx - Math . Round ( j . sidedef . Line . Length ) / scalex ) % vwidth , General . Map . FormatInterface . VertexDecimals ) ;
2020-04-02 20:46:40 +00:00
else
2020-05-22 20:30:32 +00:00
backwardoffset = Math . Round ( ( j . offsetx - Math . Round ( j . sidedef . Line . Length ) / scalex * Math . Abs ( first . scaleX ) ) % vwidth , General . Map . FormatInterface . VertexDecimals ) ;
2020-04-02 20:46:40 +00:00
}
2019-04-14 16:24:37 +00:00
else
2020-05-22 20:30:32 +00:00
backwardoffset = Math . Round ( ( j . offsetx - Math . Round ( j . sidedef . Line . Length ) ) % vwidth , General . Map . FormatInterface . VertexDecimals ) ;
2013-03-18 13:52:27 +00:00
// 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 ;
Sectors, Linedefs, Things modes: optimized text label rendering.
Fixed, Things mode: in some cases selection labels were not updated after editing a thing.
Fixed, Things mode: selection labels were positioned incorrectly on things with FixedSize setting.
Fixed, Sectors mode: fixed a crash when selecting self-referencing sector when selection labels were enabled.
Fixed, Visual mode: in some cases Auto-align texture actions were not working when "use long texture names" Map Options setting was enabled.
Fixed, MD2/MD3 loader: available animation frames upper bound check was performed incorrectly, which would cause a crash in some very special cases.
Fixed, Game configurations: most Hexen/ZDoom teleport actions use TeleportDests as teleport targets, not MapSpots.
2016-04-05 22:24:36 +00:00
AddSidedefsForAlignment ( todo , v , true , forwardoffset , j . scaleY , texturehashes , 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 ;
Sectors, Linedefs, Things modes: optimized text label rendering.
Fixed, Things mode: in some cases selection labels were not updated after editing a thing.
Fixed, Things mode: selection labels were positioned incorrectly on things with FixedSize setting.
Fixed, Sectors mode: fixed a crash when selecting self-referencing sector when selection labels were enabled.
Fixed, Visual mode: in some cases Auto-align texture actions were not working when "use long texture names" Map Options setting was enabled.
Fixed, MD2/MD3 loader: available animation frames upper bound check was performed incorrectly, which would cause a crash in some very special cases.
Fixed, Game configurations: most Hexen/ZDoom teleport actions use TeleportDests as teleport targets, not MapSpots.
2016-04-05 22:24:36 +00:00
AddSidedefsForAlignment ( todo , v , false , backwardoffset , j . scaleY , texturehashes , true ) ;
2013-03-18 13:52:27 +00:00
}
}
}
// This adds the matching, unmarked sidedefs from a vertex for texture alignment
2020-05-21 12:20:02 +00:00
private void AddSidedefsForAlignment ( Stack < SidedefAlignJob > stack , Vertex v , bool forward , double offsetx , double scaleY , HashSet < long > texturelongnames , bool udmf )
2014-12-03 23:15:26 +00:00
{
2017-01-26 13:33:07 +00:00
foreach ( Linedef ld in v . Linedefs )
2014-12-03 23:15:26 +00:00
{
2013-03-18 13:52:27 +00:00
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
2017-01-26 13:33:07 +00:00
// [ZZ] I don't know what logic here is.
// I'm going to check if any side is marked, and if so, don't add.
if ( ( side1 ! = null & & side1 . Marked ) | |
( side2 ! = null & & side2 . Marked ) ) continue ;
2014-12-03 23:15:26 +00:00
if ( ( ld . Start = = v ) & & ( side1 ! = null ) & & ! side1 . Marked )
{
2015-01-20 07:58:47 +00:00
List < Sidedef > controlSides = GetControlSides ( side1 , udmf ) ; //mxd
2013-03-18 13:52:27 +00:00
2019-04-14 16:24:37 +00:00
foreach ( Sidedef s in controlSides )
2014-12-03 23:15:26 +00:00
{
2016-05-12 11:32:10 +00:00
if ( ! singleselection | | BuilderModesTools . SidedefTextureMatch ( this , s , texturelongnames ) )
2014-12-03 23:15:26 +00:00
{
2013-03-18 13:52:27 +00:00
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 ) ;
}
}
2014-12-03 23:15:26 +00:00
}
else if ( ( ld . End = = v ) & & ( side2 ! = null ) & & ! side2 . Marked )
{
2015-01-20 07:58:47 +00:00
List < Sidedef > controlSides = GetControlSides ( side2 , udmf ) ; //mxd
2013-03-18 13:52:27 +00:00
2014-12-03 23:15:26 +00:00
foreach ( Sidedef s in controlSides )
{
2016-05-12 11:32:10 +00:00
if ( ! singleselection | | BuilderModesTools . SidedefTextureMatch ( this , s , texturelongnames ) )
2014-12-03 23:15:26 +00:00
{
2013-03-18 13:52:27 +00:00
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
2014-12-03 23:15:26 +00:00
private static bool SidePartIsSelected ( List < BaseVisualGeometrySidedef > selection , Sidedef side , VisualGeometryType geoType )
2014-05-20 09:09:28 +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 ( BaseVisualGeometrySidedef vs in selection )
if ( vs . GeometryType = = geoType & & vs . Sidedef . Index = = side . Index ) return true ;
return false ;
}
2013-03-18 13:52:27 +00:00
//mxd
2014-12-03 23:15:26 +00:00
private List < Sidedef > GetControlSides ( Sidedef side , bool udmf )
{
2016-04-19 20:40:42 +00:00
if ( side . Other = = null ) return new List < Sidedef > { side } ;
if ( side . Other . Sector . Tag = = 0 ) return new List < Sidedef > { side } ;
2013-03-18 13:52:27 +00:00
2016-04-19 20:40:42 +00:00
SectorData data = GetSectorDataEx ( side . Other . Sector ) ;
if ( data = = null | | data . ExtraFloors . Count = = 0 ) return new List < Sidedef > { side } ;
2013-03-18 13:52:27 +00:00
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
}
}