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
parent a61f02f7cc
commit 56fec9eb14
2 changed files with 57 additions and 9 deletions

View file

@ -186,7 +186,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
if(args != null) if(args != null)
{ {
int x = 0; int x = 0;
argtext = " args: ("; argtext = ". Args: ";
//mxd. Check script name... //mxd. Check script name...
if(!string.IsNullOrEmpty(arg0str)) if(!string.IsNullOrEmpty(arg0str))
@ -209,7 +209,31 @@ namespace CodeImp.DoomBuilder.BuilderModes
} }
argtext += (x == 0 ? "" : ", ") + l.Args[x]; argtext += (x == 0 ? "" : ", ") + l.Args[x];
} }
argtext += ")"; }
//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());
}
} }
if(match) if(match)
@ -239,9 +263,9 @@ namespace CodeImp.DoomBuilder.BuilderModes
// Add to list // Add to list
LinedefActionInfo info = General.Map.Config.GetLinedefActionInfo(l.Action); LinedefActionInfo info = General.Map.Config.GetLinedefActionInfo(l.Action);
if(!info.IsNull) 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 else
objs.Add(new FindReplaceObject(l, "Linedef " + l.Index + argtext)); objs.Add(new FindReplaceObject(l, "Linedef " + l.Index + " (Action " + l.Action + argtext + ")"));
} }
} }
} }

View file

@ -190,7 +190,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
if(args != null) if(args != null)
{ {
int x = 0; int x = 0;
argtext = " args: ("; argtext = ". Args: ";
//mxd. Check script name... //mxd. Check script name...
if(!string.IsNullOrEmpty(arg0str)) if(!string.IsNullOrEmpty(arg0str))
@ -213,7 +213,31 @@ namespace CodeImp.DoomBuilder.BuilderModes
} }
argtext += (x == 0 ? "" : ", ") + t.Args[x]; argtext += (x == 0 ? "" : ", ") + t.Args[x];
} }
argtext += ")"; }
//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());
}
} }
if(match) if(match)
@ -242,7 +266,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
// Add to list // Add to list
ThingTypeInfo ti = General.Map.Data.GetThingInfo(t.Type); ThingTypeInfo ti = General.Map.Data.GetThingInfo(t.Type);
objs.Add(new FindReplaceObject(t, "Thing " + t.Index + " (" + ti.Title + ")" + argtext)); objs.Add(new FindReplaceObject(t, "Thing " + t.Index + " (" + ti.Title + argtext + ")"));
} }
} }
} }