mirror of
https://git.do.srb2.org/STJr/UltimateZoneBuilder.git
synced 2025-01-18 14:31:50 +00:00
- things filters! (filtering by fields doesn't work yet, will complete that when UDMF has been implemented)
- several bug fixes
This commit is contained in:
parent
e99e72e705
commit
dc158d2407
33 changed files with 1288 additions and 88 deletions
|
@ -80,6 +80,8 @@
|
|||
<Compile Include="Editing\EditModeAttribute.cs" />
|
||||
<Compile Include="Editing\EditModeInfo.cs" />
|
||||
<Compile Include="Editing\GridSetup.cs" />
|
||||
<Compile Include="Editing\NullThingsFilter.cs" />
|
||||
<Compile Include="Editing\ThingsFilter.cs" />
|
||||
<Compile Include="Editing\UndoGroup.cs" />
|
||||
<Compile Include="Editing\UndoManager.cs" />
|
||||
<Compile Include="Editing\UndoSnapshot.cs" />
|
||||
|
@ -296,6 +298,12 @@
|
|||
<Compile Include="Interface\ThingInfoPanel.Designer.cs">
|
||||
<DependentUpon>ThingInfoPanel.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Interface\ThingsFiltersForm.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Interface\ThingsFiltersForm.Designer.cs">
|
||||
<DependentUpon>ThingsFiltersForm.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Interface\VertexInfoPanel.cs">
|
||||
<SubType>UserControl</SubType>
|
||||
</Compile>
|
||||
|
@ -546,6 +554,10 @@
|
|||
<SubType>Designer</SubType>
|
||||
<DependentUpon>ThingEditForm.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Interface\ThingsFiltersForm.resx">
|
||||
<SubType>Designer</SubType>
|
||||
<DependentUpon>ThingsFiltersForm.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Resources\Font.png" />
|
||||
<EmbeddedResource Include="Resources\Thing2D_3.png" />
|
||||
<EmbeddedResource Include="Resources\Thing2D_2.png" />
|
||||
|
|
|
@ -110,7 +110,8 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
// Render things
|
||||
if(renderer.StartThings(true))
|
||||
{
|
||||
renderer.RenderThingSet(General.Map.Map.Things);
|
||||
renderer.RenderThingSet(General.Map.ThingsFilter.HiddenThings, Presentation.THINGS_HIDDEN_ALPHA);
|
||||
renderer.RenderThingSet(General.Map.ThingsFilter.VisibleThings, 1.0f);
|
||||
renderer.Finish();
|
||||
}
|
||||
|
||||
|
|
|
@ -240,7 +240,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
// Render things
|
||||
if(renderer.StartThings(true))
|
||||
{
|
||||
renderer.RenderThingSet(General.Map.Map.Things);
|
||||
renderer.RenderThingSet(General.Map.Map.Things, 1.0f);
|
||||
renderer.Finish();
|
||||
}
|
||||
|
||||
|
|
|
@ -155,7 +155,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
// Start rendering things
|
||||
if(renderer.StartThings(true))
|
||||
{
|
||||
renderer.RenderThingSet(General.Map.Map.Things);
|
||||
renderer.RenderThingSet(General.Map.Map.Things, 1.0f);
|
||||
renderer.Finish();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -161,7 +161,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
{
|
||||
if(renderer.StartThings(true))
|
||||
{
|
||||
renderer.RenderThingSet(General.Map.Map.Things);
|
||||
renderer.RenderThingSet(General.Map.Map.Things, 1.0f);
|
||||
renderer.Finish();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -108,7 +108,8 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
|
||||
// Get selected things
|
||||
selectedthings = General.Map.Map.GetMarkedThings(true);
|
||||
unselectedthings = General.Map.Map.GetMarkedThings(false);
|
||||
unselectedthings = new List<Thing>();
|
||||
foreach(Thing t in General.Map.ThingsFilter.VisibleThings) if(!t.Marked) unselectedthings.Add(t);
|
||||
|
||||
// Get the nearest thing for snapping
|
||||
dragitem = MapSet.NearestThing(selectedthings, dragstartmappos);
|
||||
|
@ -232,13 +233,14 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
if(renderer.StartThings(true))
|
||||
{
|
||||
// Render things
|
||||
renderer.RenderThingSet(unselectedthings);
|
||||
renderer.RenderThingSet(selectedthings);
|
||||
renderer.RenderThingSet(General.Map.ThingsFilter.HiddenThings, Presentation.THINGS_HIDDEN_ALPHA);
|
||||
renderer.RenderThingSet(unselectedthings, 1.0f);
|
||||
renderer.RenderThingSet(selectedthings, 1.0f);
|
||||
|
||||
// Draw the dragged item highlighted
|
||||
// This is important to know, because this item is used
|
||||
// for snapping to the grid and snapping to nearest items
|
||||
renderer.RenderThing(dragitem, General.Colors.Highlight);
|
||||
renderer.RenderThing(dragitem, General.Colors.Highlight, 1.0f);
|
||||
|
||||
// Done
|
||||
renderer.Finish();
|
||||
|
|
|
@ -137,7 +137,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
{
|
||||
if(renderer.StartThings(true))
|
||||
{
|
||||
renderer.RenderThingSet(General.Map.Map.Things);
|
||||
renderer.RenderThingSet(General.Map.Map.Things, 1.0f);
|
||||
renderer.Finish();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -611,7 +611,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
// Render things
|
||||
if(renderer.StartThings(true))
|
||||
{
|
||||
renderer.RenderThingSet(General.Map.Map.Things);
|
||||
renderer.RenderThingSet(General.Map.Map.Things, 1.0f);
|
||||
renderer.Finish();
|
||||
}
|
||||
|
||||
|
|
|
@ -144,7 +144,8 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
// Render things
|
||||
if(renderer.StartThings(true))
|
||||
{
|
||||
renderer.RenderThingSet(General.Map.Map.Things);
|
||||
renderer.RenderThingSet(General.Map.ThingsFilter.HiddenThings, Presentation.THINGS_HIDDEN_ALPHA);
|
||||
renderer.RenderThingSet(General.Map.ThingsFilter.VisibleThings, 1.0f);
|
||||
renderer.Finish();
|
||||
}
|
||||
|
||||
|
|
|
@ -205,7 +205,8 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
// Render things
|
||||
if(renderer.StartThings(true))
|
||||
{
|
||||
renderer.RenderThingSet(General.Map.Map.Things);
|
||||
renderer.RenderThingSet(General.Map.ThingsFilter.HiddenThings, Presentation.THINGS_HIDDEN_ALPHA);
|
||||
renderer.RenderThingSet(General.Map.ThingsFilter.VisibleThings, 1.0f);
|
||||
renderer.Finish();
|
||||
}
|
||||
|
||||
|
|
|
@ -46,7 +46,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
#region ================== Constants
|
||||
|
||||
public const float THING_HIGHLIGHT_RANGE = 10f;
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
#region ================== Variables
|
||||
|
@ -126,9 +126,10 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
// Render things
|
||||
if(renderer.StartThings(true))
|
||||
{
|
||||
renderer.RenderThingSet(General.Map.Map.Things);
|
||||
renderer.RenderThingSet(General.Map.ThingsFilter.HiddenThings, Presentation.THINGS_HIDDEN_ALPHA);
|
||||
renderer.RenderThingSet(General.Map.ThingsFilter.VisibleThings, 1.0f);
|
||||
if((highlighted != null) && !highlighted.IsDisposed)
|
||||
renderer.RenderThing(highlighted, General.Colors.Highlight);
|
||||
renderer.RenderThing(highlighted, General.Colors.Highlight, 1.0f);
|
||||
renderer.Finish();
|
||||
}
|
||||
|
||||
|
@ -154,14 +155,14 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
{
|
||||
// Undraw previous highlight
|
||||
if((highlighted != null) && !highlighted.IsDisposed)
|
||||
renderer.RenderThing(highlighted, renderer.DetermineThingColor(highlighted));
|
||||
renderer.RenderThing(highlighted, renderer.DetermineThingColor(highlighted), 1.0f);
|
||||
|
||||
// Set new highlight
|
||||
highlighted = t;
|
||||
|
||||
// Render highlighted item
|
||||
if((highlighted != null) && !highlighted.IsDisposed)
|
||||
renderer.RenderThing(highlighted, General.Colors.Highlight);
|
||||
renderer.RenderThing(highlighted, General.Colors.Highlight, 1.0f);
|
||||
|
||||
// Done
|
||||
renderer.Finish();
|
||||
|
@ -188,7 +189,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
if(renderer.StartThings(false))
|
||||
{
|
||||
// Redraw highlight to show selection
|
||||
renderer.RenderThing(highlighted, renderer.DetermineThingColor(highlighted));
|
||||
renderer.RenderThing(highlighted, renderer.DetermineThingColor(highlighted), 1.0f);
|
||||
renderer.Finish();
|
||||
renderer.Present();
|
||||
}
|
||||
|
@ -215,7 +216,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
if(renderer.StartThings(false))
|
||||
{
|
||||
// Render highlighted item
|
||||
renderer.RenderThing(highlighted, General.Colors.Highlight);
|
||||
renderer.RenderThing(highlighted, General.Colors.Highlight, 1.0f);
|
||||
renderer.Finish();
|
||||
renderer.Present();
|
||||
}
|
||||
|
@ -247,7 +248,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
if(renderer.StartThings(false))
|
||||
{
|
||||
// Redraw highlight to show selection
|
||||
renderer.RenderThing(highlighted, renderer.DetermineThingColor(highlighted));
|
||||
renderer.RenderThing(highlighted, renderer.DetermineThingColor(highlighted), 1.0f);
|
||||
renderer.Finish();
|
||||
renderer.Present();
|
||||
}
|
||||
|
@ -272,6 +273,9 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
// When a single thing was selected, deselect it now
|
||||
if(selected.Count == 1) General.Map.Map.ClearSelectedThings();
|
||||
|
||||
// Update things filter
|
||||
General.Map.ThingsFilter.Update();
|
||||
|
||||
// Update entire display
|
||||
General.Interface.RedrawDisplay();
|
||||
}
|
||||
|
@ -290,8 +294,8 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
if(e.Button == MouseButtons.None)
|
||||
{
|
||||
// Find the nearest vertex within highlight range
|
||||
Thing t = General.Map.Map.NearestThingSquareRange(mousemappos, THING_HIGHLIGHT_RANGE / renderer.Scale);
|
||||
|
||||
Thing t = MapSet.NearestThingSquareRange(General.Map.ThingsFilter.VisibleThings, mousemappos, THING_HIGHLIGHT_RANGE / renderer.Scale);
|
||||
|
||||
// Highlight if not the same
|
||||
if(t != highlighted) Highlight(t);
|
||||
}
|
||||
|
@ -335,7 +339,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
protected override void OnEndMultiSelection()
|
||||
{
|
||||
// Go for all things
|
||||
foreach(Thing t in General.Map.Map.Things)
|
||||
foreach(Thing t in General.Map.ThingsFilter.VisibleThings)
|
||||
{
|
||||
t.Selected = ((t.Position.x >= selectionrect.Left) &&
|
||||
(t.Position.y >= selectionrect.Top) &&
|
||||
|
|
|
@ -145,7 +145,8 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
// Render things
|
||||
if(renderer.StartThings(true))
|
||||
{
|
||||
renderer.RenderThingSet(General.Map.Map.Things);
|
||||
renderer.RenderThingSet(General.Map.ThingsFilter.HiddenThings, Presentation.THINGS_HIDDEN_ALPHA);
|
||||
renderer.RenderThingSet(General.Map.ThingsFilter.VisibleThings, 1.0f);
|
||||
renderer.Finish();
|
||||
}
|
||||
|
||||
|
|
|
@ -142,7 +142,7 @@ namespace CodeImp.DoomBuilder.BuilderModes.Editing
|
|||
// Render things
|
||||
if(renderer.StartThings(true))
|
||||
{
|
||||
renderer.RenderThingSet(General.Map.Map.Things);
|
||||
renderer.RenderThingSet(General.Map.Map.Things, 1.0f);
|
||||
if((highlighted != null) && (highlighted is Thing)) DrawHighlight(true);
|
||||
renderer.Finish();
|
||||
}
|
||||
|
@ -180,7 +180,7 @@ namespace CodeImp.DoomBuilder.BuilderModes.Editing
|
|||
else if(highlighted is Thing)
|
||||
{
|
||||
if((highlighted as Thing).IsDisposed) return;
|
||||
renderer.RenderThing((highlighted as Thing), General.Colors.Highlight);
|
||||
renderer.RenderThing((highlighted as Thing), General.Colors.Highlight, 1.0f);
|
||||
}
|
||||
}
|
||||
// With original color
|
||||
|
@ -210,7 +210,7 @@ namespace CodeImp.DoomBuilder.BuilderModes.Editing
|
|||
else if(highlighted is Thing)
|
||||
{
|
||||
if((highlighted as Thing).IsDisposed) return;
|
||||
renderer.RenderThing((highlighted as Thing), renderer.DetermineThingColor((highlighted as Thing)));
|
||||
renderer.RenderThing((highlighted as Thing), renderer.DetermineThingColor((highlighted as Thing)), 1.0f);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,6 +24,7 @@ using System.Text;
|
|||
using CodeImp.DoomBuilder.IO;
|
||||
using CodeImp.DoomBuilder.Data;
|
||||
using System.IO;
|
||||
using CodeImp.DoomBuilder.Editing;
|
||||
|
||||
#endregion
|
||||
|
||||
|
@ -42,6 +43,7 @@ namespace CodeImp.DoomBuilder.Config
|
|||
private DataLocationList resources;
|
||||
private string testprogram;
|
||||
private string testparameters;
|
||||
private List<ThingsFilter> thingsfilters;
|
||||
|
||||
#endregion
|
||||
|
||||
|
@ -55,6 +57,7 @@ namespace CodeImp.DoomBuilder.Config
|
|||
public DataLocationList Resources { get { return resources; } }
|
||||
public string TestProgram { get { return testprogram; } set { testprogram = value; } }
|
||||
public string TestParameters { get { return testparameters; } set { testparameters = value; } }
|
||||
internal ICollection<ThingsFilter> ThingsFilters { get { return thingsfilters; } }
|
||||
|
||||
#endregion
|
||||
|
||||
|
@ -77,6 +80,14 @@ namespace CodeImp.DoomBuilder.Config
|
|||
this.testprogram = General.Settings.ReadSetting("configurations." + settingskey + ".testprogram", "");
|
||||
this.testparameters = General.Settings.ReadSetting("configurations." + settingskey + ".testparameters", "");
|
||||
this.resources = new DataLocationList(General.Settings.Config, "configurations." + settingskey + ".resources");
|
||||
|
||||
// Make list of things filters
|
||||
thingsfilters = new List<ThingsFilter>();
|
||||
IDictionary cfgfilters = General.Settings.ReadSetting("configurations." + settingskey + ".thingsfilters", new Hashtable());
|
||||
foreach(DictionaryEntry de in cfgfilters)
|
||||
{
|
||||
thingsfilters.Add(new ThingsFilter(General.Settings.Config, "configurations." + settingskey + ".thingsfilters." + de.Key));
|
||||
}
|
||||
}
|
||||
|
||||
// Constructor
|
||||
|
@ -104,6 +115,13 @@ namespace CodeImp.DoomBuilder.Config
|
|||
General.Settings.WriteSetting("configurations." + settingskey + ".testprogram", testprogram);
|
||||
General.Settings.WriteSetting("configurations." + settingskey + ".testparameters", testparameters);
|
||||
resources.WriteToConfig(General.Settings.Config, "configurations." + settingskey + ".resources");
|
||||
|
||||
// Write filters to configuration
|
||||
for(int i = 0; i < thingsfilters.Count; i++)
|
||||
{
|
||||
thingsfilters[i].WriteSettings(General.Settings.Config,
|
||||
"configurations." + settingskey + ".thingsfilters.filter" + i.ToString(CultureInfo.InvariantCulture));
|
||||
}
|
||||
}
|
||||
|
||||
// String representation
|
||||
|
|
|
@ -29,6 +29,7 @@ using System.Windows.Forms;
|
|||
using CodeImp.DoomBuilder.Map;
|
||||
using System.Reflection;
|
||||
using CodeImp.DoomBuilder.Plugins;
|
||||
using CodeImp.DoomBuilder.Editing;
|
||||
|
||||
#endregion
|
||||
|
||||
|
@ -55,7 +56,7 @@ namespace CodeImp.DoomBuilder.Config
|
|||
private int imagebrightness;
|
||||
private bool qualitydisplay;
|
||||
private bool squarethings;
|
||||
|
||||
|
||||
// These are not stored in the configuration, only used at runtime
|
||||
private string defaulttexture;
|
||||
private int defaultbrightness = 192;
|
||||
|
|
|
@ -159,6 +159,12 @@ namespace CodeImp.DoomBuilder.Config
|
|||
// Add
|
||||
things.Add(t);
|
||||
}
|
||||
|
||||
// String representation
|
||||
public override string ToString()
|
||||
{
|
||||
return title;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
|
70
Source/Editing/NullThingsFilter.cs
Normal file
70
Source/Editing/NullThingsFilter.cs
Normal file
|
@ -0,0 +1,70 @@
|
|||
|
||||
#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.Map;
|
||||
|
||||
#endregion
|
||||
|
||||
namespace CodeImp.DoomBuilder.Editing
|
||||
{
|
||||
internal class NullThingsFilter : ThingsFilter
|
||||
{
|
||||
#region ================== Constructor / Disposer
|
||||
|
||||
// Constructor
|
||||
internal NullThingsFilter()
|
||||
{
|
||||
this.name = "(show all)";
|
||||
}
|
||||
|
||||
// Disposer
|
||||
internal override void Dispose()
|
||||
{
|
||||
// Not already disposed?
|
||||
if(!isdisposed)
|
||||
{
|
||||
// Clean up
|
||||
|
||||
// Done
|
||||
base.Dispose();
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ================== Methods
|
||||
|
||||
// This updates the lists
|
||||
public override void Update()
|
||||
{
|
||||
// Make lists
|
||||
visiblethings = new List<Thing>(General.Map.Map.Things);
|
||||
hiddenthings = new List<Thing>(0);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
262
Source/Editing/ThingsFilter.cs
Normal file
262
Source/Editing/ThingsFilter.cs
Normal file
|
@ -0,0 +1,262 @@
|
|||
|
||||
#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.Map;
|
||||
using CodeImp.DoomBuilder.IO;
|
||||
using CodeImp.DoomBuilder.Config;
|
||||
|
||||
#endregion
|
||||
|
||||
namespace CodeImp.DoomBuilder.Editing
|
||||
{
|
||||
public class ThingsFilter
|
||||
{
|
||||
#region ================== Constants
|
||||
|
||||
#endregion
|
||||
|
||||
#region ================== Variables
|
||||
|
||||
// Display name of this filter
|
||||
protected string name;
|
||||
|
||||
// Filter by category
|
||||
protected string categoryname;
|
||||
|
||||
// Filter by exact thing
|
||||
protected int thingtype;
|
||||
|
||||
// Filter by fields
|
||||
protected List<string> requiredfields;
|
||||
protected List<string> forbiddenfields;
|
||||
|
||||
// List of things
|
||||
protected List<Thing> visiblethings;
|
||||
protected List<Thing> hiddenthings;
|
||||
|
||||
// Disposing
|
||||
protected bool isdisposed = false;
|
||||
|
||||
#endregion
|
||||
|
||||
#region ================== Properties
|
||||
|
||||
internal string Name { get { return name; } set { name = value; } }
|
||||
internal string CategoryName { get { return categoryname; } set { categoryname = value; } }
|
||||
internal int ThingType { get { return thingtype; } set { thingtype = value; } }
|
||||
internal ICollection<string> RequiredFields { get { return requiredfields; } }
|
||||
internal ICollection<string> ForbiddenFields { get { return forbiddenfields; } }
|
||||
public ICollection<Thing> VisibleThings { get { return visiblethings; } }
|
||||
public ICollection<Thing> HiddenThings { get { return hiddenthings; } }
|
||||
internal bool IsDisposed { get { return isdisposed; } }
|
||||
|
||||
#endregion
|
||||
|
||||
#region ================== Constructor / Disposer
|
||||
|
||||
// Copy constructor
|
||||
internal ThingsFilter(ThingsFilter f)
|
||||
{
|
||||
// Copy
|
||||
name = f.name;
|
||||
categoryname = f.categoryname;
|
||||
thingtype = f.thingtype;
|
||||
requiredfields = new List<string>(f.requiredfields);
|
||||
forbiddenfields = new List<string>(f.forbiddenfields);
|
||||
}
|
||||
|
||||
// Constructor for filter from configuration
|
||||
internal ThingsFilter(Configuration cfg, string path)
|
||||
{
|
||||
IDictionary fields;
|
||||
|
||||
// Initialize
|
||||
requiredfields = new List<string>();
|
||||
forbiddenfields = new List<string>();
|
||||
|
||||
// Read settings from config
|
||||
name = cfg.ReadSetting(path + ".name", "Unnamed filter");
|
||||
categoryname = cfg.ReadSetting(path + ".category", "");
|
||||
thingtype = cfg.ReadSetting(path + ".type", -1);
|
||||
|
||||
// Read flags
|
||||
// key is string, value must be boolean which indicates if
|
||||
// its a required field (true) or forbidden field (false).
|
||||
fields = cfg.ReadSetting(path + ".fields", new Hashtable());
|
||||
foreach(DictionaryEntry de in fields)
|
||||
{
|
||||
// Add to the corresponding list
|
||||
if((bool)de.Value == true)
|
||||
requiredfields.Add(de.Value.ToString());
|
||||
else
|
||||
forbiddenfields.Add(de.Value.ToString());
|
||||
}
|
||||
|
||||
// We have no destructor
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
|
||||
// Constructor for a new filter
|
||||
internal ThingsFilter()
|
||||
{
|
||||
// Initialize
|
||||
requiredfields = new List<string>();
|
||||
forbiddenfields = new List<string>();
|
||||
categoryname = "";
|
||||
thingtype = -1;
|
||||
name = "Unnamed filter";
|
||||
|
||||
// We have no destructor
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
|
||||
// Disposer
|
||||
internal virtual void Dispose()
|
||||
{
|
||||
// Not already disposed?
|
||||
if(!isdisposed)
|
||||
{
|
||||
// Clean up
|
||||
visiblethings = null;
|
||||
hiddenthings = null;
|
||||
|
||||
// Done
|
||||
isdisposed = true;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ================== Methods
|
||||
|
||||
// This writes the filter to configuration
|
||||
internal void WriteSettings(Configuration cfg, string path)
|
||||
{
|
||||
// Write settings to config
|
||||
cfg.WriteSetting(path + ".name", name);
|
||||
cfg.WriteSetting(path + ".category", categoryname);
|
||||
cfg.WriteSetting(path + ".type", thingtype);
|
||||
|
||||
// Write required fields to config
|
||||
foreach(string s in requiredfields)
|
||||
cfg.WriteSetting(path + ".fields." + s, true);
|
||||
|
||||
// Write forbidden fields to config
|
||||
foreach(string s in forbiddenfields)
|
||||
cfg.WriteSetting(path + ".fields." + s, false);
|
||||
}
|
||||
|
||||
// This is called when the filter is activated
|
||||
internal virtual void Activate()
|
||||
{
|
||||
// Update the list of things
|
||||
Update();
|
||||
}
|
||||
|
||||
// This is called when the filter is deactivates
|
||||
internal virtual void Deactivate()
|
||||
{
|
||||
// Clear lists
|
||||
visiblethings = null;
|
||||
hiddenthings = null;
|
||||
}
|
||||
|
||||
// This updates the list of things
|
||||
public virtual void Update()
|
||||
{
|
||||
// Make new list
|
||||
visiblethings = new List<Thing>(General.Map.Map.Things.Count);
|
||||
hiddenthings = new List<Thing>(General.Map.Map.Things.Count);
|
||||
foreach(Thing t in General.Map.Map.Things)
|
||||
{
|
||||
bool qualifies;
|
||||
|
||||
// Get thing info
|
||||
ThingTypeInfo ti = General.Map.Config.GetThingInfo(t.Type);
|
||||
|
||||
// Check if the thing matches category and id
|
||||
qualifies = ((t.Type == thingtype) || (thingtype == -1)) &&
|
||||
((ti.Category.Name == categoryname) || (categoryname.Length == 0));
|
||||
|
||||
// Still qualifies?
|
||||
if(qualifies)
|
||||
{
|
||||
// Go for all required fields
|
||||
foreach(string s in requiredfields)
|
||||
{
|
||||
if(t.Fields.ContainsKey(s))
|
||||
{
|
||||
if(t.Fields[s] is bool)
|
||||
{
|
||||
if((bool)t.Fields[s] == false)
|
||||
{
|
||||
qualifies = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
qualifies = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Still qualifies?
|
||||
if(qualifies)
|
||||
{
|
||||
// Go for all forbidden fields
|
||||
foreach(string s in forbiddenfields)
|
||||
{
|
||||
if(t.Fields.ContainsKey(s))
|
||||
{
|
||||
if(t.Fields[s] is bool)
|
||||
{
|
||||
if((bool)t.Fields[s] == true)
|
||||
{
|
||||
qualifies = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Put the thing in the correct list
|
||||
if(qualifies) visiblethings.Add(t); else hiddenthings.Add(t);
|
||||
}
|
||||
}
|
||||
|
||||
// String representation
|
||||
public override string ToString()
|
||||
{
|
||||
return name;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
|
@ -83,6 +83,7 @@ namespace CodeImp.DoomBuilder
|
|||
private GridSetup grid;
|
||||
private UndoManager undoredo;
|
||||
private Launcher launcher;
|
||||
private ThingsFilter thingsfilter;
|
||||
|
||||
// Disposing
|
||||
private bool isdisposed = false;
|
||||
|
@ -111,6 +112,7 @@ namespace CodeImp.DoomBuilder
|
|||
public UndoManager UndoRedo { get { return undoredo; } }
|
||||
public IMapSetIO FormatInterface { get { return io; } }
|
||||
internal Launcher Launcher { get { return launcher; } }
|
||||
public ThingsFilter ThingsFilter { get { return thingsfilter; } }
|
||||
|
||||
#endregion
|
||||
|
||||
|
@ -131,6 +133,7 @@ namespace CodeImp.DoomBuilder
|
|||
grid = new GridSetup();
|
||||
undoredo = new UndoManager();
|
||||
launcher = new Launcher(this);
|
||||
thingsfilter = new NullThingsFilter();
|
||||
}
|
||||
|
||||
// Disposer
|
||||
|
@ -224,7 +227,11 @@ namespace CodeImp.DoomBuilder
|
|||
tempwad.Insert(TEMP_MAP_HEADER, 0, 0);
|
||||
io.Write(map, TEMP_MAP_HEADER, 1);
|
||||
CreateRequiredLumps(tempwad, TEMP_MAP_HEADER);
|
||||
|
||||
|
||||
// Update structures
|
||||
map.Update();
|
||||
thingsfilter.Update();
|
||||
|
||||
// Load data manager
|
||||
General.WriteLogLine("Loading data resources...");
|
||||
data = new DataManager();
|
||||
|
@ -307,7 +314,8 @@ namespace CodeImp.DoomBuilder
|
|||
|
||||
// Update structures
|
||||
map.Update();
|
||||
|
||||
thingsfilter.Update();
|
||||
|
||||
// Load data manager
|
||||
General.WriteLogLine("Loading data resources...");
|
||||
data = new DataManager();
|
||||
|
@ -923,6 +931,25 @@ namespace CodeImp.DoomBuilder
|
|||
|
||||
#region ================== Methods
|
||||
|
||||
// This changes thing filter
|
||||
internal void ChangeThingFilter(ThingsFilter newfilter)
|
||||
{
|
||||
// We have a special filter for null
|
||||
if(newfilter == null) newfilter = new NullThingsFilter();
|
||||
|
||||
// Deactivate old filter
|
||||
if(thingsfilter != null) thingsfilter.Deactivate();
|
||||
|
||||
// Change
|
||||
thingsfilter = newfilter;
|
||||
|
||||
// Activate filter
|
||||
thingsfilter.Activate();
|
||||
|
||||
// Redraw
|
||||
General.MainWindow.RedrawDisplay();
|
||||
}
|
||||
|
||||
// This clears the selection
|
||||
[BeginAction("clearselection")]
|
||||
public void ClearSelection()
|
||||
|
@ -944,6 +971,7 @@ namespace CodeImp.DoomBuilder
|
|||
map.Dispose();
|
||||
map = newmap;
|
||||
map.Update();
|
||||
thingsfilter.Update();
|
||||
}
|
||||
|
||||
// This reloads resources
|
||||
|
@ -1039,6 +1067,16 @@ namespace CodeImp.DoomBuilder
|
|||
optionsform.Dispose();
|
||||
}
|
||||
|
||||
// This shows the things filters setup
|
||||
[BeginAction("thingsfilterssetup")]
|
||||
internal void ShowThingsFiltersSetup()
|
||||
{
|
||||
// Show line edit dialog
|
||||
ThingsFiltersForm f = new ThingsFiltersForm();
|
||||
f.ShowDialog(General.MainWindow);
|
||||
f.Dispose();
|
||||
}
|
||||
|
||||
// This returns true is the given type matches
|
||||
public bool IsType(Type t)
|
||||
{
|
||||
|
|
18
Source/Interface/ConfigForm.Designer.cs
generated
18
Source/Interface/ConfigForm.Designer.cs
generated
|
@ -86,7 +86,7 @@ namespace CodeImp.DoomBuilder.Interface
|
|||
label6.AutoEllipsis = true;
|
||||
label6.Location = new System.Drawing.Point(12, 15);
|
||||
label6.Name = "label6";
|
||||
label6.Size = new System.Drawing.Size(393, 37);
|
||||
label6.Size = new System.Drawing.Size(394, 37);
|
||||
label6.TabIndex = 21;
|
||||
label6.Text = "These are the resources that will be loaded when this configuration is chosen for" +
|
||||
" editing. Usually you add your IWAD (like doom.wad or doom2.wad) here.";
|
||||
|
@ -153,7 +153,7 @@ namespace CodeImp.DoomBuilder.Interface
|
|||
//
|
||||
this.cancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.cancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
|
||||
this.cancel.Location = new System.Drawing.Point(573, 381);
|
||||
this.cancel.Location = new System.Drawing.Point(567, 368);
|
||||
this.cancel.Name = "cancel";
|
||||
this.cancel.Size = new System.Drawing.Size(112, 25);
|
||||
this.cancel.TabIndex = 17;
|
||||
|
@ -164,7 +164,7 @@ namespace CodeImp.DoomBuilder.Interface
|
|||
// apply
|
||||
//
|
||||
this.apply.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.apply.Location = new System.Drawing.Point(455, 381);
|
||||
this.apply.Location = new System.Drawing.Point(449, 368);
|
||||
this.apply.Name = "apply";
|
||||
this.apply.Size = new System.Drawing.Size(112, 25);
|
||||
this.apply.TabIndex = 16;
|
||||
|
@ -182,10 +182,10 @@ namespace CodeImp.DoomBuilder.Interface
|
|||
this.tabs.Enabled = false;
|
||||
this.tabs.Font = new System.Drawing.Font("Arial", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.tabs.ItemSize = new System.Drawing.Size(110, 19);
|
||||
this.tabs.Location = new System.Drawing.Point(263, 17);
|
||||
this.tabs.Location = new System.Drawing.Point(256, 12);
|
||||
this.tabs.Name = "tabs";
|
||||
this.tabs.SelectedIndex = 0;
|
||||
this.tabs.Size = new System.Drawing.Size(422, 345);
|
||||
this.tabs.Size = new System.Drawing.Size(423, 345);
|
||||
this.tabs.SizeMode = System.Windows.Forms.TabSizeMode.Fixed;
|
||||
this.tabs.TabIndex = 18;
|
||||
//
|
||||
|
@ -198,7 +198,7 @@ namespace CodeImp.DoomBuilder.Interface
|
|||
this.tabresources.Location = new System.Drawing.Point(4, 23);
|
||||
this.tabresources.Name = "tabresources";
|
||||
this.tabresources.Padding = new System.Windows.Forms.Padding(6);
|
||||
this.tabresources.Size = new System.Drawing.Size(414, 318);
|
||||
this.tabresources.Size = new System.Drawing.Size(415, 318);
|
||||
this.tabresources.TabIndex = 0;
|
||||
this.tabresources.Text = "Resources";
|
||||
this.tabresources.UseVisualStyleBackColor = true;
|
||||
|
@ -212,7 +212,7 @@ namespace CodeImp.DoomBuilder.Interface
|
|||
this.configdata.Font = new System.Drawing.Font("Arial", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.configdata.Location = new System.Drawing.Point(15, 55);
|
||||
this.configdata.Name = "configdata";
|
||||
this.configdata.Size = new System.Drawing.Size(381, 220);
|
||||
this.configdata.Size = new System.Drawing.Size(382, 220);
|
||||
this.configdata.TabIndex = 20;
|
||||
this.configdata.OnContentChanged += new CodeImp.DoomBuilder.Interface.ResourceListEditor.ContentChanged(this.resourcelocations_OnContentChanged);
|
||||
//
|
||||
|
@ -349,7 +349,7 @@ namespace CodeImp.DoomBuilder.Interface
|
|||
this.listconfigs.FullRowSelect = true;
|
||||
this.listconfigs.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.None;
|
||||
this.listconfigs.HideSelection = false;
|
||||
this.listconfigs.Location = new System.Drawing.Point(17, 17);
|
||||
this.listconfigs.Location = new System.Drawing.Point(12, 12);
|
||||
this.listconfigs.MultiSelect = false;
|
||||
this.listconfigs.Name = "listconfigs";
|
||||
this.listconfigs.ShowGroups = false;
|
||||
|
@ -377,7 +377,7 @@ namespace CodeImp.DoomBuilder.Interface
|
|||
this.AcceptButton = this.apply;
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
|
||||
this.CancelButton = this.cancel;
|
||||
this.ClientSize = new System.Drawing.Size(697, 416);
|
||||
this.ClientSize = new System.Drawing.Size(690, 403);
|
||||
this.Controls.Add(this.listconfigs);
|
||||
this.Controls.Add(this.tabs);
|
||||
this.Controls.Add(this.cancel);
|
||||
|
|
|
@ -117,37 +117,112 @@
|
|||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<metadata name="label5.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="label5.GenerateMember" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>False</value>
|
||||
</metadata>
|
||||
<metadata name="label6.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="label6.GenerateMember" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>False</value>
|
||||
</metadata>
|
||||
<metadata name="label3.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="label3.GenerateMember" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>False</value>
|
||||
</metadata>
|
||||
<data name="label3.Text" xml:space="preserve">
|
||||
<value>The nodebuilder is a compiler which builds geometry structures for your map. You need these structures to be able to play the map in the game. For each purpose you can choose the desired nodebuilder configuration here.</value>
|
||||
</data>
|
||||
<metadata name="label2.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="label2.GenerateMember" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>False</value>
|
||||
</metadata>
|
||||
<metadata name="label7.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="label7.GenerateMember" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>False</value>
|
||||
</metadata>
|
||||
<metadata name="label9.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="label9.GenerateMember" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>False</value>
|
||||
</metadata>
|
||||
<data name="label9.Text" xml:space="preserve">
|
||||
<value>Here you can specify the program settings to use for launching a game engine when testing the map. Press F1 for a list of placeholders that can be used for automatic filenames, paths, names and numbers.</value>
|
||||
</data>
|
||||
<metadata name="label4.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="label4.GenerateMember" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>False</value>
|
||||
</metadata>
|
||||
<metadata name="label1.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="label1.GenerateMember" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>False</value>
|
||||
</metadata>
|
||||
<metadata name="cancel.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="apply.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="tabs.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="tabresources.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="configdata.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="tabnodebuilder.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="nodebuildertest.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="nodebuildersave.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="tabtesting.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="browsetestprogram.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="noresultlabel.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="testresult.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="labelresult.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="testparameters.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="testapplication.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="listconfigs.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="testprogramdialog.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>17, 17</value>
|
||||
</metadata>
|
||||
<metadata name="$this.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
</root>
|
16
Source/Interface/MainForm.Designer.cs
generated
16
Source/Interface/MainForm.Designer.cs
generated
|
@ -84,6 +84,7 @@ namespace CodeImp.DoomBuilder.Interface
|
|||
this.buttonautomerge = new System.Windows.Forms.ToolStripButton();
|
||||
this.toolStripSeparator5 = new System.Windows.Forms.ToolStripSeparator();
|
||||
this.buttontest = new System.Windows.Forms.ToolStripButton();
|
||||
this.toolStripSeparator6 = new System.Windows.Forms.ToolStripSeparator();
|
||||
this.statusbar = new System.Windows.Forms.StatusStrip();
|
||||
this.statuslabel = new System.Windows.Forms.ToolStripStatusLabel();
|
||||
this.gridlabel = new System.Windows.Forms.ToolStripStatusLabel();
|
||||
|
@ -117,7 +118,6 @@ namespace CodeImp.DoomBuilder.Interface
|
|||
this.redrawtimer = new System.Windows.Forms.Timer(this.components);
|
||||
this.display = new CodeImp.DoomBuilder.Interface.RenderTargetControl();
|
||||
this.processor = new System.Windows.Forms.Timer(this.components);
|
||||
this.toolStripSeparator6 = new System.Windows.Forms.ToolStripSeparator();
|
||||
toolStripMenuItem1 = new System.Windows.Forms.ToolStripSeparator();
|
||||
toolStripMenuItem2 = new System.Windows.Forms.ToolStripSeparator();
|
||||
toolStripMenuItem3 = new System.Windows.Forms.ToolStripSeparator();
|
||||
|
@ -552,7 +552,9 @@ namespace CodeImp.DoomBuilder.Interface
|
|||
this.buttonthingsfilter.ImageTransparentColor = System.Drawing.Color.Magenta;
|
||||
this.buttonthingsfilter.Name = "buttonthingsfilter";
|
||||
this.buttonthingsfilter.Size = new System.Drawing.Size(23, 22);
|
||||
this.buttonthingsfilter.Tag = "builder_thingsfilterssetup";
|
||||
this.buttonthingsfilter.Text = "Configure Things Filters";
|
||||
this.buttonthingsfilter.Click += new System.EventHandler(this.InvokeTaggedAction);
|
||||
//
|
||||
// thingfilters
|
||||
//
|
||||
|
@ -567,6 +569,8 @@ namespace CodeImp.DoomBuilder.Interface
|
|||
this.thingfilters.Name = "thingfilters";
|
||||
this.thingfilters.Size = new System.Drawing.Size(130, 25);
|
||||
this.thingfilters.ToolTipText = "Things Filter";
|
||||
this.thingfilters.SelectedIndexChanged += new System.EventHandler(this.thingfilters_SelectedIndexChanged);
|
||||
this.thingfilters.DropDownClosed += new System.EventHandler(this.LoseFocus);
|
||||
//
|
||||
// toolStripSeparator8
|
||||
//
|
||||
|
@ -616,6 +620,11 @@ namespace CodeImp.DoomBuilder.Interface
|
|||
this.buttontest.Text = "Test Map";
|
||||
this.buttontest.Click += new System.EventHandler(this.InvokeTaggedAction);
|
||||
//
|
||||
// toolStripSeparator6
|
||||
//
|
||||
this.toolStripSeparator6.Name = "toolStripSeparator6";
|
||||
this.toolStripSeparator6.Size = new System.Drawing.Size(6, 25);
|
||||
//
|
||||
// statusbar
|
||||
//
|
||||
this.statusbar.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
|
@ -947,11 +956,6 @@ namespace CodeImp.DoomBuilder.Interface
|
|||
this.processor.Interval = 10;
|
||||
this.processor.Tick += new System.EventHandler(this.processor_Tick);
|
||||
//
|
||||
// toolStripSeparator6
|
||||
//
|
||||
this.toolStripSeparator6.Name = "toolStripSeparator6";
|
||||
this.toolStripSeparator6.Size = new System.Drawing.Size(6, 25);
|
||||
//
|
||||
// MainForm
|
||||
//
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
|
||||
|
|
|
@ -78,6 +78,7 @@ namespace CodeImp.DoomBuilder.Interface
|
|||
|
||||
// Toolbar
|
||||
private EventHandler buttonvisiblechangedhandler;
|
||||
private bool updatingfilters;
|
||||
|
||||
#endregion
|
||||
|
||||
|
@ -871,6 +872,78 @@ namespace CodeImp.DoomBuilder.Interface
|
|||
|
||||
#region ================== Toolbar
|
||||
|
||||
// This loses focus
|
||||
private void LoseFocus(object sender, EventArgs e)
|
||||
{
|
||||
// Lose focus!
|
||||
this.ActiveControl = null;
|
||||
}
|
||||
|
||||
// Things filter selected
|
||||
private void thingfilters_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
// Only possible when a map is open
|
||||
if((General.Map != null) && !updatingfilters)
|
||||
{
|
||||
// Change filter
|
||||
General.Map.ChangeThingFilter(thingfilters.SelectedItem as ThingsFilter);
|
||||
}
|
||||
|
||||
// Lose focus
|
||||
LoseFocus(sender, e);
|
||||
}
|
||||
|
||||
// This updates the things filter on the toolbar
|
||||
internal void UpdateThingsFilters()
|
||||
{
|
||||
// Only possible to list filters when a map is open
|
||||
if(General.Map != null)
|
||||
{
|
||||
ThingsFilter oldfilter = null;
|
||||
if(thingfilters.SelectedIndex > -1)
|
||||
oldfilter = thingfilters.SelectedItem as ThingsFilter;
|
||||
|
||||
updatingfilters = true;
|
||||
|
||||
// Clear the list
|
||||
thingfilters.Items.Clear();
|
||||
|
||||
// Add null filter
|
||||
if(General.Map.ThingsFilter is NullThingsFilter)
|
||||
thingfilters.Items.Add(General.Map.ThingsFilter);
|
||||
else
|
||||
thingfilters.Items.Add(new NullThingsFilter());
|
||||
|
||||
// Add all filters
|
||||
foreach(ThingsFilter f in General.Map.ConfigSettings.ThingsFilters)
|
||||
thingfilters.Items.Add(f);
|
||||
|
||||
// Select current filter
|
||||
foreach(ThingsFilter f in thingfilters.Items)
|
||||
if(f == General.Map.ThingsFilter) thingfilters.SelectedItem = f;
|
||||
|
||||
updatingfilters = false;
|
||||
|
||||
// No filter selected?
|
||||
if(thingfilters.SelectedIndex == -1)
|
||||
{
|
||||
// Select the first and update
|
||||
thingfilters.SelectedIndex = 0;
|
||||
}
|
||||
// Another filter got selected?
|
||||
else if(oldfilter != (thingfilters.SelectedItem as ThingsFilter))
|
||||
{
|
||||
// Update!
|
||||
thingfilters_SelectedIndexChanged(this, EventArgs.Empty);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Clear the list
|
||||
thingfilters.Items.Clear();
|
||||
}
|
||||
}
|
||||
|
||||
// This adds a button to the toolbar
|
||||
public void AddButton(ToolStripItem button)
|
||||
{
|
||||
|
@ -1353,6 +1426,9 @@ namespace CodeImp.DoomBuilder.Interface
|
|||
itemreloadresources.Enabled = (General.Map != null);
|
||||
|
||||
// Toolbar icons
|
||||
thingfilters.Enabled = (General.Map != null);
|
||||
buttonthingsfilter.Enabled = (General.Map != null);
|
||||
UpdateThingsFilters();
|
||||
}
|
||||
|
||||
// Game Configuration action
|
||||
|
|
235
Source/Interface/ThingsFiltersForm.Designer.cs
generated
Normal file
235
Source/Interface/ThingsFiltersForm.Designer.cs
generated
Normal file
|
@ -0,0 +1,235 @@
|
|||
namespace CodeImp.DoomBuilder.Interface
|
||||
{
|
||||
partial class ThingsFiltersForm
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if(disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.listfilters = new System.Windows.Forms.ListView();
|
||||
this.columnname = new System.Windows.Forms.ColumnHeader();
|
||||
this.addfilter = new System.Windows.Forms.Button();
|
||||
this.deletefilter = new System.Windows.Forms.Button();
|
||||
this.filtergroup = new System.Windows.Forms.GroupBox();
|
||||
this.filterfields = new CodeImp.DoomBuilder.Interface.CheckboxArrayControl();
|
||||
this.label3 = new System.Windows.Forms.Label();
|
||||
this.filtercategory = new System.Windows.Forms.ComboBox();
|
||||
this.label2 = new System.Windows.Forms.Label();
|
||||
this.filtername = new System.Windows.Forms.TextBox();
|
||||
this.label1 = new System.Windows.Forms.Label();
|
||||
this.cancel = new System.Windows.Forms.Button();
|
||||
this.apply = new System.Windows.Forms.Button();
|
||||
this.filtergroup.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// listfilters
|
||||
//
|
||||
this.listfilters.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||
| System.Windows.Forms.AnchorStyles.Left)));
|
||||
this.listfilters.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
|
||||
this.columnname});
|
||||
this.listfilters.FullRowSelect = true;
|
||||
this.listfilters.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.None;
|
||||
this.listfilters.HideSelection = false;
|
||||
this.listfilters.Location = new System.Drawing.Point(12, 12);
|
||||
this.listfilters.MultiSelect = false;
|
||||
this.listfilters.Name = "listfilters";
|
||||
this.listfilters.ShowGroups = false;
|
||||
this.listfilters.Size = new System.Drawing.Size(202, 323);
|
||||
this.listfilters.Sorting = System.Windows.Forms.SortOrder.Ascending;
|
||||
this.listfilters.TabIndex = 20;
|
||||
this.listfilters.UseCompatibleStateImageBehavior = false;
|
||||
this.listfilters.View = System.Windows.Forms.View.Details;
|
||||
this.listfilters.SelectedIndexChanged += new System.EventHandler(this.listfilters_SelectedIndexChanged);
|
||||
//
|
||||
// columnname
|
||||
//
|
||||
this.columnname.Text = "Configuration";
|
||||
this.columnname.Width = 177;
|
||||
//
|
||||
// addfilter
|
||||
//
|
||||
this.addfilter.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||
this.addfilter.Location = new System.Drawing.Point(12, 341);
|
||||
this.addfilter.Name = "addfilter";
|
||||
this.addfilter.Size = new System.Drawing.Size(98, 25);
|
||||
this.addfilter.TabIndex = 21;
|
||||
this.addfilter.Text = "New Filter";
|
||||
this.addfilter.UseVisualStyleBackColor = true;
|
||||
this.addfilter.Click += new System.EventHandler(this.addfilter_Click);
|
||||
//
|
||||
// deletefilter
|
||||
//
|
||||
this.deletefilter.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||
this.deletefilter.Enabled = false;
|
||||
this.deletefilter.Location = new System.Drawing.Point(116, 341);
|
||||
this.deletefilter.Name = "deletefilter";
|
||||
this.deletefilter.Size = new System.Drawing.Size(98, 25);
|
||||
this.deletefilter.TabIndex = 22;
|
||||
this.deletefilter.Text = "Delete Selected";
|
||||
this.deletefilter.UseVisualStyleBackColor = true;
|
||||
this.deletefilter.Click += new System.EventHandler(this.deletefilter_Click);
|
||||
//
|
||||
// filtergroup
|
||||
//
|
||||
this.filtergroup.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||
| System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.filtergroup.Controls.Add(this.filterfields);
|
||||
this.filtergroup.Controls.Add(this.label3);
|
||||
this.filtergroup.Controls.Add(this.filtercategory);
|
||||
this.filtergroup.Controls.Add(this.label2);
|
||||
this.filtergroup.Controls.Add(this.filtername);
|
||||
this.filtergroup.Controls.Add(this.label1);
|
||||
this.filtergroup.Enabled = false;
|
||||
this.filtergroup.Location = new System.Drawing.Point(232, 12);
|
||||
this.filtergroup.Name = "filtergroup";
|
||||
this.filtergroup.Size = new System.Drawing.Size(382, 354);
|
||||
this.filtergroup.TabIndex = 23;
|
||||
this.filtergroup.TabStop = false;
|
||||
this.filtergroup.Text = " Filter settings ";
|
||||
//
|
||||
// filterfields
|
||||
//
|
||||
this.filterfields.AutoScroll = true;
|
||||
this.filterfields.Columns = 2;
|
||||
this.filterfields.Location = new System.Drawing.Point(18, 125);
|
||||
this.filterfields.Name = "filterfields";
|
||||
this.filterfields.Size = new System.Drawing.Size(350, 198);
|
||||
this.filterfields.TabIndex = 5;
|
||||
//
|
||||
// label3
|
||||
//
|
||||
this.label3.AutoSize = true;
|
||||
this.label3.Location = new System.Drawing.Point(15, 106);
|
||||
this.label3.Name = "label3";
|
||||
this.label3.Size = new System.Drawing.Size(77, 14);
|
||||
this.label3.TabIndex = 4;
|
||||
this.label3.Text = "Filter by fields:";
|
||||
//
|
||||
// filtercategory
|
||||
//
|
||||
this.filtercategory.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||
this.filtercategory.FormattingEnabled = true;
|
||||
this.filtercategory.Location = new System.Drawing.Point(115, 66);
|
||||
this.filtercategory.Name = "filtercategory";
|
||||
this.filtercategory.Size = new System.Drawing.Size(232, 22);
|
||||
this.filtercategory.TabIndex = 3;
|
||||
this.filtercategory.SelectedIndexChanged += new System.EventHandler(this.filtercategory_SelectedIndexChanged);
|
||||
//
|
||||
// label2
|
||||
//
|
||||
this.label2.AutoSize = true;
|
||||
this.label2.Location = new System.Drawing.Point(15, 69);
|
||||
this.label2.Name = "label2";
|
||||
this.label2.Size = new System.Drawing.Size(94, 14);
|
||||
this.label2.TabIndex = 2;
|
||||
this.label2.Text = "Filter by category:";
|
||||
//
|
||||
// filtername
|
||||
//
|
||||
this.filtername.Location = new System.Drawing.Point(115, 28);
|
||||
this.filtername.MaxLength = 50;
|
||||
this.filtername.Name = "filtername";
|
||||
this.filtername.Size = new System.Drawing.Size(232, 20);
|
||||
this.filtername.TabIndex = 1;
|
||||
this.filtername.Validating += new System.ComponentModel.CancelEventHandler(this.filtername_Validating);
|
||||
//
|
||||
// label1
|
||||
//
|
||||
this.label1.AutoSize = true;
|
||||
this.label1.Location = new System.Drawing.Point(72, 31);
|
||||
this.label1.Name = "label1";
|
||||
this.label1.Size = new System.Drawing.Size(37, 14);
|
||||
this.label1.TabIndex = 0;
|
||||
this.label1.Text = "Name:";
|
||||
//
|
||||
// cancel
|
||||
//
|
||||
this.cancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.cancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
|
||||
this.cancel.Location = new System.Drawing.Point(502, 383);
|
||||
this.cancel.Name = "cancel";
|
||||
this.cancel.Size = new System.Drawing.Size(112, 25);
|
||||
this.cancel.TabIndex = 25;
|
||||
this.cancel.Text = "Cancel";
|
||||
this.cancel.UseVisualStyleBackColor = true;
|
||||
this.cancel.Click += new System.EventHandler(this.cancel_Click);
|
||||
//
|
||||
// apply
|
||||
//
|
||||
this.apply.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.apply.Location = new System.Drawing.Point(384, 383);
|
||||
this.apply.Name = "apply";
|
||||
this.apply.Size = new System.Drawing.Size(112, 25);
|
||||
this.apply.TabIndex = 24;
|
||||
this.apply.Text = "OK";
|
||||
this.apply.UseVisualStyleBackColor = true;
|
||||
this.apply.Click += new System.EventHandler(this.apply_Click);
|
||||
//
|
||||
// ThingsFiltersForm
|
||||
//
|
||||
this.AcceptButton = this.apply;
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
|
||||
this.CancelButton = this.cancel;
|
||||
this.ClientSize = new System.Drawing.Size(624, 418);
|
||||
this.Controls.Add(this.cancel);
|
||||
this.Controls.Add(this.apply);
|
||||
this.Controls.Add(this.filtergroup);
|
||||
this.Controls.Add(this.deletefilter);
|
||||
this.Controls.Add(this.addfilter);
|
||||
this.Controls.Add(this.listfilters);
|
||||
this.Font = new System.Drawing.Font("Arial", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
|
||||
this.MaximizeBox = false;
|
||||
this.MinimizeBox = false;
|
||||
this.Name = "ThingsFiltersForm";
|
||||
this.ShowIcon = false;
|
||||
this.ShowInTaskbar = false;
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
|
||||
this.Text = "Things Filters";
|
||||
this.filtergroup.ResumeLayout(false);
|
||||
this.filtergroup.PerformLayout();
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.ListView listfilters;
|
||||
private System.Windows.Forms.ColumnHeader columnname;
|
||||
private System.Windows.Forms.Button addfilter;
|
||||
private System.Windows.Forms.Button deletefilter;
|
||||
private System.Windows.Forms.GroupBox filtergroup;
|
||||
private System.Windows.Forms.Button cancel;
|
||||
private System.Windows.Forms.Button apply;
|
||||
private System.Windows.Forms.TextBox filtername;
|
||||
private System.Windows.Forms.Label label1;
|
||||
private System.Windows.Forms.Label label2;
|
||||
private System.Windows.Forms.ComboBox filtercategory;
|
||||
private System.Windows.Forms.Label label3;
|
||||
private CheckboxArrayControl filterfields;
|
||||
}
|
||||
}
|
199
Source/Interface/ThingsFiltersForm.cs
Normal file
199
Source/Interface/ThingsFiltersForm.cs
Normal file
|
@ -0,0 +1,199 @@
|
|||
|
||||
#region ================== Copyright (c) 2007 Pascal vd Heiden
|
||||
|
||||
/*
|
||||
* Copyright (c) 2007 Pascal vd Heiden, www.codeimp.com
|
||||
* This program is released under GNU General Public License
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
*/
|
||||
|
||||
#endregion
|
||||
|
||||
#region ================== Namespaces
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
using CodeImp.DoomBuilder.Map;
|
||||
using CodeImp.DoomBuilder.Data;
|
||||
using CodeImp.DoomBuilder.IO;
|
||||
using System.IO;
|
||||
using CodeImp.DoomBuilder.Config;
|
||||
using CodeImp.DoomBuilder.Editing;
|
||||
using CodeImp.DoomBuilder.Geometry;
|
||||
|
||||
#endregion
|
||||
|
||||
namespace CodeImp.DoomBuilder.Interface
|
||||
{
|
||||
public partial class ThingsFiltersForm : DelayedForm
|
||||
{
|
||||
#region ================== Constructor
|
||||
|
||||
// Constructor
|
||||
public ThingsFiltersForm()
|
||||
{
|
||||
// Initialize
|
||||
InitializeComponent();
|
||||
|
||||
// Fill the categories combobox
|
||||
filtercategory.Items.AddRange(General.Map.Config.ThingCategories.ToArray());
|
||||
|
||||
// Fill checkboxes list
|
||||
// TODO: When UDMF is implemented
|
||||
filterfields.Add("TODO: When UDMF is implemented!", null);
|
||||
|
||||
// Fill list of filters
|
||||
foreach(ThingsFilter f in General.Map.ConfigSettings.ThingsFilters)
|
||||
{
|
||||
// Make a copy (we don't want to modify the filters until OK is clicked)
|
||||
ThingsFilter nf = new ThingsFilter(f);
|
||||
|
||||
// Make item in list
|
||||
ListViewItem item = new ListViewItem(nf.Name);
|
||||
item.Tag = nf;
|
||||
listfilters.Items.Add(item);
|
||||
|
||||
// Select item if this is the current filter
|
||||
if(General.Map.ThingsFilter == f) item.Selected = true;
|
||||
}
|
||||
|
||||
// Sort the list
|
||||
listfilters.Sort();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ================== Management
|
||||
|
||||
// OK clicked
|
||||
private void apply_Click(object sender, EventArgs e)
|
||||
{
|
||||
// Clear all filters and add the new ones
|
||||
General.Map.ConfigSettings.ThingsFilters.Clear();
|
||||
foreach(ListViewItem item in listfilters.Items)
|
||||
General.Map.ConfigSettings.ThingsFilters.Add(item.Tag as ThingsFilter);
|
||||
|
||||
// Update stuff
|
||||
General.Map.ChangeThingFilter(new NullThingsFilter());
|
||||
General.MainWindow.UpdateThingsFilters();
|
||||
|
||||
// Close
|
||||
this.DialogResult = DialogResult.OK;
|
||||
this.Close();
|
||||
}
|
||||
|
||||
// Cancel clicked
|
||||
private void cancel_Click(object sender, EventArgs e)
|
||||
{
|
||||
// Close
|
||||
this.DialogResult = DialogResult.Cancel;
|
||||
this.Close();
|
||||
}
|
||||
|
||||
// New Filter clicked
|
||||
private void addfilter_Click(object sender, EventArgs e)
|
||||
{
|
||||
ThingsFilter newf = new ThingsFilter();
|
||||
|
||||
// Make item in list and select it
|
||||
ListViewItem item = new ListViewItem(newf.Name);
|
||||
item.Tag = newf;
|
||||
listfilters.Items.Add(item);
|
||||
item.Selected = true;
|
||||
|
||||
// Focus on the name field
|
||||
filtername.Focus();
|
||||
filtername.SelectAll();
|
||||
}
|
||||
|
||||
// Delete Selected clicked
|
||||
private void deletefilter_Click(object sender, EventArgs e)
|
||||
{
|
||||
// Anything selected?
|
||||
if(listfilters.SelectedItems.Count > 0)
|
||||
{
|
||||
// Remove item
|
||||
listfilters.Items.Remove(listfilters.SelectedItems[0]);
|
||||
}
|
||||
}
|
||||
|
||||
// Item selected
|
||||
private void listfilters_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
// Anything selected?
|
||||
if(listfilters.SelectedItems.Count > 0)
|
||||
{
|
||||
// Get selected filter
|
||||
ThingsFilter f = listfilters.SelectedItems[0].Tag as ThingsFilter;
|
||||
|
||||
// Enable settings
|
||||
deletefilter.Enabled = true;
|
||||
filtergroup.Enabled = true;
|
||||
|
||||
// Show settings
|
||||
filtername.Text = f.Name;
|
||||
foreach(ThingCategory c in filtercategory.Items)
|
||||
if(c.Name == f.CategoryName) filtercategory.SelectedItem = c;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Disable filter settings
|
||||
deletefilter.Enabled = false;
|
||||
filtergroup.Enabled = false;
|
||||
filtername.Text = "";
|
||||
filtercategory.SelectedIndex = -1;
|
||||
foreach(CheckBox c in filterfields.Checkboxes) c.CheckState = CheckState.Indeterminate;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ================== Filter Settings
|
||||
|
||||
// Category changed
|
||||
private void filtercategory_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
// Anything selected?
|
||||
if(listfilters.SelectedItems.Count > 0)
|
||||
{
|
||||
// Get selected filter
|
||||
ThingsFilter f = listfilters.SelectedItems[0].Tag as ThingsFilter;
|
||||
|
||||
// Set new category name
|
||||
if(filtercategory.SelectedIndex > -1)
|
||||
f.CategoryName = (filtercategory.SelectedItem as ThingCategory).Name;
|
||||
}
|
||||
}
|
||||
|
||||
// Rename filter
|
||||
private void filtername_Validating(object sender, CancelEventArgs e)
|
||||
{
|
||||
// Anything selected?
|
||||
if(listfilters.SelectedItems.Count > 0)
|
||||
{
|
||||
// Get selected filter
|
||||
ThingsFilter f = listfilters.SelectedItems[0].Tag as ThingsFilter;
|
||||
|
||||
// Name changed?
|
||||
if(f.Name != filtername.Text)
|
||||
{
|
||||
// Update name
|
||||
f.Name = filtername.Text;
|
||||
listfilters.SelectedItems[0].Text = f.Name;
|
||||
listfilters.Sort();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
165
Source/Interface/ThingsFiltersForm.resx
Normal file
165
Source/Interface/ThingsFiltersForm.resx
Normal file
|
@ -0,0 +1,165 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<metadata name="listfilters.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="addfilter.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="deletefilter.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="filtergroup.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="filterfields.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="label3.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="filtercategory.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="label2.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="filtername.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="label1.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="cancel.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="apply.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="checkBox1.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="checkBox2.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="$this.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
</root>
|
|
@ -127,7 +127,7 @@ namespace CodeImp.DoomBuilder.Rendering
|
|||
public void SetupSettings()
|
||||
{
|
||||
// Setup renderstates
|
||||
device.SetRenderState(RenderState.AlphaRef, 0x0000007F);
|
||||
device.SetRenderState(RenderState.AlphaRef, 0x0000007E);
|
||||
device.SetRenderState(RenderState.AlphaFunc, Compare.GreaterEqual);
|
||||
device.SetRenderState(RenderState.AntialiasedLineEnable, false);
|
||||
device.SetRenderState(RenderState.Ambient, Color.White.ToArgb());
|
||||
|
|
|
@ -70,8 +70,8 @@ namespace CodeImp.DoomBuilder.Rendering
|
|||
void PlotVertex(Vertex v, int colorindex);
|
||||
void PlotVertexAt(Vector2D v, int colorindex);
|
||||
void PlotVerticesSet(ICollection<Vertex> vertices);
|
||||
void RenderThing(Thing t, PixelColor c);
|
||||
void RenderThingSet(ICollection<Thing> things);
|
||||
void RenderThing(Thing t, PixelColor c, float alpha);
|
||||
void RenderThingSet(ICollection<Thing> things, float alpha);
|
||||
void RenderRectangle(RectangleF rect, float bordersize, PixelColor c, bool transformrect);
|
||||
void RenderRectangleFilled(RectangleF rect, PixelColor c, bool transformrect);
|
||||
void RenderLine(Vector2D start, Vector2D end, float thickness, PixelColor c, bool transformcoords);
|
||||
|
|
|
@ -32,7 +32,8 @@ namespace CodeImp.DoomBuilder.Rendering
|
|||
public class Presentation
|
||||
{
|
||||
// Constants for static instances
|
||||
private const float THINGS_BACK_ALPHA = 0.3f;
|
||||
public const float THINGS_BACK_ALPHA = 0.3f;
|
||||
public const float THINGS_HIDDEN_ALPHA = 0.66f;
|
||||
|
||||
// Static instances
|
||||
private static Presentation standard;
|
||||
|
@ -74,7 +75,7 @@ namespace CodeImp.DoomBuilder.Rendering
|
|||
things.layers.Add(new PresentLayer(RendererLayer.Background, BlendingMode.Mask));
|
||||
things.layers.Add(new PresentLayer(RendererLayer.Grid, BlendingMode.Mask));
|
||||
things.layers.Add(new PresentLayer(RendererLayer.Geometry, BlendingMode.Alpha, 1f, true));
|
||||
things.layers.Add(new PresentLayer(RendererLayer.Things, BlendingMode.Alpha, 1f, true));
|
||||
things.layers.Add(new PresentLayer(RendererLayer.Things, BlendingMode.Alpha, 1f, false));
|
||||
things.layers.Add(new PresentLayer(RendererLayer.Overlay, BlendingMode.Alpha, 1f, true));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -612,7 +612,7 @@ namespace CodeImp.DoomBuilder.Rendering
|
|||
|
||||
// Set the rendertarget to the things texture
|
||||
targetsurface = thingstex.GetSurfaceLevel(0);
|
||||
if(graphics.StartRendering(clear, new Color4(0), targetsurface, null))
|
||||
if(graphics.StartRendering(clear, General.Colors.Background.WithAlpha(0).ToColorValue(), targetsurface, null))
|
||||
{
|
||||
// Ready for rendering
|
||||
UpdateTransformations();
|
||||
|
@ -644,7 +644,7 @@ namespace CodeImp.DoomBuilder.Rendering
|
|||
{
|
||||
// Set the rendertarget to the things texture
|
||||
targetsurface = overlaytex.GetSurfaceLevel(0);
|
||||
if(graphics.StartRendering(clear, new Color4(0), targetsurface, null))
|
||||
if(graphics.StartRendering(clear, General.Colors.Background.WithAlpha(0).ToColorValue(), targetsurface, null))
|
||||
{
|
||||
// Ready for rendering
|
||||
UpdateTransformations();
|
||||
|
@ -959,19 +959,24 @@ namespace CodeImp.DoomBuilder.Rendering
|
|||
}
|
||||
|
||||
// This draws a set of things
|
||||
private void RenderThingsBatch(int offset, int count)
|
||||
private void RenderThingsBatch(int offset, int count, float alpha)
|
||||
{
|
||||
int thingtextureindex = 0;
|
||||
|
||||
// Anything to render?
|
||||
if(count > 0)
|
||||
{
|
||||
// Make alpha color
|
||||
Color4 alphacolor = new Color4(alpha, 1.0f, 1.0f, 1.0f);
|
||||
|
||||
// Set renderstates for things rendering
|
||||
graphics.Device.SetRenderState(RenderState.CullMode, Cull.None);
|
||||
graphics.Device.SetRenderState(RenderState.ZEnable, false);
|
||||
graphics.Device.SetRenderState(RenderState.AlphaBlendEnable, false);
|
||||
graphics.Device.SetRenderState(RenderState.AlphaTestEnable, true);
|
||||
graphics.Device.SetRenderState(RenderState.TextureFactor, -1);
|
||||
graphics.Device.SetRenderState(RenderState.AlphaBlendEnable, true);
|
||||
graphics.Device.SetRenderState(RenderState.SourceBlend, Blend.SourceAlpha);
|
||||
graphics.Device.SetRenderState(RenderState.DestinationBlend, Blend.InvSourceAlpha);
|
||||
graphics.Device.SetRenderState(RenderState.AlphaTestEnable, false);
|
||||
graphics.Device.SetRenderState(RenderState.TextureFactor, alphacolor.ToArgb());
|
||||
graphics.Device.SetStreamSource(0, thingsvertices, 0, FlatVertex.Stride);
|
||||
|
||||
// Determine things texture to use
|
||||
|
@ -980,7 +985,7 @@ namespace CodeImp.DoomBuilder.Rendering
|
|||
graphics.Device.SetTexture(0, thingtexture[thingtextureindex].Texture);
|
||||
graphics.Shaders.Things2D.Texture1 = thingtexture[thingtextureindex].Texture;
|
||||
SetWorldTransformation(false);
|
||||
graphics.Shaders.Things2D.SetSettings();
|
||||
graphics.Shaders.Things2D.SetSettings(alpha);
|
||||
|
||||
// Draw the things batched
|
||||
graphics.Shaders.Things2D.Begin();
|
||||
|
@ -992,7 +997,7 @@ namespace CodeImp.DoomBuilder.Rendering
|
|||
}
|
||||
|
||||
// This adds a thing in the things buffer for rendering
|
||||
public void RenderThing(Thing t, PixelColor c)
|
||||
public void RenderThing(Thing t, PixelColor c, float alpha)
|
||||
{
|
||||
FlatVertex[] verts = new FlatVertex[12];
|
||||
DataStream stream;
|
||||
|
@ -1013,44 +1018,47 @@ namespace CodeImp.DoomBuilder.Rendering
|
|||
}
|
||||
|
||||
// Thing added, render it
|
||||
RenderThingsBatch(numthings, 1);
|
||||
RenderThingsBatch(numthings, 1, alpha);
|
||||
numthings++;
|
||||
}
|
||||
}
|
||||
|
||||
// This adds a thing in the things buffer for rendering
|
||||
public void RenderThingSet(ICollection<Thing> things)
|
||||
public void RenderThingSet(ICollection<Thing> things, float alpha)
|
||||
{
|
||||
FlatVertex[] verts = new FlatVertex[things.Count * 12];
|
||||
DataStream stream;
|
||||
int addcount = 0;
|
||||
|
||||
// Make sure there is enough memory reserved
|
||||
ReserveThingsMemory(numthings + things.Count, true);
|
||||
|
||||
// Go for all things
|
||||
foreach(Thing t in things)
|
||||
// Anything to do?
|
||||
if(things.Count > 0)
|
||||
{
|
||||
// Create vertices
|
||||
if(CreateThingVerts(t, ref verts, addcount * 12, DetermineThingColor(t)))
|
||||
FlatVertex[] verts = new FlatVertex[things.Count * 12];
|
||||
|
||||
// Make sure there is enough memory reserved
|
||||
ReserveThingsMemory(numthings + things.Count, true);
|
||||
|
||||
// Go for all things
|
||||
int addcount = 0;
|
||||
foreach(Thing t in things)
|
||||
{
|
||||
// Next
|
||||
addcount++;
|
||||
// Create vertices
|
||||
if(CreateThingVerts(t, ref verts, addcount * 12, DetermineThingColor(t)))
|
||||
{
|
||||
// Next
|
||||
addcount++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Store vertices in buffer
|
||||
if(thingsvertices != null)
|
||||
{
|
||||
stream = thingsvertices.Lock(numthings * 12 * FlatVertex.Stride, things.Count * 12 * FlatVertex.Stride, LockFlags.NoSystemLock);
|
||||
stream.WriteRange<FlatVertex>(verts);
|
||||
thingsvertices.Unlock();
|
||||
stream.Dispose();
|
||||
}
|
||||
// Store vertices in buffer
|
||||
if(thingsvertices != null)
|
||||
{
|
||||
DataStream stream = thingsvertices.Lock(numthings * 12 * FlatVertex.Stride, things.Count * 12 * FlatVertex.Stride, LockFlags.NoSystemLock);
|
||||
stream.WriteRange<FlatVertex>(verts);
|
||||
thingsvertices.Unlock();
|
||||
stream.Dispose();
|
||||
}
|
||||
|
||||
// Things added, render them
|
||||
RenderThingsBatch(numthings, addcount);
|
||||
numthings += addcount;
|
||||
// Things added, render them
|
||||
RenderThingsBatch(numthings, addcount, alpha);
|
||||
numthings += addcount;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
|
|
@ -42,6 +42,7 @@ namespace CodeImp.DoomBuilder.Rendering
|
|||
|
||||
// Property handlers
|
||||
private EffectHandle texture1;
|
||||
private EffectHandle rendersettings;
|
||||
private EffectHandle transformsettings;
|
||||
|
||||
#endregion
|
||||
|
@ -64,6 +65,7 @@ namespace CodeImp.DoomBuilder.Rendering
|
|||
if(effect != null)
|
||||
{
|
||||
texture1 = effect.GetParameter(null, "texture1");
|
||||
rendersettings = effect.GetParameter(null, "rendersettings");
|
||||
transformsettings = effect.GetParameter(null, "transformsettings");
|
||||
}
|
||||
|
||||
|
@ -89,6 +91,7 @@ namespace CodeImp.DoomBuilder.Rendering
|
|||
{
|
||||
// Clean up
|
||||
if(texture1 != null) texture1.Dispose();
|
||||
if(rendersettings != null) rendersettings.Dispose();
|
||||
if(transformsettings != null) transformsettings.Dispose();
|
||||
|
||||
// Done
|
||||
|
@ -101,10 +104,12 @@ namespace CodeImp.DoomBuilder.Rendering
|
|||
#region ================== Methods
|
||||
|
||||
// This sets the settings
|
||||
public void SetSettings()
|
||||
public void SetSettings(float alpha)
|
||||
{
|
||||
if(manager.Enabled)
|
||||
{
|
||||
Vector4 values = new Vector4(0.0f, 0.0f, 1.0f, alpha);
|
||||
effect.SetValue(rendersettings, values);
|
||||
Matrix world = manager.D3DDevice.Device.GetTransform(TransformState.World);
|
||||
Matrix view = manager.D3DDevice.Device.GetTransform(TransformState.View);
|
||||
effect.SetValue(transformsettings, Matrix.Multiply(world, view));
|
||||
|
|
|
@ -340,3 +340,12 @@ testmap
|
|||
allowmouse = false;
|
||||
allowscroll = false;
|
||||
}
|
||||
|
||||
thingsfilterssetup
|
||||
{
|
||||
title = "Tools: Setup Things Filters";
|
||||
description = "Shows the Things Filters setup dialog which allows you to add, remove and change the things filters.";
|
||||
allowkeys = true;
|
||||
allowmouse = false;
|
||||
allowscroll = false;
|
||||
}
|
||||
|
|
|
@ -17,6 +17,10 @@ struct PixelData
|
|||
float2 uv : TEXCOORD0;
|
||||
};
|
||||
|
||||
// Render settings
|
||||
// w = transparency
|
||||
float4 rendersettings;
|
||||
|
||||
// Transform settings
|
||||
float4x4 transformsettings;
|
||||
|
||||
|
@ -59,9 +63,11 @@ float4 ps_circle(PixelData pd) : COLOR
|
|||
if(pd.uv.x < 0.4f)
|
||||
{
|
||||
float4 s = tex2D(texture1samp, pd.uv + float2(0.25f, 0.0f));
|
||||
return float4(lerp(c.rgb * pd.color.rgb, s.rgb, s.a), c.a * pd.color.a);
|
||||
c = float4(lerp(c.rgb * pd.color.rgb, s.rgb, s.a), c.a);
|
||||
}
|
||||
else return c;
|
||||
|
||||
c.a = c.a * pd.color.a * rendersettings.w;
|
||||
return c;
|
||||
}
|
||||
|
||||
// Technique for shader model 2.0
|
||||
|
|
Loading…
Reference in a new issue