Added AngleByteHandler (type 22).

Bit Flags form now changes width to show flags with long names without scrolling.
Bit Flags form: flag numbers are now shown as well as names.
Game configurations: updated Hexen and ZDoom linedef definitions. Now they (hopefully) fully match ZDoom ones. 
Action Selector Control: fixed a crash when trying to increase action above maximum value using mouse wheel.
Sector/Linedef/Thing tag lists are now handled by corresponding TypeHandlers (and not by dirty hacks as before).
Linedef info panel: line peggedness labels were obscured by effect label in Doom/Hexen map formats.
This commit is contained in:
MaxED 2014-12-08 21:06:08 +00:00
parent 868d1f50eb
commit f9b5399a39
26 changed files with 888 additions and 534 deletions

View file

@ -108,8 +108,7 @@ polyobj
arg2
{
title = "Movement Angle";
type = 11;
enum = "angles";
type = 22;
}
arg3
@ -167,8 +166,7 @@ polyobj
arg2
{
title = "Movement Angle";
type = 11;
enum = "angles";
type = 22;
}
arg3
@ -199,8 +197,7 @@ polyobj
arg2
{
title = "Movement Angle";
type = 11;
enum = "angles";
type = 22;
}
arg3
@ -233,8 +230,7 @@ polyobj
arg2
{
title = "Movement Angle";
type = 11;
enum = "angles";
type = 22;
}
arg3
@ -264,7 +260,7 @@ polyobj
arg1
{
title = "Movement Speed";
title = "Rotation Speed";
type = 11;
enum = "stair_speeds";
default = 16;
@ -290,7 +286,7 @@ polyobj
arg1
{
title = "Movement Speed";
title = "Rotation Speed";
type = 11;
enum = "stair_speeds";
default = 16;
@ -325,8 +321,7 @@ polyobj
arg2
{
title = "Movement Angle";
type = 11;
enum = "angles";
type = 22;
}
arg3
@ -357,8 +352,7 @@ polyobj
arg2
{
title = "Movement Angle";
type = 11;
enum = "angles";
type = 22;
}
arg3
@ -545,7 +539,7 @@ floor
arg2
{
title = "Movement Amount";
title = "Lower by";
}
}
@ -610,7 +604,7 @@ floor
arg2
{
title = "Movement Amount";
title = "Raise by";
}
}
@ -676,6 +670,7 @@ floor
arg2
{
title = "Crush Damage";
default = 100;
}
}
@ -828,7 +823,7 @@ floor
arg2
{
title = "Movement Amount";
title = "Lower by";
}
}
@ -853,7 +848,7 @@ floor
arg2
{
title = "Movement Amount";
title = "Raise by";
}
}
}
@ -1297,11 +1292,17 @@ platform
arg1
{
title = "Movement Speed";
type = 11;
enum = "plat_speeds";
default = 16;
}
arg2
{
title = "Reverse Delay";
title = "Reverse Delay (tics)";
type = 11;
enum = "delay_tics";
default = 105;
}
}
@ -1331,11 +1332,17 @@ platform
arg1
{
title = "Movement Speed";
type = 11;
enum = "plat_speeds";
default = 16;
}
arg2
{
title = "Reverse Delay";
title = "Reverse Delay (tics)";
type = 11;
enum = "delay_tics";
default = 105;
}
}
@ -1353,16 +1360,22 @@ platform
arg1
{
title = "Movement Speed";
type = 11;
enum = "plat_speeds";
default = 16;
}
arg2
{
title = "Reverse Delay";
title = "Reverse Delay (tics)";
type = 11;
enum = "delay_tics";
default = 105;
}
arg3
{
title = "Movement Amount * 8";
title = "Lower by (* 8)";
}
}
@ -1380,11 +1393,17 @@ platform
arg1
{
title = "Movement Speed";
type = 11;
enum = "plat_speeds";
default = 16;
}
arg2
{
title = "Reverse Delay";
title = "Reverse Delay (tics)";
type = 11;
enum = "delay_tics";
default = 105;
}
}
@ -1402,16 +1421,22 @@ platform
arg1
{
title = "Movement Speed";
type = 11;
enum = "plat_speeds";
default = 16;
}
arg2
{
title = "Reverse Delay";
title = "Reverse Delay (tics)";
type = 11;
enum = "delay_tics";
default = 105;
}
arg3
{
title = "Movement Amount * 8";
title = "Lower by (* 8)";
}
}
}
@ -1452,7 +1477,7 @@ teleport
arg1
{
title = "Keep orientation";
title = "Keep Orientation";
type = 11;
enum = "noyes";
}
@ -1488,23 +1513,24 @@ thing
72
{
title = "Thing Thrust";
title = "Thrust Thing";
id = "ThrustThing";
arg0
{
title = "Thrust Angle";
type = 22;
}
arg1
{
title = "Thrust Distance";
title = "Thrust Force (mu. per tic)";
}
}
73
{
title = "Thing Damage";
title = "Damage Thing";
id = "DamageThing";
arg0
@ -1515,7 +1541,7 @@ thing
130
{
title = "Thing Activate";
title = "Activate Thing";
id = "Thing_Activate";
arg0
@ -1527,7 +1553,7 @@ thing
131
{
title = "Thing Deactivate";
title = "Deactivate Thing";
id = "Thing_Deactivate";
arg0
@ -1539,7 +1565,7 @@ thing
132
{
title = "Thing Remove";
title = "Remove Thing";
id = "Thing_Remove";
arg0
@ -1551,7 +1577,7 @@ thing
133
{
title = "Thing Destroy";
title = "Destroy Thing";
id = "Thing_Destroy";
arg0
@ -1561,12 +1587,9 @@ thing
}
arg1
{
title = "Extreme";
enum
{
0 = "No";
1 = "Yes";
}
title = "Extreme Death";
type = 11;
enum = "noyes";
}
arg2
{
@ -1578,7 +1601,7 @@ thing
134
{
title = "Thing Projectile";
title = "Spawn Projectile";
id = "Thing_Projectile";
arg0
@ -1589,12 +1612,15 @@ thing
arg1
{
title = "Spawn Thing";
title = "Projectile Type";
type = 11;
enum = "spawn_projectile";
}
arg2
{
title = "Movement Angle";
type = 22;
}
arg3
@ -1610,7 +1636,7 @@ thing
135
{
title = "Thing Spawn";
title = "Spawn Thing";
id = "Thing_Spawn";
arg0
@ -1621,18 +1647,21 @@ thing
arg1
{
title = "Spawn Thing";
title = "Thing Type";
type = 11;
enum = "spawnthing";
}
arg2
{
title = "Thing Angle";
type = 22;
}
}
136
{
title = "Thing Projectile with Gravity";
title = "Spawn Projectile (gravity)";
id = "Thing_ProjectileGravity";
arg0
@ -1643,12 +1672,15 @@ thing
arg1
{
title = "Spawn Thing";
title = "Projectile Type";
type = 11;
enum = "spawn_projectile";
}
arg2
{
title = "Movement Angle";
type = 22;
}
arg3
@ -1664,23 +1696,26 @@ thing
137
{
title = "Thing Spawn (silent)";
title = "Spawn Thing (silent)";
id = "Thing_SpawnNoFog";
arg0
{
title = "MapSpot Tag";
title = "Target MapSpot Tag";
type = 14;
}
arg1
{
title = "Spawn Thing";
title = "Thing Type";
type = 11;
enum = "spawnthing";
}
arg2
{
title = "Thing Angle";
type = 22;
}
}
}
@ -1933,6 +1968,7 @@ light
arg1
{
title = "Target Brightness";
default = 128;
}
arg2

File diff suppressed because it is too large Load diff

View file

@ -672,11 +672,11 @@ enums
generic_lift_types
{
0 = "Up Stay";
1 = "Down Up";
2 = "Down to nearest";
3 = "Down to lowest";
4 = "Perpetual raise";
0 = "Up by Value, Stay";
1 = "Down, Wait, Up, Stay";
2 = "Down to Nearest Floor";
3 = "Down to Lowest Ceiling";
4 = "Perpetual Raise";
}
death_types
@ -774,8 +774,17 @@ enums
75 = "75%";
100 = "100%";
}
setadd
{
0 = "Set";
1 = "Add";
}
puzzle_items {}
puzzle_items
{
0 = "None";
}
}
enums_doom
@ -907,7 +916,43 @@ enums_doom
152 = "Health Bonus";
153 = "Mancubus Shot";
154 = "Baron Fireball";
216 = "Grenade";
//216 = "Grenade";
}
spawn_projectile
{
0 = "None";
10 = "Imp Fireball";
33 = "Super Shotgun";
41 = "Rock debris #1";
42 = "Rock debris #2";
43 = "Rock debris #3";
44 = "Dirt #1";
45 = "Dirt #2";
46 = "Dirt #3";
47 = "Dirt #4";
48 = "Dirt #5";
49 = "Dirt #6";
51 = "Plasma Bolt";
53 = "Tracer";
54 = "Glass shard #1";
55 = "Glass shard #2";
56 = "Glass shard #3";
57 = "Glass shard #4";
58 = "Glass shard #5";
59 = "Glass shard #6";
60 = "Glass shard #7";
61 = "Glass shard #8";
62 = "Glass shard #9";
63 = "Glass shard #10";
110 = "Lost Soul";
126 = "Cacodemon Shot";
127 = "Rocket (Projectile)";
128 = "BFG Shot";
129 = "Arachnotron Plasma Bolt";
131 = "Bullet Puff";
153 = "Mancubus Shot";
154 = "Baron Fireball";
}
}
@ -1039,6 +1084,48 @@ enums_heretic
166 = "Red Glitter Generator";
167 = "Blue Glitter Generator";
}
spawn_projectile
{
10 = "Gargoyle Shot";
40 = "Morph Ovum Shot";
41 = "Rock debris #1";
42 = "Rock debris #2";
43 = "Rock debris #3";
44 = "Dirt #1";
45 = "Dirt #2";
46 = "Dirt #3";
47 = "Dirt #4";
48 = "Dirt #5";
49 = "Dirt #6";
54 = "Glass shard #1";
55 = "Glass shard #2";
56 = "Glass shard #3";
57 = "Glass shard #4";
58 = "Glass shard #5";
59 = "Glass shard #6";
60 = "Glass shard #7";
61 = "Glass shard #8";
62 = "Glass shard #9";
63 = "Glass shard #10";
120 = "Weredragon Shot";
123 = "Volcano Blast";
124 = "Tiny Volcano Blast";
131 = "Golem Shot";
138 = "Ophidian Blue Shot";
139 = "Ophidian Yellow Shot";
140 = "Disciple Shot";
141 = "D'Sparil Teleportation Spot";
144 = "Chaos Serpent Shot";
145 = "D'Sparil Shot";
147 = "Main Crossbow Shot";
148 = "Tomed Crossbow Shot";
149 = "Secondary Crossbow Shot";
151 = "Small Goldwand Shot";
152 = "Tomed Goldwand Shot";
164 = "Iron Lich Ice Shot";
165 = "Iron Lich Whirlwind";
}
}
enums_hexen
@ -1133,7 +1220,7 @@ enums_hexen
69 = "Falcon Shield";
70 = "Platinum Helm";
71 = "Amulet Of Warding";
72 = "Fléchette";
72 = "Flechette";
73 = "Torch";
74 = "Disc of Repulsion";
75 = "Combined Mana";
@ -1174,6 +1261,36 @@ enums_hexen
130 = "Blood";
133 = "Icon of the Defender";
}
spawn_projectile
{
10 = "Fireball";
40 = "Porkalator Shot";
41 = "Rock debris #1";
42 = "Rock debris #2";
43 = "Rock debris #3";
44 = "Dirt #1";
45 = "Dirt #2";
46 = "Dirt #3";
47 = "Dirt #4";
48 = "Dirt #5";
49 = "Dirt #6";
50 = "Arrow";
51 = "Dart";
52 = "Poison Dart";
53 = "Ripper Ball";
54 = "Glass shard #1";
55 = "Glass shard #2";
56 = "Glass shard #3";
57 = "Glass shard #4";
58 = "Glass shard #5";
59 = "Glass shard #6";
60 = "Glass shard #7";
61 = "Glass shard #8";
62 = "Glass shard #9";
63 = "Glass shard #10";
65 = "Ice Shard";
}
puzzle_items
{
@ -1237,30 +1354,9 @@ enums_strife
spawnthing
{
11 = "Clip Of Bullets";
40 = "Morph Ovum Shot";
41 = "Rock debris #1";
42 = "Rock debris #2";
43 = "Rock debris #3";
44 = "Dirt #1";
45 = "Dirt #2";
46 = "Dirt #3";
47 = "Dirt #4";
48 = "Dirt #5";
49 = "Dirt #6";
54 = "Glass shard #1";
55 = "Glass shard #2";
56 = "Glass shard #3";
57 = "Glass shard #4";
58 = "Glass shard #5";
59 = "Glass shard #6";
60 = "Glass shard #7";
61 = "Glass shard #8";
62 = "Glass shard #9";
63 = "Glass shard #10";
68 = "Leather Armor";
69 = "Metal Armor";
75 = "Energy Pod";
130 = "Blood";
135 = "Shadow Armor";
136 = "Environmental Suit";
137 = "Computer Map";

View file

@ -865,6 +865,7 @@
<Compile Include="Rendering\SurfaceEntryCollection.cs" />
<Compile Include="Rendering\SurfaceManager.cs" />
<Compile Include="Rendering\SurfaceUpdate.cs" />
<Compile Include="Types\AngleByteHandler.cs" />
<Compile Include="Types\RandomFloatHandler.cs" />
<Compile Include="Types\RandomIntegerHandler.cs" />
<Compile Include="Types\ThingClassHandler.cs" />

View file

@ -30,8 +30,8 @@ namespace CodeImp.DoomBuilder.Config
#region ================== Variables
private string value;
private string title;
private readonly string value;
private readonly string title;
#endregion
@ -66,10 +66,7 @@ namespace CodeImp.DoomBuilder.Config
public int GetIntValue()
{
int result;
if(int.TryParse(value, NumberStyles.Integer, CultureInfo.InvariantCulture, out result))
return result;
else
return 0;
return int.TryParse(value, NumberStyles.Integer, CultureInfo.InvariantCulture, out result) ? result : 0;
}
#endregion

View file

@ -280,7 +280,7 @@ namespace CodeImp.DoomBuilder.Controls
list.SelectedIndex--;
list_SelectionChangeCommitted(list, EventArgs.Empty);
}
else if (e.Delta > 0 && list.SelectedIndex < list.Items.Count)
else if (e.Delta > 0 && list.SelectedIndex < list.Items.Count - 1)
{
list.SelectedIndex++;
list_SelectionChangeCommitted(list, EventArgs.Empty);

View file

@ -40,7 +40,6 @@ namespace CodeImp.DoomBuilder.Controls
private TypeHandler typehandler;
private bool ignorebuttonchange;
private bool gotTagArgument;
#endregion
@ -89,17 +88,9 @@ namespace CodeImp.DoomBuilder.Controls
// When the entered value needs to be validated
private void combobox_Validating(object sender, CancelEventArgs e)
{
//mxd
if(gotTagArgument && combobox.SelectedItem != null)
{
typehandler.SetValue(((TagInfo)combobox.SelectedItem).Tag);
return;
}
string str = combobox.Text.Trim().ToLowerInvariant();
str = str.TrimStart('+', '-');
int num;
// Anything in the box?
if(combobox.Text.Trim().Length > 0)
{
@ -107,6 +98,7 @@ namespace CodeImp.DoomBuilder.Controls
if(CheckIsRelative())
{
// Try parsing to number
int num;
if(!int.TryParse(str, NumberStyles.Integer, CultureInfo.CurrentCulture, out num))
{
// Invalid relative number
@ -192,120 +184,10 @@ namespace CodeImp.DoomBuilder.Controls
combobox.SelectedItem = null;
combobox.Items.Clear();
//mxd. Special cases, special cases...
if(typehandler is ThingTagHandler)
{
gotTagArgument = true;
//collect thing tags
List<int> tags = new List<int>();
List<TagInfo> infos = new List<TagInfo>();
foreach(Thing t in General.Map.Map.Things)
{
if(t.Tag == 0 || tags.Contains(t.Tag)) continue;
tags.Add(t.Tag);
}
//now sort them
tags.Sort();
//create tag infos
foreach(int tag in tags)
{
if(General.Map.Options.TagLabels.ContainsKey(tag)) //tag labels
infos.Add(new TagInfo(tag, General.Map.Options.TagLabels[tag]));
else
infos.Add(new TagInfo(tag, string.Empty));
}
// Show the combobox
button.Visible = false;
scrollbuttons.Visible = false;
combobox.DropDownStyle = ComboBoxStyle.DropDown;
foreach(TagInfo info in infos)
combobox.Items.Add(info);
combobox.DropDownWidth = Tools.GetDropDownWidth(combobox);
}
else if(typehandler is LinedefTagHandler)
{
gotTagArgument = true;
//collect linedef tags
List<int> tags = new List<int>();
List<TagInfo> infos = new List<TagInfo>();
foreach(Linedef t in General.Map.Map.Linedefs)
{
if(t.Tag == 0 || tags.Contains(t.Tag)) continue;
tags.Add(t.Tag);
}
//now sort them
tags.Sort();
//create tag infos
foreach(int tag in tags)
{
if(General.Map.Options.TagLabels.ContainsKey(tag)) //tag labels
infos.Add(new TagInfo(tag, General.Map.Options.TagLabels[tag]));
else
infos.Add(new TagInfo(tag, string.Empty));
}
// Show the combobox
button.Visible = false;
scrollbuttons.Visible = false;
combobox.DropDownStyle = ComboBoxStyle.DropDown;
foreach(TagInfo info in infos)
combobox.Items.Add(info);
combobox.DropDownWidth = Tools.GetDropDownWidth(combobox);
}
else if(typehandler is SectorTagHandler)
{
gotTagArgument = true;
//collect sector tags
List<int> tags = new List<int>();
List<TagInfo> infos = new List<TagInfo>();
foreach(Sector t in General.Map.Map.Sectors)
{
if(t.Tag == 0 || tags.Contains(t.Tag)) continue;
tags.Add(t.Tag);
}
//now sort them
tags.Sort();
//create tag infos
foreach(int tag in tags)
{
if(General.Map.Options.TagLabels.ContainsKey(tag)) //tag labels
infos.Add(new TagInfo(tag, General.Map.Options.TagLabels[tag]));
else
infos.Add(new TagInfo(tag, string.Empty));
}
// Show the combobox
button.Visible = false;
scrollbuttons.Visible = false;
combobox.DropDownStyle = ComboBoxStyle.DropDown;
foreach(TagInfo info in infos)
combobox.Items.Add(info);
combobox.DropDownWidth = Tools.GetDropDownWidth(combobox);
}
// Check if this supports enumerated options
else if(typehandler.IsEnumerable)
if(typehandler.IsEnumerable)
{
// Show the combobox
gotTagArgument = false; //mxd
button.Visible = false;
scrollbuttons.Visible = false;
combobox.DropDownStyle = ComboBoxStyle.DropDown;
@ -316,7 +198,6 @@ namespace CodeImp.DoomBuilder.Controls
else if(typehandler.IsBrowseable)
{
// Show the button
gotTagArgument = false; //mxd
button.Visible = true;
button.Image = typehandler.BrowseImage;
scrollbuttons.Visible = false;
@ -325,14 +206,13 @@ namespace CodeImp.DoomBuilder.Controls
else
{
// Show textbox with scroll buttons
gotTagArgument = false; //mxd
button.Visible = false;
scrollbuttons.Visible = true;
combobox.DropDownStyle = ComboBoxStyle.Simple;
}
//mxd
if(gotTagArgument)
if(typehandler.IsEnumerable)
{
combobox.AutoCompleteMode = AutoCompleteMode.Suggest;
combobox.AutoCompleteSource = AutoCompleteSource.ListItems;
@ -354,20 +234,6 @@ namespace CodeImp.DoomBuilder.Controls
public void SetValue(int value)
{
typehandler.SetValue(value);
if(gotTagArgument) //mxd
{
foreach(object item in combobox.Items)
{
TagInfo info = (TagInfo)item;
if(info.Tag == value)
{
combobox.SelectedItem = item;
return;
}
}
}
combobox.SelectedItem = null;
combobox.Text = typehandler.GetStringValue();
combobox_Validating(this, new CancelEventArgs());
@ -376,8 +242,6 @@ namespace CodeImp.DoomBuilder.Controls
//mxd. this sets default value
public void SetDefaultValue()
{
if(gotTagArgument) return; //default tag sounds a bit silly
typehandler.SetDefaultValue();
combobox.SelectedItem = null;
combobox.Text = typehandler.GetStringValue();
@ -402,10 +266,6 @@ namespace CodeImp.DoomBuilder.Controls
// This returns the selected value
public int GetResult(int original)
{
//mxd
if(gotTagArgument && combobox.SelectedItem != null)
return General.Clamp(((TagInfo)combobox.SelectedItem).Tag, General.Map.FormatInterface.MinArgument, General.Map.FormatInterface.MaxArgument);
int result;
// Strip prefixes

View file

@ -71,11 +71,23 @@ namespace CodeImp.DoomBuilder.Controls
return c;
}
//mxd
public int GetWidth()
{
if(columns < 1 || checkboxes.Count < 1) return 0;
int maxwidth = 0;
foreach (CheckBox cb in checkboxes)
{
if (cb.Width > maxwidth) maxwidth = cb.Width;
}
return maxwidth * columns;
}
//mxd
public int GetHeight()
{
if(columns < 1) return 0;
if(checkboxes.Count < 1) return 0;
if(columns < 1 || checkboxes.Count < 1) return 0;
int col = (int)Math.Ceiling(checkboxes.Count / (float)columns);
return col * checkboxes[0].Height + (col * spacingY + spacingY);
}
@ -88,8 +100,7 @@ namespace CodeImp.DoomBuilder.Controls
int col = 0;
// Checks
if(columns < 1) return;
if(checkboxes.Count < 1) return;
if(columns < 1 || checkboxes.Count < 1) return;
// Calculate column width
int columnwidth = this.ClientSize.Width / columns;

View file

@ -214,11 +214,11 @@ namespace CodeImp.DoomBuilder.Controls
//
// activation
//
this.activation.AutoEllipsis = true;
this.activation.AutoSize = true;
this.activation.BackColor = System.Drawing.Color.Transparent;
this.activation.Location = new System.Drawing.Point(66, 34);
this.activation.Name = "activation";
this.activation.Size = new System.Drawing.Size(205, 14);
this.activation.Size = new System.Drawing.Size(168, 14);
this.activation.TabIndex = 31;
this.activation.Text = "0 - When player does a barrel roll";
this.activation.UseMnemonic = false;
@ -417,11 +417,11 @@ namespace CodeImp.DoomBuilder.Controls
//
// action
//
this.action.AutoEllipsis = true;
this.action.AutoSize = true;
this.action.BackColor = System.Drawing.Color.Transparent;
this.action.Location = new System.Drawing.Point(66, 19);
this.action.Name = "action";
this.action.Size = new System.Drawing.Size(205, 14);
this.action.Size = new System.Drawing.Size(190, 14);
this.action.TabIndex = 1;
this.action.Text = "0 - Big Door that goes Wobbly Wobbly";
this.action.UseMnemonic = false;

View file

@ -35,7 +35,6 @@ namespace CodeImp.DoomBuilder.Controls
{
private readonly int hexenformatwidth;
private readonly int doomformatwidth;
private readonly int[] labelPositionsY = new[] { 39, 58, 77 }; //mxd
// Constructor
public LinedefInfoPanel()
@ -110,22 +109,8 @@ namespace CodeImp.DoomBuilder.Controls
}
}
activation.Top = labelPositionsY[0];
activationlabel.Top = labelPositionsY[0];
activation.Enabled = (l.Activate != 0); //mxd
activationlabel.Enabled = (l.Activate != 0); //mxd
unpegged.Top = labelPositionsY[0];
peglabel.Top = labelPositionsY[0];
length.Top = labelPositionsY[1];
lengthlabel.Top = labelPositionsY[1];
frontoffset.Top = labelPositionsY[1];
frontoffsetlabel.Top = labelPositionsY[1];
angle.Top = labelPositionsY[2];
anglelabel.Top = labelPositionsY[2];
backoffset.Top = labelPositionsY[2];
backoffsetlabel.Top = labelPositionsY[2];
}
else
{
@ -135,24 +120,9 @@ namespace CodeImp.DoomBuilder.Controls
tag.Visible = true;
//set tag
tag.Text = l.Tag + (General.Map.Options.TagLabels.ContainsKey(l.Tag) ? " (" + General.Map.Options.TagLabels[l.Tag] + ")" : string.Empty);
tag.Text = l.Tag + (General.Map.Options.TagLabels.ContainsKey(l.Tag) ? " - " + General.Map.Options.TagLabels[l.Tag] : string.Empty);
tag.Enabled = (l.Tag != 0);
taglabel.Enabled = (l.Tag != 0);
length.Top = labelPositionsY[0];
lengthlabel.Top = labelPositionsY[0];
unpegged.Top = labelPositionsY[0];
peglabel.Top = labelPositionsY[0];
angle.Top = labelPositionsY[1];
anglelabel.Top = labelPositionsY[1];
frontoffset.Top = labelPositionsY[1];
frontoffsetlabel.Top = labelPositionsY[1];
tag.Top = labelPositionsY[2];
taglabel.Top = labelPositionsY[2];
backoffset.Top = labelPositionsY[2];
backoffsetlabel.Top = labelPositionsY[2];
}
// Get line action information
@ -176,6 +146,8 @@ namespace CodeImp.DoomBuilder.Controls
length.Text = l.Length.ToString("0.##");
angle.Text = l.AngleDeg + "\u00B0";
unpegged.Text = peggedness;
unpegged.Enabled = (peggedness != "None"); //mxd
peglabel.Enabled = (peggedness != "None"); //mxd
action.Enabled = (act.Index != 0);
actionlabel.Enabled = (act.Index != 0);
@ -262,9 +234,18 @@ namespace CodeImp.DoomBuilder.Controls
else
{
frontoffsetlabel.Text = "Front offset:";
frontoffset.Text = l.Front.OffsetX + ", " + l.Front.OffsetY;
frontoffsetlabel.Enabled = true;
frontoffset.Enabled = true;
if (l.Front.OffsetX != 0 || l.Front.OffsetY != 0)
{
frontoffset.Text = l.Front.OffsetX + ", " + l.Front.OffsetY;
frontoffsetlabel.Enabled = true;
frontoffset.Enabled = true;
}
else
{
frontoffset.Text = "--, --";
frontoffsetlabel.Enabled = false;
frontoffset.Enabled = false;
}
//mxd. Sector index
frontpanel.Text += ". Sector " + l.Front.Sector.Index + " ";
@ -364,9 +345,18 @@ namespace CodeImp.DoomBuilder.Controls
else
{
backoffsetlabel.Text = "Back offset:";
backoffset.Text = l.Back.OffsetX + ", " + l.Back.OffsetY;
backoffsetlabel.Enabled = true;
backoffset.Enabled = true;
if (l.Back.OffsetX != 0 || l.Back.OffsetY != 0)
{
backoffset.Text = l.Back.OffsetX + ", " + l.Back.OffsetY;
backoffsetlabel.Enabled = true;
backoffset.Enabled = true;
}
else
{
backoffset.Text = "--, --";
backoffsetlabel.Enabled = false;
backoffset.Enabled = false;
}
// Sector index
backpanel.Text += ". Sector " + l.Back.Sector.Index + " ";
@ -526,11 +516,6 @@ namespace CodeImp.DoomBuilder.Controls
TypeHandler th = General.Types.GetArgumentHandler(info);
th.SetValue(value);
label.Text = th.GetStringValue();
if(value < 1 || !General.Map.Options.TagLabels.ContainsKey(value)) return;
if(th is ThingTagHandler || th is LinedefTagHandler || th is SectorTagHandler)
label.Text += " (" + General.Map.Options.TagLabels[value] + ")";
}
// When visible changed

View file

@ -159,46 +159,4 @@
<metadata name="frontoffset.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="unpegged.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="peglabel.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="arg5.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="arglbl5.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="arglbl4.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="arg4.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="arglbl3.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="arglbl2.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="arg3.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="arglbl1.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="arg2.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="backoffset.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="arg1.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="frontoffset.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
</root>

View file

@ -64,7 +64,7 @@ namespace CodeImp.DoomBuilder.Controls
effect.Text = effectinfo;
ceiling.Text = s.CeilHeight.ToString();
floor.Text = s.FloorHeight.ToString();
tag.Text = s.Tag + (General.Map.Options.TagLabels.ContainsKey(s.Tag) ? " (" + General.Map.Options.TagLabels[s.Tag] + ")" : string.Empty);
tag.Text = s.Tag + (General.Map.Options.TagLabels.ContainsKey(s.Tag) ? " - " + General.Map.Options.TagLabels[s.Tag] : string.Empty);
height.Text = sheight.ToString();
brightness.Text = s.Brightness.ToString();
floorname.Text = s.FloorTexture;

View file

@ -68,9 +68,8 @@ namespace CodeImp.DoomBuilder.Controls
infopanel.Width = (hasArgs ? hexenformatwidth : doomformatwidth);
//mxd
bool hasAction = General.Map.FormatInterface.HasThingAction;
action.Visible = hasAction;
labelaction.Visible = hasAction;
action.Visible = General.Map.FormatInterface.HasThingAction;
labelaction.Visible = General.Map.FormatInterface.HasThingAction;
// Move panel
spritepanel.Left = infopanel.Left + infopanel.Width + infopanel.Margin.Right + spritepanel.Margin.Left;
@ -125,7 +124,7 @@ namespace CodeImp.DoomBuilder.Controls
type.Text = t.Type + " - " + ti.Title;
action.Text = actioninfo;
position.Text = t.Position.x + ", " + t.Position.y + ", " + zinfo;
tag.Text = t.Tag + (General.Map.Options.TagLabels.ContainsKey(t.Tag) ? " (" + General.Map.Options.TagLabels[t.Tag] + ")" : string.Empty);
tag.Text = t.Tag + (General.Map.Options.TagLabels.ContainsKey(t.Tag) ? " - " + General.Map.Options.TagLabels[t.Tag] : string.Empty);
angle.Text = t.AngleDoom + "\u00B0";
anglecontrol.Angle = t.AngleDoom;
anglecontrol.Left = angle.Right + 1;
@ -217,13 +216,6 @@ namespace CodeImp.DoomBuilder.Controls
TypeHandler th = General.Types.GetArgumentHandler(info);
th.SetValue(value);
label.Text = th.GetStringValue();
if(value < 1 || !General.Map.Options.TagLabels.ContainsKey(value)) return;
if (th is ThingTagHandler || th is LinedefTagHandler || th is SectorTagHandler)
{
label.Text += " (" + General.Map.Options.TagLabels[value] + ")";
}
}
// When visible changed

View file

@ -18,7 +18,7 @@ namespace CodeImp.DoomBuilder.GZBuilder.Controls
public TagInfo(int tag, string label)
{
Label = (string.IsNullOrEmpty(label) ? tag.ToString() : tag + " (" + label + ")");
Label = (string.IsNullOrEmpty(label) ? tag.ToString() : tag + " - " + label);
Tag = tag;
}

View file

@ -418,11 +418,7 @@ namespace CodeImp.DoomBuilder {
grid.TranslateBackgroundName(config.UseLongTextureNames);
//mxd. Sector textures may've been changed
if (nameschanged)
{
data.UpdateUsedTextures();
General.Map.IsChanged = true;
}
if (nameschanged) data.UpdateUsedTextures();
// Update structures
options.ApplyGridSettings();
@ -1940,11 +1936,7 @@ namespace CodeImp.DoomBuilder {
grid.TranslateBackgroundName(config.UseLongTextureNames);
//mxd. Sector textures may've been changed
if (nameschanged)
{
data.UpdateUsedTextures();
General.Map.IsChanged = true;
}
if (nameschanged) data.UpdateUsedTextures();
// Done
General.MainWindow.DisplayReady();

View file

@ -0,0 +1,23 @@
#region ================== Namespaces
using System;
using System.Windows.Forms;
using CodeImp.DoomBuilder.Windows;
#endregion
namespace CodeImp.DoomBuilder.Types
{
[TypeHandler(UniversalType.AngleByte, "Byte Angle", true)]
internal class AngleByteHandler : AngleDegreesHandler
{
#region ================== Methods
public override void Browse(IWin32Window parent)
{
value = (int)Math.Round((float)AngleForm.ShowDialog(parent, (int)Math.Round((float)value / 256 * 360)) / 360 * 256);
}
#endregion
}
}

View file

@ -35,7 +35,7 @@ namespace CodeImp.DoomBuilder.Types
#region ================== Variables
private int value;
protected int value;
#endregion

View file

@ -35,7 +35,7 @@ namespace CodeImp.DoomBuilder.Types
private EnumList list;
private EnumItem value;
private EnumItem defaultValue; //mxd
private EnumItem defaultvalue; //mxd
#endregion
@ -46,12 +46,12 @@ namespace CodeImp.DoomBuilder.Types
#endregion
#region ================== Constructor
#region ================== Setup
// When set up for an argument
public override void SetupArgument(TypeHandlerAttribute attr, ArgumentInfo arginfo)
{
defaultValue = new EnumItem(arginfo.DefaultValue.ToString(), arginfo.DefaultValue.ToString());//mxd
defaultvalue = new EnumItem(arginfo.DefaultValue.ToString(), arginfo.DefaultValue.ToString());//mxd
base.SetupArgument(attr, arginfo);
// Keep enum list reference
@ -142,7 +142,7 @@ namespace CodeImp.DoomBuilder.Types
//mxd
public override void SetDefaultValue()
{
value = defaultValue;
value = defaultvalue;
}
public override object GetValue()

View file

@ -16,12 +16,46 @@
#region ================== Namespaces
using System.Collections.Generic;
using CodeImp.DoomBuilder.Config;
using CodeImp.DoomBuilder.Map;
#endregion
namespace CodeImp.DoomBuilder.Types
{
[TypeHandler(UniversalType.LinedefTag, "Linedef Tag", true)]
internal class LinedefTagHandler : IntegerHandler
internal class LinedefTagHandler : SectorTagHandler
{
#region ================== Setup
protected override EnumList CreateTagList()
{
//collect tags
List<int> tags = new List<int>();
EnumList taglist = new EnumList();
foreach(Linedef t in General.Map.Map.Linedefs)
{
if(t.Tag == 0 || tags.Contains(t.Tag)) continue;
tags.Add(t.Tag);
}
//now sort them
tags.Sort();
//create enum items
foreach(int tag in tags)
{
if(General.Map.Options.TagLabels.ContainsKey(tag)) //tag labels
taglist.Add(new EnumItem(tag.ToString(), General.Map.Options.TagLabels[tag]));
else
taglist.Add(new EnumItem(tag.ToString(), tag.ToString()));
}
return taglist;
}
#endregion
}
}

View file

@ -16,6 +16,12 @@
#region ================== Namespaces
using System;
using System.Collections.Generic;
using System.Globalization;
using CodeImp.DoomBuilder.Config;
using CodeImp.DoomBuilder.Map;
#endregion
namespace CodeImp.DoomBuilder.Types
@ -23,5 +29,185 @@ namespace CodeImp.DoomBuilder.Types
[TypeHandler(UniversalType.SectorTag, "Sector Tag", true)]
internal class SectorTagHandler : IntegerHandler
{
#region ================== Variables
private EnumList list;
private EnumItem value;
private EnumItem defaultvalue;
#endregion
#region ================== Properties
public override bool IsEnumerable { get { return true; } }
#endregion
#region ================== Setup
// When set up for an argument
public override void SetupArgument(TypeHandlerAttribute attr, ArgumentInfo arginfo)
{
defaultvalue = new EnumItem("0", "0: No Tag");
base.SetupArgument(attr, arginfo);
// Create enum list reference
list = CreateTagList();
// Add default value
list.Insert(0, defaultvalue);
}
// When set up for a universal field
public override void SetupField(TypeHandlerAttribute attr, UniversalFieldInfo fieldinfo)
{
base.SetupField(attr, fieldinfo);
// Create enum list reference
list = CreateTagList();
}
//mxd
protected virtual EnumList CreateTagList()
{
//collect tags
List<int> tags = new List<int>();
EnumList taglist = new EnumList();
foreach(Sector t in General.Map.Map.Sectors)
{
if(t.Tag == 0 || tags.Contains(t.Tag)) continue;
tags.Add(t.Tag);
}
//now sort them
tags.Sort();
//create enum items
foreach(int tag in tags)
{
if(General.Map.Options.TagLabels.ContainsKey(tag)) //tag labels
taglist.Add(new EnumItem(tag.ToString(), tag + ": " + General.Map.Options.TagLabels[tag]));
else
taglist.Add(new EnumItem(tag.ToString(), tag.ToString()));
}
return taglist;
}
#endregion
#region ================== Methods
public override void SetValue(object value)
{
this.value = null;
// Input null?
if(value == null)
{
this.value = new EnumItem("0", "0: No Tag");
}
else
{
// Compatible type?
if((value is int) || (value is float) || (value is bool))
{
int intvalue = Convert.ToInt32(value);
// First try to match the value against the enum values
foreach(EnumItem item in list)
{
// Matching value?
if(item.GetIntValue() == intvalue)
{
// Set this value
this.value = item;
}
}
}
// No match found yet?
if(this.value == null)
{
// First try to match the value against the enum values
foreach(EnumItem item in list)
{
// Matching value?
if(item.Value == value.ToString())
{
// Set this value
this.value = item;
}
}
}
// No match found yet?
if(this.value == null)
{
// Try to match against the titles
foreach(EnumItem item in list)
{
// Matching value?
if(item.Title.ToLowerInvariant() == value.ToString().ToLowerInvariant())
{
// Set this value
this.value = item;
}
}
}
// Still no match found?
if(this.value == null)
{
// Make a dummy value
this.value = new EnumItem(value.ToString(), value.ToString());
this.value = new EnumItem(this.value.GetIntValue().ToString(CultureInfo.InvariantCulture), value.ToString());
}
}
}
//mxd
public override void SetDefaultValue()
{
value = defaultvalue;
}
public override object GetValue()
{
return GetIntValue();
}
public override int GetIntValue()
{
if(this.value != null)
{
// Parse the value to integer
int result;
return (int.TryParse(this.value.Value, NumberStyles.Integer,
CultureInfo.InvariantCulture, out result) ? result : 0);
}
return 0;
}
public override string GetStringValue()
{
return (this.value != null ? this.value.Title : "0: No Tag");
}
// This returns an enum list
public override EnumList GetEnumList()
{
return list;
}
// This returns the type to display for fixed fields
// Must be a custom usable type
public override TypeHandlerAttribute GetDisplayType()
{
return General.Types.GetAttribute((int)UniversalType.Integer);
}
#endregion
}
}

View file

@ -16,12 +16,46 @@
#region ================== Namespaces
using System.Collections.Generic;
using CodeImp.DoomBuilder.Config;
using CodeImp.DoomBuilder.Map;
#endregion
namespace CodeImp.DoomBuilder.Types
{
[TypeHandler(UniversalType.ThingTag, "Thing Tag", true)]
internal class ThingTagHandler : IntegerHandler
internal class ThingTagHandler : SectorTagHandler
{
#region ================== Setup
protected override EnumList CreateTagList()
{
//collect tags
List<int> tags = new List<int>();
EnumList taglist = new EnumList();
foreach(Thing t in General.Map.Map.Things)
{
if(t.Tag == 0 || tags.Contains(t.Tag)) continue;
tags.Add(t.Tag);
}
//now sort them
tags.Sort();
//create enum items
foreach(int tag in tags)
{
if(General.Map.Options.TagLabels.ContainsKey(tag)) //tag labels
taglist.Add(new EnumItem(tag.ToString(), General.Map.Options.TagLabels[tag]));
else
taglist.Add(new EnumItem(tag.ToString(), tag.ToString()));
}
return taglist;
}
#endregion
}
}

View file

@ -148,7 +148,7 @@ namespace CodeImp.DoomBuilder.Types
// This must returns an enum list when IsEnumerable is true
public virtual EnumList GetEnumList()
{
return null;
return new EnumList(); //mxd
}
// String representation

View file

@ -30,10 +30,10 @@ namespace CodeImp.DoomBuilder.Types
#region ================== Variables
private int index;
private string name;
private readonly int index;
private readonly string name;
private Type type;
private bool customusable;
private readonly bool customusable;
#endregion

View file

@ -20,7 +20,7 @@
namespace CodeImp.DoomBuilder.Types
{
public enum UniversalType : int
public enum UniversalType
{
Integer = 0,
Float = 1,
@ -43,6 +43,7 @@ namespace CodeImp.DoomBuilder.Types
ThingType = 18,
ThingClass = 19,
RandomInteger = 20, //mxd
RandomFloat = 21 //mxd
RandomFloat = 21, //mxd
AngleByte = 22, //mxd
}
}

View file

@ -84,7 +84,7 @@ namespace CodeImp.DoomBuilder.Windows
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "BitFlagsForm";
this.Opacity = 0;
this.Opacity = 1;
this.ShowIcon = false;
this.ShowInTaskbar = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;

View file

@ -30,7 +30,6 @@ namespace CodeImp.DoomBuilder.Windows
private bool setup;
private int value;
private readonly int initialFlagsHeight; //mxd
#endregion
@ -47,9 +46,6 @@ namespace CodeImp.DoomBuilder.Windows
{
// Initialize
InitializeComponent();
//mxd
initialFlagsHeight = options.Height;
}
#endregion
@ -122,12 +118,14 @@ namespace CodeImp.DoomBuilder.Windows
{
setup = true;
this.value = value;
int optionsheight = options.Height;
// Make a checkbox for each item
foreach(EnumItem item in flags)
{
// Make the checkbox
CheckBox box = options.Add(item.Title, item.GetIntValue());
int flag = item.GetIntValue(); //mxd
CheckBox box = options.Add(flag + ": " + item.Title, item.GetIntValue());
// Bind checking event
box.CheckedChanged += box_CheckedChanged;
@ -154,8 +152,10 @@ namespace CodeImp.DoomBuilder.Windows
}
}
//mxd
this.Height -= initialFlagsHeight - options.GetHeight();
//mxd. Update window size
this.Height -= (optionsheight - options.GetHeight());
int targetwidth = options.GetWidth();
if(targetwidth > options.Width) this.Width += (targetwidth - options.Width);
setup = false;
}