mirror of
https://git.do.srb2.org/STJr/UltimateZoneBuilder.git
synced 2025-02-20 10:53:19 +00:00
- Added selection order numbering display to Sectors mode
- Added floor/ceiling raise/lower by 8 mp actions to Sectors mode @ Added simple CRC32 calculator class (using Crc32 from sharpziplib)
This commit is contained in:
parent
77731b03ca
commit
e67c71d992
16 changed files with 675 additions and 842 deletions
BIN
Resources/Icons/ViewSelectionIndex.png
Normal file
BIN
Resources/Icons/ViewSelectionIndex.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 429 B |
|
@ -672,6 +672,7 @@
|
|||
<Compile Include="Data\HighResImage.cs" />
|
||||
<Compile Include="Data\PK3FileImage.cs" />
|
||||
<Compile Include="Data\PK3StructuredReader.cs" />
|
||||
<Compile Include="General\CRC.cs" />
|
||||
<Compile Include="General\ErrorItem.cs" />
|
||||
<Compile Include="General\ErrorLogger.cs" />
|
||||
<Compile Include="Windows\ErrorsForm.cs">
|
||||
|
|
|
@ -45,7 +45,6 @@
|
|||
<ItemGroup>
|
||||
<Compile Include="ClassicModes\BaseClassicMode.cs" />
|
||||
<Compile Include="ClassicModes\BrightnessMode.cs" />
|
||||
<Compile Include="ClassicModes\HeightsMode.cs" />
|
||||
<Compile Include="ClassicModes\ErrorCheckMode.cs" />
|
||||
<Compile Include="ClassicModes\EditSelectionMode.cs" />
|
||||
<Compile Include="ClassicModes\CurveLinedefsMode.cs" />
|
||||
|
@ -247,6 +246,15 @@
|
|||
<Compile Include="FindReplace\FindThingType.cs" />
|
||||
<Compile Include="FindReplace\FindVertexNumber.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="Resources\ViewSelectionIndex.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="Resources\FloorsGradient.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="Resources\CeilsGradient.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.
|
||||
|
|
|
@ -87,7 +87,9 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
#endregion
|
||||
|
||||
#region ================== Properties
|
||||
|
||||
|
||||
public ICollection<Sector> OrderedSelection { get { return orderedselection; } }
|
||||
|
||||
#endregion
|
||||
|
||||
#region ================== Constructor / Disposer
|
||||
|
@ -118,6 +120,12 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
|
||||
#region ================== Methods
|
||||
|
||||
// This sets the ordered selection
|
||||
public void SetOrderedSelection(ICollection<Sector> list)
|
||||
{
|
||||
orderedselection = new List<Sector>(list);
|
||||
}
|
||||
|
||||
// This sets up new labels
|
||||
private void SetupLabels()
|
||||
{
|
||||
|
@ -172,19 +180,22 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
renderer.RenderGeometry(verts, null, true);
|
||||
}
|
||||
}
|
||||
|
||||
// Go for all sectors
|
||||
foreach(Sector s in General.Map.Map.Sectors)
|
||||
|
||||
if(BuilderPlug.Me.ViewSelectionNumbers)
|
||||
{
|
||||
// Render labels
|
||||
TextLabel[] labelarray = labels[s];
|
||||
for(int i = 0; i < s.Labels.Count; i++)
|
||||
// Go for all sectors
|
||||
foreach(Sector s in orderedselection)
|
||||
{
|
||||
TextLabel l = labelarray[i];
|
||||
|
||||
// Render only when enough space for the label to see
|
||||
float requiredsize = (l.TextSize.Height / 2) / renderer.Scale;
|
||||
if(requiredsize < s.Labels[i].radius) renderer.RenderText(l);
|
||||
// Render labels
|
||||
TextLabel[] labelarray = labels[s];
|
||||
for(int i = 0; i < s.Labels.Count; i++)
|
||||
{
|
||||
TextLabel l = labelarray[i];
|
||||
|
||||
// Render only when enough space for the label to see
|
||||
float requiredsize = (l.TextSize.Height / 2) / renderer.Scale;
|
||||
if(requiredsize < s.Labels[i].radius) renderer.RenderText(l);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -349,7 +360,9 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
{
|
||||
base.OnEngage();
|
||||
|
||||
// Add toolbar button
|
||||
// Add toolbar buttons
|
||||
General.Interface.AddButton(BuilderPlug.Me.MenusForm.ViewSelectionNumbers);
|
||||
General.Interface.AddButton(BuilderPlug.Me.MenusForm.SeparatorSectors1);
|
||||
General.Interface.AddButton(BuilderPlug.Me.MenusForm.MakeGradientBrightness);
|
||||
|
||||
// Make custom presentation
|
||||
|
@ -388,13 +401,17 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
foreach(Sidedef sd in s.Sidedefs) sd.Line.Selected = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Fill the list with selected sectors (these are not in order, but we have no other choice)
|
||||
ICollection<Sector> selectedsectors = General.Map.Map.GetSelectedSectors(true);
|
||||
General.Map.Map.ClearSelectedSectors();
|
||||
foreach(Sector s in selectedsectors) SelectSector(s, true, false);
|
||||
if(orderedselection.Count < selectedsectors.Count)
|
||||
{
|
||||
General.Map.Map.ClearSelectedSectors();
|
||||
foreach(Sector s in selectedsectors) SelectSector(s, true, false);
|
||||
}
|
||||
|
||||
// Update
|
||||
UpdateSelectedLabels();
|
||||
UpdateOverlay();
|
||||
}
|
||||
|
||||
|
@ -403,7 +420,9 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
{
|
||||
base.OnDisengage();
|
||||
|
||||
// Remove toolbar button
|
||||
// Remove toolbar buttons
|
||||
General.Interface.RemoveButton(BuilderPlug.Me.MenusForm.ViewSelectionNumbers);
|
||||
General.Interface.RemoveButton(BuilderPlug.Me.MenusForm.SeparatorSectors1);
|
||||
General.Interface.RemoveButton(BuilderPlug.Me.MenusForm.MakeGradientBrightness);
|
||||
|
||||
// Going to EditSelectionMode?
|
||||
|
@ -416,6 +435,12 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
SelectSector(highlighted, true, false);
|
||||
}
|
||||
}
|
||||
// Going to SectorsMode?
|
||||
else if(General.Editing.NewMode is SectorsMode)
|
||||
{
|
||||
// Pass on the ordered selection
|
||||
(General.Editing.NewMode as SectorsMode).SetOrderedSelection(orderedselection);
|
||||
}
|
||||
|
||||
// Hide highlight info
|
||||
General.Interface.HideInfo();
|
||||
|
|
|
@ -1,809 +0,0 @@
|
|||
|
||||
#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;
|
||||
using CodeImp.DoomBuilder.Data;
|
||||
|
||||
#endregion
|
||||
|
||||
namespace CodeImp.DoomBuilder.BuilderModes
|
||||
{
|
||||
[EditMode(DisplayName = "Heights Mode",
|
||||
SwitchAction = "heightsmode",
|
||||
ButtonImage = "HeightsMode.png",
|
||||
ButtonOrder = int.MinValue + 202,
|
||||
ButtonGroup = "000_editing",
|
||||
AllowCopyPaste = false,
|
||||
UseByDefault = true)]
|
||||
|
||||
public sealed class HeightsMode : BaseClassicMode
|
||||
{
|
||||
#region ================== Enums
|
||||
|
||||
private enum ModifyMode : int
|
||||
{
|
||||
None,
|
||||
AdjustingFloors,
|
||||
AdjustingCeilings,
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ================== Constants
|
||||
|
||||
#endregion
|
||||
|
||||
#region ================== Variables
|
||||
|
||||
// Highlighted item
|
||||
private Sector highlighted;
|
||||
|
||||
// Interface
|
||||
private bool editpressed;
|
||||
|
||||
// The methods GetSelected* and MarkSelected* on the MapSet do not
|
||||
// retain the order in which items were selected.
|
||||
// This list keeps in order while sectors are selected/deselected.
|
||||
protected List<Sector> orderedselection;
|
||||
|
||||
// Labels
|
||||
private Dictionary<Sector, TextLabel[]> labels;
|
||||
|
||||
// Modifying
|
||||
private ModifyMode mode;
|
||||
private Point editstartpos;
|
||||
private List<int> sectorheights;
|
||||
private int undoticket;
|
||||
|
||||
#endregion
|
||||
|
||||
#region ================== Properties
|
||||
|
||||
#endregion
|
||||
|
||||
#region ================== Constructor / Disposer
|
||||
|
||||
// Constructor
|
||||
public HeightsMode()
|
||||
{
|
||||
// Make ordered selection list
|
||||
orderedselection = new List<Sector>();
|
||||
}
|
||||
|
||||
// Disposer
|
||||
public override void Dispose()
|
||||
{
|
||||
// Not already disposed?
|
||||
if(!isdisposed)
|
||||
{
|
||||
// Dispose old labels
|
||||
foreach(KeyValuePair<Sector, TextLabel[]> lbl in labels)
|
||||
foreach(TextLabel l in lbl.Value) l.Dispose();
|
||||
|
||||
// Dispose base
|
||||
base.Dispose();
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ================== Methods
|
||||
|
||||
// This sets up new labels
|
||||
private void SetupLabels()
|
||||
{
|
||||
if(labels != null)
|
||||
{
|
||||
// Dispose old labels
|
||||
foreach(KeyValuePair<Sector, TextLabel[]> lbl in labels)
|
||||
foreach(TextLabel l in lbl.Value) l.Dispose();
|
||||
}
|
||||
|
||||
// Make text labels for sectors
|
||||
labels = new Dictionary<Sector, TextLabel[]>(General.Map.Map.Sectors.Count);
|
||||
foreach(Sector s in General.Map.Map.Sectors)
|
||||
{
|
||||
// Setup labels
|
||||
TextLabel[] labelarray = new TextLabel[s.Triangles.IslandVertices.Count];
|
||||
for(int i = 0; i < s.Triangles.IslandVertices.Count; i++)
|
||||
{
|
||||
Vector2D v = s.Labels[i].position;
|
||||
labelarray[i] = new TextLabel(20);
|
||||
labelarray[i].TransformCoords = true;
|
||||
labelarray[i].Rectangle = new RectangleF(v.x, v.y, 0.0f, 0.0f);
|
||||
labelarray[i].AlignX = TextAlignmentX.Center;
|
||||
labelarray[i].AlignY = TextAlignmentY.Middle;
|
||||
labelarray[i].Scale = 14f;
|
||||
labelarray[i].Color = General.Colors.Highlight.WithAlpha(255);
|
||||
labelarray[i].Backcolor = General.Colors.Background.WithAlpha(255);
|
||||
}
|
||||
labels.Add(s, labelarray);
|
||||
}
|
||||
}
|
||||
|
||||
// This updates the overlay
|
||||
private void UpdateOverlay()
|
||||
{
|
||||
if(renderer.StartOverlay(true))
|
||||
{
|
||||
// Go for all sectors
|
||||
foreach(Sector s in General.Map.Map.Sectors)
|
||||
{
|
||||
// Render labels
|
||||
TextLabel[] labelarray = labels[s];
|
||||
for(int i = 0; i < s.Labels.Count; i++)
|
||||
{
|
||||
TextLabel l = labelarray[i];
|
||||
|
||||
// Render only when enough space for the label to see
|
||||
float requiredsize = (l.TextSize.Height / 2) / renderer.Scale;
|
||||
if(requiredsize < s.Labels[i].radius) renderer.RenderText(l);
|
||||
}
|
||||
}
|
||||
|
||||
renderer.Finish();
|
||||
}
|
||||
}
|
||||
|
||||
// This highlights a new item
|
||||
protected void Highlight(Sector s)
|
||||
{
|
||||
// Highlight actually changes?
|
||||
if(s != highlighted)
|
||||
{
|
||||
// Update display
|
||||
if(renderer.StartPlotter(false))
|
||||
{
|
||||
if((highlighted != null) && !highlighted.IsDisposed)
|
||||
{
|
||||
// Undraw previous highlight
|
||||
renderer.PlotSector(highlighted);
|
||||
|
||||
// Change label color
|
||||
TextLabel[] labelarray = labels[highlighted];
|
||||
foreach(TextLabel l in labelarray) l.Color = General.Colors.Selection;
|
||||
}
|
||||
|
||||
// Set new highlight
|
||||
highlighted = s;
|
||||
|
||||
if((highlighted != null) && !highlighted.IsDisposed)
|
||||
{
|
||||
// Render highlighted item
|
||||
renderer.PlotSector(highlighted, General.Colors.Highlight);
|
||||
|
||||
// Change label color
|
||||
TextLabel[] labelarray = labels[highlighted];
|
||||
foreach(TextLabel l in labelarray) l.Color = General.Colors.Highlight;
|
||||
}
|
||||
|
||||
renderer.Finish();
|
||||
}
|
||||
|
||||
UpdateOverlay();
|
||||
renderer.Present();
|
||||
}
|
||||
|
||||
// Show highlight info
|
||||
if((highlighted != null) && !highlighted.IsDisposed)
|
||||
General.Interface.ShowSectorInfo(highlighted);
|
||||
else
|
||||
General.Interface.HideInfo();
|
||||
}
|
||||
|
||||
// This selectes or deselects a sector
|
||||
protected void SelectSector(Sector s, bool selectstate, bool update)
|
||||
{
|
||||
bool selectionchanged = false;
|
||||
|
||||
if(!s.IsDisposed)
|
||||
{
|
||||
// Select the sector?
|
||||
if(selectstate && !s.Selected)
|
||||
{
|
||||
orderedselection.Add(s);
|
||||
s.Selected = true;
|
||||
selectionchanged = true;
|
||||
|
||||
// Setup labels
|
||||
TextLabel[] labelarray = labels[s];
|
||||
foreach(TextLabel l in labelarray)
|
||||
{
|
||||
l.Text = orderedselection.Count.ToString();
|
||||
l.Color = General.Colors.Selection;
|
||||
}
|
||||
}
|
||||
// Deselect the sector?
|
||||
else if(!selectstate && s.Selected)
|
||||
{
|
||||
orderedselection.Remove(s);
|
||||
s.Selected = false;
|
||||
selectionchanged = true;
|
||||
|
||||
// Clear labels
|
||||
TextLabel[] labelarray = labels[s];
|
||||
foreach(TextLabel l in labelarray) l.Text = "";
|
||||
|
||||
// Update all other labels
|
||||
UpdateSelectedLabels();
|
||||
}
|
||||
|
||||
// Selection changed?
|
||||
if(selectionchanged)
|
||||
{
|
||||
// Make update lines selection
|
||||
foreach(Sidedef sd in s.Sidedefs)
|
||||
{
|
||||
bool front, back;
|
||||
if(sd.Line.Front != null) front = sd.Line.Front.Sector.Selected; else front = false;
|
||||
if(sd.Line.Back != null) back = sd.Line.Back.Sector.Selected; else back = false;
|
||||
sd.Line.Selected = front | back;
|
||||
}
|
||||
}
|
||||
|
||||
if(update)
|
||||
{
|
||||
UpdateOverlay();
|
||||
renderer.Present();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Remove from list
|
||||
orderedselection.Remove(s);
|
||||
}
|
||||
}
|
||||
|
||||
// This updates labels from the selected sectors
|
||||
private void UpdateSelectedLabels()
|
||||
{
|
||||
// Update labels for editing mode?
|
||||
if(mode == ModifyMode.AdjustingFloors)
|
||||
{
|
||||
// Go for all labels in all selected sectors
|
||||
for(int i = 0; i < orderedselection.Count; i++)
|
||||
{
|
||||
Sector s = orderedselection[i];
|
||||
TextLabel[] labelarray = labels[s];
|
||||
foreach(TextLabel l in labelarray)
|
||||
{
|
||||
// Make sure the text and color are right
|
||||
l.Text = s.FloorHeight.ToString();
|
||||
l.Color = General.Colors.Indication;
|
||||
}
|
||||
}
|
||||
}
|
||||
// Update labels for editing mode?
|
||||
else if(mode == ModifyMode.AdjustingCeilings)
|
||||
{
|
||||
// Go for all labels in all selected sectors
|
||||
for(int i = 0; i < orderedselection.Count; i++)
|
||||
{
|
||||
Sector s = orderedselection[i];
|
||||
TextLabel[] labelarray = labels[s];
|
||||
foreach(TextLabel l in labelarray)
|
||||
{
|
||||
// Make sure the text and color are right
|
||||
l.Text = s.CeilHeight.ToString();
|
||||
l.Color = General.Colors.Indication;
|
||||
}
|
||||
}
|
||||
}
|
||||
// Updating for normal mode
|
||||
else
|
||||
{
|
||||
// Go for all labels in all selected sectors
|
||||
for(int i = 0; i < orderedselection.Count; i++)
|
||||
{
|
||||
Sector s = orderedselection[i];
|
||||
TextLabel[] labelarray = labels[s];
|
||||
foreach(TextLabel l in labelarray)
|
||||
{
|
||||
// Make sure the text and color are right
|
||||
int labelnum = i + 1;
|
||||
l.Text = labelnum.ToString();
|
||||
l.Color = General.Colors.Selection;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ================== Events
|
||||
|
||||
// Mode engages
|
||||
public override void OnEngage()
|
||||
{
|
||||
base.OnEngage();
|
||||
|
||||
// Add toolbar button
|
||||
General.Interface.AddButton(BuilderPlug.Me.MenusForm.MakeGradientBrightness);
|
||||
|
||||
// Make custom presentation
|
||||
CustomPresentation p = new CustomPresentation();
|
||||
p.AddLayer(new PresentLayer(RendererLayer.Background, BlendingMode.Mask, General.Settings.BackgroundAlpha));
|
||||
p.AddLayer(new PresentLayer(RendererLayer.Grid, BlendingMode.Mask));
|
||||
p.AddLayer(new PresentLayer(RendererLayer.Surface, 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);
|
||||
|
||||
// Make text labels for sectors
|
||||
SetupLabels();
|
||||
|
||||
// Convert geometry selection to sectors only
|
||||
General.Map.Map.ClearAllMarks(false);
|
||||
General.Map.Map.MarkSelectedVertices(true, true);
|
||||
ICollection<Linedef> lines = General.Map.Map.LinedefsFromMarkedVertices(false, true, false);
|
||||
foreach(Linedef l in lines) l.Selected = true;
|
||||
General.Map.Map.ClearMarkedSectors(true);
|
||||
foreach(Linedef l in General.Map.Map.Linedefs)
|
||||
{
|
||||
if(!l.Selected)
|
||||
{
|
||||
if(l.Front != null) l.Front.Sector.Marked = false;
|
||||
if(l.Back != null) l.Back.Sector.Marked = false;
|
||||
}
|
||||
}
|
||||
General.Map.Map.ClearAllSelected();
|
||||
foreach(Sector s in General.Map.Map.Sectors)
|
||||
{
|
||||
if(s.Marked)
|
||||
{
|
||||
s.Selected = true;
|
||||
foreach(Sidedef sd in s.Sidedefs) sd.Line.Selected = true;
|
||||
}
|
||||
}
|
||||
|
||||
// Fill the list with selected sectors (these are not in order, but we have no other choice)
|
||||
ICollection<Sector> selectedsectors = General.Map.Map.GetSelectedSectors(true);
|
||||
General.Map.Map.ClearSelectedSectors();
|
||||
foreach(Sector s in selectedsectors) SelectSector(s, true, false);
|
||||
|
||||
// Update
|
||||
UpdateOverlay();
|
||||
}
|
||||
|
||||
// When disengaged
|
||||
public override void OnDisengage()
|
||||
{
|
||||
base.OnDisengage();
|
||||
|
||||
// Remove toolbar button
|
||||
General.Interface.RemoveButton(BuilderPlug.Me.MenusForm.MakeGradientBrightness);
|
||||
|
||||
// Going to EditSelectionMode?
|
||||
if(General.Editing.NewMode is EditSelectionMode)
|
||||
{
|
||||
// No selection made? But we have a highlight!
|
||||
if((General.Map.Map.GetSelectedSectors(true).Count == 0) && (highlighted != null))
|
||||
{
|
||||
// Make the highlight the selection
|
||||
SelectSector(highlighted, true, false);
|
||||
}
|
||||
}
|
||||
|
||||
// Hide highlight info
|
||||
General.Interface.HideInfo();
|
||||
}
|
||||
|
||||
// This redraws the display
|
||||
public override void OnRedrawDisplay()
|
||||
{
|
||||
renderer.RedrawSurface();
|
||||
|
||||
// Render lines and vertices
|
||||
if(renderer.StartPlotter(true))
|
||||
{
|
||||
renderer.PlotLinedefSet(General.Map.Map.Linedefs);
|
||||
renderer.PlotVerticesSet(General.Map.Map.Vertices);
|
||||
if((highlighted != null) && !highlighted.IsDisposed)
|
||||
renderer.PlotSector(highlighted, General.Colors.Highlight);
|
||||
renderer.Finish();
|
||||
}
|
||||
|
||||
// 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
|
||||
UpdateOverlay();
|
||||
|
||||
renderer.Present();
|
||||
}
|
||||
|
||||
// Mouse moves
|
||||
public override void OnMouseMove(MouseEventArgs e)
|
||||
{
|
||||
base.OnMouseMove(e);
|
||||
|
||||
// Not in any editing mode?
|
||||
if((mode == ModifyMode.None) && (e.Button == MouseButtons.None))
|
||||
{
|
||||
// Find the nearest linedef within highlight range
|
||||
Linedef l = General.Map.Map.NearestLinedef(mousemappos);
|
||||
if(l != null)
|
||||
{
|
||||
// Check on which side of the linedef the mouse is
|
||||
float side = l.SideOfLine(mousemappos);
|
||||
if(side > 0)
|
||||
{
|
||||
// Is there a sidedef here?
|
||||
if(l.Back != null)
|
||||
{
|
||||
// Highlight if not the same
|
||||
if(l.Back.Sector != highlighted) Highlight(l.Back.Sector);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Highlight nothing
|
||||
if(highlighted != null) Highlight(null);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Is there a sidedef here?
|
||||
if(l.Front != null)
|
||||
{
|
||||
// Highlight if not the same
|
||||
if(l.Front.Sector != highlighted) Highlight(l.Front.Sector);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Highlight nothing
|
||||
if(highlighted != null) Highlight(null);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Highlight nothing
|
||||
if(highlighted != null) Highlight(null);
|
||||
}
|
||||
}
|
||||
// Adjusting mode?
|
||||
else if((mode == ModifyMode.AdjustingFloors) || (mode == ModifyMode.AdjustingCeilings))
|
||||
{
|
||||
// Calculate change in position
|
||||
Point delta = Cursor.Position - new Size(editstartpos);
|
||||
|
||||
if(!General.Interface.ShiftState)
|
||||
{
|
||||
delta.X = (delta.X / 8) * 8;
|
||||
delta.Y = (delta.Y / 8) * 8;
|
||||
}
|
||||
|
||||
if(mode == ModifyMode.AdjustingFloors)
|
||||
{
|
||||
// Adjust selected sector floors
|
||||
for(int i = 0; i < orderedselection.Count; i++)
|
||||
{
|
||||
Sector s = orderedselection[i];
|
||||
s.FloorHeight = sectorheights[i] - delta.Y;
|
||||
}
|
||||
}
|
||||
else if(mode == ModifyMode.AdjustingCeilings)
|
||||
{
|
||||
// Adjust selected sector ceilings
|
||||
for(int i = 0; i < orderedselection.Count; i++)
|
||||
{
|
||||
Sector s = orderedselection[i];
|
||||
s.CeilHeight = sectorheights[i] - delta.Y;
|
||||
}
|
||||
}
|
||||
|
||||
// Update
|
||||
UpdateSelectedLabels();
|
||||
UpdateOverlay();
|
||||
renderer.Present();
|
||||
}
|
||||
}
|
||||
|
||||
// Selecting with mouse
|
||||
protected override void OnSelectBegin()
|
||||
{
|
||||
// Not modifying?
|
||||
if(mode == ModifyMode.None)
|
||||
{
|
||||
// Item highlighted?
|
||||
if((highlighted != null) && !highlighted.IsDisposed)
|
||||
{
|
||||
// Flip selection
|
||||
SelectSector(highlighted, !highlighted.Selected, true);
|
||||
|
||||
// Update display
|
||||
if(renderer.StartPlotter(false))
|
||||
{
|
||||
// Redraw highlight to show selection
|
||||
renderer.PlotSector(highlighted);
|
||||
renderer.Finish();
|
||||
renderer.Present();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Start making a selection
|
||||
StartMultiSelection();
|
||||
}
|
||||
}
|
||||
|
||||
base.OnSelectBegin();
|
||||
}
|
||||
|
||||
// End selection
|
||||
protected override void OnSelectEnd()
|
||||
{
|
||||
// Not stopping from multiselection or modifying
|
||||
if(!selecting && (mode == ModifyMode.None))
|
||||
{
|
||||
// Item highlighted?
|
||||
if((highlighted != null) && !highlighted.IsDisposed)
|
||||
{
|
||||
// Update display
|
||||
if(renderer.StartPlotter(false))
|
||||
{
|
||||
// Render highlighted item
|
||||
renderer.PlotSector(highlighted, General.Colors.Highlight);
|
||||
renderer.Finish();
|
||||
}
|
||||
|
||||
// Update overlay
|
||||
TextLabel[] labelarray = labels[highlighted];
|
||||
foreach(TextLabel l in labelarray) l.Color = General.Colors.Highlight;
|
||||
UpdateOverlay();
|
||||
renderer.Present();
|
||||
}
|
||||
}
|
||||
|
||||
base.OnSelectEnd();
|
||||
}
|
||||
|
||||
// This is called wheh selection ends
|
||||
protected override void OnEndMultiSelection()
|
||||
{
|
||||
if(General.Interface.ShiftState ^ BuilderPlug.Me.AdditiveSelect)
|
||||
{
|
||||
// Go for all lines
|
||||
foreach(Linedef l in General.Map.Map.Linedefs)
|
||||
{
|
||||
l.Selected |= ((l.Start.Position.x >= selectionrect.Left) &&
|
||||
(l.Start.Position.y >= selectionrect.Top) &&
|
||||
(l.Start.Position.x <= selectionrect.Right) &&
|
||||
(l.Start.Position.y <= selectionrect.Bottom) &&
|
||||
(l.End.Position.x >= selectionrect.Left) &&
|
||||
(l.End.Position.y >= selectionrect.Top) &&
|
||||
(l.End.Position.x <= selectionrect.Right) &&
|
||||
(l.End.Position.y <= selectionrect.Bottom));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Go for all lines
|
||||
foreach(Linedef l in General.Map.Map.Linedefs)
|
||||
{
|
||||
l.Selected = ((l.Start.Position.x >= selectionrect.Left) &&
|
||||
(l.Start.Position.y >= selectionrect.Top) &&
|
||||
(l.Start.Position.x <= selectionrect.Right) &&
|
||||
(l.Start.Position.y <= selectionrect.Bottom) &&
|
||||
(l.End.Position.x >= selectionrect.Left) &&
|
||||
(l.End.Position.y >= selectionrect.Top) &&
|
||||
(l.End.Position.x <= selectionrect.Right) &&
|
||||
(l.End.Position.y <= selectionrect.Bottom));
|
||||
}
|
||||
}
|
||||
|
||||
// Go for all sectors
|
||||
foreach(Sector s in General.Map.Map.Sectors)
|
||||
{
|
||||
// Go for all sidedefs
|
||||
bool allselected = true;
|
||||
foreach(Sidedef sd in s.Sidedefs)
|
||||
{
|
||||
if(!sd.Line.Selected)
|
||||
{
|
||||
allselected = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Sector completely selected?
|
||||
SelectSector(s, allselected, false);
|
||||
}
|
||||
|
||||
// Make sure all linedefs reflect selected sectors
|
||||
foreach(Sidedef sd in General.Map.Map.Sidedefs)
|
||||
if(!sd.Sector.Selected && ((sd.Other == null) || !sd.Other.Sector.Selected))
|
||||
sd.Line.Selected = false;
|
||||
|
||||
base.OnEndMultiSelection();
|
||||
UpdateOverlay();
|
||||
General.Interface.RedrawDisplay();
|
||||
}
|
||||
|
||||
// This is called when the selection is updated
|
||||
protected override void OnUpdateMultiSelection()
|
||||
{
|
||||
base.OnUpdateMultiSelection();
|
||||
|
||||
// Render selection
|
||||
UpdateOverlay();
|
||||
if(renderer.StartOverlay(false))
|
||||
{
|
||||
RenderMultiSelection();
|
||||
renderer.Finish();
|
||||
renderer.Present();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Editing
|
||||
protected override void OnEditBegin()
|
||||
{
|
||||
base.OnEditBegin();
|
||||
|
||||
// No selection?
|
||||
if(orderedselection.Count == 0)
|
||||
{
|
||||
// Make the highlight a selection if we have a highlight
|
||||
if((highlighted != null) && !highlighted.IsDisposed)
|
||||
SelectSector(highlighted, true, false);
|
||||
}
|
||||
|
||||
// Anything selected?
|
||||
if(orderedselection.Count > 0)
|
||||
{
|
||||
// Create undo
|
||||
undoticket = General.Map.UndoRedo.CreateUndo("Adjust brightness");
|
||||
|
||||
// General stuff
|
||||
editstartpos = Cursor.Position;
|
||||
|
||||
// Floors or ceilings?
|
||||
if(General.Interface.CtrlState)
|
||||
{
|
||||
// Start editing
|
||||
mode = ModifyMode.AdjustingCeilings;
|
||||
|
||||
// Keep original heights
|
||||
sectorheights = new List<int>(orderedselection.Count);
|
||||
foreach(Sector s in orderedselection)
|
||||
{
|
||||
sectorheights.Add(s.CeilHeight);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Start editing
|
||||
mode = ModifyMode.AdjustingFloors;
|
||||
|
||||
// Keep original heights
|
||||
sectorheights = new List<int>(orderedselection.Count);
|
||||
foreach(Sector s in orderedselection)
|
||||
{
|
||||
sectorheights.Add(s.FloorHeight);
|
||||
}
|
||||
}
|
||||
|
||||
// Update
|
||||
UpdateSelectedLabels();
|
||||
UpdateOverlay();
|
||||
renderer.Present();
|
||||
}
|
||||
}
|
||||
|
||||
// Done editing
|
||||
protected override void OnEditEnd()
|
||||
{
|
||||
base.OnEditEnd();
|
||||
|
||||
// Stop editing
|
||||
mode = ModifyMode.None;
|
||||
sectorheights = null;
|
||||
|
||||
// Nothing changed? Then writhdraw the undo
|
||||
if(editstartpos.Y == Cursor.Position.Y)
|
||||
General.Map.UndoRedo.WithdrawUndo(undoticket);
|
||||
|
||||
// Update
|
||||
General.Map.Map.Update();
|
||||
UpdateSelectedLabels();
|
||||
General.Interface.RedrawDisplay();
|
||||
renderer.Present();
|
||||
|
||||
// If only one sector was selected, deselect it
|
||||
if(orderedselection.Count == 1) SelectSector(orderedselection[0], false, true);
|
||||
}
|
||||
|
||||
// When undo is used
|
||||
public override bool OnUndoBegin()
|
||||
{
|
||||
// Clear selection
|
||||
General.Map.Map.ClearAllSelected();
|
||||
orderedselection.Clear();
|
||||
|
||||
return base.OnUndoBegin();
|
||||
}
|
||||
|
||||
// When undo is performed
|
||||
public override void OnUndoEnd()
|
||||
{
|
||||
// Clear labels
|
||||
SetupLabels();
|
||||
}
|
||||
|
||||
// When redo is used
|
||||
public override bool OnRedoBegin()
|
||||
{
|
||||
// Clear selection
|
||||
General.Map.Map.ClearAllSelected();
|
||||
orderedselection.Clear();
|
||||
|
||||
return base.OnRedoBegin();
|
||||
}
|
||||
|
||||
// When redo is performed
|
||||
public override void OnRedoEnd()
|
||||
{
|
||||
// Clear labels
|
||||
SetupLabels();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ================== Actions
|
||||
|
||||
// This clears the selection
|
||||
[BeginAction("clearselection", BaseAction = true)]
|
||||
public void ClearSelection()
|
||||
{
|
||||
// Clear selection
|
||||
General.Map.Map.ClearAllSelected();
|
||||
orderedselection.Clear();
|
||||
|
||||
// Clear labels
|
||||
foreach(TextLabel[] labelarray in labels.Values)
|
||||
foreach(TextLabel l in labelarray) l.Text = "";
|
||||
|
||||
// Redraw
|
||||
General.Interface.RedrawDisplay();
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
|
@ -65,11 +65,16 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
// retain the order in which items were selected.
|
||||
// This list keeps in order while sectors are selected/deselected.
|
||||
protected List<Sector> orderedselection;
|
||||
|
||||
// Labels
|
||||
private Dictionary<Sector, TextLabel[]> labels;
|
||||
|
||||
#endregion
|
||||
|
||||
#region ================== Properties
|
||||
|
||||
public ICollection<Sector> OrderedSelection { get { return orderedselection; } }
|
||||
|
||||
#endregion
|
||||
|
||||
#region ================== Constructor / Disposer
|
||||
|
@ -87,6 +92,10 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
// Not already disposed?
|
||||
if(!isdisposed)
|
||||
{
|
||||
// Dispose old labels
|
||||
foreach(KeyValuePair<Sector, TextLabel[]> lbl in labels)
|
||||
foreach(TextLabel l in lbl.Value) l.Dispose();
|
||||
|
||||
// Clean up
|
||||
orderedselection = null;
|
||||
|
||||
|
@ -99,6 +108,83 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
|
||||
#region ================== Methods
|
||||
|
||||
// This makes a CRC for the selection
|
||||
public int CreateSelectionCRC()
|
||||
{
|
||||
CRC crc = new CRC();
|
||||
crc.Add(orderedselection.Count);
|
||||
foreach(Sector s in orderedselection)
|
||||
{
|
||||
crc.Add(s.FixedIndex);
|
||||
}
|
||||
return (int)(crc.Value & 0xFFFFFFFF);
|
||||
}
|
||||
|
||||
// This sets the ordered selection
|
||||
public void SetOrderedSelection(ICollection<Sector> list)
|
||||
{
|
||||
orderedselection = new List<Sector>(list);
|
||||
}
|
||||
|
||||
// This sets up new labels
|
||||
private void SetupLabels()
|
||||
{
|
||||
if(labels != null)
|
||||
{
|
||||
// Dispose old labels
|
||||
foreach(KeyValuePair<Sector, TextLabel[]> lbl in labels)
|
||||
foreach(TextLabel l in lbl.Value) l.Dispose();
|
||||
}
|
||||
|
||||
// Make text labels for sectors
|
||||
labels = new Dictionary<Sector, TextLabel[]>(General.Map.Map.Sectors.Count);
|
||||
foreach(Sector s in General.Map.Map.Sectors)
|
||||
{
|
||||
// Setup labels
|
||||
TextLabel[] labelarray = new TextLabel[s.Triangles.IslandVertices.Count];
|
||||
for(int i = 0; i < s.Triangles.IslandVertices.Count; i++)
|
||||
{
|
||||
Vector2D v = s.Labels[i].position;
|
||||
labelarray[i] = new TextLabel(20);
|
||||
labelarray[i].TransformCoords = true;
|
||||
labelarray[i].Rectangle = new RectangleF(v.x, v.y, 0.0f, 0.0f);
|
||||
labelarray[i].AlignX = TextAlignmentX.Center;
|
||||
labelarray[i].AlignY = TextAlignmentY.Middle;
|
||||
labelarray[i].Scale = 14f;
|
||||
labelarray[i].Color = General.Colors.Highlight.WithAlpha(255);
|
||||
labelarray[i].Backcolor = General.Colors.Background.WithAlpha(255);
|
||||
}
|
||||
labels.Add(s, labelarray);
|
||||
}
|
||||
}
|
||||
|
||||
// This updates the overlay
|
||||
private void UpdateOverlay()
|
||||
{
|
||||
if(renderer.StartOverlay(true))
|
||||
{
|
||||
if(BuilderPlug.Me.ViewSelectionNumbers)
|
||||
{
|
||||
// Go for all selected sectors
|
||||
foreach(Sector s in orderedselection)
|
||||
{
|
||||
// Render labels
|
||||
TextLabel[] labelarray = labels[s];
|
||||
for(int i = 0; i < s.Labels.Count; i++)
|
||||
{
|
||||
TextLabel l = labelarray[i];
|
||||
|
||||
// Render only when enough space for the label to see
|
||||
float requiredsize = (l.TextSize.Height / 2) / renderer.Scale;
|
||||
if(requiredsize < s.Labels[i].radius) renderer.RenderText(l);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
renderer.Finish();
|
||||
}
|
||||
}
|
||||
|
||||
// Support function for joining and merging sectors
|
||||
private void JoinMergeSectors(bool removelines)
|
||||
{
|
||||
|
@ -159,6 +245,20 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
// New association highlights something?
|
||||
if((s != null) && (s.Tag > 0)) completeredraw = true;
|
||||
|
||||
// Change label color
|
||||
if((highlighted != null) && !highlighted.IsDisposed)
|
||||
{
|
||||
TextLabel[] labelarray = labels[highlighted];
|
||||
foreach(TextLabel l in labelarray) l.Color = General.Colors.Selection;
|
||||
}
|
||||
|
||||
// Change label color
|
||||
if((s != null) && !s.IsDisposed)
|
||||
{
|
||||
TextLabel[] labelarray = labels[s];
|
||||
foreach(TextLabel l in labelarray) l.Color = General.Colors.Highlight;
|
||||
}
|
||||
|
||||
// If we're changing associations, then we
|
||||
// need to redraw the entire display
|
||||
if(completeredraw)
|
||||
|
@ -175,7 +275,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
// Undraw previous highlight
|
||||
if((highlighted != null) && !highlighted.IsDisposed)
|
||||
renderer.PlotSector(highlighted);
|
||||
|
||||
|
||||
/*
|
||||
// Undraw highlighted things
|
||||
if(highlighted != null)
|
||||
|
@ -189,7 +289,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
// Render highlighted item
|
||||
if((highlighted != null) && !highlighted.IsDisposed)
|
||||
renderer.PlotSector(highlighted, General.Colors.Highlight);
|
||||
|
||||
|
||||
/*
|
||||
// Render highlighted things
|
||||
if(highlighted != null)
|
||||
|
@ -199,8 +299,10 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
|
||||
// Done
|
||||
renderer.Finish();
|
||||
renderer.Present();
|
||||
}
|
||||
|
||||
UpdateOverlay();
|
||||
renderer.Present();
|
||||
}
|
||||
|
||||
// Show highlight info
|
||||
|
@ -211,7 +313,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
}
|
||||
|
||||
// This selectes or deselects a sector
|
||||
protected void SelectSector(Sector s, bool selectstate)
|
||||
protected void SelectSector(Sector s, bool selectstate, bool update)
|
||||
{
|
||||
bool selectionchanged = false;
|
||||
|
||||
|
@ -223,6 +325,14 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
orderedselection.Add(s);
|
||||
s.Selected = true;
|
||||
selectionchanged = true;
|
||||
|
||||
// Setup labels
|
||||
TextLabel[] labelarray = labels[s];
|
||||
foreach(TextLabel l in labelarray)
|
||||
{
|
||||
l.Text = orderedselection.Count.ToString();
|
||||
l.Color = General.Colors.Selection;
|
||||
}
|
||||
}
|
||||
// Deselect the sector?
|
||||
else if(!selectstate && s.Selected)
|
||||
|
@ -230,6 +340,13 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
orderedselection.Remove(s);
|
||||
s.Selected = false;
|
||||
selectionchanged = true;
|
||||
|
||||
// Clear labels
|
||||
TextLabel[] labelarray = labels[s];
|
||||
foreach(TextLabel l in labelarray) l.Text = "";
|
||||
|
||||
// Update all other labels
|
||||
UpdateSelectedLabels();
|
||||
}
|
||||
|
||||
// Selection changed?
|
||||
|
@ -244,6 +361,12 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
sd.Line.Selected = front | back;
|
||||
}
|
||||
}
|
||||
|
||||
if(update)
|
||||
{
|
||||
UpdateOverlay();
|
||||
renderer.Present();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -252,6 +375,24 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
}
|
||||
}
|
||||
|
||||
// This updates labels from the selected sectors
|
||||
private void UpdateSelectedLabels()
|
||||
{
|
||||
// Go for all labels in all selected sectors
|
||||
for(int i = 0; i < orderedselection.Count; i++)
|
||||
{
|
||||
Sector s = orderedselection[i];
|
||||
TextLabel[] labelarray = labels[s];
|
||||
foreach(TextLabel l in labelarray)
|
||||
{
|
||||
// Make sure the text and color are right
|
||||
int labelnum = i + 1;
|
||||
l.Text = labelnum.ToString();
|
||||
l.Color = General.Colors.Selection;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ================== Events
|
||||
|
@ -270,6 +411,13 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
{
|
||||
base.OnEngage();
|
||||
renderer.SetPresentation(Presentation.Standard);
|
||||
|
||||
// Add toolbar buttons
|
||||
General.Interface.AddButton(BuilderPlug.Me.MenusForm.ViewSelectionNumbers);
|
||||
General.Interface.AddButton(BuilderPlug.Me.MenusForm.SeparatorSectors1);
|
||||
General.Interface.AddButton(BuilderPlug.Me.MenusForm.MakeGradientBrightness);
|
||||
General.Interface.AddButton(BuilderPlug.Me.MenusForm.MakeGradientFloors);
|
||||
General.Interface.AddButton(BuilderPlug.Me.MenusForm.MakeGradientCeilings);
|
||||
|
||||
// Convert geometry selection to sectors only
|
||||
General.Map.Map.ClearAllMarks(false);
|
||||
|
@ -294,17 +442,35 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
foreach(Sidedef sd in s.Sidedefs) sd.Line.Selected = true;
|
||||
}
|
||||
}
|
||||
|
||||
// Make text labels for sectors
|
||||
SetupLabels();
|
||||
|
||||
// Fill the list with selected sectors (these are not in order, but we have no other choice)
|
||||
ICollection<Sector> selectedsectors = General.Map.Map.GetSelectedSectors(true);
|
||||
foreach(Sector s in selectedsectors) orderedselection.Add(s);
|
||||
if(orderedselection.Count < selectedsectors.Count)
|
||||
{
|
||||
General.Map.Map.ClearSelectedSectors();
|
||||
foreach(Sector s in selectedsectors) SelectSector(s, true, false);
|
||||
}
|
||||
|
||||
// Update
|
||||
UpdateSelectedLabels();
|
||||
UpdateOverlay();
|
||||
}
|
||||
|
||||
// Mode disengages
|
||||
public override void OnDisengage()
|
||||
{
|
||||
base.OnDisengage();
|
||||
|
||||
|
||||
// Remove toolbar buttons
|
||||
General.Interface.RemoveButton(BuilderPlug.Me.MenusForm.ViewSelectionNumbers);
|
||||
General.Interface.RemoveButton(BuilderPlug.Me.MenusForm.SeparatorSectors1);
|
||||
General.Interface.RemoveButton(BuilderPlug.Me.MenusForm.MakeGradientBrightness);
|
||||
General.Interface.RemoveButton(BuilderPlug.Me.MenusForm.MakeGradientFloors);
|
||||
General.Interface.RemoveButton(BuilderPlug.Me.MenusForm.MakeGradientCeilings);
|
||||
|
||||
// Going to EditSelectionMode?
|
||||
if(General.Editing.NewMode is EditSelectionMode)
|
||||
{
|
||||
|
@ -312,9 +478,15 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
if((General.Map.Map.GetSelectedSectors(true).Count == 0) && (highlighted != null))
|
||||
{
|
||||
// Make the highlight the selection
|
||||
SelectSector(highlighted, true);
|
||||
SelectSector(highlighted, true, false);
|
||||
}
|
||||
}
|
||||
// Going to BrightnessMode?
|
||||
else if(General.Editing.NewMode is BrightnessMode)
|
||||
{
|
||||
// Pass on the ordered selection
|
||||
(General.Editing.NewMode as BrightnessMode).SetOrderedSelection(orderedselection);
|
||||
}
|
||||
|
||||
// Hide highlight info
|
||||
General.Interface.HideInfo();
|
||||
|
@ -354,6 +526,9 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
renderer.Finish();
|
||||
}
|
||||
|
||||
// Render overlay
|
||||
UpdateOverlay();
|
||||
|
||||
renderer.Present();
|
||||
}
|
||||
|
||||
|
@ -364,7 +539,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
if((highlighted != null) && !highlighted.IsDisposed)
|
||||
{
|
||||
// Flip selection
|
||||
SelectSector(highlighted, !highlighted.Selected);
|
||||
SelectSector(highlighted, !highlighted.Selected, true);
|
||||
|
||||
// Update display
|
||||
if(renderer.StartPlotter(false))
|
||||
|
@ -401,6 +576,12 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
renderer.Finish();
|
||||
renderer.Present();
|
||||
}
|
||||
|
||||
// Update overlay
|
||||
TextLabel[] labelarray = labels[highlighted];
|
||||
foreach(TextLabel l in labelarray) l.Color = General.Colors.Highlight;
|
||||
UpdateOverlay();
|
||||
renderer.Present();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -422,7 +603,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
// Make this the only selection
|
||||
General.Map.Map.ClearSelectedSectors();
|
||||
General.Map.Map.ClearSelectedLinedefs();
|
||||
SelectSector(highlighted, true);
|
||||
SelectSector(highlighted, true, false);
|
||||
General.Interface.RedrawDisplay();
|
||||
}
|
||||
|
||||
|
@ -559,7 +740,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
{
|
||||
// Select only this sector for dragging
|
||||
General.Map.Map.ClearSelectedSectors();
|
||||
SelectSector(highlighted, true);
|
||||
SelectSector(highlighted, true, true);
|
||||
}
|
||||
|
||||
// Start dragging the selection
|
||||
|
@ -617,7 +798,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
}
|
||||
|
||||
// Sector completely selected?
|
||||
SelectSector(s, allselected);
|
||||
SelectSector(s, allselected, false);
|
||||
}
|
||||
|
||||
// Make sure all linedefs reflect selected sectors
|
||||
|
@ -656,7 +837,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
if((General.Map.Map.GetSelectedSectors(true).Count == 0) && (highlighted != null))
|
||||
{
|
||||
// Make the highlight the selection
|
||||
SelectSector(highlighted, true);
|
||||
SelectSector(highlighted, true, true);
|
||||
}
|
||||
|
||||
return base.OnCopyBegin();
|
||||
|
@ -669,7 +850,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
if((General.Map.Map.GetSelectedSectors(true).Count == 0) && (highlighted != null))
|
||||
{
|
||||
// Make the highlight the selection
|
||||
SelectSector(highlighted, true);
|
||||
SelectSector(highlighted, true, true);
|
||||
}
|
||||
|
||||
return base.OnPasteBegin();
|
||||
|
@ -679,19 +860,35 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
public override bool OnUndoBegin()
|
||||
{
|
||||
// Clear ordered selection
|
||||
General.Map.Map.ClearAllSelected();
|
||||
orderedselection.Clear();
|
||||
|
||||
return base.OnUndoBegin();
|
||||
}
|
||||
|
||||
// When undo is performed
|
||||
public override void OnUndoEnd()
|
||||
{
|
||||
// Clear labels
|
||||
SetupLabels();
|
||||
}
|
||||
|
||||
// When redo is used
|
||||
public override bool OnRedoBegin()
|
||||
{
|
||||
// Clear ordered selection
|
||||
General.Map.Map.ClearAllSelected();
|
||||
orderedselection.Clear();
|
||||
|
||||
return base.OnRedoBegin();
|
||||
}
|
||||
|
||||
// When redo is performed
|
||||
public override void OnRedoEnd()
|
||||
{
|
||||
// Clear labels
|
||||
SetupLabels();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
@ -724,7 +921,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
// Make this the only selection
|
||||
General.Map.Map.ClearSelectedSectors();
|
||||
General.Map.Map.ClearSelectedLinedefs();
|
||||
SelectSector(highlighted, true);
|
||||
SelectSector(highlighted, true, false);
|
||||
General.Interface.RedrawDisplay();
|
||||
}
|
||||
}
|
||||
|
@ -953,6 +1150,170 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
}
|
||||
}
|
||||
|
||||
// Make gradient brightness
|
||||
[BeginAction("gradientbrightness")]
|
||||
public void MakeGradientBrightness()
|
||||
{
|
||||
General.Interface.DisplayStatus(StatusType.Action, "Created gradient brightness over selected sectors.");
|
||||
General.Map.UndoRedo.CreateUndo("Gradient brightness");
|
||||
|
||||
// Need at least 3 selected sectors
|
||||
// The first and last are not modified
|
||||
if(orderedselection.Count > 2)
|
||||
{
|
||||
float startbrightness = (float)orderedselection[0].Brightness;
|
||||
float endbrightness = (float)orderedselection[orderedselection.Count - 1].Brightness;
|
||||
float delta = endbrightness - startbrightness;
|
||||
|
||||
// Go for all sectors in between first and last
|
||||
for(int i = 1; i < (orderedselection.Count - 1); i++)
|
||||
{
|
||||
float u = (float)i / (float)(orderedselection.Count - 1);
|
||||
float b = startbrightness + delta * u;
|
||||
orderedselection[i].Brightness = (int)b;
|
||||
}
|
||||
}
|
||||
|
||||
// Update
|
||||
General.Map.Map.Update();
|
||||
UpdateOverlay();
|
||||
renderer.Present();
|
||||
General.Interface.RedrawDisplay();
|
||||
General.Map.IsChanged = true;
|
||||
}
|
||||
|
||||
// Make gradient floors
|
||||
[BeginAction("gradientfloors")]
|
||||
public void MakeGradientFloors()
|
||||
{
|
||||
General.Interface.DisplayStatus(StatusType.Action, "Created gradient floor heights over selected sectors.");
|
||||
General.Map.UndoRedo.CreateUndo("Gradient floor heights");
|
||||
|
||||
// Need at least 3 selected sectors
|
||||
// The first and last are not modified
|
||||
if(orderedselection.Count > 2)
|
||||
{
|
||||
float startlevel = (float)orderedselection[0].FloorHeight;
|
||||
float endlevel = (float)orderedselection[orderedselection.Count - 1].FloorHeight;
|
||||
float delta = endlevel - startlevel;
|
||||
|
||||
// Go for all sectors in between first and last
|
||||
for(int i = 1; i < (orderedselection.Count - 1); i++)
|
||||
{
|
||||
float u = (float)i / (float)(orderedselection.Count - 1);
|
||||
float b = startlevel + delta * u;
|
||||
orderedselection[i].FloorHeight = (int)b;
|
||||
}
|
||||
}
|
||||
|
||||
// Update
|
||||
General.Map.IsChanged = true;
|
||||
}
|
||||
|
||||
// Change heights
|
||||
[BeginAction("lowerfloor8")]
|
||||
public void LowerFloors8()
|
||||
{
|
||||
General.Interface.DisplayStatus(StatusType.Action, "Lowered floor heights by 8mp.");
|
||||
General.Map.UndoRedo.CreateUndo("Floor heights change", UndoGroup.FloorHeightChange, CreateSelectionCRC());
|
||||
|
||||
// Change heights
|
||||
ICollection<Sector> selected = General.Map.Map.GetSelectedSectors(true);
|
||||
if((selected.Count == 0) && (highlighted != null) && !highlighted.IsDisposed) selected.Add(highlighted);
|
||||
foreach(Sector s in selected)
|
||||
{
|
||||
s.FloorHeight -= 8;
|
||||
}
|
||||
|
||||
// Update
|
||||
General.Map.IsChanged = true;
|
||||
}
|
||||
|
||||
// Change heights
|
||||
[BeginAction("raisefloor8")]
|
||||
public void RaiseFloors8()
|
||||
{
|
||||
General.Interface.DisplayStatus(StatusType.Action, "Raised floor heights by 8mp.");
|
||||
General.Map.UndoRedo.CreateUndo("Floor heights change", UndoGroup.FloorHeightChange, CreateSelectionCRC());
|
||||
|
||||
// Change heights
|
||||
ICollection<Sector> selected = General.Map.Map.GetSelectedSectors(true);
|
||||
if((selected.Count == 0) && (highlighted != null) && !highlighted.IsDisposed) selected.Add(highlighted);
|
||||
foreach(Sector s in selected)
|
||||
{
|
||||
s.FloorHeight += 8;
|
||||
}
|
||||
|
||||
// Update
|
||||
General.Map.IsChanged = true;
|
||||
}
|
||||
|
||||
// Change heights
|
||||
[BeginAction("lowerceiling8")]
|
||||
public void LowerCeilings8()
|
||||
{
|
||||
General.Interface.DisplayStatus(StatusType.Action, "Lowered ceiling heights by 8mp.");
|
||||
General.Map.UndoRedo.CreateUndo("Ceiling heights change", UndoGroup.CeilingHeightChange, CreateSelectionCRC());
|
||||
|
||||
// Change heights
|
||||
ICollection<Sector> selected = General.Map.Map.GetSelectedSectors(true);
|
||||
if((selected.Count == 0) && (highlighted != null) && !highlighted.IsDisposed) selected.Add(highlighted);
|
||||
foreach(Sector s in selected)
|
||||
{
|
||||
s.CeilHeight -= 8;
|
||||
}
|
||||
|
||||
// Update
|
||||
General.Map.IsChanged = true;
|
||||
}
|
||||
|
||||
// Change heights
|
||||
[BeginAction("raiseceiling8")]
|
||||
public void RaiseCeilings8()
|
||||
{
|
||||
General.Interface.DisplayStatus(StatusType.Action, "Raised ceiling heights by 8mp.");
|
||||
General.Map.UndoRedo.CreateUndo("Ceiling heights change", UndoGroup.CeilingHeightChange, CreateSelectionCRC());
|
||||
|
||||
// Change heights
|
||||
ICollection<Sector> selected = General.Map.Map.GetSelectedSectors(true);
|
||||
if((selected.Count == 0) && (highlighted != null) && !highlighted.IsDisposed) selected.Add(highlighted);
|
||||
foreach(Sector s in selected)
|
||||
{
|
||||
s.CeilHeight += 8;
|
||||
}
|
||||
|
||||
// Update
|
||||
General.Map.IsChanged = true;
|
||||
}
|
||||
|
||||
// Make gradient ceilings
|
||||
[BeginAction("gradientceilings")]
|
||||
public void MakeGradientCeilings()
|
||||
{
|
||||
General.Interface.DisplayStatus(StatusType.Action, "Created gradient ceiling heights over selected sectors.");
|
||||
General.Map.UndoRedo.CreateUndo("Gradient ceiling heights");
|
||||
|
||||
// Need at least 3 selected sectors
|
||||
// The first and last are not modified
|
||||
if(orderedselection.Count > 2)
|
||||
{
|
||||
float startlevel = (float)orderedselection[0].CeilHeight;
|
||||
float endlevel = (float)orderedselection[orderedselection.Count - 1].CeilHeight;
|
||||
float delta = endlevel - startlevel;
|
||||
|
||||
// Go for all sectors in between first and last
|
||||
for(int i = 1; i < (orderedselection.Count - 1); i++)
|
||||
{
|
||||
float u = (float)i / (float)(orderedselection.Count - 1);
|
||||
float b = startlevel + delta * u;
|
||||
orderedselection[i].CeilHeight = (int)b;
|
||||
}
|
||||
}
|
||||
|
||||
// Update
|
||||
General.Map.IsChanged = true;
|
||||
}
|
||||
|
||||
// This clears the selection
|
||||
[BeginAction("clearselection", BaseAction = true)]
|
||||
public void ClearSelection()
|
||||
|
@ -961,6 +1322,10 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
General.Map.Map.ClearAllSelected();
|
||||
orderedselection.Clear();
|
||||
|
||||
// Clear labels
|
||||
foreach(TextLabel[] labelarray in labels.Values)
|
||||
foreach(TextLabel l in labelarray) l.Text = "";
|
||||
|
||||
// Redraw
|
||||
General.Interface.RedrawDisplay();
|
||||
}
|
||||
|
|
|
@ -71,6 +71,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
private SectorProperties copiedsectorprops;
|
||||
private SidedefProperties copiedsidedefprops;
|
||||
private ThingProperties copiedthingprops;
|
||||
private bool viewselectionnumbers;
|
||||
|
||||
#endregion
|
||||
|
||||
|
@ -98,6 +99,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
public SectorProperties CopiedSectorProps { get { return copiedsectorprops; } set { copiedsectorprops = value; } }
|
||||
public SidedefProperties CopiedSidedefProps { get { return copiedsidedefprops; } set { copiedsidedefprops = value; } }
|
||||
public ThingProperties CopiedThingProps { get { return copiedthingprops; } set { copiedthingprops = value; } }
|
||||
public bool ViewSelectionNumbers { get { return viewselectionnumbers; } set { viewselectionnumbers = value; } }
|
||||
|
||||
#endregion
|
||||
|
||||
|
@ -162,6 +164,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
editnewthing = General.Settings.ReadPluginSetting("editnewthing", true);
|
||||
editnewsector = General.Settings.ReadPluginSetting("editnewsector", false);
|
||||
additiveselect = General.Settings.ReadPluginSetting("additiveselect", false);
|
||||
viewselectionnumbers = General.Settings.ReadPluginSetting("viewselectionnumbers", true);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
|
51
Source/BuilderModes/Interface/MenusForm.Designer.cs
generated
51
Source/BuilderModes/Interface/MenusForm.Designer.cs
generated
|
@ -45,7 +45,11 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
this.toolStripMenuItem2 = new System.Windows.Forms.ToolStripSeparator();
|
||||
this.globalstrip = new System.Windows.Forms.ToolStrip();
|
||||
this.manualstrip = new System.Windows.Forms.ToolStrip();
|
||||
this.buttonselectionnumbers = new System.Windows.Forms.ToolStripButton();
|
||||
this.separatorsectors1 = new System.Windows.Forms.ToolStripSeparator();
|
||||
this.buttonbrightnessgradient = new System.Windows.Forms.ToolStripButton();
|
||||
this.buttonfloorgradient = new System.Windows.Forms.ToolStripButton();
|
||||
this.buttonceilinggradient = new System.Windows.Forms.ToolStripButton();
|
||||
this.buttonflipselectionh = new System.Windows.Forms.ToolStripButton();
|
||||
this.buttonflipselectionv = new System.Windows.Forms.ToolStripButton();
|
||||
this.menustrip.SuspendLayout();
|
||||
|
@ -186,7 +190,11 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
// manualstrip
|
||||
//
|
||||
this.manualstrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.buttonselectionnumbers,
|
||||
this.separatorsectors1,
|
||||
this.buttonbrightnessgradient,
|
||||
this.buttonfloorgradient,
|
||||
this.buttonceilinggradient,
|
||||
this.buttonflipselectionh,
|
||||
this.buttonflipselectionv});
|
||||
this.manualstrip.Location = new System.Drawing.Point(0, 49);
|
||||
|
@ -195,6 +203,23 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
this.manualstrip.TabIndex = 2;
|
||||
this.manualstrip.Text = "toolStrip1";
|
||||
//
|
||||
// buttonselectionnumbers
|
||||
//
|
||||
this.buttonselectionnumbers.CheckOnClick = true;
|
||||
this.buttonselectionnumbers.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
|
||||
this.buttonselectionnumbers.Image = global::CodeImp.DoomBuilder.BuilderModes.Properties.Resources.ViewSelectionIndex;
|
||||
this.buttonselectionnumbers.ImageTransparentColor = System.Drawing.Color.Magenta;
|
||||
this.buttonselectionnumbers.Name = "buttonselectionnumbers";
|
||||
this.buttonselectionnumbers.Size = new System.Drawing.Size(23, 22);
|
||||
this.buttonselectionnumbers.Text = "View Selection Numbering";
|
||||
this.buttonselectionnumbers.Click += new System.EventHandler(this.buttonselectionnumbers_Click);
|
||||
//
|
||||
// separatorsectors1
|
||||
//
|
||||
this.separatorsectors1.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0);
|
||||
this.separatorsectors1.Name = "separatorsectors1";
|
||||
this.separatorsectors1.Size = new System.Drawing.Size(6, 25);
|
||||
//
|
||||
// buttonbrightnessgradient
|
||||
//
|
||||
this.buttonbrightnessgradient.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
|
||||
|
@ -207,6 +232,28 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
this.buttonbrightnessgradient.Text = "Make Brightness Gradient";
|
||||
this.buttonbrightnessgradient.Click += new System.EventHandler(this.InvokeTaggedAction);
|
||||
//
|
||||
// buttonfloorgradient
|
||||
//
|
||||
this.buttonfloorgradient.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
|
||||
this.buttonfloorgradient.Image = global::CodeImp.DoomBuilder.BuilderModes.Properties.Resources.FloorsGradient;
|
||||
this.buttonfloorgradient.ImageTransparentColor = System.Drawing.Color.Magenta;
|
||||
this.buttonfloorgradient.Name = "buttonfloorgradient";
|
||||
this.buttonfloorgradient.Size = new System.Drawing.Size(23, 22);
|
||||
this.buttonfloorgradient.Tag = "gradientfloors";
|
||||
this.buttonfloorgradient.Text = "Make Floor Heights Gradient";
|
||||
this.buttonfloorgradient.Click += new System.EventHandler(this.InvokeTaggedAction);
|
||||
//
|
||||
// buttonceilinggradient
|
||||
//
|
||||
this.buttonceilinggradient.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
|
||||
this.buttonceilinggradient.Image = global::CodeImp.DoomBuilder.BuilderModes.Properties.Resources.CeilsGradient;
|
||||
this.buttonceilinggradient.ImageTransparentColor = System.Drawing.Color.Magenta;
|
||||
this.buttonceilinggradient.Name = "buttonceilinggradient";
|
||||
this.buttonceilinggradient.Size = new System.Drawing.Size(23, 22);
|
||||
this.buttonceilinggradient.Tag = "gradientceilings";
|
||||
this.buttonceilinggradient.Text = "Make Ceiling Heights Gradient";
|
||||
this.buttonceilinggradient.Click += new System.EventHandler(this.InvokeTaggedAction);
|
||||
//
|
||||
// buttonflipselectionh
|
||||
//
|
||||
this.buttonflipselectionh.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
|
||||
|
@ -277,5 +324,9 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
private System.Windows.Forms.ToolStripSeparator toolStripMenuItem4;
|
||||
private System.Windows.Forms.ToolStripButton buttonflipselectionh;
|
||||
private System.Windows.Forms.ToolStripButton buttonflipselectionv;
|
||||
private System.Windows.Forms.ToolStripButton buttonselectionnumbers;
|
||||
private System.Windows.Forms.ToolStripSeparator separatorsectors1;
|
||||
private System.Windows.Forms.ToolStripButton buttonfloorgradient;
|
||||
private System.Windows.Forms.ToolStripButton buttonceilinggradient;
|
||||
}
|
||||
}
|
|
@ -52,7 +52,11 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
|
||||
public ToolStripMenuItem LinedefsMenu { get { return linedefsmenu; } }
|
||||
public ToolStripMenuItem SectorsMenu { get { return sectorsmenu; } }
|
||||
public ToolStripButton ViewSelectionNumbers { get { return buttonselectionnumbers; } }
|
||||
public ToolStripSeparator SeparatorSectors1 { get { return separatorsectors1; } }
|
||||
public ToolStripButton MakeGradientBrightness { get { return buttonbrightnessgradient; } }
|
||||
public ToolStripButton MakeGradientFloors { get { return buttonfloorgradient; } }
|
||||
public ToolStripButton MakeGradientCeilings { get { return buttonceilinggradient; } }
|
||||
public ToolStripButton FlipSelectionV { get { return buttonflipselectionv; } }
|
||||
public ToolStripButton FlipSelectionH { get { return buttonflipselectionh; } }
|
||||
|
||||
|
@ -66,6 +70,9 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
// Initialize
|
||||
InitializeComponent();
|
||||
|
||||
// Apply settings
|
||||
buttonselectionnumbers.Checked = BuilderPlug.Me.ViewSelectionNumbers;
|
||||
|
||||
// List all menus
|
||||
menus = new ToolStripItem[menustrip.Items.Count];
|
||||
for(int i = 0; i < menustrip.Items.Count; i++) menus[i] = menustrip.Items[i];
|
||||
|
@ -139,6 +146,13 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
{
|
||||
General.Interface.InvokeTaggedAction(sender, e);
|
||||
}
|
||||
|
||||
// View selection numbers clicked
|
||||
private void buttonselectionnumbers_Click(object sender, EventArgs e)
|
||||
{
|
||||
BuilderPlug.Me.ViewSelectionNumbers = buttonselectionnumbers.Checked;
|
||||
General.Interface.RedrawDisplay();
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
|
21
Source/BuilderModes/Properties/Resources.Designer.cs
generated
21
Source/BuilderModes/Properties/Resources.Designer.cs
generated
|
@ -67,6 +67,13 @@ namespace CodeImp.DoomBuilder.BuilderModes.Properties {
|
|||
}
|
||||
}
|
||||
|
||||
internal static System.Drawing.Bitmap CeilsGradient {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("CeilsGradient", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
internal static System.Drawing.Bitmap FlipSelectionH {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("FlipSelectionH", resourceCulture);
|
||||
|
@ -81,11 +88,25 @@ namespace CodeImp.DoomBuilder.BuilderModes.Properties {
|
|||
}
|
||||
}
|
||||
|
||||
internal static System.Drawing.Bitmap FloorsGradient {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("FloorsGradient", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
internal static System.Drawing.Bitmap treeview {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("treeview", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
internal static System.Drawing.Bitmap ViewSelectionIndex {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("ViewSelectionIndex", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -121,13 +121,22 @@
|
|||
<data name="treeview" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\treeview.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="ViewSelectionIndex" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\ViewSelectionIndex.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="BrightnessGradient" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\BrightnessGradient.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="FlipSelectionH" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\FlipSelectionH.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="FloorsGradient" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\FloorsGradient.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="FlipSelectionV" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\FlipSelectionV.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="CeilsGradient" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\CeilsGradient.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
</root>
|
|
@ -273,13 +273,33 @@ editselectionmode
|
|||
gradientbrightness
|
||||
{
|
||||
title = "Make Brightness Gradient";
|
||||
category = "tools";
|
||||
category = "sectors";
|
||||
description = "Creates a brightness gradient over all selected sectors from the first to the last selected sector.";
|
||||
allowkeys = true;
|
||||
allowmouse = true;
|
||||
allowscroll = true;
|
||||
}
|
||||
|
||||
gradientfloors
|
||||
{
|
||||
title = "Make Floors Gradient";
|
||||
category = "sectors";
|
||||
description = "Creates a floor heights gradient over all selected sectors from the first to the last selected sector.";
|
||||
allowkeys = true;
|
||||
allowmouse = true;
|
||||
allowscroll = true;
|
||||
}
|
||||
|
||||
gradientceilings
|
||||
{
|
||||
title = "Make Ceilings Gradient";
|
||||
category = "sectors";
|
||||
description = "Creates a ceiling heights gradient over all selected sectors from the first to the last selected sector.";
|
||||
allowkeys = true;
|
||||
allowmouse = true;
|
||||
allowscroll = true;
|
||||
}
|
||||
|
||||
makedoor
|
||||
{
|
||||
title = "Make Door";
|
||||
|
@ -290,6 +310,49 @@ makedoor
|
|||
allowscroll = true;
|
||||
}
|
||||
|
||||
lowerfloor8
|
||||
{
|
||||
title = "Lower Floor by 8 mp";
|
||||
category = "sectors";
|
||||
description = "Lowers the highlighted or selected floor heights by 8 mp.";
|
||||
allowkeys = true;
|
||||
allowmouse = true;
|
||||
allowscroll = true;
|
||||
repeat = true;
|
||||
}
|
||||
|
||||
raisefloor8
|
||||
{
|
||||
title = "Raise Floor by 8 mp";
|
||||
category = "sectors";
|
||||
description = "Raises the highlighted or selected floor heights by 8 mp.";
|
||||
allowkeys = true;
|
||||
allowmouse = true;
|
||||
allowscroll = true;
|
||||
repeat = true;
|
||||
}
|
||||
|
||||
lowerceiling8
|
||||
{
|
||||
title = "Lower Ceiling by 8 mp";
|
||||
category = "sectors";
|
||||
description = "Lowers the highlighted or selected ceiling heights by 8 mp.";
|
||||
allowkeys = true;
|
||||
allowmouse = true;
|
||||
allowscroll = true;
|
||||
repeat = true;
|
||||
}
|
||||
|
||||
raiseceiling8
|
||||
{
|
||||
title = "Raise Ceiling by 8 mp";
|
||||
category = "sectors";
|
||||
description = "Raises the highlighted or selected ceiling heights by 8 mp.";
|
||||
allowkeys = true;
|
||||
allowmouse = true;
|
||||
allowscroll = true;
|
||||
}
|
||||
|
||||
errorcheckmode
|
||||
{
|
||||
title = "Map Analysis Mode";
|
||||
|
|
BIN
Source/BuilderModes/Resources/CeilsGradient.png
Normal file
BIN
Source/BuilderModes/Resources/CeilsGradient.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 406 B |
BIN
Source/BuilderModes/Resources/FloorsGradient.png
Normal file
BIN
Source/BuilderModes/Resources/FloorsGradient.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 354 B |
BIN
Source/BuilderModes/Resources/ViewSelectionIndex.png
Normal file
BIN
Source/BuilderModes/Resources/ViewSelectionIndex.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 429 B |
82
Source/General/CRC.cs
Normal file
82
Source/General/CRC.cs
Normal file
|
@ -0,0 +1,82 @@
|
|||
|
||||
#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.Runtime.InteropServices;
|
||||
using System.Diagnostics;
|
||||
using ICSharpCode.SharpZipLib.Checksums;
|
||||
|
||||
#endregion
|
||||
|
||||
namespace CodeImp.DoomBuilder
|
||||
{
|
||||
public class CRC
|
||||
{
|
||||
#region ================== Constants
|
||||
|
||||
#endregion
|
||||
|
||||
#region ================== Variables
|
||||
|
||||
private Crc32 crc;
|
||||
|
||||
#endregion
|
||||
|
||||
#region ================== Properties
|
||||
|
||||
public long Value { get { return crc.Value; } }
|
||||
|
||||
#endregion
|
||||
|
||||
#region ================== Constructor / Disposer
|
||||
|
||||
// Constructor
|
||||
public CRC()
|
||||
{
|
||||
crc = new Crc32();
|
||||
|
||||
// We have no destructor
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ================== Methods
|
||||
|
||||
public void Add(int value)
|
||||
{
|
||||
crc.Update(value);
|
||||
}
|
||||
|
||||
public void Add(byte[] data)
|
||||
{
|
||||
crc.Update(data);
|
||||
}
|
||||
|
||||
public void Reset()
|
||||
{
|
||||
crc.Reset();
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue