2009-04-19 18:07:22 +00:00
|
|
|
|
|
|
|
#region ================== Copyright (c) 2007 Pascal vd Heiden
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Copyright (c) 2007 Pascal vd Heiden, www.codeimp.com
|
|
|
|
* This program is released under GNU General Public License
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
#region ================== Namespaces
|
|
|
|
|
|
|
|
using System;
|
|
|
|
using System.Collections.Generic;
|
Model rendering (all modes): UDMF scale, pitch and roll are now displayed.
Thing Edit Form, UDMF: added controls for setting pitch, roll, scale, render style, fill color, alpha, health and score.
Visual mode, UDMF: UDMF scale is now applied when rendering sprites.
Added Thing Statistics form (Edit -> View Thing Types...), which shows all loaded thing types with some additional info.
Visual mode: sprites with negative ScaleX and positive ScaleY were not rendered properly.
Classic modes: display was not updated after loading a sprite.
Current testing engine change was not saved on closing the program when no other game configuration settings were changed.
2014-04-30 10:01:22 +00:00
|
|
|
using System.Drawing;
|
2009-04-19 18:07:22 +00:00
|
|
|
using System.IO;
|
|
|
|
using System.Reflection;
|
Model rendering (all modes): UDMF scale, pitch and roll are now displayed.
Thing Edit Form, UDMF: added controls for setting pitch, roll, scale, render style, fill color, alpha, health and score.
Visual mode, UDMF: UDMF scale is now applied when rendering sprites.
Added Thing Statistics form (Edit -> View Thing Types...), which shows all loaded thing types with some additional info.
Visual mode: sprites with negative ScaleX and positive ScaleY were not rendered properly.
Classic modes: display was not updated after loading a sprite.
Current testing engine change was not saved on closing the program when no other game configuration settings were changed.
2014-04-30 10:01:22 +00:00
|
|
|
using System.Runtime.InteropServices;
|
|
|
|
using System.Windows.Forms;
|
|
|
|
using CodeImp.DoomBuilder.Actions;
|
|
|
|
using CodeImp.DoomBuilder.BuilderModes.Interface;
|
|
|
|
using CodeImp.DoomBuilder.BuilderModes.IO;
|
2009-04-19 18:07:22 +00:00
|
|
|
using CodeImp.DoomBuilder.Config;
|
2009-07-22 15:16:28 +00:00
|
|
|
using CodeImp.DoomBuilder.Controls;
|
Model rendering (all modes): UDMF scale, pitch and roll are now displayed.
Thing Edit Form, UDMF: added controls for setting pitch, roll, scale, render style, fill color, alpha, health and score.
Visual mode, UDMF: UDMF scale is now applied when rendering sprites.
Added Thing Statistics form (Edit -> View Thing Types...), which shows all loaded thing types with some additional info.
Visual mode: sprites with negative ScaleX and positive ScaleY were not rendered properly.
Classic modes: display was not updated after loading a sprite.
Current testing engine change was not saved on closing the program when no other game configuration settings were changed.
2014-04-30 10:01:22 +00:00
|
|
|
using CodeImp.DoomBuilder.Data;
|
|
|
|
using CodeImp.DoomBuilder.Editing;
|
|
|
|
using CodeImp.DoomBuilder.Geometry;
|
|
|
|
using CodeImp.DoomBuilder.Map;
|
|
|
|
using CodeImp.DoomBuilder.Plugins;
|
|
|
|
using CodeImp.DoomBuilder.Rendering;
|
|
|
|
using CodeImp.DoomBuilder.Types;
|
|
|
|
using CodeImp.DoomBuilder.Windows;
|
2018-04-14 22:59:58 +00:00
|
|
|
using System.Runtime.CompilerServices;
|
2009-04-19 18:07:22 +00:00
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
namespace CodeImp.DoomBuilder.BuilderModes
|
|
|
|
{
|
2022-11-27 10:02:26 +00:00
|
|
|
internal class ToastMessages
|
|
|
|
{
|
|
|
|
public static readonly string VISUALSLOPING = "visualsloping";
|
|
|
|
}
|
|
|
|
|
2009-04-19 18:07:22 +00:00
|
|
|
public class BuilderPlug : Plug
|
|
|
|
{
|
2009-07-23 05:09:53 +00:00
|
|
|
#region ================== API Declarations
|
|
|
|
|
|
|
|
[DllImport("user32.dll")]
|
|
|
|
internal static extern int GetWindowLong(IntPtr hWnd, int nIndex);
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
2009-04-19 18:07:22 +00:00
|
|
|
#region ================== Constants
|
|
|
|
|
2009-07-23 05:09:53 +00:00
|
|
|
internal const int WS_HSCROLL = 0x100000;
|
|
|
|
internal const int WS_VSCROLL = 0x200000;
|
|
|
|
internal const int GWL_STYLE = -16;
|
|
|
|
|
2009-04-19 18:07:22 +00:00
|
|
|
#endregion
|
|
|
|
|
Game Configurations: added Vanilla Strife, Vanilla Heretic and Vanilla Hexen game configurations.
Added "makedoorceil" game configuration property. Works the same way as "makedoortrack" and "makedoordoor", but for ceilings of door sectors.
Changed, Game configurations: the editor no longer tries to load DECORATE/MODELDEF/VOXELDEF/GLDEFS/REVERBS lumps when "decorategames" setting is not specified / is set to empty string.
Changed, General interface: "Tools -> Reload MODELDEF/VOXELDEF" and "Tools -> Reload GLDEFS" menu items are no longer shown when current game configuration doesn't support DECORATE.
Fixed a crash when pasting linedef/thing properties in Hexen map format.
Fixed, Visual mode: Visual Thing resources were not fully unloaded when resetting D3D device leading to crash when switching to the editor from a DX-using game engine (like ZDoom) running in fullscreen.
Fixed: in some cases, when current game configuration supported multiple script compilers, it was possible to open/create a map or change map options without selecting any script compiler.
Fixed, New Map Options window: default map name was not updated when switching game configurations.
Fixed: copied map element properties were not reset after switching to another map.
Fixed: stored textures for "Make Door" action were not reset after switching to another map.
Fixed, Game Configurations window: currently selected test engine name was not updated when pasting test engines from another configuration.
Fixed, Game Configurations: all "Heretic in Doom map format" configurations were using Doom sector effects list.
Fixed, Game Configurations: all "Strife in Doom map format" configurations were using Doom sector effects list.
2015-10-21 13:35:42 +00:00
|
|
|
#region ================== Structs (mxd)
|
|
|
|
|
|
|
|
public struct MakeDoorSettings
|
|
|
|
{
|
|
|
|
public readonly string DoorTexture;
|
|
|
|
public readonly string TrackTexture;
|
|
|
|
public readonly string CeilingTexture;
|
|
|
|
public readonly bool ResetOffsets;
|
2017-04-03 08:20:40 +00:00
|
|
|
public readonly bool ApplyActionSpecials;
|
|
|
|
public readonly bool ApplyTag;
|
Game Configurations: added Vanilla Strife, Vanilla Heretic and Vanilla Hexen game configurations.
Added "makedoorceil" game configuration property. Works the same way as "makedoortrack" and "makedoordoor", but for ceilings of door sectors.
Changed, Game configurations: the editor no longer tries to load DECORATE/MODELDEF/VOXELDEF/GLDEFS/REVERBS lumps when "decorategames" setting is not specified / is set to empty string.
Changed, General interface: "Tools -> Reload MODELDEF/VOXELDEF" and "Tools -> Reload GLDEFS" menu items are no longer shown when current game configuration doesn't support DECORATE.
Fixed a crash when pasting linedef/thing properties in Hexen map format.
Fixed, Visual mode: Visual Thing resources were not fully unloaded when resetting D3D device leading to crash when switching to the editor from a DX-using game engine (like ZDoom) running in fullscreen.
Fixed: in some cases, when current game configuration supported multiple script compilers, it was possible to open/create a map or change map options without selecting any script compiler.
Fixed, New Map Options window: default map name was not updated when switching game configurations.
Fixed: copied map element properties were not reset after switching to another map.
Fixed: stored textures for "Make Door" action were not reset after switching to another map.
Fixed, Game Configurations window: currently selected test engine name was not updated when pasting test engines from another configuration.
Fixed, Game Configurations: all "Heretic in Doom map format" configurations were using Doom sector effects list.
Fixed, Game Configurations: all "Strife in Doom map format" configurations were using Doom sector effects list.
2015-10-21 13:35:42 +00:00
|
|
|
|
2017-04-03 08:20:40 +00:00
|
|
|
public MakeDoorSettings(string doortexture, string tracktexture, string ceilingtexture, bool resetoffsets, bool applyactionspecials, bool applytag)
|
Game Configurations: added Vanilla Strife, Vanilla Heretic and Vanilla Hexen game configurations.
Added "makedoorceil" game configuration property. Works the same way as "makedoortrack" and "makedoordoor", but for ceilings of door sectors.
Changed, Game configurations: the editor no longer tries to load DECORATE/MODELDEF/VOXELDEF/GLDEFS/REVERBS lumps when "decorategames" setting is not specified / is set to empty string.
Changed, General interface: "Tools -> Reload MODELDEF/VOXELDEF" and "Tools -> Reload GLDEFS" menu items are no longer shown when current game configuration doesn't support DECORATE.
Fixed a crash when pasting linedef/thing properties in Hexen map format.
Fixed, Visual mode: Visual Thing resources were not fully unloaded when resetting D3D device leading to crash when switching to the editor from a DX-using game engine (like ZDoom) running in fullscreen.
Fixed: in some cases, when current game configuration supported multiple script compilers, it was possible to open/create a map or change map options without selecting any script compiler.
Fixed, New Map Options window: default map name was not updated when switching game configurations.
Fixed: copied map element properties were not reset after switching to another map.
Fixed: stored textures for "Make Door" action were not reset after switching to another map.
Fixed, Game Configurations window: currently selected test engine name was not updated when pasting test engines from another configuration.
Fixed, Game Configurations: all "Heretic in Doom map format" configurations were using Doom sector effects list.
Fixed, Game Configurations: all "Strife in Doom map format" configurations were using Doom sector effects list.
2015-10-21 13:35:42 +00:00
|
|
|
{
|
|
|
|
DoorTexture = doortexture;
|
|
|
|
TrackTexture = tracktexture;
|
|
|
|
CeilingTexture = ceilingtexture;
|
|
|
|
ResetOffsets = resetoffsets;
|
2017-04-03 08:20:40 +00:00
|
|
|
ApplyActionSpecials = applyactionspecials;
|
|
|
|
ApplyTag = applytag;
|
Game Configurations: added Vanilla Strife, Vanilla Heretic and Vanilla Hexen game configurations.
Added "makedoorceil" game configuration property. Works the same way as "makedoortrack" and "makedoordoor", but for ceilings of door sectors.
Changed, Game configurations: the editor no longer tries to load DECORATE/MODELDEF/VOXELDEF/GLDEFS/REVERBS lumps when "decorategames" setting is not specified / is set to empty string.
Changed, General interface: "Tools -> Reload MODELDEF/VOXELDEF" and "Tools -> Reload GLDEFS" menu items are no longer shown when current game configuration doesn't support DECORATE.
Fixed a crash when pasting linedef/thing properties in Hexen map format.
Fixed, Visual mode: Visual Thing resources were not fully unloaded when resetting D3D device leading to crash when switching to the editor from a DX-using game engine (like ZDoom) running in fullscreen.
Fixed: in some cases, when current game configuration supported multiple script compilers, it was possible to open/create a map or change map options without selecting any script compiler.
Fixed, New Map Options window: default map name was not updated when switching game configurations.
Fixed: copied map element properties were not reset after switching to another map.
Fixed: stored textures for "Make Door" action were not reset after switching to another map.
Fixed, Game Configurations window: currently selected test engine name was not updated when pasting test engines from another configuration.
Fixed, Game Configurations: all "Heretic in Doom map format" configurations were using Doom sector effects list.
Fixed, Game Configurations: all "Strife in Doom map format" configurations were using Doom sector effects list.
2015-10-21 13:35:42 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
2009-04-19 18:07:22 +00:00
|
|
|
#region ================== Variables
|
2009-07-23 05:09:53 +00:00
|
|
|
|
2009-04-19 18:07:22 +00:00
|
|
|
// Static instance
|
|
|
|
private static BuilderPlug me;
|
|
|
|
|
|
|
|
// Main objects
|
|
|
|
private MenusForm menusform;
|
|
|
|
private FindReplaceForm findreplaceform;
|
|
|
|
private ErrorCheckForm errorcheckform;
|
|
|
|
private PreferencesForm preferencesform;
|
2009-07-22 15:16:28 +00:00
|
|
|
|
|
|
|
// Dockers
|
|
|
|
private UndoRedoPanel undoredopanel;
|
|
|
|
private Docker undoredodocker;
|
2013-11-21 10:53:11 +00:00
|
|
|
private SectorDrawingOptionsPanel drawingOverridesPanel; //mxd
|
|
|
|
private Docker drawingOverridesDocker; //mxd
|
2009-07-22 15:16:28 +00:00
|
|
|
|
2009-04-19 18:07:22 +00:00
|
|
|
// Settings
|
|
|
|
private int showvisualthings; // 0 = none, 1 = sprite only, 2 = sprite caged
|
|
|
|
private bool usegravity;
|
|
|
|
private int changeheightbysidedef; // 0 = nothing, 1 = change ceiling, 2 = change floor
|
|
|
|
private bool editnewthing;
|
|
|
|
private bool editnewsector;
|
|
|
|
private bool additiveselect;
|
2019-06-20 13:38:41 +00:00
|
|
|
private bool additivepaintselect;
|
2009-07-07 11:29:56 +00:00
|
|
|
private bool autoclearselection;
|
|
|
|
private bool visualmodeclearselection;
|
2009-04-19 18:07:22 +00:00
|
|
|
private string copiedtexture;
|
|
|
|
private string copiedflat;
|
|
|
|
private Point copiedoffsets;
|
2010-08-15 13:45:43 +00:00
|
|
|
private VertexProperties copiedvertexprops;
|
2009-04-19 18:07:22 +00:00
|
|
|
private SectorProperties copiedsectorprops;
|
|
|
|
private SidedefProperties copiedsidedefprops;
|
2010-08-15 13:45:43 +00:00
|
|
|
private LinedefProperties copiedlinedefprops;
|
2009-04-19 18:07:22 +00:00
|
|
|
private ThingProperties copiedthingprops;
|
|
|
|
private bool viewselectionnumbers;
|
2013-09-16 11:44:47 +00:00
|
|
|
private bool viewselectioneffects; //mxd
|
2009-05-20 15:03:08 +00:00
|
|
|
private float stitchrange;
|
|
|
|
private float highlightrange;
|
|
|
|
private float highlightthingsrange;
|
|
|
|
private float splitlinedefsrange;
|
2017-08-24 13:24:03 +00:00
|
|
|
private float mouseselectionthreshold;
|
2009-07-12 11:14:34 +00:00
|
|
|
private bool autodragonpaste;
|
2013-03-18 13:52:27 +00:00
|
|
|
private bool autoAlignTextureOffsetsOnCreate;//mxd
|
|
|
|
private bool dontMoveGeometryOutsideMapBoundary;//mxd
|
2013-12-05 09:24:55 +00:00
|
|
|
private bool autoDrawOnEdit; //mxd
|
2013-03-18 13:52:27 +00:00
|
|
|
private bool marqueSelectTouching; //mxd. Select elements partially/fully inside of marque selection?
|
|
|
|
private bool syncSelection; //mxd. Sync selection between Visual and Classic modes.
|
2013-04-11 09:27:16 +00:00
|
|
|
private bool lockSectorTextureOffsetsWhileDragging; //mxd
|
2020-05-03 15:25:07 +00:00
|
|
|
private bool lock3DFloorSectorTextureOffsetsWhileDragging;
|
2015-11-03 08:54:56 +00:00
|
|
|
private bool syncthingedit; //mxd
|
2016-06-13 23:37:55 +00:00
|
|
|
private bool alphabasedtexturehighlighting; //mxd
|
2016-10-03 11:42:12 +00:00
|
|
|
private bool showlightradii; //mxd
|
|
|
|
private bool showsoundradii; //mxd
|
2020-04-04 16:03:40 +00:00
|
|
|
private int scaletexturesonslopes; // 0 = base scale of 1, 1 = use current scale as base, 2 = don't scale
|
2020-07-16 20:01:37 +00:00
|
|
|
private int eventlinelabelvisibility; // 0 = never show, 1 = forward only, 2 = reverse only, 3 = forward + reverse
|
|
|
|
private int eventlinelabelstyle; // 0 = Action only, 1 = Action + short arguments, 2 = action + full arguments
|
|
|
|
private bool eventlinedistinctcolors;
|
2021-02-13 11:03:37 +00:00
|
|
|
private bool useoppositesmartpivothandle;
|
2021-10-24 17:22:00 +00:00
|
|
|
private bool selectchangedafterundoredo;
|
2022-01-07 15:28:06 +00:00
|
|
|
private bool selectadjacentvisualvertexslopehandles;
|
2020-07-16 20:01:37 +00:00
|
|
|
|
2009-04-19 18:07:22 +00:00
|
|
|
#endregion
|
|
|
|
|
|
|
|
#region ================== Properties
|
2020-07-16 20:01:37 +00:00
|
|
|
|
2019-12-24 07:12:45 +00:00
|
|
|
public override string Name { get { return "Ultimate Doom Builder"; } } //mxd
|
2009-04-19 18:07:22 +00:00
|
|
|
public static BuilderPlug Me { get { return me; } }
|
2010-08-12 18:42:52 +00:00
|
|
|
|
2016-01-20 17:54:56 +00:00
|
|
|
//mxd. BuilderModes.dll revision should always match the main module revision
|
|
|
|
public override bool StrictRevisionMatching { get { return true; } }
|
2010-08-12 18:42:52 +00:00
|
|
|
public override int MinimumRevision { get { return Assembly.GetExecutingAssembly().GetName().Version.Revision; } }
|
2009-04-19 18:07:22 +00:00
|
|
|
|
|
|
|
public MenusForm MenusForm { get { return menusform; } }
|
2014-03-05 09:21:28 +00:00
|
|
|
public FindReplaceForm FindReplaceForm { get { return findreplaceform ?? (findreplaceform = new FindReplaceForm()); } }
|
|
|
|
public ErrorCheckForm ErrorCheckForm { get { return errorcheckform ?? (errorcheckform = new ErrorCheckForm()); } }
|
2009-04-19 18:07:22 +00:00
|
|
|
public PreferencesForm PreferencesForm { get { return preferencesform; } }
|
|
|
|
|
|
|
|
// Settings
|
|
|
|
public int ShowVisualThings { get { return showvisualthings; } set { showvisualthings = value; } }
|
|
|
|
public bool UseGravity { get { return usegravity; } set { usegravity = value; } }
|
|
|
|
public int ChangeHeightBySidedef { get { return changeheightbysidedef; } }
|
|
|
|
public bool EditNewThing { get { return editnewthing; } }
|
|
|
|
public bool EditNewSector { get { return editnewsector; } }
|
|
|
|
public bool AdditiveSelect { get { return additiveselect; } }
|
2019-06-20 13:38:41 +00:00
|
|
|
public bool AdditivePaintSelect { get { return additivepaintselect; } }
|
2009-07-07 11:29:56 +00:00
|
|
|
public bool AutoClearSelection { get { return autoclearselection; } }
|
|
|
|
public bool VisualModeClearSelection { get { return visualmodeclearselection; } }
|
2009-04-19 18:07:22 +00:00
|
|
|
public string CopiedTexture { get { return copiedtexture; } set { copiedtexture = value; } }
|
|
|
|
public string CopiedFlat { get { return copiedflat; } set { copiedflat = value; } }
|
|
|
|
public Point CopiedOffsets { get { return copiedoffsets; } set { copiedoffsets = value; } }
|
2010-08-15 13:45:43 +00:00
|
|
|
public VertexProperties CopiedVertexProps { get { return copiedvertexprops; } set { copiedvertexprops = value; } }
|
2009-04-19 18:07:22 +00:00
|
|
|
public SectorProperties CopiedSectorProps { get { return copiedsectorprops; } set { copiedsectorprops = value; } }
|
|
|
|
public SidedefProperties CopiedSidedefProps { get { return copiedsidedefprops; } set { copiedsidedefprops = value; } }
|
2010-08-15 13:45:43 +00:00
|
|
|
public LinedefProperties CopiedLinedefProps { get { return copiedlinedefprops; } set { copiedlinedefprops = value; } }
|
2009-04-19 18:07:22 +00:00
|
|
|
public ThingProperties CopiedThingProps { get { return copiedthingprops; } set { copiedthingprops = value; } }
|
|
|
|
public bool ViewSelectionNumbers { get { return viewselectionnumbers; } set { viewselectionnumbers = value; } }
|
2013-09-16 11:44:47 +00:00
|
|
|
public bool ViewSelectionEffects { get { return viewselectioneffects; } set { viewselectioneffects = value; } } //mxd
|
2013-09-11 09:47:53 +00:00
|
|
|
public float StitchRange { get { return stitchrange; } internal set { stitchrange = value; } }
|
2009-05-20 15:03:08 +00:00
|
|
|
public float HighlightRange { get { return highlightrange; } }
|
|
|
|
public float HighlightThingsRange { get { return highlightthingsrange; } }
|
|
|
|
public float SplitLinedefsRange { get { return splitlinedefsrange; } }
|
2017-08-24 13:24:03 +00:00
|
|
|
public float MouseSelectionThreshold { get { return mouseselectionthreshold; } }
|
2009-07-12 11:14:34 +00:00
|
|
|
public bool AutoDragOnPaste { get { return autodragonpaste; } set { autodragonpaste = value; } }
|
2013-12-05 09:24:55 +00:00
|
|
|
public bool AutoDrawOnEdit { get { return autoDrawOnEdit; } set { autoDrawOnEdit = value; } } //mxd
|
2013-03-18 13:52:27 +00:00
|
|
|
public bool AutoAlignTextureOffsetsOnCreate { get { return autoAlignTextureOffsetsOnCreate; } set { autoAlignTextureOffsetsOnCreate = value; } } //mxd
|
|
|
|
public bool DontMoveGeometryOutsideMapBoundary { get { return dontMoveGeometryOutsideMapBoundary; } set { DontMoveGeometryOutsideMapBoundary = value; } } //mxd
|
|
|
|
public bool MarqueSelectTouching { get { return marqueSelectTouching; } set { marqueSelectTouching = value; } } //mxd
|
|
|
|
public bool SyncSelection { get { return syncSelection; } set { syncSelection = value; } } //mxd
|
2013-04-11 09:27:16 +00:00
|
|
|
public bool LockSectorTextureOffsetsWhileDragging { get { return lockSectorTextureOffsetsWhileDragging; } internal set { lockSectorTextureOffsetsWhileDragging = value; } } //mxd
|
2020-05-03 15:25:07 +00:00
|
|
|
public bool Lock3DFloorSectorTextureOffsetsWhileDragging { get { return lock3DFloorSectorTextureOffsetsWhileDragging; } internal set { lock3DFloorSectorTextureOffsetsWhileDragging = value; } } //mxd
|
2015-11-03 08:54:56 +00:00
|
|
|
public bool SyncronizeThingEdit { get { return syncthingedit; } internal set { syncthingedit = value; } } //mxd
|
2016-06-13 23:37:55 +00:00
|
|
|
public bool AlphaBasedTextureHighlighting { get { return alphabasedtexturehighlighting; } internal set { alphabasedtexturehighlighting = value; } } //mxd
|
2016-10-03 11:42:12 +00:00
|
|
|
public bool ShowLightRadii { get { return showlightradii; } internal set { showlightradii = value; } } //mxd
|
|
|
|
public bool ShowSoundRadii { get { return showsoundradii; } internal set { showsoundradii = value; } } //mxd
|
2020-04-04 16:03:40 +00:00
|
|
|
public int ScaleTexturesOnSlopes { get { return scaletexturesonslopes; } internal set { scaletexturesonslopes = value; } }
|
2020-07-16 20:01:37 +00:00
|
|
|
public int EventLineLabelVisibility { get { return eventlinelabelvisibility; } internal set { eventlinelabelvisibility = value; } }
|
|
|
|
public int EventLineLabelStyle { get { return eventlinelabelstyle; } internal set { eventlinelabelstyle = value; } }
|
|
|
|
public bool EventLineDistinctColors { get { return eventlinedistinctcolors; } internal set { eventlinedistinctcolors = value; } }
|
2021-02-13 11:03:37 +00:00
|
|
|
public bool UseOppositeSmartPivotHandle { get { return useoppositesmartpivothandle; } internal set { useoppositesmartpivothandle = value; } }
|
2021-10-24 17:22:00 +00:00
|
|
|
public bool SelectChangedafterUndoRedo { get { return selectchangedafterundoredo; } internal set { selectchangedafterundoredo = value; } }
|
2022-01-07 15:28:06 +00:00
|
|
|
public bool SelectAdjacentVisualVertexSlopeHandles { get { return selectadjacentvisualvertexslopehandles; } internal set { selectadjacentvisualvertexslopehandles = value; } }
|
Game Configurations: added Vanilla Strife, Vanilla Heretic and Vanilla Hexen game configurations.
Added "makedoorceil" game configuration property. Works the same way as "makedoortrack" and "makedoordoor", but for ceilings of door sectors.
Changed, Game configurations: the editor no longer tries to load DECORATE/MODELDEF/VOXELDEF/GLDEFS/REVERBS lumps when "decorategames" setting is not specified / is set to empty string.
Changed, General interface: "Tools -> Reload MODELDEF/VOXELDEF" and "Tools -> Reload GLDEFS" menu items are no longer shown when current game configuration doesn't support DECORATE.
Fixed a crash when pasting linedef/thing properties in Hexen map format.
Fixed, Visual mode: Visual Thing resources were not fully unloaded when resetting D3D device leading to crash when switching to the editor from a DX-using game engine (like ZDoom) running in fullscreen.
Fixed: in some cases, when current game configuration supported multiple script compilers, it was possible to open/create a map or change map options without selecting any script compiler.
Fixed, New Map Options window: default map name was not updated when switching game configurations.
Fixed: copied map element properties were not reset after switching to another map.
Fixed: stored textures for "Make Door" action were not reset after switching to another map.
Fixed, Game Configurations window: currently selected test engine name was not updated when pasting test engines from another configuration.
Fixed, Game Configurations: all "Heretic in Doom map format" configurations were using Doom sector effects list.
Fixed, Game Configurations: all "Strife in Doom map format" configurations were using Doom sector effects list.
2015-10-21 13:35:42 +00:00
|
|
|
|
|
|
|
//mxd. "Make Door" action persistent settings
|
|
|
|
internal MakeDoorSettings MakeDoor;
|
|
|
|
|
2009-04-19 18:07:22 +00:00
|
|
|
#endregion
|
|
|
|
|
|
|
|
#region ================== Initialize / Dispose
|
|
|
|
|
|
|
|
// When plugin is initialized
|
|
|
|
public override void OnInitialize()
|
|
|
|
{
|
|
|
|
// Setup
|
|
|
|
me = this;
|
|
|
|
|
|
|
|
// Settings
|
|
|
|
showvisualthings = 2;
|
|
|
|
usegravity = false;
|
|
|
|
LoadSettings();
|
2015-09-12 21:05:01 +00:00
|
|
|
LoadUISettings(); //mxd
|
2009-04-19 18:07:22 +00:00
|
|
|
|
|
|
|
// Load menus form and register it
|
|
|
|
menusform = new MenusForm();
|
|
|
|
menusform.Register();
|
2013-04-11 09:27:16 +00:00
|
|
|
menusform.TextureOffsetLock.Checked = lockSectorTextureOffsetsWhileDragging; //mxd
|
2020-05-03 15:25:07 +00:00
|
|
|
menusform.TextureOffset3DFloorLock.Checked = lock3DFloorSectorTextureOffsetsWhileDragging;
|
2015-11-03 08:54:56 +00:00
|
|
|
menusform.SyncronizeThingEditButton.Checked = syncthingedit; //mxd
|
|
|
|
menusform.SyncronizeThingEditSectorsItem.Checked = syncthingedit; //mxd
|
|
|
|
menusform.SyncronizeThingEditLinedefsItem.Checked = syncthingedit; //mxd
|
2016-10-03 11:42:12 +00:00
|
|
|
menusform.ItemLightRadii.Checked = showlightradii;
|
|
|
|
menusform.ButtonLightRadii.Checked = showlightradii;
|
|
|
|
menusform.ItemSoundRadii.Checked = showsoundradii;
|
|
|
|
menusform.ButtonSoundRadii.Checked = showsoundradii;
|
2009-07-22 15:16:28 +00:00
|
|
|
|
|
|
|
// Load Undo\Redo docker
|
|
|
|
undoredopanel = new UndoRedoPanel();
|
|
|
|
undoredodocker = new Docker("undoredo", "Undo / Redo", undoredopanel);
|
|
|
|
General.Interface.AddDocker(undoredodocker);
|
2013-03-18 13:52:27 +00:00
|
|
|
|
2014-09-17 12:46:47 +00:00
|
|
|
//mxd. Create Overrides docker
|
|
|
|
drawingOverridesPanel = new SectorDrawingOptionsPanel();
|
|
|
|
drawingOverridesDocker = new Docker("drawingoverrides", "Draw Settings", drawingOverridesPanel);
|
|
|
|
|
2013-03-18 13:52:27 +00:00
|
|
|
//mxd
|
|
|
|
General.Actions.BindMethods(this);
|
2022-11-27 10:02:26 +00:00
|
|
|
|
|
|
|
// Register toasts
|
|
|
|
General.ToastManager.RegisterToast(ToastMessages.VISUALSLOPING, "Visual sloping", "Toasts related to visual sloping");
|
2009-04-19 18:07:22 +00:00
|
|
|
}
|
2022-11-27 10:02:26 +00:00
|
|
|
|
2009-04-19 18:07:22 +00:00
|
|
|
// Disposer
|
|
|
|
public override void Dispose()
|
|
|
|
{
|
|
|
|
// Not already disposed?
|
|
|
|
if(!IsDisposed)
|
|
|
|
{
|
|
|
|
// Clean up
|
2009-07-22 15:16:28 +00:00
|
|
|
General.Interface.RemoveDocker(undoredodocker);
|
2012-06-28 20:27:48 +00:00
|
|
|
|
2009-07-22 15:16:28 +00:00
|
|
|
undoredopanel.Dispose();
|
2014-09-17 12:46:47 +00:00
|
|
|
drawingOverridesPanel.Dispose(); //mxd
|
2009-04-19 18:07:22 +00:00
|
|
|
menusform.Unregister();
|
|
|
|
menusform.Dispose();
|
|
|
|
menusform = null;
|
2015-10-09 21:57:32 +00:00
|
|
|
|
|
|
|
//mxd. These are created on demand, so they may be nulls.
|
|
|
|
if(findreplaceform != null)
|
|
|
|
{
|
|
|
|
findreplaceform.Dispose();
|
|
|
|
findreplaceform = null;
|
|
|
|
}
|
|
|
|
if(errorcheckform != null)
|
|
|
|
{
|
|
|
|
errorcheckform.Dispose();
|
|
|
|
errorcheckform = null;
|
|
|
|
}
|
2009-04-19 18:07:22 +00:00
|
|
|
|
|
|
|
// Done
|
|
|
|
me = null;
|
|
|
|
base.Dispose();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
#region ================== Methods
|
|
|
|
|
|
|
|
// This loads the plugin settings
|
|
|
|
private void LoadSettings()
|
|
|
|
{
|
|
|
|
changeheightbysidedef = General.Settings.ReadPluginSetting("changeheightbysidedef", 0);
|
|
|
|
editnewthing = General.Settings.ReadPluginSetting("editnewthing", true);
|
|
|
|
editnewsector = General.Settings.ReadPluginSetting("editnewsector", false);
|
|
|
|
additiveselect = General.Settings.ReadPluginSetting("additiveselect", false);
|
2019-06-20 13:38:41 +00:00
|
|
|
additivepaintselect = General.Settings.ReadPluginSetting("additivepaintselect", additiveselect); // use the same value as additiveselect by default
|
2009-07-07 20:59:56 +00:00
|
|
|
autoclearselection = General.Settings.ReadPluginSetting("autoclearselection", false);
|
2009-07-07 11:29:56 +00:00
|
|
|
visualmodeclearselection = General.Settings.ReadPluginSetting("visualmodeclearselection", false);
|
2013-09-11 08:49:45 +00:00
|
|
|
stitchrange = General.Settings.ReadPluginSetting("stitchrange", 20);
|
|
|
|
highlightrange = General.Settings.ReadPluginSetting("highlightrange", 20);
|
|
|
|
highlightthingsrange = General.Settings.ReadPluginSetting("highlightthingsrange", 10);
|
|
|
|
splitlinedefsrange = General.Settings.ReadPluginSetting("splitlinedefsrange", 10);
|
2017-08-24 13:24:03 +00:00
|
|
|
mouseselectionthreshold = General.Settings.ReadPluginSetting("mouseselectionthreshold", 2);
|
2009-07-12 11:14:34 +00:00
|
|
|
autodragonpaste = General.Settings.ReadPluginSetting("autodragonpaste", false);
|
2013-12-05 09:24:55 +00:00
|
|
|
autoDrawOnEdit = General.Settings.ReadPluginSetting("autodrawonedit", true); //mxd
|
2013-09-11 08:49:45 +00:00
|
|
|
autoAlignTextureOffsetsOnCreate = General.Settings.ReadPluginSetting("autoaligntextureoffsetsoncreate", false); //mxd
|
2013-03-18 13:52:27 +00:00
|
|
|
dontMoveGeometryOutsideMapBoundary = General.Settings.ReadPluginSetting("dontmovegeometryoutsidemapboundary", false); //mxd
|
|
|
|
syncSelection = General.Settings.ReadPluginSetting("syncselection", false); //mxd
|
2020-04-04 16:03:40 +00:00
|
|
|
scaletexturesonslopes = General.Settings.ReadPluginSetting("scaletexturesonslopes", 0);
|
2020-07-16 20:01:37 +00:00
|
|
|
eventlinelabelvisibility = General.Settings.ReadPluginSetting("eventlinelabelvisibility", 3);
|
|
|
|
eventlinelabelstyle = General.Settings.ReadPluginSetting("eventlinelabelstyle", 2);
|
|
|
|
eventlinedistinctcolors = General.Settings.ReadPluginSetting("eventlinedistinctcolors", true);
|
2021-02-13 11:03:37 +00:00
|
|
|
useoppositesmartpivothandle = General.Settings.ReadPluginSetting("useoppositesmartpivothandle", true);
|
2021-10-24 17:22:00 +00:00
|
|
|
selectchangedafterundoredo = General.Settings.ReadPluginSetting("selectchangedafterundoredo", false);
|
2015-09-12 21:05:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//mxd. Load settings, which can be changed via UI
|
|
|
|
private void LoadUISettings()
|
|
|
|
{
|
2016-06-13 23:37:55 +00:00
|
|
|
lockSectorTextureOffsetsWhileDragging = General.Settings.ReadPluginSetting("locktextureoffsets", false);
|
2020-05-03 15:25:07 +00:00
|
|
|
lock3DFloorSectorTextureOffsetsWhileDragging = General.Settings.ReadPluginSetting("lock3dfloortextureoffsets", false);
|
2015-09-12 21:05:01 +00:00
|
|
|
viewselectionnumbers = General.Settings.ReadPluginSetting("viewselectionnumbers", true);
|
2016-06-13 23:37:55 +00:00
|
|
|
viewselectioneffects = General.Settings.ReadPluginSetting("viewselectioneffects", true);
|
|
|
|
syncthingedit = General.Settings.ReadPluginSetting("syncthingedit", true);
|
|
|
|
alphabasedtexturehighlighting = General.Settings.ReadPluginSetting("alphabasedtexturehighlighting", true);
|
2016-10-03 11:42:12 +00:00
|
|
|
showlightradii = General.Settings.ReadPluginSetting("showlightradii", true);
|
|
|
|
showsoundradii = General.Settings.ReadPluginSetting("showsoundradii", true);
|
2009-04-19 18:07:22 +00:00
|
|
|
}
|
|
|
|
|
2013-12-05 09:24:55 +00:00
|
|
|
//mxd. Save settings, which can be changed via UI
|
2015-09-12 21:05:01 +00:00
|
|
|
private void SaveUISettings()
|
2014-12-03 23:15:26 +00:00
|
|
|
{
|
2013-09-16 11:44:47 +00:00
|
|
|
General.Settings.WritePluginSetting("locktextureoffsets", lockSectorTextureOffsetsWhileDragging);
|
2020-05-03 15:25:07 +00:00
|
|
|
General.Settings.WritePluginSetting("lock3dfloortextureoffsets", lock3DFloorSectorTextureOffsetsWhileDragging);
|
2013-09-16 11:44:47 +00:00
|
|
|
General.Settings.WritePluginSetting("viewselectionnumbers", viewselectionnumbers);
|
|
|
|
General.Settings.WritePluginSetting("viewselectioneffects", viewselectioneffects);
|
2015-11-03 08:54:56 +00:00
|
|
|
General.Settings.WritePluginSetting("syncthingedit", syncthingedit);
|
2016-06-13 23:37:55 +00:00
|
|
|
General.Settings.WritePluginSetting("alphabasedtexturehighlighting", alphabasedtexturehighlighting);
|
2016-10-03 11:42:12 +00:00
|
|
|
General.Settings.WritePluginSetting("showlightradii", showlightradii);
|
|
|
|
General.Settings.WritePluginSetting("showsoundradii", showsoundradii);
|
2013-09-16 11:44:47 +00:00
|
|
|
}
|
|
|
|
|
Game Configurations: added Vanilla Strife, Vanilla Heretic and Vanilla Hexen game configurations.
Added "makedoorceil" game configuration property. Works the same way as "makedoortrack" and "makedoordoor", but for ceilings of door sectors.
Changed, Game configurations: the editor no longer tries to load DECORATE/MODELDEF/VOXELDEF/GLDEFS/REVERBS lumps when "decorategames" setting is not specified / is set to empty string.
Changed, General interface: "Tools -> Reload MODELDEF/VOXELDEF" and "Tools -> Reload GLDEFS" menu items are no longer shown when current game configuration doesn't support DECORATE.
Fixed a crash when pasting linedef/thing properties in Hexen map format.
Fixed, Visual mode: Visual Thing resources were not fully unloaded when resetting D3D device leading to crash when switching to the editor from a DX-using game engine (like ZDoom) running in fullscreen.
Fixed: in some cases, when current game configuration supported multiple script compilers, it was possible to open/create a map or change map options without selecting any script compiler.
Fixed, New Map Options window: default map name was not updated when switching game configurations.
Fixed: copied map element properties were not reset after switching to another map.
Fixed: stored textures for "Make Door" action were not reset after switching to another map.
Fixed, Game Configurations window: currently selected test engine name was not updated when pasting test engines from another configuration.
Fixed, Game Configurations: all "Heretic in Doom map format" configurations were using Doom sector effects list.
Fixed, Game Configurations: all "Strife in Doom map format" configurations were using Doom sector effects list.
2015-10-21 13:35:42 +00:00
|
|
|
//mxd. These should be reset when changing maps
|
|
|
|
private void ResetCopyProperties()
|
|
|
|
{
|
|
|
|
copiedvertexprops = null;
|
|
|
|
copiedthingprops = null;
|
|
|
|
copiedlinedefprops = null;
|
|
|
|
copiedsidedefprops = null;
|
|
|
|
copiedsectorprops = null;
|
|
|
|
}
|
|
|
|
|
2009-04-19 18:07:22 +00:00
|
|
|
#endregion
|
|
|
|
|
|
|
|
#region ================== Events
|
|
|
|
|
|
|
|
// When floor surface geometry is created for classic modes
|
|
|
|
public override void OnSectorFloorSurfaceUpdate(Sector s, ref FlatVertex[] vertices)
|
|
|
|
{
|
|
|
|
ImageData img = General.Map.Data.GetFlatImage(s.LongFloorTexture);
|
|
|
|
if((img != null) && img.IsImageLoaded)
|
|
|
|
{
|
2012-11-27 21:12:20 +00:00
|
|
|
//mxd. Merged from GZDoomEditing plugin
|
2017-04-03 17:42:30 +00:00
|
|
|
if(General.Map.UDMF)
|
2014-12-03 23:15:26 +00:00
|
|
|
{
|
2012-11-27 21:12:20 +00:00
|
|
|
// Fetch ZDoom fields
|
2020-05-22 19:39:18 +00:00
|
|
|
Vector2D offset = new Vector2D(s.Fields.GetValue("xpanningfloor", 0.0),
|
|
|
|
s.Fields.GetValue("ypanningfloor", 0.0));
|
|
|
|
Vector2D scale = new Vector2D(s.Fields.GetValue("xscalefloor", 1.0),
|
|
|
|
s.Fields.GetValue("yscalefloor", 1.0));
|
|
|
|
double rotate = s.Fields.GetValue("rotationfloor", 0.0);
|
2015-04-14 11:33:57 +00:00
|
|
|
int color, light;
|
|
|
|
bool absolute;
|
|
|
|
|
|
|
|
//mxd. Apply GLDEFS override?
|
Added, Visual mode, GLDEFS, GLOOME: subtractive glow is now supported.
Changed, Visual mode: changed thing fog calculation logic. Should be closer to GZDoom now.
Fixed, GLDEFS parser: "height" texture parameter was not treated as optional.
Fixed, text lump parsers: in some cases incorrect line number was displayed in error and warning messages.
Fixed, Visual mode: glow effect was not applied to sectors with 3 sidedefs.
Fixed, Visual mode: in some cases glow effect was not updated when replacing textures.
Fixed, general interface: "Full Brightness" button state was not updated during map loading.
Fixed, Drag Linedefs/Vertices/Sectors/Things modes: positions of line length labels were not updated while panning the view.
Cosmetic: added a bunch of new icons.
Cosmetic: changed Visual mode crosshair.
2015-08-27 20:46:49 +00:00
|
|
|
if(General.Map.Data.GlowingFlats.ContainsKey(s.LongFloorTexture)
|
2016-11-09 10:07:21 +00:00
|
|
|
&& General.Map.Data.GlowingFlats[s.LongFloorTexture].Fullbright)
|
2015-04-14 11:33:57 +00:00
|
|
|
{
|
|
|
|
color = -1;
|
2016-11-09 10:07:21 +00:00
|
|
|
light = 255;
|
2015-04-14 11:33:57 +00:00
|
|
|
absolute = true;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2017-02-13 00:06:29 +00:00
|
|
|
color = PixelColor.Modulate(PixelColor.FromInt(s.Fields.GetValue("lightcolor", -1)), PixelColor.FromInt(s.Fields.GetValue("color_floor", -1))).ToInt();
|
2015-04-14 11:33:57 +00:00
|
|
|
light = s.Fields.GetValue("lightfloor", 0);
|
|
|
|
absolute = s.Fields.GetValue("lightfloorabsolute", false);
|
|
|
|
}
|
2012-11-27 21:12:20 +00:00
|
|
|
|
|
|
|
// Setup the vertices with the given settings
|
|
|
|
SetupSurfaceVertices(vertices, s, img, offset, scale, rotate, color, light, absolute);
|
2014-12-03 23:15:26 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2012-11-27 21:12:20 +00:00
|
|
|
// Make scalars
|
|
|
|
float sw = 1.0f / img.ScaledWidth;
|
|
|
|
float sh = 1.0f / img.ScaledHeight;
|
|
|
|
|
|
|
|
// Make proper texture coordinates
|
2014-12-03 23:15:26 +00:00
|
|
|
for(int i = 0; i < vertices.Length; i++)
|
|
|
|
{
|
2012-11-27 21:12:20 +00:00
|
|
|
vertices[i].u = vertices[i].u * sw;
|
|
|
|
vertices[i].v = -vertices[i].v * sh;
|
|
|
|
}
|
2009-04-19 18:07:22 +00:00
|
|
|
}
|
|
|
|
}
|
2017-04-03 17:40:51 +00:00
|
|
|
else // [ZZ] proper fallback please.
|
|
|
|
{
|
|
|
|
for (int i = 0; i < vertices.Length; i++)
|
|
|
|
{
|
|
|
|
vertices[i].u = vertices[i].u / 64;
|
|
|
|
vertices[i].v = -vertices[i].v / 64;
|
|
|
|
}
|
|
|
|
}
|
2009-04-19 18:07:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// When ceiling surface geometry is created for classic modes
|
|
|
|
public override void OnSectorCeilingSurfaceUpdate(Sector s, ref FlatVertex[] vertices)
|
|
|
|
{
|
|
|
|
ImageData img = General.Map.Data.GetFlatImage(s.LongCeilTexture);
|
|
|
|
if((img != null) && img.IsImageLoaded)
|
|
|
|
{
|
2012-11-27 21:12:20 +00:00
|
|
|
//mxd. Merged from GZDoomEditing plugin
|
2014-12-03 23:15:26 +00:00
|
|
|
if(General.Map.UDMF)
|
|
|
|
{
|
2012-11-27 21:12:20 +00:00
|
|
|
// Fetch ZDoom fields
|
2020-05-22 19:39:18 +00:00
|
|
|
Vector2D offset = new Vector2D(s.Fields.GetValue("xpanningceiling", 0.0),
|
|
|
|
s.Fields.GetValue("ypanningceiling", 0.0));
|
|
|
|
Vector2D scale = new Vector2D(s.Fields.GetValue("xscaleceiling", 1.0),
|
|
|
|
s.Fields.GetValue("yscaleceiling", 1.0));
|
|
|
|
double rotate = s.Fields.GetValue("rotationceiling", 0.0);
|
2015-04-14 11:33:57 +00:00
|
|
|
int color, light;
|
|
|
|
bool absolute;
|
|
|
|
|
|
|
|
//mxd. Apply GLDEFS override?
|
Added, Visual mode, GLDEFS, GLOOME: subtractive glow is now supported.
Changed, Visual mode: changed thing fog calculation logic. Should be closer to GZDoom now.
Fixed, GLDEFS parser: "height" texture parameter was not treated as optional.
Fixed, text lump parsers: in some cases incorrect line number was displayed in error and warning messages.
Fixed, Visual mode: glow effect was not applied to sectors with 3 sidedefs.
Fixed, Visual mode: in some cases glow effect was not updated when replacing textures.
Fixed, general interface: "Full Brightness" button state was not updated during map loading.
Fixed, Drag Linedefs/Vertices/Sectors/Things modes: positions of line length labels were not updated while panning the view.
Cosmetic: added a bunch of new icons.
Cosmetic: changed Visual mode crosshair.
2015-08-27 20:46:49 +00:00
|
|
|
if(General.Map.Data.GlowingFlats.ContainsKey(s.LongCeilTexture)
|
2016-11-09 10:07:21 +00:00
|
|
|
&& General.Map.Data.GlowingFlats[s.LongCeilTexture].Fullbright)
|
2015-04-14 11:33:57 +00:00
|
|
|
{
|
|
|
|
color = -1;
|
2016-11-09 10:07:21 +00:00
|
|
|
light = 255;
|
2015-04-14 11:33:57 +00:00
|
|
|
absolute = true;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2017-02-13 00:06:29 +00:00
|
|
|
color = PixelColor.Modulate(PixelColor.FromInt(s.Fields.GetValue("lightcolor", -1)), PixelColor.FromInt(s.Fields.GetValue("color_ceiling", -1))).ToInt();
|
|
|
|
light = s.Fields.GetValue("lightceiling", 0);
|
2015-04-14 11:33:57 +00:00
|
|
|
absolute = s.Fields.GetValue("lightceilingabsolute", false);
|
|
|
|
}
|
2012-11-27 21:12:20 +00:00
|
|
|
|
|
|
|
// Setup the vertices with the given settings
|
|
|
|
SetupSurfaceVertices(vertices, s, img, offset, scale, rotate, color, light, absolute);
|
2014-12-03 23:15:26 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2012-11-27 21:12:20 +00:00
|
|
|
// Make scalars
|
|
|
|
float sw = 1.0f / img.ScaledWidth;
|
|
|
|
float sh = 1.0f / img.ScaledHeight;
|
|
|
|
|
|
|
|
// Make proper texture coordinates
|
2014-12-03 23:15:26 +00:00
|
|
|
for(int i = 0; i < vertices.Length; i++)
|
|
|
|
{
|
2012-11-27 21:12:20 +00:00
|
|
|
vertices[i].u = vertices[i].u * sw;
|
|
|
|
vertices[i].v = -vertices[i].v * sh;
|
|
|
|
}
|
2009-04-19 18:07:22 +00:00
|
|
|
}
|
|
|
|
}
|
2017-04-03 17:40:51 +00:00
|
|
|
else // [ZZ] proper fallback please.
|
|
|
|
{
|
|
|
|
for (int i = 0; i < vertices.Length; i++)
|
|
|
|
{
|
|
|
|
vertices[i].u = vertices[i].u / 64;
|
|
|
|
vertices[i].v = -vertices[i].v / 64;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2009-04-19 18:07:22 +00:00
|
|
|
|
|
|
|
// When the editing mode changes
|
|
|
|
public override bool OnModeChange(EditMode oldmode, EditMode newmode)
|
|
|
|
{
|
|
|
|
// Show the correct menu for the new mode
|
|
|
|
menusform.ShowEditingModeMenu(newmode);
|
|
|
|
|
|
|
|
return base.OnModeChange(oldmode, newmode);
|
|
|
|
}
|
|
|
|
|
|
|
|
// When the Preferences dialog is shown
|
|
|
|
public override void OnShowPreferences(PreferencesController controller)
|
|
|
|
{
|
|
|
|
base.OnShowPreferences(controller);
|
|
|
|
|
|
|
|
// Load preferences
|
|
|
|
preferencesform = new PreferencesForm();
|
|
|
|
preferencesform.Setup(controller);
|
|
|
|
}
|
|
|
|
|
|
|
|
// When the Preferences dialog is closed
|
|
|
|
public override void OnClosePreferences(PreferencesController controller)
|
|
|
|
{
|
|
|
|
base.OnClosePreferences(controller);
|
|
|
|
|
|
|
|
// Apply settings that could have been changed
|
|
|
|
LoadSettings();
|
|
|
|
|
|
|
|
// Unload preferences
|
|
|
|
preferencesform.Dispose();
|
|
|
|
preferencesform = null;
|
|
|
|
}
|
|
|
|
|
2009-07-22 15:16:28 +00:00
|
|
|
// New map created
|
|
|
|
public override void OnMapNewEnd()
|
|
|
|
{
|
|
|
|
base.OnMapNewEnd();
|
|
|
|
undoredopanel.SetBeginDescription("New Map");
|
|
|
|
undoredopanel.UpdateList();
|
2012-06-26 08:54:25 +00:00
|
|
|
|
2013-11-21 10:53:11 +00:00
|
|
|
//mxd
|
2014-09-17 12:46:47 +00:00
|
|
|
General.Interface.AddDocker(drawingOverridesDocker);
|
2013-11-21 10:53:11 +00:00
|
|
|
drawingOverridesPanel.Setup();
|
2017-04-03 08:20:40 +00:00
|
|
|
MakeDoor = new MakeDoorSettings(General.Map.Config.MakeDoorDoor, General.Map.Config.MakeDoorTrack, General.Map.Config.MakeDoorCeiling, MakeDoor.ResetOffsets, MakeDoor.ApplyActionSpecials, MakeDoor.ApplyTag);
|
Game Configurations: added Vanilla Strife, Vanilla Heretic and Vanilla Hexen game configurations.
Added "makedoorceil" game configuration property. Works the same way as "makedoortrack" and "makedoordoor", but for ceilings of door sectors.
Changed, Game configurations: the editor no longer tries to load DECORATE/MODELDEF/VOXELDEF/GLDEFS/REVERBS lumps when "decorategames" setting is not specified / is set to empty string.
Changed, General interface: "Tools -> Reload MODELDEF/VOXELDEF" and "Tools -> Reload GLDEFS" menu items are no longer shown when current game configuration doesn't support DECORATE.
Fixed a crash when pasting linedef/thing properties in Hexen map format.
Fixed, Visual mode: Visual Thing resources were not fully unloaded when resetting D3D device leading to crash when switching to the editor from a DX-using game engine (like ZDoom) running in fullscreen.
Fixed: in some cases, when current game configuration supported multiple script compilers, it was possible to open/create a map or change map options without selecting any script compiler.
Fixed, New Map Options window: default map name was not updated when switching game configurations.
Fixed: copied map element properties were not reset after switching to another map.
Fixed: stored textures for "Make Door" action were not reset after switching to another map.
Fixed, Game Configurations window: currently selected test engine name was not updated when pasting test engines from another configuration.
Fixed, Game Configurations: all "Heretic in Doom map format" configurations were using Doom sector effects list.
Fixed, Game Configurations: all "Strife in Doom map format" configurations were using Doom sector effects list.
2015-10-21 13:35:42 +00:00
|
|
|
ResetCopyProperties();
|
2009-07-22 15:16:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Map opened
|
|
|
|
public override void OnMapOpenEnd()
|
|
|
|
{
|
|
|
|
base.OnMapOpenEnd();
|
|
|
|
undoredopanel.SetBeginDescription("Opened Map");
|
|
|
|
undoredopanel.UpdateList();
|
2012-06-26 08:54:25 +00:00
|
|
|
|
2013-11-21 10:53:11 +00:00
|
|
|
//mxd
|
2014-09-17 12:46:47 +00:00
|
|
|
General.Interface.AddDocker(drawingOverridesDocker);
|
2013-11-21 10:53:11 +00:00
|
|
|
drawingOverridesPanel.Setup();
|
Game Configurations: added Vanilla Strife, Vanilla Heretic and Vanilla Hexen game configurations.
Added "makedoorceil" game configuration property. Works the same way as "makedoortrack" and "makedoordoor", but for ceilings of door sectors.
Changed, Game configurations: the editor no longer tries to load DECORATE/MODELDEF/VOXELDEF/GLDEFS/REVERBS lumps when "decorategames" setting is not specified / is set to empty string.
Changed, General interface: "Tools -> Reload MODELDEF/VOXELDEF" and "Tools -> Reload GLDEFS" menu items are no longer shown when current game configuration doesn't support DECORATE.
Fixed a crash when pasting linedef/thing properties in Hexen map format.
Fixed, Visual mode: Visual Thing resources were not fully unloaded when resetting D3D device leading to crash when switching to the editor from a DX-using game engine (like ZDoom) running in fullscreen.
Fixed: in some cases, when current game configuration supported multiple script compilers, it was possible to open/create a map or change map options without selecting any script compiler.
Fixed, New Map Options window: default map name was not updated when switching game configurations.
Fixed: copied map element properties were not reset after switching to another map.
Fixed: stored textures for "Make Door" action were not reset after switching to another map.
Fixed, Game Configurations window: currently selected test engine name was not updated when pasting test engines from another configuration.
Fixed, Game Configurations: all "Heretic in Doom map format" configurations were using Doom sector effects list.
Fixed, Game Configurations: all "Strife in Doom map format" configurations were using Doom sector effects list.
2015-10-21 13:35:42 +00:00
|
|
|
General.Map.Renderer2D.UpdateExtraFloorFlag();
|
2017-04-03 08:20:40 +00:00
|
|
|
MakeDoor = new MakeDoorSettings(General.Map.Config.MakeDoorDoor, General.Map.Config.MakeDoorTrack, General.Map.Config.MakeDoorCeiling, MakeDoor.ResetOffsets, MakeDoor.ApplyActionSpecials, MakeDoor.ApplyTag);
|
Game Configurations: added Vanilla Strife, Vanilla Heretic and Vanilla Hexen game configurations.
Added "makedoorceil" game configuration property. Works the same way as "makedoortrack" and "makedoordoor", but for ceilings of door sectors.
Changed, Game configurations: the editor no longer tries to load DECORATE/MODELDEF/VOXELDEF/GLDEFS/REVERBS lumps when "decorategames" setting is not specified / is set to empty string.
Changed, General interface: "Tools -> Reload MODELDEF/VOXELDEF" and "Tools -> Reload GLDEFS" menu items are no longer shown when current game configuration doesn't support DECORATE.
Fixed a crash when pasting linedef/thing properties in Hexen map format.
Fixed, Visual mode: Visual Thing resources were not fully unloaded when resetting D3D device leading to crash when switching to the editor from a DX-using game engine (like ZDoom) running in fullscreen.
Fixed: in some cases, when current game configuration supported multiple script compilers, it was possible to open/create a map or change map options without selecting any script compiler.
Fixed, New Map Options window: default map name was not updated when switching game configurations.
Fixed: copied map element properties were not reset after switching to another map.
Fixed: stored textures for "Make Door" action were not reset after switching to another map.
Fixed, Game Configurations window: currently selected test engine name was not updated when pasting test engines from another configuration.
Fixed, Game Configurations: all "Heretic in Doom map format" configurations were using Doom sector effects list.
Fixed, Game Configurations: all "Strife in Doom map format" configurations were using Doom sector effects list.
2015-10-21 13:35:42 +00:00
|
|
|
ResetCopyProperties();
|
2009-07-22 15:16:28 +00:00
|
|
|
}
|
2015-09-16 12:10:43 +00:00
|
|
|
|
|
|
|
//mxd
|
|
|
|
public override void OnMapCloseBegin()
|
|
|
|
{
|
|
|
|
drawingOverridesPanel.Terminate();
|
|
|
|
General.Interface.RemoveDocker(drawingOverridesDocker);
|
|
|
|
}
|
2018-04-14 22:59:58 +00:00
|
|
|
|
|
|
|
// Map closed
|
|
|
|
public override void OnMapCloseEnd()
|
2009-07-22 15:16:28 +00:00
|
|
|
{
|
|
|
|
base.OnMapCloseEnd();
|
|
|
|
undoredopanel.UpdateList();
|
2016-05-18 23:31:12 +00:00
|
|
|
errorcheckform = null; //mxd. Error checks may need to be reinitialized
|
2012-06-26 08:54:25 +00:00
|
|
|
|
2013-09-16 11:44:47 +00:00
|
|
|
//mxd. Save settings
|
2015-09-12 21:05:01 +00:00
|
|
|
SaveUISettings();
|
2009-07-22 15:16:28 +00:00
|
|
|
}
|
2016-05-19 21:44:39 +00:00
|
|
|
|
|
|
|
//mxd. Error checks may need to be reinitialized
|
|
|
|
public override void OnMapReconfigure()
|
|
|
|
{
|
|
|
|
errorcheckform = null;
|
|
|
|
}
|
2009-07-22 15:16:28 +00:00
|
|
|
|
|
|
|
// Redo performed
|
|
|
|
public override void OnRedoEnd()
|
|
|
|
{
|
|
|
|
base.OnRedoEnd();
|
|
|
|
undoredopanel.UpdateList();
|
|
|
|
}
|
|
|
|
|
|
|
|
// Undo performed
|
|
|
|
public override void OnUndoEnd()
|
|
|
|
{
|
|
|
|
base.OnUndoEnd();
|
|
|
|
undoredopanel.UpdateList();
|
|
|
|
}
|
|
|
|
|
|
|
|
// Undo created
|
|
|
|
public override void OnUndoCreated()
|
|
|
|
{
|
|
|
|
base.OnUndoCreated();
|
|
|
|
undoredopanel.UpdateList();
|
|
|
|
}
|
|
|
|
|
|
|
|
// Undo withdrawn
|
|
|
|
public override void OnUndoWithdrawn()
|
|
|
|
{
|
|
|
|
base.OnUndoWithdrawn();
|
|
|
|
undoredopanel.UpdateList();
|
|
|
|
}
|
|
|
|
|
2009-04-19 18:07:22 +00:00
|
|
|
#endregion
|
|
|
|
|
|
|
|
#region ================== Tools
|
2012-03-19 21:31:10 +00:00
|
|
|
|
2012-11-27 21:12:20 +00:00
|
|
|
//mxd. merged from GZDoomEditing plugin
|
|
|
|
// This applies the given values on the vertices
|
2014-05-20 09:09:28 +00:00
|
|
|
private static void SetupSurfaceVertices(FlatVertex[] vertices, Sector s, ImageData img, Vector2D offset,
|
2020-05-21 12:20:02 +00:00
|
|
|
Vector2D scale, double rotate, int color, int light, bool absolute)
|
2014-05-20 09:09:28 +00:00
|
|
|
{
|
2012-11-27 21:12:20 +00:00
|
|
|
// Prepare for math!
|
|
|
|
rotate = Angle2D.DegToRad(rotate);
|
|
|
|
Vector2D texscale = new Vector2D(1.0f / img.ScaledWidth, 1.0f / img.ScaledHeight);
|
|
|
|
if(!absolute) light = s.Brightness + light;
|
|
|
|
PixelColor lightcolor = PixelColor.FromInt(color);
|
|
|
|
PixelColor brightness = PixelColor.FromInt(General.Map.Renderer2D.CalculateBrightness(light));
|
|
|
|
PixelColor finalcolor = PixelColor.Modulate(lightcolor, brightness);
|
2017-02-13 00:06:29 +00:00
|
|
|
color = finalcolor.WithAlpha(255).ToInt();
|
2012-11-27 21:12:20 +00:00
|
|
|
|
|
|
|
// Do the math for all vertices
|
2014-12-03 23:15:26 +00:00
|
|
|
for(int i = 0; i < vertices.Length; i++)
|
|
|
|
{
|
2012-11-27 21:12:20 +00:00
|
|
|
Vector2D pos = new Vector2D(vertices[i].x, vertices[i].y);
|
|
|
|
pos = pos.GetRotated(rotate);
|
|
|
|
pos.y = -pos.y;
|
|
|
|
pos = (pos + offset) * scale * texscale;
|
2020-05-21 12:20:02 +00:00
|
|
|
vertices[i].u = (float)pos.x;
|
|
|
|
vertices[i].v = (float)pos.y;
|
2012-11-27 21:12:20 +00:00
|
|
|
vertices[i].c = color;
|
|
|
|
}
|
|
|
|
}
|
2009-04-19 18:07:22 +00:00
|
|
|
|
|
|
|
// This finds all class types that inherits from the given type
|
|
|
|
public Type[] FindClasses(Type t)
|
|
|
|
{
|
|
|
|
List<Type> found = new List<Type>();
|
|
|
|
|
|
|
|
// Get all exported types
|
2013-09-09 14:03:02 +00:00
|
|
|
Type[] types = Assembly.GetExecutingAssembly().GetTypes();
|
2009-04-19 18:07:22 +00:00
|
|
|
foreach(Type it in types)
|
|
|
|
{
|
|
|
|
// Compare types
|
|
|
|
if(t.IsAssignableFrom(it)) found.Add(it);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Return list
|
|
|
|
return found.ToArray();
|
|
|
|
}
|
|
|
|
|
|
|
|
#endregion
|
2013-03-18 13:52:27 +00:00
|
|
|
|
2014-10-23 08:18:14 +00:00
|
|
|
#region ================== Actions (mxd)
|
2013-03-18 13:52:27 +00:00
|
|
|
|
|
|
|
[BeginAction("exporttoobj")]
|
2014-12-03 23:15:26 +00:00
|
|
|
private void ExportToObj()
|
|
|
|
{
|
2013-12-13 09:31:18 +00:00
|
|
|
// Convert geometry selection to sectors
|
|
|
|
General.Map.Map.ConvertSelection(SelectionType.Sectors);
|
|
|
|
|
2013-03-18 13:52:27 +00:00
|
|
|
//get sectors
|
|
|
|
ICollection<Sector> sectors = General.Map.Map.SelectedSectorsCount == 0 ? General.Map.Map.Sectors : General.Map.Map.GetSelectedSectors(true);
|
2014-12-03 23:15:26 +00:00
|
|
|
if(sectors.Count == 0)
|
|
|
|
{
|
2013-03-18 13:52:27 +00:00
|
|
|
General.Interface.DisplayStatus(StatusType.Warning, "OBJ export failed. Map has no sectors!");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
//show settings form
|
|
|
|
WavefrontSettingsForm form = new WavefrontSettingsForm(General.Map.Map.SelectedSectorsCount == 0 ? -1 : sectors.Count);
|
2014-12-03 23:15:26 +00:00
|
|
|
if(form.ShowDialog() == DialogResult.OK)
|
|
|
|
{
|
2020-07-04 19:26:06 +00:00
|
|
|
WavefrontExportSettings data = new WavefrontExportSettings(form);
|
2013-03-18 13:52:27 +00:00
|
|
|
WavefrontExporter e = new WavefrontExporter();
|
|
|
|
e.Export(sectors, data);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-06-17 20:22:00 +00:00
|
|
|
[BeginAction("exporttoimage")]
|
|
|
|
private void ExportToImage()
|
|
|
|
{
|
|
|
|
// Convert geometry selection to sectors
|
|
|
|
General.Map.Map.ConvertSelection(SelectionType.Sectors);
|
|
|
|
|
|
|
|
// Get sectors
|
|
|
|
ICollection<Sector> sectors = General.Map.Map.SelectedSectorsCount == 0 ? General.Map.Map.Sectors : General.Map.Map.GetSelectedSectors(true);
|
|
|
|
if (sectors.Count == 0)
|
|
|
|
{
|
|
|
|
General.Interface.DisplayStatus(StatusType.Warning, "Image export failed. Map has no sectors!");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
ImageExportSettingsForm form = new ImageExportSettingsForm();
|
2020-12-24 14:00:16 +00:00
|
|
|
form.ShowDialog();
|
2020-06-17 20:22:00 +00:00
|
|
|
}
|
|
|
|
|
2013-03-18 13:52:27 +00:00
|
|
|
#endregion
|
2009-04-19 18:07:22 +00:00
|
|
|
}
|
|
|
|
}
|