mirror of
https://git.do.srb2.org/STJr/UltimateZoneBuilder.git
synced 2025-01-18 14:31:50 +00:00
- added Make Sectors mode
- added editing mode name at the bottom information bar - some bugfixes in game configurations
This commit is contained in:
parent
c37b28e15f
commit
1bd143c9b3
47 changed files with 769 additions and 153 deletions
|
@ -18,10 +18,10 @@ formatinterface = "DoomMapSetIO";
|
|||
defaultlumpname = "E1M1";
|
||||
|
||||
// Special linedefs
|
||||
soundlinedefflags = 64; // See linedefflags
|
||||
singlesidedflags = 1; // See linedefflags
|
||||
doublesidedflags = 4; // See linedefflags
|
||||
impassableflags = 1;
|
||||
soundlinedefflag = 64; // See linedefflags
|
||||
singlesidedflag = 1; // See linedefflags
|
||||
doublesidedflag = 4; // See linedefflags
|
||||
impassableflag = 1;
|
||||
|
||||
// Generalized actions
|
||||
generalizedlinedefs = true;
|
||||
|
|
|
@ -18,10 +18,10 @@ formatinterface = "DoomMapSetIO";
|
|||
defaultlumpname = "E1M1";
|
||||
|
||||
// Special linedefs
|
||||
soundlinedefflags = 64; // See linedefflags
|
||||
singlesidedflags = 1; // See linedefflags
|
||||
doublesidedflags = 4; // See linedefflags
|
||||
impassableflags = 1;
|
||||
soundlinedefflag = 64; // See linedefflags
|
||||
singlesidedflag = 1; // See linedefflags
|
||||
doublesidedflag = 4; // See linedefflags
|
||||
impassableflag = 1;
|
||||
|
||||
// Generalized actions
|
||||
generalizedlinedefs = false;
|
||||
|
|
|
@ -18,10 +18,10 @@ formatinterface = "DoomMapSetIO";
|
|||
defaultlumpname = "MAP01";
|
||||
|
||||
// Special linedefs
|
||||
soundlinedefflags = 64; // See linedefflags
|
||||
singlesidedflags = 1; // See linedefflags
|
||||
doublesidedflags = 4; // See linedefflags
|
||||
impassableflags = 1;
|
||||
soundlinedefflag = 64; // See linedefflags
|
||||
singlesidedflag = 1; // See linedefflags
|
||||
doublesidedflag = 4; // See linedefflags
|
||||
impassableflag = 1;
|
||||
|
||||
// Generalized actions
|
||||
generalizedlinedefs = false;
|
||||
|
|
|
@ -18,10 +18,10 @@ formatinterface = "DoomMapSetIO";
|
|||
defaultlumpname = "MAP01";
|
||||
|
||||
// Special linedefs
|
||||
soundlinedefflags = 64; // See linedefflags
|
||||
singlesidedflags = 1; // See linedefflags
|
||||
doublesidedflags = 4; // See linedefflags
|
||||
impassableflags = 1;
|
||||
soundlinedefflag = 64; // See linedefflags
|
||||
singlesidedflag = 1; // See linedefflags
|
||||
doublesidedflag = 4; // See linedefflags
|
||||
impassableflag = 1;
|
||||
|
||||
// Generalized actions
|
||||
generalizedlinedefs = false;
|
||||
|
|
|
@ -18,10 +18,10 @@ formatinterface = "DoomMapSetIO";
|
|||
defaultlumpname = "MAP01";
|
||||
|
||||
// Special linedefs
|
||||
soundlinedefflags = 64; // See linedefflags
|
||||
singlesidedflags = 1; // See linedefflags
|
||||
doublesidedflags = 4; // See linedefflags
|
||||
impassableflags = 1;
|
||||
soundlinedefflag = 64; // See linedefflags
|
||||
singlesidedflag = 1; // See linedefflags
|
||||
doublesidedflag = 4; // See linedefflags
|
||||
impassableflag = 1;
|
||||
|
||||
// Generalized actions
|
||||
generalizedlinedefs = true;
|
||||
|
|
|
@ -18,10 +18,10 @@ formatinterface = "DoomMapSetIO";
|
|||
defaultlumpname = "E1M1";
|
||||
|
||||
// Special linedefs
|
||||
soundlinedefflags = 64; // See linedefflags
|
||||
singlesidedflags = 1; // See linedefflags
|
||||
doublesidedflags = 4; // See linedefflags
|
||||
impassableflags = 1;
|
||||
soundlinedefflag = 64; // See linedefflags
|
||||
singlesidedflag = 1; // See linedefflags
|
||||
doublesidedflag = 4; // See linedefflags
|
||||
impassableflag = 1;
|
||||
|
||||
// Generalized actions
|
||||
generalizedlinedefs = false;
|
||||
|
|
|
@ -18,10 +18,10 @@ formatinterface = "HexenMapSetIO";
|
|||
defaultlumpname = "MAP01";
|
||||
|
||||
// Special linedefs
|
||||
soundlinedefflags = 64; // See linedefflags
|
||||
singlesidedflags = 1; // See linedefflags
|
||||
doublesidedflags = 4; // See linedefflags
|
||||
impassableflags = 1;
|
||||
soundlinedefflag = 64; // See linedefflags
|
||||
singlesidedflag = 1; // See linedefflags
|
||||
doublesidedflag = 4; // See linedefflags
|
||||
impassableflag = 1;
|
||||
|
||||
// Generalized actions
|
||||
generalizedlinedefs = false;
|
||||
|
|
|
@ -18,10 +18,10 @@ formatinterface = "DoomMapSetIO";
|
|||
defaultlumpname = "MAP01";
|
||||
|
||||
// Special linedefs
|
||||
soundlinedefflags = 64; // See linedefflags
|
||||
singlesidedflags = 1; // See linedefflags
|
||||
doublesidedflags = 4; // See linedefflags
|
||||
impassableflags = 1;
|
||||
soundlinedefflag = 64; // See linedefflags
|
||||
singlesidedflag = 1; // See linedefflags
|
||||
doublesidedflag = 4; // See linedefflags
|
||||
impassableflag = 1;
|
||||
|
||||
// Generalized actions
|
||||
generalizedlinedefs = true;
|
||||
|
|
|
@ -18,10 +18,10 @@ formatinterface = "DoomMapSetIO";
|
|||
defaultlumpname = "MAP01";
|
||||
|
||||
// Special linedefs
|
||||
soundlinedefflags = 64; // See linedefflags
|
||||
singlesidedflags = 1; // See linedefflags
|
||||
doublesidedflags = 4; // See linedefflags
|
||||
impassableflags = 1;
|
||||
soundlinedefflag = 64; // See linedefflags
|
||||
singlesidedflag = 1; // See linedefflags
|
||||
doublesidedflag = 4; // See linedefflags
|
||||
impassableflag = 1;
|
||||
|
||||
// Generalized actions
|
||||
generalizedlinedefs = true;
|
||||
|
|
|
@ -18,10 +18,10 @@ formatinterface = "DoomMapSetIO";
|
|||
defaultlumpname = "MAP01";
|
||||
|
||||
// Special linedefs
|
||||
soundlinedefflags = 64; // See linedefflags
|
||||
singlesidedflags = 1; // See linedefflags
|
||||
doublesidedflags = 4; // See linedefflags
|
||||
impassableflags = 1;
|
||||
soundlinedefflag = 64; // See linedefflags
|
||||
singlesidedflag = 1; // See linedefflags
|
||||
doublesidedflag = 4; // See linedefflags
|
||||
impassableflag = 1;
|
||||
|
||||
// Generalized actions
|
||||
generalizedlinedefs = true;
|
||||
|
|
|
@ -18,10 +18,10 @@ formatinterface = "HexenMapSetIO";
|
|||
defaultlumpname = "MAP01";
|
||||
|
||||
// Special linedefs
|
||||
soundlinedefflags = 64; // See linedefflags
|
||||
singlesidedflags = 1; // See linedefflags
|
||||
doublesidedflags = 4; // See linedefflags
|
||||
impassableflags = 1;
|
||||
soundlinedefflag = 64; // See linedefflags
|
||||
singlesidedflag = 1; // See linedefflags
|
||||
doublesidedflag = 4; // See linedefflags
|
||||
impassableflag = 1;
|
||||
|
||||
// Generalized actions
|
||||
generalizedlinedefs = false;
|
||||
|
|
|
@ -18,10 +18,10 @@ formatinterface = "DoomMapSetIO";
|
|||
defaultlumpname = "MAP01";
|
||||
|
||||
// Special linedefs
|
||||
soundlinedefflags = 64; // See linedefflags
|
||||
singlesidedflags = 1; // See linedefflags
|
||||
doublesidedflags = 4; // See linedefflags
|
||||
impassableflags = 1;
|
||||
soundlinedefflag = 64; // See linedefflags
|
||||
singlesidedflag = 1; // See linedefflags
|
||||
doublesidedflag = 4; // See linedefflags
|
||||
impassableflag = 1;
|
||||
|
||||
// Generalized actions
|
||||
generalizedlinedefs = false;
|
||||
|
|
|
@ -18,10 +18,10 @@ formatinterface = "DoomMapSetIO";
|
|||
defaultlumpname = "E1M1";
|
||||
|
||||
// Special linedefs
|
||||
soundlinedefflags = 64; // See linedefflags
|
||||
singlesidedflags = 1; // See linedefflags
|
||||
doublesidedflags = 4; // See linedefflags
|
||||
impassableflags = 1;
|
||||
soundlinedefflag = 64; // See linedefflags
|
||||
singlesidedflag = 1; // See linedefflags
|
||||
doublesidedflag = 4; // See linedefflags
|
||||
impassableflag = 1;
|
||||
|
||||
// Generalized actions
|
||||
generalizedlinedefs = false;
|
||||
|
|
|
@ -18,10 +18,10 @@ formatinterface = "DoomMapSetIO";
|
|||
defaultlumpname = "MAP01";
|
||||
|
||||
// Special linedefs
|
||||
soundlinedefflags = 64; // See linedefflags
|
||||
singlesidedflags = 1; // See linedefflags
|
||||
doublesidedflags = 4; // See linedefflags
|
||||
impassableflags = 1;
|
||||
soundlinedefflag = 64; // See linedefflags
|
||||
singlesidedflag = 1; // See linedefflags
|
||||
doublesidedflag = 4; // See linedefflags
|
||||
impassableflag = 1;
|
||||
|
||||
// Generalized actions
|
||||
generalizedlinedefs = true;
|
||||
|
|
|
@ -18,10 +18,10 @@ formatinterface = "HexenMapSetIO";
|
|||
defaultlumpname = "E1M1";
|
||||
|
||||
// Special linedefs
|
||||
soundlinedefflags = 64; // See linedefflags
|
||||
singlesidedflags = 1; // See linedefflags
|
||||
doublesidedflags = 4; // See linedefflags
|
||||
impassableflags = 1;
|
||||
soundlinedefflag = 64; // See linedefflags
|
||||
singlesidedflag = 1; // See linedefflags
|
||||
doublesidedflag = 4; // See linedefflags
|
||||
impassableflag = 1;
|
||||
|
||||
// Generalized actions
|
||||
generalizedlinedefs = false;
|
||||
|
|
|
@ -18,10 +18,10 @@ formatinterface = "HexenMapSetIO";
|
|||
defaultlumpname = "MAP01";
|
||||
|
||||
// Special linedefs
|
||||
soundlinedefflags = 64; // See linedefflags
|
||||
singlesidedflags = 1; // See linedefflags
|
||||
doublesidedflags = 4; // See linedefflags
|
||||
impassableflags = 1;
|
||||
soundlinedefflag = 64; // See linedefflags
|
||||
singlesidedflag = 1; // See linedefflags
|
||||
doublesidedflag = 4; // See linedefflags
|
||||
impassableflag = 1;
|
||||
|
||||
// Generalized actions
|
||||
generalizedlinedefs = false;
|
||||
|
|
|
@ -18,10 +18,10 @@ formatinterface = "HexenMapSetIO";
|
|||
defaultlumpname = "MAP01";
|
||||
|
||||
// Special linedefs
|
||||
soundlinedefflags = 64; // See linedefflags
|
||||
singlesidedflags = 1; // See linedefflags
|
||||
doublesidedflags = 4; // See linedefflags
|
||||
impassableflags = 1;
|
||||
soundlinedefflag = 64; // See linedefflags
|
||||
singlesidedflag = 1; // See linedefflags
|
||||
doublesidedflag = 4; // See linedefflags
|
||||
impassableflag = 1;
|
||||
|
||||
// Generalized actions
|
||||
generalizedlinedefs = false;
|
||||
|
|
|
@ -18,10 +18,10 @@ formatinterface = "DoomMapSetIO";
|
|||
defaultlumpname = "MAP01";
|
||||
|
||||
// Special linedefs
|
||||
soundlinedefflags = 64; // See linedefflags
|
||||
singlesidedflags = 1; // See linedefflags
|
||||
doublesidedflags = 4; // See linedefflags
|
||||
impassableflags = 1;
|
||||
soundlinedefflag = 64; // See linedefflags
|
||||
singlesidedflag = 1; // See linedefflags
|
||||
doublesidedflag = 4; // See linedefflags
|
||||
impassableflag = 1;
|
||||
|
||||
// Generalized actions
|
||||
generalizedlinedefs = false;
|
||||
|
|
|
@ -1,7 +1,3 @@
|
|||
- Make "Make Sector" mode
|
||||
- On mousemove (?) already show the sector outline it will create
|
||||
- On click make the sector
|
||||
|
||||
- Show action associations when highlighting line/sector/thing
|
||||
|
||||
- Make sector gradient features
|
||||
|
|
BIN
Resources/Icons/NewSector.png
Normal file
BIN
Resources/Icons/NewSector.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 381 B |
BIN
Resources/Icons/NewSector2.png
Normal file
BIN
Resources/Icons/NewSector2.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 345 B |
|
@ -39,6 +39,7 @@
|
|||
<Compile Include="ClassicModes\DragSectorsMode.cs" />
|
||||
<Compile Include="ClassicModes\DragGeometryMode.cs" />
|
||||
<Compile Include="ClassicModes\DrawGeometryMode.cs" />
|
||||
<Compile Include="ClassicModes\MakeSectorMode.cs" />
|
||||
<Compile Include="General\BuilderPlug.cs" />
|
||||
<Compile Include="Interface\CurveLinedefsForm.cs">
|
||||
<SubType>Form</SubType>
|
||||
|
@ -119,6 +120,9 @@
|
|||
<ItemGroup>
|
||||
<EmbeddedResource Include="Resources\BrightnessMode.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="Resources\NewSector2.png" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
|
|
|
@ -38,10 +38,11 @@ using CodeImp.DoomBuilder.Data;
|
|||
|
||||
namespace CodeImp.DoomBuilder.BuilderModes
|
||||
{
|
||||
[EditMode(SwitchAction = "brightnessmode",
|
||||
[EditMode(DisplayName = "Sector Brightness",
|
||||
SwitchAction = "brightnessmode",
|
||||
ButtonDesc = "Brightness Mode",
|
||||
ButtonImage = "BrightnessMode.png",
|
||||
ButtonOrder = int.MinValue + 3)]
|
||||
ButtonOrder = int.MinValue + 201)]
|
||||
|
||||
public class BrightnessMode : SectorsMode
|
||||
{
|
||||
|
@ -89,7 +90,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
p.AddLayer(new PresentLayer(RendererLayer.Background, BlendingMode.Mask));
|
||||
p.AddLayer(new PresentLayer(RendererLayer.Grid, BlendingMode.Mask));
|
||||
p.AddLayer(new PresentLayer(RendererLayer.Overlay, BlendingMode.Alpha, 1f, true));
|
||||
p.AddLayer(new PresentLayer(RendererLayer.Things, BlendingMode.Alpha, 0.3f, false));
|
||||
p.AddLayer(new PresentLayer(RendererLayer.Things, BlendingMode.Alpha, Presentation.THINGS_BACK_ALPHA, false));
|
||||
p.AddLayer(new PresentLayer(RendererLayer.Geometry, BlendingMode.Alpha, 1f, true));
|
||||
renderer.SetPresentation(p);
|
||||
}
|
||||
|
|
|
@ -36,7 +36,8 @@ using CodeImp.DoomBuilder.Editing;
|
|||
|
||||
namespace CodeImp.DoomBuilder.BuilderModes
|
||||
{
|
||||
[EditMode(Volatile = true)]
|
||||
[EditMode(DisplayName = "Curve Linedefs",
|
||||
Volatile = true)]
|
||||
public sealed class CurveLinedefsMode : ClassicMode
|
||||
{
|
||||
#region ================== Constants
|
||||
|
|
|
@ -42,7 +42,8 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
// In that case, just specifying the attribute like this is enough:
|
||||
// [EditMode]
|
||||
|
||||
[EditMode(Volatile = true)]
|
||||
[EditMode(DisplayName = "Linedefs",
|
||||
Volatile = true)]
|
||||
|
||||
public sealed class DragLinedefsMode : DragGeometryMode
|
||||
{
|
||||
|
|
|
@ -42,7 +42,8 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
// In that case, just specifying the attribute like this is enough:
|
||||
// [EditMode]
|
||||
|
||||
[EditMode(Volatile = true)]
|
||||
[EditMode(DisplayName = "Sectors",
|
||||
Volatile = true)]
|
||||
|
||||
public sealed class DragSectorsMode : DragGeometryMode
|
||||
{
|
||||
|
|
|
@ -42,7 +42,8 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
// In that case, just specifying the attribute like this is enough:
|
||||
// [EditMode]
|
||||
|
||||
[EditMode(Volatile = true)]
|
||||
[EditMode(DisplayName = "Things",
|
||||
Volatile = true)]
|
||||
|
||||
public sealed class DragThingsMode : ClassicMode
|
||||
{
|
||||
|
|
|
@ -42,7 +42,8 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
// In that case, just specifying the attribute like this is enough:
|
||||
// [EditMode]
|
||||
|
||||
[EditMode(Volatile = true)]
|
||||
[EditMode(DisplayName = "Vertices",
|
||||
Volatile = true)]
|
||||
|
||||
public sealed class DragVerticesMode : DragGeometryMode
|
||||
{
|
||||
|
|
|
@ -37,7 +37,9 @@ using CodeImp.DoomBuilder.Actions;
|
|||
|
||||
namespace CodeImp.DoomBuilder.BuilderModes
|
||||
{
|
||||
[EditMode(SwitchAction = "drawlinesmode", Volatile = true)]
|
||||
[EditMode(DisplayName = "Drawing",
|
||||
SwitchAction = "drawlinesmode",
|
||||
Volatile = true)]
|
||||
|
||||
public class DrawGeometryMode : ClassicMode
|
||||
{
|
||||
|
@ -538,6 +540,8 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
MapSet.FlipBackwardLinedefs(newlines);
|
||||
|
||||
// Remove all unneeded textures
|
||||
// Shouldn't this already be done by the
|
||||
// makesector/joinsector functions?
|
||||
foreach(Linedef ld in newlines)
|
||||
{
|
||||
if(ld.Front != null) ld.Front.RemoveUnneededTextures(true);
|
||||
|
|
|
@ -36,10 +36,11 @@ using CodeImp.DoomBuilder.Actions;
|
|||
|
||||
namespace CodeImp.DoomBuilder.BuilderModes
|
||||
{
|
||||
[EditMode(SwitchAction = "linedefsmode", // Action name used to switch to this mode
|
||||
[EditMode(DisplayName = "Linedefs",
|
||||
SwitchAction = "linedefsmode", // Action name used to switch to this mode
|
||||
ButtonDesc = "Linedefs Mode", // Description on the button in toolbar/menu
|
||||
ButtonImage = "LinesMode.png", // Image resource name for the button
|
||||
ButtonOrder = int.MinValue + 1)] // Position of the button (lower is more to the left)
|
||||
ButtonOrder = int.MinValue + 100)] // Position of the button (lower is more to the left)
|
||||
|
||||
public class LinedefsMode : ClassicMode
|
||||
{
|
||||
|
|
424
Source/BuilderModes/ClassicModes/MakeSectorMode.cs
Normal file
424
Source/BuilderModes/ClassicModes/MakeSectorMode.cs
Normal file
|
@ -0,0 +1,424 @@
|
|||
|
||||
#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;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
using CodeImp.DoomBuilder.Windows;
|
||||
using CodeImp.DoomBuilder.IO;
|
||||
using CodeImp.DoomBuilder.Map;
|
||||
using CodeImp.DoomBuilder.Rendering;
|
||||
using CodeImp.DoomBuilder.Geometry;
|
||||
using CodeImp.DoomBuilder.Editing;
|
||||
using System.Drawing;
|
||||
using CodeImp.DoomBuilder.Actions;
|
||||
|
||||
#endregion
|
||||
|
||||
namespace CodeImp.DoomBuilder.BuilderModes
|
||||
{
|
||||
[EditMode(DisplayName = "Make Sectors",
|
||||
SwitchAction = "makesectormode",
|
||||
ButtonDesc = "Make Sectors Mode", // Description on the button in toolbar/menu
|
||||
ButtonImage = "NewSector2.png", // Image resource name for the button
|
||||
ButtonOrder = int.MinValue + 202)] // Position of the button (lower is more to the left)
|
||||
|
||||
public class MakeSectorMode : ClassicMode
|
||||
{
|
||||
#region ================== Constants
|
||||
|
||||
private const double FLASH_DURATION = 500.0f;
|
||||
|
||||
#endregion
|
||||
|
||||
#region ================== Variables
|
||||
|
||||
// Nearest sidedef
|
||||
private LinedefSide editside;
|
||||
private LinedefSide nearestside;
|
||||
private List<LinedefSide> allsides;
|
||||
private List<Linedef> alllines;
|
||||
|
||||
// Flash polygon
|
||||
private FlatVertex[] flashpolygon;
|
||||
private float flashintensity;
|
||||
private double flashstarttime;
|
||||
|
||||
// Interface
|
||||
protected bool selectpressed;
|
||||
protected bool editpressed;
|
||||
|
||||
#endregion
|
||||
|
||||
#region ================== Properties
|
||||
|
||||
#endregion
|
||||
|
||||
#region ================== Constructor / Disposer
|
||||
|
||||
// Constructor
|
||||
public MakeSectorMode()
|
||||
{
|
||||
}
|
||||
|
||||
// Disposer
|
||||
public override void Dispose()
|
||||
{
|
||||
// Not already disposed?
|
||||
if(!isdisposed)
|
||||
{
|
||||
// Clean up
|
||||
nearestside = null;
|
||||
allsides = null;
|
||||
|
||||
// Dispose base
|
||||
base.Dispose();
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ================== Methods
|
||||
|
||||
// Cancel mode
|
||||
public override void OnCancel()
|
||||
{
|
||||
base.OnCancel();
|
||||
|
||||
// Return to base mode
|
||||
General.Map.ChangeMode(new SectorsMode());
|
||||
}
|
||||
|
||||
// Mode engages
|
||||
public override void OnEngage()
|
||||
{
|
||||
base.OnEngage();
|
||||
|
||||
// Make customized presentation
|
||||
CustomPresentation p = new CustomPresentation();
|
||||
p.AddLayer(new PresentLayer(RendererLayer.Background, BlendingMode.Mask));
|
||||
p.AddLayer(new PresentLayer(RendererLayer.Grid, BlendingMode.Mask));
|
||||
p.AddLayer(new PresentLayer(RendererLayer.Overlay, BlendingMode.Alpha, 1f, true));
|
||||
p.AddLayer(new PresentLayer(RendererLayer.Things, BlendingMode.Alpha, Presentation.THINGS_BACK_ALPHA, false));
|
||||
p.AddLayer(new PresentLayer(RendererLayer.Geometry, BlendingMode.Alpha, 1f, true));
|
||||
renderer.SetPresentation(p);
|
||||
}
|
||||
|
||||
// Mode disengages
|
||||
public override void OnDisengage()
|
||||
{
|
||||
base.OnDisengage();
|
||||
|
||||
// Check which mode we are switching to
|
||||
if(General.Map.NewMode is VerticesMode)
|
||||
{
|
||||
// Convert selection to vertices
|
||||
|
||||
// Clear selected sectors
|
||||
General.Map.Map.ClearSelectedSectors();
|
||||
}
|
||||
else if(General.Map.NewMode is LinedefsMode)
|
||||
{
|
||||
// Convert selection to linedefs
|
||||
|
||||
// Clear selected sectors
|
||||
General.Map.Map.ClearSelectedSectors();
|
||||
}
|
||||
|
||||
// Hide highlight info
|
||||
General.Interface.HideInfo();
|
||||
|
||||
// Stop processing
|
||||
General.Interface.SetProcessorState(false);
|
||||
}
|
||||
|
||||
// This redraws the display
|
||||
public override void OnRedrawDisplay()
|
||||
{
|
||||
// Render lines and vertices
|
||||
DrawGeometry();
|
||||
|
||||
// Render things
|
||||
if(renderer.StartThings(true))
|
||||
{
|
||||
renderer.RenderThingSet(General.Map.ThingsFilter.HiddenThings, Presentation.THINGS_HIDDEN_ALPHA);
|
||||
renderer.RenderThingSet(General.Map.ThingsFilter.VisibleThings, 1.0f);
|
||||
renderer.Finish();
|
||||
}
|
||||
|
||||
// Render overlay
|
||||
DrawOverlay();
|
||||
renderer.Present();
|
||||
}
|
||||
|
||||
// This draws the geometry
|
||||
private void DrawGeometry()
|
||||
{
|
||||
// Render lines and vertices
|
||||
if(renderer.StartPlotter(true))
|
||||
{
|
||||
renderer.PlotLinedefSet(General.Map.Map.Linedefs);
|
||||
|
||||
// Render highlight
|
||||
if(alllines != null)
|
||||
{
|
||||
foreach(Linedef l in alllines) renderer.PlotLinedef(l, General.Colors.Highlight);
|
||||
}
|
||||
|
||||
renderer.PlotVerticesSet(General.Map.Map.Vertices);
|
||||
renderer.Finish();
|
||||
}
|
||||
}
|
||||
|
||||
// This draws the overlay
|
||||
private void DrawOverlay()
|
||||
{
|
||||
// Redraw overlay
|
||||
if(renderer.StartOverlay(true))
|
||||
{
|
||||
if((flashpolygon != null) && (flashintensity > 0.0f))
|
||||
{
|
||||
renderer.RenderGeometry(flashpolygon, null, true);
|
||||
}
|
||||
|
||||
renderer.Finish();
|
||||
}
|
||||
}
|
||||
|
||||
// This highlights a new region
|
||||
protected void Highlight(bool buttonspressed)
|
||||
{
|
||||
LinedefSide newnearest;
|
||||
|
||||
// Mouse inside?
|
||||
if(mouseinside)
|
||||
{
|
||||
// Highlighting from a new sidedef?
|
||||
Linedef nl = General.Map.Map.NearestLinedef(mousemappos);
|
||||
float side = nl.SideOfLine(mousemappos);
|
||||
newnearest = new LinedefSide(nl, (side <= 0.0f));
|
||||
if(newnearest != nearestside)
|
||||
{
|
||||
// Only change when buttons are not pressed
|
||||
if(!buttonspressed || (editside == newnearest))
|
||||
{
|
||||
// Find new sector
|
||||
General.Interface.SetCursor(Cursors.AppStarting);
|
||||
nearestside = newnearest;
|
||||
allsides = SectorTools.FindPotentialSectorAt(mousemappos);
|
||||
if(allsides != null)
|
||||
{
|
||||
alllines = new List<Linedef>(allsides.Count);
|
||||
foreach(LinedefSide sd in allsides) alllines.Add(sd.Line);
|
||||
}
|
||||
else
|
||||
{
|
||||
alllines = null;
|
||||
}
|
||||
General.Interface.SetCursor(Cursors.Default);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Don't highlight this one
|
||||
nearestside = null;
|
||||
allsides = null;
|
||||
alllines = null;
|
||||
}
|
||||
|
||||
// Redraw overlay
|
||||
DrawGeometry();
|
||||
renderer.Present();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// No valid region
|
||||
nearestside = null;
|
||||
allsides = null;
|
||||
alllines = null;
|
||||
|
||||
// Redraw overlay
|
||||
DrawGeometry();
|
||||
renderer.Present();
|
||||
}
|
||||
}
|
||||
|
||||
// Start select
|
||||
protected override void OnSelect()
|
||||
{
|
||||
// Select pressed in this mode
|
||||
selectpressed = true;
|
||||
editside = nearestside;
|
||||
base.OnEdit();
|
||||
}
|
||||
|
||||
// Done selecting
|
||||
protected override void OnEndSelect()
|
||||
{
|
||||
// Select was pressed in this mode?
|
||||
if(selectpressed && (editside == nearestside) && (nearestside != null))
|
||||
{
|
||||
// Possible to make a sector?
|
||||
if(allsides != null)
|
||||
{
|
||||
// Make the sector
|
||||
General.Interface.SetCursor(Cursors.WaitCursor);
|
||||
General.Settings.FindDefaultDrawSettings();
|
||||
General.Map.UndoRedo.CreateUndo("Make Sector", UndoGroup.None, 0);
|
||||
Sector s = SectorTools.MakeSector(allsides);
|
||||
General.Interface.SetCursor(Cursors.Default);
|
||||
|
||||
// Quickly flash this sector to indicate it was created
|
||||
General.Map.IsChanged = true;
|
||||
General.Map.Map.Update();
|
||||
flashpolygon = new FlatVertex[s.Vertices.Length];
|
||||
s.Vertices.CopyTo(flashpolygon, 0);
|
||||
flashintensity = 1.0f;
|
||||
flashstarttime = (double)General.Clock.GetCurrentTime();
|
||||
General.Interface.SetProcessorState(true);
|
||||
|
||||
// Redraw overlay
|
||||
DrawGeometry();
|
||||
DrawOverlay();
|
||||
renderer.Present();
|
||||
}
|
||||
}
|
||||
|
||||
selectpressed = false;
|
||||
base.OnEndSelect();
|
||||
}
|
||||
|
||||
// Start editing
|
||||
protected override void OnEdit()
|
||||
{
|
||||
// Edit pressed in this mode
|
||||
editpressed = true;
|
||||
editside = nearestside;
|
||||
base.OnEdit();
|
||||
}
|
||||
|
||||
// Done editing
|
||||
protected override void OnEndEdit()
|
||||
{
|
||||
// Edit was pressed in this mode?
|
||||
if(editpressed && (editside == nearestside) && (nearestside != null))
|
||||
{
|
||||
// Possible to make a sector?
|
||||
if(allsides != null)
|
||||
{
|
||||
// Make the sector
|
||||
General.Interface.SetCursor(Cursors.WaitCursor);
|
||||
General.Settings.FindDefaultDrawSettings();
|
||||
General.Map.UndoRedo.CreateUndo("Make Sector", UndoGroup.None, 0);
|
||||
Sector s = SectorTools.MakeSector(allsides);
|
||||
General.Interface.SetCursor(Cursors.Default);
|
||||
|
||||
// Edit the sector
|
||||
List<Sector> secs = new List<Sector>(); secs.Add(s);
|
||||
if(General.Interface.ShowEditSectors(secs) == DialogResult.OK)
|
||||
{
|
||||
// Quickly flash this sector to indicate it was created
|
||||
General.Map.IsChanged = true;
|
||||
General.Map.Map.Update();
|
||||
flashpolygon = new FlatVertex[s.Vertices.Length];
|
||||
s.Vertices.CopyTo(flashpolygon, 0);
|
||||
flashintensity = 1.0f;
|
||||
flashstarttime = (double)General.Clock.GetCurrentTime();
|
||||
General.Interface.SetProcessorState(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Undo
|
||||
General.Map.UndoRedo.PerformUndo();
|
||||
General.Map.UndoRedo.ClearAllRedos();
|
||||
}
|
||||
|
||||
// Redraw overlay
|
||||
DrawGeometry();
|
||||
DrawOverlay();
|
||||
renderer.Present();
|
||||
}
|
||||
}
|
||||
|
||||
editpressed = false;
|
||||
base.OnEndEdit();
|
||||
}
|
||||
|
||||
// Mouse moves
|
||||
public override void OnMouseMove(MouseEventArgs e)
|
||||
{
|
||||
base.OnMouseMove(e);
|
||||
|
||||
// Highlight the region
|
||||
Highlight((e.Button != MouseButtons.None));
|
||||
}
|
||||
|
||||
// Mouse leaves
|
||||
public override void OnMouseLeave(EventArgs e)
|
||||
{
|
||||
base.OnMouseLeave(e);
|
||||
|
||||
// Highlight nothing
|
||||
Highlight(false);
|
||||
}
|
||||
|
||||
// Processing
|
||||
public override void OnProcess()
|
||||
{
|
||||
base.OnProcess();
|
||||
|
||||
// Process flash
|
||||
if(flashpolygon != null)
|
||||
{
|
||||
// Determine the intensity of the flash by time elapsed
|
||||
double curtime = (double)General.Clock.GetCurrentTime();;
|
||||
flashintensity = 1f - (float)((curtime - flashstarttime) / FLASH_DURATION);
|
||||
if(flashintensity > 0.0f)
|
||||
{
|
||||
// Update vertices in polygon
|
||||
PixelColor pc = new PixelColor((byte)(flashintensity * 255.0f), 255, 255, 255);
|
||||
int intcolor = pc.ToInt();
|
||||
for(int i = 0; i < flashpolygon.Length; i++) flashpolygon[i].c = intcolor;
|
||||
}
|
||||
else
|
||||
{
|
||||
// End of flash, trash the polygon
|
||||
flashpolygon = null;
|
||||
flashintensity = 0.0f;
|
||||
General.Interface.SetProcessorState(false);
|
||||
}
|
||||
|
||||
// Redraw overlay
|
||||
DrawOverlay();
|
||||
renderer.Present();
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ================== Actions
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
|
@ -37,10 +37,11 @@ using CodeImp.DoomBuilder.Actions;
|
|||
|
||||
namespace CodeImp.DoomBuilder.BuilderModes
|
||||
{
|
||||
[EditMode(SwitchAction = "sectorsmode", // Action name used to switch to this mode
|
||||
[EditMode(DisplayName = "Sectors",
|
||||
SwitchAction = "sectorsmode", // Action name used to switch to this mode
|
||||
ButtonDesc = "Sectors Mode", // Description on the button in toolbar/menu
|
||||
ButtonImage = "SectorsMode.png", // Image resource name for the button
|
||||
ButtonOrder = int.MinValue + 2)] // Position of the button (lower is more to the left)
|
||||
ButtonOrder = int.MinValue + 200)] // Position of the button (lower is more to the left)
|
||||
|
||||
public class SectorsMode : ClassicMode
|
||||
{
|
||||
|
|
|
@ -36,10 +36,11 @@ using CodeImp.DoomBuilder.Actions;
|
|||
|
||||
namespace CodeImp.DoomBuilder.BuilderModes
|
||||
{
|
||||
[EditMode(SwitchAction = "thingsmode", // Action name used to switch to this mode
|
||||
[EditMode(DisplayName = "Things",
|
||||
SwitchAction = "thingsmode", // Action name used to switch to this mode
|
||||
ButtonDesc = "Things Mode", // Description on the button in toolbar/menu
|
||||
ButtonImage = "ThingsMode.png", // Image resource name for the button
|
||||
ButtonOrder = int.MinValue + 3)] // Position of the button (lower is more to the left)
|
||||
ButtonOrder = int.MinValue + 300)] // Position of the button (lower is more to the left)
|
||||
|
||||
public class ThingsMode : ClassicMode
|
||||
{
|
||||
|
|
|
@ -36,7 +36,8 @@ using CodeImp.DoomBuilder.Actions;
|
|||
|
||||
namespace CodeImp.DoomBuilder.BuilderModes
|
||||
{
|
||||
[EditMode(SwitchAction = "verticesmode", // Action name used to switch to this mode
|
||||
[EditMode(DisplayName = "Vertices",
|
||||
SwitchAction = "verticesmode", // Action name used to switch to this mode
|
||||
ButtonDesc = "Vertices Mode", // Description on the button in toolbar/menu
|
||||
ButtonImage = "VerticesMode.png", // Image resource name for the button
|
||||
ButtonOrder = int.MinValue + 0)] // Position of the button (lower is more to the left)
|
||||
|
|
|
@ -181,3 +181,13 @@ mergesectors
|
|||
allowmouse = true;
|
||||
allowscroll = true;
|
||||
}
|
||||
|
||||
makesectormode
|
||||
{
|
||||
title = "Edit: Make Sector Mode";
|
||||
description = "Switches to the Make Sector editing mode. This mode allows creating and fixing and/or splitten sectors by clicking within a closed region.";
|
||||
allowkeys = true;
|
||||
allowmouse = true;
|
||||
allowscroll = true;
|
||||
}
|
||||
|
||||
|
|
BIN
Source/BuilderModes/Resources/NewSector2.png
Normal file
BIN
Source/BuilderModes/Resources/NewSector2.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 345 B |
|
@ -43,6 +43,7 @@ namespace CodeImp.DoomBuilder.Editing
|
|||
private int buttonorder;
|
||||
private bool configspecific;
|
||||
private bool isvolatile;
|
||||
private string displayname;
|
||||
|
||||
#endregion
|
||||
|
||||
|
@ -86,6 +87,11 @@ namespace CodeImp.DoomBuilder.Editing
|
|||
/// </summary>
|
||||
public bool Volatile { get { return isvolatile; } set { isvolatile = value; } }
|
||||
|
||||
/// <summary>
|
||||
/// Name to display on the button information bar when no specific element information is displayed.
|
||||
/// </summary>
|
||||
public string DisplayName { get { return displayname; } set { displayname = value; } }
|
||||
|
||||
#endregion
|
||||
|
||||
#region ================== Constructor / Disposer
|
||||
|
|
|
@ -142,6 +142,13 @@ namespace CodeImp.DoomBuilder.Editing
|
|||
|
||||
#region ================== Public Methods
|
||||
|
||||
// This clears all redos
|
||||
public void ClearAllRedos()
|
||||
{
|
||||
ClearRedos();
|
||||
General.MainWindow.UpdateInterface();
|
||||
}
|
||||
|
||||
// This makes an undo and returns the unique ticket id
|
||||
public int CreateUndo(string description, UndoGroup group, int grouptag)
|
||||
{
|
||||
|
@ -205,7 +212,7 @@ namespace CodeImp.DoomBuilder.Editing
|
|||
|
||||
// This performs an undo
|
||||
[BeginAction("undo")]
|
||||
internal void PerformUndo()
|
||||
public void PerformUndo()
|
||||
{
|
||||
UndoSnapshot u, r;
|
||||
Cursor oldcursor = Cursor.Current;
|
||||
|
|
|
@ -682,6 +682,7 @@ namespace CodeImp.DoomBuilder
|
|||
// All done
|
||||
mainwindow.RedrawDisplay();
|
||||
mainwindow.UpdateInterface();
|
||||
mainwindow.HideInfo();
|
||||
mainwindow.DisplayReady();
|
||||
Cursor.Current = Cursors.Default;
|
||||
}
|
||||
|
@ -714,6 +715,7 @@ namespace CodeImp.DoomBuilder
|
|||
// Done
|
||||
Cursor.Current = Cursors.Default;
|
||||
mainwindow.RedrawDisplay();
|
||||
mainwindow.HideInfo();
|
||||
mainwindow.UpdateInterface();
|
||||
mainwindow.DisplayReady();
|
||||
General.WriteLogLine("Map unload done");
|
||||
|
@ -798,6 +800,7 @@ namespace CodeImp.DoomBuilder
|
|||
// All done
|
||||
mainwindow.RedrawDisplay();
|
||||
mainwindow.UpdateInterface();
|
||||
mainwindow.HideInfo();
|
||||
mainwindow.DisplayReady();
|
||||
Cursor.Current = Cursors.Default;
|
||||
}
|
||||
|
|
|
@ -895,10 +895,17 @@ namespace CodeImp.DoomBuilder
|
|||
mode = newmode;
|
||||
|
||||
// Check appropriate button on interface
|
||||
// And show the mode name
|
||||
if(newmode != null)
|
||||
{
|
||||
General.MainWindow.CheckEditModeButton(newmode.EditModeButtonName);
|
||||
General.MainWindow.DisplayModeName(newmode.Attributes.DisplayName);
|
||||
}
|
||||
else
|
||||
{
|
||||
General.MainWindow.CheckEditModeButton("");
|
||||
General.MainWindow.DisplayModeName("");
|
||||
}
|
||||
|
||||
// Engage new mode
|
||||
if(newmode != null) newmode.OnEngage();
|
||||
|
|
|
@ -75,6 +75,16 @@ namespace CodeImp.DoomBuilder.Geometry
|
|||
this.front = front;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This makes a copy of the linedef side.
|
||||
/// </summary>
|
||||
public LinedefSide(LinedefSide original)
|
||||
{
|
||||
// Initialize
|
||||
this.line = original.line;
|
||||
this.front = original.front;
|
||||
}
|
||||
|
||||
// Destructor
|
||||
~LinedefSide()
|
||||
{
|
||||
|
@ -84,6 +94,24 @@ namespace CodeImp.DoomBuilder.Geometry
|
|||
|
||||
#region ================== Methods
|
||||
|
||||
// This compares a linedef side
|
||||
public static bool operator ==(LinedefSide a, LinedefSide b)
|
||||
{
|
||||
if((object.Equals(a, null)) && (object.Equals(b, null))) return true;
|
||||
if((!object.Equals(a, null)) && (object.Equals(b, null))) return false;
|
||||
if((object.Equals(a, null)) && (!object.Equals(b, null))) return false;
|
||||
return (a.line == b.line) && (a.front == b.front);
|
||||
}
|
||||
|
||||
// This compares a linedef side
|
||||
public static bool operator !=(LinedefSide a, LinedefSide b)
|
||||
{
|
||||
if((object.Equals(a, null)) && (object.Equals(b, null))) return false;
|
||||
if((!object.Equals(a, null)) && (object.Equals(b, null))) return true;
|
||||
if((object.Equals(a, null)) && (!object.Equals(b, null))) return true;
|
||||
return (a.line != b.line) || (a.front != b.front);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,6 +26,7 @@ using CodeImp.DoomBuilder.Rendering;
|
|||
using SlimDX.Direct3D9;
|
||||
using System.Drawing;
|
||||
using CodeImp.DoomBuilder.Map;
|
||||
using CodeImp.DoomBuilder.IO;
|
||||
|
||||
#endregion
|
||||
|
||||
|
@ -37,6 +38,17 @@ namespace CodeImp.DoomBuilder.Geometry
|
|||
/// </summary>
|
||||
public static class SectorTools
|
||||
{
|
||||
#region ================== Structures
|
||||
|
||||
private struct SidedefSettings
|
||||
{
|
||||
public string newtexhigh;
|
||||
public string newtexmid;
|
||||
public string newtexlow;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ================== Constants
|
||||
|
||||
#endregion
|
||||
|
@ -369,9 +381,11 @@ namespace CodeImp.DoomBuilder.Geometry
|
|||
// This makes the sector from the given lines and sides
|
||||
public static Sector MakeSector(List<LinedefSide> alllines)
|
||||
{
|
||||
Sidedef source = null;
|
||||
Sector newsector = General.Map.Map.CreateSector();
|
||||
|
||||
Sector sourcesector = null;
|
||||
SidedefSettings sourceside = new SidedefSettings();
|
||||
bool removeuselessmiddle;
|
||||
|
||||
// Check if any of the sides already has a sidedef
|
||||
// Then we use information from that sidedef to make the others
|
||||
foreach(LinedefSide ls in alllines)
|
||||
|
@ -380,8 +394,9 @@ namespace CodeImp.DoomBuilder.Geometry
|
|||
{
|
||||
if(ls.Line.Front != null)
|
||||
{
|
||||
source = ls.Line.Front;
|
||||
source.Sector.CopyPropertiesTo(newsector);
|
||||
// Copy sidedef information if not already found
|
||||
if(sourcesector == null) sourcesector = ls.Line.Front.Sector;
|
||||
TakeSidedefSettings(ref sourceside, ls.Line.Front);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -389,62 +404,81 @@ namespace CodeImp.DoomBuilder.Geometry
|
|||
{
|
||||
if(ls.Line.Back != null)
|
||||
{
|
||||
source = ls.Line.Back;
|
||||
source.Sector.CopyPropertiesTo(newsector);
|
||||
// Copy sidedef information if not already found
|
||||
if(sourcesector == null) sourcesector = ls.Line.Back.Sector;
|
||||
TakeSidedefSettings(ref sourceside, ls.Line.Back);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// If we couldn't find anything, try the other sides
|
||||
if(source == null)
|
||||
// Now do the same for the other sides
|
||||
// Note how information is only copied when not already found
|
||||
// so this won't override information from the sides searched above
|
||||
foreach(LinedefSide ls in alllines)
|
||||
{
|
||||
foreach(LinedefSide ls in alllines)
|
||||
if(ls.Front)
|
||||
{
|
||||
if(ls.Front)
|
||||
if(ls.Line.Back != null)
|
||||
{
|
||||
if(ls.Line.Back != null)
|
||||
{
|
||||
source = ls.Line.Back;
|
||||
source.Sector.CopyPropertiesTo(newsector);
|
||||
break;
|
||||
}
|
||||
// Copy sidedef information if not already found
|
||||
if(sourcesector == null) sourcesector = ls.Line.Back.Sector;
|
||||
TakeSidedefSettings(ref sourceside, ls.Line.Back);
|
||||
break;
|
||||
}
|
||||
else
|
||||
}
|
||||
else
|
||||
{
|
||||
if(ls.Line.Front != null)
|
||||
{
|
||||
if(ls.Line.Front != null)
|
||||
{
|
||||
source = ls.Line.Front;
|
||||
source.Sector.CopyPropertiesTo(newsector);
|
||||
break;
|
||||
}
|
||||
// Copy sidedef information if not already found
|
||||
if(sourcesector == null) sourcesector = ls.Line.Front.Sector;
|
||||
TakeSidedefSettings(ref sourceside, ls.Line.Front);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Still nothing found?
|
||||
// Then apply default sector properties
|
||||
if(source == null) ApplyDefaultsToSector(newsector);
|
||||
|
||||
// Use defaults where no settings could be found
|
||||
TakeSidedefDefaults(ref sourceside);
|
||||
|
||||
// Found a source sector?
|
||||
if(sourcesector != null)
|
||||
{
|
||||
// Copy properties from source to new sector
|
||||
sourcesector.CopyPropertiesTo(newsector);
|
||||
}
|
||||
else
|
||||
{
|
||||
// No source sector, apply default sector properties
|
||||
ApplyDefaultsToSector(newsector);
|
||||
}
|
||||
|
||||
// Go for all sides to make sidedefs
|
||||
foreach(LinedefSide ls in alllines)
|
||||
{
|
||||
// We may only remove a useless middle texture when
|
||||
// the line was previously singlesided
|
||||
removeuselessmiddle = (ls.Line.Back == null) || (ls.Line.Front == null);
|
||||
|
||||
if(ls.Front)
|
||||
{
|
||||
// Create sidedef is needed and ensure it points to the new sector
|
||||
if(ls.Line.Front == null) General.Map.Map.CreateSidedef(ls.Line, true, newsector);
|
||||
if(ls.Line.Front.Sector != newsector) ls.Line.Front.ChangeSector(newsector);
|
||||
if(source != null) source.CopyPropertiesTo(ls.Line.Front); else ApplyDefaultsToSidedef(ls.Line.Front);
|
||||
ApplyDefaultsToSidedef(ls.Line.Front, sourceside);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Create sidedef is needed and ensure it points to the new sector
|
||||
if(ls.Line.Back == null) General.Map.Map.CreateSidedef(ls.Line, false, newsector);
|
||||
if(ls.Line.Back.Sector != newsector) ls.Line.Back.ChangeSector(newsector);
|
||||
if(source != null) source.CopyPropertiesTo(ls.Line.Back); else ApplyDefaultsToSidedef(ls.Line.Back);
|
||||
ApplyDefaultsToSidedef(ls.Line.Back, sourceside);
|
||||
}
|
||||
|
||||
// Update line
|
||||
if(ls.Line.Front != null) ls.Line.Front.RemoveUnneededTextures(removeuselessmiddle);
|
||||
if(ls.Line.Back != null) ls.Line.Back.RemoveUnneededTextures(removeuselessmiddle);
|
||||
ls.Line.ApplySidedFlags();
|
||||
}
|
||||
|
||||
|
@ -456,6 +490,14 @@ namespace CodeImp.DoomBuilder.Geometry
|
|||
// This joins a sector with the given lines and sides
|
||||
public static Sector JoinSector(List<LinedefSide> alllines, Sidedef original)
|
||||
{
|
||||
SidedefSettings sourceside = new SidedefSettings();
|
||||
|
||||
// Take settings fro mthe original side
|
||||
TakeSidedefSettings(ref sourceside, original);
|
||||
|
||||
// Use defaults where no settings could be found
|
||||
TakeSidedefDefaults(ref sourceside);
|
||||
|
||||
// Go for all sides to make sidedefs
|
||||
foreach(LinedefSide ls in alllines)
|
||||
{
|
||||
|
@ -465,10 +507,8 @@ namespace CodeImp.DoomBuilder.Geometry
|
|||
if(ls.Line.Front == null)
|
||||
{
|
||||
General.Map.Map.CreateSidedef(ls.Line, true, original.Sector);
|
||||
ls.Line.ApplySidedFlags();
|
||||
ApplyDefaultsToSidedef(ls.Line.Front, sourceside);
|
||||
}
|
||||
original.CopyPropertiesTo(ls.Line.Front);
|
||||
ApplyDefaultsToSidedef(ls.Line.Front);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -476,10 +516,8 @@ namespace CodeImp.DoomBuilder.Geometry
|
|||
if(ls.Line.Back == null)
|
||||
{
|
||||
General.Map.Map.CreateSidedef(ls.Line, false, original.Sector);
|
||||
ls.Line.ApplySidedFlags();
|
||||
ApplyDefaultsToSidedef(ls.Line.Back, sourceside);
|
||||
}
|
||||
original.CopyPropertiesTo(ls.Line.Back);
|
||||
ApplyDefaultsToSidedef(ls.Line.Back);
|
||||
}
|
||||
|
||||
// Update line
|
||||
|
@ -490,12 +528,32 @@ namespace CodeImp.DoomBuilder.Geometry
|
|||
return original.Sector;
|
||||
}
|
||||
|
||||
// This applies defaults to a sidedef
|
||||
private static void ApplyDefaultsToSidedef(Sidedef sd)
|
||||
// This takes default settings if not taken yet
|
||||
private static void TakeSidedefDefaults(ref SidedefSettings settings)
|
||||
{
|
||||
if(sd.HighRequired() && sd.HighTexture.StartsWith("-")) sd.SetTextureHigh(General.Settings.DefaultTexture);
|
||||
if(sd.MiddleRequired() && sd.MiddleTexture.StartsWith("-")) sd.SetTextureMid(General.Settings.DefaultTexture);
|
||||
if(sd.LowRequired() && sd.LowTexture.StartsWith("-")) sd.SetTextureLow(General.Settings.DefaultTexture);
|
||||
// Use defaults where no settings could be found
|
||||
if(settings.newtexhigh == null) settings.newtexhigh = General.Settings.DefaultTexture;
|
||||
if(settings.newtexmid == null) settings.newtexmid = General.Settings.DefaultTexture;
|
||||
if(settings.newtexlow == null) settings.newtexlow = General.Settings.DefaultTexture;
|
||||
}
|
||||
|
||||
// This takes sidedef settings if not taken yet
|
||||
private static void TakeSidedefSettings(ref SidedefSettings settings, Sidedef side)
|
||||
{
|
||||
if((side.LongHighTexture != General.Map.Map.EmptyLongName) && (settings.newtexhigh == null))
|
||||
settings.newtexhigh = side.HighTexture;
|
||||
if((side.LongMiddleTexture != General.Map.Map.EmptyLongName) && (settings.newtexmid == null))
|
||||
settings.newtexmid = side.MiddleTexture;
|
||||
if((side.LongLowTexture != General.Map.Map.EmptyLongName) && (settings.newtexlow == null))
|
||||
settings.newtexlow = side.LowTexture;
|
||||
}
|
||||
|
||||
// This applies defaults to a sidedef
|
||||
private static void ApplyDefaultsToSidedef(Sidedef sd, SidedefSettings defaults)
|
||||
{
|
||||
if(sd.HighRequired() && sd.HighTexture.StartsWith("-")) sd.SetTextureHigh(defaults.newtexhigh);
|
||||
if(sd.MiddleRequired() && sd.MiddleTexture.StartsWith("-")) sd.SetTextureMid(defaults.newtexmid);
|
||||
if(sd.LowRequired() && sd.LowTexture.StartsWith("-")) sd.SetTextureLow(defaults.newtexlow);
|
||||
}
|
||||
|
||||
// This applies defaults to a sector
|
||||
|
|
|
@ -115,6 +115,7 @@ namespace CodeImp.DoomBuilder.Map
|
|||
this.ceiltexname = "-";
|
||||
this.longfloortexname = map.EmptyLongName;
|
||||
this.longceiltexname = map.EmptyLongName;
|
||||
this.triangulationneeded = true;
|
||||
|
||||
// We have no destructor
|
||||
GC.SuppressFinalize(this);
|
||||
|
|
|
@ -53,9 +53,9 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
void DisplayReady();
|
||||
void DisplayStatus(string status);
|
||||
void RedrawDisplay();
|
||||
void ShowEditLinedefs(ICollection<Linedef> lines);
|
||||
void ShowEditSectors(ICollection<Sector> sectors);
|
||||
void ShowEditThings(ICollection<Thing> things);
|
||||
DialogResult ShowEditLinedefs(ICollection<Linedef> lines);
|
||||
DialogResult ShowEditSectors(ICollection<Sector> sectors);
|
||||
DialogResult ShowEditThings(ICollection<Thing> things);
|
||||
void ShowLinedefInfo(Linedef l);
|
||||
void ShowSectorInfo(Sector s);
|
||||
void ShowThingInfo(Thing t);
|
||||
|
|
32
Source/Windows/MainForm.Designer.cs
generated
32
Source/Windows/MainForm.Designer.cs
generated
|
@ -115,6 +115,7 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
this.xposlabel = new System.Windows.Forms.ToolStripStatusLabel();
|
||||
this.yposlabel = new System.Windows.Forms.ToolStripStatusLabel();
|
||||
this.panelinfo = new System.Windows.Forms.Panel();
|
||||
this.modename = new System.Windows.Forms.Label();
|
||||
this.vertexinfo = new CodeImp.DoomBuilder.Controls.VertexInfoPanel();
|
||||
this.thinginfo = new CodeImp.DoomBuilder.Controls.ThingInfoPanel();
|
||||
this.sectorinfo = new CodeImp.DoomBuilder.Controls.SectorInfoPanel();
|
||||
|
@ -238,7 +239,7 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
this.menuhelp});
|
||||
this.menumain.Location = new System.Drawing.Point(0, 0);
|
||||
this.menumain.Name = "menumain";
|
||||
this.menumain.Size = new System.Drawing.Size(803, 24);
|
||||
this.menumain.Size = new System.Drawing.Size(823, 24);
|
||||
this.menumain.TabIndex = 0;
|
||||
//
|
||||
// menufile
|
||||
|
@ -513,7 +514,7 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
this.toolStripSeparator6});
|
||||
this.toolbar.Location = new System.Drawing.Point(0, 24);
|
||||
this.toolbar.Name = "toolbar";
|
||||
this.toolbar.Size = new System.Drawing.Size(803, 25);
|
||||
this.toolbar.Size = new System.Drawing.Size(823, 25);
|
||||
this.toolbar.TabIndex = 1;
|
||||
//
|
||||
// buttonnewmap
|
||||
|
@ -680,7 +681,7 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
this.statusbar.Location = new System.Drawing.Point(0, 522);
|
||||
this.statusbar.Name = "statusbar";
|
||||
this.statusbar.ShowItemToolTips = true;
|
||||
this.statusbar.Size = new System.Drawing.Size(803, 23);
|
||||
this.statusbar.Size = new System.Drawing.Size(823, 23);
|
||||
this.statusbar.TabIndex = 2;
|
||||
//
|
||||
// statuslabel
|
||||
|
@ -689,7 +690,7 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
this.statuslabel.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
|
||||
this.statuslabel.ImageScaling = System.Windows.Forms.ToolStripItemImageScaling.None;
|
||||
this.statuslabel.Name = "statuslabel";
|
||||
this.statuslabel.Size = new System.Drawing.Size(477, 18);
|
||||
this.statuslabel.Size = new System.Drawing.Size(497, 18);
|
||||
this.statuslabel.Spring = true;
|
||||
this.statuslabel.Text = "Initializing user interface...";
|
||||
this.statuslabel.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
|
||||
|
@ -909,6 +910,7 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
//
|
||||
// panelinfo
|
||||
//
|
||||
this.panelinfo.Controls.Add(this.modename);
|
||||
this.panelinfo.Controls.Add(this.vertexinfo);
|
||||
this.panelinfo.Controls.Add(this.thinginfo);
|
||||
this.panelinfo.Controls.Add(this.sectorinfo);
|
||||
|
@ -916,9 +918,23 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
this.panelinfo.Dock = System.Windows.Forms.DockStyle.Bottom;
|
||||
this.panelinfo.Location = new System.Drawing.Point(0, 416);
|
||||
this.panelinfo.Name = "panelinfo";
|
||||
this.panelinfo.Size = new System.Drawing.Size(803, 106);
|
||||
this.panelinfo.Size = new System.Drawing.Size(823, 106);
|
||||
this.panelinfo.TabIndex = 4;
|
||||
//
|
||||
// modename
|
||||
//
|
||||
this.modename.AutoSize = true;
|
||||
this.modename.Font = new System.Drawing.Font("Verdana", 36F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.modename.ForeColor = System.Drawing.SystemColors.GrayText;
|
||||
this.modename.Location = new System.Drawing.Point(12, 20);
|
||||
this.modename.Name = "modename";
|
||||
this.modename.Size = new System.Drawing.Size(244, 59);
|
||||
this.modename.TabIndex = 4;
|
||||
this.modename.Text = "Vertices";
|
||||
this.modename.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
|
||||
this.modename.UseMnemonic = false;
|
||||
this.modename.Visible = false;
|
||||
//
|
||||
// vertexinfo
|
||||
//
|
||||
this.vertexinfo.Font = new System.Drawing.Font("Arial", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
|
@ -977,7 +993,7 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
this.display.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.display.Location = new System.Drawing.Point(0, 49);
|
||||
this.display.Name = "display";
|
||||
this.display.Size = new System.Drawing.Size(803, 367);
|
||||
this.display.Size = new System.Drawing.Size(823, 367);
|
||||
this.display.TabIndex = 5;
|
||||
this.display.MouseLeave += new System.EventHandler(this.display_MouseLeave);
|
||||
this.display.Paint += new System.Windows.Forms.PaintEventHandler(this.display_Paint);
|
||||
|
@ -997,7 +1013,7 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
// MainForm
|
||||
//
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
|
||||
this.ClientSize = new System.Drawing.Size(803, 545);
|
||||
this.ClientSize = new System.Drawing.Size(823, 545);
|
||||
this.Controls.Add(this.display);
|
||||
this.Controls.Add(this.panelinfo);
|
||||
this.Controls.Add(this.statusbar);
|
||||
|
@ -1026,6 +1042,7 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
this.statusbar.ResumeLayout(false);
|
||||
this.statusbar.PerformLayout();
|
||||
this.panelinfo.ResumeLayout(false);
|
||||
this.panelinfo.PerformLayout();
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
|
@ -1112,5 +1129,6 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
private System.Windows.Forms.ToolStripMenuItem itemgridinc;
|
||||
private System.Windows.Forms.ToolStripMenuItem itemgriddec;
|
||||
private System.Windows.Forms.ToolStripMenuItem itemgridsetup;
|
||||
private System.Windows.Forms.Label modename;
|
||||
}
|
||||
}
|
|
@ -1486,6 +1486,13 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
|
||||
#region ================== Info Panels
|
||||
|
||||
// This displays the current mode name
|
||||
internal void DisplayModeName(string name)
|
||||
{
|
||||
modename.Text = name;
|
||||
modename.Refresh();
|
||||
}
|
||||
|
||||
// This hides all info panels
|
||||
public void HideInfo()
|
||||
{
|
||||
|
@ -1494,52 +1501,82 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
if(vertexinfo.Visible) vertexinfo.Hide();
|
||||
if(sectorinfo.Visible) sectorinfo.Hide();
|
||||
if(thinginfo.Visible) thinginfo.Hide();
|
||||
modename.Visible = (General.Map != null);
|
||||
modename.Refresh();
|
||||
}
|
||||
|
||||
// Show linedef info
|
||||
public void ShowLinedefInfo(Linedef l) { linedefinfo.ShowInfo(l); }
|
||||
public void ShowLinedefInfo(Linedef l)
|
||||
{
|
||||
modename.Visible = false;
|
||||
linedefinfo.ShowInfo(l);
|
||||
}
|
||||
|
||||
// Show vertex info
|
||||
public void ShowVertexInfo(Vertex v) { vertexinfo.ShowInfo(v); }
|
||||
public void ShowVertexInfo(Vertex v)
|
||||
{
|
||||
modename.Visible = false;
|
||||
vertexinfo.ShowInfo(v);
|
||||
}
|
||||
|
||||
// Show sector info
|
||||
public void ShowSectorInfo(Sector s) { sectorinfo.ShowInfo(s); }
|
||||
public void ShowSectorInfo(Sector s)
|
||||
{
|
||||
modename.Visible = false;
|
||||
sectorinfo.ShowInfo(s);
|
||||
}
|
||||
|
||||
// Show thing info
|
||||
public void ShowThingInfo(Thing t) { thinginfo.ShowInfo(t); }
|
||||
public void ShowThingInfo(Thing t)
|
||||
{
|
||||
modename.Visible = false;
|
||||
thinginfo.ShowInfo(t);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ================== Dialogs
|
||||
|
||||
// This shows the dialog to edit lines
|
||||
public void ShowEditLinedefs(ICollection<Linedef> lines)
|
||||
public DialogResult ShowEditLinedefs(ICollection<Linedef> lines)
|
||||
{
|
||||
DialogResult result;
|
||||
|
||||
// Show line edit dialog
|
||||
LinedefEditForm f = new LinedefEditForm();
|
||||
f.Setup(lines);
|
||||
f.ShowDialog(this);
|
||||
result = f.ShowDialog(this);
|
||||
f.Dispose();
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
// This shows the dialog to edit sectors
|
||||
public void ShowEditSectors(ICollection<Sector> sectors)
|
||||
public DialogResult ShowEditSectors(ICollection<Sector> sectors)
|
||||
{
|
||||
DialogResult result;
|
||||
|
||||
// Show sector edit dialog
|
||||
SectorEditForm f = new SectorEditForm();
|
||||
f.Setup(sectors);
|
||||
f.ShowDialog(this);
|
||||
result = f.ShowDialog(this);
|
||||
f.Dispose();
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
// This shows the dialog to edit things
|
||||
public void ShowEditThings(ICollection<Thing> things)
|
||||
public DialogResult ShowEditThings(ICollection<Thing> things)
|
||||
{
|
||||
DialogResult result;
|
||||
|
||||
// Show thing edit dialog
|
||||
ThingEditForm f = new ThingEditForm();
|
||||
f.Setup(things);
|
||||
f.ShowDialog(this);
|
||||
result = f.ShowDialog(this);
|
||||
f.Dispose();
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
|
|
@ -177,6 +177,9 @@
|
|||
<metadata name="panelinfo.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="modename.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="vertexinfo.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
|
|
Loading…
Reference in a new issue