mirror of
https://git.do.srb2.org/STJr/UltimateZoneBuilder.git
synced 2024-11-22 20:02:48 +00:00
Lua parsing tweaks:
- All files in a PK3's Lua folder are now checked, instead of just LUA_ and .lua files - Slightly improve radius/height handling - Simplify wallsprite/flatsprite/spawnceiling settings
This commit is contained in:
parent
87069be13b
commit
a2324f5d98
2 changed files with 15 additions and 29 deletions
|
@ -779,8 +779,7 @@ namespace CodeImp.DoomBuilder.Data
|
||||||
List<string> files = new List<string>();
|
List<string> files = new List<string>();
|
||||||
|
|
||||||
// Can be several entries
|
// Can be several entries
|
||||||
files.AddRange(GetAllFilesWhichTitleStartsWith("", "LUA_", true));
|
files.AddRange(GetAllFiles("lua", true));
|
||||||
files.AddRange(GetFilesWithExt("", "lua", true));
|
|
||||||
|
|
||||||
// Add to collection
|
// Add to collection
|
||||||
foreach (string s in files)
|
foreach (string s in files)
|
||||||
|
|
|
@ -48,35 +48,20 @@ namespace CodeImp.DoomBuilder.ZDoom
|
||||||
// Property begins with $? Then the whole line is a single value
|
// Property begins with $? Then the whole line is a single value
|
||||||
if (token.Contains("$"))
|
if (token.Contains("$"))
|
||||||
{
|
{
|
||||||
bool isflag = false;
|
|
||||||
bool isname = false;
|
|
||||||
|
|
||||||
switch (token)
|
switch (token)
|
||||||
{
|
{
|
||||||
case "$name":
|
|
||||||
token = "$title";
|
|
||||||
isname = true;
|
|
||||||
break;
|
|
||||||
case "$wallsprite":
|
case "$wallsprite":
|
||||||
case "$flatsprite":
|
case "$flatsprite":
|
||||||
case "$spawnceiling":
|
case "$spawnceiling":
|
||||||
isflag = true;
|
flags[token.Substring(1)] = true;
|
||||||
|
parser.ReadLine();
|
||||||
|
break;
|
||||||
|
case "$name":
|
||||||
|
token = "$title";
|
||||||
|
goto default;
|
||||||
|
default:
|
||||||
|
props[token] = new List<string> { (parser.SkipWhitespace(false) ? parser.ReadLine() : "") };
|
||||||
break;
|
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<string> { (parser.SkipWhitespace(false) ? parser.ReadLine() : "") };
|
|
||||||
|
|
||||||
if (isname)
|
|
||||||
{
|
|
||||||
General.WriteLogLine("name = " + props["$title"][0]);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -110,11 +95,10 @@ namespace CodeImp.DoomBuilder.ZDoom
|
||||||
break;
|
break;
|
||||||
case "doomednum":
|
case "doomednum":
|
||||||
doomednum = int.Parse(values[0]);
|
doomednum = int.Parse(values[0]);
|
||||||
General.WriteLogLine("parsed doomednum: " + DoomEdNum);
|
|
||||||
goto default;
|
goto default;
|
||||||
case "height":
|
case "height":
|
||||||
case "radius":
|
case "radius":
|
||||||
props[tokenname] = new List<string>() { GetNumbers(values[0]).ToString() };
|
props[tokenname] = new List<string>() { ReadFracunit(values[0]).ToString() };
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
props[tokenname] = values;
|
props[tokenname] = values;
|
||||||
|
@ -131,9 +115,12 @@ namespace CodeImp.DoomBuilder.ZDoom
|
||||||
ParseCustomArguments();
|
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
|
#endregion
|
||||||
|
|
Loading…
Reference in a new issue