things! colored, scaled, and in their own mode!

This commit is contained in:
codeimp 2007-10-21 22:41:46 +00:00
parent 4af61009c1
commit 1084cae38b
27 changed files with 749 additions and 96 deletions

View file

@ -36,6 +36,26 @@ colors
color17 = -16776961;
color18 = -16744448;
color19 = -8388608;
color20 = -9868951;
color21 = -12490271;
color22 = -14513374;
color23 = -14634326;
color24 = -5103070;
color25 = -7077677;
color26 = -2448096;
color27 = -4144960;
color28 = -8355712;
color29 = -16728065;
color30 = -13447886;
color31 = -5247250;
color32 = -40121;
color33 = -1146130;
color34 = -256;
color35 = -657931;
color36 = -18751;
color37 = -29696;
color38 = -4343957;
color39 = -4684277;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 660 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 11 KiB

View file

@ -60,6 +60,7 @@
<Compile Include="Editing\EditMode.cs" />
<Compile Include="Editing\LinedefsMode.cs" />
<Compile Include="Editing\SectorsMode.cs" />
<Compile Include="Editing\ThingsMode.cs" />
<Compile Include="Editing\VerticesMode.cs" />
<Compile Include="Editing\ClassicMode.cs" />
<Compile Include="Controls\ActionDelegate.cs" />
@ -217,6 +218,7 @@
</ItemGroup>
<ItemGroup>
<Content Include="Resources\Builder.ico" />
<None Include="Resources\ThingsMode.png" />
<None Include="Resources\VerticesMode.png" />
<None Include="Resources\SectorsMode.png" />
<None Include="Resources\LinesMode.png" />

View file

@ -46,9 +46,15 @@ namespace CodeImp.DoomBuilder.Config
private float defaulttexturescale;
private float defaultflatscale;
private string formatinterface;
private IDictionary maplumpnames;
private int soundlinedefflags;
// Map lumps
private IDictionary maplumpnames;
// Things
private List<ThingCategory> thingcategories;
private Dictionary<int, ThingTypeInfo> things;
#endregion
#region ================== Properties
@ -57,9 +63,14 @@ namespace CodeImp.DoomBuilder.Config
public float DefaultTextureScale { get { return defaulttexturescale; } }
public float DefaultFlatScale { get { return defaultflatscale; } }
public string FormatInterface { get { return formatinterface; } }
public IDictionary MapLumpNames { get { return maplumpnames; } }
public int SoundLinedefFlags { get { return soundlinedefflags; } }
// Map lumps
public IDictionary MapLumpNames { get { return maplumpnames; } }
// Things
public List<ThingCategory> ThingCategories { get { return thingcategories; } }
#endregion
#region ================== Constructor / Disposer
@ -67,16 +78,34 @@ namespace CodeImp.DoomBuilder.Config
// Constructor
public GameConfiguration(Configuration cfg)
{
// Keep reference
IDictionary dic;
ThingCategory thingcat;
// Initialize
this.cfg = cfg;
this.thingcategories = new List<ThingCategory>();
this.things = new Dictionary<int, ThingTypeInfo>();
// Read general settings
defaulttexturescale = cfg.ReadSetting("defaulttexturescale", 1f);
defaultflatscale = cfg.ReadSetting("defaultflatscale", 1f);
formatinterface = cfg.ReadSetting("formatinterface", "");
maplumpnames = cfg.ReadSetting("maplumpnames", new Hashtable());
soundlinedefflags = cfg.ReadSetting("soundlinedefflags", 0);
// Get map lumps
maplumpnames = cfg.ReadSetting("maplumpnames", new Hashtable());
// Get thing categories
dic = cfg.ReadSetting("thingtypes", new Hashtable());
foreach(DictionaryEntry de in dic)
{
// Make a category
thingcat = new ThingCategory(cfg, de.Key.ToString());
// Add all thing in category to the big list
foreach(ThingTypeInfo t in thingcat.Things) things.Add(t.Index, t);
}
// We have no destructor
GC.SuppressFinalize(this);
}
@ -95,6 +124,22 @@ namespace CodeImp.DoomBuilder.Config
public byte ReadSetting(string setting, byte defaultsetting) { return cfg.ReadSetting(setting, defaultsetting); }
public IDictionary ReadSetting(string setting, IDictionary defaultsetting) { return cfg.ReadSetting(setting, defaultsetting); }
// This gets thing information by index
public ThingTypeInfo GetThingInfo(int index)
{
// Index in config?
if(things.ContainsKey(index))
{
// Return from config
return things[index];
}
else
{
// Create unknown thing info
return new ThingTypeInfo(index);
}
}
#endregion
}
}

View file

