mirror of
https://git.do.srb2.org/STJr/UltimateZoneBuilder.git
synced 2024-11-27 06:02:11 +00:00
Fixed, MAPINFO parser: the parser was unable to handle DoomEdNum block's action special definitions.
Fixed, DoomEdNum handling: in some cases ThingTypeInfo was not assigned a proper DoomEdNum and was not placed in a ThingCategory.
This commit is contained in:
parent
60c4ad7b4b
commit
f30c1ba0c6
4 changed files with 58 additions and 26 deletions
|
@ -255,6 +255,44 @@ namespace CodeImp.DoomBuilder.Config
|
|||
GC.SuppressFinalize(this);
|
||||
}
|
||||
|
||||
//mxd. Constructor
|
||||
internal ThingTypeInfo(ThingCategory cat, ActorStructure actor, int index)
|
||||
{
|
||||
// Initialize
|
||||
this.index = index;
|
||||
this.category = cat;
|
||||
this.title = "";
|
||||
this.actor = actor;
|
||||
this.classname = actor.ClassName; //mxd
|
||||
this.isknown = true;
|
||||
this.args = new ArgumentInfo[Linedef.NUM_ARGS];
|
||||
for(int i = 0; i < Linedef.NUM_ARGS; i++) this.args[i] = new ArgumentInfo(i);
|
||||
|
||||
// Read properties
|
||||
this.sprite = cat.Sprite;
|
||||
this.color = cat.Color;
|
||||
this.arrow = (cat.Arrow != 0);
|
||||
this.radius = cat.Radius;
|
||||
this.height = cat.Height;
|
||||
this.hangs = (cat.Hangs != 0);
|
||||
this.blocking = cat.Blocking;
|
||||
this.errorcheck = cat.ErrorCheck;
|
||||
this.fixedsize = cat.FixedSize;
|
||||
this.fixedrotation = cat.FixedRotation; //mxd
|
||||
this.absolutez = cat.AbsoluteZ;
|
||||
this.spritescale = new SizeF(cat.SpriteScale, cat.SpriteScale);
|
||||
|
||||
// Safety
|
||||
if(this.radius < 4f) this.radius = 8f;
|
||||
if(this.hangs && this.absolutez) this.hangs = false; //mxd
|
||||
|
||||
// Apply settings from actor
|
||||
ModifyByDecorateActor(actor);
|
||||
|
||||
// We have no destructor
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
|
||||
// Constructor
|
||||
internal ThingTypeInfo(int index, ThingTypeInfo other)
|
||||
{
|
||||
|
|
|
@ -1432,18 +1432,15 @@ namespace CodeImp.DoomBuilder.Data
|
|||
// Try to find the actor...
|
||||
ActorStructure actor = null;
|
||||
|
||||
if(!decorate.HasError)
|
||||
//... in ActorsByClass
|
||||
if(decorate.ActorsByClass.ContainsKey(group.Value))
|
||||
{
|
||||
//... in ActorsByClass
|
||||
if(decorate.ActorsByClass.ContainsKey(group.Value))
|
||||
{
|
||||
actor = decorate.ActorsByClass[group.Value];
|
||||
}
|
||||
// Try finding in ArchivedActors
|
||||
else if(decorate.AllActorsByClass.ContainsKey(group.Value))
|
||||
{
|
||||
actor = decorate.AllActorsByClass[group.Value];
|
||||
}
|
||||
actor = decorate.ActorsByClass[group.Value];
|
||||
}
|
||||
// Try finding in ArchivedActors
|
||||
else if(decorate.AllActorsByClass.ContainsKey(group.Value))
|
||||
{
|
||||
actor = decorate.AllActorsByClass[group.Value];
|
||||
}
|
||||
|
||||
if(actor != null)
|
||||
|
@ -1454,8 +1451,9 @@ namespace CodeImp.DoomBuilder.Data
|
|||
ThingCategory cat = GetThingCategory(actor, catname);
|
||||
|
||||
// Add a new ThingTypeInfo, replacing already existing one if necessary
|
||||
ThingTypeInfo info = new ThingTypeInfo(cat, actor);
|
||||
ThingTypeInfo info = new ThingTypeInfo(cat, actor, group.Key);
|
||||
thingtypes[group.Key] = info;
|
||||
cat.AddThing(info);
|
||||
}
|
||||
// Check thingtypes...
|
||||
else if(thingtypesbyclass.ContainsKey(group.Value))
|
||||
|
|
|
@ -41,6 +41,10 @@ namespace CodeImp.DoomBuilder.GZBuilder.GZDoom
|
|||
|
||||
public MapinfoParser()
|
||||
{
|
||||
// Syntax
|
||||
whitespace = "\n \t\r\u00A0";
|
||||
specialtokens = ",{}\n";
|
||||
|
||||
mapinfo = new MapInfo();
|
||||
spawnnums = new Dictionary<int, string>();
|
||||
doomednums = new Dictionary<int, string>();
|
||||
|
@ -378,21 +382,13 @@ namespace CodeImp.DoomBuilder.GZBuilder.GZDoom
|
|||
return true; // Finished with this file
|
||||
}
|
||||
|
||||
// Possible args
|
||||
for (int i = 0; i < 5; i++)
|
||||
// Possible special and args. We'll skip them
|
||||
for (int i = 0; i < 6; i++)
|
||||
{
|
||||
if(!SkipWhitespace(false) || !NextTokenIs(",", false)) break;
|
||||
if(!NextTokenIs(",", false)) break;
|
||||
|
||||
// Read an arg
|
||||
if(!SkipWhitespace(false)) break;
|
||||
token = ReadToken();
|
||||
int arg;
|
||||
if(!int.TryParse(token, NumberStyles.Integer, CultureInfo.InvariantCulture, out arg))
|
||||
{
|
||||
// Not numeric!
|
||||
General.ErrorLogger.Add(ErrorType.Error, "Unexpected token found in '" + sourcename + "' at line " + GetCurrentLineNumber() + ": expected SpawnNums actor argument " + (i + 1) + ", but got '" + token + "'");
|
||||
break;
|
||||
}
|
||||
// Read special name or arg value
|
||||
if(!SkipWhitespace(true) || string.IsNullOrEmpty(ReadToken())) return false;
|
||||
}
|
||||
|
||||
// Add to collection?
|
||||
|
|
|
@ -395,7 +395,7 @@ namespace CodeImp.DoomBuilder.ZDoom
|
|||
//mxd
|
||||
protected bool NextTokenIs(string expectedtoken, bool reporterror)
|
||||
{
|
||||
SkipWhitespace(true);
|
||||
if(!SkipWhitespace(true)) return false;
|
||||
string token = ReadToken();
|
||||
|
||||
if(token != expectedtoken)
|
||||
|
|
Loading…
Reference in a new issue