Added, Find and Replace mode: action arguments are now displayed in "Linedef Action and Arguments" and "Thing Action and Arguments" search results.

This commit is contained in:
MaxED 2016-05-09 20:34:47 +00:00 committed by spherallic
parent 2be07ef1ee
commit 4b91a6d76b
2 changed files with 57 additions and 9 deletions

View file

@ -183,7 +183,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
if(args != null)
{
int x = 0;
argtext = " args: (";
argtext = ". Args: ";
//mxd. Check script name...
if(!string.IsNullOrEmpty(arg0str))
@ -204,9 +204,33 @@ namespace CodeImp.DoomBuilder.BuilderModes
match = false;
break;
}
argtext += (x == 0 ? "" : ",") + l.Args[x];
argtext += (x == 0 ? "" : ", ") + l.Args[x];
}
}
//mxd. Add action args
else
{
List<string> argslist = new List<string>();
// Process args, drop trailing zeroes
for(int i = l.Args.Length - 1; i > -1; i--)
{
if(l.Args[i] == 0 && argslist.Count == 0) continue; // Skip tail zeroes
argslist.Insert(0, l.Args[i].ToString());
}
// Process arg0str...
if(Array.IndexOf(GZGeneral.ACS_SPECIALS, l.Action) != -1)
{
string s = l.Fields.GetValue("arg0str", string.Empty);
if(!string.IsNullOrEmpty(s)) argslist[0] = "\"" + s + "\"";
}
// Create args string
if(argslist.Count > 0)
{
argtext = ". Args: " + string.Join(", ", argslist.ToArray());
}
argtext += ")";
}
if(match)
@ -236,9 +260,9 @@ namespace CodeImp.DoomBuilder.BuilderModes
// Add to list
LinedefActionInfo info = General.Map.Config.GetLinedefActionInfo(l.Action);
if(!info.IsNull)
objs.Add(new FindReplaceObject(l, "Linedef " + l.Index + " (" + info.Title + ")" + argtext));
objs.Add(new FindReplaceObject(l, "Linedef " + l.Index + " (" + info.Title + argtext + ")"));
else
objs.Add(new FindReplaceObject(l, "Linedef " + l.Index + argtext));
objs.Add(new FindReplaceObject(l, "Linedef " + l.Index + " (Action " + l.Action + argtext + ")"));
}
}
}

View file

@ -187,7 +187,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
if(args != null)
{
int x = 0;
argtext = " args: (";
argtext = ". Args: ";
//mxd. Check script name...
if(!string.IsNullOrEmpty(arg0str))
@ -208,9 +208,33 @@ namespace CodeImp.DoomBuilder.BuilderModes
match = false;
break;
}
argtext += (x == 0 ? "" : ",") + t.Args[x];
argtext += (x == 0 ? "" : ", ") + t.Args[x];
}
}
//mxd. Add action args
else
{
List<string> argslist = new List<string>();
// Process args, drop trailing zeroes
for(int i = t.Args.Length - 1; i > -1; i--)
{
if(t.Args[i] == 0 && argslist.Count == 0) continue; // Skip tail zeroes
argslist.Insert(0, t.Args[i].ToString());
}
// Process arg0str...
if(Array.IndexOf(GZGeneral.ACS_SPECIALS, t.Action) != -1)
{
string s = t.Fields.GetValue("arg0str", string.Empty);
if(!string.IsNullOrEmpty(s)) argslist[0] = "\"" + s + "\"";
}
// Create args string
if(argslist.Count > 0)
{
argtext = ". Args: " + string.Join(", ", argslist.ToArray());
}
argtext += ")";
}
if(match)
@ -239,7 +263,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
// Add to list
ThingTypeInfo ti = General.Map.Data.GetThingInfo(t.SRB2Type);
objs.Add(new FindReplaceObject(t, "Thing " + t.Index + " (" + ti.Title + ")" + argtext));
objs.Add(new FindReplaceObject(t, "Thing " + t.Index + " (" + ti.Title + argtext + ")"));
}
}
}