@ -26,12 +26,13 @@ using CodeImp.DoomBuilder.Data;
using System.IO;
using System.Diagnostics;
using System.Windows.Forms;
using CodeImp.DoomBuilder.Rendering;
#endregion
namespace CodeImp.DoomBuilder.Config
{
internal class ThingCategory
internal class ThingCategory : IDisposable
{
#region ================== Constants
@ -39,27 +40,127 @@ namespace CodeImp.DoomBuilder.Config
#region ================== Variables
// Things
private List<ThingTypeInfo> things;
// Category properties
private string name;
private string title;
private bool sorted;
// Thing properties for inheritance
private string sprite;
private int color;
private int arrow;
private float width;
private float height;
private int hangs;
private int blocking;
private int errorcheck;
// Disposing
private bool isdisposed = false;
#endregion
#region ================== Properties
public string Name { get { return name; } }
public string Title { get { return title; } }
public string Sprite { get { return sprite; } }
public bool Sorted { get { return sorted; } }
public int Color { get { return color; } }
public int Arrow { get { return arrow; } }
public float Width { get { return width; } }
public float Height { get { return height; } }
public int Hangs { get { return hangs; } }
public int Blocking { get { return blocking; } }
public int ErrorCheck { get { return errorcheck; } }
public bool IsDisposed { get { return isdisposed; } }
public List<ThingTypeInfo> Things { get { return things; } }
#endregion
#region ================== Constructor / Disposer
// Constructor
public ThingCategory()
public ThingCategory(Configuration cfg, string name)
{
IDictionary dic;
int index;
// Initialize
this.name = name;
this.things = new List<ThingTypeInfo>();
// Read properties
this.title = cfg.ReadSetting("thingtypes." + name + ".title", "<category>");
this.sprite = cfg.ReadSetting("thingtypes." + name + ".sprite", "");
this.sorted = (cfg.ReadSetting("thingtypes." + name + ".sort", 0) != 0);
this.color = cfg.ReadSetting("thingtypes." + name + ".color", 0);
this.arrow = cfg.ReadSetting("thingtypes." + name + ".arrow", 0);
this.width = cfg.ReadSetting("thingtypes." + name + ".width", 16);
this.height = cfg.ReadSetting("thingtypes." + name + ".height", 16);
this.hangs = cfg.ReadSetting("thingtypes." + name + ".hangs", 0);
this.blocking = cfg.ReadSetting("thingtypes." + name + ".blocking", 0);
this.errorcheck = cfg.ReadSetting("thingtypes." + name + ".errorcheck", 0);
// Safety
if(this.width < 2f) this.width = 2f;
if(this.height < 2f) this.height = 2f;
// Go for all items in category
dic = cfg.ReadSetting("thingtypes." + name, new Hashtable());
foreach(DictionaryEntry de in dic)
{
// Check if the item key is numeric
if(int.TryParse(de.Key.ToString(), NumberStyles.AllowLeadingWhite | NumberStyles.AllowTrailingWhite, CultureInfo.InvariantCulture, out index))
{
// Check if the item value is a structure
if(de.Value is IDictionary)
{
// Create this thing
things.Add(new ThingTypeInfo(this, index, cfg));
}
// Check if the item value is a string
else if(de.Value is string)
{
// Interpret this as the title
things.Add(new ThingTypeInfo(this, index, de.Value.ToString()));
}
}
}
// We have no destructor
GC.SuppressFinalize(this);
}
// Disposer
public void Dispose()
{
// Not already disposed?
if(!isdisposed)
{
// Clean up
things = null;
// Done
isdisposed = true;
}
}
#endregion
#region ================== Methods
// This adds a thing to the category
public void AddThing(ThingTypeInfo t)
{
// Add
things.Add(t);
}
#endregion
}
}

View file

