mirror of
https://git.do.srb2.org/STJr/UltimateZoneBuilder.git
synced 2024-11-29 23:22:32 +00:00
Fixed, Script Editor, Script names parser, DECORATE actor names parser: in some cases (for example, when entering utter garbage instead of proper acs), parsers could get stuck in an infinite loop...
Updated ZDoom_ACS.cfg.
This commit is contained in:
parent
8cf084fc41
commit
d72e642dce
7 changed files with 32 additions and 35 deletions
|
@ -318,7 +318,7 @@ keywords
|
|||
PolyWait = "void PolyWait(int polyid)";
|
||||
Print = "void Print(type:expression)\nPrint will print something to the screen.\nPrint will only display for the activator of the script\nFor printing to all players, use PrintBold.";
|
||||
PrintBold = "void PrintBold(type:expression)\nThis is exactly the same as Print, except all players will see the printed text\non the screen instead of just the activator of the script.";
|
||||
QuakeEx = "void QuakeEx(int tid, int intensityX, int intensityY, int intensityZ, int duration, int damrad, int tremrad, str sound[, int flags = 0[, float mulwavex = 1.0[, float mulwavey = 1.0[, float mulwavez = 1.0]]]])";
|
||||
QuakeEx = "bool QuakeEx(int tid, int intensityX, int intensityY, int intensityZ, int duration, int damrad, int tremrad, str sound[, int flags = 0[, float mulwavex = 1.0[, float mulwavey = 1.0[, float mulwavez = 1.0]]]])";
|
||||
Radius_Quake = "Radius_Quake(intensity, duration, damrad, tremrad, tid)";
|
||||
Radius_Quake2 = "void Radius_Quake2(int tid, int intensity, int duration, int damrad, int tremrad, str sound)";
|
||||
Random = "int Random(int min, int max)";
|
||||
|
|
|
@ -94,14 +94,14 @@ namespace CodeImp.DoomBuilder.GZBuilder.GZDoom
|
|||
//now find opening brace
|
||||
do
|
||||
{
|
||||
SkipWhitespace(true);
|
||||
if(!SkipWhitespace(true)) break;
|
||||
token = ReadToken();
|
||||
} while (token != "{");
|
||||
} while (!string.IsNullOrEmpty(token) && token != "{");
|
||||
|
||||
token = ReadLine();
|
||||
string name = "";
|
||||
|
||||
if (token.Length > 0)
|
||||
if (!string.IsNullOrEmpty(token))
|
||||
{
|
||||
int commentStart = token.IndexOf("//");
|
||||
if (commentStart != -1) //found comment
|
||||
|
@ -141,10 +141,10 @@ namespace CodeImp.DoomBuilder.GZBuilder.GZDoom
|
|||
{
|
||||
do
|
||||
{
|
||||
SkipWhitespace(true);
|
||||
if(!SkipWhitespace(true)) break;
|
||||
token = ReadToken();
|
||||
funcname += " " + token;
|
||||
} while(!token.Contains(")"));
|
||||
} while(!string.IsNullOrEmpty(token) && !token.Contains(")"));
|
||||
}
|
||||
|
||||
ScriptItem i = new ScriptItem(0, funcname, startPos, isinclude);
|
||||
|
|
|
@ -8,7 +8,7 @@ namespace CodeImp.DoomBuilder.GZBuilder.GZDoom
|
|||
{
|
||||
internal sealed class DecorateParserSE : ZDTextParser
|
||||
{
|
||||
private List<ScriptItem> actors;
|
||||
private readonly List<ScriptItem> actors;
|
||||
public List<ScriptItem> Actors { get { return actors; } }
|
||||
|
||||
public DecorateParserSE()
|
||||
|
@ -36,11 +36,12 @@ namespace CodeImp.DoomBuilder.GZBuilder.GZDoom
|
|||
|
||||
List<string> definition = new List<string>();
|
||||
|
||||
while ((token = ReadToken()) != "{")
|
||||
do
|
||||
{
|
||||
token = ReadToken();
|
||||
if(string.IsNullOrEmpty(token) || token == "{") break;
|
||||
definition.Add(token);
|
||||
SkipWhitespace(true);
|
||||
}
|
||||
} while(SkipWhitespace(true));
|
||||
|
||||
string name = "";
|
||||
foreach (string s in definition) name += s + " ";
|
||||
|
|
|
@ -14,13 +14,13 @@ namespace CodeImp.DoomBuilder.GZBuilder.GZDoom
|
|||
public delegate void IncludeDelegate(GldefsParser parser, string includefile);
|
||||
public IncludeDelegate OnInclude;
|
||||
|
||||
private Dictionary<string, DynamicLightData> lightsByName; //LightName, light definition
|
||||
private Dictionary<string, string> objects; //ClassName, LightName
|
||||
private readonly Dictionary<string, DynamicLightData> lightsByName; //LightName, light definition
|
||||
private readonly Dictionary<string, string> objects; //ClassName, LightName
|
||||
|
||||
public Dictionary<string, DynamicLightData> LightsByName { get { return lightsByName; } }
|
||||
public Dictionary<string, string> Objects { get { return objects; } }
|
||||
|
||||
private List<string> parsedLumps;
|
||||
private readonly List<string> parsedLumps;
|
||||
|
||||
private struct GldefsLightType
|
||||
{
|
||||
|
@ -30,7 +30,7 @@ namespace CodeImp.DoomBuilder.GZBuilder.GZDoom
|
|||
public const string FLICKER2 = "flickerlight2";
|
||||
public const string SECTOR = "sectorlight";
|
||||
|
||||
public static Dictionary<string, DynamicLightType> GLDEFS_TO_GZDOOM_LIGHT_TYPE = new Dictionary<string, DynamicLightType>(StringComparer.Ordinal) { { POINT, DynamicLightType.NORMAL }, { PULSE, DynamicLightType.PULSE }, { FLICKER, DynamicLightType.FLICKER }, { FLICKER2, DynamicLightType.RANDOM }, { SECTOR, DynamicLightType.SECTOR } };
|
||||
public static readonly Dictionary<string, DynamicLightType> GLDEFS_TO_GZDOOM_LIGHT_TYPE = new Dictionary<string, DynamicLightType>(StringComparer.Ordinal) { { POINT, DynamicLightType.NORMAL }, { PULSE, DynamicLightType.PULSE }, { FLICKER, DynamicLightType.FLICKER }, { FLICKER2, DynamicLightType.RANDOM }, { SECTOR, DynamicLightType.SECTOR } };
|
||||
}
|
||||
|
||||
public GldefsParser()
|
||||
|
|
|
@ -41,22 +41,22 @@ namespace CodeImp.DoomBuilder.GZBuilder.GZDoom {
|
|||
//returns true if parsing is finished
|
||||
private bool ParseBlock(string token, string mapName)
|
||||
{
|
||||
string curBlockName;
|
||||
if (token == "map" || token == "defaultmap" || token == "adddefaultmap")
|
||||
{
|
||||
curBlockName = token;
|
||||
if (token == "map") //check map name
|
||||
string curBlockName = token;
|
||||
switch(token)
|
||||
{
|
||||
case "map":
|
||||
//get map name
|
||||
SkipWhitespace(true);
|
||||
token = ReadToken().ToLowerInvariant();
|
||||
|
||||
if (token != mapName) return false; //not finished, search for next "map", "defaultmap" or "adddefaultmap" block
|
||||
}
|
||||
else if (token == "defaultmap")
|
||||
{
|
||||
break;
|
||||
|
||||
case "defaultmap":
|
||||
//reset MapInfo
|
||||
mapInfo = new MapInfo();
|
||||
break;
|
||||
}
|
||||
|
||||
//search for required keys
|
||||
|
|
|
@ -114,6 +114,8 @@ namespace CodeImp.DoomBuilder.GZBuilder.Windows
|
|||
"It's CRASHENING!",
|
||||
"W-W-W-WIPEOUT!",
|
||||
"EVERYTHING IS LOST!",
|
||||
"Your empty is full!",
|
||||
"Let's see how far this infinite loop goes...",
|
||||
};
|
||||
this.Text = titles[new Random().Next(0, titles.Length - 1)];
|
||||
}
|
||||
|
|
|
@ -36,19 +36,13 @@ namespace CodeImp.DoomBuilder.ZDoom
|
|||
|
||||
if(token == ",") //previous token was a sprite name
|
||||
{
|
||||
if(!string.IsNullOrEmpty(prevToken))
|
||||
{
|
||||
if(!spriteNames.Contains(prevToken)) spriteNames.Add(prevToken);
|
||||
}
|
||||
if(!string.IsNullOrEmpty(prevToken) && !spriteNames.Contains(prevToken)) spriteNames.Add(prevToken);
|
||||
prevToken = token.ToUpperInvariant();
|
||||
|
||||
}
|
||||
else if(token == "=") //next token should be a voxel model name
|
||||
{
|
||||
if(!string.IsNullOrEmpty(prevToken))
|
||||
{
|
||||
if(!spriteNames.Contains(prevToken)) spriteNames.Add(prevToken);
|
||||
}
|
||||
if(!string.IsNullOrEmpty(prevToken) && !spriteNames.Contains(prevToken)) spriteNames.Add(prevToken);
|
||||
|
||||
SkipWhitespace(true);
|
||||
token = ReadToken();
|
||||
|
|
Loading…
Reference in a new issue