mirror of
https://git.do.srb2.org/STJr/UltimateZoneBuilder.git
synced 2024-11-23 20:32:34 +00:00
0369c969d1
Draw Curve Mode: added settings panel. Sectors mode: added "Make Door" button to the toolbar. Swapped Side panel and Info panel z-order. Interface: split toolbar into 3 separate toolbars. All toolbar buttons are now viewable at 1024x768. Interface: grouped stuff in "Modes" menu a bit better. Interface: added "Draw [stuff]" buttons to modes toolbar. Interface: reorganized main menu. Hope it makes more sense now. API: added General.Interface.AddModesButton() and General.Interface.AddModesMenu(), which can be used to add buttons to specific group in "Modes" toolbar and menu items to specific group in "Modes" menu, so actions, which behave like an editing mode, but are not part of one can be added there.
78 lines
2.4 KiB
C#
78 lines
2.4 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.IO;
|
|
using CodeImp.DoomBuilder.ZDoom;
|
|
using CodeImp.DoomBuilder.GZBuilder.Data;
|
|
|
|
namespace CodeImp.DoomBuilder.GZBuilder.GZDoom {
|
|
|
|
internal class ModeldefParser : ZDTextParser {
|
|
private Dictionary<string, ModelData> entries; //classname, entry
|
|
internal Dictionary<string, ModelData> Entries { get { return entries; } }
|
|
internal string Source { get { return sourcename; } }
|
|
|
|
internal ModeldefParser() {
|
|
entries = new Dictionary<string, ModelData>(StringComparer.Ordinal);
|
|
}
|
|
|
|
//should be called after all decorate actors are parsed
|
|
public override bool Parse(Stream stream, string sourcefilename) {
|
|
base.Parse(stream, sourcefilename);
|
|
entries = new Dictionary<string, ModelData>(StringComparer.Ordinal);
|
|
|
|
// Continue until at the end of the stream
|
|
while (SkipWhitespace(true)) {
|
|
string token = ReadToken();
|
|
|
|
if (token != null) {
|
|
token = StripTokenQuotes(token).ToLowerInvariant();
|
|
|
|
if (token == "model") { //model structure start
|
|
//find classname
|
|
SkipWhitespace(true);
|
|
string className = StripTokenQuotes(ReadToken(ActorStructure.ACTOR_CLASS_SPECIAL_TOKENS)).ToLowerInvariant();
|
|
|
|
if(!string.IsNullOrEmpty(className) && !entries.ContainsKey(className)) {
|
|
//now find opening brace
|
|
SkipWhitespace(true);
|
|
token = ReadToken();
|
|
if (token != "{") {
|
|
General.ErrorLogger.Add(ErrorType.Error, "Unexpected token found in '"+sourcefilename+"' at line "+GetCurrentLineNumber()+": expected '{', but got '" + token + "'");
|
|
continue; //something wrong with modeldef declaration, continue to next one
|
|
}
|
|
|
|
ModeldefStructure mds = new ModeldefStructure();
|
|
ModelData mde = mds.Parse(this);
|
|
if (mde != null) {
|
|
entries.Add(className, mde);
|
|
}
|
|
}
|
|
|
|
} else {
|
|
// Unknown structure!
|
|
string token2;
|
|
do {
|
|
if (!SkipWhitespace(true)) break;
|
|
token2 = ReadToken();
|
|
if (token2 == null) break;
|
|
}
|
|
while (token2 != "{");
|
|
int scopelevel = 1;
|
|
do {
|
|
if (!SkipWhitespace(true)) break;
|
|
token2 = ReadToken();
|
|
if (token2 == null) break;
|
|
if (token2 == "{") scopelevel++;
|
|
if (token2 == "}") scopelevel--;
|
|
}
|
|
while (scopelevel > 0);
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return entries.Count > 0;
|
|
}
|
|
}
|
|
}
|