From 3621ff78c139f2431fca9e26c964e355f90ee85c Mon Sep 17 00:00:00 2001 From: MaxED <j.maxed@gmail.com> Date: Sat, 19 Dec 2015 00:05:34 +0000 Subject: [PATCH] Fixed, UDMF parser: property names must be case-insensitive. Fixed, ANIMDEFS parser: camera texture names are limited to 8 chars in ZDoom. Fixed, Game configurations: Stalagtite:47 thing was named Stalagmite. Changed, Game configurations: moved Stalagmite:5050 thing to the "Obstacles" category. --- Build/Configurations/Includes/Doom_things.cfg | 4 +-- .../Configurations/Includes/ZDoom_things.cfg | 19 ++++++------ Source/Core/IO/UniversalParser.cs | 19 ++++++------ Source/Core/ZDoom/AnimdefsParser.cs | 30 ++++++++++++------- 4 files changed, 39 insertions(+), 33 deletions(-) diff --git a/Build/Configurations/Includes/Doom_things.cfg b/Build/Configurations/Includes/Doom_things.cfg index 5f8fae8bd..f56d6d809 100644 --- a/Build/Configurations/Includes/Doom_things.cfg +++ b/Build/Configurations/Includes/Doom_things.cfg @@ -543,9 +543,9 @@ obstacles 47 { - title = "Stalagmite"; + title = "Stalagtite"; sprite = "SMITA0"; - class = "Stalagmite"; + class = "Stalagtite"; } 43 diff --git a/Build/Configurations/Includes/ZDoom_things.cfg b/Build/Configurations/Includes/ZDoom_things.cfg index 1b824e496..2dd37261e 100644 --- a/Build/Configurations/Includes/ZDoom_things.cfg +++ b/Build/Configurations/Includes/ZDoom_things.cfg @@ -35,6 +35,15 @@ zdoom obstacles { blocking = 2; + + 5050 + { + title = "Stalagmite"; + sprite = "SMT2A0"; + class = "Stalagmite"; + width = 16; + height = 48; + } } lights @@ -1469,16 +1478,6 @@ doom { blocking = 2; } - - 5050 // Stalagmite - { - blocking = 2; - title = "Stalagmite"; - sprite = "SMT2A0"; - class = "Stalagmite"; - width = 16; - height = 48; - } } weapons diff --git a/Source/Core/IO/UniversalParser.cs b/Source/Core/IO/UniversalParser.cs index 791a8686d..c3a7f2900 100644 --- a/Source/Core/IO/UniversalParser.cs +++ b/Source/Core/IO/UniversalParser.cs @@ -21,7 +21,6 @@ using System.IO; using System.Text; using System.Globalization; using System.Collections.Generic; -using CodeImp.DoomBuilder.Map; #endregion @@ -141,32 +140,32 @@ namespace CodeImp.DoomBuilder.IO // error properties if key is invalid and errorline > -1 private bool ValidateKey(string key, int errorline) { - bool validateresult = true; - // Check if key is an empty string if(key.Length == 0) { // ERROR: Missing key name in statement if(errorline > -1) RaiseError(errorline, ERROR_KEYMISSING); - validateresult = false; + return false; } - else if(strictchecking) //Only when strict checking + + //Only when strict checking + if(strictchecking) { // Check if all characters are valid - foreach(char c in key) + string keylc = key.ToLowerInvariant(); //mxd. UDMF key names are case-insensitive + foreach(char c in keylc) { if(KEY_CHARACTERS.IndexOf(c) == -1) { // ERROR: Invalid characters in key name if(errorline > -1) RaiseError(errorline, ERROR_KEYCHARACTERS); - validateresult = false; - break; + return false; } } } - // Return result - return validateresult; + // Key is valid + return true; } diff --git a/Source/Core/ZDoom/AnimdefsParser.cs b/Source/Core/ZDoom/AnimdefsParser.cs index ff9941afe..944e7094a 100644 --- a/Source/Core/ZDoom/AnimdefsParser.cs +++ b/Source/Core/ZDoom/AnimdefsParser.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.IO; +using CodeImp.DoomBuilder.Data; #endregion @@ -58,8 +59,15 @@ namespace CodeImp.DoomBuilder.ZDoom string texturename = StripTokenQuotes(ReadToken(false)); if(string.IsNullOrEmpty(texturename)) { - ReportError("Expected camera texture name"); - break; + ReportError("expected camera texture name"); + return false; + } + + // Camera texture names are limited to 8 chars + if(texturename.Length > DataManager.CLASIC_IMAGE_NAME_LENGTH) + { + ReportError("camera texture names must be no longer than " + DataManager.CLASIC_IMAGE_NAME_LENGTH + " chars"); + return false; } // Width @@ -67,8 +75,8 @@ namespace CodeImp.DoomBuilder.ZDoom SkipWhitespace(true); if(!ReadSignedInt(ref width) || width < 1) { - ReportError("Expected camera texture width"); - break; + ReportError("expected camera texture width"); + return false; } // Height @@ -76,8 +84,8 @@ namespace CodeImp.DoomBuilder.ZDoom SkipWhitespace(true); if(!ReadSignedInt(ref height) || height < 1) { - ReportError("Expected camera texture height"); - break; + ReportError("expected camera texture height"); + return false; } // "Fit" keyword? @@ -96,16 +104,16 @@ namespace CodeImp.DoomBuilder.ZDoom SkipWhitespace(true); if(!ReadSignedInt(ref fitwidth) || fitwidth < 1) { - ReportError("Expected camera texture fit width"); - break; + ReportError("expected camera texture fit width"); + return false; } // Fit height SkipWhitespace(true); if(!ReadSignedInt(ref fitheight) || fitheight < 1) { - ReportError("Expected camera texture fit height"); - break; + ReportError("expected camera texture fit height"); + return false; } // Update scale @@ -124,7 +132,7 @@ namespace CodeImp.DoomBuilder.ZDoom if(cameratextures.ContainsKey(texturename.ToUpperInvariant())) { ReportError("Camera texture '" + texturename + "' is defined more than once"); - break; + return false; } // Store results -- GitLab