2014-10-17 11:55:08 +00:00
#region = = = = = = = = = = = = = = = = = = Namespaces
using System ;
2013-06-25 12:35:13 +00:00
using System.Collections.Generic ;
2013-11-21 10:53:11 +00:00
using System.Drawing ;
2013-06-25 12:35:13 +00:00
using System.Windows.Forms ;
2014-10-17 11:55:08 +00:00
using CodeImp.DoomBuilder.Controls ;
using CodeImp.DoomBuilder.Geometry ;
2013-06-25 12:35:13 +00:00
using CodeImp.DoomBuilder.Map ;
using CodeImp.DoomBuilder.Types ;
2014-10-17 11:55:08 +00:00
#endregion
2013-06-25 12:35:13 +00:00
namespace CodeImp.DoomBuilder.Windows
{
2013-07-10 08:59:17 +00:00
internal partial class SectorEditFormUDMF : DelayedForm
2013-06-25 12:35:13 +00:00
{
2013-07-09 13:13:00 +00:00
#region = = = = = = = = = = = = = = = = = = Events
public event EventHandler OnValuesChanged ; //mxd
#endregion
2015-02-14 18:15:11 +00:00
#region = = = = = = = = = = = = = = = = = = Constants
private const string NO_SOUND_SEQUENCE = "None" ; //mxd
Added, Sector Edit window, UDMF: added UI for sector damage-realted properties.
Added, DECORATE parser: damage types are now parsed.
Added: the editor now reports duplicate textures/flats/patches/sprites/colormaps/voxels in the loaded wads.
Added, all text parsers: added #region/#endregion support.
Added TERRAIN parser.
Added, Script Editor: added special handling for DECORATE special comments.
Added, Sector Edit window, UDMF: Soundsequence value was setup incorrectly when showing the window for multiple sectors with mixed Soundsequence value.
Fixed, Map Options window: "Strictly load patches between P_START and P_END" was not applied when applying the changes.
Fixed, MAPINFO parser: MapInfo should be treated as defined when a map MAPINFO block corresponding to current map is encountered even if it doesn't define any properties recognized by the editor.
Fixed, all text parsers: in some cases error line was calculated incorrectly when reporting an error detected by a text parser.
Cosmetic: changed ' to " in the rest of Error and Warning messages.
Internal: added text resource tracking.
Updated ZDoom_DECORATE.cfg.
Updated documentation ("Game Configuration - Basic Settings" page).
2016-02-22 12:33:19 +00:00
private const string NO_TERRAIN = "Default" ; //mxd
private const string NO_DAMAGETYPE = "None" ; //mxd
2015-02-14 18:15:11 +00:00
#endregion
2013-07-09 13:13:00 +00:00
#region = = = = = = = = = = = = = = = = = = Variables
2013-06-25 12:35:13 +00:00
private ICollection < Sector > sectors ;
2014-08-25 11:15:19 +00:00
private Dictionary < Sector , SectorProperties > sectorprops ; //mxd
2015-01-26 08:53:05 +00:00
private bool preventchanges ; //mxd
private bool undocreated ; //mxd
2014-08-25 11:15:19 +00:00
private StepsList anglesteps ; //mxd
2014-12-04 10:06:44 +00:00
private readonly string [ ] renderstyles ; //mxd
2013-07-19 15:30:58 +00:00
2013-11-21 10:53:11 +00:00
//mxd. Persistent settings
2013-07-19 15:30:58 +00:00
private static bool linkCeilingScale ;
private static bool linkFloorScale ;
2013-08-12 10:15:08 +00:00
private static bool useFloorLineAngles ;
private static bool useCeilLineAngles ;
2014-08-25 11:15:19 +00:00
private static bool useFloorSlopeLineAngles ;
private static bool useCeilSlopeLineAngles ;
2014-10-17 11:55:08 +00:00
private static SlopePivotMode ceilpivotmode = SlopePivotMode . LOCAL ;
private static SlopePivotMode floorpivotmode = SlopePivotMode . LOCAL ;
2013-07-19 15:30:58 +00:00
2013-11-21 10:53:11 +00:00
//mxd. Window setup stuff
private static Point location = Point . Empty ;
2014-08-25 11:15:19 +00:00
private static int activetab ;
2014-08-05 08:22:49 +00:00
//mxd. Slope pivots
2014-10-17 11:55:08 +00:00
private Vector2D globalslopepivot ;
private Dictionary < Sector , Vector2D > slopepivots ;
2014-08-25 11:15:19 +00:00
#endregion
#region = = = = = = = = = = = = = = = = = = Structs
2014-08-05 08:22:49 +00:00
2013-07-19 15:30:58 +00:00
private struct SectorProperties //mxd
{
2014-05-05 14:24:57 +00:00
public readonly int Brightness ;
public readonly int FloorHeight ;
public readonly int CeilHeight ;
public readonly string FloorTexture ;
public readonly string CeilTexture ;
2013-07-19 15:30:58 +00:00
//UDMF stuff
2014-05-05 14:24:57 +00:00
public readonly int LightColor ;
public readonly int FadeColor ;
2013-07-19 15:30:58 +00:00
//public float Desaturation;
//UDMF Ceiling
2014-05-05 14:24:57 +00:00
public readonly float CeilOffsetX ;
public readonly float CeilOffsetY ;
public readonly float CeilScaleX ;
public readonly float CeilScaleY ;
2013-07-19 15:30:58 +00:00
//public float CeilAlpha;
2014-05-05 14:24:57 +00:00
public readonly float CeilRotation ;
public readonly int CeilBrightness ;
public readonly bool CeilLightAbsoulte ;
2013-07-19 15:30:58 +00:00
//UDMF Floor
2014-05-05 14:24:57 +00:00
public readonly float FloorOffsetX ;
public readonly float FloorOffsetY ;
public readonly float FloorScaleX ;
public readonly float FloorScaleY ;
2013-07-19 15:30:58 +00:00
//public float FloorAlpha;
2014-05-05 14:24:57 +00:00
public readonly float FloorRotation ;
public readonly int FloorBrightness ;
public readonly bool FloorLightAbsoulte ;
2013-07-19 15:30:58 +00:00
2014-08-25 11:15:19 +00:00
//UDMF slopes. Angles are in degrees
2014-10-17 11:55:08 +00:00
public readonly Vector3D FloorSlope ;
public readonly Vector3D CeilSlope ;
2014-08-25 11:15:19 +00:00
public readonly float FloorSlopeAngleXY ;
public readonly float FloorSlopeAngleZ ;
2014-08-05 08:22:49 +00:00
public readonly float FloorSlopeOffset ;
2014-10-17 11:55:08 +00:00
public readonly float CeilSlopeAngleXY ;
public readonly float CeilSlopeAngleZ ;
public readonly float CeilSlopeOffset ;
2014-08-05 08:22:49 +00:00
2014-10-17 11:55:08 +00:00
public SectorProperties ( Sector s )
{
2013-07-19 15:30:58 +00:00
Brightness = s . Brightness ;
FloorHeight = s . FloorHeight ;
CeilHeight = s . CeilHeight ;
FloorTexture = s . FloorTexture ;
CeilTexture = s . CeilTexture ;
//UDMF stuff
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
LightColor = UniFields . GetInteger ( s . Fields , "lightcolor" , 16777215 ) ;
FadeColor = UniFields . GetInteger ( s . Fields , "fadecolor" , 0 ) ;
2013-07-19 15:30:58 +00:00
//UDMF Ceiling
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
CeilOffsetX = UniFields . GetFloat ( s . Fields , "xpanningceiling" , 0f ) ;
CeilOffsetY = UniFields . GetFloat ( s . Fields , "ypanningceiling" , 0f ) ;
CeilScaleX = UniFields . GetFloat ( s . Fields , "xscaleceiling" , 1.0f ) ;
CeilScaleY = UniFields . GetFloat ( s . Fields , "yscaleceiling" , 1.0f ) ;
//CeilAlpha = UniFields.GetFloat(s.Fields, "alphaceiling", 1.0f);
2013-07-19 15:30:58 +00:00
CeilRotation = s . Fields . GetValue ( "rotationceiling" , 0.0f ) ;
CeilBrightness = s . Fields . GetValue ( "lightceiling" , 0 ) ;
CeilLightAbsoulte = s . Fields . GetValue ( "lightceilingabsolute" , false ) ;
//UDMF Floor
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
FloorOffsetX = UniFields . GetFloat ( s . Fields , "xpanningfloor" , 0f ) ;
FloorOffsetY = UniFields . GetFloat ( s . Fields , "ypanningfloor" , 0f ) ;
FloorScaleX = UniFields . GetFloat ( s . Fields , "xscalefloor" , 1.0f ) ;
FloorScaleY = UniFields . GetFloat ( s . Fields , "yscalefloor" , 1.0f ) ;
//FloorAlpha = UniFields.GetFloat(s.Fields, "alphafloor", 1.0f);
2013-07-19 15:30:58 +00:00
FloorRotation = s . Fields . GetValue ( "rotationfloor" , 0.0f ) ;
FloorBrightness = s . Fields . GetValue ( "lightfloor" , 0 ) ;
FloorLightAbsoulte = s . Fields . GetValue ( "lightfloorabsolute" , false ) ;
2014-08-05 08:22:49 +00:00
2014-08-25 11:15:19 +00:00
//UDMF slopes
2015-12-28 15:01:53 +00:00
if ( s . FloorSlope . GetLengthSq ( ) > 0 )
2014-10-17 11:55:08 +00:00
{
FloorSlopeAngleXY = General . ClampAngle ( ( float ) Math . Round ( Angle2D . RadToDeg ( s . FloorSlope . GetAngleXY ( ) ) - 180 , 1 ) ) ;
FloorSlopeAngleZ = - ( float ) Math . Round ( Angle2D . RadToDeg ( s . FloorSlope . GetAngleZ ( ) ) - 90 , 1 ) ;
FloorSlopeOffset = ( float . IsNaN ( s . FloorSlopeOffset ) ? s . FloorHeight : s . FloorSlopeOffset ) ;
}
else
{
2014-08-25 11:15:19 +00:00
FloorSlopeAngleXY = 0 ;
FloorSlopeAngleZ = 0 ;
2014-10-17 11:55:08 +00:00
FloorSlopeOffset = - s . FloorHeight ;
2014-08-25 11:15:19 +00:00
}
2014-10-17 11:55:08 +00:00
FloorSlope = s . FloorSlope ;
2015-12-28 15:01:53 +00:00
if ( s . CeilSlope . GetLengthSq ( ) > 0 )
2014-10-17 11:55:08 +00:00
{
CeilSlopeAngleXY = General . ClampAngle ( ( float ) Math . Round ( Angle2D . RadToDeg ( s . CeilSlope . GetAngleXY ( ) ) - 180 , 1 ) ) ;
CeilSlopeAngleZ = - ( float ) Math . Round ( 270 - Angle2D . RadToDeg ( s . CeilSlope . GetAngleZ ( ) ) , 1 ) ;
CeilSlopeOffset = ( float . IsNaN ( s . CeilSlopeOffset ) ? s . CeilHeight : s . CeilSlopeOffset ) ;
}
else
{
CeilSlopeAngleXY = 0 ;
CeilSlopeAngleZ = 0 ;
CeilSlopeOffset = s . CeilHeight ;
2014-08-25 11:15:19 +00:00
}
2014-10-17 11:55:08 +00:00
CeilSlope = s . CeilSlope ;
2013-07-19 15:30:58 +00:00
}
}
2013-07-09 13:13:00 +00:00
#endregion
#region = = = = = = = = = = = = = = = = = = Constructor
2014-10-17 11:55:08 +00:00
public SectorEditFormUDMF ( )
{
2013-06-25 12:35:13 +00:00
InitializeComponent ( ) ;
2013-11-21 10:53:11 +00:00
//mxd. Widow setup
2014-10-17 11:55:08 +00:00
if ( location ! = Point . Empty )
{
2013-11-21 10:53:11 +00:00
this . StartPosition = FormStartPosition . Manual ;
this . Location = location ;
2015-04-15 07:41:18 +00:00
if ( General . Settings . StoreSelectedEditTab & & activetab > 0 ) tabs . SelectTab ( activetab ) ;
2013-11-21 10:53:11 +00:00
}
2013-07-10 08:59:17 +00:00
// Fill flags list
foreach ( KeyValuePair < string , string > lf in General . Map . Config . SectorFlags )
flags . Add ( lf . Value , lf . Key ) ;
2014-12-04 10:06:44 +00:00
flags . Enabled = General . Map . Config . SectorFlags . Count > 0 ;
2013-07-10 08:59:17 +00:00
2014-12-04 10:06:44 +00:00
// Setup renderstyles
renderstyles = new string [ General . Map . Config . SectorRenderStyles . Count ] ;
General . Map . Config . SectorRenderStyles . Keys . CopyTo ( renderstyles , 0 ) ;
floorRenderStyle . Enabled = ( General . Map . Config . SectorRenderStyles . Count > 0 ) ;
labelfloorrenderstyle . Enabled = ( General . Map . Config . SectorRenderStyles . Count > 0 ) ;
ceilRenderStyle . Enabled = ( General . Map . Config . SectorRenderStyles . Count > 0 ) ;
labelceilrenderstyle . Enabled = ( General . Map . Config . SectorRenderStyles . Count > 0 ) ;
// Fill renderstyles
2014-10-17 11:55:08 +00:00
foreach ( KeyValuePair < string , string > lf in General . Map . Config . SectorRenderStyles )
{
2014-05-05 14:24:57 +00:00
floorRenderStyle . Items . Add ( lf . Value ) ;
ceilRenderStyle . Items . Add ( lf . Value ) ;
}
2013-06-25 12:35:13 +00:00
// Fill effects list
2014-09-04 12:34:26 +00:00
effect . GeneralizedOptions = General . Map . Config . GenEffectOptions ; //mxd
2013-06-25 12:35:13 +00:00
effect . AddInfo ( General . Map . Config . SortedSectorEffects . ToArray ( ) ) ;
2015-05-28 13:45:01 +00:00
// Fill sound sequences list
soundsequence . Items . Add ( NO_SOUND_SEQUENCE ) ;
Added, Sector Edit window, UDMF: added UI for sector damage-realted properties.
Added, DECORATE parser: damage types are now parsed.
Added: the editor now reports duplicate textures/flats/patches/sprites/colormaps/voxels in the loaded wads.
Added, all text parsers: added #region/#endregion support.
Added TERRAIN parser.
Added, Script Editor: added special handling for DECORATE special comments.
Added, Sector Edit window, UDMF: Soundsequence value was setup incorrectly when showing the window for multiple sectors with mixed Soundsequence value.
Fixed, Map Options window: "Strictly load patches between P_START and P_END" was not applied when applying the changes.
Fixed, MAPINFO parser: MapInfo should be treated as defined when a map MAPINFO block corresponding to current map is encountered even if it doesn't define any properties recognized by the editor.
Fixed, all text parsers: in some cases error line was calculated incorrectly when reporting an error detected by a text parser.
Cosmetic: changed ' to " in the rest of Error and Warning messages.
Internal: added text resource tracking.
Updated ZDoom_DECORATE.cfg.
Updated documentation ("Game Configuration - Basic Settings" page).
2016-02-22 12:33:19 +00:00
soundsequence . Items . AddRange ( General . Map . Data . SoundSequences ) ;
// Fill damagetype list
damagetype . Items . Add ( NO_DAMAGETYPE ) ;
damagetype . Items . AddRange ( General . Map . Data . DamageTypes ) ;
// Fill terrain type lists
ceilterrain . Items . Add ( NO_TERRAIN ) ;
ceilterrain . Items . AddRange ( General . Map . Data . TerrainNames ) ;
floorterrain . Items . Add ( NO_TERRAIN ) ;
floorterrain . Items . AddRange ( General . Map . Data . TerrainNames ) ;
2015-05-28 13:45:01 +00:00
2013-08-08 11:04:13 +00:00
// Initialize custom fields editor
fieldslist . Setup ( "sector" ) ;
2013-06-25 12:35:13 +00:00
// Fill universal fields list
fieldslist . ListFixedFields ( General . Map . Config . SectorFields ) ;
// Initialize image selectors
floortex . Initialize ( ) ;
ceilingtex . Initialize ( ) ;
// Set steps for brightness field
brightness . StepValues = General . Map . Config . BrightnessLevels ;
2013-07-19 15:30:58 +00:00
// Value linking
ceilScale . LinkValues = linkCeilingScale ;
floorScale . LinkValues = linkFloorScale ;
2013-08-12 10:15:08 +00:00
cbUseCeilLineAngles . Checked = useCeilLineAngles ;
cbUseFloorLineAngles . Checked = useFloorLineAngles ;
2014-08-05 08:22:49 +00:00
2014-08-25 11:15:19 +00:00
floorslopecontrol . UseLineAngles = useFloorSlopeLineAngles ;
ceilingslopecontrol . UseLineAngles = useCeilSlopeLineAngles ;
2014-10-17 11:55:08 +00:00
floorslopecontrol . PivotMode = floorpivotmode ;
ceilingslopecontrol . PivotMode = ceilpivotmode ;
2013-06-25 12:35:13 +00:00
}
2013-07-09 13:13:00 +00:00
#endregion
#region = = = = = = = = = = = = = = = = = = Methods
2013-06-25 12:35:13 +00:00
// This sets up the form to edit the given sectors
2014-10-17 11:55:08 +00:00
public void Setup ( ICollection < Sector > sectors )
{
2015-01-26 08:53:05 +00:00
preventchanges = true ; //mxd
2013-06-25 12:35:13 +00:00
// Keep this list
this . sectors = sectors ;
if ( sectors . Count > 1 ) this . Text = "Edit Sectors (" + sectors . Count + ")" ;
2014-08-25 11:15:19 +00:00
sectorprops = new Dictionary < Sector , SectorProperties > ( sectors . Count ) ; //mxd
2013-07-19 15:30:58 +00:00
2014-09-13 21:57:56 +00:00
//mxd. Set default height offset
heightoffset . Text = "0" ;
2014-10-17 11:55:08 +00:00
CreateHelperProps ( sectors ) ; //mxd
2013-06-25 12:35:13 +00:00
////////////////////////////////////////////////////////////////////////
// Set all options to the first sector properties
////////////////////////////////////////////////////////////////////////
// Get first sector
2013-07-19 15:30:58 +00:00
Sector sc = General . GetByIndex ( sectors , 0 ) ;
2013-06-25 12:35:13 +00:00
2013-07-10 08:59:17 +00:00
// Flags
foreach ( CheckBox c in flags . Checkboxes )
if ( sc . Flags . ContainsKey ( c . Tag . ToString ( ) ) ) c . Checked = sc . Flags [ c . Tag . ToString ( ) ] ;
2013-06-25 12:35:13 +00:00
// Effects
effect . Value = sc . Effect ;
brightness . Text = sc . Brightness . ToString ( ) ;
// Floor/ceiling
floorheight . Text = sc . FloorHeight . ToString ( ) ;
ceilingheight . Text = sc . CeilHeight . ToString ( ) ;
floortex . TextureName = sc . FloorTexture ;
ceilingtex . TextureName = sc . CeilTexture ;
//UDMF stuff
//Texture offsets
2013-07-19 15:30:58 +00:00
ceilOffsets . SetValuesFrom ( sc . Fields , true ) ;
floorOffsets . SetValuesFrom ( sc . Fields , true ) ;
2013-06-25 12:35:13 +00:00
//Texture scale
2013-07-19 15:30:58 +00:00
ceilScale . SetValuesFrom ( sc . Fields , true ) ;
floorScale . SetValuesFrom ( sc . Fields , true ) ;
2013-06-25 12:35:13 +00:00
//Texture rotation
float ceilAngle = sc . Fields . GetValue ( "rotationceiling" , 0.0f ) ;
float floorAngle = sc . Fields . GetValue ( "rotationfloor" , 0.0f ) ;
ceilRotation . Text = ceilAngle . ToString ( ) ;
floorRotation . Text = floorAngle . ToString ( ) ;
ceilAngleControl . Angle = General . ClampAngle ( 360 - ( int ) ceilAngle ) ;
floorAngleControl . Angle = General . ClampAngle ( 360 - ( int ) floorAngle ) ;
//Texture brightness
ceilBrightness . Text = sc . Fields . GetValue ( "lightceiling" , 0 ) . ToString ( ) ;
floorBrightness . Text = sc . Fields . GetValue ( "lightfloor" , 0 ) . ToString ( ) ;
2013-07-19 15:30:58 +00:00
ceilLightAbsolute . Checked = sc . Fields . GetValue ( "lightceilingabsolute" , false ) ;
floorLightAbsolute . Checked = sc . Fields . GetValue ( "lightfloorabsolute" , false ) ;
2013-06-25 12:35:13 +00:00
//Alpha
ceilAlpha . Text = General . Clamp ( sc . Fields . GetValue ( "alphaceiling" , 1.0f ) , 0f , 1f ) . ToString ( ) ;
floorAlpha . Text = General . Clamp ( sc . Fields . GetValue ( "alphafloor" , 1.0f ) , 0f , 1f ) . ToString ( ) ;
//Render style
2014-12-04 10:06:44 +00:00
ceilRenderStyle . SelectedIndex = Array . IndexOf ( renderstyles , sc . Fields . GetValue ( "renderstyleceiling" , "translucent" ) ) ;
floorRenderStyle . SelectedIndex = Array . IndexOf ( renderstyles , sc . Fields . GetValue ( "renderstylefloor" , "translucent" ) ) ;
2013-06-25 12:35:13 +00:00
Added, Sector Edit window, UDMF: added UI for sector damage-realted properties.
Added, DECORATE parser: damage types are now parsed.
Added: the editor now reports duplicate textures/flats/patches/sprites/colormaps/voxels in the loaded wads.
Added, all text parsers: added #region/#endregion support.
Added TERRAIN parser.
Added, Script Editor: added special handling for DECORATE special comments.
Added, Sector Edit window, UDMF: Soundsequence value was setup incorrectly when showing the window for multiple sectors with mixed Soundsequence value.
Fixed, Map Options window: "Strictly load patches between P_START and P_END" was not applied when applying the changes.
Fixed, MAPINFO parser: MapInfo should be treated as defined when a map MAPINFO block corresponding to current map is encountered even if it doesn't define any properties recognized by the editor.
Fixed, all text parsers: in some cases error line was calculated incorrectly when reporting an error detected by a text parser.
Cosmetic: changed ' to " in the rest of Error and Warning messages.
Internal: added text resource tracking.
Updated ZDoom_DECORATE.cfg.
Updated documentation ("Game Configuration - Basic Settings" page).
2016-02-22 12:33:19 +00:00
//Damage
damagetype . Text = sc . Fields . GetValue ( "damagetype" , NO_DAMAGETYPE ) ;
damageamount . Text = sc . Fields . GetValue ( "damageamount" , 0 ) . ToString ( ) ;
damageinterval . Text = sc . Fields . GetValue ( "damageinterval" , 32 ) . ToString ( ) ;
leakiness . Text = General . Clamp ( sc . Fields . GetValue ( "leakiness" , 0 ) , 0 , 256 ) . ToString ( ) ;
//Terrain
ceilterrain . Text = sc . Fields . GetValue ( "ceilingterrain" , NO_TERRAIN ) ;
floorterrain . Text = sc . Fields . GetValue ( "floorterrain" , NO_TERRAIN ) ;
2013-06-25 12:35:13 +00:00
//Misc
2015-02-14 18:15:11 +00:00
soundsequence . Text = sc . Fields . GetValue ( "soundsequence" , NO_SOUND_SEQUENCE ) ;
2013-06-25 12:35:13 +00:00
gravity . Text = sc . Fields . GetValue ( "gravity" , 1.0f ) . ToString ( ) ;
desaturation . Text = General . Clamp ( sc . Fields . GetValue ( "desaturation" , 0.0f ) , 0f , 1f ) . ToString ( ) ;
//Sector colors
fadeColor . SetValueFrom ( sc . Fields ) ;
lightColor . SetValueFrom ( sc . Fields ) ;
2014-08-05 08:22:49 +00:00
//Slopes
2014-10-17 11:55:08 +00:00
SetupFloorSlope ( sc , true ) ;
SetupCeilingSlope ( sc , true ) ;
2014-08-05 08:22:49 +00:00
2013-06-25 12:35:13 +00:00
// Action
2015-07-27 21:35:42 +00:00
tagsselector . Setup ( UniversalType . SectorTag ) ; //mxd
tagsselector . SetValue ( sc . Tags , true ) ; //mxd
2013-06-25 12:35:13 +00:00
// Custom fields
fieldslist . SetValues ( sc . Fields , true ) ;
2015-07-14 23:34:31 +00:00
//mxd. Comments
commenteditor . SetValues ( sc . Fields , true ) ;
2014-08-25 11:15:19 +00:00
anglesteps = new StepsList ( ) ;
2013-08-12 10:15:08 +00:00
2013-06-25 12:35:13 +00:00
////////////////////////////////////////////////////////////////////////
// Now go for all sectors and change the options when a setting is different
////////////////////////////////////////////////////////////////////////
// Go for all sectors
2014-10-17 11:55:08 +00:00
foreach ( Sector s in sectors )
{
2013-07-10 08:59:17 +00:00
// Flags
2014-10-17 11:55:08 +00:00
foreach ( CheckBox c in flags . Checkboxes )
{
2014-08-05 08:22:49 +00:00
if ( c . CheckState = = CheckState . Indeterminate ) continue ; //mxd
2014-10-17 11:55:08 +00:00
if ( s . IsFlagSet ( c . Tag . ToString ( ) ) ! = c . Checked )
{
2014-08-05 08:22:49 +00:00
c . ThreeState = true ;
c . CheckState = CheckState . Indeterminate ;
2013-07-10 08:59:17 +00:00
}
}
2013-06-25 12:35:13 +00:00
// Effects
if ( s . Effect ! = effect . Value ) effect . Empty = true ;
if ( s . Brightness . ToString ( ) ! = brightness . Text ) brightness . Text = "" ;
// Floor/Ceiling
if ( s . FloorHeight . ToString ( ) ! = floorheight . Text ) floorheight . Text = "" ;
if ( s . CeilHeight . ToString ( ) ! = ceilingheight . Text ) ceilingheight . Text = "" ;
2015-12-28 15:01:53 +00:00
if ( s . FloorTexture ! = floortex . TextureName )
2014-10-17 11:55:08 +00:00
{
2014-03-05 09:21:28 +00:00
floortex . MultipleTextures = true ; //mxd
floortex . TextureName = "" ;
}
2015-12-28 15:01:53 +00:00
if ( s . CeilTexture ! = ceilingtex . TextureName )
2014-10-17 11:55:08 +00:00
{
2014-03-05 09:21:28 +00:00
ceilingtex . MultipleTextures = true ; //mxd
ceilingtex . TextureName = "" ;
}
2013-06-25 12:35:13 +00:00
//mxd. UDMF stuff
//Texture offsets
2013-07-19 15:30:58 +00:00
ceilOffsets . SetValuesFrom ( s . Fields , false ) ;
floorOffsets . SetValuesFrom ( s . Fields , false ) ;
2013-06-25 12:35:13 +00:00
//Texture scale
2013-07-19 15:30:58 +00:00
ceilScale . SetValuesFrom ( s . Fields , false ) ;
floorScale . SetValuesFrom ( s . Fields , false ) ;
2013-06-25 12:35:13 +00:00
//Texture rotation
2014-10-17 11:55:08 +00:00
if ( s . Fields . GetValue ( "rotationceiling" , 0.0f ) . ToString ( ) ! = ceilRotation . Text )
{
2013-06-25 12:35:13 +00:00
ceilRotation . Text = "" ;
2014-10-17 11:55:08 +00:00
ceilAngleControl . Angle = GZBuilder . Controls . AngleControl . NO_ANGLE ;
2013-06-25 12:35:13 +00:00
}
2014-10-17 11:55:08 +00:00
if ( s . Fields . GetValue ( "rotationfloor" , 0.0f ) . ToString ( ) ! = floorRotation . Text )
{
2013-06-25 12:35:13 +00:00
floorRotation . Text = "" ;
2014-10-17 11:55:08 +00:00
floorAngleControl . Angle = GZBuilder . Controls . AngleControl . NO_ANGLE ;
2013-06-25 12:35:13 +00:00
}
//Texture brightness
if ( s . Fields . GetValue ( "lightceiling" , 0 ) . ToString ( ) ! = ceilBrightness . Text ) ceilBrightness . Text = "" ;
2013-08-08 11:04:13 +00:00
if ( s . Fields . GetValue ( "lightfloor" , 0 ) . ToString ( ) ! = floorBrightness . Text ) floorBrightness . Text = "" ;
2013-07-19 15:30:58 +00:00
2014-10-17 11:55:08 +00:00
if ( s . Fields . GetValue ( "lightceilingabsolute" , false ) ! = ceilLightAbsolute . Checked )
{
2013-07-19 15:30:58 +00:00
ceilLightAbsolute . ThreeState = true ;
ceilLightAbsolute . CheckState = CheckState . Indeterminate ;
}
2014-10-17 11:55:08 +00:00
if ( s . Fields . GetValue ( "lightfloorabsolute" , false ) ! = floorLightAbsolute . Checked )
{
2013-07-19 15:30:58 +00:00
floorLightAbsolute . ThreeState = true ;
floorLightAbsolute . CheckState = CheckState . Indeterminate ;
}
2013-06-25 12:35:13 +00:00
//Alpha
if ( s . Fields . GetValue ( "alphaceiling" , 1.0f ) . ToString ( ) ! = ceilAlpha . Text ) ceilAlpha . Text = "" ;
if ( s . Fields . GetValue ( "alphafloor" , 1.0f ) . ToString ( ) ! = floorAlpha . Text ) floorAlpha . Text = "" ;
//Render style
2014-12-04 10:06:44 +00:00
if ( ceilRenderStyle . SelectedIndex > - 1 & & ceilRenderStyle . SelectedIndex ! = Array . IndexOf ( renderstyles , s . Fields . GetValue ( "renderstyleceiling" , "translucent" ) ) )
ceilRenderStyle . SelectedIndex = - 1 ;
if ( floorRenderStyle . SelectedIndex > - 1 & & floorRenderStyle . SelectedIndex ! = Array . IndexOf ( renderstyles , s . Fields . GetValue ( "renderstylefloor" , "translucent" ) ) )
floorRenderStyle . SelectedIndex = - 1 ;
2013-06-25 12:35:13 +00:00
Added, Sector Edit window, UDMF: added UI for sector damage-realted properties.
Added, DECORATE parser: damage types are now parsed.
Added: the editor now reports duplicate textures/flats/patches/sprites/colormaps/voxels in the loaded wads.
Added, all text parsers: added #region/#endregion support.
Added TERRAIN parser.
Added, Script Editor: added special handling for DECORATE special comments.
Added, Sector Edit window, UDMF: Soundsequence value was setup incorrectly when showing the window for multiple sectors with mixed Soundsequence value.
Fixed, Map Options window: "Strictly load patches between P_START and P_END" was not applied when applying the changes.
Fixed, MAPINFO parser: MapInfo should be treated as defined when a map MAPINFO block corresponding to current map is encountered even if it doesn't define any properties recognized by the editor.
Fixed, all text parsers: in some cases error line was calculated incorrectly when reporting an error detected by a text parser.
Cosmetic: changed ' to " in the rest of Error and Warning messages.
Internal: added text resource tracking.
Updated ZDoom_DECORATE.cfg.
Updated documentation ("Game Configuration - Basic Settings" page).
2016-02-22 12:33:19 +00:00
//Damage
if ( damagetype . SelectedIndex > - 1 & & s . Fields . GetValue ( "damagetype" , NO_DAMAGETYPE ) ! = damagetype . Text )
damagetype . SelectedIndex = - 1 ;
if ( s . Fields . GetValue ( "damageamount" , 0 ) . ToString ( ) ! = damageamount . Text ) damageamount . Text = "" ;
if ( s . Fields . GetValue ( "damageinterval" , 32 ) . ToString ( ) ! = damageinterval . Text ) damageinterval . Text = "" ;
if ( s . Fields . GetValue ( "leakiness" , 0 ) . ToString ( ) ! = leakiness . Text ) leakiness . Text = "" ;
//Terrain
if ( ceilterrain . SelectedIndex > - 1 & & s . Fields . GetValue ( "ceilingterrain" , NO_TERRAIN ) ! = ceilterrain . Text )
ceilterrain . SelectedIndex = - 1 ;
if ( floorterrain . SelectedIndex > - 1 & & s . Fields . GetValue ( "floorterrain" , NO_TERRAIN ) ! = floorterrain . Text )
floorterrain . SelectedIndex = - 1 ;
2013-06-25 12:35:13 +00:00
//Misc
Added, Sector Edit window, UDMF: added UI for sector damage-realted properties.
Added, DECORATE parser: damage types are now parsed.
Added: the editor now reports duplicate textures/flats/patches/sprites/colormaps/voxels in the loaded wads.
Added, all text parsers: added #region/#endregion support.
Added TERRAIN parser.
Added, Script Editor: added special handling for DECORATE special comments.
Added, Sector Edit window, UDMF: Soundsequence value was setup incorrectly when showing the window for multiple sectors with mixed Soundsequence value.
Fixed, Map Options window: "Strictly load patches between P_START and P_END" was not applied when applying the changes.
Fixed, MAPINFO parser: MapInfo should be treated as defined when a map MAPINFO block corresponding to current map is encountered even if it doesn't define any properties recognized by the editor.
Fixed, all text parsers: in some cases error line was calculated incorrectly when reporting an error detected by a text parser.
Cosmetic: changed ' to " in the rest of Error and Warning messages.
Internal: added text resource tracking.
Updated ZDoom_DECORATE.cfg.
Updated documentation ("Game Configuration - Basic Settings" page).
2016-02-22 12:33:19 +00:00
if ( soundsequence . SelectedIndex > - 1 & & s . Fields . GetValue ( "soundsequence" , NO_SOUND_SEQUENCE ) ! = soundsequence . Text )
soundsequence . SelectedIndex = - 1 ;
2013-06-25 12:35:13 +00:00
if ( s . Fields . GetValue ( "gravity" , 1.0f ) . ToString ( ) ! = gravity . Text ) gravity . Text = "" ;
if ( s . Fields . GetValue ( "desaturation" , 0.0f ) . ToString ( ) ! = desaturation . Text ) desaturation . Text = "" ;
//Sector colors
fadeColor . SetValueFrom ( s . Fields ) ;
lightColor . SetValueFrom ( s . Fields ) ;
2014-08-05 08:22:49 +00:00
//Slopes
2014-10-17 11:55:08 +00:00
SetupFloorSlope ( s , false ) ;
SetupCeilingSlope ( s , false ) ;
2014-08-05 08:22:49 +00:00
2013-06-25 12:35:13 +00:00
// Action
2015-07-27 21:35:42 +00:00
tagsselector . SetValue ( s . Tags , false ) ; //mxd
2013-06-25 12:35:13 +00:00
// Custom fields
fieldslist . SetValues ( s . Fields , false ) ;
2013-07-19 15:30:58 +00:00
2015-07-14 23:34:31 +00:00
//mxd. Comments
commenteditor . SetValues ( s . Fields , false ) ;
2013-08-12 10:15:08 +00:00
//mxd. Angle steps
2014-10-17 11:55:08 +00:00
foreach ( Sidedef side in s . Sidedefs )
{
2015-12-28 15:01:53 +00:00
int angle ;
if ( side . Line . Front ! = null & & side . Index = = side . Line . Front . Index )
2013-08-12 10:15:08 +00:00
angle = General . ClampAngle ( 270 - side . Line . AngleDeg ) ;
else
angle = General . ClampAngle ( 90 - side . Line . AngleDeg ) ;
2014-08-25 11:15:19 +00:00
if ( ! anglesteps . Contains ( angle ) ) anglesteps . Add ( angle ) ;
2013-08-12 10:15:08 +00:00
}
2014-08-05 08:22:49 +00:00
}
2014-08-11 08:35:39 +00:00
//mxd. Update slope controls
ceilingslopecontrol . UpdateControls ( ) ;
floorslopecontrol . UpdateControls ( ) ;
2013-06-25 12:35:13 +00:00
// Show sector height
UpdateSectorHeight ( ) ;
2013-07-19 15:30:58 +00:00
2015-01-05 14:56:44 +00:00
//mxd. Update some labels
labelCeilOffsets . Enabled = ceilOffsets . NonDefaultValue ;
labelCeilScale . Enabled = ceilScale . NonDefaultValue ;
labelFloorOffsets . Enabled = floorOffsets . NonDefaultValue ;
labelFloorScale . Enabled = floorScale . NonDefaultValue ;
2015-10-02 14:47:34 +00:00
//mxd. Update brightness reset buttons
resetceillight . Visible = ( ceilLightAbsolute . CheckState ! = CheckState . Unchecked | | ceilBrightness . GetResult ( 0 ) ! = 0 ) ;
resetfloorlight . Visible = ( floorLightAbsolute . CheckState ! = CheckState . Unchecked | | floorBrightness . GetResult ( 0 ) ! = 0 ) ;
2013-08-12 10:15:08 +00:00
//mxd. Angle steps
2014-08-25 11:15:19 +00:00
anglesteps . Sort ( ) ;
if ( useCeilLineAngles ) ceilRotation . StepValues = anglesteps ;
if ( useFloorLineAngles ) floorRotation . StepValues = anglesteps ;
if ( useCeilSlopeLineAngles ) ceilingslopecontrol . StepValues = anglesteps ;
if ( useFloorSlopeLineAngles ) floorslopecontrol . StepValues = anglesteps ;
2013-08-12 10:15:08 +00:00
2015-07-27 21:35:42 +00:00
//mxd. Comments and Tags
2015-07-14 23:34:31 +00:00
commenteditor . FinishSetup ( ) ;
2015-07-27 21:35:42 +00:00
tagsselector . FinishSetup ( ) ;
2015-07-14 23:34:31 +00:00
2015-01-26 08:53:05 +00:00
preventchanges = false ; //mxd
}
//mxd
private void MakeUndo ( )
{
if ( undocreated ) return ;
undocreated = true ;
//mxd. Make undo
General . Map . UndoRedo . CreateUndo ( "Edit " + ( sectors . Count > 1 ? sectors . Count + " sectors" : "sector" ) ) ;
foreach ( Sector s in sectors ) s . Fields . BeforeFieldsChange ( ) ;
2014-08-11 08:35:39 +00:00
}
2014-10-17 11:55:08 +00:00
// mxd
private void CreateHelperProps ( ICollection < Sector > sectors )
{
slopepivots = new Dictionary < Sector , Vector2D > ( sectors . Count ) ;
2015-12-28 15:01:53 +00:00
foreach ( Sector s in sectors )
2014-10-17 11:55:08 +00:00
{
2015-12-29 11:44:32 +00:00
if ( slopepivots . ContainsKey ( s ) ) continue ;
2014-10-17 11:55:08 +00:00
Vector2D pivot = new Vector2D ( s . BBox . X + s . BBox . Width / 2 , s . BBox . Y + s . BBox . Height / 2 ) ;
globalslopepivot + = pivot ;
slopepivots . Add ( s , pivot ) ;
2015-12-29 11:44:32 +00:00
// Store initial properties
2014-10-17 11:55:08 +00:00
sectorprops . Add ( s , new SectorProperties ( s ) ) ;
}
globalslopepivot / = sectors . Count ;
}
2013-06-25 12:35:13 +00:00
// This updates the sector height field
2014-10-17 11:55:08 +00:00
private void UpdateSectorHeight ( )
{
2014-08-25 11:15:19 +00:00
int delta = int . MinValue ;
2013-06-25 12:35:13 +00:00
// Check all selected sectors
2014-10-17 11:55:08 +00:00
foreach ( Sector s in sectors )
{
if ( delta = = int . MinValue )
{
2013-06-25 12:35:13 +00:00
// First sector in list
delta = s . CeilHeight - s . FloorHeight ;
2014-10-17 11:55:08 +00:00
}
else if ( delta ! = ( s . CeilHeight - s . FloorHeight ) )
{
2013-08-12 10:15:08 +00:00
// We can't show heights because the delta
// heights for the sectors is different
2014-08-25 11:15:19 +00:00
delta = int . MinValue ;
2013-08-12 10:15:08 +00:00
break ;
2013-06-25 12:35:13 +00:00
}
}
2014-10-17 11:55:08 +00:00
if ( delta ! = int . MinValue )
{
2014-08-25 11:15:19 +00:00
sectorheight . Text = delta . ToString ( ) ;
2013-06-25 12:35:13 +00:00
sectorheight . Visible = true ;
sectorheightlabel . Visible = true ;
2014-10-17 11:55:08 +00:00
}
else
{
2013-06-25 12:35:13 +00:00
sectorheight . Visible = false ;
sectorheightlabel . Visible = false ;
}
}
2014-09-13 21:57:56 +00:00
//mxd
private void UpdateCeilingHeight ( )
{
2015-04-01 12:51:26 +00:00
int offset ;
2014-09-13 21:57:56 +00:00
2015-04-01 12:51:26 +00:00
if ( heightoffset . Text = = "++" | | heightoffset . Text = = "--" ) // Raise or lower by sector height
2014-09-13 21:57:56 +00:00
{
2015-04-01 12:51:26 +00:00
int sign = ( heightoffset . Text = = "++" ? 1 : - 1 ) ;
2015-12-28 15:01:53 +00:00
foreach ( Sector s in sectors )
2014-10-17 11:55:08 +00:00
{
2015-04-01 12:51:26 +00:00
offset = sectorprops [ s ] . CeilHeight - sectorprops [ s ] . FloorHeight ;
s . CeilHeight + = offset * sign ;
2014-10-17 11:55:08 +00:00
SynchCeilSlopeOffsetToHeight ( s ) ;
}
2015-04-01 12:51:26 +00:00
}
else
2014-09-13 21:57:56 +00:00
{
2015-04-01 12:51:26 +00:00
offset = heightoffset . GetResult ( 0 ) ;
//restore values
if ( string . IsNullOrEmpty ( ceilingheight . Text ) )
2014-10-17 11:55:08 +00:00
{
2015-12-28 15:01:53 +00:00
foreach ( Sector s in sectors )
2015-04-01 12:51:26 +00:00
{
s . CeilHeight = sectorprops [ s ] . CeilHeight + offset ;
SynchCeilSlopeOffsetToHeight ( s ) ;
}
}
else //update values
{
2015-12-28 15:01:53 +00:00
foreach ( Sector s in sectors )
2015-04-01 12:51:26 +00:00
{
s . CeilHeight = ceilingheight . GetResult ( sectorprops [ s ] . CeilHeight ) + offset ;
SynchCeilSlopeOffsetToHeight ( s ) ;
}
2014-10-17 11:55:08 +00:00
}
2014-09-13 21:57:56 +00:00
}
}
//mxd
private void UpdateFloorHeight ( )
{
2015-04-01 12:51:26 +00:00
int offset ;
2014-09-13 21:57:56 +00:00
2015-04-01 12:51:26 +00:00
if ( heightoffset . Text = = "++" | | heightoffset . Text = = "--" )
2014-09-13 21:57:56 +00:00
{
2015-04-01 12:51:26 +00:00
// Raise or lower by sector height
int sign = ( heightoffset . Text = = "++" ? 1 : - 1 ) ;
2015-12-28 15:01:53 +00:00
foreach ( Sector s in sectors )
2014-10-17 11:55:08 +00:00
{
2015-04-01 12:51:26 +00:00
offset = sectorprops [ s ] . CeilHeight - sectorprops [ s ] . FloorHeight ;
s . FloorHeight + = offset * sign ;
2014-10-17 11:55:08 +00:00
}
2015-04-01 12:51:26 +00:00
}
else
2014-09-13 21:57:56 +00:00
{
2015-04-01 12:51:26 +00:00
offset = heightoffset . GetResult ( 0 ) ;
//restore values
if ( string . IsNullOrEmpty ( floorheight . Text ) )
{
2015-12-28 15:01:53 +00:00
foreach ( Sector s in sectors )
2015-04-01 12:51:26 +00:00
{
s . FloorHeight = sectorprops [ s ] . FloorHeight + offset ;
SynchFloorSlopeOffsetToHeight ( s ) ;
}
}
else //update values
2014-10-17 11:55:08 +00:00
{
2015-12-28 15:01:53 +00:00
foreach ( Sector s in sectors )
2015-04-01 12:51:26 +00:00
{
s . FloorHeight = floorheight . GetResult ( sectorprops [ s ] . FloorHeight ) + offset ;
SynchFloorSlopeOffsetToHeight ( s ) ;
}
2014-10-17 11:55:08 +00:00
}
2014-09-13 21:57:56 +00:00
}
}
2014-10-17 11:55:08 +00:00
//mxd
private void SynchCeilSlopeOffsetToHeight ( Sector s )
{
Vector3D center = GetSectorCenter ( s , s . CeilHeight , SlopePivotMode . LOCAL ) ;
Plane p = new Plane ( center , s . CeilSlope . GetAngleXY ( ) - Angle2D . PIHALF , s . CeilSlope . GetAngleZ ( ) , false ) ;
s . CeilSlopeOffset = p . Offset ;
}
//mxd
private void SynchFloorSlopeOffsetToHeight ( Sector s )
{
Vector3D center = GetSectorCenter ( s , s . FloorHeight , SlopePivotMode . LOCAL ) ;
Plane p = new Plane ( center , s . FloorSlope . GetAngleXY ( ) + Angle2D . PIHALF , - s . FloorSlope . GetAngleZ ( ) , true ) ;
s . FloorSlopeOffset = p . Offset ;
}
2013-07-09 13:13:00 +00:00
#endregion
#region = = = = = = = = = = = = = = = = = = Events
2014-10-17 11:55:08 +00:00
private void apply_Click ( object sender , EventArgs e )
{
2013-06-25 12:35:13 +00:00
// Verify the effect
2014-10-17 11:55:08 +00:00
if ( ( effect . Value < General . Map . FormatInterface . MinEffect ) | | ( effect . Value > General . Map . FormatInterface . MaxEffect ) )
{
2013-06-25 12:35:13 +00:00
General . ShowWarningMessage ( "Sector effect must be between " + General . Map . FormatInterface . MinEffect + " and " + General . Map . FormatInterface . MaxEffect + "." , MessageBoxButtons . OK ) ;
return ;
}
2014-05-05 14:24:57 +00:00
//mxd
string [ ] rskeys = null ;
2014-10-17 11:55:08 +00:00
if ( General . Map . Config . SectorRenderStyles . Count > 0 )
{
2014-05-05 14:24:57 +00:00
rskeys = new string [ General . Map . Config . SectorRenderStyles . Count ] ;
General . Map . Config . SectorRenderStyles . Keys . CopyTo ( rskeys , 0 ) ;
}
2015-01-26 08:53:05 +00:00
MakeUndo ( ) ; //mxd
2013-06-25 12:35:13 +00:00
// Go for all sectors
2014-08-05 11:03:55 +00:00
int tagoffset = 0 ; //mxd
2014-10-17 11:55:08 +00:00
foreach ( Sector s in sectors )
{
2013-07-10 08:59:17 +00:00
// Apply all flags
2014-10-17 11:55:08 +00:00
foreach ( CheckBox c in flags . Checkboxes )
{
2015-12-28 15:01:53 +00:00
switch ( c . CheckState )
2015-07-15 09:09:47 +00:00
{
case CheckState . Checked : s . SetFlag ( c . Tag . ToString ( ) , true ) ; break ;
case CheckState . Unchecked : s . SetFlag ( c . Tag . ToString ( ) , false ) ; break ;
}
2013-07-10 08:59:17 +00:00
}
2013-06-25 12:35:13 +00:00
// Effects
if ( ! effect . Empty ) s . Effect = effect . Value ;
2015-07-27 21:35:42 +00:00
//mxd. Tag
tagsselector . ApplyTo ( s , tagoffset + + ) ;
2013-06-25 12:35:13 +00:00
2014-10-17 11:55:08 +00:00
// Fields
2013-08-08 11:04:13 +00:00
fieldslist . Apply ( s . Fields ) ;
2015-07-14 23:34:31 +00:00
//mxd. Comments
commenteditor . Apply ( s . Fields ) ;
2013-08-08 11:04:13 +00:00
2014-10-17 11:55:08 +00:00
// Alpha
if ( ! string . IsNullOrEmpty ( ceilAlpha . Text ) )
{
2013-07-19 15:30:58 +00:00
float ceilAlphaVal = General . Clamp ( ceilAlpha . GetResultFloat ( s . Fields . GetValue ( "alphaceiling" , 1.0f ) ) , 0f , 1f ) ;
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 ( s . Fields , "alphaceiling" , ceilAlphaVal , 1.0f ) ;
2013-06-25 12:35:13 +00:00
}
2014-10-17 11:55:08 +00:00
if ( ! string . IsNullOrEmpty ( floorAlpha . Text ) )
{
2013-07-19 15:30:58 +00:00
float floorAlphaVal = General . Clamp ( floorAlpha . GetResultFloat ( s . Fields . GetValue ( "alphafloor" , 1.0f ) ) , 0f , 1f ) ;
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 ( s . Fields , "alphafloor" , floorAlphaVal , 1.0f ) ;
2013-06-25 12:35:13 +00:00
}
//renderstyle
2015-12-28 15:01:53 +00:00
if ( rskeys ! = null )
2014-10-17 11:55:08 +00:00
{
2015-12-28 15:01:53 +00:00
if ( ceilRenderStyle . SelectedIndex > - 1 )
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 ( s . Fields , "renderstyleceiling" , rskeys [ ceilRenderStyle . SelectedIndex ] , "translucent" ) ;
2015-12-28 15:01:53 +00:00
if ( floorRenderStyle . SelectedIndex > - 1 )
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 ( s . Fields , "renderstylefloor" , rskeys [ floorRenderStyle . SelectedIndex ] , "translucent" ) ;
2013-06-25 12:35:13 +00:00
}
Added, Sector Edit window, UDMF: added UI for sector damage-realted properties.
Added, DECORATE parser: damage types are now parsed.
Added: the editor now reports duplicate textures/flats/patches/sprites/colormaps/voxels in the loaded wads.
Added, all text parsers: added #region/#endregion support.
Added TERRAIN parser.
Added, Script Editor: added special handling for DECORATE special comments.
Added, Sector Edit window, UDMF: Soundsequence value was setup incorrectly when showing the window for multiple sectors with mixed Soundsequence value.
Fixed, Map Options window: "Strictly load patches between P_START and P_END" was not applied when applying the changes.
Fixed, MAPINFO parser: MapInfo should be treated as defined when a map MAPINFO block corresponding to current map is encountered even if it doesn't define any properties recognized by the editor.
Fixed, all text parsers: in some cases error line was calculated incorrectly when reporting an error detected by a text parser.
Cosmetic: changed ' to " in the rest of Error and Warning messages.
Internal: added text resource tracking.
Updated ZDoom_DECORATE.cfg.
Updated documentation ("Game Configuration - Basic Settings" page).
2016-02-22 12:33:19 +00:00
//Damage
if ( ! string . IsNullOrEmpty ( damagetype . Text ) )
UniFields . SetString ( s . Fields , "damagetype" , damagetype . Text , NO_DAMAGETYPE ) ;
if ( ! string . IsNullOrEmpty ( damageamount . Text ) )
UniFields . SetInteger ( s . Fields , "damageamount" , damageamount . GetResult ( s . Fields . GetValue ( "damageamount" , 0 ) ) , 0 ) ;
if ( ! string . IsNullOrEmpty ( damageinterval . Text ) )
UniFields . SetInteger ( s . Fields , "damageinterval" , damageinterval . GetResult ( s . Fields . GetValue ( "damageinterval" , 32 ) ) , 32 ) ;
if ( ! string . IsNullOrEmpty ( leakiness . Text ) )
UniFields . SetInteger ( s . Fields , "leakiness" , General . Clamp ( leakiness . GetResult ( s . Fields . GetValue ( "leakiness" , 0 ) ) , 0 , 256 ) , 0 ) ;
//Terrain
if ( ! string . IsNullOrEmpty ( ceilterrain . Text ) )
UniFields . SetString ( s . Fields , "ceilingterrain" , ceilterrain . Text , NO_TERRAIN ) ;
if ( ! string . IsNullOrEmpty ( floorterrain . Text ) )
UniFields . SetString ( s . Fields , "floorterrain" , floorterrain . Text , NO_TERRAIN ) ;
2014-10-17 11:55:08 +00:00
// Misc
2015-02-14 18:15:11 +00:00
if ( ! string . IsNullOrEmpty ( soundsequence . 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
UniFields . SetString ( s . Fields , "soundsequence" , soundsequence . Text , NO_SOUND_SEQUENCE ) ;
2015-02-14 18:15:11 +00:00
if ( ! string . IsNullOrEmpty ( gravity . 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
UniFields . SetFloat ( s . Fields , "gravity" , gravity . GetResultFloat ( s . Fields . GetValue ( "gravity" , 1.0f ) ) , 1.0f ) ;
2015-02-14 18:15:11 +00:00
if ( ! string . IsNullOrEmpty ( desaturation . Text ) )
2014-10-17 11:55:08 +00:00
{
2013-07-19 15:30:58 +00:00
float val = General . Clamp ( desaturation . GetResultFloat ( s . Fields . GetValue ( "desaturation" , 0f ) ) , 0f , 1f ) ;
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 ( s . Fields , "desaturation" , val , 0f ) ;
2013-06-25 12:35:13 +00:00
}
2014-10-17 11:55:08 +00:00
// Clear horizontal slopes
if ( ( float ) Math . Round ( Angle2D . RadToDeg ( s . FloorSlope . GetAngleZ ( ) ) , 3 ) = = 90f )
{
s . FloorSlope = new Vector3D ( ) ;
s . FloorSlopeOffset = float . NaN ;
}
if ( ( float ) Math . Round ( Angle2D . RadToDeg ( s . CeilSlope . GetAngleZ ( ) ) , 3 ) = = 270f )
{
s . CeilSlope = new Vector3D ( ) ;
s . CeilSlopeOffset = float . NaN ;
}
2013-06-25 12:35:13 +00:00
}
// Update the used textures
General . Map . Data . UpdateUsedTextures ( ) ;
2013-07-19 15:30:58 +00:00
// Store value linking
linkCeilingScale = ceilScale . LinkValues ;
linkFloorScale = floorScale . LinkValues ;
2013-08-12 10:15:08 +00:00
useCeilLineAngles = cbUseCeilLineAngles . Checked ;
useFloorLineAngles = cbUseFloorLineAngles . Checked ;
2014-08-25 11:15:19 +00:00
useCeilSlopeLineAngles = ceilingslopecontrol . UseLineAngles ;
useFloorSlopeLineAngles = floorslopecontrol . UseLineAngles ;
2014-10-17 11:55:08 +00:00
floorpivotmode = floorslopecontrol . PivotMode ;
ceilpivotmode = ceilingslopecontrol . PivotMode ;
2013-07-19 15:30:58 +00:00
2013-06-25 12:35:13 +00:00
// Done
General . Map . IsChanged = true ;
2013-07-19 15:30:58 +00:00
if ( OnValuesChanged ! = null ) OnValuesChanged ( this , EventArgs . Empty ) ; //mxd
2013-06-25 12:35:13 +00:00
this . DialogResult = DialogResult . OK ;
this . Close ( ) ;
}
2014-10-17 11:55:08 +00:00
private void cancel_Click ( object sender , EventArgs e )
{
2013-07-19 15:30:58 +00:00
//mxd. Let's pretend nothing of this really happened...
2015-01-26 08:53:05 +00:00
if ( undocreated ) General . Map . UndoRedo . WithdrawUndo ( ) ;
2013-07-19 15:30:58 +00:00
2013-06-25 12:35:13 +00:00
// Be gone
this . DialogResult = DialogResult . Cancel ;
this . Close ( ) ;
}
2014-10-17 11:55:08 +00:00
private void browseeffect_Click ( object sender , EventArgs e )
{
2013-06-25 12:35:13 +00:00
effect . Value = EffectBrowserForm . BrowseEffect ( this , effect . Value ) ;
}
2013-11-21 10:53:11 +00:00
//mxd
2014-10-17 11:55:08 +00:00
private void SectorEditFormUDMF_FormClosing ( object sender , FormClosingEventArgs e )
{
2013-11-21 10:53:11 +00:00
location = this . Location ;
2014-08-25 11:15:19 +00:00
activetab = tabs . SelectedIndex ;
2013-11-21 10:53:11 +00:00
}
2014-10-17 11:55:08 +00:00
private void SectorEditFormUDMF_HelpRequested ( object sender , HelpEventArgs hlpevent )
{
2013-06-25 12:35:13 +00:00
General . ShowHelp ( "w_sectoredit.html" ) ;
hlpevent . Handled = true ;
}
2014-10-17 11:55:08 +00:00
private void tabcustom_MouseEnter ( object sender , EventArgs e )
{
2013-06-25 12:35:13 +00:00
fieldslist . Focus ( ) ;
}
2014-12-24 18:32:24 +00:00
private void ceilAngleControl_AngleChanged ( object sender , EventArgs e )
2014-10-17 11:55:08 +00:00
{
2013-06-25 12:35:13 +00:00
ceilRotation . Text = ( General . ClampAngle ( 360 - ceilAngleControl . Angle ) ) . ToString ( ) ;
}
2014-12-24 18:32:24 +00:00
private void floorAngleControl_AngleChanged ( object sender , EventArgs e )
2014-10-17 11:55:08 +00:00
{
2013-06-25 12:35:13 +00:00
floorRotation . Text = ( General . ClampAngle ( 360 - floorAngleControl . Angle ) ) . ToString ( ) ;
}
2014-10-17 11:55:08 +00:00
private void cbUseCeilLineAngles_CheckedChanged ( object sender , EventArgs e )
{
2014-09-15 08:15:22 +00:00
ceilRotation . ButtonStepsWrapAround = cbUseCeilLineAngles . Checked ;
2014-08-25 11:15:19 +00:00
ceilRotation . StepValues = ( cbUseCeilLineAngles . Checked ? anglesteps : null ) ;
2013-08-12 10:15:08 +00:00
}
2014-10-17 11:55:08 +00:00
private void cbUseFloorLineAngles_CheckedChanged ( object sender , EventArgs e )
{
2014-09-15 08:15:22 +00:00
floorRotation . ButtonStepsWrapAround = cbUseFloorLineAngles . Checked ;
2014-08-25 11:15:19 +00:00
floorRotation . StepValues = ( cbUseFloorLineAngles . Checked ? anglesteps : null ) ;
2013-08-12 10:15:08 +00:00
}
Added, Sector Edit window, UDMF: added UI for sector damage-realted properties.
Added, DECORATE parser: damage types are now parsed.
Added: the editor now reports duplicate textures/flats/patches/sprites/colormaps/voxels in the loaded wads.
Added, all text parsers: added #region/#endregion support.
Added TERRAIN parser.
Added, Script Editor: added special handling for DECORATE special comments.
Added, Sector Edit window, UDMF: Soundsequence value was setup incorrectly when showing the window for multiple sectors with mixed Soundsequence value.
Fixed, Map Options window: "Strictly load patches between P_START and P_END" was not applied when applying the changes.
Fixed, MAPINFO parser: MapInfo should be treated as defined when a map MAPINFO block corresponding to current map is encountered even if it doesn't define any properties recognized by the editor.
Fixed, all text parsers: in some cases error line was calculated incorrectly when reporting an error detected by a text parser.
Cosmetic: changed ' to " in the rest of Error and Warning messages.
Internal: added text resource tracking.
Updated ZDoom_DECORATE.cfg.
Updated documentation ("Game Configuration - Basic Settings" page).
2016-02-22 12:33:19 +00:00
private void resetfloorterrain_Click ( object sender , EventArgs e )
{
floorterrain . Text = NO_TERRAIN ;
}
private void floorterrain_TextChanged ( object sender , EventArgs e )
{
resetfloorterrain . Visible = ( floorterrain . Text ! = NO_TERRAIN ) ;
}
private void floorterrain_MouseDown ( object sender , MouseEventArgs e )
{
if ( floorterrain . Text = = NO_TERRAIN ) floorterrain . SelectAll ( ) ;
}
private void resetceilterrain_Click ( object sender , EventArgs e )
{
ceilterrain . Text = NO_TERRAIN ;
}
private void ceilterrain_TextChanged ( object sender , EventArgs e )
{
resetceilterrain . Visible = ( ceilterrain . Text ! = NO_TERRAIN ) ;
}
private void ceilterrain_MouseDown ( object sender , MouseEventArgs e )
{
if ( ceilterrain . Text = = NO_TERRAIN ) ceilterrain . SelectAll ( ) ;
}
private void resetdamagetype_Click ( object sender , EventArgs e )
{
damagetype . Focus ( ) ;
damagetype . Text = NO_DAMAGETYPE ;
}
private void damagetype_TextChanged ( object sender , EventArgs e )
{
resetdamagetype . Visible = ( damagetype . Text ! = NO_DAMAGETYPE ) ;
}
private void damagetype_MouseDown ( object sender , MouseEventArgs e )
{
if ( damagetype . Text = = NO_DAMAGETYPE ) damagetype . SelectAll ( ) ;
}
2015-02-14 18:15:11 +00:00
private void resetsoundsequence_Click ( object sender , EventArgs e )
{
Added, Sector Edit window, UDMF: added UI for sector damage-realted properties.
Added, DECORATE parser: damage types are now parsed.
Added: the editor now reports duplicate textures/flats/patches/sprites/colormaps/voxels in the loaded wads.
Added, all text parsers: added #region/#endregion support.
Added TERRAIN parser.
Added, Script Editor: added special handling for DECORATE special comments.
Added, Sector Edit window, UDMF: Soundsequence value was setup incorrectly when showing the window for multiple sectors with mixed Soundsequence value.
Fixed, Map Options window: "Strictly load patches between P_START and P_END" was not applied when applying the changes.
Fixed, MAPINFO parser: MapInfo should be treated as defined when a map MAPINFO block corresponding to current map is encountered even if it doesn't define any properties recognized by the editor.
Fixed, all text parsers: in some cases error line was calculated incorrectly when reporting an error detected by a text parser.
Cosmetic: changed ' to " in the rest of Error and Warning messages.
Internal: added text resource tracking.
Updated ZDoom_DECORATE.cfg.
Updated documentation ("Game Configuration - Basic Settings" page).
2016-02-22 12:33:19 +00:00
soundsequence . Focus ( ) ;
2015-02-14 18:15:11 +00:00
soundsequence . Text = NO_SOUND_SEQUENCE ;
}
Added, Sector Edit window, UDMF: added UI for sector damage-realted properties.
Added, DECORATE parser: damage types are now parsed.
Added: the editor now reports duplicate textures/flats/patches/sprites/colormaps/voxels in the loaded wads.
Added, all text parsers: added #region/#endregion support.
Added TERRAIN parser.
Added, Script Editor: added special handling for DECORATE special comments.
Added, Sector Edit window, UDMF: Soundsequence value was setup incorrectly when showing the window for multiple sectors with mixed Soundsequence value.
Fixed, Map Options window: "Strictly load patches between P_START and P_END" was not applied when applying the changes.
Fixed, MAPINFO parser: MapInfo should be treated as defined when a map MAPINFO block corresponding to current map is encountered even if it doesn't define any properties recognized by the editor.
Fixed, all text parsers: in some cases error line was calculated incorrectly when reporting an error detected by a text parser.
Cosmetic: changed ' to " in the rest of Error and Warning messages.
Internal: added text resource tracking.
Updated ZDoom_DECORATE.cfg.
Updated documentation ("Game Configuration - Basic Settings" page).
2016-02-22 12:33:19 +00:00
private void soundsequence_TextChanged ( object sender , EventArgs e )
2015-02-14 18:15:11 +00:00
{
Added, Sector Edit window, UDMF: added UI for sector damage-realted properties.
Added, DECORATE parser: damage types are now parsed.
Added: the editor now reports duplicate textures/flats/patches/sprites/colormaps/voxels in the loaded wads.
Added, all text parsers: added #region/#endregion support.
Added TERRAIN parser.
Added, Script Editor: added special handling for DECORATE special comments.
Added, Sector Edit window, UDMF: Soundsequence value was setup incorrectly when showing the window for multiple sectors with mixed Soundsequence value.
Fixed, Map Options window: "Strictly load patches between P_START and P_END" was not applied when applying the changes.
Fixed, MAPINFO parser: MapInfo should be treated as defined when a map MAPINFO block corresponding to current map is encountered even if it doesn't define any properties recognized by the editor.
Fixed, all text parsers: in some cases error line was calculated incorrectly when reporting an error detected by a text parser.
Cosmetic: changed ' to " in the rest of Error and Warning messages.
Internal: added text resource tracking.
Updated ZDoom_DECORATE.cfg.
Updated documentation ("Game Configuration - Basic Settings" page).
2016-02-22 12:33:19 +00:00
resetsoundsequence . Visible = ( soundsequence . Text ! = NO_SOUND_SEQUENCE ) ;
2015-02-14 18:15:11 +00:00
}
private void soundsequence_MouseDown ( object sender , MouseEventArgs e )
{
if ( soundsequence . Text = = NO_SOUND_SEQUENCE ) soundsequence . SelectAll ( ) ;
}
2013-07-19 15:30:58 +00:00
#endregion
2014-09-04 12:34:26 +00:00
#region = = = = = = = = = = = = = = = = = = Sector Realtime events ( mxd )
2013-07-19 15:30:58 +00:00
2014-09-13 21:57:56 +00:00
private void ceilingheight_WhenTextChanged ( object sender , EventArgs e )
{
2015-01-26 08:53:05 +00:00
if ( preventchanges ) return ;
MakeUndo ( ) ; //mxd
2013-07-19 15:30:58 +00:00
2014-09-13 21:57:56 +00:00
UpdateCeilingHeight ( ) ;
2013-09-17 08:21:12 +00:00
UpdateSectorHeight ( ) ;
2013-07-19 15:30:58 +00:00
General . Map . IsChanged = true ;
if ( OnValuesChanged ! = null ) OnValuesChanged ( this , EventArgs . Empty ) ;
}
2014-09-13 21:57:56 +00:00
private void floorheight_WhenTextChanged ( object sender , EventArgs e )
{
2015-01-26 08:53:05 +00:00
if ( preventchanges ) return ;
MakeUndo ( ) ; //mxd
2013-07-19 15:30:58 +00:00
2014-09-13 21:57:56 +00:00
UpdateFloorHeight ( ) ;
2013-09-17 08:21:12 +00:00
UpdateSectorHeight ( ) ;
2013-07-19 15:30:58 +00:00
General . Map . IsChanged = true ;
if ( OnValuesChanged ! = null ) OnValuesChanged ( this , EventArgs . Empty ) ;
}
2014-09-13 21:57:56 +00:00
private void heightoffset_WhenTextChanged ( object sender , EventArgs e )
{
2015-01-26 08:53:05 +00:00
if ( preventchanges ) return ;
MakeUndo ( ) ; //mxd
2014-09-13 21:57:56 +00:00
UpdateFloorHeight ( ) ;
UpdateCeilingHeight ( ) ;
UpdateSectorHeight ( ) ;
General . Map . IsChanged = true ;
if ( OnValuesChanged ! = null ) OnValuesChanged ( this , EventArgs . Empty ) ;
}
2014-12-03 23:15:26 +00:00
private void brightness_WhenTextChanged ( object sender , EventArgs e )
{
2015-01-26 08:53:05 +00:00
if ( preventchanges ) return ;
MakeUndo ( ) ; //mxd
2013-07-19 15:30:58 +00:00
//restore values
2014-10-17 11:55:08 +00:00
if ( string . IsNullOrEmpty ( brightness . Text ) )
{
2013-07-19 15:30:58 +00:00
foreach ( Sector s in sectors )
2014-08-25 11:15:19 +00:00
s . Brightness = sectorprops [ s ] . Brightness ;
2014-10-17 11:55:08 +00:00
}
else //update values
{
2013-07-19 15:30:58 +00:00
foreach ( Sector s in sectors )
2014-08-25 11:15:19 +00:00
s . Brightness = General . Clamp ( brightness . GetResult ( sectorprops [ s ] . Brightness ) , General . Map . FormatInterface . MinBrightness , General . Map . FormatInterface . MaxBrightness ) ;
2013-07-19 15:30:58 +00:00
}
General . Map . IsChanged = true ;
if ( OnValuesChanged ! = null ) OnValuesChanged ( this , EventArgs . Empty ) ;
}
2014-10-17 11:55:08 +00:00
private void ceilingtex_OnValueChanged ( object sender , EventArgs e )
{
2015-01-26 08:53:05 +00:00
if ( preventchanges ) return ;
MakeUndo ( ) ; //mxd
2013-07-19 15:30:58 +00:00
//restore values
2014-10-17 11:55:08 +00:00
if ( string . IsNullOrEmpty ( ceilingtex . TextureName ) )
{
2013-07-19 15:30:58 +00:00
foreach ( Sector s in sectors )
2014-08-25 11:15:19 +00:00
s . SetCeilTexture ( sectorprops [ s ] . CeilTexture ) ;
2014-10-17 11:55:08 +00:00
}
else //update values
{
2013-07-19 15:30:58 +00:00
foreach ( Sector s in sectors )
s . SetCeilTexture ( ceilingtex . GetResult ( s . CeilTexture ) ) ;
}
// Update the used textures
General . Map . Data . UpdateUsedTextures ( ) ;
General . Map . IsChanged = true ;
if ( OnValuesChanged ! = null ) OnValuesChanged ( this , EventArgs . Empty ) ;
}
2014-10-17 11:55:08 +00:00
private void floortex_OnValueChanged ( object sender , EventArgs e )
{
2015-01-26 08:53:05 +00:00
if ( preventchanges ) return ;
MakeUndo ( ) ; //mxd
2013-07-19 15:30:58 +00:00
//restore values
2014-10-17 11:55:08 +00:00
if ( string . IsNullOrEmpty ( floortex . TextureName ) )
{
2013-07-19 15:30:58 +00:00
foreach ( Sector s in sectors )
2014-08-25 11:15:19 +00:00
s . SetFloorTexture ( sectorprops [ s ] . FloorTexture ) ;
2014-10-17 11:55:08 +00:00
}
else //update values
{
2013-07-19 15:30:58 +00:00
foreach ( Sector s in sectors )
s . SetFloorTexture ( floortex . GetResult ( s . FloorTexture ) ) ;
}
// Update the used textures
General . Map . Data . UpdateUsedTextures ( ) ;
General . Map . IsChanged = true ;
if ( OnValuesChanged ! = null ) OnValuesChanged ( this , EventArgs . Empty ) ;
}
2014-10-17 11:55:08 +00:00
private void floorRotation_WhenTextChanged ( object sender , EventArgs e )
{
2015-01-26 08:53:05 +00:00
if ( preventchanges ) return ;
MakeUndo ( ) ; //mxd
2013-07-19 15:30:58 +00:00
//restore values
2014-10-17 11:55:08 +00:00
if ( string . IsNullOrEmpty ( floorRotation . Text ) )
{
floorAngleControl . Angle = GZBuilder . Controls . AngleControl . NO_ANGLE ;
foreach ( Sector s in sectors )
{
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 ( s . Fields , "rotationfloor" , sectorprops [ s ] . FloorRotation , 0f ) ;
2013-07-19 15:30:58 +00:00
s . UpdateNeeded = true ;
}
2014-10-17 11:55:08 +00:00
}
else //update values
{
floorAngleControl . Angle = ( int ) General . ClampAngle ( 360 - floorRotation . GetResultFloat ( 0 ) ) ;
foreach ( Sector s in sectors )
{
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 ( s . Fields , "rotationfloor" , floorRotation . GetResultFloat ( sectorprops [ s ] . FloorRotation ) , 0f ) ;
2013-07-19 15:30:58 +00:00
s . UpdateNeeded = true ;
}
}
General . Map . IsChanged = true ;
if ( OnValuesChanged ! = null ) OnValuesChanged ( this , EventArgs . Empty ) ;
2013-06-25 12:35:13 +00:00
}
2014-10-17 11:55:08 +00:00
private void ceilRotation_WhenTextChanged ( object sender , EventArgs e )
{
2015-01-26 08:53:05 +00:00
if ( preventchanges ) return ;
MakeUndo ( ) ; //mxd
2013-07-19 15:30:58 +00:00
//restore values
2014-10-17 11:55:08 +00:00
if ( string . IsNullOrEmpty ( ceilRotation . Text ) )
{
ceilAngleControl . Angle = GZBuilder . Controls . AngleControl . NO_ANGLE ;
foreach ( Sector s in sectors )
{
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 ( s . Fields , "rotationceiling" , sectorprops [ s ] . CeilRotation , 0f ) ;
2013-07-19 15:30:58 +00:00
s . UpdateNeeded = true ;
}
2014-10-17 11:55:08 +00:00
}
else //update values
{
ceilAngleControl . Angle = ( int ) General . ClampAngle ( 360 - ceilRotation . GetResultFloat ( 0 ) ) ;
foreach ( Sector s in sectors )
{
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 ( s . Fields , "rotationceiling" , ceilRotation . GetResultFloat ( sectorprops [ s ] . CeilRotation ) , 0f ) ;
2013-07-19 15:30:58 +00:00
s . UpdateNeeded = true ;
}
}
General . Map . IsChanged = true ;
if ( OnValuesChanged ! = null ) OnValuesChanged ( this , EventArgs . Empty ) ;
}
2014-10-17 11:55:08 +00:00
private void lightColor_OnValueChanged ( object sender , EventArgs e )
{
2015-01-26 08:53:05 +00:00
if ( preventchanges ) return ;
MakeUndo ( ) ; //mxd
2013-07-19 15:30:58 +00:00
2014-10-17 11:55:08 +00:00
foreach ( Sector s in sectors )
{
2014-08-25 11:15:19 +00:00
lightColor . ApplyTo ( s . Fields , sectorprops [ s ] . LightColor ) ;
2013-07-19 15:30:58 +00:00
s . UpdateNeeded = true ;
}
General . Map . IsChanged = true ;
if ( OnValuesChanged ! = null ) OnValuesChanged ( this , EventArgs . Empty ) ;
}
2014-10-17 11:55:08 +00:00
private void fadeColor_OnValueChanged ( object sender , EventArgs e )
{
2015-01-26 08:53:05 +00:00
if ( preventchanges ) return ;
MakeUndo ( ) ; //mxd
2013-07-19 15:30:58 +00:00
2014-10-17 11:55:08 +00:00
foreach ( Sector s in sectors )
{
2014-08-25 11:15:19 +00:00
fadeColor . ApplyTo ( s . Fields , sectorprops [ s ] . FadeColor ) ;
2013-07-19 15:30:58 +00:00
s . UpdateNeeded = true ;
}
General . Map . IsChanged = true ;
if ( OnValuesChanged ! = null ) OnValuesChanged ( this , EventArgs . Empty ) ;
}
#endregion
2014-09-04 12:34:26 +00:00
#region = = = = = = = = = = = = = = = = = = Ceiling / Floor realtime events ( mxd )
2013-07-19 15:30:58 +00:00
2014-10-17 11:55:08 +00:00
private void ceilOffsets_OnValuesChanged ( object sender , EventArgs e )
{
2015-01-26 08:53:05 +00:00
if ( preventchanges ) return ;
MakeUndo ( ) ; //mxd
2013-07-19 15:30:58 +00:00
2014-10-17 11:55:08 +00:00
foreach ( Sector s in sectors )
{
2014-08-25 11:15:19 +00:00
ceilOffsets . ApplyTo ( s . Fields , General . Map . FormatInterface . MinTextureOffset , General . Map . FormatInterface . MaxTextureOffset , sectorprops [ s ] . CeilOffsetX , sectorprops [ s ] . CeilOffsetY ) ;
2013-07-19 15:30:58 +00:00
s . UpdateNeeded = true ;
}
General . Map . IsChanged = true ;
2015-01-05 14:56:44 +00:00
labelCeilOffsets . Enabled = ceilOffsets . NonDefaultValue ;
2013-07-19 15:30:58 +00:00
if ( OnValuesChanged ! = null ) OnValuesChanged ( this , EventArgs . Empty ) ;
}
2014-10-17 11:55:08 +00:00
private void floorOffsets_OnValuesChanged ( object sender , EventArgs e )
{
2015-01-26 08:53:05 +00:00
if ( preventchanges ) return ;
MakeUndo ( ) ; //mxd
2013-07-19 15:30:58 +00:00
2014-10-17 11:55:08 +00:00
foreach ( Sector s in sectors )
{
2014-08-25 11:15:19 +00:00
floorOffsets . ApplyTo ( s . Fields , General . Map . FormatInterface . MinTextureOffset , General . Map . FormatInterface . MaxTextureOffset , sectorprops [ s ] . FloorOffsetX , sectorprops [ s ] . FloorOffsetY ) ;
2013-07-19 15:30:58 +00:00
s . UpdateNeeded = true ;
}
General . Map . IsChanged = true ;
2015-01-05 14:56:44 +00:00
labelFloorOffsets . Enabled = floorOffsets . NonDefaultValue ;
2013-07-19 15:30:58 +00:00
if ( OnValuesChanged ! = null ) OnValuesChanged ( this , EventArgs . Empty ) ;
}
2014-10-17 11:55:08 +00:00
private void ceilScale_OnValuesChanged ( object sender , EventArgs e )
{
2015-01-26 08:53:05 +00:00
if ( preventchanges ) return ;
MakeUndo ( ) ; //mxd
2013-07-19 15:30:58 +00:00
2014-10-17 11:55:08 +00:00
foreach ( Sector s in sectors )
{
2014-08-25 11:15:19 +00:00
ceilScale . ApplyTo ( s . Fields , General . Map . FormatInterface . MinTextureOffset , General . Map . FormatInterface . MaxTextureOffset , sectorprops [ s ] . CeilScaleX , sectorprops [ s ] . CeilScaleY ) ;
2013-07-19 15:30:58 +00:00
s . UpdateNeeded = true ;
}
General . Map . IsChanged = true ;
2015-01-05 14:56:44 +00:00
labelCeilScale . Enabled = ceilScale . NonDefaultValue ;
2013-07-19 15:30:58 +00:00
if ( OnValuesChanged ! = null ) OnValuesChanged ( this , EventArgs . Empty ) ;
}
2014-10-17 11:55:08 +00:00
private void floorScale_OnValuesChanged ( object sender , EventArgs e )
{
2015-01-26 08:53:05 +00:00
if ( preventchanges ) return ;
MakeUndo ( ) ; //mxd
2013-07-19 15:30:58 +00:00
2014-10-17 11:55:08 +00:00
foreach ( Sector s in sectors )
{
2014-08-25 11:15:19 +00:00
floorScale . ApplyTo ( s . Fields , General . Map . FormatInterface . MinTextureOffset , General . Map . FormatInterface . MaxTextureOffset , sectorprops [ s ] . FloorScaleX , sectorprops [ s ] . FloorScaleY ) ;
2013-07-19 15:30:58 +00:00
s . UpdateNeeded = true ;
}
General . Map . IsChanged = true ;
2015-01-05 14:56:44 +00:00
labelFloorScale . Enabled = floorScale . NonDefaultValue ;
2013-07-19 15:30:58 +00:00
if ( OnValuesChanged ! = null ) OnValuesChanged ( this , EventArgs . Empty ) ;
}
2014-10-17 11:55:08 +00:00
private void ceilBrightness_WhenTextChanged ( object sender , EventArgs e )
{
2015-01-26 08:53:05 +00:00
if ( preventchanges ) return ;
MakeUndo ( ) ; //mxd
2013-07-19 15:30:58 +00:00
//restore values
2014-10-17 11:55:08 +00:00
if ( string . IsNullOrEmpty ( ceilBrightness . Text ) )
{
foreach ( Sector s in sectors )
{
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 ( s . Fields , "lightceiling" , sectorprops [ s ] . CeilBrightness , 0 ) ;
2013-07-19 15:30:58 +00:00
s . UpdateNeeded = true ;
}
2014-10-17 11:55:08 +00:00
}
else //update values
{
foreach ( Sector s in sectors )
{
2013-07-19 15:30:58 +00:00
bool absolute = false ;
2015-12-28 15:01:53 +00:00
switch ( ceilLightAbsolute . CheckState )
2014-10-17 11:55:08 +00:00
{
2015-07-15 09:09:47 +00:00
case CheckState . Indeterminate :
absolute = s . Fields . GetValue ( "lightceilingabsolute" , false ) ;
break ;
case CheckState . Checked :
absolute = true ;
break ;
2013-07-19 15:30:58 +00:00
}
2014-08-25 11:15:19 +00:00
int value = General . Clamp ( ceilBrightness . GetResult ( sectorprops [ s ] . CeilBrightness ) , ( 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 ( s . Fields , "lightceiling" , value , 0 ) ;
2013-07-19 15:30:58 +00:00
s . UpdateNeeded = true ;
}
}
2015-10-02 14:47:34 +00:00
resetceillight . Visible = ( ceilLightAbsolute . CheckState ! = CheckState . Unchecked | | ceilBrightness . Text ! = "0" ) ;
2013-07-19 15:30:58 +00:00
General . Map . IsChanged = true ;
if ( OnValuesChanged ! = null ) OnValuesChanged ( this , EventArgs . Empty ) ;
}
2014-10-17 11:55:08 +00:00
private void floorBrightness_WhenTextChanged ( object sender , EventArgs e )
{
2015-01-26 08:53:05 +00:00
if ( preventchanges ) return ;
MakeUndo ( ) ; //mxd
2013-07-19 15:30:58 +00:00
//restore values
2014-10-17 11:55:08 +00:00
if ( string . IsNullOrEmpty ( floorBrightness . Text ) )
{
foreach ( Sector s in sectors )
{
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 ( s . Fields , "lightfloor" , sectorprops [ s ] . FloorBrightness , 0 ) ;
2013-07-19 15:30:58 +00:00
s . UpdateNeeded = true ;
}
2014-10-17 11:55:08 +00:00
}
else //update values
{
foreach ( Sector s in sectors )
{
2013-07-19 15:30:58 +00:00
bool absolute = false ;
2015-12-28 15:01:53 +00:00
switch ( floorLightAbsolute . CheckState )
2014-10-17 11:55:08 +00:00
{
2015-07-15 09:09:47 +00:00
case CheckState . Indeterminate :
absolute = s . Fields . GetValue ( "lightfloorabsolute" , false ) ;
break ;
case CheckState . Checked :
absolute = true ;
break ;
2013-07-19 15:30:58 +00:00
}
2014-08-25 11:15:19 +00:00
int value = General . Clamp ( floorBrightness . GetResult ( sectorprops [ s ] . FloorBrightness ) , ( 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 ( s . Fields , "lightfloor" , value , 0 ) ;
2013-07-19 15:30:58 +00:00
s . UpdateNeeded = true ;
}
}
2015-10-02 14:47:34 +00:00
resetfloorlight . Visible = ( floorLightAbsolute . CheckState ! = CheckState . Unchecked | | floorBrightness . Text ! = "0" ) ;
2013-07-19 15:30:58 +00:00
General . Map . IsChanged = true ;
if ( OnValuesChanged ! = null ) OnValuesChanged ( this , EventArgs . Empty ) ;
}
2014-10-17 11:55:08 +00:00
private void ceilLightAbsolute_CheckedChanged ( object sender , EventArgs e )
{
2015-01-26 08:53:05 +00:00
if ( preventchanges ) return ;
MakeUndo ( ) ; //mxd
2013-07-19 15:30:58 +00:00
2014-10-17 11:55:08 +00:00
if ( ceilLightAbsolute . Checked )
{
foreach ( Sector s in sectors )
{
2013-07-19 15:30:58 +00:00
s . Fields [ "lightceilingabsolute" ] = new UniValue ( UniversalType . Boolean , true ) ;
s . UpdateNeeded = true ;
}
2014-10-17 11:55:08 +00:00
}
else if ( ceilLightAbsolute . CheckState = = CheckState . Indeterminate )
{
foreach ( Sector s in sectors )
{
if ( sectorprops [ s ] . CeilLightAbsoulte )
{
2013-07-19 15:30:58 +00:00
s . Fields [ "lightceilingabsolute" ] = new UniValue ( UniversalType . Boolean , true ) ;
s . UpdateNeeded = true ;
2014-10-17 11:55:08 +00:00
}
else if ( s . Fields . ContainsKey ( "lightceilingabsolute" ) )
{
2013-07-19 15:30:58 +00:00
s . Fields . Remove ( "lightceilingabsolute" ) ;
s . UpdateNeeded = true ;
}
}
2014-10-17 11:55:08 +00:00
}
else
{
foreach ( Sector s in sectors )
{
if ( s . Fields . ContainsKey ( "lightceilingabsolute" ) )
{
2013-07-19 15:30:58 +00:00
s . Fields . Remove ( "lightceilingabsolute" ) ;
s . UpdateNeeded = true ;
}
}
}
2015-10-02 14:47:34 +00:00
resetceillight . Visible = ( ceilLightAbsolute . CheckState ! = CheckState . Unchecked | | ceilBrightness . Text ! = "0" ) ;
2013-07-19 15:30:58 +00:00
General . Map . IsChanged = true ;
if ( OnValuesChanged ! = null ) OnValuesChanged ( this , EventArgs . Empty ) ;
}
2014-10-17 11:55:08 +00:00
private void floorLightAbsolute_CheckedChanged ( object sender , EventArgs e )
{
2015-01-26 08:53:05 +00:00
if ( preventchanges ) return ;
MakeUndo ( ) ; //mxd
2013-07-19 15:30:58 +00:00
2014-10-17 11:55:08 +00:00
if ( floorLightAbsolute . Checked )
{
foreach ( Sector s in sectors )
{
2013-07-19 15:30:58 +00:00
s . Fields [ "lightfloorabsolute" ] = new UniValue ( UniversalType . Boolean , true ) ;
s . UpdateNeeded = true ;
}
2014-10-17 11:55:08 +00:00
}
else if ( floorLightAbsolute . CheckState = = CheckState . Indeterminate )
{
foreach ( Sector s in sectors )
{
if ( sectorprops [ s ] . FloorLightAbsoulte )
{
2013-07-19 15:30:58 +00:00
s . Fields [ "lightfloorabsolute" ] = new UniValue ( UniversalType . Boolean , true ) ;
s . UpdateNeeded = true ;
2014-10-17 11:55:08 +00:00
}
else if ( s . Fields . ContainsKey ( "lightfloorabsolute" ) )
{
2013-07-19 15:30:58 +00:00
s . Fields . Remove ( "lightfloorabsolute" ) ;
s . UpdateNeeded = true ;
}
}
2014-10-17 11:55:08 +00:00
}
else
{
foreach ( Sector s in sectors )
{
if ( s . Fields . ContainsKey ( "lightfloorabsolute" ) )
{
2013-07-19 15:30:58 +00:00
s . Fields . Remove ( "lightfloorabsolute" ) ;
s . UpdateNeeded = true ;
}
}
}
2015-10-02 14:47:34 +00:00
resetfloorlight . Visible = ( floorLightAbsolute . CheckState ! = CheckState . Unchecked | | floorBrightness . Text ! = "0" ) ;
2013-07-19 15:30:58 +00:00
General . Map . IsChanged = true ;
if ( OnValuesChanged ! = null ) OnValuesChanged ( this , EventArgs . Empty ) ;
2013-06-25 12:35:13 +00:00
}
2013-07-09 13:13:00 +00:00
2015-10-02 14:47:34 +00:00
private void resetceillight_Click ( object sender , EventArgs e )
{
MakeUndo ( ) ; //mxd
preventchanges = true ;
ceilLightAbsolute . Checked = false ;
ceilBrightness . Text = "0" ;
foreach ( Sector s in sectors )
{
if ( s . Fields . ContainsKey ( "lightceilingabsolute" ) ) s . Fields . Remove ( "lightceilingabsolute" ) ;
if ( s . Fields . ContainsKey ( "lightceiling" ) ) s . Fields . Remove ( "lightceiling" ) ;
}
preventchanges = false ;
resetceillight . Visible = false ;
ceilBrightness . Focus ( ) ;
General . Map . IsChanged = true ;
if ( OnValuesChanged ! = null ) OnValuesChanged ( this , EventArgs . Empty ) ;
}
private void resetfloorlight_Click ( object sender , EventArgs e )
{
MakeUndo ( ) ; //mxd
preventchanges = true ;
floorLightAbsolute . Checked = false ;
floorBrightness . Text = "0" ;
foreach ( Sector s in sectors )
{
if ( s . Fields . ContainsKey ( "lightfloorabsolute" ) ) s . Fields . Remove ( "lightfloorabsolute" ) ;
if ( s . Fields . ContainsKey ( "lightfloor" ) ) s . Fields . Remove ( "lightfloor" ) ;
}
preventchanges = false ;
resetfloorlight . Visible = false ;
floorBrightness . Focus ( ) ;
General . Map . IsChanged = true ;
if ( OnValuesChanged ! = null ) OnValuesChanged ( this , EventArgs . Empty ) ;
}
2013-07-09 13:13:00 +00:00
#endregion
2013-07-19 15:30:58 +00:00
2014-09-04 12:34:26 +00:00
#region = = = = = = = = = = = = = = = = = = Slope Utility ( mxd )
2014-10-17 11:55:08 +00:00
private void SetupFloorSlope ( Sector s , bool first )
{
if ( s . FloorSlope . GetLengthSq ( ) > 0 )
{
float anglexy = General . ClampAngle ( ( float ) Math . Round ( Angle2D . RadToDeg ( s . FloorSlope . GetAngleXY ( ) ) - 180 , 1 ) ) ;
float anglez = - ( float ) Math . Round ( Angle2D . RadToDeg ( s . FloorSlope . GetAngleZ ( ) ) - 90 , 1 ) ;
float offset = ( float ) Math . Round ( GetVirtualSlopeOffset ( s , floorslopecontrol . PivotMode , true ) , 1 ) ;
2014-09-04 12:34:26 +00:00
2014-10-17 11:55:08 +00:00
if ( anglexy > = 180 & & anglez < 0 )
{
anglexy - = 180 ;
2014-09-04 12:34:26 +00:00
anglez = - anglez ;
}
2014-10-17 11:55:08 +00:00
2014-09-15 08:15:22 +00:00
floorslopecontrol . SetValues ( anglexy , anglez , offset , first ) ;
2014-10-17 11:55:08 +00:00
}
else
{
2014-09-04 12:34:26 +00:00
floorslopecontrol . SetValues ( 0f , 0f , s . FloorHeight , first ) ;
}
}
2014-10-17 11:55:08 +00:00
private void SetupCeilingSlope ( Sector s , bool first )
{
if ( s . CeilSlope . GetLengthSq ( ) > 0 )
{
float anglexy = General . ClampAngle ( ( float ) Math . Round ( Angle2D . RadToDeg ( s . CeilSlope . GetAngleXY ( ) ) - 180 , 1 ) ) ;
float anglez = - ( float ) ( 270 - Math . Round ( Angle2D . RadToDeg ( s . CeilSlope . GetAngleZ ( ) ) , 1 ) ) ;
float offset = ( float ) Math . Round ( GetVirtualSlopeOffset ( s , ceilingslopecontrol . PivotMode , false ) , 1 ) ;
2014-09-04 12:34:26 +00:00
2014-10-17 11:55:08 +00:00
if ( anglexy > = 180 & & anglez < 0 )
{
anglexy - = 180 ;
anglez = - anglez ;
2014-09-04 12:34:26 +00:00
}
2014-10-17 11:55:08 +00:00
ceilingslopecontrol . SetValues ( anglexy , anglez , offset , first ) ;
}
else
{
ceilingslopecontrol . SetValues ( 0f , 0f , s . CeilHeight , first ) ;
2014-09-04 12:34:26 +00:00
}
2014-10-17 11:55:08 +00:00
}
// Gets the offset to be displayed in a SectorSlopeControl
private float GetVirtualSlopeOffset ( Sector s , SlopePivotMode mode , bool floor )
{
float offset = ( floor ? s . FloorSlopeOffset : s . CeilSlopeOffset ) ;
2015-12-28 15:01:53 +00:00
if ( float . IsNaN ( offset ) )
2014-10-17 11:55:08 +00:00
{
offset = ( floor ? s . FloorHeight : s . CeilHeight ) ;
}
Vector3D normal = ( floor ? s . FloorSlope : s . CeilSlope ) ;
2015-12-28 15:01:53 +00:00
if ( normal . GetLengthSq ( ) > 0 )
2014-10-17 11:55:08 +00:00
{
Vector3D center = GetSectorCenter ( s , 0 , mode ) ;
Plane p = new Plane ( normal , offset ) ;
return p . GetZ ( center ) ;
}
return offset ;
}
2014-09-04 12:34:26 +00:00
2014-10-17 11:55:08 +00:00
// Gets the offset to be displayed in a SectorSlopeControl
private float GetInitialVirtualSlopeOffset ( Sector s , SlopePivotMode mode , bool floor )
{
float offset = ( floor ? sectorprops [ s ] . FloorSlopeOffset : sectorprops [ s ] . CeilSlopeOffset ) ;
Vector3D normal = ( floor ? sectorprops [ s ] . FloorSlope : sectorprops [ s ] . CeilSlope ) ;
if ( normal . GetLengthSq ( ) > 0 )
{
Vector3D center = GetSectorCenter ( s , 0 , mode ) ;
Plane p = new Plane ( normal , offset ) ;
return p . GetZ ( center ) ;
}
2014-09-04 12:34:26 +00:00
2014-10-17 11:55:08 +00:00
return offset ;
}
2014-09-04 12:34:26 +00:00
2014-10-17 11:55:08 +00:00
private Vector3D GetSectorCenter ( Sector s , float offset , SlopePivotMode mode )
{
switch ( mode )
{
case SlopePivotMode . GLOBAL : //translate from the center of selection
return new Vector3D ( globalslopepivot , offset ) ;
2014-09-04 12:34:26 +00:00
2014-10-17 11:55:08 +00:00
case SlopePivotMode . LOCAL : //translate from sector's bounding box center
return new Vector3D ( slopepivots [ s ] , offset ) ;
2014-09-04 12:34:26 +00:00
2014-10-17 11:55:08 +00:00
case SlopePivotMode . ORIGIN : //don't translate
return new Vector3D ( 0 , 0 , offset ) ;
2014-09-04 12:34:26 +00:00
default :
Added, Sector Edit window, UDMF: added UI for sector damage-realted properties.
Added, DECORATE parser: damage types are now parsed.
Added: the editor now reports duplicate textures/flats/patches/sprites/colormaps/voxels in the loaded wads.
Added, all text parsers: added #region/#endregion support.
Added TERRAIN parser.
Added, Script Editor: added special handling for DECORATE special comments.
Added, Sector Edit window, UDMF: Soundsequence value was setup incorrectly when showing the window for multiple sectors with mixed Soundsequence value.
Fixed, Map Options window: "Strictly load patches between P_START and P_END" was not applied when applying the changes.
Fixed, MAPINFO parser: MapInfo should be treated as defined when a map MAPINFO block corresponding to current map is encountered even if it doesn't define any properties recognized by the editor.
Fixed, all text parsers: in some cases error line was calculated incorrectly when reporting an error detected by a text parser.
Cosmetic: changed ' to " in the rest of Error and Warning messages.
Internal: added text resource tracking.
Updated ZDoom_DECORATE.cfg.
Updated documentation ("Game Configuration - Basic Settings" page).
2016-02-22 12:33:19 +00:00
throw new NotImplementedException ( "Unknown SlopePivotMode: " + ( int ) mode ) ;
2014-09-04 12:34:26 +00:00
}
}
#endregion
#region = = = = = = = = = = = = = = = = = = Slopes realtime events ( mxd )
2014-08-05 08:22:49 +00:00
2014-09-04 12:34:26 +00:00
private void ceilingslopecontrol_OnAnglesChanged ( object sender , EventArgs e )
2014-08-25 11:15:19 +00:00
{
2015-01-26 08:53:05 +00:00
if ( preventchanges ) return ;
MakeUndo ( ) ; //mxd
2014-08-05 08:22:49 +00:00
2014-08-25 11:15:19 +00:00
//Set or restore values
foreach ( Sector s in sectors )
{
2015-12-28 15:01:53 +00:00
float anglexy = General . ClampAngle ( ceilingslopecontrol . GetAngleXY ( sectorprops [ s ] . CeilSlopeAngleXY ) + 270 ) ;
float anglez = - ( ceilingslopecontrol . GetAngleZ ( sectorprops [ s ] . CeilSlopeAngleZ ) + 90 ) ;
2014-10-17 11:55:08 +00:00
float virtualoffset = GetInitialVirtualSlopeOffset ( s , ceilingslopecontrol . PivotMode , false ) ;
Vector3D center = GetSectorCenter ( s , ceilingslopecontrol . GetOffset ( virtualoffset ) , ceilingslopecontrol . PivotMode ) ;
Plane p = new Plane ( center , Angle2D . DegToRad ( anglexy ) , Angle2D . DegToRad ( anglez ) , false ) ;
s . CeilSlope = p . Normal ;
s . CeilSlopeOffset = p . Offset ;
s . CeilHeight = ( int ) Math . Round ( p . GetZ ( center . x , center . y ) ) ;
2014-08-25 11:15:19 +00:00
s . UpdateNeeded = true ;
2014-08-05 08:22:49 +00:00
}
General . Map . IsChanged = true ;
2014-08-25 11:15:19 +00:00
if ( OnValuesChanged ! = null ) OnValuesChanged ( this , EventArgs . Empty ) ;
2014-08-05 08:22:49 +00:00
}
2014-09-04 12:34:26 +00:00
private void floorslopecontrol_OnAnglesChanged ( object sender , EventArgs e )
2014-08-25 11:15:19 +00:00
{
2015-01-26 08:53:05 +00:00
if ( preventchanges ) return ;
MakeUndo ( ) ; //mxd
2014-08-05 08:22:49 +00:00
2014-08-25 11:15:19 +00:00
//Set or restore values
foreach ( Sector s in sectors )
{
2015-12-28 15:01:53 +00:00
float anglexy = General . ClampAngle ( floorslopecontrol . GetAngleXY ( sectorprops [ s ] . FloorSlopeAngleXY ) + 90 ) ;
float anglez = - ( floorslopecontrol . GetAngleZ ( sectorprops [ s ] . FloorSlopeAngleZ ) + 90 ) ;
2014-10-17 11:55:08 +00:00
float virtualoffset = GetInitialVirtualSlopeOffset ( s , floorslopecontrol . PivotMode , true ) ;
Vector3D center = GetSectorCenter ( s , floorslopecontrol . GetOffset ( virtualoffset ) , floorslopecontrol . PivotMode ) ;
Plane p = new Plane ( center , Angle2D . DegToRad ( anglexy ) , Angle2D . DegToRad ( anglez ) , true ) ;
s . FloorSlope = p . Normal ;
s . FloorSlopeOffset = p . Offset ;
s . FloorHeight = ( int ) Math . Round ( p . GetZ ( center . x , center . y ) ) ;
2014-08-25 11:15:19 +00:00
s . UpdateNeeded = true ;
2014-08-05 08:22:49 +00:00
}
General . Map . IsChanged = true ;
2014-08-25 11:15:19 +00:00
if ( OnValuesChanged ! = null ) OnValuesChanged ( this , EventArgs . Empty ) ;
2014-08-11 08:35:39 +00:00
}
2014-10-17 11:55:08 +00:00
// Update displayed ceiling offset value
2014-09-04 12:34:26 +00:00
private void ceilingslopecontrol_OnPivotModeChanged ( object sender , EventArgs e )
2014-08-11 08:35:39 +00:00
{
2015-01-26 08:53:05 +00:00
MakeUndo ( ) ; //mxd
2014-10-17 11:55:08 +00:00
bool first = true ;
2015-12-28 15:01:53 +00:00
foreach ( Sector s in sectors )
2014-10-17 11:55:08 +00:00
{
SetupCeilingSlope ( s , first ) ;
first = false ;
2014-08-05 08:22:49 +00:00
}
2014-09-04 12:34:26 +00:00
}
2014-08-05 08:22:49 +00:00
2014-10-17 11:55:08 +00:00
// Update displayed floor offset value
private void floorslopecontrol_OnPivotModeChanged ( object sender , EventArgs e )
2014-09-04 12:34:26 +00:00
{
2015-01-26 08:53:05 +00:00
MakeUndo ( ) ; //mxd
2014-10-17 11:55:08 +00:00
bool first = true ;
2015-12-28 15:01:53 +00:00
foreach ( Sector s in sectors )
2014-10-17 11:55:08 +00:00
{
SetupFloorSlope ( s , first ) ;
first = false ;
2014-09-04 12:34:26 +00:00
}
}
2014-08-05 08:22:49 +00:00
2014-09-04 12:34:26 +00:00
private void ceilingslopecontrol_OnResetClicked ( object sender , EventArgs e )
{
2015-01-26 08:53:05 +00:00
MakeUndo ( ) ; //mxd
2014-09-15 08:15:22 +00:00
ceilingslopecontrol . SetOffset ( General . GetByIndex ( sectors , 0 ) . CeilHeight , true ) ;
2014-10-17 11:55:08 +00:00
foreach ( Sector s in sectors )
{
s . CeilSlope = new Vector3D ( ) ;
s . CeilSlopeOffset = float . NaN ;
s . CeilHeight = ceilingheight . GetResult ( sectorprops [ s ] . CeilHeight ) ;
2014-09-04 12:34:26 +00:00
s . UpdateNeeded = true ;
2014-09-15 08:15:22 +00:00
ceilingslopecontrol . SetOffset ( s . CeilHeight , false ) ;
2014-09-04 12:34:26 +00:00
}
2014-09-15 08:15:22 +00:00
ceilingslopecontrol . UpdateOffset ( ) ;
2014-09-04 12:34:26 +00:00
General . Map . IsChanged = true ;
if ( OnValuesChanged ! = null ) OnValuesChanged ( this , EventArgs . Empty ) ;
}
2014-08-05 08:22:49 +00:00
2014-09-04 12:34:26 +00:00
private void floorslopecontrol_OnResetClicked ( object sender , EventArgs e )
{
2015-01-26 08:53:05 +00:00
MakeUndo ( ) ; //mxd
2014-09-15 08:15:22 +00:00
floorslopecontrol . SetOffset ( General . GetByIndex ( sectors , 0 ) . FloorHeight , true ) ;
2014-10-17 11:55:08 +00:00
foreach ( Sector s in sectors )
{
2014-09-04 12:34:26 +00:00
s . FloorSlope = new Vector3D ( ) ;
s . FloorSlopeOffset = float . NaN ;
2014-10-17 11:55:08 +00:00
s . FloorHeight = floorheight . GetResult ( sectorprops [ s ] . FloorHeight ) ;
2014-09-04 12:34:26 +00:00
s . UpdateNeeded = true ;
2014-09-15 08:15:22 +00:00
floorslopecontrol . SetOffset ( s . FloorHeight , false ) ;
2014-08-05 08:22:49 +00:00
}
2014-09-15 08:15:22 +00:00
floorslopecontrol . UpdateOffset ( ) ;
2014-09-04 12:34:26 +00:00
General . Map . IsChanged = true ;
if ( OnValuesChanged ! = null ) OnValuesChanged ( this , EventArgs . Empty ) ;
2014-08-25 11:15:19 +00:00
}
2014-08-05 08:22:49 +00:00
2014-08-25 11:15:19 +00:00
private void ceilingslopecontrol_OnUseLineAnglesChanged ( object sender , EventArgs e )
{
ceilingslopecontrol . StepValues = ( ceilingslopecontrol . UseLineAngles ? anglesteps : null ) ;
}
2014-08-05 08:22:49 +00:00
2014-08-25 11:15:19 +00:00
private void floorslopecontrol_OnUseLineAnglesChanged ( object sender , EventArgs e )
{
floorslopecontrol . StepValues = ( floorslopecontrol . UseLineAngles ? anglesteps : null ) ;
}
2014-08-05 08:22:49 +00:00
#endregion
2013-06-25 12:35:13 +00:00
}
}