mirror of
https://git.do.srb2.org/STJr/UltimateZoneBuilder.git
synced 2024-11-23 04:12:12 +00:00
Added "Select Things in Selected Sectors" action.
This commit is contained in:
parent
817cb2a7a4
commit
23efaee1ee
4 changed files with 57 additions and 6 deletions
|
@ -79,7 +79,6 @@ namespace CodeImp.DoomBuilder.ZDoom
|
|||
props = new Dictionary<string, List<string>>();
|
||||
states = new Dictionary<string, StateStructure>();
|
||||
userVars = new List<string>();//mxd
|
||||
bool haveBaseClass = false;//mxd
|
||||
|
||||
// Always define a game property, but default to 0 values
|
||||
props["game"] = new List<string>();
|
||||
|
@ -107,7 +106,6 @@ namespace CodeImp.DoomBuilder.ZDoom
|
|||
token = token.ToLowerInvariant();
|
||||
if(token == ":")
|
||||
{
|
||||
haveBaseClass = true; //mxd
|
||||
// The next token must be the class to inherit from
|
||||
parser.SkipWhitespace(true);
|
||||
inheritclass = parser.StripTokenQuotes(parser.ReadToken());
|
||||
|
@ -359,7 +357,7 @@ namespace CodeImp.DoomBuilder.ZDoom
|
|||
}
|
||||
|
||||
//mxd. Check if baseclass is valid
|
||||
if(haveBaseClass && doomednum > -1 && baseclass == null) {
|
||||
if(inheritclass != "actor" && doomednum > -1 && baseclass == null) {
|
||||
//check if this class inherits from a class defined in game configuration
|
||||
Dictionary<int, ThingTypeInfo> things = General.Map.Config.GetThingTypes();
|
||||
inheritclass = inheritclass.ToLowerInvariant();
|
||||
|
|
|
@ -911,6 +911,36 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
// Redraw screen
|
||||
General.Interface.RedrawDisplay();
|
||||
}
|
||||
|
||||
//mxd
|
||||
[BeginAction("thingsselectinsectors")]
|
||||
public void SelectThingsInSelectedSectors() {
|
||||
General.Map.Map.ConvertSelection(SelectionType.Sectors);
|
||||
|
||||
if(General.Map.Map.SelectedSectorsCount == 0) {
|
||||
General.Interface.DisplayStatus(StatusType.Warning, "No Sectors are Selected!");
|
||||
General.Map.Map.ConvertSelection(SelectionType.Linedefs);
|
||||
return;
|
||||
}
|
||||
|
||||
int selectedCount = 0;
|
||||
ICollection<Sector> sectors = General.Map.Map.GetSelectedSectors(true);
|
||||
|
||||
foreach(Thing t in General.Map.Map.Things) {
|
||||
t.DetermineSector();
|
||||
|
||||
if(!t.Selected && t.Sector != null && sectors.Contains(t.Sector)) {
|
||||
t.Selected = true;
|
||||
selectedCount++;
|
||||
}
|
||||
}
|
||||
|
||||
General.Interface.DisplayStatus(StatusType.Info, "Selected " + selectedCount + (selectedCount == 1 ? " Thing" : " Things"));
|
||||
General.Map.Map.ConvertSelection(SelectionType.Linedefs);
|
||||
|
||||
// Redraw screen
|
||||
General.Interface.RedrawDisplay();
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
|
|
@ -63,6 +63,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
this.buttonMarqueSelectTouching = new System.Windows.Forms.ToolStripButton();
|
||||
this.buttonAlignThingsToWall = new System.Windows.Forms.ToolStripButton();
|
||||
this.buttonTextureOffsetLock = new System.Windows.Forms.ToolStripButton();
|
||||
this.selectInSectorsItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.menustrip.SuspendLayout();
|
||||
this.manualstrip.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
|
@ -195,7 +196,8 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
//
|
||||
this.thingsmenu.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.alignToWallItem,
|
||||
this.pointAtCursorItem});
|
||||
this.pointAtCursorItem,
|
||||
this.selectInSectorsItem});
|
||||
this.thingsmenu.Name = "thingsmenu";
|
||||
this.thingsmenu.Size = new System.Drawing.Size(55, 20);
|
||||
this.thingsmenu.Text = "Things";
|
||||
|
@ -205,7 +207,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
//
|
||||
this.alignToWallItem.Image = global::CodeImp.DoomBuilder.BuilderModes.Properties.Resources.AlignThings;
|
||||
this.alignToWallItem.Name = "alignToWallItem";
|
||||
this.alignToWallItem.Size = new System.Drawing.Size(202, 22);
|
||||
this.alignToWallItem.Size = new System.Drawing.Size(245, 22);
|
||||
this.alignToWallItem.Tag = "thingaligntowall";
|
||||
this.alignToWallItem.Text = "&Align To Closest Linedef";
|
||||
this.alignToWallItem.Click += new System.EventHandler(this.InvokeTaggedAction);
|
||||
|
@ -214,7 +216,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
//
|
||||
this.pointAtCursorItem.Image = global::CodeImp.DoomBuilder.BuilderModes.Properties.Resources.ThingPointAtCursor;
|
||||
this.pointAtCursorItem.Name = "pointAtCursorItem";
|
||||
this.pointAtCursorItem.Size = new System.Drawing.Size(202, 22);
|
||||
this.pointAtCursorItem.Size = new System.Drawing.Size(245, 22);
|
||||
this.pointAtCursorItem.Tag = "thinglookatcursor";
|
||||
this.pointAtCursorItem.Text = "&Point at Cursor";
|
||||
this.pointAtCursorItem.Click += new System.EventHandler(this.InvokeTaggedAction);
|
||||
|
@ -406,6 +408,14 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
"tant while sector is dragged\r\n";
|
||||
this.buttonTextureOffsetLock.Click += new System.EventHandler(this.buttonTextureOffsetLock_Click);
|
||||
//
|
||||
// selectInSectorsItem
|
||||
//
|
||||
this.selectInSectorsItem.Name = "selectInSectorsItem";
|
||||
this.selectInSectorsItem.Size = new System.Drawing.Size(245, 22);
|
||||
this.selectInSectorsItem.Tag = "thingsselectinsectors";
|
||||
this.selectInSectorsItem.Text = "&Select Things in Selected Sectors";
|
||||
this.selectInSectorsItem.Click += new System.EventHandler(this.InvokeTaggedAction);
|
||||
//
|
||||
// MenusForm
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
|
||||
|
@ -469,5 +479,6 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
private System.Windows.Forms.ToolStripButton buttonAlignThingsToWall;
|
||||
private System.Windows.Forms.ToolStripMenuItem pointAtCursorItem;
|
||||
private System.Windows.Forms.ToolStripButton buttonTextureOffsetLock;
|
||||
private System.Windows.Forms.ToolStripMenuItem selectInSectorsItem;
|
||||
}
|
||||
}
|
|
@ -347,6 +347,18 @@ thinglookatcursor
|
|||
default = 65612; //Shift-L
|
||||
}
|
||||
|
||||
//mxd
|
||||
thingsselectinsectors
|
||||
{
|
||||
title = "Select Things in Selected Sectors";
|
||||
category = "things";
|
||||
description = "Selects Things in Selected Sectors.";
|
||||
allowkeys = true;
|
||||
allowmouse = true;
|
||||
allowscroll = false;
|
||||
default = 65620; //Shift-T
|
||||
}
|
||||
|
||||
makesectormode
|
||||
{
|
||||
title = "Make Sector Mode";
|
||||
|
|
Loading…
Reference in a new issue