@ -39,18 +39,117 @@ namespace CodeImp.DoomBuilder.Config
#region ================== Variables
// Properties
private int index;
private string title;
private string sprite;
private long spritelongname;
private int color;
private bool arrow;
private float width;
private float height;
private bool hangs;
private int blocking;
private int errorcheck;
private ThingCategory category;
#endregion
#region ================== Properties
public int Index { get { return index; } }
public string Title { get { return title; } }
public string Sprite { get { return sprite; } }
public long SpriteLongName { get { return spritelongname; } }
public int Color { get { return color; } }
public bool Arrow { get { return arrow; } }
public float Width { get { return width; } }
public float Height { get { return height; } }
public bool Hangs { get { return hangs; } }
public int Blocking { get { return blocking; } }
public int ErrorCheck { get { return errorcheck; } }
public ThingCategory Category { get { return category; } }
#endregion
#region ================== Constructor / Disposer
// Constructor
public ThingTypeInfo()
public ThingTypeInfo(int index)
{
// Initialize
this.index = index;
this.category = null;
this.title = "<" + index.ToString(CultureInfo.InvariantCulture) + ">";
this.sprite = "";
this.color = 0;
this.arrow = true;
this.width = 16f;
this.height = 16f;
this.hangs = false;
this.blocking = 0;
this.errorcheck = 0;
// Make long name for sprite lookup
this.spritelongname = Lump.MakeLongName(this.sprite);
// We have no destructor
GC.SuppressFinalize(this);
}
// Constructor
public ThingTypeInfo(ThingCategory cat, int index, Configuration cfg)
{
string key = index.ToString(CultureInfo.InvariantCulture);
// Initialize
this.index = index;
this.category = cat;
// Read properties
this.title = cfg.ReadSetting("thingtypes." + cat.Name + "." + key + ".title", "<" + key + ">");
this.sprite = cfg.ReadSetting("thingtypes." + cat.Name + "." + key + ".sprite", cat.Sprite);
this.color = cfg.ReadSetting("thingtypes." + cat.Name + "." + key + ".color", cat.Color);
this.arrow = (cfg.ReadSetting("thingtypes." + cat.Name + "." + key + ".arrow", cat.Arrow) != 0);
this.width = cfg.ReadSetting("thingtypes." + cat.Name + "." + key + ".width", cat.Width);
this.height = cfg.ReadSetting("thingtypes." + cat.Name + "." + key + ".height", cat.Height);
this.hangs = (cfg.ReadSetting("thingtypes." + cat.Name + "." + key + ".hangs", cat.Hangs) != 0);
this.blocking = cfg.ReadSetting("thingtypes." + cat.Name + "." + key + ".blocking", cat.Blocking);
this.errorcheck = cfg.ReadSetting("thingtypes." + cat.Name + "." + key + ".errorcheck", cat.ErrorCheck);
// Safety
if(this.width < 2f) this.width = 2f;
if(this.height < 2f) this.height = 2f;
// Make long name for sprite lookup
this.spritelongname = Lump.MakeLongName(this.sprite);
// We have no destructor
GC.SuppressFinalize(this);
}
// Constructor
public ThingTypeInfo(ThingCategory cat, int index, string title)
{
string key = index.ToString(CultureInfo.InvariantCulture);
// Initialize
this.index = index;
this.category = cat;
this.title = title;
// Read properties
this.sprite = cat.Sprite;
this.color = cat.Color;
this.arrow = (cat.Arrow != 0);
this.width = cat.Width;
this.height = cat.Height;
this.hangs = (cat.Hangs != 0);
this.blocking = cat.Blocking;
this.errorcheck = cat.ErrorCheck;
// Make long name for sprite lookup
this.spritelongname = Lump.MakeLongName(this.sprite);
// We have no destructor
GC.SuppressFinalize(this);

View file

@ -50,6 +50,7 @@ namespace CodeImp.DoomBuilder.Controls
public const string VERTICESMODE = "verticesmode";
public const string LINEDEFSMODE = "linedefsmode";
public const string SECTORSMODE = "sectorsmode";
public const string THINGSMODE = "thingsmode";
#endregion

View file

@ -101,6 +101,10 @@ namespace CodeImp.DoomBuilder.Editing
// Start with a clear display
if(renderer.StartRendering(true))
{
// Render things
renderer.SetThingsRenderOrder(false);
renderer.RenderThingSet(General.Map.Map.Things);
// Render lines
renderer.RenderLinedefSet(General.Map.Map.Linedefs);

View file

@ -99,7 +99,11 @@ namespace CodeImp.DoomBuilder.Editing
// Start with a clear display
if(renderer.StartRendering(true))
{
// Render stuff
// Render things
renderer.SetThingsRenderOrder(false);
renderer.RenderThingSet(General.Map.Map.Things);
// Render lines and vertices
renderer.RenderLinedefSet(General.Map.Map.Linedefs);
renderer.RenderVerticesSet(General.Map.Map.Vertices);

View file

@ -0,0 +1,166 @@
#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.Interface;
using CodeImp.DoomBuilder.IO;
using CodeImp.DoomBuilder.Map;
using CodeImp.DoomBuilder.Rendering;
using CodeImp.DoomBuilder.Geometry;
#endregion
namespace CodeImp.DoomBuilder.Editing
{
internal class ThingsMode : ClassicMode
{
#region ================== Constants
protected const float THING_HIGHLIGHT_RANGE = 10f;
#endregion
#region ================== Variables
// Highlighted item
private Thing highlighted;
#endregion
#region ================== Properties
#endregion
#region ================== Constructor / Disposer
// Constructor
public ThingsMode()
{
}
// Diposer
public override void Dispose()
{
// Not already disposed?
if(!isdisposed)
{
// Clean up
// Dispose base
base.Dispose();
}
}
#endregion
#region ================== Methods
// Mode engages
public override void Engage()
{
base.Engage();
// Check things button on main window
General.MainWindow.SetThingsChecked(true);
}
// Mode disengages
public override void Disengage()
{
base.Disengage();
// Check things button on main window
General.MainWindow.SetThingsChecked(false);
}
// This redraws the display
public unsafe override void RedrawDisplay()
{
// Start with a clear display
if(renderer.StartRendering(true))
{
// Render lines and vertices
renderer.RenderLinedefSet(General.Map.Map.Linedefs);
renderer.RenderVerticesSet(General.Map.Map.Vertices);
// Render things
renderer.SetThingsRenderOrder(true);
renderer.RenderThingSet(General.Map.Map.Things);
// Render highlighted item
if(highlighted != null)
renderer.RenderThing(highlighted, General.Colors.Highlight);
// Done
renderer.FinishRendering();
}
}
// This highlights a new item
protected void Highlight(Thing t)
{
// Update display
if(renderer.StartRendering(false))
{
// Undraw previous highlight
if(highlighted != null)
renderer.RenderThing(highlighted, renderer.DetermineThingColor(highlighted));
// Set new highlight
highlighted = t;
// Render highlighted item
if(highlighted != null)
renderer.RenderThing(highlighted, General.Colors.Highlight);
// Done
renderer.FinishRendering();
}
}
// Mouse moves
public override void MouseMove(MouseEventArgs e)
{
base.MouseMove(e);
// Find the nearest vertex within highlight range
//Thing t = General.Map.Map.Nearestt(mousemappos, VERTEX_HIGHLIGHT_RANGE / renderer.Scale);
// Highlight if not the same
//if(t != highlighted) Highlight(v);
}
// Mouse leaves
public override void MouseLeave(EventArgs e)
{
base.MouseLeave(e);
// Highlight nothing
Highlight(null);
}
#endregion
}
}

View file

@ -101,7 +101,11 @@ namespace CodeImp.DoomBuilder.Editing
// Start with a clear display
if(renderer.StartRendering(true))
{
// Render stuff
// Render things
renderer.SetThingsRenderOrder(false);
renderer.RenderThingSet(General.Map.Map.Things);
// Render lines and vertices
renderer.RenderLinedefSet(General.Map.Map.Linedefs);
renderer.RenderVerticesSet(General.Map.Map.Vertices);
@ -109,9 +113,6 @@ namespace CodeImp.DoomBuilder.Editing
if(highlighted != null)
renderer.RenderVertex(highlighted, ColorCollection.HIGHLIGHT);
// Render things
renderer.RenderThingSet(General.Map.Map.Things);
// Done
renderer.FinishRendering();
}

View file

@ -850,6 +850,14 @@ namespace CodeImp.DoomBuilder
// Change to sectors mode
ChangeMode(new SectorsMode());
}
// This switches to things mode
[Action(Action.THINGSMODE)]
public void SwitchThingsMode()
{
// Change to things mode
ChangeMode(new ThingsMode());
}
#endregion
@ -882,7 +890,10 @@ namespace CodeImp.DoomBuilder
data = new DataManager();
maplocation = new DataLocation(DataLocation.RESOURCE_WAD, filepathname, false, false);
data.Load(configinfo.Resources, options.Resources, maplocation);
// Apply new settings to map elements
map.UpdateConfiguration();
// Reset status
General.MainWindow.DisplayStatus(oldstatus);
Cursor.Current = oldcursor;

View file

@ -113,6 +113,7 @@ namespace CodeImp.DoomBuilder.IO
t = map.CreateThing();
t.Update(type, new Vector3D(x, y, 0f), angle, flags, 0, 0, Thing.EMPTY_ARGS);
t.DetermineSector();
t.UpdateConfiguration();
}
// Done

View file

@ -50,6 +50,7 @@ namespace CodeImp.DoomBuilder.Interface
this.itemverticesmode = new System.Windows.Forms.ToolStripMenuItem();
this.itemlinedefsmode = new System.Windows.Forms.ToolStripMenuItem();
this.itemsectorsmode = new System.Windows.Forms.ToolStripMenuItem();
this.itemthingsmode = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripSeparator6 = new System.Windows.Forms.ToolStripSeparator();
this.itemmapoptions = new System.Windows.Forms.ToolStripMenuItem();
this.menutools = new System.Windows.Forms.ToolStripMenuItem();
@ -68,6 +69,7 @@ namespace CodeImp.DoomBuilder.Interface
this.buttonverticesmode = new System.Windows.Forms.ToolStripButton();
this.buttonlinedefsmode = new System.Windows.Forms.ToolStripButton();
this.buttonsectorsmode = new System.Windows.Forms.ToolStripButton();
this.buttonthingsmode = new System.Windows.Forms.ToolStripButton();
this.statusbar = new System.Windows.Forms.StatusStrip();
this.statuslabel = new System.Windows.Forms.ToolStripStatusLabel();
this.zoomlabel = new System.Windows.Forms.ToolStripStatusLabel();
@ -231,6 +233,7 @@ namespace CodeImp.DoomBuilder.Interface
this.itemverticesmode,
this.itemlinedefsmode,
this.itemsectorsmode,
this.itemthingsmode,
this.toolStripSeparator6,
this.itemmapoptions});
this.menuedit.Name = "menuedit";
@ -264,6 +267,15 @@ namespace CodeImp.DoomBuilder.Interface
this.itemsectorsmode.Text = "Sectors Mode";
this.itemsectorsmode.Click += new System.EventHandler(this.InvokeTaggedAction);
//
// itemthingsmode
//
this.itemthingsmode.Image = global::CodeImp.DoomBuilder.Properties.Resources.ThingsMode;
this.itemthingsmode.Name = "itemthingsmode";
this.itemthingsmode.Size = new System.Drawing.Size(161, 22);
this.itemthingsmode.Tag = "thingsmode";
this.itemthingsmode.Text = "Things Mode";
this.itemthingsmode.Click += new System.EventHandler(this.InvokeTaggedAction);
//
// toolStripSeparator6
//
this.toolStripSeparator6.Name = "toolStripSeparator6";
@ -340,7 +352,8 @@ namespace CodeImp.DoomBuilder.Interface
this.toolStripSeparator5,
this.buttonverticesmode,
this.buttonlinedefsmode,
this.buttonsectorsmode});
this.buttonsectorsmode,
this.buttonthingsmode});
this.toolbar.Location = new System.Drawing.Point(0, 24);
this.toolbar.Name = "toolbar";
this.toolbar.Size = new System.Drawing.Size(731, 25);
@ -436,6 +449,17 @@ namespace CodeImp.DoomBuilder.Interface
this.buttonsectorsmode.Text = "Sectors Mode";
this.buttonsectorsmode.Click += new System.EventHandler(this.InvokeTaggedAction);
//
// buttonthingsmode
//
this.buttonthingsmode.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
this.buttonthingsmode.Image = global::CodeImp.DoomBuilder.Properties.Resources.ThingsMode;
this.buttonthingsmode.ImageTransparentColor = System.Drawing.Color.Magenta;
this.buttonthingsmode.Name = "buttonthingsmode";
this.buttonthingsmode.Size = new System.Drawing.Size(23, 22);
this.buttonthingsmode.Tag = "thingsmode";
this.buttonthingsmode.Text = "Things Mode";
this.buttonthingsmode.Click += new System.EventHandler(this.InvokeTaggedAction);
//
// statusbar
//
this.statusbar.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
@ -687,5 +711,7 @@ namespace CodeImp.DoomBuilder.Interface
private System.Windows.Forms.ToolStripMenuItem itemlinedefsmode;
private System.Windows.Forms.ToolStripMenuItem itemsectorsmode;
private System.Windows.Forms.ToolStripSeparator toolStripSeparator6;
private System.Windows.Forms.ToolStripButton buttonthingsmode;
private System.Windows.Forms.ToolStripMenuItem itemthingsmode;
}
}

