Skip to content

Commit 9487796

Browse files
committed
Fix for func_door_rotating angles
1 parent 83c71e3 commit 9487796

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

VMFInstanceInserter/VMFStructure.cs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ private static string TrimFGDLine(String line)
132132
}
133133

134134
private static readonly Regex _sIncludeRegex = new Regex("^@include \"[^\"]+\"");
135-
private static readonly Regex _sClassTypeRegex = new Regex("^@[A-Z]([A-Za-z])*Class( |=)");
135+
private static readonly Regex _sClassTypeRegex = new Regex("^@(?<classType>[A-Z]([A-Za-z])*Class)( |=)");
136136
private static readonly Regex _sBaseDefRegex = new Regex("base\\(\\s*[A-Za-z0-9_]+(\\s*,\\s*[A-Za-z0-9_]+)*\\s*\\)");
137137
private static readonly Regex _sParamDefRegex = new Regex("^[a-zA-Z0-9_]+\\s*\\(\\s*[A-Za-z0-9_]+\\s*\\)(\\s*readonly\\s*|\\s*):.*$");
138138
public static void ParseFGD(String path)
@@ -156,11 +156,13 @@ public static void ParseFGD(String path)
156156
line = line.TrimEnd('+', ' ', '\t') + TrimFGDLine(reader.ReadLine());
157157
}
158158

159+
Match match;
160+
159161
if (_sIncludeRegex.IsMatch(line)) {
160162
int start = line.IndexOf('"') + 1;
161163
int end = line.IndexOf('"', start);
162164
ParseFGD(Path.Combine(Path.GetDirectoryName(path), line.Substring(start, end - start)));
163-
} else if (_sClassTypeRegex.IsMatch(line)) {
165+
} else if ((match = _sClassTypeRegex.Match(line)).Success) {
164166
int start = line.IndexOf('=') + 1;
165167
int end = Math.Max(line.IndexOf(':', start), line.IndexOf('[', start));
166168
if (end == -1) end = line.Length;
@@ -172,6 +174,11 @@ public static void ParseFGD(String path)
172174

173175
curDict = stEntitiesDict[curName];
174176

177+
// Don't rotate angles for brush entities
178+
if (match.Groups["classType"].Value.Equals("SolidClass", StringComparison.InvariantCultureIgnoreCase)) {
179+
curDict.Add("angles", TransformType.None);
180+
}
181+
175182
var basesMatch = _sBaseDefRegex.Match(line);
176183
while (basesMatch.Success && basesMatch.Index < start) {
177184
int baseStart = basesMatch.Value.IndexOf('(') + 1;

0 commit comments

Comments
 (0)