mirror of
https://git.do.srb2.org/STJr/UltimateZoneBuilder.git
synced 2025-02-17 01:22:18 +00:00
"Rotate Clockwise" and "Rotate Counterclockwise" actions now work in Things mode (they will rotate things) and in Sectors mode (they will rotate floor/ceiling textures based on current view mode).
Moved "Rotate Clockwise" and "Rotate Counterclockwise" actions to "Edit" category. Tag Statistics form: help label was incorrectly aligned. Some actions in Sectors and Linedefs modes were not used on highlighted map elements. Some actions in Sectors and Linedefs modes created undo groups incorrectly when used on highlighted map elements.
This commit is contained in:
parent
f68e61e0fe
commit
7a29d87cb1
7 changed files with 289 additions and 82 deletions
|
@ -25,12 +25,12 @@
|
|||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent() {
|
||||
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle13 = new System.Windows.Forms.DataGridViewCellStyle();
|
||||
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle14 = new System.Windows.Forms.DataGridViewCellStyle();
|
||||
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle15 = new System.Windows.Forms.DataGridViewCellStyle();
|
||||
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle16 = new System.Windows.Forms.DataGridViewCellStyle();
|
||||
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle17 = new System.Windows.Forms.DataGridViewCellStyle();
|
||||
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle18 = new System.Windows.Forms.DataGridViewCellStyle();
|
||||
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle();
|
||||
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle();
|
||||
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle3 = new System.Windows.Forms.DataGridViewCellStyle();
|
||||
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle4 = new System.Windows.Forms.DataGridViewCellStyle();
|
||||
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle5 = new System.Windows.Forms.DataGridViewCellStyle();
|
||||
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle6 = new System.Windows.Forms.DataGridViewCellStyle();
|
||||
this.dataGridView = new System.Windows.Forms.DataGridView();
|
||||
this.TagColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.Label = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
|
@ -55,14 +55,14 @@
|
|||
this.dataGridView.BorderStyle = System.Windows.Forms.BorderStyle.None;
|
||||
this.dataGridView.CellBorderStyle = System.Windows.Forms.DataGridViewCellBorderStyle.None;
|
||||
this.dataGridView.ColumnHeadersBorderStyle = System.Windows.Forms.DataGridViewHeaderBorderStyle.Single;
|
||||
dataGridViewCellStyle13.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
|
||||
dataGridViewCellStyle13.BackColor = System.Drawing.SystemColors.Control;
|
||||
dataGridViewCellStyle13.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
|
||||
dataGridViewCellStyle13.ForeColor = System.Drawing.SystemColors.WindowText;
|
||||
dataGridViewCellStyle13.SelectionBackColor = System.Drawing.SystemColors.Highlight;
|
||||
dataGridViewCellStyle13.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
|
||||
dataGridViewCellStyle13.WrapMode = System.Windows.Forms.DataGridViewTriState.False;
|
||||
this.dataGridView.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle13;
|
||||
dataGridViewCellStyle1.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
|
||||
dataGridViewCellStyle1.BackColor = System.Drawing.SystemColors.Control;
|
||||
dataGridViewCellStyle1.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
|
||||
dataGridViewCellStyle1.ForeColor = System.Drawing.SystemColors.WindowText;
|
||||
dataGridViewCellStyle1.SelectionBackColor = System.Drawing.SystemColors.Highlight;
|
||||
dataGridViewCellStyle1.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
|
||||
dataGridViewCellStyle1.WrapMode = System.Windows.Forms.DataGridViewTriState.False;
|
||||
this.dataGridView.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle1;
|
||||
this.dataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||
this.dataGridView.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
|
||||
this.TagColumn,
|
||||
|
@ -84,8 +84,8 @@
|
|||
// TagColumn
|
||||
//
|
||||
this.TagColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.ColumnHeader;
|
||||
dataGridViewCellStyle14.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
|
||||
this.TagColumn.DefaultCellStyle = dataGridViewCellStyle14;
|
||||
dataGridViewCellStyle2.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
|
||||
this.TagColumn.DefaultCellStyle = dataGridViewCellStyle2;
|
||||
this.TagColumn.HeaderText = "Tag";
|
||||
this.TagColumn.Name = "TagColumn";
|
||||
this.TagColumn.ReadOnly = true;
|
||||
|
@ -94,16 +94,16 @@
|
|||
// Label
|
||||
//
|
||||
this.Label.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
|
||||
dataGridViewCellStyle15.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
|
||||
this.Label.DefaultCellStyle = dataGridViewCellStyle15;
|
||||
dataGridViewCellStyle3.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
|
||||
this.Label.DefaultCellStyle = dataGridViewCellStyle3;
|
||||
this.Label.HeaderText = "Label";
|
||||
this.Label.Name = "Label";
|
||||
//
|
||||
// Sectors
|
||||
//
|
||||
this.Sectors.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.ColumnHeader;
|
||||
dataGridViewCellStyle16.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
|
||||
this.Sectors.DefaultCellStyle = dataGridViewCellStyle16;
|
||||
dataGridViewCellStyle4.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
|
||||
this.Sectors.DefaultCellStyle = dataGridViewCellStyle4;
|
||||
this.Sectors.HeaderText = "Sectors";
|
||||
this.Sectors.Name = "Sectors";
|
||||
this.Sectors.ReadOnly = true;
|
||||
|
@ -113,8 +113,8 @@
|
|||
// Linedefs
|
||||
//
|
||||
this.Linedefs.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.ColumnHeader;
|
||||
dataGridViewCellStyle17.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
|
||||
this.Linedefs.DefaultCellStyle = dataGridViewCellStyle17;
|
||||
dataGridViewCellStyle5.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
|
||||
this.Linedefs.DefaultCellStyle = dataGridViewCellStyle5;
|
||||
this.Linedefs.HeaderText = "Linedefs";
|
||||
this.Linedefs.Name = "Linedefs";
|
||||
this.Linedefs.ReadOnly = true;
|
||||
|
@ -124,8 +124,8 @@
|
|||
// Things
|
||||
//
|
||||
this.Things.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.ColumnHeader;
|
||||
dataGridViewCellStyle18.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
|
||||
this.Things.DefaultCellStyle = dataGridViewCellStyle18;
|
||||
dataGridViewCellStyle6.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
|
||||
this.Things.DefaultCellStyle = dataGridViewCellStyle6;
|
||||
this.Things.HeaderText = "Things";
|
||||
this.Things.Name = "Things";
|
||||
this.Things.ReadOnly = true;
|
||||
|
@ -157,7 +157,7 @@
|
|||
//
|
||||
// textBox1
|
||||
//
|
||||
this.textBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
this.textBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.textBox1.BackColor = System.Drawing.SystemColors.Control;
|
||||
this.textBox1.BorderStyle = System.Windows.Forms.BorderStyle.None;
|
||||
|
|
|
@ -183,6 +183,9 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
private void alignTextureToLine(bool alignFloors, bool alignToFrontSide) {
|
||||
ICollection<Linedef> lines = General.Map.Map.GetSelectedLinedefs(true);
|
||||
|
||||
if(lines.Count == 0 && highlighted != null && !highlighted.IsDisposed)
|
||||
lines.Add(highlighted);
|
||||
|
||||
if(lines.Count == 0) {
|
||||
General.Interface.DisplayStatus(StatusType.Warning, "This action requires a selection");
|
||||
return;
|
||||
|
@ -1296,15 +1299,15 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
|
||||
index++;
|
||||
}
|
||||
|
||||
// Update
|
||||
General.Map.Map.Update();
|
||||
General.Interface.RedrawDisplay();
|
||||
General.Interface.RefreshInfo();
|
||||
General.Map.IsChanged = true;
|
||||
} else {
|
||||
General.Interface.DisplayStatus(StatusType.Warning, "Select at least 3 linedefs first!");
|
||||
}
|
||||
|
||||
// Update
|
||||
General.Map.Map.Update();
|
||||
General.Interface.RedrawDisplay();
|
||||
General.Interface.RefreshInfo();
|
||||
General.Map.IsChanged = true;
|
||||
}
|
||||
|
||||
[BeginAction("placethings")] //mxd
|
||||
|
|
|
@ -126,6 +126,16 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
return (int)(crc.Value & 0xFFFFFFFF);
|
||||
}
|
||||
|
||||
//mxd. This makes a CRC for given selection
|
||||
public int CreateSelectionCRC(ICollection<Sector> selection) {
|
||||
CRC crc = new CRC();
|
||||
crc.Add(selection.Count);
|
||||
foreach(Sector s in selection) {
|
||||
crc.Add(s.FixedIndex);
|
||||
}
|
||||
return (int)(crc.Value & 0xFFFFFFFF);
|
||||
}
|
||||
|
||||
// This sets up new labels
|
||||
private void SetupLabels()
|
||||
{
|
||||
|
@ -1692,17 +1702,17 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
index++;
|
||||
}
|
||||
}
|
||||
|
||||
// Update
|
||||
General.Map.Map.Update();
|
||||
UpdateOverlay();
|
||||
renderer.Present();
|
||||
General.Interface.RedrawDisplay();
|
||||
General.Interface.RefreshInfo();
|
||||
General.Map.IsChanged = true;
|
||||
} else {
|
||||
General.Interface.DisplayStatus(StatusType.Warning, "Select at least 3 sectors first!");
|
||||
}
|
||||
|
||||
// Update
|
||||
General.Map.Map.Update();
|
||||
UpdateOverlay();
|
||||
renderer.Present();
|
||||
General.Interface.RedrawDisplay();
|
||||
General.Interface.RefreshInfo();
|
||||
General.Map.IsChanged = true;
|
||||
}
|
||||
|
||||
// Make gradient floors
|
||||
|
@ -1728,13 +1738,13 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
s.FloorHeight = (int)b;
|
||||
index++;
|
||||
}
|
||||
|
||||
// Update
|
||||
General.Interface.RefreshInfo();
|
||||
General.Map.IsChanged = true;
|
||||
} else {
|
||||
General.Interface.DisplayStatus(StatusType.Warning, "Select at least 3 sectors first!");
|
||||
}
|
||||
|
||||
// Update
|
||||
General.Interface.RefreshInfo();
|
||||
General.Map.IsChanged = true;
|
||||
}
|
||||
|
||||
// Make gradient ceilings
|
||||
|
@ -1760,24 +1770,33 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
s.CeilHeight = (int)b;
|
||||
index++;
|
||||
}
|
||||
|
||||
// Update
|
||||
General.Interface.RefreshInfo();
|
||||
General.Map.IsChanged = true;
|
||||
} else {
|
||||
General.Interface.DisplayStatus(StatusType.Warning, "Select at least 3 sectors first!");
|
||||
}
|
||||
|
||||
// Update
|
||||
General.Interface.RefreshInfo();
|
||||
General.Map.IsChanged = true;
|
||||
}
|
||||
|
||||
// Change heights
|
||||
[BeginAction("lowerfloor8")]
|
||||
public void LowerFloors8() {
|
||||
// Get selection
|
||||
ICollection<Sector> selected = General.Map.Map.GetSelectedSectors(true);
|
||||
if(selected.Count == 0 && highlighted != null && !highlighted.IsDisposed)
|
||||
selected.Add(highlighted);
|
||||
|
||||
if(selected.Count == 0) {
|
||||
General.Interface.DisplayStatus(StatusType.Warning, "This action requires a selection!");
|
||||
return;
|
||||
}
|
||||
|
||||
// Make undo
|
||||
General.Interface.DisplayStatus(StatusType.Action, "Lowered floor heights by 8mp.");
|
||||
General.Map.UndoRedo.CreateUndo("Floor heights change", this, UndoGroup.FloorHeightChange, CreateSelectionCRC());
|
||||
General.Map.UndoRedo.CreateUndo("Floor heights change", this, UndoGroup.FloorHeightChange, CreateSelectionCRC(selected));
|
||||
|
||||
// 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;
|
||||
}
|
||||
|
@ -1790,12 +1809,21 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
// Change heights
|
||||
[BeginAction("raisefloor8")]
|
||||
public void RaiseFloors8() {
|
||||
// Get selection
|
||||
ICollection<Sector> selected = General.Map.Map.GetSelectedSectors(true);
|
||||
if(selected.Count == 0 && highlighted != null && !highlighted.IsDisposed)
|
||||
selected.Add(highlighted);
|
||||
|
||||
if(selected.Count == 0) {
|
||||
General.Interface.DisplayStatus(StatusType.Warning, "This action requires a selection!");
|
||||
return;
|
||||
}
|
||||
|
||||
// Make undo
|
||||
General.Interface.DisplayStatus(StatusType.Action, "Raised floor heights by 8mp.");
|
||||
General.Map.UndoRedo.CreateUndo("Floor heights change", this, UndoGroup.FloorHeightChange, CreateSelectionCRC());
|
||||
General.Map.UndoRedo.CreateUndo("Floor heights change", this, UndoGroup.FloorHeightChange, CreateSelectionCRC(selected));
|
||||
|
||||
// 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;
|
||||
}
|
||||
|
@ -1808,12 +1836,21 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
// Change heights
|
||||
[BeginAction("lowerceiling8")]
|
||||
public void LowerCeilings8() {
|
||||
// Get selection
|
||||
ICollection<Sector> selected = General.Map.Map.GetSelectedSectors(true);
|
||||
if((selected.Count == 0) && (highlighted != null) && !highlighted.IsDisposed)
|
||||
selected.Add(highlighted);
|
||||
|
||||
if(selected.Count == 0) {
|
||||
General.Interface.DisplayStatus(StatusType.Warning, "This action requires a selection!");
|
||||
return;
|
||||
}
|
||||
|
||||
// Make undo
|
||||
General.Interface.DisplayStatus(StatusType.Action, "Lowered ceiling heights by 8mp.");
|
||||
General.Map.UndoRedo.CreateUndo("Ceiling heights change", this, UndoGroup.CeilingHeightChange, CreateSelectionCRC());
|
||||
General.Map.UndoRedo.CreateUndo("Ceiling heights change", this, UndoGroup.CeilingHeightChange, CreateSelectionCRC(selected));
|
||||
|
||||
// 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;
|
||||
}
|
||||
|
@ -1826,12 +1863,21 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
// Change heights
|
||||
[BeginAction("raiseceiling8")]
|
||||
public void RaiseCeilings8() {
|
||||
// Get selection
|
||||
ICollection<Sector> selected = General.Map.Map.GetSelectedSectors(true);
|
||||
if(selected.Count == 0 && highlighted != null && !highlighted.IsDisposed)
|
||||
selected.Add(highlighted);
|
||||
|
||||
if(selected.Count == 0) {
|
||||
General.Interface.DisplayStatus(StatusType.Warning, "This action requires a selection!");
|
||||
return;
|
||||
}
|
||||
|
||||
// Make undo
|
||||
General.Interface.DisplayStatus(StatusType.Action, "Raised ceiling heights by 8mp.");
|
||||
General.Map.UndoRedo.CreateUndo("Ceiling heights change", this, UndoGroup.CeilingHeightChange, CreateSelectionCRC());
|
||||
General.Map.UndoRedo.CreateUndo("Ceiling heights change", this, UndoGroup.CeilingHeightChange, CreateSelectionCRC(selected));
|
||||
|
||||
// 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;
|
||||
}
|
||||
|
@ -1844,12 +1890,21 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
//mxd. Raise brightness
|
||||
[BeginAction("raisebrightness8")]
|
||||
public void RaiseBrightness8() {
|
||||
// Get selection
|
||||
ICollection<Sector> selected = General.Map.Map.GetSelectedSectors(true);
|
||||
if((selected.Count == 0) && (highlighted != null) && !highlighted.IsDisposed)
|
||||
selected.Add(highlighted);
|
||||
|
||||
if(selected.Count == 0) {
|
||||
General.Interface.DisplayStatus(StatusType.Warning, "This action requires a selection!");
|
||||
return;
|
||||
}
|
||||
|
||||
// Make undo
|
||||
General.Interface.DisplayStatus(StatusType.Action, "Raised sector brightness by 8.");
|
||||
General.Map.UndoRedo.CreateUndo("Sector brightness change", this, UndoGroup.SectorBrightnessChange, CreateSelectionCRC());
|
||||
General.Map.UndoRedo.CreateUndo("Sector brightness change", this, UndoGroup.SectorBrightnessChange, CreateSelectionCRC(selected));
|
||||
|
||||
// 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.Brightness = General.Map.Config.BrightnessLevels.GetNextHigher(s.Brightness);
|
||||
s.UpdateNeeded = true;
|
||||
|
@ -1867,13 +1922,21 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
//mxd. Lower brightness
|
||||
[BeginAction("lowerbrightness8")]
|
||||
public void LowerBrightness8() {
|
||||
// Get selection
|
||||
ICollection<Sector> selected = General.Map.Map.GetSelectedSectors(true);
|
||||
if(selected.Count == 0 && highlighted != null && !highlighted.IsDisposed)
|
||||
selected.Add(highlighted);
|
||||
|
||||
if (selected.Count == 0) {
|
||||
General.Interface.DisplayStatus(StatusType.Warning, "This action requires a selection!");
|
||||
return;
|
||||
}
|
||||
|
||||
// Make undo
|
||||
General.Interface.DisplayStatus(StatusType.Action, "Lowered sector brightness by 8.");
|
||||
General.Map.UndoRedo.CreateUndo("Sector brightness change", this, UndoGroup.SectorBrightnessChange, CreateSelectionCRC());
|
||||
General.Map.UndoRedo.CreateUndo("Sector brightness change", this, UndoGroup.SectorBrightnessChange, CreateSelectionCRC(selected));
|
||||
|
||||
// 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.Brightness = General.Map.Config.BrightnessLevels.GetNextLower(s.Brightness);
|
||||
s.UpdateNeeded = true;
|
||||
|
@ -1936,6 +1999,87 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
|
||||
placeThingsAtPositions(positions);
|
||||
}
|
||||
|
||||
//mxd. rotate clockwise
|
||||
[BeginAction("rotateclockwise")]
|
||||
public void RotateCW() {
|
||||
rotateTextures(5);
|
||||
}
|
||||
|
||||
//mxd. rotate counterclockwise
|
||||
[BeginAction("rotatecounterclockwise")]
|
||||
public void RotateCCW() {
|
||||
rotateTextures(-5);
|
||||
}
|
||||
|
||||
//mxd
|
||||
private void rotateTextures(float increment) {
|
||||
if (!General.Map.UDMF) {
|
||||
General.Interface.DisplayStatus(StatusType.Warning, "This action works only in UDMF map format!");
|
||||
return;
|
||||
}
|
||||
|
||||
// Make list of selected sectors
|
||||
ICollection<Sector> sectors = General.Map.Map.GetSelectedSectors(true);
|
||||
|
||||
if(sectors.Count == 0 && highlighted != null && !highlighted.IsDisposed)
|
||||
sectors.Add(highlighted);
|
||||
|
||||
if(sectors.Count == 0) {
|
||||
General.Interface.DisplayStatus(StatusType.Warning, "This action requires a selection!");
|
||||
return;
|
||||
}
|
||||
|
||||
string targets;
|
||||
string target;
|
||||
switch (General.Map.Renderer2D.ViewMode) {
|
||||
case ViewMode.FloorTextures:
|
||||
target = " a floor";
|
||||
targets = " floors";
|
||||
break;
|
||||
|
||||
case ViewMode.CeilingTextures:
|
||||
target = " a ceiling";
|
||||
targets = " ceilings";
|
||||
break;
|
||||
|
||||
default:
|
||||
target = " a floor and a ceiling";
|
||||
targets = " floors and ceilings";
|
||||
break;
|
||||
}
|
||||
|
||||
// Make undo
|
||||
if(sectors.Count > 1) {
|
||||
General.Map.UndoRedo.CreateUndo("Rotate " + sectors.Count + targets, this, UndoGroup.TextureRotationChange, CreateSelectionCRC(sectors));
|
||||
General.Interface.DisplayStatus(StatusType.Action, "Rotated " + sectors.Count + targets + ".");
|
||||
} else {
|
||||
General.Map.UndoRedo.CreateUndo("Rotate" + target, this, UndoGroup.TextureRotationChange, CreateSelectionCRC(sectors));
|
||||
General.Interface.DisplayStatus(StatusType.Action, "Rotated" + target + ".");
|
||||
}
|
||||
|
||||
//rotate stuff
|
||||
foreach (Sector s in sectors) {
|
||||
s.Fields.BeforeFieldsChange();
|
||||
|
||||
//floor
|
||||
if(General.Map.Renderer2D.ViewMode == ViewMode.FloorTextures || General.Map.Renderer2D.ViewMode != ViewMode.CeilingTextures) {
|
||||
UDMFTools.SetFloat(s.Fields, "rotationfloor", General.ClampAngle(UDMFTools.GetFloat(s.Fields, "rotationfloor") + increment));
|
||||
s.UpdateNeeded = true;
|
||||
}
|
||||
|
||||
//ceiling
|
||||
if(General.Map.Renderer2D.ViewMode == ViewMode.CeilingTextures || General.Map.Renderer2D.ViewMode != ViewMode.FloorTextures) {
|
||||
UDMFTools.SetFloat(s.Fields, "rotationceiling", General.ClampAngle(UDMFTools.GetFloat(s.Fields, "rotationceiling") + increment));
|
||||
s.UpdateNeeded = true;
|
||||
}
|
||||
}
|
||||
|
||||
// Redraw screen
|
||||
General.Map.Map.Update();
|
||||
General.Interface.RedrawDisplay();
|
||||
General.Interface.RefreshInfo();
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
|
|
@ -73,6 +73,27 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
|
||||
#region ================== Methods
|
||||
|
||||
//mxd. This makes a CRC for the selection
|
||||
public int CreateSelectionCRC() {
|
||||
CRC crc = new CRC();
|
||||
ICollection<Thing> orderedselection = General.Map.Map.GetSelectedThings(true);
|
||||
crc.Add(orderedselection.Count);
|
||||
foreach(Thing t in orderedselection) {
|
||||
crc.Add(t.Index);
|
||||
}
|
||||
return (int)(crc.Value & 0xFFFFFFFF);
|
||||
}
|
||||
|
||||
//mxd. This makes a CRC for given selection
|
||||
public int CreateSelectionCRC(ICollection<Thing> selection) {
|
||||
CRC crc = new CRC();
|
||||
crc.Add(selection.Count);
|
||||
foreach(Thing t in selection) {
|
||||
crc.Add(t.Index);
|
||||
}
|
||||
return (int)(crc.Value & 0xFFFFFFFF);
|
||||
}
|
||||
|
||||
public override void OnHelp()
|
||||
{
|
||||
General.ShowHelp("e_things.html");
|
||||
|
@ -932,11 +953,49 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
}
|
||||
}
|
||||
|
||||
// Update cache values
|
||||
General.Map.IsChanged = true;
|
||||
// Redraw screen
|
||||
General.Interface.RedrawDisplay();
|
||||
}
|
||||
|
||||
//mxd. rotate clockwise
|
||||
[BeginAction("rotateclockwise")]
|
||||
public void RotateCW() {
|
||||
rotateThings(-5);
|
||||
}
|
||||
|
||||
//mxd. rotate counterclockwise
|
||||
[BeginAction("rotatecounterclockwise")]
|
||||
public void RotateCCW() {
|
||||
rotateThings(5);
|
||||
}
|
||||
|
||||
//mxd
|
||||
private void rotateThings(int increment) {
|
||||
// Make list of selected things
|
||||
List<Thing> selected = new List<Thing>(General.Map.Map.GetSelectedThings(true));
|
||||
if(selected.Count == 0 && highlighted != null && !highlighted.IsDisposed)
|
||||
selected.Add(highlighted);
|
||||
|
||||
if(selected.Count == 0) {
|
||||
General.Interface.DisplayStatus(StatusType.Warning, "This action requires a selection!");
|
||||
return;
|
||||
}
|
||||
|
||||
// Make undo
|
||||
if(selected.Count > 1) {
|
||||
General.Map.UndoRedo.CreateUndo("Rotate " + selected.Count + " things", this, UndoGroup.ThingRotate, CreateSelectionCRC(selected));
|
||||
General.Interface.DisplayStatus(StatusType.Action, "Rotated " + selected.Count + " things.");
|
||||
} else {
|
||||
General.Map.UndoRedo.CreateUndo("Rotate thing", this, UndoGroup.ThingRotate, CreateSelectionCRC(selected));
|
||||
General.Interface.DisplayStatus(StatusType.Action, "Rotated a thing.");
|
||||
}
|
||||
|
||||
//change angle
|
||||
foreach(Thing t in selected) t.Rotate(General.ClampAngle(t.AngleDoom + increment));
|
||||
|
||||
// Redraw screen
|
||||
General.Interface.RedrawDisplay();
|
||||
General.Interface.RefreshInfo();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
|
|
@ -20,17 +20,18 @@
|
|||
|
||||
namespace CodeImp.DoomBuilder.BuilderModes
|
||||
{
|
||||
public class UndoGroup
|
||||
public static class UndoGroup
|
||||
{
|
||||
public const int None = 0;
|
||||
public const int FloorHeightChange = 1;
|
||||
public const int CeilingHeightChange = 2;
|
||||
public const int SectorBrightnessChange = 3;
|
||||
public const int TextureOffsetChange = 4;
|
||||
public const int SectorHeightChange = 5;
|
||||
public const int ThingMove = 6; //mxd
|
||||
public const int ThingRotate = 7; //mxd
|
||||
public const int SurfaceBrightnessChange = 8; //mxd
|
||||
public const int TextureScaleChange = 9; //mxd
|
||||
public const int TextureRotationChange = 5; //mxd
|
||||
public const int TextureScaleChange = 6; //mxd
|
||||
public const int SurfaceBrightnessChange = 7; //mxd
|
||||
public const int SectorHeightChange = 8;
|
||||
public const int ThingMove = 9; //mxd
|
||||
public const int ThingRotate = 10; //mxd
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1098,11 +1098,11 @@ flipselectionh
|
|||
}
|
||||
|
||||
//mxd
|
||||
rotatethingscw
|
||||
rotateclockwise
|
||||
{
|
||||
title = "Rotate Clockwise";
|
||||
category = "visual";
|
||||
description = "Rotates selected things clockwise. Also rotates floor/ceiling textures in UDMF map format.";
|
||||
category = "edit";
|
||||
description = "Rotates selected or highlighted things clockwise. Also rotates floor/ceiling textures in UDMF map format.";
|
||||
allowkeys = true;
|
||||
allowmouse = false;
|
||||
allowscroll = true;
|
||||
|
@ -1111,11 +1111,11 @@ rotatethingscw
|
|||
}
|
||||
|
||||
//mxd
|
||||
rotatethingsccw
|
||||
rotatecounterclockwise
|
||||
{
|
||||
title = "Rotate Counterclockwise";
|
||||
category = "visual";
|
||||
description = "Rotates selected things counterclockwise. Also rotates floor/ceiling textures in UDMF map format.";
|
||||
category = "edit";
|
||||
description = "Rotates selected or highlighted things counterclockwise. Also rotates floor/ceiling textures in UDMF map format.";
|
||||
allowkeys = true;
|
||||
allowmouse = false;
|
||||
allowscroll = true;
|
||||
|
|
|
@ -2777,13 +2777,13 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
}
|
||||
|
||||
//mxd. rotate clockwise
|
||||
[BeginAction("rotatethingscw")]
|
||||
[BeginAction("rotateclockwise")]
|
||||
public void RotateCW() {
|
||||
rotateThingsAndTextures(5);
|
||||
}
|
||||
|
||||
//mxd. rotate counterclockwise
|
||||
[BeginAction("rotatethingsccw")]
|
||||
[BeginAction("rotatecounterclockwise")]
|
||||
public void RotateCCW() {
|
||||
rotateThingsAndTextures(-5);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue