mirror of
https://git.do.srb2.org/STJr/UltimateZoneBuilder.git
synced 2024-11-22 20:02:48 +00:00
Fixed: fixed a crash when determining sprite angles when there were sprites for both rotated (like TESTA2A8) and non-rotated (like TESTA0) versions of the same frame.
Fixed, Tags Selector control, UDMF: in some cases tags adding/removing worked unreliably when mixed tag values were used. Fixed, Arguments control: in some cases ending colon was not appended to argument names. Updated ZDoom_ACS.cfg. Updated ZDoom_DECORATE.cfg.
This commit is contained in:
parent
42607f704f
commit
06d7209871
12 changed files with 242 additions and 144 deletions
|
@ -562,6 +562,8 @@ constants
|
|||
APROP_JumpZ;
|
||||
APROP_Mass;
|
||||
APROP_MasterTID;
|
||||
APROP_MaxDropOffHeight;
|
||||
APROP_MaxStepHeight;
|
||||
APROP_MeleeRange;
|
||||
APROP_Nametag;
|
||||
APROP_Notarget;
|
||||
|
|
|
@ -111,7 +111,7 @@ keywords
|
|||
A_VileChase = "A_VileChase";
|
||||
A_Wander = "A_Wander";
|
||||
//Generic monster attacks
|
||||
A_CustomMissile = "A_CustomMissile(str missiletype[, float spawnheight = 0.0[, int spawnofs_horiz = 0[, int angle = 0[, int aimflags = 0[, int pitch = 0[, int target = AAPTR_TARGET]]]]]])";
|
||||
A_CustomMissile = "A_CustomMissile(str missiletype[, float spawnheight = 32.0[, float spawnofs_horiz = 0.0[, int angle = 0[, int aimflags = 0[, int pitch = 0[, int target = AAPTR_TARGET]]]]]])";
|
||||
A_CustomBulletAttack = "A_CustomBulletAttack(float horz_spread, float vert_spread, int numbullets, int damageperbullet[, str pufftype = \"BulletPuff\"[, float range = 0.0[, int flags = 0[, int target = AAPTR_TARGET]]]])";
|
||||
A_CustomRailgun = "A_CustomRailgun(int damage[, int offset[, color ringcolor[, color corecolor[, int flags = 0[, bool aim = false[, float maxdiff = 0.0[, str pufftype = \"\"[, float spread_xy = 0.0[, float spread_z = 0.0[, float range = 8192[, int duration = 35[, float sparsity = 1.0[, float driftspeed = 1.0[, str spawnclass = \"\"[, float spawnofs_z = 0[, int spiraloffset = 270]]]]]]]]]]]]]]]])";
|
||||
A_CustomMeleeAttack = "A_CustomMeleeAttack[(int damage = 0[, str meleesound = \"\"[, str misssound = \"\"[, str damagetype = \"Melee\"[, bool bleed = true]]]])]";
|
||||
|
@ -306,7 +306,7 @@ keywords
|
|||
A_Saw = "A_Saw[(str fullsound = \"weapons/sawfull\"[, str hitsound = \"weapons/sawhit\"[, int damage = 0[, str pufftype = \"BulletPuff\"[, int flags = 0[, float range = 65.0[, float spread_xy = 2.8125[, float spread_z = 0.0[, float lifesteal = 0.0[, int lifestealmax = 0[, str armorbonustype = \"ArmorBonus\"]]]]]]]]]])]";
|
||||
A_CustomPunch = "A_CustomPunch(int damage[, bool norandom = false[, int flags = 0[, str pufftype = \"BulletPuff\"[, float range = 64.0[, float lifesteal = 0.0[, int lifestealmax = 0[, str armorbonustype = \"ArmorBonus\"[, str meleesound[, str misssound]]]]]]]]])";
|
||||
A_FireBullets = "A_FireBullets(int spread_horz, int spread_vert, int numbullets, int damage[, str pufftype = \"\"[, int flags = FBF_USEAMMO[, float range = 0.0]]])";
|
||||
A_FireCustomMissile = "A_FireCustomMissile(str missiletype[, int angle = 0[, bool useammo = false[, int spawnofs_horz = 0[, int spawnheight = 0[, int flags = 0[, angle pitch = 0]]]]]])";
|
||||
A_FireCustomMissile = "A_FireCustomMissile(str missiletype[, int angle = 0[, bool useammo = false[, float spawnofs_horz = 0.0[, int spawnheight = 0[, int flags = 0[, angle pitch = 0]]]]]])";
|
||||
A_RailAttack = "A_RailAttack(int damage[, int spawnofs_horz[, bool useammo[, str ringcolor[, str corecolor[, int flags[, int maxdiff[, str pufftype[, float spread_xy = 0.0[, float spread_z = 0.0[, float range = 8192.0[, int duration = 35[, float sparsity = 1.0[, float driftspeed = 1.0[, str spawnclass[, float spawnofs_z = 0.0[, int spiraloffset = 270]]]]]]]]]]]]]]]])";
|
||||
A_FireAssaultGun = "A_FireAssaultGun";
|
||||
A_FireBFG = "A_FireBFG";
|
||||
|
|
|
@ -914,6 +914,7 @@
|
|||
<Compile Include="IO\DoomColormapReader.cs" />
|
||||
<Compile Include="IO\ClipboardStreamWriter.cs" />
|
||||
<Compile Include="Map\GroupInfo.cs" />
|
||||
<Compile Include="Map\ITaggedMapElement.cs" />
|
||||
<Compile Include="Map\SelectionType.cs" />
|
||||
<Compile Include="Map\MapElementCollection.cs" />
|
||||
<Compile Include="Map\SplitLineBehavior.cs" />
|
||||
|
|
|
@ -564,9 +564,15 @@ namespace CodeImp.DoomBuilder.Config
|
|||
return;
|
||||
}
|
||||
|
||||
if(targetangle < 0 || targetangle > 8)
|
||||
if(targetangle == 0)
|
||||
{
|
||||
General.ErrorLogger.Add(ErrorType.Error, "Error in actor \"" + title + "\":" + index + ", sprite \"" + s + "\". Sprite angle must be in [0..8] range");
|
||||
General.ErrorLogger.Add(ErrorType.Warning, "Warning: actor \"" + title + "\":" + index + ", sprite \"" + sourcename + "\", frame " + targetframe + " has both rotated and non-rotated versions");
|
||||
continue;
|
||||
}
|
||||
|
||||
if(targetangle < 1 || targetangle > 8)
|
||||
{
|
||||
General.ErrorLogger.Add(ErrorType.Error, "Error in actor \"" + title + "\":" + index + ", sprite \"" + s + "\". Expected sprite angle in [1..8] range");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -590,9 +596,15 @@ namespace CodeImp.DoomBuilder.Config
|
|||
return;
|
||||
}
|
||||
|
||||
if(targetangle < 0 || targetangle > 8)
|
||||
if(targetangle == 0)
|
||||
{
|
||||
General.ErrorLogger.Add(ErrorType.Error, "Error in actor \"" + title + "\":" + index + ", sprite \"" + s + "\". Sprite angle must be in [0..8] range");
|
||||
General.ErrorLogger.Add(ErrorType.Warning, "Warning: actor \"" + title + "\":" + index + ", sprite \"" + sourcename + "\", frame " + targetframe + " has both rotated and non-rotated versions");
|
||||
continue;
|
||||
}
|
||||
|
||||
if(targetangle < 1 || targetangle > 8)
|
||||
{
|
||||
General.ErrorLogger.Add(ErrorType.Error, "Error in actor \"" + title + "\":" + index + ", sprite \"" + s + "\". Expected sprite angle in [1..8] range");
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -373,7 +373,7 @@ namespace CodeImp.DoomBuilder.Controls
|
|||
}
|
||||
else
|
||||
{
|
||||
labels[i].Text = arginfo[i].Title;
|
||||
labels[i].Text = arginfo[i].Title + ":";
|
||||
labels[i].Enabled = arginfo[i].Used;
|
||||
UpdateToolTip(labels[i], arginfo[i]);
|
||||
}
|
||||
|
@ -385,7 +385,7 @@ namespace CodeImp.DoomBuilder.Controls
|
|||
{
|
||||
for(int i = 0; i < labels.Length; i++)
|
||||
{
|
||||
labels[i].Text = arginfo[i].Title;
|
||||
labels[i].Text = arginfo[i].Title + ":";
|
||||
labels[i].Enabled = arginfo[i].Used;
|
||||
UpdateToolTip(labels[i], arginfo[i]);
|
||||
args[i].ForeColor = (labels[i].Enabled ? SystemColors.WindowText : SystemColors.GrayText);
|
||||
|
|
|
@ -24,11 +24,11 @@ namespace CodeImp.DoomBuilder.GZBuilder.Controls
|
|||
|
||||
#region ================== Variables
|
||||
|
||||
private List<int> usedtags; //tags already used in the map
|
||||
private List<int> usedtags; // Tags already used in the map
|
||||
private List<TagInfo> infos;
|
||||
private List<int> tags; //tags being edited
|
||||
private List<int> rangemodes; //0 - none, 1 - positive (>=), -1 - negative (<=)
|
||||
private List<int> offsetmodes; //0 - none, 1 - positive (++), -1 - negative (--)
|
||||
private List<List<int>> tagspermapelement; // One list per each map element
|
||||
private List<int> rangemodes; // 0 - none, 1 - positive (>=), -1 - negative (<=)
|
||||
private List<int> offsetmodes; // 0 - none, 1 - positive (++), -1 - negative (--)
|
||||
private UniversalType elementtype;
|
||||
private const string TAGS_SEPARATOR = ", ";
|
||||
private int curtagindex;
|
||||
|
@ -41,22 +41,80 @@ namespace CodeImp.DoomBuilder.GZBuilder.Controls
|
|||
public TagsSelector()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
tagspermapelement = new List<List<int>>();
|
||||
usedtags = new List<int>();
|
||||
rangemodes = new List<int>();
|
||||
offsetmodes = new List<int>();
|
||||
infos = new List<TagInfo>();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ================== Setup
|
||||
|
||||
public void Setup(UniversalType mapelementtype)
|
||||
public void SetValues(ICollection<Sector> sectors)
|
||||
{
|
||||
List<IMultiTaggedMapElement> taglist = new List<IMultiTaggedMapElement>(sectors.Count);
|
||||
foreach(Sector s in sectors) taglist.Add(s);
|
||||
SetValues(taglist);
|
||||
}
|
||||
|
||||
public void SetValues(ICollection<Linedef> lines)
|
||||
{
|
||||
List<IMultiTaggedMapElement> taglist = new List<IMultiTaggedMapElement>(lines.Count);
|
||||
foreach(Linedef l in lines) taglist.Add(l);
|
||||
SetValues(taglist);
|
||||
}
|
||||
|
||||
private void SetValues(ICollection<IMultiTaggedMapElement> elements)
|
||||
{
|
||||
// Initial setup
|
||||
IMultiTaggedMapElement first = General.GetByIndex(elements, 0);
|
||||
if(first is Linedef)
|
||||
Setup(UniversalType.LinedefTag);
|
||||
else if(first is Sector)
|
||||
Setup(UniversalType.SectorTag);
|
||||
else
|
||||
throw new NotSupportedException(first + " doesn't support 'moreids' property!");
|
||||
|
||||
// Create tags collection
|
||||
int maxtagscount = 0;
|
||||
foreach(IMultiTaggedMapElement me in elements)
|
||||
{
|
||||
tagspermapelement.Add(new List<int>(me.Tags));
|
||||
if(me.Tags.Count > maxtagscount) maxtagscount = me.Tags.Count;
|
||||
}
|
||||
|
||||
// Make all lists the same length
|
||||
foreach(List<int> l in tagspermapelement)
|
||||
{
|
||||
if(l.Count < maxtagscount)
|
||||
for(int i = l.Count; i < maxtagscount; i++) l.Add(int.MaxValue);
|
||||
}
|
||||
|
||||
// Update collections
|
||||
List<int> tags = GetDisplayTags();
|
||||
|
||||
// Initialize modifier modes
|
||||
for(int i = 0; i < tags.Count; i++)
|
||||
{
|
||||
rangemodes.Add(0);
|
||||
offsetmodes.Add(0);
|
||||
}
|
||||
|
||||
// Update controls
|
||||
UpdateTagPicker(tags[0]);
|
||||
UpdateTagsList(tags);
|
||||
removetag.Enabled = (tags.Count > 1);
|
||||
clear.Enabled = (tagpicker.Text.Trim() != "0");
|
||||
}
|
||||
|
||||
private void Setup(UniversalType mapelementtype)
|
||||
{
|
||||
tags = new List<int>();
|
||||
usedtags = new List<int>();
|
||||
rangemodes = new List<int>();
|
||||
offsetmodes = new List<int>();
|
||||
infos = new List<TagInfo>();
|
||||
elementtype = mapelementtype;
|
||||
|
||||
//collect used tags from appropriate element type...
|
||||
// Collect used tags from appropriate element type...
|
||||
switch(elementtype)
|
||||
{
|
||||
case UniversalType.SectorTag:
|
||||
|
@ -83,18 +141,15 @@ namespace CodeImp.DoomBuilder.GZBuilder.Controls
|
|||
}
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
throw new NotSupportedException(elementtype + " doesn't support 'moreids' property!");
|
||||
}
|
||||
|
||||
//now sort them in descending order
|
||||
// Now sort them in descending order
|
||||
usedtags.Sort((a, b) => -1 * a.CompareTo(b));
|
||||
|
||||
//create tag infos
|
||||
// Create tag infos
|
||||
foreach(int tag in usedtags)
|
||||
{
|
||||
if(General.Map.Options.TagLabels.ContainsKey(tag)) //tag labels
|
||||
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));
|
||||
|
@ -104,102 +159,93 @@ namespace CodeImp.DoomBuilder.GZBuilder.Controls
|
|||
tagpicker.DropDownWidth = DoomBuilder.Geometry.Tools.GetDropDownWidth(tagpicker);
|
||||
}
|
||||
|
||||
// Update collections and controls
|
||||
public void FinishSetup()
|
||||
{
|
||||
if(tags.Count == 0) tags.Add(0);
|
||||
|
||||
// Initialize modifier modes
|
||||
for(int i = 0; i < tags.Count; i++)
|
||||
{
|
||||
rangemodes.Add(0);
|
||||
offsetmodes.Add(0);
|
||||
}
|
||||
|
||||
// Update controls
|
||||
UpdateTagPicker(tags[0]);
|
||||
UpdateTagsList();
|
||||
removetag.Enabled = (tags.Count > 1);
|
||||
clear.Enabled = (tagpicker.Text.Trim() != "0");
|
||||
}
|
||||
|
||||
public void SetValue(List<int> newtags, bool first)
|
||||
{
|
||||
if(first)
|
||||
{
|
||||
tags.AddRange(newtags);
|
||||
return;
|
||||
}
|
||||
|
||||
for(int i = 0; i < newtags.Count; i++)
|
||||
{
|
||||
if(i < tags.Count && newtags[i] != tags[i])
|
||||
tags[i] = int.MinValue;
|
||||
else if(i >= tags.Count)
|
||||
tags.Add(int.MinValue);
|
||||
}
|
||||
|
||||
// If current tags list is shorter than out tags list, mark the rest of our list as mixed
|
||||
if(newtags.Count < tags.Count)
|
||||
{
|
||||
for(int i = newtags.Count; i < tags.Count; i++)
|
||||
tags[i] = int.MinValue;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ================== Apply
|
||||
|
||||
public void ApplyTo(Linedef mo, int offset)
|
||||
public void ApplyTo(ICollection<Sector> sectors)
|
||||
{
|
||||
int[] oldtags = new int[mo.Tags.Count];
|
||||
mo.Tags.CopyTo(oldtags);
|
||||
mo.Tags.Clear();
|
||||
mo.Tags.AddRange(GetResultTags(oldtags, offset));
|
||||
List<IMultiTaggedMapElement> taglist = new List<IMultiTaggedMapElement>(sectors.Count);
|
||||
foreach(Sector s in sectors) taglist.Add(s);
|
||||
ApplyTo(taglist);
|
||||
}
|
||||
|
||||
public void ApplyTo(Sector mo, int offset)
|
||||
public void ApplyTo(ICollection<Linedef> lines)
|
||||
{
|
||||
int[] oldtags = new int[mo.Tags.Count];
|
||||
mo.Tags.CopyTo(oldtags);
|
||||
mo.Tags.Clear();
|
||||
mo.Tags.AddRange(GetResultTags(oldtags, offset));
|
||||
List<IMultiTaggedMapElement> taglist = new List<IMultiTaggedMapElement>(lines.Count);
|
||||
foreach(Linedef l in lines) taglist.Add(l);
|
||||
ApplyTo(taglist);
|
||||
}
|
||||
|
||||
private IEnumerable<int> GetResultTags(int[] oldtags, int offset)
|
||||
private void ApplyTo(IEnumerable<IMultiTaggedMapElement> elements)
|
||||
{
|
||||
HashSet<int> newtags = new HashSet<int>();
|
||||
|
||||
for(int i = 0; i < tags.Count; i++)
|
||||
int offset = 0;
|
||||
foreach(IMultiTaggedMapElement me in elements)
|
||||
{
|
||||
if(tags[i] == int.MinValue && oldtags.Length > i)
|
||||
// Create resulting tags list for this map element
|
||||
List<int> tags = tagspermapelement[offset];
|
||||
HashSet<int> newtags = new HashSet<int>();
|
||||
for(int i = 0; i < tags.Count; i++)
|
||||
{
|
||||
if(oldtags[i] != 0 && !newtags.Contains(oldtags[i])) newtags.Add(oldtags[i]);
|
||||
}
|
||||
else if(tags[i] != 0 && tags[i] != int.MinValue)
|
||||
{
|
||||
int tag;
|
||||
if(rangemodes[i] != 0)
|
||||
tag = tags[i] + offset * rangemodes[i];
|
||||
else if(offsetmodes[i] != 0 && oldtags.Length > i)
|
||||
tag = oldtags[i] + tags[i] * offsetmodes[i];
|
||||
else
|
||||
tag = tags[i];
|
||||
if(tags[i] == int.MaxValue) continue; // int.MaxValue is there only for padding
|
||||
if(tags[i] == int.MinValue && me.Tags.Count > i)
|
||||
{
|
||||
if(me.Tags[i] != 0 && !newtags.Contains(me.Tags[i])) newtags.Add(me.Tags[i]);
|
||||
}
|
||||
else if(tags[i] != 0 && tags[i] != int.MinValue)
|
||||
{
|
||||
int tag;
|
||||
if(rangemodes[i] != 0)
|
||||
tag = tags[i] + offset * rangemodes[i];
|
||||
else if(offsetmodes[i] != 0 && me.Tags.Count > i)
|
||||
tag = me.Tags[i] + tags[i] * offsetmodes[i];
|
||||
else
|
||||
tag = tags[i];
|
||||
|
||||
if(!newtags.Contains(tag)) newtags.Add(tag);
|
||||
if(!newtags.Contains(tag)) newtags.Add(tag);
|
||||
}
|
||||
}
|
||||
|
||||
if(newtags.Count == 0) newtags.Add(0);
|
||||
|
||||
// Apply it
|
||||
me.Tags.Clear();
|
||||
me.Tags.AddRange(newtags);
|
||||
|
||||
// We are making progress...
|
||||
offset++;
|
||||
}
|
||||
|
||||
if(newtags.Count == 0) newtags.Add(0);
|
||||
return newtags;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ================== Methods
|
||||
|
||||
private void UpdateTagsList()
|
||||
// Creates a single tag collection to display. int.MinValue means "mixed tag"
|
||||
private List<int> GetDisplayTags()
|
||||
{
|
||||
List<int> tags = new List<int>(tagspermapelement[0].Count);
|
||||
|
||||
// Padding values should stay in tagspermapelement
|
||||
foreach(int tag in tagspermapelement[0])
|
||||
{
|
||||
tags.Add(tag == int.MaxValue ? int.MinValue : tag);
|
||||
}
|
||||
|
||||
for(int i = 1; i < tagspermapelement.Count; i++)
|
||||
{
|
||||
// Check mixed values
|
||||
for(int c = 0; c < tagspermapelement[i].Count; c++)
|
||||
{
|
||||
if(tagspermapelement[i][c] != tags[c])
|
||||
tags[c] = int.MinValue;
|
||||
}
|
||||
}
|
||||
|
||||
return tags;
|
||||
}
|
||||
|
||||
private void UpdateTagsList(List<int> tags)
|
||||
{
|
||||
string[] displaytags = new string[tags.Count];
|
||||
int displaytagslen = 0;
|
||||
|
@ -290,6 +336,7 @@ namespace CodeImp.DoomBuilder.GZBuilder.Controls
|
|||
private void addtag_Click(object sender, EventArgs e)
|
||||
{
|
||||
// When an item has no tags, act like "New Tag" button
|
||||
List<int> tags = GetDisplayTags();
|
||||
if(tags.Count == 1 && tags[0] == 0)
|
||||
{
|
||||
newtag_Click(sender, e);
|
||||
|
@ -297,7 +344,13 @@ namespace CodeImp.DoomBuilder.GZBuilder.Controls
|
|||
}
|
||||
|
||||
int nt = General.Map.Map.GetNewTag(tags);
|
||||
|
||||
// Add to displayed tags list
|
||||
tags.Add(nt);
|
||||
|
||||
// Add to real tag lists
|
||||
foreach(List<int> l in tagspermapelement) l.Add(nt);
|
||||
|
||||
rangemodes.Add(0);
|
||||
offsetmodes.Add(0);
|
||||
curtagindex = tags.Count - 1;
|
||||
|
@ -308,12 +361,19 @@ namespace CodeImp.DoomBuilder.GZBuilder.Controls
|
|||
blockupdate = false;
|
||||
|
||||
removetag.Enabled = true;
|
||||
UpdateTagsList();
|
||||
UpdateTagsList(tags);
|
||||
}
|
||||
|
||||
private void removetag_Click(object sender, EventArgs e)
|
||||
{
|
||||
List<int> tags = GetDisplayTags();
|
||||
|
||||
// Remove from displayed tags list
|
||||
tags.RemoveAt(curtagindex);
|
||||
|
||||
// Remove from real tag lists
|
||||
foreach(List<int> l in tagspermapelement) l.RemoveAt(curtagindex);
|
||||
|
||||
rangemodes.RemoveAt(curtagindex);
|
||||
offsetmodes.RemoveAt(curtagindex);
|
||||
if(curtagindex >= tags.Count) curtagindex = tags.Count - 1;
|
||||
|
@ -322,20 +382,20 @@ namespace CodeImp.DoomBuilder.GZBuilder.Controls
|
|||
UpdateTagPicker(tags[curtagindex]);
|
||||
|
||||
removetag.Enabled = (tags.Count > 1);
|
||||
UpdateTagsList();
|
||||
UpdateTagsList(tags);
|
||||
}
|
||||
|
||||
private void clearalltags_Click(object sender, EventArgs e)
|
||||
{
|
||||
curtagindex = 0;
|
||||
|
||||
|
||||
// Clear real tag lists
|
||||
for(int i = 0; i < tagspermapelement.Count; i++)
|
||||
tagspermapelement[i] = new List<int> { 0 };
|
||||
|
||||
// Clear collections
|
||||
tags.Clear();
|
||||
tags.Add(0);
|
||||
rangemodes.Clear();
|
||||
rangemodes.Add(0);
|
||||
offsetmodes.Clear();
|
||||
offsetmodes.Add(0);
|
||||
rangemodes = new List<int> { 0 };
|
||||
offsetmodes = new List<int> { 0 };
|
||||
|
||||
// Update controls
|
||||
blockupdate = true;
|
||||
|
@ -343,7 +403,7 @@ namespace CodeImp.DoomBuilder.GZBuilder.Controls
|
|||
blockupdate = false;
|
||||
|
||||
removetag.Enabled = false;
|
||||
UpdateTagsList();
|
||||
UpdateTagsList(new List<int> { 0 });
|
||||
}
|
||||
|
||||
private void tagslist_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
|
||||
|
@ -354,7 +414,7 @@ namespace CodeImp.DoomBuilder.GZBuilder.Controls
|
|||
|
||||
// Update interface
|
||||
UpdateTagPicker(data.Tag);
|
||||
UpdateTagsList();
|
||||
UpdateTagsList(GetDisplayTags());
|
||||
}
|
||||
|
||||
private void tagpicker_TextChanged(object sender, EventArgs e)
|
||||
|
@ -362,43 +422,55 @@ namespace CodeImp.DoomBuilder.GZBuilder.Controls
|
|||
if(blockupdate) return;
|
||||
|
||||
clear.Enabled = (tagpicker.Text.Trim() != "0");
|
||||
List<int> tags = GetDisplayTags();
|
||||
if(tagpicker.SelectedItem != null)
|
||||
{
|
||||
TagInfo info = (TagInfo)tagpicker.SelectedItem;
|
||||
|
||||
// Set displayed tag
|
||||
tags[curtagindex] = info.Tag;
|
||||
UpdateTagsList();
|
||||
|
||||
// Apply to real tags
|
||||
foreach(List<int> l in tagspermapelement) l[curtagindex] = info.Tag;
|
||||
|
||||
UpdateTagsList(tags);
|
||||
return;
|
||||
}
|
||||
|
||||
string text = tagpicker.Text.Trim();
|
||||
if(string.IsNullOrEmpty(text))
|
||||
{
|
||||
// Set displayed tag
|
||||
tags[curtagindex] = int.MinValue;
|
||||
UpdateTagsList();
|
||||
|
||||
// Apply to real tags
|
||||
foreach(List<int> l in tagspermapelement) l[curtagindex] = int.MinValue;
|
||||
|
||||
UpdateTagsList(tags);
|
||||
return;
|
||||
}
|
||||
|
||||
//incremental?
|
||||
// Incremental?
|
||||
int rangemode = 0;
|
||||
int offsetmode = 0;
|
||||
if(text.Length > 2)
|
||||
{
|
||||
if(text.StartsWith(">=")) //range up
|
||||
if(text.StartsWith(">=")) // Range up
|
||||
{
|
||||
rangemode = 1;
|
||||
text = text.Substring(2, text.Length - 2);
|
||||
}
|
||||
else if(text.StartsWith("<=")) //range down
|
||||
else if(text.StartsWith("<=")) // Range down
|
||||
{
|
||||
rangemode = -1;
|
||||
text = text.Substring(2, text.Length - 2);
|
||||
}
|
||||
else if(text.StartsWith("++")) //relative up
|
||||
else if(text.StartsWith("++")) // Relative up
|
||||
{
|
||||
offsetmode = 1;
|
||||
text = text.Substring(2, text.Length - 2);
|
||||
}
|
||||
else if(text.StartsWith("--")) //relative down
|
||||
else if(text.StartsWith("--")) // Relative down
|
||||
{
|
||||
offsetmode = -1;
|
||||
text = text.Substring(2, text.Length - 2);
|
||||
|
@ -415,10 +487,15 @@ namespace CodeImp.DoomBuilder.GZBuilder.Controls
|
|||
return;
|
||||
}
|
||||
|
||||
// Set displayed tag
|
||||
tags[curtagindex] = tag;
|
||||
|
||||
// Apply to real tags
|
||||
foreach(List<int> l in tagspermapelement) l[curtagindex] = tag;
|
||||
|
||||
rangemodes[curtagindex] = rangemode;
|
||||
offsetmodes[curtagindex] = offsetmode;
|
||||
UpdateTagsList();
|
||||
UpdateTagsList(tags);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
14
Source/Core/Map/ITaggedMapElement.cs
Normal file
14
Source/Core/Map/ITaggedMapElement.cs
Normal file
|
@ -0,0 +1,14 @@
|
|||
using System.Collections.Generic;
|
||||
|
||||
namespace CodeImp.DoomBuilder.Map
|
||||
{
|
||||
public interface ITaggedMapElement
|
||||
{
|
||||
int Tag { get; set; }
|
||||
}
|
||||
|
||||
public interface IMultiTaggedMapElement : ITaggedMapElement
|
||||
{
|
||||
List<int> Tags { get; set; }
|
||||
}
|
||||
}
|
|
@ -28,7 +28,7 @@ using CodeImp.DoomBuilder.IO;
|
|||
|
||||
namespace CodeImp.DoomBuilder.Map
|
||||
{
|
||||
public sealed class Linedef : SelectableElement
|
||||
public sealed class Linedef : SelectableElement, IMultiTaggedMapElement
|
||||
{
|
||||
#region ================== Constants
|
||||
|
||||
|
|
|
@ -38,7 +38,7 @@ namespace CodeImp.DoomBuilder.Map
|
|||
FADE // sector uses UDMF "fade" sector property
|
||||
}
|
||||
|
||||
public sealed class Sector : SelectableElement
|
||||
public sealed class Sector : SelectableElement, IMultiTaggedMapElement
|
||||
{
|
||||
#region ================== Constants
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@ using CodeImp.DoomBuilder.VisualModes;
|
|||
|
||||
namespace CodeImp.DoomBuilder.Map
|
||||
{
|
||||
public sealed class Thing : SelectableElement
|
||||
public sealed class Thing : SelectableElement, ITaggedMapElement
|
||||
{
|
||||
#region ================== Constants
|
||||
|
||||
|
|
|
@ -285,10 +285,6 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
// Action
|
||||
action.Value = fl.Action;
|
||||
|
||||
//mxd. Tags
|
||||
tagsselector.Setup(UniversalType.LinedefTag);
|
||||
tagsselector.SetValue(fl.Tags, true);
|
||||
|
||||
//mxd. Args
|
||||
argscontrol.SetValue(fl, true);
|
||||
|
||||
|
@ -411,9 +407,8 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
//mxd. Comments
|
||||
commenteditor.SetValues(l.Fields, false);
|
||||
|
||||
// Action/tags
|
||||
// Action
|
||||
if(l.Action != action.Value) action.Empty = true;
|
||||
tagsselector.SetValue(l.Tags, false);
|
||||
|
||||
//mxd. Arguments
|
||||
argscontrol.SetValue(l, false);
|
||||
|
@ -546,6 +541,9 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
//mxd
|
||||
linedefprops.Add(new LinedefProperties(l));
|
||||
}
|
||||
|
||||
//mxd. Set tags
|
||||
tagsselector.SetValues(lines);
|
||||
|
||||
// Refresh controls so that they show their image
|
||||
backhigh.Refresh();
|
||||
|
@ -560,7 +558,6 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
CheckActivationFlagsRequired(); //mxd
|
||||
argscontrol.UpdateScriptControls(); //mxd
|
||||
actionhelp.UpdateAction(action.GetValue()); //mxd
|
||||
tagsselector.FinishSetup(); //mxd
|
||||
commenteditor.FinishSetup(); //mxd
|
||||
|
||||
//mxd. Update brightness reset buttons
|
||||
|
@ -677,7 +674,6 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
}
|
||||
|
||||
// Go for all the lines
|
||||
int tagoffset = 0; //mxd
|
||||
foreach(Linedef l in lines)
|
||||
{
|
||||
// UDMF activations
|
||||
|
@ -691,9 +687,8 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
}
|
||||
}
|
||||
|
||||
// Action/tags
|
||||
// Action
|
||||
if(!action.Empty) l.Action = action.Value;
|
||||
tagsselector.ApplyTo(l, tagoffset++); //mxd
|
||||
|
||||
//mxd. Apply args
|
||||
argscontrol.Apply(l);
|
||||
|
@ -754,6 +749,9 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
commenteditor.Apply(l.Fields);
|
||||
}
|
||||
|
||||
//mxd. Apply tags
|
||||
tagsselector.ApplyTo(lines);
|
||||
|
||||
//mxd. Store value linking
|
||||
linkFrontTopScale = pfcFrontScaleTop.LinkValues;
|
||||
linkFrontMidScale = pfcFrontScaleMid.LinkValues;
|
||||
|
|
|
@ -343,10 +343,6 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
SetupFloorSlope(sc, true);
|
||||
SetupCeilingSlope(sc, true);
|
||||
|
||||
// Action
|
||||
tagsselector.Setup(UniversalType.SectorTag); //mxd
|
||||
tagsselector.SetValue(sc.Tags, true);//mxd
|
||||
|
||||
// Custom fields
|
||||
fieldslist.SetValues(sc.Fields, true);
|
||||
|
||||
|
@ -464,9 +460,6 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
SetupFloorSlope(s, false);
|
||||
SetupCeilingSlope(s, false);
|
||||
|
||||
// Action
|
||||
tagsselector.SetValue(s.Tags, false); //mxd
|
||||
|
||||
// Custom fields
|
||||
fieldslist.SetValues(s.Fields, false);
|
||||
|
||||
|
@ -486,6 +479,9 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
}
|
||||
}
|
||||
|
||||
//mxd. Setup tags
|
||||
tagsselector.SetValues(sectors);
|
||||
|
||||
//mxd. Update slope controls
|
||||
ceilingslopecontrol.UpdateControls();
|
||||
floorslopecontrol.UpdateControls();
|
||||
|
@ -510,9 +506,8 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
if(useCeilSlopeLineAngles) ceilingslopecontrol.StepValues = anglesteps;
|
||||
if(useFloorSlopeLineAngles) floorslopecontrol.StepValues = anglesteps;
|
||||
|
||||
//mxd. Comments and Tags
|
||||
//mxd. Comments
|
||||
commenteditor.FinishSetup();
|
||||
tagsselector.FinishSetup();
|
||||
|
||||
preventchanges = false; //mxd
|
||||
}
|
||||
|
@ -700,7 +695,6 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
MakeUndo(); //mxd
|
||||
|
||||
// Go for all sectors
|
||||
int tagoffset = 0; //mxd
|
||||
foreach(Sector s in sectors)
|
||||
{
|
||||
// Apply all flags
|
||||
|
@ -716,9 +710,6 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
// Effects
|
||||
if(!effect.Empty) s.Effect = effect.Value;
|
||||
|
||||
//mxd. Tag
|
||||
tagsselector.ApplyTo(s, tagoffset++);
|
||||
|
||||
// Fields
|
||||
fieldslist.Apply(s.Fields);
|
||||
|
||||
|
@ -787,6 +778,9 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
}
|
||||
}
|
||||
|
||||
//mxd. Apply tags
|
||||
tagsselector.ApplyTo(sectors);
|
||||
|
||||
// Update the used textures
|
||||
General.Map.Data.UpdateUsedTextures();
|
||||
|
||||
|
|
Loading…
Reference in a new issue