diff --git a/Source/Core/Data/PK3StructuredReader.cs b/Source/Core/Data/PK3StructuredReader.cs index 68fce030..a7636a9a 100755 --- a/Source/Core/Data/PK3StructuredReader.cs +++ b/Source/Core/Data/PK3StructuredReader.cs @@ -779,8 +779,7 @@ namespace CodeImp.DoomBuilder.Data List files = new List(); // Can be several entries - files.AddRange(GetAllFilesWhichTitleStartsWith("", "LUA_", true)); - files.AddRange(GetFilesWithExt("", "lua", true)); + files.AddRange(GetAllFiles("lua", true)); // Add to collection foreach (string s in files) diff --git a/Source/Core/SRB2/LuaMobjStructure.cs b/Source/Core/SRB2/LuaMobjStructure.cs index 34993e77..3b4ba4c9 100644 --- a/Source/Core/SRB2/LuaMobjStructure.cs +++ b/Source/Core/SRB2/LuaMobjStructure.cs @@ -48,35 +48,20 @@ namespace CodeImp.DoomBuilder.ZDoom // Property begins with $? Then the whole line is a single value if (token.Contains("$")) { - bool isflag = false; - bool isname = false; - switch (token) { - case "$name": - token = "$title"; - isname = true; - break; case "$wallsprite": case "$flatsprite": case "$spawnceiling": - isflag = true; + flags[token.Substring(1)] = true; + parser.ReadLine(); + break; + case "$name": + token = "$title"; + goto default; + default: + props[token] = new List { (parser.SkipWhitespace(false) ? parser.ReadLine() : "") }; break; - } - // This is for editor-only properties such as $sprite and $category - string t = token; - if (isflag) - { - parser.SkipWhitespace(false); - string val = parser.ReadLine(); - flags[t.Substring(1)] = (val == "true" || val == "1") ? true : false; - } - else - props[token] = new List { (parser.SkipWhitespace(false) ? parser.ReadLine() : "") }; - - if (isname) - { - General.WriteLogLine("name = " + props["$title"][0]); } } else @@ -110,11 +95,10 @@ namespace CodeImp.DoomBuilder.ZDoom break; case "doomednum": doomednum = int.Parse(values[0]); - General.WriteLogLine("parsed doomednum: " + DoomEdNum); goto default; case "height": case "radius": - props[tokenname] = new List() { GetNumbers(values[0]).ToString() }; + props[tokenname] = new List() { ReadFracunit(values[0]).ToString() }; break; default: props[tokenname] = values; @@ -131,9 +115,12 @@ namespace CodeImp.DoomBuilder.ZDoom ParseCustomArguments(); } - private static string GetNumbers(string input) + private static string ReadFracunit(string input) { - return new string(input.Where(c => char.IsDigit(c)).ToArray()); + if (input.Contains("FRACUNIT") || input.Contains("FRACBITS")) + return new string(input.Where(c => char.IsDigit(c)).ToArray()); + else + return (Int32.Parse(input) >> 16).ToString(); } #endregion