diff --git a/Source/Core/Properties/AssemblyInfo.cs b/Source/Core/Properties/AssemblyInfo.cs index a8360583a500fc24c186e5141c9883c782e16032..4e9b98444809885b3cd5b6b95802ccfbcdfcc221 100755 --- a/Source/Core/Properties/AssemblyInfo.cs +++ b/Source/Core/Properties/AssemblyInfo.cs @@ -30,6 +30,6 @@ using CodeImp.DoomBuilder; // Build Number // Revision // -[assembly: AssemblyVersion("2.3.0.2913")] +[assembly: AssemblyVersion("2.3.0.2915")] [assembly: NeutralResourcesLanguageAttribute("en")] -[assembly: AssemblyHash("5ff54ab")] +[assembly: AssemblyHash("e7ed533")] diff --git a/Source/Plugins/BuilderModes/FindReplace/FindLinedefTypes.cs b/Source/Plugins/BuilderModes/FindReplace/FindLinedefTypes.cs index ae6559643c48dce7e61436ada5611490fcb8af15..d3371373ba8af02d18a6d81aebdc88af88f36736 100755 --- a/Source/Plugins/BuilderModes/FindReplace/FindLinedefTypes.cs +++ b/Source/Plugins/BuilderModes/FindReplace/FindLinedefTypes.cs @@ -105,13 +105,13 @@ namespace CodeImp.DoomBuilder.BuilderModes int i = 1; //mxd. Named script search support... - if(General.Map.UDMF && Array.IndexOf(GZGeneral.ACS_SPECIALS, replaceaction) != -1) + if(General.Map.UDMF) { - string possiblescriptname = replaceparts[1].Trim().Replace("\"", "").ToLowerInvariant(); + string possiblescriptname = replaceparts[1].Trim(); int tmp; if(!string.IsNullOrEmpty(possiblescriptname) && possiblescriptname != "*" && !int.TryParse(possiblescriptname, out tmp)) { - replacearg0str = possiblescriptname; + replacearg0str = possiblescriptname.Replace("\"", ""); i = 2; } } @@ -141,22 +141,26 @@ namespace CodeImp.DoomBuilder.BuilderModes int[] args = null; string arg0str = string.Empty; //mxd - //parse the arg values out - if(parts.Length > 1) + bool isacs = Array.IndexOf(GZGeneral.ACS_SPECIALS, action) != -1; + + //parse the arg values out + if (parts.Length > 1) { args = new[] { int.MinValue, int.MinValue, int.MinValue, int.MinValue, int.MinValue }; int i = 1; - //mxd. Named script search support... - if(General.Map.UDMF && Array.IndexOf(GZGeneral.ACS_SPECIALS, action) != -1) + //mxd. Named script search support... + if (General.Map.UDMF) { - string possiblescriptname = parts[1].Trim().Replace("\"", "").ToLowerInvariant(); - int tmp; - if(!string.IsNullOrEmpty(possiblescriptname) && possiblescriptname != "*" && !int.TryParse(possiblescriptname, out tmp)) - { - arg0str = possiblescriptname; - i = 2; - } + // [ZZ] edit: we can enclose number with "" to signify a named script called "1". + // this is achieved by trying to parse the number before removing "'s. + string possiblescriptname = parts[1].Trim(); + int tmp; + if (!string.IsNullOrEmpty(possiblescriptname) && possiblescriptname != "*" && !int.TryParse(possiblescriptname, out tmp)) + { + arg0str = possiblescriptname.Replace("\"", "").ToLowerInvariant(); + i = 2; + } } for(; i < parts.Length && i < args.Length + 1; i++) @@ -244,16 +248,19 @@ namespace CodeImp.DoomBuilder.BuilderModes if(match) { - // Replace - if(replace) + // Replace + LinedefActionInfo info = General.Map.Config.GetLinedefActionInfo(l.Action); + + if (replace) { l.Action = replaceaction; + info = General.Map.Config.GetLinedefActionInfo(l.Action); - //mxd. Replace args as well? - if(replaceargs != null) + //mxd. Replace args as well? + if (replaceargs != null) { int i = 0; - if(!string.IsNullOrEmpty(replacearg0str)) + if(!string.IsNullOrEmpty(replacearg0str) && info.Args[0].Str) // [ZZ] make sure that arg0str is supported for this special. { l.Fields["arg0str"] = new UniValue(UniversalType.String, replacearg0str); i = 1; @@ -267,7 +274,6 @@ 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 + ")")); else diff --git a/Source/Plugins/BuilderModes/FindReplace/FindThingAction.cs b/Source/Plugins/BuilderModes/FindReplace/FindThingAction.cs index 144cad20346ece7b2744ff2e4e30d2953ab28d60..9e26b8ef68dbd2dba0e6c5211abdcf5b7b180184 100755 --- a/Source/Plugins/BuilderModes/FindReplace/FindThingAction.cs +++ b/Source/Plugins/BuilderModes/FindReplace/FindThingAction.cs @@ -111,19 +111,19 @@ namespace CodeImp.DoomBuilder.BuilderModes replaceargs = new[] { int.MinValue, int.MinValue, int.MinValue, int.MinValue, int.MinValue }; int i = 1; - //mxd. Named script search support... - if(General.Map.UDMF && Array.IndexOf(GZGeneral.ACS_SPECIALS, replaceaction) != -1) - { - string possiblescriptname = replaceparts[1].Trim().Replace("\"", "").ToLowerInvariant(); - int tmp; - if(!string.IsNullOrEmpty(possiblescriptname) && possiblescriptname != "*" && !int.TryParse(possiblescriptname, out tmp)) - { - replacearg0str = possiblescriptname; - i = 2; - } - } - - for(; i < replaceparts.Length && i < replaceargs.Length + 1; i++) + //mxd. Named script search support... + if (General.Map.UDMF) + { + string possiblescriptname = replaceparts[1].Trim(); + int tmp; + if (!string.IsNullOrEmpty(possiblescriptname) && possiblescriptname != "*" && !int.TryParse(possiblescriptname, out tmp)) + { + replacearg0str = possiblescriptname.Replace("\"", ""); + i = 2; + } + } + + for (; i < replaceparts.Length && i < replaceargs.Length + 1; i++) { int argout; if(replaceparts[i].Trim() == "*") continue; //mxd. Any arg value support @@ -154,19 +154,21 @@ namespace CodeImp.DoomBuilder.BuilderModes args = new[] { int.MinValue, int.MinValue, int.MinValue, int.MinValue, int.MinValue }; int i = 1; - //mxd. Named script search support... - if(General.Map.UDMF && Array.IndexOf(GZGeneral.ACS_SPECIALS, action) != -1) - { - string possiblescriptname = parts[1].Trim().Replace("\"", "").ToLowerInvariant(); - int tmp; - if(!string.IsNullOrEmpty(possiblescriptname) && possiblescriptname != "*" && !int.TryParse(possiblescriptname, out tmp)) - { - arg0str = possiblescriptname; - i = 2; - } - } - - for(; i < parts.Length && i < args.Length + 1; i++) + //mxd. Named script search support... + if (General.Map.UDMF) + { + // [ZZ] edit: we can enclose number with "" to signify a named script called "1". + // this is achieved by trying to parse the number before removing "'s. + string possiblescriptname = parts[1].Trim(); + int tmp; + if (!string.IsNullOrEmpty(possiblescriptname) && possiblescriptname != "*" && !int.TryParse(possiblescriptname, out tmp)) + { + arg0str = possiblescriptname.Replace("\"", "").ToLowerInvariant(); + i = 2; + } + } + + for (; i < parts.Length && i < args.Length + 1; i++) { int argout; if(parts[i].Trim() == "*") continue; //mxd. Any arg value support @@ -248,16 +250,20 @@ namespace CodeImp.DoomBuilder.BuilderModes if(match) { - // Replace - if(replace) + // Replace + ThingTypeInfo ti = General.Map.Data.GetThingInfo(t.Type); + + if (replace) { t.Action = replaceaction; + LinedefActionInfo info = (t.Action > 0) ? General.Map.Config.GetLinedefActionInfo(t.Action) : null; + ArgumentInfo[] arginfo = (info != null) ? info.Args : ti.Args; - //mxd. Replace args as well? - if(replaceargs != null) + //mxd. Replace args as well? + if (replaceargs != null) { int i = 0; - if(!string.IsNullOrEmpty(replacearg0str)) + if(!string.IsNullOrEmpty(replacearg0str) && arginfo[0].Str) { t.Fields["arg0str"] = new UniValue(UniversalType.String, replacearg0str); i = 1; @@ -271,7 +277,6 @@ namespace CodeImp.DoomBuilder.BuilderModes } // Add to list - ThingTypeInfo ti = General.Map.Data.GetThingInfo(t.Type); objs.Add(new FindReplaceObject(t, "Thing " + t.Index + " (" + ti.Title + argtext + ")")); } } diff --git a/Source/Plugins/BuilderModes/Properties/AssemblyInfo.cs b/Source/Plugins/BuilderModes/Properties/AssemblyInfo.cs index 995c59ac1c8ed756013a9a3f8f7014bb71347bb3..3225205cf95b8715ca964f50eedd54c3cd7fabe4 100755 --- a/Source/Plugins/BuilderModes/Properties/AssemblyInfo.cs +++ b/Source/Plugins/BuilderModes/Properties/AssemblyInfo.cs @@ -29,5 +29,5 @@ using System.Resources; // Build Number // Revision // -[assembly: AssemblyVersion("2.3.0.2913")] +[assembly: AssemblyVersion("2.3.0.2915")] [assembly: NeutralResourcesLanguageAttribute("en")]