2014-09-15 14:12:31 +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 ;
using System.Drawing ;
using System.Windows.Forms ;
using CodeImp.DoomBuilder.Config ;
2016-04-27 09:13:07 +00:00
using CodeImp.DoomBuilder.Controls ;
2015-07-27 09:02:28 +00:00
using CodeImp.DoomBuilder.Map ;
using CodeImp.DoomBuilder.Types ;
2014-09-15 14:12:31 +00:00
#endregion
namespace CodeImp.DoomBuilder.Windows
{
internal partial class LinedefEditFormUDMF : DelayedForm
{
#region = = = = = = = = = = = = = = = = = = Events
public event EventHandler OnValuesChanged ; //mxd
#endregion
#region = = = = = = = = = = = = = = = = = = Variables
private ICollection < Linedef > lines ;
2015-01-26 08:53:05 +00:00
private List < LinedefProperties > linedefprops ; //mxd
2014-09-15 14:12:31 +00:00
private bool preventchanges ;
2015-01-26 08:53:05 +00:00
private bool undocreated ; //mxd
2014-09-15 14:12:31 +00:00
private readonly string [ ] renderstyles ; //mxd
2014-11-15 20:25:16 +00:00
private readonly List < int > keynumbers ; //mxd
2014-09-15 14:12:31 +00:00
private readonly List < PairedFieldsControl > frontUdmfControls ; //mxd
private readonly List < PairedFieldsControl > backUdmfControls ; //mxd
private struct LinedefProperties //mxd
{
public readonly Dictionary < string , bool > Flags ;
public readonly float Alpha ;
public readonly SidedefProperties Front ;
public readonly SidedefProperties Back ;
public LinedefProperties ( Linedef line )
{
Front = ( line . Front ! = null ? new SidedefProperties ( line . Front ) : null ) ;
Back = ( line . Back ! = null ? new SidedefProperties ( line . Back ) : null ) ;
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
Alpha = UniFields . GetFloat ( line . Fields , "alpha" , 1.0f ) ;
2014-09-15 14:12:31 +00:00
Flags = line . GetFlags ( ) ;
}
}
private class SidedefProperties //mxd
{
public readonly Dictionary < string , bool > Flags ;
public readonly float ScaleTopX ;
public readonly float ScaleTopY ;
public readonly float ScaleMidX ;
public readonly float ScaleMidY ;
public readonly float ScaleBottomX ;
public readonly float ScaleBottomY ;
public readonly int OffsetX ;
public readonly int OffsetY ;
public readonly float OffsetTopX ;
public readonly float OffsetTopY ;
public readonly float OffsetMidX ;
public readonly float OffsetMidY ;
public readonly float OffsetBottomX ;
public readonly float OffsetBottomY ;
public readonly int Brightness ;
public readonly bool AbsoluteBrightness ;
2016-02-26 12:46:17 +00:00
public readonly string HighTexture ;
public readonly string MiddleTexture ;
public readonly string LowTexture ;
2014-09-15 14:12:31 +00:00
public SidedefProperties ( Sidedef side )
{
Flags = side . GetFlags ( ) ;
2016-02-26 12:46:17 +00:00
// Offset
2014-09-15 14:12:31 +00:00
OffsetX = side . OffsetX ;
OffsetY = side . OffsetY ;
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
Brightness = UniFields . GetInteger ( side . Fields , "light" , 0 ) ;
2014-09-15 14:12:31 +00:00
AbsoluteBrightness = side . Fields . GetValue ( "lightabsolute" , false ) ;
2016-02-26 12:46:17 +00:00
// Scale
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
ScaleTopX = UniFields . GetFloat ( side . Fields , "scalex_top" , 1.0f ) ;
ScaleTopY = UniFields . GetFloat ( side . Fields , "scaley_top" , 1.0f ) ;
ScaleMidX = UniFields . GetFloat ( side . Fields , "scalex_mid" , 1.0f ) ;
ScaleMidY = UniFields . GetFloat ( side . Fields , "scaley_mid" , 1.0f ) ;
ScaleBottomX = UniFields . GetFloat ( side . Fields , "scalex_bottom" , 1.0f ) ;
ScaleBottomY = UniFields . GetFloat ( side . Fields , "scaley_bottom" , 1.0f ) ;
2014-09-15 14:12:31 +00:00
2016-02-26 12:46:17 +00:00
// Local offsets
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
OffsetTopX = UniFields . GetFloat ( side . Fields , "offsetx_top" , 0f ) ;
OffsetTopY = UniFields . GetFloat ( side . Fields , "offsety_top" , 0f ) ;
OffsetMidX = UniFields . GetFloat ( side . Fields , "offsetx_mid" , 0f ) ;
OffsetMidY = UniFields . GetFloat ( side . Fields , "offsety_mid" , 0f ) ;
OffsetBottomX = UniFields . GetFloat ( side . Fields , "offsetx_bottom" , 0f ) ;
OffsetBottomY = UniFields . GetFloat ( side . Fields , "offsety_bottom" , 0f ) ;
2014-09-15 14:12:31 +00:00
2016-02-26 12:46:17 +00:00
// Textures
HighTexture = side . HighTexture ;
MiddleTexture = side . MiddleTexture ;
LowTexture = side . LowTexture ;
2014-09-15 14:12:31 +00:00
}
}
#endregion
#region = = = = = = = = = = = = = = = = = = Constructor
2017-02-07 04:53:00 +00:00
public LinedefEditFormUDMF ( )
2014-09-15 14:12:31 +00:00
{
// Initialize
InitializeComponent ( ) ;
// Fill flags lists
foreach ( KeyValuePair < string , string > lf in General . Map . Config . LinedefFlags )
flags . Add ( lf . Value , lf . Key ) ;
2014-12-04 10:06:44 +00:00
flags . Enabled = General . Map . Config . LinedefFlags . Count > 0 ;
2014-09-15 14:12:31 +00:00
2016-02-26 12:46:17 +00:00
// Fill sidedef flags lists
2014-09-15 14:12:31 +00:00
foreach ( KeyValuePair < string , string > lf in General . Map . Config . SidedefFlags )
{
flagsFront . Add ( lf . Value , lf . Key ) ;
flagsBack . Add ( lf . Value , lf . Key ) ;
}
2014-12-04 10:06:44 +00:00
flagsFront . Enabled = General . Map . Config . SidedefFlags . Count > 0 ;
flagsBack . Enabled = General . Map . Config . SidedefFlags . Count > 0 ;
2014-09-15 14:12:31 +00:00
// Fill actions list
action . AddInfo ( General . Map . Config . SortedLinedefActions . ToArray ( ) ) ;
// Fill activations list
foreach ( LinedefActivateInfo ai in General . Map . Config . LinedefActivates ) udmfactivates . Add ( ai . Title , ai ) ;
2014-11-15 20:25:16 +00:00
2016-02-26 12:46:17 +00:00
// Fill keys list
2014-11-15 20:25:16 +00:00
keynumbers = new List < int > ( ) ;
2015-12-28 15:01:53 +00:00
if ( General . Map . Config . Enums . ContainsKey ( "keys" ) )
2014-11-15 20:25:16 +00:00
{
2015-12-28 15:01:53 +00:00
foreach ( EnumItem item in General . Map . Config . Enums [ "keys" ] )
2014-11-15 20:25:16 +00:00
{
keynumbers . Add ( item . GetIntValue ( ) ) ;
lockpick . Items . Add ( item ) ;
}
}
2014-12-04 10:06:44 +00:00
lockpick . Enabled = ( keynumbers . Count > 0 ) ;
labellockpick . Enabled = ( keynumbers . Count > 0 ) ;
2014-09-15 14:12:31 +00:00
// Initialize image selectors
fronthigh . Initialize ( ) ;
frontmid . Initialize ( ) ;
frontlow . Initialize ( ) ;
backhigh . Initialize ( ) ;
backmid . Initialize ( ) ;
backlow . Initialize ( ) ;
2014-12-04 10:06:44 +00:00
// Initialize custom fields editor
fieldslist . Setup ( "linedef" ) ;
// Fill universal fields list
fieldslist . ListFixedFields ( General . Map . Config . LinedefFields ) ;
2016-02-26 12:46:17 +00:00
// Initialize controls
2014-12-04 10:06:44 +00:00
frontUdmfControls = new List < PairedFieldsControl > { pfcFrontOffsetTop , pfcFrontOffsetMid , pfcFrontOffsetBottom , pfcFrontScaleTop , pfcFrontScaleMid , pfcFrontScaleBottom } ;
backUdmfControls = new List < PairedFieldsControl > { pfcBackOffsetTop , pfcBackOffsetMid , pfcBackOffsetBottom , pfcBackScaleTop , pfcBackScaleMid , pfcBackScaleBottom } ;
// Setup renderstyles
renderstyles = new string [ General . Map . Config . LinedefRenderStyles . Count ] ;
General . Map . Config . LinedefRenderStyles . Keys . CopyTo ( renderstyles , 0 ) ;
renderStyle . Enabled = ( General . Map . Config . LinedefRenderStyles . Count > 0 ) ;
labelrenderstyle . Enabled = ( General . Map . Config . LinedefRenderStyles . Count > 0 ) ;
// Fill renderstyles
foreach ( KeyValuePair < string , string > lf in General . Map . Config . LinedefRenderStyles )
renderStyle . Items . Add ( lf . Value ) ;
2016-02-26 12:46:17 +00:00
// Restore value linking
2016-12-02 13:45:03 +00:00
pfcFrontScaleTop . LinkValues = General . Settings . ReadSetting ( "windows." + configname + ".linkfronttopscale" , false ) ;
pfcFrontScaleMid . LinkValues = General . Settings . ReadSetting ( "windows." + configname + ".linkfrontmidscale" , false ) ;
pfcFrontScaleBottom . LinkValues = General . Settings . ReadSetting ( "windows." + configname + ".linkfrontbottomscale" , false ) ;
pfcBackScaleTop . LinkValues = General . Settings . ReadSetting ( "windows." + configname + ".linkbacktopscale" , false ) ;
pfcBackScaleMid . LinkValues = General . Settings . ReadSetting ( "windows." + configname + ".linkbackmidscale" , false ) ;
pfcBackScaleBottom . LinkValues = General . Settings . ReadSetting ( "windows." + configname + ".linkbackbottomscale" , false ) ;
2016-09-05 18:36:22 +00:00
// Disable top/mid/bottom texture offset controls?
if ( ! General . Map . Config . UseLocalSidedefTextureOffsets )
{
pfcFrontOffsetTop . Enabled = false ;
pfcFrontOffsetMid . Enabled = false ;
pfcFrontOffsetBottom . Enabled = false ;
pfcBackOffsetTop . Enabled = false ;
pfcBackOffsetMid . Enabled = false ;
pfcBackOffsetBottom . Enabled = false ;
labelFrontOffsetTop . Enabled = false ;
labelFrontOffsetMid . Enabled = false ;
labelFrontOffsetBottom . Enabled = false ;
labelBackOffsetTop . Enabled = false ;
labelBackOffsetMid . Enabled = false ;
labelBackOffsetBottom . Enabled = false ;
}
2014-09-15 14:12:31 +00:00
}
#endregion
#region = = = = = = = = = = = = = = = = = = Methods
// This sets up the form to edit the given lines
2017-02-07 04:53:00 +00:00
public void Setup ( ICollection < Linedef > lines , bool selectfront , bool selectback )
2014-09-15 14:12:31 +00:00
{
2017-02-07 04:53:00 +00:00
// Window setup
// ano - moved this here because we don't reinstantiate the thing every time anymore
if ( General . Settings . StoreSelectedEditTab )
{
int activetab = General . Settings . ReadSetting ( "windows." + configname + ".activetab" , 0 ) ;
// When front or back tab was previously selected, switch to appropriate side (selectfront/selectback are set in BaseVisualGeometrySidedef.OnEditEnd)
if ( ( selectfront | | selectback ) & & ( activetab = = 1 | | activetab = = 2 ) )
tabs . SelectTab ( selectfront ? 1 : 2 ) ;
else
tabs . SelectTab ( activetab ) ;
}
preventchanges = true ;
2014-09-15 14:12:31 +00:00
// Keep this list
this . lines = lines ;
if ( lines . Count > 1 ) this . Text = "Edit Linedefs (" + lines . Count + ")" ;
2015-01-26 08:53:05 +00:00
linedefprops = new List < LinedefProperties > ( ) ;
2014-09-15 14:12:31 +00:00
////////////////////////////////////////////////////////////////////////
// Set all options to the first linedef properties
////////////////////////////////////////////////////////////////////////
// Get first line
Linedef fl = General . GetByIndex ( lines , 0 ) ;
// Flags
foreach ( CheckBox c in flags . Checkboxes )
if ( fl . Flags . ContainsKey ( c . Tag . ToString ( ) ) ) c . Checked = fl . Flags [ c . Tag . ToString ( ) ] ;
// UDMF Activations
foreach ( CheckBox c in udmfactivates . Checkboxes )
{
LinedefActivateInfo ai = ( c . Tag as LinedefActivateInfo ) ;
if ( fl . Flags . ContainsKey ( ai . Key ) ) c . Checked = fl . Flags [ ai . Key ] ;
}
2014-12-04 10:06:44 +00:00
fieldslist . SetValues ( fl . Fields , true ) ; // Custom fields
2015-07-14 23:34:31 +00:00
commenteditor . SetValues ( fl . Fields , true ) ; //mxd. Comments
2014-12-04 10:06:44 +00:00
renderStyle . SelectedIndex = Array . IndexOf ( renderstyles , fl . Fields . GetValue ( "renderstyle" , "translucent" ) ) ;
alpha . Text = General . Clamp ( fl . Fields . GetValue ( "alpha" , 1.0f ) , 0f , 1f ) . ToString ( ) ;
2014-11-15 20:25:16 +00:00
2014-12-04 10:06:44 +00:00
// Locknumber
int locknumber = fl . Fields . GetValue ( "locknumber" , 0 ) ;
lockpick . SelectedIndex = keynumbers . IndexOf ( locknumber ) ;
if ( lockpick . SelectedIndex = = - 1 ) lockpick . Text = locknumber . ToString ( ) ;
2014-09-15 14:12:31 +00:00
2015-07-27 21:35:42 +00:00
// Action
2014-09-15 14:12:31 +00:00
action . Value = fl . Action ;
2015-07-27 09:02:28 +00:00
//mxd. Args
argscontrol . SetValue ( fl , true ) ;
2014-09-15 14:12:31 +00:00
// Front side and back side checkboxes
frontside . Checked = ( fl . Front ! = null ) ;
backside . Checked = ( fl . Back ! = null ) ;
// Front settings
if ( fl . Front ! = null )
{
fronthigh . TextureName = fl . Front . HighTexture ;
frontmid . TextureName = fl . Front . MiddleTexture ;
frontlow . TextureName = fl . Front . LowTexture ;
fronthigh . Required = fl . Front . HighRequired ( ) ;
frontmid . Required = fl . Front . MiddleRequired ( ) ;
frontlow . Required = fl . Front . LowRequired ( ) ;
frontsector . Text = fl . Front . Sector . Index . ToString ( ) ;
2016-02-26 12:46:17 +00:00
// Flags
2014-12-04 10:06:44 +00:00
foreach ( CheckBox c in flagsFront . Checkboxes )
if ( fl . Front . Flags . ContainsKey ( c . Tag . ToString ( ) ) ) c . Checked = fl . Front . Flags [ c . Tag . ToString ( ) ] ;
2014-09-15 14:12:31 +00:00
2016-02-26 12:46:17 +00:00
// Front settings
2014-12-04 10:06:44 +00:00
foreach ( PairedFieldsControl pfc in frontUdmfControls )
pfc . SetValuesFrom ( fl . Front . Fields , true ) ;
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
lightFront . Text = UniFields . GetInteger ( fl . Front . Fields , "light" , 0 ) . ToString ( ) ;
2014-12-04 10:06:44 +00:00
cbLightAbsoluteFront . Checked = fl . Front . Fields . GetValue ( "lightabsolute" , false ) ;
2014-09-15 14:12:31 +00:00
frontTextureOffset . SetValues ( fl . Front . OffsetX , fl . Front . OffsetY , true ) ; //mxd
}
// Back settings
if ( fl . Back ! = null )
{
backhigh . TextureName = fl . Back . HighTexture ;
backmid . TextureName = fl . Back . MiddleTexture ;
backlow . TextureName = fl . Back . LowTexture ;
backhigh . Required = fl . Back . HighRequired ( ) ;
backmid . Required = fl . Back . MiddleRequired ( ) ;
backlow . Required = fl . Back . LowRequired ( ) ;
backsector . Text = fl . Back . Sector . Index . ToString ( ) ;
2016-02-26 12:46:17 +00:00
// Flags
2014-12-04 10:06:44 +00:00
foreach ( CheckBox c in flagsBack . Checkboxes )
if ( fl . Back . Flags . ContainsKey ( c . Tag . ToString ( ) ) ) c . Checked = fl . Back . Flags [ c . Tag . ToString ( ) ] ;
2014-09-15 14:12:31 +00:00
2016-02-26 12:46:17 +00:00
// Back settings
2014-12-04 10:06:44 +00:00
foreach ( PairedFieldsControl pfc in backUdmfControls )
pfc . SetValuesFrom ( fl . Back . Fields , true ) ;
2014-09-15 14:12:31 +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
lightBack . Text = UniFields . GetInteger ( fl . Back . Fields , "light" , 0 ) . ToString ( ) ;
2014-12-04 10:06:44 +00:00
cbLightAbsoluteBack . Checked = fl . Back . Fields . GetValue ( "lightabsolute" , false ) ;
2014-09-15 14:12:31 +00:00
backTextureOffset . SetValues ( fl . Back . OffsetX , fl . Back . OffsetY , true ) ; //mxd
}
////////////////////////////////////////////////////////////////////////
// Now go for all lines and change the options when a setting is different
////////////////////////////////////////////////////////////////////////
// Go for all lines
foreach ( Linedef l in lines )
{
// Flags
foreach ( CheckBox c in flags . Checkboxes )
{
if ( c . CheckState = = CheckState . Indeterminate ) continue ; //mxd
if ( l . IsFlagSet ( c . Tag . ToString ( ) ) ! = c . Checked )
{
c . ThreeState = true ;
c . CheckState = CheckState . Indeterminate ;
}
}
// UDMF Activations
foreach ( CheckBox c in udmfactivates . Checkboxes )
{
if ( c . CheckState = = CheckState . Indeterminate ) continue ; //mxd
LinedefActivateInfo ai = ( c . Tag as LinedefActivateInfo ) ;
if ( l . IsFlagSet ( ai . Key ) ! = c . Checked )
{
c . ThreeState = true ;
c . CheckState = CheckState . Indeterminate ;
}
}
//mxd. UDMF Settings
2014-12-04 10:06:44 +00:00
// Render style
if ( renderStyle . SelectedIndex > - 1 & & renderStyle . SelectedIndex ! = Array . IndexOf ( renderstyles , l . Fields . GetValue ( "renderstyle" , "translucent" ) ) )
renderStyle . SelectedIndex = - 1 ;
// Alpha
if ( ! string . IsNullOrEmpty ( alpha . Text ) & & General . Clamp ( alpha . GetResultFloat ( 1.0f ) , 0f , 1f ) ! = l . Fields . GetValue ( "alpha" , 1.0f ) )
alpha . Text = string . Empty ;
2014-09-15 14:12:31 +00:00
2014-12-04 10:06:44 +00:00
// Locknumber
if ( ! string . IsNullOrEmpty ( lockpick . Text ) )
{
if ( lockpick . SelectedIndex = = - 1 )
2014-11-15 20:25:16 +00:00
{
2014-12-04 10:06:44 +00:00
if ( int . TryParse ( lockpick . Text , out locknumber ) & & locknumber ! = l . Fields . GetValue ( "locknumber" , 0 ) )
2014-11-15 20:25:16 +00:00
{
lockpick . SelectedIndex = - 1 ;
lockpick . Text = string . Empty ;
}
2014-12-04 10:06:44 +00:00
}
else if ( keynumbers [ lockpick . SelectedIndex ] ! = l . Fields . GetValue ( "locknumber" , 0 ) )
2014-09-15 14:12:31 +00:00
{
2014-12-04 10:06:44 +00:00
lockpick . SelectedIndex = - 1 ;
lockpick . Text = string . Empty ;
2014-09-15 14:12:31 +00:00
}
2014-12-04 10:06:44 +00:00
}
2014-09-15 14:12:31 +00:00
2014-12-04 10:06:44 +00:00
// Custom fields
fieldslist . SetValues ( l . Fields , false ) ;
2015-07-14 23:34:31 +00:00
//mxd. Comments
commenteditor . SetValues ( l . Fields , false ) ;
2016-04-09 23:18:39 +00:00
// Action
2014-09-15 14:12:31 +00:00
if ( l . Action ! = action . Value ) action . Empty = true ;
2015-07-27 09:02:28 +00:00
//mxd. Arguments
argscontrol . SetValue ( l , false ) ;
2014-09-15 14:12:31 +00:00
// Front side checkbox
if ( ( l . Front ! = null ) ! = frontside . Checked )
{
frontside . ThreeState = true ;
frontside . CheckState = CheckState . Indeterminate ;
frontside . AutoCheck = false ;
}
// Back side checkbox
if ( ( l . Back ! = null ) ! = backside . Checked )
{
backside . ThreeState = true ;
backside . CheckState = CheckState . Indeterminate ;
backside . AutoCheck = false ;
}
// Front settings
if ( l . Front ! = null )
{
//mxd
2016-03-01 23:24:41 +00:00
if ( ! string . IsNullOrEmpty ( fronthigh . TextureName ) & & fronthigh . TextureName ! = l . Front . HighTexture )
2014-09-15 14:12:31 +00:00
{
if ( ! fronthigh . Required & & l . Front . HighRequired ( ) ) fronthigh . Required = true ;
2016-03-01 23:24:41 +00:00
fronthigh . MultipleTextures = true ;
2014-09-15 14:12:31 +00:00
fronthigh . TextureName = string . Empty ;
}
2016-03-01 23:24:41 +00:00
if ( ! string . IsNullOrEmpty ( frontmid . TextureName ) & & frontmid . TextureName ! = l . Front . MiddleTexture )
2014-09-15 14:12:31 +00:00
{
if ( ! frontmid . Required & & l . Front . MiddleRequired ( ) ) frontmid . Required = true ;
2016-03-01 23:24:41 +00:00
frontmid . MultipleTextures = true ;
2014-09-15 14:12:31 +00:00
frontmid . TextureName = string . Empty ;
}
2016-03-01 23:24:41 +00:00
if ( ! string . IsNullOrEmpty ( frontlow . TextureName ) & & frontlow . TextureName ! = l . Front . LowTexture )
2014-09-15 14:12:31 +00:00
{
if ( ! frontlow . Required & & l . Front . LowRequired ( ) ) frontlow . Required = true ;
frontlow . MultipleTextures = true ; //mxd
frontlow . TextureName = string . Empty ;
}
if ( frontsector . Text ! = l . Front . Sector . Index . ToString ( ) ) frontsector . Text = string . Empty ;
2014-12-04 10:06:44 +00:00
//flags
foreach ( CheckBox c in flagsFront . Checkboxes )
2014-09-15 14:12:31 +00:00
{
2014-12-04 10:06:44 +00:00
if ( c . CheckState = = CheckState . Indeterminate ) continue ;
if ( l . Front . IsFlagSet ( c . Tag . ToString ( ) ) ! = c . Checked )
2014-09-15 14:12:31 +00:00
{
2014-12-04 10:06:44 +00:00
c . ThreeState = true ;
c . CheckState = CheckState . Indeterminate ;
2014-09-15 14:12:31 +00:00
}
2014-12-04 10:06:44 +00:00
}
2014-09-15 14:12:31 +00:00
2014-12-04 10:06:44 +00:00
//mxd
foreach ( PairedFieldsControl pfc in frontUdmfControls )
pfc . SetValuesFrom ( l . Front . Fields , false ) ;
if ( ! string . IsNullOrEmpty ( lightFront . Text ) )
{
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
int light = UniFields . GetInteger ( l . Front . Fields , "light" , 0 ) ;
2014-12-04 10:06:44 +00:00
if ( light ! = lightFront . GetResult ( light ) ) lightFront . Text = string . Empty ;
}
if ( l . Front . Fields . GetValue ( "lightabsolute" , false ) ! = cbLightAbsoluteFront . Checked )
{
cbLightAbsoluteFront . ThreeState = true ;
cbLightAbsoluteFront . CheckState = CheckState . Indeterminate ;
2014-09-15 14:12:31 +00:00
}
frontTextureOffset . SetValues ( l . Front . OffsetX , l . Front . OffsetY , false ) ; //mxd
}
// Back settings
if ( l . Back ! = null )
{
//mxd
2016-03-01 23:24:41 +00:00
if ( ! string . IsNullOrEmpty ( backhigh . TextureName ) & & backhigh . TextureName ! = l . Back . HighTexture )
2014-09-15 14:12:31 +00:00
{
if ( ! backhigh . Required & & l . Back . HighRequired ( ) ) backhigh . Required = true ;
2016-03-01 23:24:41 +00:00
backhigh . MultipleTextures = true ;
2014-09-15 14:12:31 +00:00
backhigh . TextureName = string . Empty ;
}
2016-03-01 23:24:41 +00:00
if ( ! string . IsNullOrEmpty ( backmid . TextureName ) & & backmid . TextureName ! = l . Back . MiddleTexture )
2014-09-15 14:12:31 +00:00
{
if ( ! backmid . Required & & l . Back . MiddleRequired ( ) ) backmid . Required = true ;
2016-03-01 23:24:41 +00:00
backmid . MultipleTextures = true ;
2014-09-15 14:12:31 +00:00
backmid . TextureName = string . Empty ;
}
2016-03-01 23:24:41 +00:00
if ( ! string . IsNullOrEmpty ( backlow . TextureName ) & & backlow . TextureName ! = l . Back . LowTexture )
2014-12-03 23:15:26 +00:00
{
2014-09-15 14:12:31 +00:00
if ( ! backlow . Required & & l . Back . LowRequired ( ) ) backlow . Required = true ;
2016-03-01 23:24:41 +00:00
backlow . MultipleTextures = true ;
2014-09-15 14:12:31 +00:00
backlow . TextureName = string . Empty ;
}
if ( backsector . Text ! = l . Back . Sector . Index . ToString ( ) ) backsector . Text = string . Empty ;
2014-12-04 10:06:44 +00:00
//flags
foreach ( CheckBox c in flagsBack . Checkboxes )
2014-09-15 14:12:31 +00:00
{
2014-12-04 10:06:44 +00:00
if ( c . CheckState = = CheckState . Indeterminate ) continue ;
if ( l . Back . IsFlagSet ( c . Tag . ToString ( ) ) ! = c . Checked )
2014-09-15 14:12:31 +00:00
{
2014-12-04 10:06:44 +00:00
c . ThreeState = true ;
c . CheckState = CheckState . Indeterminate ;
2014-09-15 14:12:31 +00:00
}
2014-12-04 10:06:44 +00:00
}
2014-09-15 14:12:31 +00:00
2014-12-04 10:06:44 +00:00
//mxd
foreach ( PairedFieldsControl pfc in backUdmfControls )
pfc . SetValuesFrom ( l . Back . Fields , false ) ;
2014-09-15 14:12:31 +00:00
2014-12-04 10:06:44 +00:00
if ( ! string . IsNullOrEmpty ( lightBack . Text ) )
{
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
int light = UniFields . GetInteger ( l . Back . Fields , "light" , 0 ) ;
2014-12-04 10:06:44 +00:00
if ( light ! = lightBack . GetResult ( light ) )
lightBack . Text = string . Empty ;
}
if ( l . Back . Fields . GetValue ( "lightabsolute" , false ) ! = cbLightAbsoluteBack . Checked )
{
cbLightAbsoluteBack . ThreeState = true ;
cbLightAbsoluteBack . CheckState = CheckState . Indeterminate ;
2014-09-15 14:12:31 +00:00
}
backTextureOffset . SetValues ( l . Back . OffsetX , l . Back . OffsetY , false ) ; //mxd
}
//mxd
2015-01-26 08:53:05 +00:00
linedefprops . Add ( new LinedefProperties ( l ) ) ;
2014-09-15 14:12:31 +00:00
}
2016-04-09 23:18:39 +00:00
//mxd. Set tags
tagsselector . SetValues ( lines ) ;
2014-09-15 14:12:31 +00:00
// Refresh controls so that they show their image
backhigh . Refresh ( ) ;
backmid . Refresh ( ) ;
backlow . Refresh ( ) ;
fronthigh . Refresh ( ) ;
frontmid . Refresh ( ) ;
frontlow . Refresh ( ) ;
preventchanges = false ;
2014-09-15 14:49:11 +00:00
CheckActivationFlagsRequired ( ) ; //mxd
2015-07-27 09:02:28 +00:00
argscontrol . UpdateScriptControls ( ) ; //mxd
2014-12-05 14:33:31 +00:00
actionhelp . UpdateAction ( action . GetValue ( ) ) ; //mxd
2015-07-14 23:34:31 +00:00
commenteditor . FinishSetup ( ) ; //mxd
2014-09-15 14:12:31 +00:00
2016-12-30 10:31:10 +00:00
//mxd. Update "Reset" buttons
2015-10-02 14:47:34 +00:00
resetfrontlight . Visible = ( cbLightAbsoluteFront . CheckState ! = CheckState . Unchecked | | lightFront . GetResult ( 0 ) ! = 0 ) ;
resetbacklight . Visible = ( cbLightAbsoluteBack . CheckState ! = CheckState . Unchecked | | lightBack . GetResult ( 0 ) ! = 0 ) ;
2016-12-30 10:31:10 +00:00
if ( alpha . Text = = "1" ) resetalpha . Visible = false ;
2014-09-15 14:12:31 +00:00
}
2015-01-26 08:53:05 +00:00
//mxd
private void MakeUndo ( )
{
if ( undocreated ) return ;
undocreated = true ;
//mxd. Make undo
General . Map . UndoRedo . CreateUndo ( "Edit " + ( lines . Count > 1 ? lines . Count + " linedefs" : "linedef" ) ) ;
if ( General . Map . FormatInterface . HasCustomFields )
{
2015-12-28 15:01:53 +00:00
foreach ( Linedef l in lines )
2015-01-26 08:53:05 +00:00
{
l . Fields . BeforeFieldsChange ( ) ;
if ( l . Front ! = null ) l . Front . Fields . BeforeFieldsChange ( ) ;
if ( l . Back ! = null ) l . Back . Fields . BeforeFieldsChange ( ) ;
}
}
}
2014-09-15 14:49:11 +00:00
//mxd
private void CheckActivationFlagsRequired ( )
{
// Display a warning if we have an action and no activation flags
2014-09-15 23:37:55 +00:00
if ( action . Value ! = 0
& & General . Map . Config . LinedefActions . ContainsKey ( action . Value )
& & General . Map . Config . LinedefActions [ action . Value ] . RequiresActivation )
2014-09-15 14:49:11 +00:00
{
bool haveactivationflag = false ;
foreach ( CheckBox c in udmfactivates . Checkboxes )
{
if ( c . CheckState ! = CheckState . Unchecked )
{
haveactivationflag = true ;
break ;
}
}
missingactivation . Visible = ! haveactivationflag ;
activationGroup . ForeColor = ( ! haveactivationflag ? Color . DarkRed : SystemColors . ControlText ) ;
}
else
{
missingactivation . Visible = false ;
activationGroup . ForeColor = SystemColors . ControlText ;
}
}
2014-09-15 14:12:31 +00:00
#endregion
#region = = = = = = = = = = = = = = = = = = Events
// Apply clicked
private void apply_Click ( object sender , EventArgs e )
{
// Verify the action
if ( ( action . Value < General . Map . FormatInterface . MinAction ) | | ( action . Value > General . Map . FormatInterface . MaxAction ) )
{
General . ShowWarningMessage ( "Linedef action must be between " + General . Map . FormatInterface . MinAction + " and " + General . Map . FormatInterface . MaxAction + "." , MessageBoxButtons . OK ) ;
return ;
}
2015-01-26 08:53:05 +00:00
MakeUndo ( ) ;
2014-09-15 14:12:31 +00:00
//mxd
2014-11-15 20:25:16 +00:00
int locknumber = 0 ;
bool setlocknumber = false ;
if ( ! string . IsNullOrEmpty ( lockpick . Text ) )
{
if ( lockpick . SelectedIndex = = - 1 )
{
setlocknumber = int . TryParse ( lockpick . Text , out locknumber ) ;
}
else
{
locknumber = keynumbers [ lockpick . SelectedIndex ] ;
setlocknumber = true ;
}
}
2014-09-15 14:12:31 +00:00
// Go for all the lines
2016-08-29 10:06:16 +00:00
int offset = 0 ; //mxd
2014-09-15 14:12:31 +00:00
foreach ( Linedef l in lines )
{
// UDMF activations
foreach ( CheckBox c in udmfactivates . Checkboxes )
{
LinedefActivateInfo ai = ( c . Tag as LinedefActivateInfo ) ;
2015-12-28 15:01:53 +00:00
switch ( c . CheckState )
2015-07-15 09:09:47 +00:00
{
case CheckState . Checked : l . SetFlag ( ai . Key , true ) ; break ;
case CheckState . Unchecked : l . SetFlag ( ai . Key , false ) ; break ;
}
2014-09-15 14:12:31 +00:00
}
2016-04-09 23:18:39 +00:00
// Action
2015-07-27 09:02:28 +00:00
if ( ! action . Empty ) l . Action = action . Value ;
2014-09-15 14:12:31 +00:00
2015-07-27 09:02:28 +00:00
//mxd. Apply args
2016-08-29 10:06:16 +00:00
argscontrol . Apply ( l , offset + + ) ;
2014-09-15 14:12:31 +00:00
// Remove front side?
if ( ( l . Front ! = null ) & & ( frontside . CheckState = = CheckState . Unchecked ) )
{
l . Front . Dispose ( ) ;
}
// Create or modify front side?
else if ( frontside . CheckState = = CheckState . Checked )
{
// Make sure we have a valid sector (make a new one if needed)
2015-12-28 15:01:53 +00:00
int index = ( l . Front ! = null ? l . Front . Sector . Index : - 1 ) ;
2014-09-15 14:12:31 +00:00
index = frontsector . GetResult ( index ) ;
if ( ( index > - 1 ) & & ( index < General . Map . Map . Sectors . Count ) )
{
2015-12-28 15:01:53 +00:00
Sector s = ( General . Map . Map . GetSectorByIndex ( index ) ? ? General . Map . Map . CreateSector ( ) ) ;
2014-09-15 14:12:31 +00:00
if ( s ! = null )
{
// Create new sidedef?
if ( l . Front = = null ) General . Map . Map . CreateSidedef ( l , true , s ) ;
// Change sector?
if ( l . Front ! = null & & l . Front . Sector ! = s ) l . Front . SetSector ( s ) ;
}
}
}
// Remove back side?
if ( ( l . Back ! = null ) & & ( backside . CheckState = = CheckState . Unchecked ) )
{
l . Back . Dispose ( ) ;
}
// Create or modify back side?
else if ( backside . CheckState = = CheckState . Checked )
{
// Make sure we have a valid sector (make a new one if needed)
2015-12-28 15:01:53 +00:00
int index = ( l . Back ! = null ? l . Back . Sector . Index : - 1 ) ;
2014-09-15 14:12:31 +00:00
index = backsector . GetResult ( index ) ;
if ( ( index > - 1 ) & & ( index < General . Map . Map . Sectors . Count ) )
{
2015-12-28 15:01:53 +00:00
Sector s = ( General . Map . Map . GetSectorByIndex ( index ) ? ? General . Map . Map . CreateSector ( ) ) ;
2014-09-15 14:12:31 +00:00
if ( s ! = null )
{
// Create new sidedef?
if ( l . Back = = null ) General . Map . Map . CreateSidedef ( l , false , s ) ;
// Change sector?
if ( l . Back ! = null & & l . Back . Sector ! = s ) l . Back . SetSector ( s ) ;
}
}
}
//mxd. UDMF Settings
2014-12-04 10:06:44 +00:00
fieldslist . Apply ( l . Fields ) ;
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 ( setlocknumber ) UniFields . SetInteger ( l . Fields , "locknumber" , locknumber , 0 ) ;
2015-07-14 23:34:31 +00:00
commenteditor . Apply ( l . Fields ) ;
2014-09-15 14:12:31 +00:00
}
2016-04-09 23:18:39 +00:00
//mxd. Apply tags
tagsselector . ApplyTo ( lines ) ;
2014-09-15 14:12:31 +00:00
// Update the used textures
General . Map . Data . UpdateUsedTextures ( ) ;
// Done
General . Map . IsChanged = true ;
if ( OnValuesChanged ! = null ) OnValuesChanged ( this , EventArgs . Empty ) ; //mxd
this . DialogResult = DialogResult . OK ;
this . Close ( ) ;
}
// Cancel clicked
private void cancel_Click ( object sender , EventArgs e )
{
//mxd. Let's pretend nothing of this really happened...
2015-01-26 08:53:05 +00:00
if ( undocreated ) General . Map . UndoRedo . WithdrawUndo ( ) ;
2014-09-15 14:12:31 +00:00
// Be gone
this . DialogResult = DialogResult . Cancel ;
this . Close ( ) ;
}
// Front side (un)checked
private void frontside_CheckStateChanged ( object sender , EventArgs e )
{
// Enable/disable panel
// NOTE: Also enabled when checkbox is grayed!
frontgroup . Enabled = ( frontside . CheckState ! = CheckState . Unchecked ) ;
2014-11-25 11:52:01 +00:00
tabfront . ImageIndex = ( frontside . CheckState = = CheckState . Unchecked ? 1 : 0 ) ;
2014-09-15 14:12:31 +00:00
}
// Back side (un)checked
private void backside_CheckStateChanged ( object sender , EventArgs e )
{
// Enable/disable panel
// NOTE: Also enabled when checkbox is grayed!
backgroup . Enabled = ( backside . CheckState ! = CheckState . Unchecked ) ;
2014-11-25 11:52:01 +00:00
tabback . ImageIndex = ( backside . CheckState = = CheckState . Unchecked ? 1 : 0 ) ;
2014-09-15 14:12:31 +00:00
}
// Action changes
private void action_ValueChanges ( object sender , EventArgs e )
{
int showaction = 0 ;
// Only when line type is known
if ( General . Map . Config . LinedefActions . ContainsKey ( action . Value ) ) showaction = action . Value ;
2015-07-27 09:02:28 +00:00
//mxd. Change the argument descriptions
argscontrol . UpdateAction ( showaction , preventchanges ) ;
2014-09-15 14:12:31 +00:00
if ( ! preventchanges )
{
2015-01-26 08:53:05 +00:00
MakeUndo ( ) ; //mxd
2014-09-15 14:12:31 +00:00
2014-12-05 21:34:16 +00:00
//mxd. Update what must be updated
2014-09-15 14:49:11 +00:00
CheckActivationFlagsRequired ( ) ;
2015-07-27 09:02:28 +00:00
argscontrol . UpdateScriptControls ( ) ;
2014-12-05 14:33:31 +00:00
actionhelp . UpdateAction ( showaction ) ;
2014-09-15 14:12:31 +00:00
}
}
// Browse Action clicked
private void browseaction_Click ( object sender , EventArgs e )
{
action . Value = ActionBrowserForm . BrowseAction ( this , action . Value ) ;
}
//mxd
private void tabcustom_MouseEnter ( object sender , EventArgs e )
{
fieldslist . Focus ( ) ;
}
2016-02-26 12:46:17 +00:00
//mxd. Store window settings
2014-09-15 14:12:31 +00:00
private void LinedefEditForm_FormClosing ( object sender , FormClosingEventArgs e )
{
2016-12-02 13:45:03 +00:00
// Save settings
General . Settings . WriteSetting ( "windows." + configname + ".activetab" , tabs . SelectedIndex ) ;
General . Settings . WriteSetting ( "windows." + configname + ".linkfronttopscale" , pfcFrontScaleTop . LinkValues ) ;
General . Settings . WriteSetting ( "windows." + configname + ".linkfrontmidscale" , pfcFrontScaleMid . LinkValues ) ;
General . Settings . WriteSetting ( "windows." + configname + ".linkfrontbottomscale" , pfcFrontScaleBottom . LinkValues ) ;
General . Settings . WriteSetting ( "windows." + configname + ".linkbacktopscale" , pfcBackScaleTop . LinkValues ) ;
General . Settings . WriteSetting ( "windows." + configname + ".linkbackmidscale" , pfcBackScaleMid . LinkValues ) ;
General . Settings . WriteSetting ( "windows." + configname + ".linkbackbottomscale" , pfcBackScaleBottom . LinkValues ) ;
2014-09-15 14:12:31 +00:00
}
// Help!
private void LinedefEditForm_HelpRequested ( object sender , HelpEventArgs hlpevent )
{
General . ShowHelp ( "w_linedefedit.html" ) ;
hlpevent . Handled = true ;
}
#endregion
#region = = = = = = = = = = = = = = = = = = mxd . Realtime events ( linedef )
private void cbRenderStyle_SelectedIndexChanged ( object sender , EventArgs e )
{
if ( preventchanges ) return ;
2015-01-26 08:53:05 +00:00
MakeUndo ( ) ; //mxd
2014-09-15 14:12:31 +00:00
//update values
foreach ( Linedef l in lines )
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 . SetString ( l . Fields , "renderstyle" , renderstyles [ renderStyle . SelectedIndex ] , "translucent" ) ;
2014-09-15 14:12:31 +00:00
General . Map . IsChanged = true ;
if ( OnValuesChanged ! = null ) OnValuesChanged ( this , EventArgs . Empty ) ;
}
private void alpha_WhenTextChanged ( object sender , EventArgs e )
{
if ( preventchanges ) return ;
2015-01-26 08:53:05 +00:00
MakeUndo ( ) ; //mxd
2014-09-15 14:12:31 +00:00
int i = 0 ;
//restore values
if ( string . IsNullOrEmpty ( alpha . Text ) )
{
foreach ( Linedef l in lines )
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 . SetFloat ( l . Fields , "alpha" , linedefprops [ i + + ] . Alpha , 1.0f ) ;
2014-09-15 14:12:31 +00:00
}
else //update values
{
foreach ( Linedef l in lines )
{
float value = General . Clamp ( alpha . GetResultFloat ( l . Fields . GetValue ( "alpha" , 1.0f ) ) , 0f , 1.0f ) ;
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 . SetFloat ( l . Fields , "alpha" , value , 1.0f ) ;
2014-09-15 14:12:31 +00:00
}
}
2016-12-30 10:31:10 +00:00
resetalpha . Visible = ( alpha . GetResultFloat ( 1.0f ) ! = 1.0f ) ;
2014-09-15 14:12:31 +00:00
General . Map . IsChanged = true ;
if ( OnValuesChanged ! = null ) OnValuesChanged ( this , EventArgs . Empty ) ;
}
2016-12-30 10:31:10 +00:00
private void resetalpha_Click ( object sender , EventArgs e )
{
2017-01-04 13:28:36 +00:00
alpha . Focus ( ) ;
2016-12-30 10:31:10 +00:00
alpha . Text = "1" ;
}
2014-09-15 14:12:31 +00:00
private void flags_OnValueChanged ( object sender , EventArgs e )
{
if ( preventchanges ) return ;
2015-01-26 08:53:05 +00:00
MakeUndo ( ) ; //mxd
2014-09-15 14:12:31 +00:00
int i = 0 ;
foreach ( Linedef l in lines )
{
// Apply all flags
foreach ( CheckBox c in flags . Checkboxes )
{
if ( c . CheckState = = CheckState . Checked )
l . SetFlag ( c . Tag . ToString ( ) , true ) ;
else if ( c . CheckState = = CheckState . Unchecked )
l . SetFlag ( c . Tag . ToString ( ) , false ) ;
2015-01-26 08:53:05 +00:00
else if ( linedefprops [ i ] . Flags . ContainsKey ( c . Tag . ToString ( ) ) )
l . SetFlag ( c . Tag . ToString ( ) , linedefprops [ i ] . Flags [ c . Tag . ToString ( ) ] ) ;
2014-09-15 14:12:31 +00:00
else //linedefs created in the editor have empty Flags by default
l . SetFlag ( c . Tag . ToString ( ) , false ) ;
}
i + + ;
}
General . Map . IsChanged = true ;
if ( OnValuesChanged ! = null ) OnValuesChanged ( this , EventArgs . Empty ) ;
}
2014-09-15 14:49:11 +00:00
//mxd
private void udmfactivates_OnValueChanged ( object sender , EventArgs e )
{
if ( preventchanges ) return ;
CheckActivationFlagsRequired ( ) ;
}
2014-09-15 14:12:31 +00:00
#endregion
2014-09-15 14:49:11 +00:00
#region = = = = = = = = = = = = = = = = = = mxd . Realtime events ( sides )
2014-09-15 14:12:31 +00:00
2014-09-15 14:49:11 +00:00
#region Custom fields changed
2014-09-15 14:12:31 +00:00
// Custom fields on front sides
private void customfrontbutton_Click ( object sender , EventArgs e )
{
// Make collection of front sides
List < MapElement > sides = new List < MapElement > ( lines . Count ) ;
foreach ( Linedef l in lines ) if ( l . Front ! = null ) sides . Add ( l . Front ) ;
if ( ! CustomFieldsForm . ShowDialog ( this , "Front side custom fields" , "sidedef" , sides , General . Map . Config . SidedefFields ) ) return ;
//Apply values
Sidedef fs = General . GetByIndex ( sides , 0 ) as Sidedef ;
//..to the first side
foreach ( PairedFieldsControl pfc in frontUdmfControls )
pfc . SetValuesFrom ( fs . Fields , true ) ;
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
lightFront . Text = UniFields . GetInteger ( fs . Fields , "light" , 0 ) . ToString ( ) ;
2014-09-15 14:12:31 +00:00
cbLightAbsoluteFront . ThreeState = false ;
cbLightAbsoluteFront . Checked = fs . Fields . GetValue ( "lightabsolute" , false ) ;
//flags
foreach ( CheckBox c in flagsFront . Checkboxes )
if ( fs . Flags . ContainsKey ( c . Tag . ToString ( ) ) ) c . Checked = fs . Flags [ c . Tag . ToString ( ) ] ;
//..then to all of them
foreach ( Sidedef s in sides )
{
foreach ( PairedFieldsControl pfc in frontUdmfControls )
pfc . SetValuesFrom ( s . Fields , false ) ;
if ( ! string . IsNullOrEmpty ( lightFront . Text ) )
{
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
int light = UniFields . GetInteger ( s . Fields , "light" , 0 ) ;
2014-09-15 14:12:31 +00:00
if ( light ! = lightFront . GetResult ( light ) ) lightFront . Text = string . Empty ;
}
if ( s . Fields . GetValue ( "lightabsolute" , false ) ! = cbLightAbsoluteFront . Checked )
{
cbLightAbsoluteFront . ThreeState = true ;
cbLightAbsoluteFront . CheckState = CheckState . Indeterminate ;
}
//flags
foreach ( CheckBox c in flagsFront . Checkboxes )
{
if ( c . CheckState = = CheckState . Indeterminate ) continue ;
if ( s . Flags . ContainsKey ( c . Tag . ToString ( ) ) )
{
if ( s . Flags [ c . Tag . ToString ( ) ] ! = c . Checked )
{
c . ThreeState = true ;
c . CheckState = CheckState . Indeterminate ;
}
}
}
}
General . Map . IsChanged = true ;
if ( OnValuesChanged ! = null ) OnValuesChanged ( this , EventArgs . Empty ) ;
}
// Custom fields on back sides
private void custombackbutton_Click ( object sender , EventArgs e )
{
// Make collection of back sides
List < MapElement > sides = new List < MapElement > ( lines . Count ) ;
foreach ( Linedef l in lines ) if ( l . Back ! = null ) sides . Add ( l . Back ) ;
// Edit these
if ( ! CustomFieldsForm . ShowDialog ( this , "Back side custom fields" , "sidedef" , sides , General . Map . Config . SidedefFields ) ) return ;
//Apply values
Sidedef fs = General . GetByIndex ( sides , 0 ) as Sidedef ;
//..to the first side
foreach ( PairedFieldsControl pfc in backUdmfControls )
pfc . SetValuesFrom ( fs . Fields , true ) ;
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
lightBack . Text = UniFields . GetInteger ( fs . Fields , "light" , 0 ) . ToString ( ) ;
2014-09-15 14:12:31 +00:00
cbLightAbsoluteBack . ThreeState = false ;
cbLightAbsoluteBack . Checked = fs . Fields . GetValue ( "lightabsolute" , false ) ;
//flags
foreach ( CheckBox c in flagsBack . Checkboxes )
if ( fs . Flags . ContainsKey ( c . Tag . ToString ( ) ) ) c . Checked = fs . Flags [ c . Tag . ToString ( ) ] ;
//..then to all of them
foreach ( Sidedef s in sides )
{
foreach ( PairedFieldsControl pfc in backUdmfControls )
pfc . SetValuesFrom ( s . Fields , false ) ;
if ( ! string . IsNullOrEmpty ( lightBack . Text ) )
{
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
int light = UniFields . GetInteger ( s . Fields , "light" , 0 ) ;
2014-09-15 14:12:31 +00:00
if ( light ! = lightBack . GetResult ( light ) ) lightBack . Text = string . Empty ;
}
if ( s . Fields . GetValue ( "lightabsolute" , false ) ! = cbLightAbsoluteBack . Checked )
{
cbLightAbsoluteBack . ThreeState = true ;
cbLightAbsoluteBack . CheckState = CheckState . Indeterminate ;
}
//flags
foreach ( CheckBox c in flagsBack . Checkboxes )
{
if ( c . CheckState = = CheckState . Indeterminate ) continue ;
if ( s . Flags . ContainsKey ( c . Tag . ToString ( ) ) & & s . Flags [ c . Tag . ToString ( ) ] ! = c . Checked )
{
c . ThreeState = true ;
c . CheckState = CheckState . Indeterminate ;
}
}
}
General . Map . IsChanged = true ;
if ( OnValuesChanged ! = null ) OnValuesChanged ( this , EventArgs . Empty ) ;
}
#endregion
#region Texture changed
private void fronthigh_OnValueChanged ( object sender , EventArgs e )
{
if ( preventchanges ) return ;
2016-02-26 12:46:17 +00:00
MakeUndo ( ) ;
2014-09-15 14:12:31 +00:00
2016-02-26 12:46:17 +00:00
// Restore values
2014-09-15 14:12:31 +00:00
if ( string . IsNullOrEmpty ( fronthigh . TextureName ) )
{
int i = 0 ;
foreach ( Linedef l in lines )
{
2016-02-26 12:46:17 +00:00
if ( l . Front ! = null ) l . Front . SetTextureHigh ( linedefprops [ i ] . Front ! = null ? linedefprops [ i ] . Front . HighTexture : "-" ) ;
2014-09-15 14:12:31 +00:00
i + + ;
}
2016-02-26 12:46:17 +00:00
}
// Update values
else
2014-09-15 14:12:31 +00:00
{
2016-02-26 12:46:17 +00:00
foreach ( Linedef l in lines )
{
2016-06-05 22:06:56 +00:00
if ( l . Front ! = null ) l . Front . SetTextureHigh ( fronthigh . GetResult ( l . Front . HighTexture ) ) ;
2016-02-26 12:46:17 +00:00
}
2014-09-15 14:12:31 +00:00
}
// Update the used textures
General . Map . Data . UpdateUsedTextures ( ) ;
General . Map . IsChanged = true ;
if ( OnValuesChanged ! = null ) OnValuesChanged ( this , EventArgs . Empty ) ;
}
private void frontmid_OnValueChanged ( object sender , EventArgs e )
{
if ( preventchanges ) return ;
2016-02-26 12:46:17 +00:00
MakeUndo ( ) ;
2014-09-15 14:12:31 +00:00
2016-02-26 12:46:17 +00:00
// Restore values
2014-09-15 14:12:31 +00:00
if ( string . IsNullOrEmpty ( frontmid . TextureName ) )
{
int i = 0 ;
foreach ( Linedef l in lines )
{
2016-02-26 12:46:17 +00:00
if ( l . Front ! = null ) l . Front . SetTextureMid ( linedefprops [ i ] . Front ! = null ? linedefprops [ i ] . Front . MiddleTexture : "-" ) ;
2014-09-15 14:12:31 +00:00
i + + ;
}
2016-02-26 12:46:17 +00:00
}
// Update values
else
2014-09-15 14:12:31 +00:00
{
2016-02-26 12:46:17 +00:00
foreach ( Linedef l in lines )
{
2016-06-05 22:06:56 +00:00
if ( l . Front ! = null ) l . Front . SetTextureMid ( frontmid . GetResult ( l . Front . MiddleTexture ) ) ;
2016-02-26 12:46:17 +00:00
}
2014-09-15 14:12:31 +00:00
}
// Update the used textures
General . Map . Data . UpdateUsedTextures ( ) ;
General . Map . IsChanged = true ;
if ( OnValuesChanged ! = null ) OnValuesChanged ( this , EventArgs . Empty ) ;
}
private void frontlow_OnValueChanged ( object sender , EventArgs e )
{
if ( preventchanges ) return ;
2016-02-26 12:46:17 +00:00
MakeUndo ( ) ;
2014-09-15 14:12:31 +00:00
2016-02-26 12:46:17 +00:00
// Restore values
2014-09-15 14:12:31 +00:00
if ( string . IsNullOrEmpty ( frontlow . TextureName ) )
{
int i = 0 ;
foreach ( Linedef l in lines )
{
2016-02-26 12:46:17 +00:00
if ( l . Front ! = null ) l . Front . SetTextureLow ( linedefprops [ i ] . Front ! = null ? linedefprops [ i ] . Front . LowTexture : "-" ) ;
2014-09-15 14:12:31 +00:00
i + + ;
}
2016-02-26 12:46:17 +00:00
}
// Update values
else
2014-09-15 14:12:31 +00:00
{
foreach ( Linedef l in lines )
2016-02-26 12:46:17 +00:00
{
2016-06-05 22:06:56 +00:00
if ( l . Front ! = null ) l . Front . SetTextureLow ( frontlow . GetResult ( l . Front . LowTexture ) ) ;
2016-02-26 12:46:17 +00:00
}
2014-09-15 14:12:31 +00:00
}
// Update the used textures
General . Map . Data . UpdateUsedTextures ( ) ;
General . Map . IsChanged = true ;
if ( OnValuesChanged ! = null ) OnValuesChanged ( this , EventArgs . Empty ) ;
}
private void backhigh_OnValueChanged ( object sender , EventArgs e )
{
if ( preventchanges ) return ;
2016-02-26 12:46:17 +00:00
MakeUndo ( ) ;
2014-09-15 14:12:31 +00:00
2016-02-26 12:46:17 +00:00
// Restore values
2014-09-15 14:12:31 +00:00
if ( string . IsNullOrEmpty ( backhigh . TextureName ) )
{
int i = 0 ;
foreach ( Linedef l in lines )
{
2016-02-26 12:46:17 +00:00
if ( l . Back ! = null ) l . Back . SetTextureHigh ( linedefprops [ i ] . Back ! = null ? linedefprops [ i ] . Back . HighTexture : "-" ) ;
2014-09-15 14:12:31 +00:00
i + + ;
}
2016-02-26 12:46:17 +00:00
}
// Update values
else
2014-09-15 14:12:31 +00:00
{
foreach ( Linedef l in lines )
2016-02-26 12:46:17 +00:00
{
2016-06-05 22:06:56 +00:00
if ( l . Back ! = null ) l . Back . SetTextureHigh ( backhigh . GetResult ( l . Back . HighTexture ) ) ;
2016-02-26 12:46:17 +00:00
}
2014-09-15 14:12:31 +00:00
}
// Update the used textures
General . Map . Data . UpdateUsedTextures ( ) ;
General . Map . IsChanged = true ;
if ( OnValuesChanged ! = null ) OnValuesChanged ( this , EventArgs . Empty ) ;
}
2014-12-03 23:15:26 +00:00
private void backmid_OnValueChanged ( object sender , EventArgs e )
{
2014-09-15 14:12:31 +00:00
if ( preventchanges ) return ;
2016-02-26 12:46:17 +00:00
MakeUndo ( ) ;
2014-09-15 14:12:31 +00:00
2016-02-26 12:46:17 +00:00
// Restore values
2014-09-15 14:12:31 +00:00
if ( string . IsNullOrEmpty ( backmid . TextureName ) )
{
int i = 0 ;
foreach ( Linedef l in lines )
{
2016-02-26 12:46:17 +00:00
if ( l . Back ! = null ) l . Back . SetTextureMid ( linedefprops [ i ] . Back ! = null ? linedefprops [ i ] . Back . MiddleTexture : "-" ) ;
2014-09-15 14:12:31 +00:00
i + + ;
}
2016-02-26 12:46:17 +00:00
}
// Update values
else
2014-09-15 14:12:31 +00:00
{
foreach ( Linedef l in lines )
2016-02-26 12:46:17 +00:00
{
2016-06-05 22:06:56 +00:00
if ( l . Back ! = null ) l . Back . SetTextureMid ( backmid . GetResult ( l . Back . MiddleTexture ) ) ;
2016-02-26 12:46:17 +00:00
}
2014-09-15 14:12:31 +00:00
}
// Update the used textures
General . Map . Data . UpdateUsedTextures ( ) ;
General . Map . IsChanged = true ;
if ( OnValuesChanged ! = null ) OnValuesChanged ( this , EventArgs . Empty ) ;
}
2014-12-03 23:15:26 +00:00
private void backlow_OnValueChanged ( object sender , EventArgs e )
{
2014-09-15 14:12:31 +00:00
if ( preventchanges ) return ;
2016-02-26 12:46:17 +00:00
MakeUndo ( ) ;
2014-09-15 14:12:31 +00:00
2016-02-26 12:46:17 +00:00
// Restore values
2014-09-15 14:12:31 +00:00
if ( string . IsNullOrEmpty ( backlow . TextureName ) )
{
int i = 0 ;
foreach ( Linedef l in lines )
{
2016-02-26 12:46:17 +00:00
if ( l . Back ! = null ) l . Back . SetTextureLow ( linedefprops [ i ] . Back ! = null ? linedefprops [ i ] . Back . LowTexture : "-" ) ;
2014-09-15 14:12:31 +00:00
i + + ;
}
2016-02-26 12:46:17 +00:00
}
// Update values
else
2014-09-15 14:12:31 +00:00
{
foreach ( Linedef l in lines )
2016-02-26 12:46:17 +00:00
{
2016-06-05 22:06:56 +00:00
if ( l . Back ! = null ) l . Back . SetTextureLow ( backlow . GetResult ( l . Back . LowTexture ) ) ;
2016-02-26 12:46:17 +00:00
}
2014-09-15 14:12:31 +00:00
}
// Update the used textures
General . Map . Data . UpdateUsedTextures ( ) ;
General . Map . IsChanged = true ;
if ( OnValuesChanged ! = null ) OnValuesChanged ( this , EventArgs . Empty ) ;
}
#endregion
#region Brightness changed
private void lightFront_WhenTextChanged ( object sender , EventArgs e )
{
if ( preventchanges ) return ;
2015-01-26 08:53:05 +00:00
MakeUndo ( ) ; //mxd
2014-09-15 14:12:31 +00:00
int i = 0 ;
//restore values
if ( string . IsNullOrEmpty ( lightFront . Text ) )
{
foreach ( Linedef l in lines )
{
if ( l . Front ! = null )
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 ( l . Front . Fields , "light" , ( linedefprops [ i ] . Front ! = null ? linedefprops [ i ] . Front . Brightness : 0 ) , 0 ) ;
2014-09-15 14:12:31 +00:00
i + + ;
}
}
else //update values
{
foreach ( Linedef l in lines )
{
if ( l . Front ! = null )
{
bool absolute = false ;
2015-12-28 15:01:53 +00:00
switch ( cbLightAbsoluteFront . CheckState )
2014-09-15 14:12:31 +00:00
{
2015-07-15 09:09:47 +00:00
case CheckState . Indeterminate :
absolute = l . Front . Fields . GetValue ( "lightabsolute" , false ) ;
break ;
case CheckState . Checked :
absolute = true ;
break ;
2014-09-15 14:12:31 +00:00
}
2015-01-26 08:53:05 +00:00
int value = General . Clamp ( lightFront . GetResult ( ( linedefprops [ i ] . Front ! = null ? linedefprops [ i ] . Front . Brightness : 0 ) ) , ( absolute ? 0 : - 255 ) , 255 ) ;
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 ( l . Front . Fields , "light" , value , 0 ) ;
2014-09-15 14:12:31 +00:00
}
i + + ;
}
}
2015-10-02 14:47:34 +00:00
resetfrontlight . Visible = ( cbLightAbsoluteFront . CheckState ! = CheckState . Unchecked | | lightFront . Text ! = "0" ) ;
2014-09-15 14:12:31 +00:00
General . Map . IsChanged = true ;
if ( OnValuesChanged ! = null ) OnValuesChanged ( this , EventArgs . Empty ) ;
}
private void lightBack_WhenTextChanged ( object sender , EventArgs e )
{
if ( preventchanges ) return ;
2015-01-26 08:53:05 +00:00
MakeUndo ( ) ; //mxd
2014-09-15 14:12:31 +00:00
int i = 0 ;
//restore values
if ( string . IsNullOrEmpty ( lightBack . Text ) )
{
foreach ( Linedef l in lines )
{
if ( l . Back ! = null )
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 ( l . Back . Fields , "light" , ( linedefprops [ i ] . Back ! = null ? linedefprops [ i ] . Back . Brightness : 0 ) , 0 ) ;
2014-09-15 14:12:31 +00:00
i + + ;
}
}
else //update values
{
foreach ( Linedef l in lines )
{
if ( l . Back ! = null )
{
bool absolute = false ;
2015-10-02 14:47:34 +00:00
switch ( cbLightAbsoluteBack . CheckState )
2014-09-15 14:12:31 +00:00
{
2015-07-15 09:09:47 +00:00
case CheckState . Indeterminate :
absolute = l . Back . Fields . GetValue ( "lightabsolute" , false ) ;
break ;
case CheckState . Checked :
absolute = true ;
break ;
2014-09-15 14:12:31 +00:00
}
2015-01-26 08:53:05 +00:00
int value = General . Clamp ( lightBack . GetResult ( ( linedefprops [ i ] . Back ! = null ? linedefprops [ i ] . Back . Brightness : 0 ) ) , ( absolute ? 0 : - 255 ) , 255 ) ;
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 ( l . Back . Fields , "light" , value , 0 ) ;
2014-09-15 14:12:31 +00:00
}
i + + ;
}
}
2015-10-02 14:47:34 +00:00
resetbacklight . Visible = ( cbLightAbsoluteBack . CheckState ! = CheckState . Unchecked | | lightBack . Text ! = "0" ) ;
2014-09-15 14:12:31 +00:00
General . Map . IsChanged = true ;
if ( OnValuesChanged ! = null ) OnValuesChanged ( this , EventArgs . Empty ) ;
}
private void cbLightAbsoluteFront_CheckedChanged ( object sender , EventArgs e )
{
if ( preventchanges ) return ;
2015-01-26 08:53:05 +00:00
MakeUndo ( ) ; //mxd
2014-09-15 14:12:31 +00:00
if ( cbLightAbsoluteFront . Checked )
{
foreach ( Linedef l in lines )
{
if ( l . Front = = null ) continue ;
l . Front . Fields [ "lightabsolute" ] = new UniValue ( UniversalType . Boolean , true ) ;
}
}
else if ( cbLightAbsoluteFront . CheckState = = CheckState . Indeterminate )
{
int i = 0 ;
foreach ( Linedef l in lines )
{
if ( l . Front ! = null )
{
2015-01-26 08:53:05 +00:00
if ( linedefprops [ i ] . Front ! = null & & linedefprops [ i ] . Front . AbsoluteBrightness )
2014-09-15 14:12:31 +00:00
{
l . Front . Fields [ "lightabsolute" ] = new UniValue ( UniversalType . Boolean , true ) ;
}
else if ( l . Front . Fields . ContainsKey ( "lightabsolute" ) )
{
l . Front . Fields . Remove ( "lightabsolute" ) ;
}
}
i + + ;
}
}
else
{
foreach ( Linedef l in lines )
{
if ( l . Front = = null ) continue ;
if ( l . Front . Fields . ContainsKey ( "lightabsolute" ) ) l . Front . Fields . Remove ( "lightabsolute" ) ;
}
}
2015-10-02 14:47:34 +00:00
resetfrontlight . Visible = ( cbLightAbsoluteFront . CheckState ! = CheckState . Unchecked | | lightFront . Text ! = "0" ) ;
2014-09-15 14:12:31 +00:00
General . Map . IsChanged = true ;
if ( OnValuesChanged ! = null ) OnValuesChanged ( this , EventArgs . Empty ) ;
}
private void cbLightAbsoluteBack_CheckedChanged ( object sender , EventArgs e )
{
if ( preventchanges ) return ;
2015-01-26 08:53:05 +00:00
MakeUndo ( ) ; //mxd
2014-09-15 14:12:31 +00:00
if ( cbLightAbsoluteBack . Checked )
{
foreach ( Linedef l in lines )
{
if ( l . Back = = null ) continue ;
l . Back . Fields [ "lightabsolute" ] = new UniValue ( UniversalType . Boolean , true ) ;
}
}
else if ( cbLightAbsoluteBack . CheckState = = CheckState . Indeterminate )
{
int i = 0 ;
foreach ( Linedef l in lines )
{
if ( l . Back ! = null )
{
2015-01-26 08:53:05 +00:00
if ( linedefprops [ i ] . Back ! = null & & linedefprops [ i ] . Back . AbsoluteBrightness )
2014-09-15 14:12:31 +00:00
{
l . Back . Fields [ "lightabsolute" ] = new UniValue ( UniversalType . Boolean , true ) ;
}
else if ( l . Back . Fields . ContainsKey ( "lightabsolute" ) )
{
l . Back . Fields . Remove ( "lightabsolute" ) ;
}
}
i + + ;
}
}
else
{
foreach ( Linedef l in lines )
{
if ( l . Back = = null ) continue ;
if ( l . Back . Fields . ContainsKey ( "lightabsolute" ) ) l . Back . Fields . Remove ( "lightabsolute" ) ;
}
}
2015-10-02 14:47:34 +00:00
resetbacklight . Visible = ( cbLightAbsoluteBack . CheckState ! = CheckState . Unchecked | | lightBack . Text ! = "0" ) ;
General . Map . IsChanged = true ;
if ( OnValuesChanged ! = null ) OnValuesChanged ( this , EventArgs . Empty ) ;
}
private void resetfrontlight_Click ( object sender , EventArgs e )
{
MakeUndo ( ) ; //mxd
preventchanges = true ;
cbLightAbsoluteFront . Checked = false ;
lightFront . Text = "0" ;
foreach ( Linedef l in lines )
{
if ( l . Front = = null ) continue ;
if ( l . Front . Fields . ContainsKey ( "lightabsolute" ) ) l . Front . Fields . Remove ( "lightabsolute" ) ;
if ( l . Front . Fields . ContainsKey ( "light" ) ) l . Front . Fields . Remove ( "light" ) ;
}
preventchanges = false ;
resetfrontlight . Visible = false ;
lightFront . Focus ( ) ;
General . Map . IsChanged = true ;
if ( OnValuesChanged ! = null ) OnValuesChanged ( this , EventArgs . Empty ) ;
}
private void resetbacklight_Click ( object sender , EventArgs e )
{
MakeUndo ( ) ; //mxd
preventchanges = true ;
cbLightAbsoluteBack . Checked = false ;
lightBack . Text = "0" ;
foreach ( Linedef l in lines )
{
if ( l . Back = = null ) continue ;
if ( l . Back . Fields . ContainsKey ( "lightabsolute" ) ) l . Back . Fields . Remove ( "lightabsolute" ) ;
if ( l . Back . Fields . ContainsKey ( "light" ) ) l . Back . Fields . Remove ( "light" ) ;
}
preventchanges = false ;
resetbacklight . Visible = false ;
lightBack . Focus ( ) ;
2014-09-15 14:12:31 +00:00
General . Map . IsChanged = true ;
if ( OnValuesChanged ! = null ) OnValuesChanged ( this , EventArgs . Empty ) ;
}
#endregion
#region Global texture offsets changed
2015-01-05 14:56:44 +00:00
private void frontTextureOffset_OnValuesChanged ( object sender , EventArgs e )
2014-09-15 14:12:31 +00:00
{
if ( preventchanges ) return ;
2015-01-26 08:53:05 +00:00
MakeUndo ( ) ; //mxd
2014-09-15 14:12:31 +00:00
int i = 0 ;
foreach ( Linedef l in lines )
{
if ( l . Front ! = null )
{
2015-01-26 08:53:05 +00:00
if ( linedefprops [ i ] . Front ! = null )
2014-09-15 14:12:31 +00:00
{
2015-01-26 08:53:05 +00:00
l . Front . OffsetX = frontTextureOffset . GetValue1 ( linedefprops [ i ] . Front . OffsetX ) ;
l . Front . OffsetY = frontTextureOffset . GetValue2 ( linedefprops [ i ] . Front . OffsetY ) ;
2014-09-15 14:12:31 +00:00
}
else
{
l . Front . OffsetX = frontTextureOffset . GetValue1 ( 0 ) ;
l . Front . OffsetY = frontTextureOffset . GetValue2 ( 0 ) ;
}
}
i + + ;
}
General . Map . IsChanged = true ;
if ( OnValuesChanged ! = null ) OnValuesChanged ( this , EventArgs . Empty ) ;
}
private void backTextureOffset_OnValuesChanged ( object sender , EventArgs e )
{
if ( preventchanges ) return ;
2015-01-26 08:53:05 +00:00
MakeUndo ( ) ; //mxd
2014-09-15 14:12:31 +00:00
int i = 0 ;
foreach ( Linedef l in lines )
{
if ( l . Back ! = null )
{
2015-01-26 08:53:05 +00:00
if ( linedefprops [ i ] . Back ! = null )
2014-09-15 14:12:31 +00:00
{
2015-01-26 08:53:05 +00:00
l . Back . OffsetX = backTextureOffset . GetValue1 ( linedefprops [ i ] . Back . OffsetX ) ;
l . Back . OffsetY = backTextureOffset . GetValue2 ( linedefprops [ i ] . Back . OffsetY ) ;
2014-09-15 14:12:31 +00:00
}
else
{
l . Back . OffsetX = backTextureOffset . GetValue1 ( 0 ) ;
l . Back . OffsetY = backTextureOffset . GetValue2 ( 0 ) ;
}
}
i + + ;
}
General . Map . IsChanged = true ;
if ( OnValuesChanged ! = null ) OnValuesChanged ( this , EventArgs . Empty ) ;
}
#endregion
#region Texture offsets changed
2015-01-05 14:56:44 +00:00
private void pfcFrontOffsetTop_OnValuesChanged ( object sender , EventArgs e )
2014-09-15 14:12:31 +00:00
{
if ( preventchanges ) return ;
2015-01-26 08:53:05 +00:00
MakeUndo ( ) ; //mxd
2014-09-15 14:12:31 +00:00
int i = 0 ;
foreach ( Linedef l in lines )
{
if ( l . Front ! = null )
{
2015-01-26 08:53:05 +00:00
float oldX = linedefprops [ i ] . Front ! = null ? linedefprops [ i ] . Front . OffsetTopX : 0f ;
float oldY = linedefprops [ i ] . Front ! = null ? linedefprops [ i ] . Front . OffsetTopY : 0f ;
2014-09-15 14:12:31 +00:00
pfcFrontOffsetTop . ApplyTo ( l . Front . Fields , General . Map . FormatInterface . MinTextureOffset , General . Map . FormatInterface . MaxTextureOffset , oldX , oldY ) ;
}
i + + ;
}
General . Map . IsChanged = true ;
if ( OnValuesChanged ! = null ) OnValuesChanged ( this , EventArgs . Empty ) ;
}
2015-01-05 14:56:44 +00:00
private void pfcFrontOffsetMid_OnValuesChanged ( object sender , EventArgs e )
2014-09-15 14:12:31 +00:00
{
if ( preventchanges ) return ;
2015-01-26 08:53:05 +00:00
MakeUndo ( ) ; //mxd
2014-09-15 14:12:31 +00:00
int i = 0 ;
foreach ( Linedef l in lines )
{
if ( l . Front ! = null )
{
2015-01-26 08:53:05 +00:00
float oldX = linedefprops [ i ] . Front ! = null ? linedefprops [ i ] . Front . OffsetMidX : 0f ;
float oldY = linedefprops [ i ] . Front ! = null ? linedefprops [ i ] . Front . OffsetMidY : 0f ;
2014-09-15 14:12:31 +00:00
pfcFrontOffsetMid . ApplyTo ( l . Front . Fields , General . Map . FormatInterface . MinTextureOffset , General . Map . FormatInterface . MaxTextureOffset , oldX , oldY ) ;
}
i + + ;
}
General . Map . IsChanged = true ;
if ( OnValuesChanged ! = null ) OnValuesChanged ( this , EventArgs . Empty ) ;
}
2015-01-05 14:56:44 +00:00
private void pfcFrontOffsetBottom_OnValuesChanged ( object sender , EventArgs e )
2014-09-15 14:12:31 +00:00
{
if ( preventchanges ) return ;
2015-01-26 08:53:05 +00:00
MakeUndo ( ) ; //mxd
2014-09-15 14:12:31 +00:00
int i = 0 ;
foreach ( Linedef l in lines )
{
if ( l . Front ! = null )
{
2015-01-26 08:53:05 +00:00
float oldX = linedefprops [ i ] . Front ! = null ? linedefprops [ i ] . Front . OffsetBottomX : 0f ;
float oldY = linedefprops [ i ] . Front ! = null ? linedefprops [ i ] . Front . OffsetBottomY : 0f ;
2014-09-15 14:12:31 +00:00
pfcFrontOffsetBottom . ApplyTo ( l . Front . Fields , General . Map . FormatInterface . MinTextureOffset , General . Map . FormatInterface . MaxTextureOffset , oldX , oldY ) ;
}
i + + ;
}
General . Map . IsChanged = true ;
if ( OnValuesChanged ! = null ) OnValuesChanged ( this , EventArgs . Empty ) ;
}
private void pfcBackOffsetTop_OnValuesChanged ( object sender , EventArgs e )
{
if ( preventchanges ) return ;
2015-01-26 08:53:05 +00:00
MakeUndo ( ) ; //mxd
2014-09-15 14:12:31 +00:00
int i = 0 ;
foreach ( Linedef l in lines )
{
if ( l . Back ! = null )
{
2015-01-26 08:53:05 +00:00
float oldX = linedefprops [ i ] . Back ! = null ? linedefprops [ i ] . Back . OffsetTopX : 0f ;
float oldY = linedefprops [ i ] . Back ! = null ? linedefprops [ i ] . Back . OffsetTopY : 0f ;
2014-09-15 14:12:31 +00:00
pfcBackOffsetTop . ApplyTo ( l . Back . Fields , General . Map . FormatInterface . MinTextureOffset , General . Map . FormatInterface . MaxTextureOffset , oldX , oldY ) ;
}
i + + ;
}
General . Map . IsChanged = true ;
if ( OnValuesChanged ! = null ) OnValuesChanged ( this , EventArgs . Empty ) ;
}
private void pfcBackOffsetMid_OnValuesChanged ( object sender , EventArgs e )
{
if ( preventchanges ) return ;
2015-01-26 08:53:05 +00:00
MakeUndo ( ) ; //mxd
2014-09-15 14:12:31 +00:00
int i = 0 ;
foreach ( Linedef l in lines )
{
if ( l . Back ! = null )
{
2015-01-26 08:53:05 +00:00
float oldX = linedefprops [ i ] . Back ! = null ? linedefprops [ i ] . Back . OffsetMidX : 0f ;
float oldY = linedefprops [ i ] . Back ! = null ? linedefprops [ i ] . Back . OffsetMidY : 0f ;
2014-09-15 14:12:31 +00:00
pfcBackOffsetMid . ApplyTo ( l . Back . Fields , General . Map . FormatInterface . MinTextureOffset , General . Map . FormatInterface . MaxTextureOffset , oldX , oldY ) ;
}
i + + ;
}
General . Map . IsChanged = true ;
if ( OnValuesChanged ! = null ) OnValuesChanged ( this , EventArgs . Empty ) ;
}
private void pfcBackOffsetBottom_OnValuesChanged ( object sender , EventArgs e )
{
if ( preventchanges ) return ;
2015-01-26 08:53:05 +00:00
MakeUndo ( ) ; //mxd
2014-09-15 14:12:31 +00:00
int i = 0 ;
foreach ( Linedef l in lines )
{
if ( l . Back ! = null )
{
2015-01-26 08:53:05 +00:00
float oldX = linedefprops [ i ] . Back ! = null ? linedefprops [ i ] . Back . OffsetBottomX : 0f ;
float oldY = linedefprops [ i ] . Back ! = null ? linedefprops [ i ] . Back . OffsetBottomY : 0f ;
2014-09-15 14:12:31 +00:00
pfcBackOffsetBottom . ApplyTo ( l . Back . Fields , General . Map . FormatInterface . MinTextureOffset , General . Map . FormatInterface . MaxTextureOffset , oldX , oldY ) ;
}
i + + ;
}
General . Map . IsChanged = true ;
if ( OnValuesChanged ! = null ) OnValuesChanged ( this , EventArgs . Empty ) ;
}
#endregion
#region Scale changed
private void pfcFrontScaleTop_OnValuesChanged ( object sender , EventArgs e )
{
if ( preventchanges ) return ;
2015-01-26 08:53:05 +00:00
MakeUndo ( ) ; //mxd
2014-09-15 14:12:31 +00:00
int i = 0 ;
foreach ( Linedef l in lines )
{
if ( l . Front ! = null )
{
2015-01-26 08:53:05 +00:00
float oldX = linedefprops [ i ] . Front ! = null ? linedefprops [ i ] . Front . ScaleTopX : 1.0f ;
float oldY = linedefprops [ i ] . Front ! = null ? linedefprops [ i ] . Front . ScaleTopY : 1.0f ;
2014-09-15 14:12:31 +00:00
pfcFrontScaleTop . ApplyTo ( l . Front . Fields , General . Map . FormatInterface . MinTextureOffset , General . Map . FormatInterface . MaxTextureOffset , oldX , oldY ) ;
}
i + + ;
}
General . Map . IsChanged = true ;
if ( OnValuesChanged ! = null ) OnValuesChanged ( this , EventArgs . Empty ) ;
}
private void pfcFrontScaleMid_OnValuesChanged ( object sender , EventArgs e )
{
if ( preventchanges ) return ;
2015-01-26 08:53:05 +00:00
MakeUndo ( ) ; //mxd
2014-09-15 14:12:31 +00:00
int i = 0 ;
foreach ( Linedef l in lines )
{
if ( l . Front ! = null )
{
2015-01-26 08:53:05 +00:00
float oldX = linedefprops [ i ] . Front ! = null ? linedefprops [ i ] . Front . ScaleMidX : 1.0f ;
float oldY = linedefprops [ i ] . Front ! = null ? linedefprops [ i ] . Front . ScaleMidY : 1.0f ;
2014-09-15 14:12:31 +00:00
pfcFrontScaleMid . ApplyTo ( l . Front . Fields , General . Map . FormatInterface . MinTextureOffset , General . Map . FormatInterface . MaxTextureOffset , oldX , oldY ) ;
}
i + + ;
}
General . Map . IsChanged = true ;
if ( OnValuesChanged ! = null ) OnValuesChanged ( this , EventArgs . Empty ) ;
}
private void pfcFrontScaleBottom_OnValuesChanged ( object sender , EventArgs e )
{
if ( preventchanges ) return ;
2015-01-26 08:53:05 +00:00
MakeUndo ( ) ; //mxd
2014-09-15 14:12:31 +00:00
int i = 0 ;
foreach ( Linedef l in lines )
{
if ( l . Front ! = null )
{
2015-01-26 08:53:05 +00:00
float oldX = linedefprops [ i ] . Front ! = null ? linedefprops [ i ] . Front . ScaleBottomX : 1.0f ;
float oldY = linedefprops [ i ] . Front ! = null ? linedefprops [ i ] . Front . ScaleBottomY : 1.0f ;
2014-09-15 14:12:31 +00:00
pfcFrontScaleBottom . ApplyTo ( l . Front . Fields , General . Map . FormatInterface . MinTextureOffset , General . Map . FormatInterface . MaxTextureOffset , oldX , oldY ) ;
}
i + + ;
}
General . Map . IsChanged = true ;
if ( OnValuesChanged ! = null ) OnValuesChanged ( this , EventArgs . Empty ) ;
}
private void pfcBackScaleTop_OnValuesChanged ( object sender , EventArgs e )
{
if ( preventchanges ) return ;
2015-01-26 08:53:05 +00:00
MakeUndo ( ) ; //mxd
2014-09-15 14:12:31 +00:00
int i = 0 ;
foreach ( Linedef l in lines )
{
if ( l . Back ! = null )
{
2015-01-26 08:53:05 +00:00
float oldX = linedefprops [ i ] . Back ! = null ? linedefprops [ i ] . Back . ScaleTopX : 1.0f ;
float oldY = linedefprops [ i ] . Back ! = null ? linedefprops [ i ] . Back . ScaleTopY : 1.0f ;
2014-09-15 14:12:31 +00:00
pfcBackScaleTop . ApplyTo ( l . Back . Fields , General . Map . FormatInterface . MinTextureOffset , General . Map . FormatInterface . MaxTextureOffset , oldX , oldY ) ;
}
i + + ;
}
General . Map . IsChanged = true ;
if ( OnValuesChanged ! = null ) OnValuesChanged ( this , EventArgs . Empty ) ;
}
private void pfcBackScaleMid_OnValuesChanged ( object sender , EventArgs e )
{
if ( preventchanges ) return ;
2015-01-26 08:53:05 +00:00
MakeUndo ( ) ; //mxd
2014-09-15 14:12:31 +00:00
int i = 0 ;
foreach ( Linedef l in lines )
{
if ( l . Back ! = null )
{
2015-01-26 08:53:05 +00:00
float oldX = linedefprops [ i ] . Back ! = null ? linedefprops [ i ] . Back . ScaleMidX : 1.0f ;
float oldY = linedefprops [ i ] . Back ! = null ? linedefprops [ i ] . Back . ScaleMidY : 1.0f ;
2014-09-15 14:12:31 +00:00
pfcBackScaleMid . ApplyTo ( l . Back . Fields , General . Map . FormatInterface . MinTextureOffset , General . Map . FormatInterface . MaxTextureOffset , oldX , oldY ) ;
}
i + + ;
}
General . Map . IsChanged = true ;
if ( OnValuesChanged ! = null ) OnValuesChanged ( this , EventArgs . Empty ) ;
}
private void pfcBackScaleBottom_OnValuesChanged ( object sender , EventArgs e )
{
if ( preventchanges ) return ;
2015-01-26 08:53:05 +00:00
MakeUndo ( ) ; //mxd
2014-09-15 14:12:31 +00:00
int i = 0 ;
foreach ( Linedef l in lines )
{
if ( l . Back ! = null )
{
2015-01-26 08:53:05 +00:00
float oldX = linedefprops [ i ] . Back ! = null ? linedefprops [ i ] . Back . ScaleBottomX : 1.0f ;
float oldY = linedefprops [ i ] . Back ! = null ? linedefprops [ i ] . Back . ScaleBottomY : 1.0f ;
2014-09-15 14:12:31 +00:00
pfcBackScaleBottom . ApplyTo ( l . Back . Fields , General . Map . FormatInterface . MinTextureOffset , General . Map . FormatInterface . MaxTextureOffset , oldX , oldY ) ;
}
i + + ;
}
General . Map . IsChanged = true ;
if ( OnValuesChanged ! = null ) OnValuesChanged ( this , EventArgs . Empty ) ;
}
#endregion
#region Flags cahnged
private void flagsFront_OnValueChanged ( object sender , EventArgs e )
{
if ( preventchanges ) return ;
2015-01-26 08:53:05 +00:00
MakeUndo ( ) ; //mxd
2014-09-15 14:12:31 +00:00
int i = 0 ;
foreach ( Linedef l in lines )
{
if ( l . Front = = null ) continue ;
// Apply all flags
foreach ( CheckBox c in flagsFront . Checkboxes )
{
if ( c . CheckState = = CheckState . Checked )
l . Front . SetFlag ( c . Tag . ToString ( ) , true ) ;
else if ( c . CheckState = = CheckState . Unchecked )
l . Front . SetFlag ( c . Tag . ToString ( ) , false ) ;
2015-01-26 08:53:05 +00:00
else if ( linedefprops [ i ] . Front . Flags . ContainsKey ( c . Tag . ToString ( ) ) )
l . Front . SetFlag ( c . Tag . ToString ( ) , linedefprops [ i ] . Front . Flags [ c . Tag . ToString ( ) ] ) ;
2014-09-15 14:12:31 +00:00
else //linedefs created in the editor have empty Flags by default
l . Front . SetFlag ( c . Tag . ToString ( ) , false ) ;
}
i + + ;
}
General . Map . IsChanged = true ;
if ( OnValuesChanged ! = null ) OnValuesChanged ( this , EventArgs . Empty ) ;
}
private void flagsBack_OnValueChanged ( object sender , EventArgs e )
{
if ( preventchanges ) return ;
2015-01-26 08:53:05 +00:00
MakeUndo ( ) ; //mxd
2014-09-15 14:12:31 +00:00
int i = 0 ;
foreach ( Linedef l in lines )
{
if ( l . Back = = null ) continue ;
// Apply all flags
foreach ( CheckBox c in flagsBack . Checkboxes )
{
if ( c . CheckState = = CheckState . Checked )
l . Back . SetFlag ( c . Tag . ToString ( ) , true ) ;
else if ( c . CheckState = = CheckState . Unchecked )
l . Back . SetFlag ( c . Tag . ToString ( ) , false ) ;
2015-01-26 08:53:05 +00:00
else if ( linedefprops [ i ] . Back . Flags . ContainsKey ( c . Tag . ToString ( ) ) )
l . Back . SetFlag ( c . Tag . ToString ( ) , linedefprops [ i ] . Back . Flags [ c . Tag . ToString ( ) ] ) ;
2014-09-15 14:12:31 +00:00
else //linedefs created in the editor have empty Flags by default
l . Back . SetFlag ( c . Tag . ToString ( ) , false ) ;
}
i + + ;
}
General . Map . IsChanged = true ;
if ( OnValuesChanged ! = null ) OnValuesChanged ( this , EventArgs . Empty ) ;
}
#endregion
#endregion
}
}