View file

@ -691,6 +691,13 @@ namespace CodeImp.DoomBuilder.Interface
buttonsectorsmode.Checked = value;
}
// This sets the status of the things button
public void SetThingsChecked(bool value)
{
itemthingsmode.Checked = value;
buttonthingsmode.Checked = value;
}
// This sets up the edit menu
private void UpdateEditMenu()
{
@ -702,12 +709,14 @@ namespace CodeImp.DoomBuilder.Interface
itemverticesmode.Enabled = (General.Map != null);
itemlinedefsmode.Enabled = (General.Map != null);
itemsectorsmode.Enabled = (General.Map != null);
itemthingsmode.Enabled = (General.Map != null);
// Toolbar icons
buttonmapoptions.Enabled = (General.Map != null);
buttonverticesmode.Enabled = (General.Map != null);
buttonlinedefsmode.Enabled = (General.Map != null);
buttonsectorsmode.Enabled = (General.Map != null);
buttonthingsmode.Enabled = (General.Map != null);
}
#endregion
@ -769,6 +778,9 @@ namespace CodeImp.DoomBuilder.Interface
{
// Update shortcut keys in menus
ApplyShortcutKeys();
// Apply new settings if a map is open
if(General.Map != null) General.Map.Map.UpdateConfiguration();
// Redraw display
RedrawDisplay();

View file

@ -243,6 +243,34 @@ namespace CodeImp.DoomBuilder.Map
#region ================== Methods
// This returns the shortest distance from given coordinates to line
public float SafeDistanceToSq(Vector2D p, bool bounded)
{
Vector2D v1 = start.Position;
Vector2D v2 = end.Position;
// Calculate intersection offset
float u = ((p.x - v1.x) * (v2.x - v1.x) + (p.y - v1.y) * (v2.y - v1.y)) / lengthsq;
// Limit intersection offset to the line
if(bounded) if(u < lengthinv) u = lengthinv; else if(u > (1f - lengthinv)) u = 1f - lengthinv;
// Calculate intersection point
Vector2D i = v1 + u * (v2 - v1);
// Return distance between intersection and point
// which is the shortest distance to the line
float ldx = p.x - i.x;
float ldy = p.y - i.y;
return ldx * ldx + ldy * ldy;
}
// This returns the shortest distance from given coordinates to line
public float SafeDistanceTo(Vector2D p, bool bounded)
{
return (float)Math.Sqrt(SafeDistanceToSq(p, bounded));
}
// This returns the shortest distance from given coordinates to line
public float DistanceToSq(Vector2D p, bool bounded)
{

View file

@ -301,6 +301,14 @@ namespace CodeImp.DoomBuilder.Map
// Update all linedefs
foreach(Linedef l in linedefs) l.Update();
}
// This updates all structures after a
// configuration or settings change
public void UpdateConfiguration()
{
// Update all things
foreach(Thing t in things) t.UpdateConfiguration();
}
#endregion
@ -317,7 +325,7 @@ namespace CodeImp.DoomBuilder.Map
foreach(Linedef l in selection)
{
// Calculate distance and check if closer than previous find
d = l.DistanceToSq(pos, true);
d = l.SafeDistanceToSq(pos, true);
if(d < distance)
{
// This one is closer
@ -342,7 +350,7 @@ namespace CodeImp.DoomBuilder.Map
foreach(Linedef l in selection)
{
// Calculate distance and check if closer than previous find
d = l.DistanceToSq(pos, true);
d = l.SafeDistanceToSq(pos, true);
if((d <= maxrangesq) && (d < distance))
{
// This one is closer
@ -430,7 +438,7 @@ namespace CodeImp.DoomBuilder.Map
// This performs sidedefs compression
public void CompressSidedefs()
{
// TODO: Make this
// TODO: Make this happen
}
// This removes unused vertices

View file

@ -23,6 +23,8 @@ using System.Globalization;
using System.Text;
using CodeImp.DoomBuilder.Geometry;
using CodeImp.DoomBuilder.Rendering;
using CodeImp.DoomBuilder.Config;
using System.Drawing;
#endregion
@ -60,6 +62,7 @@ namespace CodeImp.DoomBuilder.Map
// Configuration
private float size;
private PixelColor color;
private float iconoffset;
// Selections
private int selected;
@ -78,7 +81,10 @@ namespace CodeImp.DoomBuilder.Map
public float Angle { get { return angle; } }
public int Flags { get { return flags; } }
public int Selected { get { return selected; } set { selected = value; } }
public float Size { get { return size; } }
public float IconOffset { get { return iconoffset; } }
public PixelColor Color { get { return color; } }
#endregion
#region ================== Constructor / Disposer
@ -219,7 +225,28 @@ namespace CodeImp.DoomBuilder.Map
// This updates the settings from configuration
public void UpdateConfiguration()
{
ThingTypeInfo ti;
// Lookup settings
ti = General.Map.Configuration.GetThingInfo(type);
// Apply size
size = ti.Width;
// Color valid?
if((ti.Color >= 0) && (ti.Color < ColorCollection.NUM_THING_COLORS))
{
// Apply color
color = General.Colors.Colors[ti.Color + ColorCollection.THING_COLORS_OFFSET];
}
else
{
// Unknown thing color
color = General.Colors.Colors[ColorCollection.THING_COLORS_OFFSET];
}
// Apply icon offset (arrow or dot)
if(ti.Arrow) iconoffset = 0f; else iconoffset = 0.25f;
}
#endregion

View file

@ -130,6 +130,13 @@ namespace CodeImp.DoomBuilder.Properties {
}
}
internal static System.Drawing.Bitmap ThingsMode {
get {
object obj = ResourceManager.GetObject("ThingsMode", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
internal static System.Drawing.Bitmap VerticesMode {
get {
object obj = ResourceManager.GetObject("VerticesMode", resourceCulture);

View file

@ -121,14 +121,14 @@
<data name="ColorPick" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\ColorPick.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="NewMap" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\NewMap2.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
<data name="Splash2small" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\Splash2small.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="Properties" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\Properties.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="File" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\NewMap.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
<data name="OpenMap" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\OpenMap.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="VerticesMode" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\VerticesMode.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
@ -136,22 +136,25 @@
<data name="Splash2" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\Splash2.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="SectorsMode" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\SectorsMode.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="File" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\NewMap.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="NewMap" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\NewMap2.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="Zoom" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\Zoom.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="OpenMap" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\OpenMap.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="LinesMode" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\LinesMode.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="SaveMap" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\SaveMap.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="Splash2small" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\Splash2small.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
<data name="LinesMode" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\LinesMode.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="SectorsMode" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\SectorsMode.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
<data name="ThingsMode" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\ThingsMode.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
</root>

View file

@ -41,7 +41,9 @@ namespace CodeImp.DoomBuilder.Rendering
private const float DARK_ADDITION = -0.2f;
// Palette size
private const int NUM_COLORS = 20;
private const int NUM_COLORS = 40;
public const int NUM_THING_COLORS = 20;
public const int THING_COLORS_OFFSET = 20;
// Colors!
public const int BACKGROUND = 0;
@ -64,6 +66,26 @@ namespace CodeImp.DoomBuilder.Rendering
public const int KEYWORDS = 17;
public const int LITERALS = 18;
public const int CONSTANTS = 19;
public const int THINGCOLOR00 = 20;
public const int THINGCOLOR01 = 21;
public const int THINGCOLOR02 = 22;
public const int THINGCOLOR03 = 23;
public const int THINGCOLOR04 = 24;
public const int THINGCOLOR05 = 25;
public const int THINGCOLOR06 = 26;
public const int THINGCOLOR07 = 27;
public const int THINGCOLOR08 = 28;
public const int THINGCOLOR09 = 29;
public const int THINGCOLOR10 = 30;
public const int THINGCOLOR11 = 31;
public const int THINGCOLOR12 = 32;
public const int THINGCOLOR13 = 33;
public const int THINGCOLOR14 = 34;
public const int THINGCOLOR15 = 35;
public const int THINGCOLOR16 = 36;
public const int THINGCOLOR17 = 37;
public const int THINGCOLOR18 = 38;
public const int THINGCOLOR19 = 39;
#endregion
@ -121,8 +143,30 @@ namespace CodeImp.DoomBuilder.Rendering
for(int i = 0; i < NUM_COLORS; i++)
{
// Read color
colors[i] = PixelColor.FromInt(cfg.ReadSetting("colors.color" + i.ToString(CultureInfo.InvariantCulture), -1));
colors[i] = PixelColor.FromInt(cfg.ReadSetting("colors.color" + i.ToString(CultureInfo.InvariantCulture), 0));
}
// Set new colors
if(colors[THINGCOLOR00].ToInt() == 0) colors[THINGCOLOR00] = PixelColor.FromColor(Color.DimGray);
if(colors[THINGCOLOR01].ToInt() == 0) colors[THINGCOLOR01] = PixelColor.FromColor(Color.RoyalBlue);
if(colors[THINGCOLOR02].ToInt() == 0) colors[THINGCOLOR02] = PixelColor.FromColor(Color.ForestGreen);
if(colors[THINGCOLOR03].ToInt() == 0) colors[THINGCOLOR03] = PixelColor.FromColor(Color.LightSeaGreen);
if(colors[THINGCOLOR04].ToInt() == 0) colors[THINGCOLOR04] = PixelColor.FromColor(Color.Firebrick);
if(colors[THINGCOLOR05].ToInt() == 0) colors[THINGCOLOR05] = PixelColor.FromColor(Color.DarkViolet);
if(colors[THINGCOLOR06].ToInt() == 0) colors[THINGCOLOR06] = PixelColor.FromColor(Color.Goldenrod);
if(colors[THINGCOLOR07].ToInt() == 0) colors[THINGCOLOR07] = PixelColor.FromColor(Color.Silver);
if(colors[THINGCOLOR08].ToInt() == 0) colors[THINGCOLOR08] = PixelColor.FromColor(Color.Gray);
if(colors[THINGCOLOR09].ToInt() == 0) colors[THINGCOLOR09] = PixelColor.FromColor(Color.DeepSkyBlue);
if(colors[THINGCOLOR10].ToInt() == 0) colors[THINGCOLOR10] = PixelColor.FromColor(Color.LimeGreen);
if(colors[THINGCOLOR11].ToInt() == 0) colors[THINGCOLOR11] = PixelColor.FromColor(Color.PaleTurquoise);
if(colors[THINGCOLOR12].ToInt() == 0) colors[THINGCOLOR12] = PixelColor.FromColor(Color.Tomato);
if(colors[THINGCOLOR13].ToInt() == 0) colors[THINGCOLOR13] = PixelColor.FromColor(Color.Violet);
if(colors[THINGCOLOR14].ToInt() == 0) colors[THINGCOLOR14] = PixelColor.FromColor(Color.Yellow);
if(colors[THINGCOLOR15].ToInt() == 0) colors[THINGCOLOR15] = PixelColor.FromColor(Color.WhiteSmoke);
if(colors[THINGCOLOR16].ToInt() == 0) colors[THINGCOLOR16] = PixelColor.FromColor(Color.LightPink);
if(colors[THINGCOLOR17].ToInt() == 0) colors[THINGCOLOR17] = PixelColor.FromColor(Color.DarkOrange);
if(colors[THINGCOLOR18].ToInt() == 0) colors[THINGCOLOR18] = PixelColor.FromColor(Color.DarkKhaki);
if(colors[THINGCOLOR19].ToInt() == 0) colors[THINGCOLOR19] = PixelColor.FromColor(Color.DarkGoldenrod);
// Create assist colors
CreateAssistColors();

View file

@ -44,9 +44,12 @@ namespace CodeImp.DoomBuilder.Rendering
private const byte DOUBLESIDED_LINE_ALPHA = 130;
private const float FSAA_BLEND_FACTOR = 0.6f;
private const float THING_ARROW_SIZE = 15f;
private const float THING_CIRCLE_SIZE = 10f;
private const float THING_ARROW_SIZE = 1.5f;
private const float THING_ARROW_SHRINK = 2f;
private const float THING_CIRCLE_SIZE = 1f;
private const float THING_CIRCLE_SHRINK = 2f;
private const int THING_BUFFER_STEP = 100;
private const byte THINGS_BACK_ALPHA = 80;
#endregion
@ -66,6 +69,9 @@ namespace CodeImp.DoomBuilder.Rendering
private int numthings;
private int maxthings;
// Render settings
private bool thingsfront;
// Images
private ResourceImage thingtexture;
@ -133,6 +139,9 @@ namespace CodeImp.DoomBuilder.Rendering
// Start drawing
if(graphics.StartRendering(General.Colors.Background.ToInt()))
{
// Render things in back?
if(!thingsfront) PresentThings(THINGS_BACK_ALPHA);
// Set renderstates
graphics.Device.SetTexture(0, tex);
graphics.Device.SetRenderState(RenderState.CullMode, Cull.None);
@ -149,47 +158,56 @@ namespace CodeImp.DoomBuilder.Rendering
try { graphics.Device.DrawUserPrimitives<FlatVertex>(PrimitiveType.TriangleStrip, 0, 2, screenverts); } catch(Exception) { }
graphics.Shaders.Base2D.EndPass();
graphics.Shaders.Base2D.End();
// Do we have things to render?
if((numthings > 0) && (thingsvertices != null))
{
// Set renderstates
graphics.Device.SetRenderState(RenderState.CullMode, Cull.None);
graphics.Device.SetRenderState(RenderState.AlphaBlendEnable, true);
graphics.Device.SetRenderState(RenderState.SourceBlend, Blend.SourceAlpha);
graphics.Device.SetRenderState(RenderState.DestBlend, Blend.InvSourceAlpha);
graphics.Device.SetTexture(0, thingtexture.Texture);
graphics.Shaders.Things2D.Texture1 = thingtexture.Texture;
// Set the vertex buffer
graphics.Device.SetStreamSource(0, thingsvertices, 0, FlatVertex.Stride);
// Go for all things
for(int i = 0; i < numthings; i++)
{
// Set renderstates
graphics.Device.SetRenderState(RenderState.TextureFactor, thingcolors[i].ToInt());
graphics.Shaders.Things2D.SetColors(thingcolors[i]);
// Draw the thing circle
graphics.Shaders.Things2D.Begin();
graphics.Shaders.Things2D.BeginPass(0);
try { graphics.Device.DrawPrimitives(PrimitiveType.TriangleStrip, i * 8, 2); } catch(Exception) { }
graphics.Shaders.Things2D.EndPass();
// Draw the thing icon
graphics.Shaders.Things2D.BeginPass(1);
try { graphics.Device.DrawPrimitives(PrimitiveType.TriangleStrip, i * 8 + 4, 2); } catch(Exception) { }
graphics.Shaders.Things2D.EndPass();
graphics.Shaders.Things2D.End();
}
}
// Render things in front with full alpha?
if(thingsfront) PresentThings(255);
// Done
graphics.FinishRendering();
}
}
// This presents the things
private void PresentThings(byte a)
{
// Do we have things to render?
if((numthings > 0) && (thingsvertices != null))
{
// Set renderstates
graphics.Device.SetRenderState(RenderState.CullMode, Cull.None);
graphics.Device.SetRenderState(RenderState.AlphaBlendEnable, true);
graphics.Device.SetRenderState(RenderState.SourceBlend, Blend.SourceAlpha);
graphics.Device.SetRenderState(RenderState.DestBlend, Blend.InvSourceAlpha);
graphics.Device.SetTexture(0, thingtexture.Texture);
graphics.Shaders.Things2D.Texture1 = thingtexture.Texture;
// Set the vertex buffer
graphics.Device.SetStreamSource(0, thingsvertices, 0, FlatVertex.Stride);
// Go for all things
for(int i = 0; i < numthings; i++)
{
// Set renderstates
graphics.Device.SetRenderState(RenderState.TextureFactor, thingcolors[i].ToInt());
graphics.Shaders.Things2D.SetColors(thingcolors[i].WithAlpha(a));
// Draw the thing circle
graphics.Shaders.Things2D.Begin();
graphics.Shaders.Things2D.BeginPass(0);
try { graphics.Device.DrawPrimitives(PrimitiveType.TriangleStrip, i * 8, 2); }
catch(Exception) { }
graphics.Shaders.Things2D.EndPass();
// Draw the thing icon
graphics.Shaders.Things2D.BeginPass(1);
try { graphics.Device.DrawPrimitives(PrimitiveType.TriangleStrip, i * 8 + 4, 2); }
catch(Exception) { }
graphics.Shaders.Things2D.EndPass();
graphics.Shaders.Things2D.End();
}
}
}
// This is called before a device is reset
// (when resized or display adapter was changed)
public override void UnloadResource()
@ -411,58 +429,65 @@ namespace CodeImp.DoomBuilder.Rendering
// This makes vertices for a thing
private void CreateThingVerts(Thing t, ref FlatVertex[] verts, int offset)
{
float circlesize;
float arrowsize;
// Transform to screen coordinates
Vector2D screenpos = ((Vector2D)t.Position).GetTransformed(translatex, translatey, scale, -scale);
// Determine sizes
circlesize = (t.Size - THING_CIRCLE_SHRINK) * scale * THING_CIRCLE_SIZE;
arrowsize = (t.Size - THING_ARROW_SHRINK) * scale * THING_ARROW_SIZE;
// Setup fixed rect for circle
verts[offset].x = screenpos.x - THING_CIRCLE_SIZE;
verts[offset].y = screenpos.y - THING_CIRCLE_SIZE;
verts[offset].x = screenpos.x - circlesize;
verts[offset].y = screenpos.y - circlesize;
verts[offset].w = 1f;
verts[offset].u = 1f / 512f;
verts[offset].v = 1f / 128f;
offset++;
verts[offset].x = screenpos.x + THING_CIRCLE_SIZE;
verts[offset].y = screenpos.y - THING_CIRCLE_SIZE;
verts[offset].x = screenpos.x + circlesize;
verts[offset].y = screenpos.y - circlesize;
verts[offset].w = 1f;
verts[offset].u = 0.25f - 1f / 512f;
verts[offset].v = 1f / 128f;
offset++;
verts[offset].x = screenpos.x - THING_CIRCLE_SIZE;
verts[offset].y = screenpos.y + THING_CIRCLE_SIZE;
verts[offset].x = screenpos.x - circlesize;
verts[offset].y = screenpos.y + circlesize;
verts[offset].w = 1f;
verts[offset].u = 1f / 512f;
verts[offset].v = 1f - 1f / 128f;
offset++;
verts[offset].x = screenpos.x + THING_CIRCLE_SIZE;
verts[offset].y = screenpos.y + THING_CIRCLE_SIZE;
verts[offset].x = screenpos.x + circlesize;
verts[offset].y = screenpos.y + circlesize;
verts[offset].w = 1f;
verts[offset].u = 0.25f - 1f / 512f;
verts[offset].v = 1f - 1f / 128f;
offset++;
// Setup rotated rect for arrow
verts[offset].x = screenpos.x + (float)Math.Sin(t.Angle - Angle2D.PI * 0.25f) * THING_ARROW_SIZE;
verts[offset].y = screenpos.y + (float)Math.Cos(t.Angle - Angle2D.PI * 0.25f) * THING_ARROW_SIZE;
verts[offset].x = screenpos.x + (float)Math.Sin(t.Angle - Angle2D.PI * 0.25f) * arrowsize;
verts[offset].y = screenpos.y + (float)Math.Cos(t.Angle - Angle2D.PI * 0.25f) * arrowsize;
verts[offset].w = 1f;
verts[offset].u = 0.50f;
verts[offset].u = 0.50f + t.IconOffset;
verts[offset].v = 0f;
offset++;
verts[offset].x = screenpos.x + (float)Math.Sin(t.Angle + Angle2D.PI * 0.25f) * THING_ARROW_SIZE;
verts[offset].y = screenpos.y + (float)Math.Cos(t.Angle + Angle2D.PI * 0.25f) * THING_ARROW_SIZE;
verts[offset].x = screenpos.x + (float)Math.Sin(t.Angle + Angle2D.PI * 0.25f) * arrowsize;
verts[offset].y = screenpos.y + (float)Math.Cos(t.Angle + Angle2D.PI * 0.25f) * arrowsize;
verts[offset].w = 1f;
verts[offset].u = 0.75f;
verts[offset].u = 0.75f + t.IconOffset;
verts[offset].v = 0f;
offset++;
verts[offset].x = screenpos.x + (float)Math.Sin(t.Angle - Angle2D.PI * 0.75f) * THING_ARROW_SIZE;
verts[offset].y = screenpos.y + (float)Math.Cos(t.Angle - Angle2D.PI * 0.75f) * THING_ARROW_SIZE;
verts[offset].x = screenpos.x + (float)Math.Sin(t.Angle - Angle2D.PI * 0.75f) * arrowsize;
verts[offset].y = screenpos.y + (float)Math.Cos(t.Angle - Angle2D.PI * 0.75f) * arrowsize;
verts[offset].w = 1f;
verts[offset].u = 0.50f;
verts[offset].u = 0.50f + t.IconOffset;
verts[offset].v = 1f;
offset++;
verts[offset].x = screenpos.x + (float)Math.Sin(t.Angle + Angle2D.PI * 0.75f) * THING_ARROW_SIZE;
verts[offset].y = screenpos.y + (float)Math.Cos(t.Angle + Angle2D.PI * 0.75f) * THING_ARROW_SIZE;
verts[offset].x = screenpos.x + (float)Math.Sin(t.Angle + Angle2D.PI * 0.75f) * arrowsize;
verts[offset].y = screenpos.y + (float)Math.Cos(t.Angle + Angle2D.PI * 0.75f) * arrowsize;
verts[offset].w = 1f;
verts[offset].u = 0.75f;
verts[offset].u = 0.75f + t.IconOffset;
verts[offset].v = 1f;
}
@ -475,9 +500,7 @@ namespace CodeImp.DoomBuilder.Rendering
{
// Determine color
if(t.Selected > 0) return General.Colors.Selection;
else return PixelColor.FromColor(Color.Tomato);
// TODO: Check against game configuration or embed color into thing
else return t.Color;
}
// This returns the color for a vertex
@ -512,7 +535,18 @@ namespace CodeImp.DoomBuilder.Rendering
#endregion
#region ================== Map Rendering
#region ================== Settings
// This sets the things in front or back
public void SetThingsRenderOrder(bool front)
{
// Set things render order
this.thingsfront = front;
}
#endregion
#region ================== Rendering
// This adds a thing in the things buffer for rendering
public void RenderThing(Thing t, PixelColor c)

View file

@ -175,3 +175,12 @@ sectorsmode
allowmouse = true;
allowscroll = true;
}
thingsmode
{
title = "Tools: Things Mode";
description = "Switches to things editing mode.";
allowkeys = true;
allowmouse = true;
allowscroll = true;
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 660 B

View file

@ -35,7 +35,7 @@ float4 ps_circle(PixelData pd) : COLOR
{
float4 c = tex2D(texture1samp, pd.uv);
float4 s = tex2D(texture1samp, pd.uv + float2(0.25f, 0.0f));
return lerp(c * thingcolor, float4(s.rgb, c.a), s.a);
return float4(lerp(c.rgb * thingcolor.rgb, s.rgb, s.a), c.a * thingcolor.a);
}
// Pixel shader for icon