mirror of
https://git.do.srb2.org/STJr/UltimateZoneBuilder.git
synced 2025-06-02 18:01:36 +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);
|
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
|
// Constructor
|
||||||
internal ThingTypeInfo(int index, ThingTypeInfo other)
|
internal ThingTypeInfo(int index, ThingTypeInfo other)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1432,18 +1432,15 @@ namespace CodeImp.DoomBuilder.Data
|
||||||
// Try to find the actor...
|
// Try to find the actor...
|
||||||
ActorStructure actor = null;
|
ActorStructure actor = null;
|
||||||
|
|
||||||
if(!decorate.HasError)
|
//... in ActorsByClass
|
||||||
|
if(decorate.ActorsByClass.ContainsKey(group.Value))
|
||||||
{
|
{
|
||||||
//... in ActorsByClass
|
actor = decorate.ActorsByClass[group.Value];
|
||||||
if(decorate.ActorsByClass.ContainsKey(group.Value))
|
}
|
||||||
{
|
// Try finding in ArchivedActors
|
||||||
actor = decorate.ActorsByClass[group.Value];
|
else if(decorate.AllActorsByClass.ContainsKey(group.Value))
|
||||||
}
|
{
|
||||||
// Try finding in ArchivedActors
|
actor = decorate.AllActorsByClass[group.Value];
|
||||||
else if(decorate.AllActorsByClass.ContainsKey(group.Value))
|
|
||||||
{
|
|
||||||
actor = decorate.AllActorsByClass[group.Value];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(actor != null)
|
if(actor != null)
|
||||||
|
@ -1454,8 +1451,9 @@ namespace CodeImp.DoomBuilder.Data
|
||||||
ThingCategory cat = GetThingCategory(actor, catname);
|
ThingCategory cat = GetThingCategory(actor, catname);
|
||||||
|
|
||||||
// Add a new ThingTypeInfo, replacing already existing one if necessary
|
// 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;
|
thingtypes[group.Key] = info;
|
||||||
|
cat.AddThing(info);
|
||||||
}
|
}
|
||||||
// Check thingtypes...
|
// Check thingtypes...
|
||||||
else if(thingtypesbyclass.ContainsKey(group.Value))
|
else if(thingtypesbyclass.ContainsKey(group.Value))
|
||||||
|
|
|
@ -41,6 +41,10 @@ namespace CodeImp.DoomBuilder.GZBuilder.GZDoom
|
||||||
|
|
||||||
public MapinfoParser()
|
public MapinfoParser()
|
||||||
{
|
{
|
||||||
|
// Syntax
|
||||||
|
whitespace = "\n \t\r\u00A0";
|
||||||
|
specialtokens = ",{}\n";
|
||||||
|
|
||||||
mapinfo = new MapInfo();
|
mapinfo = new MapInfo();
|
||||||
spawnnums = new Dictionary<int, string>();
|
spawnnums = new Dictionary<int, string>();
|
||||||
doomednums = new Dictionary<int, string>();
|
doomednums = new Dictionary<int, string>();
|
||||||
|
@ -378,21 +382,13 @@ namespace CodeImp.DoomBuilder.GZBuilder.GZDoom
|
||||||
return true; // Finished with this file
|
return true; // Finished with this file
|
||||||
}
|
}
|
||||||
|
|
||||||
// Possible args
|
// Possible special and args. We'll skip them
|
||||||
for (int i = 0; i < 5; i++)
|
for (int i = 0; i < 6; i++)
|
||||||
{
|
{
|
||||||
if(!SkipWhitespace(false) || !NextTokenIs(",", false)) break;
|
if(!NextTokenIs(",", false)) break;
|
||||||
|
|
||||||
// Read an arg
|
// Read special name or arg value
|
||||||
if(!SkipWhitespace(false)) break;
|
if(!SkipWhitespace(true) || string.IsNullOrEmpty(ReadToken())) return false;
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add to collection?
|
// Add to collection?
|
||||||
|
|
|
@ -395,7 +395,7 @@ namespace CodeImp.DoomBuilder.ZDoom
|
||||||
//mxd
|
//mxd
|
||||||
protected bool NextTokenIs(string expectedtoken, bool reporterror)
|
protected bool NextTokenIs(string expectedtoken, bool reporterror)
|
||||||
{
|
{
|
||||||
SkipWhitespace(true);
|
if(!SkipWhitespace(true)) return false;
|
||||||
string token = ReadToken();
|
string token = ReadToken();
|
||||||
|
|
||||||
if(token != expectedtoken)
|
if(token != expectedtoken)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue