2014-10-17 11:55:08 +00:00
#region = = = = = = = = = = = = = = = = = = Namespaces
using System ;
2013-06-25 12:35:13 +00:00
using System.Collections.Generic ;
2023-10-24 13:51:49 +00:00
using System.Linq ;
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 ;
2016-11-16 20:31:04 +00:00
using CodeImp.DoomBuilder.Rendering ;
2013-06-25 12:35:13 +00:00
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
2016-10-11 12:58:35 +00:00
private readonly List < string > renderstyles ; //mxd
private readonly List < string > portalrenderstyles ; //mxd
2014-08-25 11:15:19 +00:00
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
2021-04-01 21:31:52 +00:00
private bool oldmapischanged ;
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 ;
2016-12-29 15:15:35 +00:00
public readonly int FogDensity ;
2013-07-19 15:30:58 +00:00
//public float Desaturation;
//UDMF Ceiling
2020-05-21 12:20:02 +00:00
public readonly double CeilOffsetX ;
public readonly double CeilOffsetY ;
public readonly double CeilScaleX ;
public readonly double CeilScaleY ;
2013-07-19 15:30:58 +00:00
//public float CeilAlpha;
2020-05-21 12:20:02 +00:00
public readonly double CeilRotation ;
2014-05-05 14:24:57 +00:00
public readonly int CeilBrightness ;
public readonly bool CeilLightAbsoulte ;
2016-12-29 15:15:35 +00:00
public readonly int CeilGlowColor ;
2020-05-21 12:20:02 +00:00
public readonly double CeilGlowHeight ;
2013-07-19 15:30:58 +00:00
//UDMF Floor
2020-05-21 12:20:02 +00:00
public readonly double FloorOffsetX ;
public readonly double FloorOffsetY ;
public readonly double FloorScaleX ;
public readonly double FloorScaleY ;
2013-07-19 15:30:58 +00:00
//public float FloorAlpha;
2020-05-21 12:20:02 +00:00
public readonly double FloorRotation ;
2014-05-05 14:24:57 +00:00
public readonly int FloorBrightness ;
public readonly bool FloorLightAbsoulte ;
2016-12-29 15:15:35 +00:00
public readonly int FloorGlowColor ;
2020-05-21 12:20:02 +00:00
public readonly double FloorGlowHeight ;
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 ;
2020-05-18 16:14:54 +00:00
public readonly double FloorSlopeAngleXY ;
public readonly double FloorSlopeAngleZ ;
public readonly double FloorSlopeOffset ;
public readonly double CeilSlopeAngleXY ;
public readonly double CeilSlopeAngleZ ;
public readonly double CeilSlopeOffset ;
2014-08-05 08:22:49 +00:00
2017-03-08 23:00:20 +00:00
//[ZZ] UDMF Doom64 sector colors
public readonly int D64ColorCeiling ;
public readonly int D64ColorWallTop ;
public readonly int D64ColorWallBottom ;
public readonly int D64ColorFloor ;
public readonly int D64ColorThings ;
public SectorProperties ( Sector s )
2014-10-17 11:55:08 +00:00
{
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
2016-11-16 20:31:04 +00:00
LightColor = UniFields . GetInteger ( s . Fields , "lightcolor" , PixelColor . INT_WHITE_NO_ALPHA ) ;
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
FadeColor = UniFields . GetInteger ( s . Fields , "fadecolor" , 0 ) ;
2016-12-29 15:15:35 +00:00
FogDensity = UniFields . GetInteger ( s . Fields , "fogdensity" , 0 ) ;
2013-07-19 15:30:58 +00:00
//UDMF Ceiling
2020-05-22 19:39:18 +00:00
CeilOffsetX = UniFields . GetFloat ( s . Fields , "xpanningceiling" , 0.0 ) ;
CeilOffsetY = UniFields . GetFloat ( s . Fields , "ypanningceiling" , 0.0 ) ;
CeilScaleX = UniFields . GetFloat ( s . Fields , "xscaleceiling" , 1.0 ) ;
CeilScaleY = UniFields . GetFloat ( s . Fields , "yscaleceiling" , 1.0 ) ;
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
//CeilAlpha = UniFields.GetFloat(s.Fields, "alphaceiling", 1.0f);
2020-05-22 19:39:18 +00:00
CeilRotation = s . Fields . GetValue ( "rotationceiling" , 0.0 ) ;
2013-07-19 15:30:58 +00:00
CeilBrightness = s . Fields . GetValue ( "lightceiling" , 0 ) ;
CeilLightAbsoulte = s . Fields . GetValue ( "lightceilingabsolute" , false ) ;
2016-12-29 15:15:35 +00:00
CeilGlowColor = s . Fields . GetValue ( "ceilingglowcolor" , 0 ) ;
2020-05-22 19:39:18 +00:00
CeilGlowHeight = s . Fields . GetValue ( "ceilingglowheight" , 0.0 ) ;
2013-07-19 15:30:58 +00:00
//UDMF Floor
2020-05-22 19:39:18 +00:00
FloorOffsetX = UniFields . GetFloat ( s . Fields , "xpanningfloor" , 0.0 ) ;
FloorOffsetY = UniFields . GetFloat ( s . Fields , "ypanningfloor" , 0.0 ) ;
FloorScaleX = UniFields . GetFloat ( s . Fields , "xscalefloor" , 1.0 ) ;
FloorScaleY = UniFields . GetFloat ( s . Fields , "yscalefloor" , 1.0 ) ;
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
//FloorAlpha = UniFields.GetFloat(s.Fields, "alphafloor", 1.0f);
2020-05-22 19:39:18 +00:00
FloorRotation = s . Fields . GetValue ( "rotationfloor" , 0.0 ) ;
2013-07-19 15:30:58 +00:00
FloorBrightness = s . Fields . GetValue ( "lightfloor" , 0 ) ;
FloorLightAbsoulte = s . Fields . GetValue ( "lightfloorabsolute" , false ) ;
2016-12-29 15:15:35 +00:00
FloorGlowColor = s . Fields . GetValue ( "floorglowcolor" , 0 ) ;
2020-05-22 19:39:18 +00:00
FloorGlowHeight = s . Fields . GetValue ( "floorglowheight" , 0.0 ) ;
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
{
2020-05-22 20:30:32 +00:00
FloorSlopeAngleXY = General . ClampAngle ( Math . Round ( Angle2D . RadToDeg ( s . FloorSlope . GetAngleXY ( ) ) - 180 , 1 ) ) ;
2020-05-18 16:14:54 +00:00
FloorSlopeAngleZ = - Math . Round ( Angle2D . RadToDeg ( s . FloorSlope . GetAngleZ ( ) ) - 90 , 1 ) ;
FloorSlopeOffset = ( double . IsNaN ( s . FloorSlopeOffset ) ? s . FloorHeight : s . FloorSlopeOffset ) ;
2014-10-17 11:55:08 +00:00
}
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
{
2020-05-22 20:30:32 +00:00
CeilSlopeAngleXY = General . ClampAngle ( Math . Round ( Angle2D . RadToDeg ( s . CeilSlope . GetAngleXY ( ) ) - 180 , 1 ) ) ;
2020-05-18 16:14:54 +00:00
CeilSlopeAngleZ = - Math . Round ( 270 - Angle2D . RadToDeg ( s . CeilSlope . GetAngleZ ( ) ) , 1 ) ;
CeilSlopeOffset = ( double . IsNaN ( s . CeilSlopeOffset ) ? s . CeilHeight : s . CeilSlopeOffset ) ;
2014-10-17 11:55:08 +00:00
}
else
{
CeilSlopeAngleXY = 0 ;
CeilSlopeAngleZ = 0 ;
CeilSlopeOffset = s . CeilHeight ;
2014-08-25 11:15:19 +00:00
}
2017-03-08 23:00:20 +00:00
CeilSlope = s . CeilSlope ;
D64ColorCeiling = s . Fields . GetValue ( "color_ceiling" , PixelColor . INT_WHITE_NO_ALPHA ) ;
D64ColorWallTop = s . Fields . GetValue ( "color_walltop" , PixelColor . INT_WHITE_NO_ALPHA ) ;
2017-03-08 23:24:31 +00:00
D64ColorThings = s . Fields . GetValue ( "color_sprites" , PixelColor . INT_WHITE_NO_ALPHA ) ;
2017-03-08 23:00:20 +00:00
D64ColorWallBottom = s . Fields . GetValue ( "color_wallbottom" , PixelColor . INT_WHITE_NO_ALPHA ) ;
D64ColorFloor = s . Fields . GetValue ( "color_floor" , PixelColor . INT_WHITE_NO_ALPHA ) ;
}
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 ( ) ;
2023-10-24 13:51:49 +00:00
DoUDMFControls ( this ) ;
// Plane equation slopes are handled internally instead through the UDMF fields, so they need special attention
EnableDisableControlAndChildren ( gbCeilingSLope , General . Map . Config . PlaneEquationSupport ) ;
EnableDisableControlAndChildren ( gbFloorSlope , General . Map . Config . PlaneEquationSupport ) ;
2016-12-02 13:45:03 +00:00
//mxd. Load settings
2023-10-24 13:51:49 +00:00
if ( General . Settings . StoreSelectedEditTab )
2014-10-17 11:55:08 +00:00
{
2016-12-02 13:45:03 +00:00
int activetab = General . Settings . ReadSetting ( "windows." + configname + ".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
2016-10-11 12:58:35 +00:00
// Fill floor protal flags list
foreach ( KeyValuePair < string , string > lf in General . Map . Config . FloorPortalFlags )
floorportalflags . Add ( lf . Value , lf . Key ) ;
floorportalflags . Enabled = General . Map . Config . FloorPortalFlags . Count > 0 ;
// Fill ceiling protal flags list
foreach ( KeyValuePair < string , string > lf in General . Map . Config . CeilingPortalFlags )
ceilportalflags . Add ( lf . Value , lf . Key ) ;
ceilportalflags . Enabled = General . Map . Config . CeilingPortalFlags . Count > 0 ;
2014-12-04 10:06:44 +00:00
// Setup renderstyles
2016-10-11 12:58:35 +00:00
if ( General . Map . Config . SectorRenderStyles . Count > 0 )
{
string [ ] rskeys = new string [ General . Map . Config . SectorRenderStyles . Count ] ;
General . Map . Config . SectorRenderStyles . Keys . CopyTo ( rskeys , 0 ) ;
renderstyles = new List < string > ( rskeys ) ;
}
else
{
renderstyles = new List < string > ( ) ;
}
2014-12-04 10:06:44 +00:00
// Fill renderstyles
2016-10-11 12:58:35 +00:00
foreach ( string name in General . Map . Config . SectorRenderStyles . Values )
{
floorRenderStyle . Items . Add ( name ) ;
ceilRenderStyle . Items . Add ( name ) ;
}
// Setup portal renderstyles
if ( General . Map . Config . SectorPortalRenderStyles . Count > 0 )
{
string [ ] rskeys = new string [ General . Map . Config . SectorPortalRenderStyles . Count ] ;
General . Map . Config . SectorPortalRenderStyles . Keys . CopyTo ( rskeys , 0 ) ;
portalrenderstyles = new List < string > ( rskeys ) ;
}
else
{
portalrenderstyles = new List < string > ( ) ;
}
// Fill portal renderstyles
foreach ( string name in General . Map . Config . SectorPortalRenderStyles . Values )
2014-10-17 11:55:08 +00:00
{
2016-10-11 12:58:35 +00:00
floorportalrenderstyle . Items . Add ( name ) ;
ceilportalrenderstyle . Items . Add ( name ) ;
2014-05-05 14:24:57 +00:00
}
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 ;
2016-12-02 13:45:03 +00:00
// Apply settings
ceilScale . LinkValues = General . Settings . ReadSetting ( "windows." + configname + ".linkceilingscale" , false ) ;
floorScale . LinkValues = General . Settings . ReadSetting ( "windows." + configname + ".linkfloorscale" , false ) ;
2013-08-12 10:15:08 +00:00
2016-12-02 13:45:03 +00:00
cbUseCeilLineAngles . Checked = General . Settings . ReadSetting ( "windows." + configname + ".useceillineangles" , false ) ;
cbUseFloorLineAngles . Checked = General . Settings . ReadSetting ( "windows." + configname + ".usefloorlineangles" , false ) ;
2014-08-05 08:22:49 +00:00
2016-12-02 13:45:03 +00:00
ceilingslopecontrol . UseLineAngles = General . Settings . ReadSetting ( "windows." + configname + ".useceilslopelineangles" , false ) ;
floorslopecontrol . UseLineAngles = General . Settings . ReadSetting ( "windows." + configname + ".usefloorslopelineangles" , false ) ;
2014-10-17 11:55:08 +00:00
2016-12-02 13:45:03 +00:00
ceilingslopecontrol . PivotMode = ( SlopePivotMode ) General . Settings . ReadSetting ( "windows." + configname + ".ceilpivotmode" , ( int ) SlopePivotMode . LOCAL ) ;
floorslopecontrol . PivotMode = ( SlopePivotMode ) General . Settings . ReadSetting ( "windows." + configname + ".floorpivotmode" , ( int ) SlopePivotMode . LOCAL ) ;
2021-09-06 21:05:58 +00:00
// Diable brightness controls?
2021-09-13 19:19:48 +00:00
if ( ! General . Map . Config . DistinctFloorAndCeilingBrightness )
2021-09-06 21:05:58 +00:00
{
ceilBrightness . Enabled = false ;
ceilLightAbsolute . Enabled = false ;
resetceillight . Enabled = false ;
floorBrightness . Enabled = false ;
floorLightAbsolute . Enabled = false ;
resetfloorlight . Enabled = false ;
}
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
2021-04-01 21:31:52 +00:00
oldmapischanged = General . Map . IsChanged ;
undocreated = false ;
2017-02-08 12:18:01 +00:00
// Keep this list
this . sectors = sectors ;
2013-06-25 12:35:13 +00:00
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 ( ) ] ;
2016-10-11 12:58:35 +00:00
// Portal flags
foreach ( CheckBox c in floorportalflags . Checkboxes )
if ( sc . Flags . ContainsKey ( c . Tag . ToString ( ) ) ) c . Checked = sc . Flags [ c . Tag . ToString ( ) ] ;
foreach ( CheckBox c in ceilportalflags . 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 ;
2016-12-29 15:15:35 +00:00
// 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
2016-12-29 15:15:35 +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
2016-12-29 15:15:35 +00:00
// Texture rotation
2020-05-22 19:39:18 +00:00
double ceilAngle = sc . Fields . GetValue ( "rotationceiling" , 0.0 ) ;
double floorAngle = sc . Fields . GetValue ( "rotationfloor" , 0.0 ) ;
2013-06-25 12:35:13 +00:00
ceilRotation . Text = ceilAngle . ToString ( ) ;
floorRotation . Text = floorAngle . ToString ( ) ;
ceilAngleControl . Angle = General . ClampAngle ( 360 - ( int ) ceilAngle ) ;
floorAngleControl . Angle = General . ClampAngle ( 360 - ( int ) floorAngle ) ;
2016-12-29 15:15:35 +00:00
// Texture brightness
2013-06-25 12:35:13 +00:00
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
2016-10-11 12:58:35 +00:00
// Portal alpha
2020-05-22 19:39:18 +00:00
alphaceiling . Text = General . Clamp ( sc . Fields . GetValue ( "alphaceiling" , 1.0 ) , 0.0 , 1.0 ) . ToString ( ) ;
alphafloor . Text = General . Clamp ( sc . Fields . GetValue ( "alphafloor" , 1.0 ) , 0.0 , 1.0 ) . ToString ( ) ;
2016-12-29 15:15:35 +00:00
// Reflectivity
2020-05-22 19:39:18 +00:00
ceiling_reflect . Text = General . Clamp ( sc . Fields . GetValue ( "ceiling_reflect" , 0.0 ) , 0.0 , 1.0 ) . ToString ( ) ;
floor_reflect . Text = General . Clamp ( sc . Fields . GetValue ( "floor_reflect" , 0.0 ) , 0.0 , 1.0 ) . ToString ( ) ;
2016-12-29 15:15:35 +00:00
// Fog density
fogdensity . Text = General . Clamp ( sc . Fields . GetValue ( "fogdensity" , 0 ) , 0 , 510 ) . ToString ( ) ;
// Floor/ceiling glow
2017-01-04 13:28:36 +00:00
int ceilingglowcolorval = sc . Fields . GetValue ( "ceilingglowcolor" , 0 ) ;
int floorglowcolorval = sc . Fields . GetValue ( "floorglowcolor" , 0 ) ;
2016-12-29 15:15:35 +00:00
ceilingglowcolor . SetValueFrom ( sc . Fields , true ) ;
floorglowcolor . SetValueFrom ( sc . Fields , true ) ;
2016-10-11 12:58:35 +00:00
2016-12-29 15:15:35 +00:00
// Floor/ceiling glow height
2020-05-22 19:39:18 +00:00
ceilingglowheight . Text = sc . Fields . GetValue ( "ceilingglowheight" , 0.0 ) . ToString ( ) ;
floorglowheight . Text = sc . Fields . GetValue ( "floorglowheight" , 0.0 ) . ToString ( ) ;
2016-12-29 15:15:35 +00:00
// Render style
2016-10-11 12:58:35 +00:00
ceilRenderStyle . SelectedIndex = renderstyles . IndexOf ( sc . Fields . GetValue ( "renderstyleceiling" , "translucent" ) ) ;
floorRenderStyle . SelectedIndex = renderstyles . IndexOf ( sc . Fields . GetValue ( "renderstylefloor" , "translucent" ) ) ;
// Portal render style
2021-03-06 20:28:00 +00:00
if ( portalrenderstyles . Count > 0 )
{
ceilportalrenderstyle . SelectedIndex = portalrenderstyles . IndexOf ( sc . Fields . GetValue ( "portal_ceil_overlaytype" , portalrenderstyles [ 0 ] ) ) ;
floorportalrenderstyle . SelectedIndex = portalrenderstyles . IndexOf ( sc . Fields . GetValue ( "portal_floor_overlaytype" , portalrenderstyles [ 0 ] ) ) ;
}
2013-06-25 12:35:13 +00:00
2016-12-29 15:15:35 +00:00
// Damage
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
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 ( ) ;
2016-12-29 15:15:35 +00:00
// Terrain
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
ceilterrain . Text = sc . Fields . GetValue ( "ceilingterrain" , NO_TERRAIN ) ;
floorterrain . Text = sc . Fields . GetValue ( "floorterrain" , NO_TERRAIN ) ;
2016-12-29 15:15:35 +00:00
// Misc
2015-02-14 18:15:11 +00:00
soundsequence . Text = sc . Fields . GetValue ( "soundsequence" , NO_SOUND_SEQUENCE ) ;
2020-05-22 19:39:18 +00:00
gravity . Text = sc . Fields . GetValue ( "gravity" , 1.0 ) . ToString ( ) ;
desaturation . Text = General . Clamp ( sc . Fields . GetValue ( "desaturation" , 0.0 ) , 0.0 , 1.0 ) . ToString ( ) ;
2013-06-25 12:35:13 +00:00
2016-12-29 15:15:35 +00:00
// Sector colors
2016-03-23 21:26:26 +00:00
fadeColor . SetValueFrom ( sc . Fields , true ) ;
lightColor . SetValueFrom ( sc . Fields , true ) ;
2013-06-25 12:35:13 +00:00
2017-03-08 23:00:20 +00:00
// [ZZ]
ceilingColor . SetValueFrom ( sc . Fields , true ) ;
upperWallColor . SetValueFrom ( sc . Fields , true ) ;
thingsColor . SetValueFrom ( sc . Fields , true ) ;
lowerWallColor . SetValueFrom ( sc . Fields , true ) ;
floorColor . SetValueFrom ( sc . Fields , true ) ;
// Slopes
SetupFloorSlope ( sc , true ) ;
2014-10-17 11:55:08 +00:00
SetupCeilingSlope ( sc , true ) ;
2014-08-05 08:22:49 +00:00
2013-06-25 12:35:13 +00:00
// Custom fields
fieldslist . SetValues ( sc . Fields , true ) ;
2016-12-29 15:15:35 +00:00
// Comments
2015-07-14 23:34:31 +00:00
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
2016-10-11 12:58:35 +00:00
SetupFlags ( flags , s ) ;
SetupFlags ( ceilportalflags , s ) ;
SetupFlags ( floorportalflags , s ) ;
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
2016-12-29 15:15:35 +00:00
// 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
2016-12-29 15:15:35 +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
2016-12-29 15:15:35 +00:00
// Texture rotation
2020-05-22 19:39:18 +00:00
if ( s . Fields . GetValue ( "rotationceiling" , 0.0 ) . ToString ( ) ! = ceilRotation . Text )
2014-10-17 11:55:08 +00:00
{
2013-06-25 12:35:13 +00:00
ceilRotation . Text = "" ;
2016-04-27 09:13:07 +00:00
ceilAngleControl . Angle = AngleControlEx . NO_ANGLE ;
2013-06-25 12:35:13 +00:00
}
2020-05-22 19:39:18 +00:00
if ( s . Fields . GetValue ( "rotationfloor" , 0.0 ) . ToString ( ) ! = floorRotation . Text )
2014-10-17 11:55:08 +00:00
{
2013-06-25 12:35:13 +00:00
floorRotation . Text = "" ;
2016-04-27 09:13:07 +00:00
floorAngleControl . Angle = AngleControlEx . NO_ANGLE ;
2013-06-25 12:35:13 +00:00
}
2016-12-29 15:15:35 +00:00
// Texture brightness
2013-06-25 12:35:13 +00:00
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
2016-10-11 12:58:35 +00:00
// Portal alpha
2020-05-22 19:39:18 +00:00
if ( s . Fields . GetValue ( "alphaceiling" , 1.0 ) . ToString ( ) ! = alphaceiling . Text ) alphaceiling . Text = "" ;
if ( s . Fields . GetValue ( "alphafloor" , 1.0 ) . ToString ( ) ! = alphafloor . Text ) alphafloor . Text = "" ;
2016-12-29 15:15:35 +00:00
// Reflectivity
2020-05-22 19:39:18 +00:00
if ( s . Fields . GetValue ( "ceiling_reflect" , 0.0 ) . ToString ( ) ! = ceiling_reflect . Text ) ceiling_reflect . Text = "" ;
if ( s . Fields . GetValue ( "floor_reflect" , 0.0 ) . ToString ( ) ! = floor_reflect . Text ) floor_reflect . Text = "" ;
2016-12-29 15:15:35 +00:00
// Fog density
if ( s . Fields . GetValue ( "fogdensity" , 0 ) . ToString ( ) ! = fogdensity . Text ) fogdensity . Text = "" ;
2016-10-11 12:58:35 +00:00
2016-12-29 15:15:35 +00:00
// Floor/ceiling glow
if ( floorglowcolorval ! = s . Fields . GetValue ( "floorglowcolor" , 0 ) ) floorglowcolorval = 0 ;
if ( ceilingglowcolorval ! = s . Fields . GetValue ( "ceilingglowcolor" , 0 ) ) ceilingglowcolorval = 0 ;
ceilingglowcolor . SetValueFrom ( s . Fields , false ) ;
floorglowcolor . SetValueFrom ( s . Fields , false ) ;
// Floor/ceiling glow height
2020-05-22 19:39:18 +00:00
if ( s . Fields . GetValue ( "ceilingglowheight" , 0.0 ) . ToString ( ) ! = ceilingglowheight . Text ) ceilingglowheight . Text = "" ;
if ( s . Fields . GetValue ( "floorglowheight" , 0.0 ) . ToString ( ) ! = floorglowheight . Text ) floorglowheight . Text = "" ;
2016-12-29 15:15:35 +00:00
// Render style
2016-10-11 12:58:35 +00:00
if ( ceilRenderStyle . SelectedIndex > - 1 & & ceilRenderStyle . SelectedIndex ! = renderstyles . IndexOf ( s . Fields . GetValue ( "renderstyleceiling" , "translucent" ) ) )
2014-12-04 10:06:44 +00:00
ceilRenderStyle . SelectedIndex = - 1 ;
2016-10-11 12:58:35 +00:00
if ( floorRenderStyle . SelectedIndex > - 1 & & floorRenderStyle . SelectedIndex ! = renderstyles . IndexOf ( s . Fields . GetValue ( "renderstylefloor" , "translucent" ) ) )
2014-12-04 10:06:44 +00:00
floorRenderStyle . SelectedIndex = - 1 ;
2013-06-25 12:35:13 +00:00
2016-10-11 12:58:35 +00:00
// Portal render style
2021-03-06 20:28:00 +00:00
if ( ceilportalrenderstyle . SelectedIndex > - 1 & & ceilportalrenderstyle . SelectedIndex ! = portalrenderstyles . IndexOf ( s . Fields . GetValue ( "portal_ceil_overlaytype" , portalrenderstyles [ 0 ] ) ) )
2016-10-11 12:58:35 +00:00
ceilportalrenderstyle . SelectedIndex = - 1 ;
2021-03-06 20:28:00 +00:00
if ( floorportalrenderstyle . SelectedIndex > - 1 & & floorportalrenderstyle . SelectedIndex ! = portalrenderstyles . IndexOf ( s . Fields . GetValue ( "portal_floor_overlaytype" , portalrenderstyles [ 0 ] ) ) )
2016-10-11 12:58:35 +00:00
floorportalrenderstyle . SelectedIndex = - 1 ;
2016-12-29 15:15:35 +00:00
// Damage
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 ( 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 = "" ;
2016-12-29 15:15:35 +00:00
// Terrain
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 ( 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 ;
2016-12-29 15:15:35 +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 ;
2020-05-22 19:39:18 +00:00
if ( s . Fields . GetValue ( "gravity" , 1.0 ) . ToString ( ) ! = gravity . Text ) gravity . Text = "" ;
if ( s . Fields . GetValue ( "desaturation" , 0.0 ) . ToString ( ) ! = desaturation . Text ) desaturation . Text = "" ;
2013-06-25 12:35:13 +00:00
2016-12-29 15:15:35 +00:00
// Sector colors
2016-03-23 21:26:26 +00:00
fadeColor . SetValueFrom ( s . Fields , false ) ;
lightColor . SetValueFrom ( s . Fields , false ) ;
2013-06-25 12:35:13 +00:00
2017-03-08 23:00:20 +00:00
// [ZZ]
ceilingColor . SetValueFrom ( s . Fields , false ) ;
upperWallColor . SetValueFrom ( s . Fields , false ) ;
thingsColor . SetValueFrom ( s . Fields , false ) ;
lowerWallColor . SetValueFrom ( s . Fields , false ) ;
floorColor . SetValueFrom ( s . Fields , false ) ;
// Slopes
SetupFloorSlope ( s , false ) ;
2014-10-17 11:55:08 +00:00
SetupCeilingSlope ( s , false ) ;
2014-08-05 08:22:49 +00:00
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
}
2017-03-08 23:00:20 +00:00
//mxd. Glow is disabled?
if ( floorglowcolorval = = - 1 )
floorGlowEnabled . Checked = false ;
2016-12-29 15:15:35 +00:00
2017-03-08 23:00:20 +00:00
if ( ceilingglowcolorval = = - 1 )
ceilingGlowEnabled . Checked = false ;
//mxd. Update "Reset" buttons...
if ( ceiling_reflect . Text = = "0" ) reset_ceiling_reflect . Visible = false ;
2016-12-29 15:15:35 +00:00
if ( floor_reflect . Text = = "0" ) reset_floor_reflect . Visible = false ;
if ( ceilingglowheight . Text = = "0" ) resetceilingglowheight . Visible = false ;
if ( floorglowheight . Text = = "0" ) resetfloorglowheight . Visible = false ;
2017-01-04 13:28:36 +00:00
//mxd. Cause Graf was not into non-zero default glow height...
UpdateCeilingGlowHeightWarning ( ) ;
UpdateFloorGlowHeightWarning ( ) ;
2016-04-09 23:18:39 +00:00
//mxd. Setup tags
tagsselector . SetValues ( sectors ) ;
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-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 ( ) ;
2016-12-02 13:45:03 +00:00
if ( cbUseCeilLineAngles . Checked ) ceilRotation . StepValues = anglesteps ;
if ( cbUseFloorLineAngles . Checked ) floorRotation . StepValues = anglesteps ;
if ( ceilingslopecontrol . UseLineAngles ) ceilingslopecontrol . StepValues = anglesteps ;
if ( floorslopecontrol . UseLineAngles ) floorslopecontrol . StepValues = anglesteps ;
2013-08-12 10:15:08 +00:00
2016-04-09 23:18:39 +00:00
//mxd. Comments
2015-07-14 23:34:31 +00:00
commenteditor . FinishSetup ( ) ;
2015-01-26 08:53:05 +00:00
preventchanges = false ; //mxd
}
2016-10-11 12:58:35 +00:00
//mxd
private static void SetupFlags ( CheckboxArrayControl control , Sector s )
{
foreach ( CheckBox c in control . Checkboxes )
{
if ( c . CheckState = = CheckState . Indeterminate ) continue ; //mxd
if ( s . IsFlagSet ( c . Tag . ToString ( ) ) ! = c . Checked )
{
c . ThreeState = true ;
c . CheckState = CheckState . Indeterminate ;
}
}
}
//mxd
private static void ApplyFlags ( CheckboxArrayControl control , Sector s )
{
foreach ( CheckBox c in control . Checkboxes )
{
switch ( c . CheckState )
{
case CheckState . Checked : s . SetFlag ( c . Tag . ToString ( ) , true ) ; break ;
case CheckState . Unchecked : s . SetFlag ( c . Tag . ToString ( ) , false ) ; break ;
}
}
}
//mxd
2016-12-29 15:15:35 +00:00
private static void ApplyFloatProperty ( ButtonsNumericTextbox control , Sector s , float defaultvalue )
2016-10-11 12:58:35 +00:00
{
if ( ! string . IsNullOrEmpty ( control . Text ) )
{
2020-05-22 19:39:18 +00:00
double ceilAlphaVal = General . Clamp ( control . GetResultFloat ( s . Fields . GetValue ( control . Name , defaultvalue ) ) , 0.0 , 1.0 ) ;
2016-12-29 15:15:35 +00:00
UniFields . SetFloat ( s . Fields , control . Name , ceilAlphaVal , defaultvalue ) ;
2016-10-11 12:58:35 +00:00
}
}
2015-01-26 08:53:05 +00:00
//mxd
private void MakeUndo ( )
{
if ( undocreated ) return ;
undocreated = true ;
//mxd. Make undo
General . Map . UndoRedo . CreateUndo ( "Edit " + ( 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
}
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
//restore values
if ( string . IsNullOrEmpty ( ceilingheight . Text ) )
2014-10-17 11:55:08 +00:00
{
2019-12-14 10:52:46 +00:00
// Reset increment steps, otherwise it's just keep counting and counting
heightoffset . ResetIncrementStep ( ) ;
foreach ( Sector s in sectors )
2015-04-01 12:51:26 +00:00
{
2019-12-14 10:52:46 +00:00
// To get the steps for ---/+++ into effect the offset has to be retrieved again for each sector
offset = heightoffset . GetResult ( 0 ) ;
2015-04-01 12:51:26 +00:00
s . CeilHeight = sectorprops [ s ] . CeilHeight + offset ;
}
}
else //update values
{
2019-12-14 10:52:46 +00:00
// Reset increment steps, otherwise it's just keep counting and counting
heightoffset . ResetIncrementStep ( ) ;
foreach ( Sector s in sectors )
2015-04-01 12:51:26 +00:00
{
2019-12-14 10:52:46 +00:00
// To get the steps for ---/+++ into effect the offset has to be retrieved again for each sector
offset = heightoffset . GetResult ( 0 ) ;
2015-04-01 12:51:26 +00:00
s . CeilHeight = ceilingheight . GetResult ( sectorprops [ s ] . CeilHeight ) + offset ;
}
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
{
2019-12-14 10:52:46 +00:00
// Reset increment steps, otherwise it's just keep counting and counting
heightoffset . ResetIncrementStep ( ) ;
2015-04-01 12:51:26 +00:00
//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
{
2019-12-14 10:52:46 +00:00
// To get the steps for ---/+++ into effect the offset has to be retrieved again for each sector
offset = heightoffset . GetResult ( 0 ) ;
2015-04-01 12:51:26 +00:00
s . FloorHeight = sectorprops [ s ] . FloorHeight + offset ;
}
}
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
{
2019-12-14 10:52:46 +00:00
// To get the steps for ---/+++ into effect the offset has to be retrieved again for each sector
offset = heightoffset . GetResult ( 0 ) ;
2015-04-01 12:51:26 +00:00
s . FloorHeight = floorheight . GetResult ( sectorprops [ s ] . FloorHeight ) + offset ;
}
2014-10-17 11:55:08 +00:00
}
2014-09-13 21:57:56 +00:00
}
}
2023-10-24 13:51:49 +00:00
/// <summary>
/// Enables or disables controls depending on if their tag is one of the UDMF fields set in the game config.
/// </summary>
/// <param name="control">Control to process</param>
private void DoUDMFControls ( Control control )
{
if ( control . Tag is string name & & ! string . IsNullOrWhiteSpace ( name ) )
{
EnableDisableControlAndChildren ( control , General . Map . Config . SectorFields . Any ( f = > f . Name = = name ) ) ;
}
else
{
foreach ( Control c in control . Controls )
DoUDMFControls ( c ) ;
}
}
/// <summary>
/// Enables or disables a control and all its children.
/// </summary>
/// <param name="control">Control the enable or disable</param>
/// <param name="state">If to enable or disable</param>
private void EnableDisableControlAndChildren ( Control control , bool state )
{
control . Enabled = state ;
foreach ( Control c in control . Controls )
EnableDisableControlAndChildren ( c , state ) ;
}
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 ;
}
2015-01-26 08:53:05 +00:00
MakeUndo ( ) ; //mxd
2013-06-25 12:35:13 +00:00
// 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
// Apply all flags
2016-10-11 12:58:35 +00:00
ApplyFlags ( flags , s ) ;
ApplyFlags ( ceilportalflags , s ) ;
ApplyFlags ( floorportalflags , s ) ;
2013-07-10 08:59:17 +00:00
2013-06-25 12:35:13 +00:00
// Effects
if ( ! effect . Empty ) s . Effect = effect . Value ;
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
2016-10-11 12:58:35 +00:00
// Portal alpha
2016-12-29 15:15:35 +00:00
ApplyFloatProperty ( alphaceiling , s , 1.0f ) ;
ApplyFloatProperty ( alphafloor , s , 1.0f ) ;
// Reflectivity
ApplyFloatProperty ( ceiling_reflect , s , 0.0f ) ;
ApplyFloatProperty ( floor_reflect , s , 0.0f ) ;
2016-10-11 12:58:35 +00:00
// Renderstyle
if ( renderstyles . Count > 0 )
2014-10-17 11:55:08 +00:00
{
2016-10-11 12:58:35 +00:00
if ( ceilRenderStyle . SelectedIndex > - 1 )
UniFields . SetString ( s . Fields , "renderstyleceiling" , renderstyles [ ceilRenderStyle . SelectedIndex ] , "translucent" ) ;
if ( floorRenderStyle . SelectedIndex > - 1 )
UniFields . SetString ( s . Fields , "renderstylefloor" , renderstyles [ floorRenderStyle . SelectedIndex ] , "translucent" ) ;
2013-06-25 12:35:13 +00:00
}
2016-10-11 12:58:35 +00:00
// Portal renderstyles
if ( portalrenderstyles . Count > 0 )
2014-10-17 11:55:08 +00:00
{
2016-10-11 12:58:35 +00:00
if ( ceilportalrenderstyle . SelectedIndex > - 1 )
2021-03-06 20:28:00 +00:00
UniFields . SetString ( s . Fields , "portal_ceil_overlaytype" , portalrenderstyles [ ceilportalrenderstyle . SelectedIndex ] , portalrenderstyles [ 0 ] ) ;
2016-10-11 12:58:35 +00:00
if ( floorportalrenderstyle . SelectedIndex > - 1 )
2021-03-06 20:28:00 +00:00
UniFields . SetString ( s . Fields , "portal_floor_overlaytype" , portalrenderstyles [ floorportalrenderstyle . SelectedIndex ] , portalrenderstyles [ 0 ] ) ;
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 ) )
2020-05-22 19:39:18 +00:00
UniFields . SetFloat ( s . Fields , "gravity" , gravity . GetResultFloat ( s . Fields . GetValue ( "gravity" , 1.0 ) ) , 1.0 ) ;
2015-02-14 18:15:11 +00:00
if ( ! string . IsNullOrEmpty ( desaturation . Text ) )
2014-10-17 11:55:08 +00:00
{
2020-05-22 19:39:18 +00:00
double val = General . Clamp ( desaturation . GetResultFloat ( s . Fields . GetValue ( "desaturation" , 0.0 ) ) , 0.0 , 1.0 ) ;
UniFields . SetFloat ( s . Fields , "desaturation" , val , 0.0 ) ;
2013-06-25 12:35:13 +00:00
}
2014-10-17 11:55:08 +00:00
// Clear horizontal slopes
2021-01-01 21:08:54 +00:00
double diff = Math . Abs ( Math . Round ( s . FloorSlopeOffset ) - s . FloorSlopeOffset ) ;
if ( Math . Abs ( s . FloorSlope . z ) = = 1.0 & & diff < 0.000000001 )
2014-10-17 11:55:08 +00:00
{
2021-01-01 21:08:54 +00:00
s . FloorHeight = - Convert . ToInt32 ( s . FloorSlopeOffset ) ;
2014-10-17 11:55:08 +00:00
s . FloorSlope = new Vector3D ( ) ;
2021-01-01 21:08:54 +00:00
s . FloorSlopeOffset = double . NaN ;
2014-10-17 11:55:08 +00:00
}
2021-01-01 21:08:54 +00:00
diff = Math . Abs ( Math . Round ( s . CeilSlopeOffset ) - s . CeilSlopeOffset ) ;
if ( Math . Abs ( s . CeilSlope . z ) = = 1.0 & & diff < 0.000000001 )
2014-10-17 11:55:08 +00:00
{
2021-02-20 15:17:32 +00:00
s . CeilHeight = Convert . ToInt32 ( s . CeilSlopeOffset ) ;
2014-10-17 11:55:08 +00:00
s . CeilSlope = new Vector3D ( ) ;
2021-01-01 21:08:54 +00:00
s . CeilSlopeOffset = double . NaN ;
2014-10-17 11:55:08 +00:00
}
2013-06-25 12:35:13 +00:00
}
2016-04-09 23:18:39 +00:00
//mxd. Apply tags
tagsselector . ApplyTo ( sectors ) ;
2013-06-25 12:35:13 +00:00
// Update the used textures
General . Map . Data . UpdateUsedTextures ( ) ;
// 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...
2021-04-01 21:31:52 +00:00
if ( undocreated )
{
General . Map . UndoRedo . WithdrawUndo ( ) ;
// Changing certain properties of the sector, like floor/ceiling textures will set General.Map.IsChanged to true.
// But if cancel is pressed and the changes are discarded, and the map was not changed before, we have to force
// General.Map.IsChanged back to false
if ( General . Map . IsChanged & & oldmapischanged = = false )
General . Map . ForceMapIsChangedFalse ( ) ;
}
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 )
{
2016-12-02 13:45:03 +00:00
// Save settings
General . Settings . WriteSetting ( "windows." + configname + ".activetab" , tabs . SelectedIndex ) ;
General . Settings . WriteSetting ( "windows." + configname + ".linkceilingscale" , ceilScale . LinkValues ) ;
General . Settings . WriteSetting ( "windows." + configname + ".linkfloorscale" , floorScale . LinkValues ) ;
General . Settings . WriteSetting ( "windows." + configname + ".useceillineangles" , cbUseCeilLineAngles . Checked ) ;
General . Settings . WriteSetting ( "windows." + configname + ".usefloorlineangles" , cbUseFloorLineAngles . Checked ) ;
General . Settings . WriteSetting ( "windows." + configname + ".useceilslopelineangles" , ceilingslopecontrol . UseLineAngles ) ;
General . Settings . WriteSetting ( "windows." + configname + ".usefloorslopelineangles" , floorslopecontrol . UseLineAngles ) ;
General . Settings . WriteSetting ( "windows." + configname + ".ceilpivotmode" , ( int ) ceilingslopecontrol . PivotMode ) ;
General . Settings . WriteSetting ( "windows." + configname + ".floorpivotmode" , ( int ) floorslopecontrol . PivotMode ) ;
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 )
{
2017-01-04 13:28:36 +00:00
floorterrain . Focus ( ) ;
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
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 )
{
2017-01-04 13:28:36 +00:00
ceilterrain . Focus ( ) ;
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
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 ( ) ;
}
2016-12-29 15:15:35 +00:00
private void ceiling_reflect_WhenTextChanged ( object sender , EventArgs e )
{
reset_ceiling_reflect . Visible = ( string . IsNullOrEmpty ( ceiling_reflect . Text ) | | ceiling_reflect . GetResultFloat ( 0.0f ) ! = 0.0f ) ;
}
private void floor_reflect_WhenTextChanged ( object sender , EventArgs e )
{
reset_floor_reflect . Visible = ( string . IsNullOrEmpty ( floor_reflect . Text ) | | floor_reflect . GetResultFloat ( 0.0f ) ! = 0.0f ) ;
}
private void reset_ceiling_reflect_Click ( object sender , EventArgs e )
{
2017-01-04 13:28:36 +00:00
ceiling_reflect . Focus ( ) ;
2016-12-29 15:15:35 +00:00
ceiling_reflect . Text = "0" ;
}
private void reset_floor_reflect_Click ( object sender , EventArgs e )
{
2017-01-04 13:28:36 +00:00
floor_reflect . Focus ( ) ;
2016-12-29 15:15:35 +00:00
floor_reflect . Text = "0" ;
}
private void alphaceiling_WhenTextChanged ( object sender , EventArgs e )
{
resetalphaceiling . Visible = ( string . IsNullOrEmpty ( alphaceiling . Text ) | | alphaceiling . GetResultFloat ( 1.0f ) ! = 1.0f ) ;
}
private void alphafloor_WhenTextChanged ( object sender , EventArgs e )
{
resetalphafloor . Visible = ( string . IsNullOrEmpty ( alphafloor . Text ) | | alphafloor . GetResultFloat ( 1.0f ) ! = 1.0f ) ;
}
private void resetalphafloor_Click ( object sender , EventArgs e )
{
2017-01-04 13:28:36 +00:00
alphafloor . Focus ( ) ;
2016-12-29 15:15:35 +00:00
alphafloor . Text = "1" ;
}
private void resetalphaceiling_Click ( object sender , EventArgs e )
{
2017-01-04 13:28:36 +00:00
alphaceiling . Focus ( ) ;
2016-12-29 15:15:35 +00:00
alphaceiling . Text = "1" ;
}
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
2020-01-04 22:29:35 +00:00
// Reset increment steps, otherwise it's just keep counting and counting
brightness . ResetIncrementStep ( ) ;
2013-07-19 15:30:58 +00:00
//restore values
2020-01-04 22:29:35 +00:00
if ( string . IsNullOrEmpty ( brightness . Text ) )
2014-10-17 11:55:08 +00:00
{
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
2020-01-04 22:29:35 +00:00
// Reset increment steps, otherwise it's just keep counting and counting
floorRotation . ResetIncrementStep ( ) ;
2013-07-19 15:30:58 +00:00
//restore values
2020-01-04 22:29:35 +00:00
if ( string . IsNullOrEmpty ( floorRotation . Text ) )
2014-10-17 11:55:08 +00:00
{
2016-04-27 09:13:07 +00:00
floorAngleControl . Angle = AngleControlEx . NO_ANGLE ;
2014-10-17 11:55:08 +00:00
foreach ( Sector s in sectors )
{
2020-05-22 20:30:32 +00:00
UniFields . SetFloat ( s . Fields , "rotationfloor" , sectorprops [ s ] . FloorRotation , 0.0 ) ;
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 )
{
2020-05-22 20:30:32 +00:00
UniFields . SetFloat ( s . Fields , "rotationfloor" , floorRotation . GetResultFloat ( sectorprops [ s ] . FloorRotation ) , 0.0 ) ;
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
2020-01-04 22:29:35 +00:00
// Reset increment steps, otherwise it's just keep counting and counting
ceilRotation . ResetIncrementStep ( ) ;
2013-07-19 15:30:58 +00:00
//restore values
2020-01-04 22:29:35 +00:00
if ( string . IsNullOrEmpty ( ceilRotation . Text ) )
2014-10-17 11:55:08 +00:00
{
2016-04-27 09:13:07 +00:00
ceilAngleControl . Angle = AngleControlEx . NO_ANGLE ;
2014-10-17 11:55:08 +00:00
foreach ( Sector s in sectors )
{
2020-05-22 20:30:32 +00:00
UniFields . SetFloat ( s . Fields , "rotationceiling" , sectorprops [ s ] . CeilRotation , 0.0 ) ;
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 )
{
2020-05-22 20:30:32 +00:00
UniFields . SetFloat ( s . Fields , "rotationceiling" , ceilRotation . GetResultFloat ( sectorprops [ s ] . CeilRotation ) , 0.0 ) ;
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
2020-01-04 22:29:35 +00:00
// Reset increment steps, otherwise it's just keep counting and counting
ceilOffsets . ResetIncrementStep ( ) ;
foreach ( Sector s in sectors )
2014-10-17 11:55:08 +00:00
{
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 ;
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
2020-01-04 22:29:35 +00:00
// Reset increment steps, otherwise it's just keep counting and counting
floorOffsets . ResetIncrementStep ( ) ;
foreach ( Sector s in sectors )
2014-10-17 11:55:08 +00:00
{
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 ;
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
2020-01-04 22:29:35 +00:00
// Reset increment steps, otherwise it's just keep counting and counting
ceilScale . ResetIncrementStep ( ) ;
foreach ( Sector s in sectors )
2014-10-17 11:55:08 +00:00
{
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 ;
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
2020-01-04 22:29:35 +00:00
// Reset increment steps, otherwise it's just keep counting and counting
floorScale . ResetIncrementStep ( ) ;
foreach ( Sector s in sectors )
2014-10-17 11:55:08 +00:00
{
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 ;
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
2020-01-04 22:29:35 +00:00
// Reset increment steps, otherwise it's just keep counting and counting
ceilBrightness . ResetIncrementStep ( ) ;
2013-07-19 15:30:58 +00:00
//restore values
2020-01-04 22:29:35 +00:00
if ( string . IsNullOrEmpty ( ceilBrightness . Text ) )
2014-10-17 11:55:08 +00:00
{
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
2020-01-04 22:29:35 +00:00
// Reset increment steps, otherwise it's just keep counting and counting
floorBrightness . ResetIncrementStep ( ) ;
2013-07-19 15:30:58 +00:00
//restore values
2020-01-04 22:29:35 +00:00
if ( string . IsNullOrEmpty ( floorBrightness . Text ) )
2014-10-17 11:55:08 +00:00
{
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 ) ;
}
2016-12-29 15:15:35 +00:00
private void fogdensity_WhenTextChanged ( object sender , EventArgs e )
{
if ( preventchanges ) return ;
MakeUndo ( ) ;
2020-01-04 22:29:35 +00:00
// Reset increment steps, otherwise it's just keep counting and counting
fogdensity . ResetIncrementStep ( ) ;
2016-12-29 15:15:35 +00:00
// Restore values
2020-01-04 22:29:35 +00:00
if ( string . IsNullOrEmpty ( fogdensity . Text ) )
2016-12-29 15:15:35 +00:00
{
foreach ( Sector s in sectors )
{
UniFields . SetInteger ( s . Fields , "fogdensity" , sectorprops [ s ] . FogDensity , 0 ) ;
s . UpdateNeeded = true ;
}
}
else // Update values
{
foreach ( Sector s in sectors )
{
int value = General . Clamp ( fogdensity . GetResult ( sectorprops [ s ] . FogDensity ) , 0 , 510 ) ;
UniFields . SetInteger ( s . Fields , "fogdensity" , value , 0 ) ;
s . UpdateNeeded = true ;
}
}
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 )
{
2020-05-22 20:30:32 +00:00
double anglexy = General . ClampAngle ( Math . Round ( Angle2D . RadToDeg ( s . FloorSlope . GetAngleXY ( ) ) - 180 , 1 ) ) ;
double anglez = - Math . Round ( Angle2D . RadToDeg ( s . FloorSlope . GetAngleZ ( ) ) - 90 , 1 ) ;
double offset = 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
{
2020-05-22 20:30:32 +00:00
floorslopecontrol . SetValues ( 0.0 , 0.0 , s . FloorHeight , first ) ;
2014-09-04 12:34:26 +00:00
}
}
2014-10-17 11:55:08 +00:00
private void SetupCeilingSlope ( Sector s , bool first )
{
if ( s . CeilSlope . GetLengthSq ( ) > 0 )
{
2020-05-22 20:30:32 +00:00
double anglexy = General . ClampAngle ( Math . Round ( Angle2D . RadToDeg ( s . CeilSlope . GetAngleXY ( ) ) - 180 , 1 ) ) ;
double anglez = - ( 270 - Math . Round ( Angle2D . RadToDeg ( s . CeilSlope . GetAngleZ ( ) ) , 1 ) ) ;
double offset = 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
{
2020-05-22 20:30:32 +00:00
ceilingslopecontrol . SetValues ( 0.0 , 0.0 , 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
2020-05-21 12:20:02 +00:00
private double GetVirtualSlopeOffset ( Sector s , SlopePivotMode mode , bool floor )
2014-10-17 11:55:08 +00:00
{
2020-05-21 12:20:02 +00:00
double offset = ( floor ? s . FloorSlopeOffset : s . CeilSlopeOffset ) ;
if ( double . 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
2020-05-21 12:20:02 +00:00
private double GetInitialVirtualSlopeOffset ( Sector s , SlopePivotMode mode , bool floor )
2014-10-17 11:55:08 +00:00
{
2020-05-21 12:20:02 +00:00
double offset = ( floor ? sectorprops [ s ] . FloorSlopeOffset : sectorprops [ s ] . CeilSlopeOffset ) ;
2014-10-17 11:55:08 +00:00
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
2020-05-21 12:20:02 +00:00
private Vector3D GetSectorCenter ( Sector s , double offset , SlopePivotMode mode )
2014-10-17 11:55:08 +00:00
{
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 )
{
2020-05-18 16:14:54 +00:00
double anglexy = General . ClampAngle ( ceilingslopecontrol . GetAngleXY ( sectorprops [ s ] . CeilSlopeAngleXY ) + 270 ) ;
double anglez = - ( ceilingslopecontrol . GetAngleZ ( sectorprops [ s ] . CeilSlopeAngleZ ) + 90 ) ;
2014-10-17 11:55:08 +00:00
2020-05-21 12:20:02 +00:00
double virtualoffset = GetInitialVirtualSlopeOffset ( s , ceilingslopecontrol . PivotMode , false ) ;
2014-10-17 11:55:08 +00:00
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 ;
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 )
{
2020-05-21 12:20:02 +00:00
double anglexy = General . ClampAngle ( floorslopecontrol . GetAngleXY ( sectorprops [ s ] . FloorSlopeAngleXY ) + 90 ) ;
double anglez = - ( floorslopecontrol . GetAngleZ ( sectorprops [ s ] . FloorSlopeAngleZ ) + 90 ) ;
2014-10-17 11:55:08 +00:00
2020-05-21 12:20:02 +00:00
double virtualoffset = GetInitialVirtualSlopeOffset ( s , floorslopecontrol . PivotMode , true ) ;
2014-10-17 11:55:08 +00:00
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 ;
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
2021-03-21 16:38:43 +00:00
Sector fs = General . GetByIndex ( sectors , 0 ) ;
2021-04-09 17:48:38 +00:00
2021-04-18 19:16:28 +00:00
// biwa. Do not reset to the z position of the plane of the center of the sector anymore, since
// that will result in pretty crazy values of 3D floor control sectors
/ *
2021-04-09 17:48:38 +00:00
if ( fs . CeilSlope . IsNormalized ( ) )
2014-10-17 11:55:08 +00:00
{
2021-04-09 17:48:38 +00:00
fs . UpdateBBox ( ) ;
Plane p = new Plane ( fs . CeilSlope , fs . CeilSlopeOffset ) ;
ceilingslopecontrol . SetOffset ( ( int ) Math . Round ( p . GetZ ( fs . BBox . X + fs . BBox . Width / 2 , fs . BBox . Y + fs . BBox . Height / 2 ) ) , true ) ;
}
else
ceilingslopecontrol . SetOffset ( fs . CeilHeight , true ) ;
2021-04-18 19:16:28 +00:00
* /
ceilingslopecontrol . SetOffset ( fs . CeilHeight , true ) ;
2021-04-09 17:48:38 +00:00
foreach ( Sector s in sectors )
{
2021-04-18 19:16:28 +00:00
// biwa. Do not reset to the z position of the plane of the center of the sector anymore, since
// that will result in pretty crazy values of 3D floor control sectors
/ *
2021-04-09 17:48:38 +00:00
if ( s . CeilSlope . IsNormalized ( ) )
{
s . UpdateBBox ( ) ;
Plane p = new Plane ( s . CeilSlope , s . CeilSlopeOffset ) ;
s . CeilHeight = ( int ) Math . Round ( p . GetZ ( s . BBox . X + s . BBox . Width / 2 , s . BBox . Y + s . BBox . Height / 2 ) ) ;
}
2021-04-18 19:16:28 +00:00
* /
2021-04-09 17:48:38 +00:00
2014-10-17 11:55:08 +00:00
s . CeilSlope = new Vector3D ( ) ;
2021-03-21 16:38:43 +00:00
s . CeilSlopeOffset = double . NaN ;
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
2021-03-21 16:38:43 +00:00
Sector fs = General . GetByIndex ( sectors , 0 ) ;
2021-04-09 17:48:38 +00:00
2021-04-18 19:16:28 +00:00
// biwa. Do not reset to the z position of the plane of the center of the sector anymore, since
// that will result in pretty crazy values of 3D floor control sectors
/ *
2021-04-09 17:48:38 +00:00
if ( fs . FloorSlope . IsNormalized ( ) )
2014-10-17 11:55:08 +00:00
{
2021-04-09 17:48:38 +00:00
fs . UpdateBBox ( ) ;
Plane p = new Plane ( fs . FloorSlope , fs . FloorSlopeOffset ) ;
floorslopecontrol . SetOffset ( ( int ) Math . Round ( p . GetZ ( fs . BBox . X + fs . BBox . Width / 2 , fs . BBox . Y + fs . BBox . Height / 2 ) ) , true ) ;
}
else
floorslopecontrol . SetOffset ( fs . FloorHeight , true ) ;
2021-04-18 19:16:28 +00:00
* /
floorslopecontrol . SetOffset ( fs . FloorHeight , true ) ;
2021-04-09 17:48:38 +00:00
foreach ( Sector s in sectors )
{
2021-04-18 19:16:28 +00:00
// biwa. Do not reset to the z position of the plane of the center of the sector anymore, since
// that will result in pretty crazy values of 3D floor control sectors
/ *
2021-04-09 17:48:38 +00:00
if ( s . FloorSlope . IsNormalized ( ) )
{
s . UpdateBBox ( ) ;
Plane p = new Plane ( s . FloorSlope , s . FloorSlopeOffset ) ;
s . FloorHeight = ( int ) Math . Round ( p . GetZ ( s . BBox . X + s . BBox . Width / 2 , s . BBox . Y + s . BBox . Height / 2 ) ) ;
}
2021-04-18 19:16:28 +00:00
* /
2021-04-09 17:48:38 +00:00
2014-09-04 12:34:26 +00:00
s . FloorSlope = new Vector3D ( ) ;
2021-03-21 16:38:43 +00:00
s . FloorSlopeOffset = double . NaN ;
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
2017-03-08 23:00:20 +00:00
#region = = = = = = = = = = = = = = = = = = Glow realtime events ( mxd )
2016-12-29 15:15:35 +00:00
2017-01-04 13:28:36 +00:00
private void UpdateCeilingGlowHeightWarning ( )
{
ceilingglowheightrequired . Visible = ( ceilingglowcolor . Color . WithAlpha ( 0 ) . ToInt ( ) ! = ceilingglowcolor . DefaultValue
& & ceilingglowheight . GetResultFloat ( 0f ) = = 0f ) ;
}
private void UpdateFloorGlowHeightWarning ( )
{
floorglowheightrequired . Visible = ( floorglowcolor . Color . WithAlpha ( 0 ) . ToInt ( ) ! = floorglowcolor . DefaultValue
& & floorglowheight . GetResultFloat ( 0f ) = = 0f ) ;
}
2016-12-29 15:15:35 +00:00
private void ceilingglowcolor_OnValueChanged ( object sender , EventArgs e )
{
if ( preventchanges ) return ;
MakeUndo ( ) ;
foreach ( Sector s in sectors )
{
ceilingglowcolor . ApplyTo ( s . Fields , sectorprops [ s ] . CeilGlowColor ) ;
s . UpdateNeeded = true ;
}
2017-01-04 13:28:36 +00:00
// Show height warning?
UpdateCeilingGlowHeightWarning ( ) ;
2016-12-29 15:15:35 +00:00
General . Map . IsChanged = true ;
if ( OnValuesChanged ! = null ) OnValuesChanged ( this , EventArgs . Empty ) ;
}
private void floorglowcolor_OnValueChanged ( object sender , EventArgs e )
{
if ( preventchanges ) return ;
MakeUndo ( ) ;
foreach ( Sector s in sectors )
{
floorglowcolor . ApplyTo ( s . Fields , sectorprops [ s ] . FloorGlowColor ) ;
s . UpdateNeeded = true ;
}
2017-01-04 13:28:36 +00:00
// Show height warning?
UpdateFloorGlowHeightWarning ( ) ;
2016-12-29 15:15:35 +00:00
General . Map . IsChanged = true ;
if ( OnValuesChanged ! = null ) OnValuesChanged ( this , EventArgs . Empty ) ;
}
private void ceilingglowheight_WhenTextChanged ( object sender , EventArgs e )
{
if ( preventchanges ) return ;
MakeUndo ( ) ;
// Restore values
if ( string . IsNullOrEmpty ( ceilingglowheight . Text ) )
{
foreach ( Sector s in sectors )
{
2020-05-22 20:30:32 +00:00
UniFields . SetFloat ( s . Fields , "ceilingglowheight" , sectorprops [ s ] . CeilGlowHeight , 0.0 ) ;
2016-12-29 15:15:35 +00:00
s . UpdateNeeded = true ;
}
}
else // Update values
{
foreach ( Sector s in sectors )
{
2020-05-22 20:30:32 +00:00
double value = General . Clamp ( ceilingglowheight . GetResultFloat ( sectorprops [ s ] . CeilGlowHeight ) , 0.0 , double . MaxValue ) ;
UniFields . SetFloat ( s . Fields , "ceilingglowheight" , value , 0.0 ) ;
2016-12-29 15:15:35 +00:00
s . UpdateNeeded = true ;
}
}
// Update "Reset" button
2020-05-22 20:30:32 +00:00
resetceilingglowheight . Visible = ( ceilingglowheight . GetResultFloat ( 0.0 ) ! = 0.0 ) ;
2016-12-29 15:15:35 +00:00
2017-01-04 13:28:36 +00:00
// Show height warning?
UpdateCeilingGlowHeightWarning ( ) ;
2016-12-29 15:15:35 +00:00
General . Map . IsChanged = true ;
if ( OnValuesChanged ! = null ) OnValuesChanged ( this , EventArgs . Empty ) ;
}
private void floorglowheight_WhenTextChanged ( object sender , EventArgs e )
{
if ( preventchanges ) return ;
MakeUndo ( ) ;
// Restore values
if ( string . IsNullOrEmpty ( floorglowheight . Text ) )
{
foreach ( Sector s in sectors )
{
2020-05-22 20:30:32 +00:00
UniFields . SetFloat ( s . Fields , "floorglowheight" , sectorprops [ s ] . FloorGlowHeight , 0.0 ) ;
2016-12-29 15:15:35 +00:00
s . UpdateNeeded = true ;
}
}
else // Update values
{
foreach ( Sector s in sectors )
{
2020-05-22 20:30:32 +00:00
double value = General . Clamp ( floorglowheight . GetResultFloat ( sectorprops [ s ] . FloorGlowHeight ) , 0.0 , double . MaxValue ) ;
UniFields . SetFloat ( s . Fields , "floorglowheight" , value , 0.0 ) ;
2016-12-29 15:15:35 +00:00
s . UpdateNeeded = true ;
}
}
// Update "Reset" button
2020-05-22 20:30:32 +00:00
resetfloorglowheight . Visible = ( floorglowheight . GetResultFloat ( 0.0 ) ! = 0.0 ) ;
2016-12-29 15:15:35 +00:00
2017-01-04 13:28:36 +00:00
// Show height warning?
UpdateFloorGlowHeightWarning ( ) ;
2016-12-29 15:15:35 +00:00
General . Map . IsChanged = true ;
if ( OnValuesChanged ! = null ) OnValuesChanged ( this , EventArgs . Empty ) ;
}
2017-03-08 23:00:20 +00:00
private void ceilingGlowEnabled_CheckedChanged ( object sender , EventArgs e )
{
if ( preventchanges ) return ;
MakeUndo ( ) ;
// Update controls
ceilingglowcolor . Enabled = ceilingGlowEnabled . Checked ;
ceilingglowcolor . Color = PixelColor . FromInt ( 0 ) ;
ceilingglowheight . Enabled = ceilingGlowEnabled . Checked ;
ceilingglowheightlabel . Enabled = ceilingGlowEnabled . Checked ;
if ( ! ceilingGlowEnabled . Checked )
{
// Set glow color to -1
foreach ( Sector s in sectors )
{
UniFields . SetInteger ( s . Fields , "ceilingglowcolor" , - 1 , 0 ) ;
s . UpdateNeeded = true ;
}
// Hide height warning
ceilingglowheightrequired . Visible = false ;
// Trigger update
General . Map . IsChanged = true ;
if ( OnValuesChanged ! = null ) OnValuesChanged ( this , EventArgs . Empty ) ;
}
else
{
// Trigger update to restore/update values
ceilingglowcolor_OnValueChanged ( this , EventArgs . Empty ) ;
}
}
private void floorGlowEnabled_CheckedChanged ( object sender , EventArgs e )
{
if ( preventchanges ) return ;
MakeUndo ( ) ;
// Update controls
floorglowcolor . Enabled = floorGlowEnabled . Checked ;
floorglowcolor . Color = PixelColor . FromInt ( 0 ) ;
floorglowheight . Enabled = floorGlowEnabled . Checked ;
floorglowheightlabel . Enabled = floorGlowEnabled . Checked ;
if ( ! floorGlowEnabled . Checked )
{
// Set glow color to -1
foreach ( Sector s in sectors )
{
UniFields . SetInteger ( s . Fields , "floorglowcolor" , - 1 , 0 ) ;
s . UpdateNeeded = true ;
}
// Hide height warning
floorglowheightrequired . Visible = false ;
// Trigger update
General . Map . IsChanged = true ;
if ( OnValuesChanged ! = null ) OnValuesChanged ( this , EventArgs . Empty ) ;
}
else
{
// Trigger glow color update to restore/update values
floorglowcolor_OnValueChanged ( this , EventArgs . Empty ) ;
}
}
private void resetceilingglowheight_Click ( object sender , EventArgs e )
2016-12-29 15:15:35 +00:00
{
2017-01-04 13:28:36 +00:00
ceilingglowheight . Focus ( ) ;
2016-12-29 15:15:35 +00:00
ceilingglowheight . Text = "0" ;
}
private void resetfloorglowheight_Click ( object sender , EventArgs e )
{
2017-01-04 13:28:36 +00:00
floorglowheight . Focus ( ) ;
2016-12-29 15:15:35 +00:00
floorglowheight . Text = "0" ;
}
2017-03-08 23:00:20 +00:00
#endregion
#region = = = = = = = = = = = = = = = = = = D64 colors realtime events ( mxd )
// generic function: use sender
private void d64color_OnValueChanged ( object sender , EventArgs e )
{
if ( preventchanges ) return ;
MakeUndo ( ) ;
ColorFieldsControl colorCtl = ( ColorFieldsControl ) sender ;
foreach ( Sector s in sectors )
{
int prevv = PixelColor . INT_WHITE_NO_ALPHA ;
SectorProperties props = sectorprops [ s ] ;
switch ( colorCtl . Field )
{
case "color_ceiling" :
prevv = props . D64ColorCeiling ;
break ;
case "color_walltop" :
prevv = props . D64ColorWallTop ;
break ;
2017-03-08 23:24:31 +00:00
case "color_sprites" :
2017-03-08 23:00:20 +00:00
prevv = props . D64ColorThings ;
break ;
case "color_wallbottom" :
prevv = props . D64ColorWallBottom ;
break ;
case "color_floor" :
prevv = props . D64ColorFloor ;
break ;
}
colorCtl . ApplyTo ( s . Fields , prevv ) ;
s . UpdateNeeded = true ;
}
General . Map . IsChanged = true ;
if ( OnValuesChanged ! = null ) OnValuesChanged ( this , EventArgs . Empty ) ;
}
#endregion
}
2013-06-25 12:35:13 +00:00
}