Fixed: ZScript: scale property should be expanded into xscale and yscale; Fixed: if actor's Spawn state starts with TNT1, first non-TNT1 frame will be used

This commit is contained in:
ZZYZX 2017-01-18 08:35:26 +02:00
parent 87fdd67fd6
commit 55b24eef39
6 changed files with 47 additions and 10 deletions

View file

@ -30,6 +30,6 @@ using CodeImp.DoomBuilder;
// Build Number
// Revision
//
[assembly: AssemblyVersion("2.3.0.2833")]
[assembly: AssemblyVersion("2.3.0.2834")]
[assembly: NeutralResourcesLanguageAttribute("en")]
[assembly: AssemblyHash("a1dc4bb")]
[assembly: AssemblyHash("87fdd67")]

View file

@ -45,7 +45,7 @@ namespace CodeImp.DoomBuilder.ZDoom
parser.DataStream.Seek(-(lasttoken.Length + 1), SeekOrigin.Current);
// Done here
return;
goto endofallthings;
}
//mxd. Start of inner scope?
else if (token == "{")
@ -69,7 +69,7 @@ namespace CodeImp.DoomBuilder.ZDoom
parser.DataStream.Seek(-1, SeekOrigin.Current);
// Done here
return;
goto endofallthings;
}
else
{
@ -97,7 +97,7 @@ namespace CodeImp.DoomBuilder.ZDoom
parser.DataStream.Seek(-(token.Length + 1), SeekOrigin.Current);
// Done here
return;
goto endofallthings;
}
// No first sprite yet?
@ -158,7 +158,11 @@ namespace CodeImp.DoomBuilder.ZDoom
return;
}
if (!parser.NextTokenIs(")")) return;
if (!parser.NextTokenIs(")"))
{
parser.ReportError("Expected closing parenthesis in Light()");
return;
}
}
//mxd. Inner scope start. Step back and reparse using parent loop
else if (t == "{")
@ -191,7 +195,7 @@ namespace CodeImp.DoomBuilder.ZDoom
parser.DataStream.Seek(-1, SeekOrigin.Current);
// Done here
return;
goto endofallthings;
}
// Read next token
@ -202,6 +206,11 @@ namespace CodeImp.DoomBuilder.ZDoom
lasttoken = token;
}
// return
endofallthings:
TrimLeft();
}
#endregion

View file

@ -70,6 +70,24 @@ namespace CodeImp.DoomBuilder.ZDoom
#endregion
#region ================== Methods
// This removes useless images from the start of the state (TNT1)
protected void TrimLeft() // :)
{
// postprocess: if there are only TNT1 sprites, do nothing. however, if there were normal sprites as well, use these.
int firstNonEmpty = -1;
for (int i = 0; i < sprites.Count; i++)
{
if (!sprites[i].Sprite.StartsWith("TNT1"))
{
firstNonEmpty = i;
break;
}
}
if (firstNonEmpty > 0)
sprites.RemoveRange(0, firstNonEmpty);
}
// This finds the first valid sprite and returns it
public FrameInfo GetSprite(int index)

View file

@ -118,7 +118,15 @@ namespace CodeImp.DoomBuilder.ZDoom
//parser.LogWarning(string.Format("{0} = [{1}]", propertyname, string.Join(", ", propertyvalues.ToArray())));
// set property
props[propertyname] = propertyvalues;
// translate "scale" to x and y scale
if (propertyname == "scale")
{
props["xscale"] = props["yscale"] = propertyvalues;
}
else
{
props[propertyname] = propertyvalues;
}
break;
}
}

View file

@ -82,7 +82,7 @@ namespace CodeImp.DoomBuilder.ZDoom
if (token.Type == ZScriptTokenType.CloseCurly)
{
stream.Position--;
return; // done
break; // done
}
else if (token.Type == ZScriptTokenType.Identifier)
{
@ -299,6 +299,8 @@ namespace CodeImp.DoomBuilder.ZDoom
} // if identifier
} // frame parsing loop (inner)
} // state parsing loop (outer)
TrimLeft();
}
}
}

View file

@ -29,5 +29,5 @@ using System.Resources;
// Build Number
// Revision
//
[assembly: AssemblyVersion("2.3.0.2833")]
[assembly: AssemblyVersion("2.3.0.2834")]
[assembly: NeutralResourcesLanguageAttribute("en")]