mirror of
https://git.do.srb2.org/STJr/UltimateZoneBuilder.git
synced 2025-01-31 21:00:56 +00:00
SNDINFO parser: added support for GZDoom's new sound assignment format. Fixes #1017
This commit is contained in:
parent
29643d98b4
commit
f9dd98695b
1 changed files with 19 additions and 0 deletions
|
@ -18,6 +18,14 @@ namespace CodeImp.DoomBuilder.ZDoom
|
||||||
private Dictionary<string, SoundInfo> sounds;
|
private Dictionary<string, SoundInfo> sounds;
|
||||||
private SoundInfo globalprops;
|
private SoundInfo globalprops;
|
||||||
|
|
||||||
|
// There are two formats supported, with the old format being
|
||||||
|
// logicalname lumpname
|
||||||
|
// and the new format being
|
||||||
|
// logicalname = lumpname
|
||||||
|
// Only one format may be used
|
||||||
|
private enum SndInfoFormat { None, Old, New }
|
||||||
|
private SndInfoFormat format = SndInfoFormat.None;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region ================== Properties
|
#region ================== Properties
|
||||||
|
@ -390,6 +398,17 @@ namespace CodeImp.DoomBuilder.ZDoom
|
||||||
logicalname = StripTokenQuotes(logicalname);
|
logicalname = StripTokenQuotes(logicalname);
|
||||||
if(string.IsNullOrEmpty(logicalname)) return false;
|
if(string.IsNullOrEmpty(logicalname)) return false;
|
||||||
|
|
||||||
|
// Check sound assignment format and report an error if both the old and new format is used
|
||||||
|
if ((format == SndInfoFormat.New && !NextTokenIs("=", false)) || (format == SndInfoFormat.Old && NextTokenIs("=", false)))
|
||||||
|
{
|
||||||
|
ReportError("Mixing old and new sound assignment format is not permitted");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
else if(format == SndInfoFormat.None)
|
||||||
|
{
|
||||||
|
format = NextTokenIs("=", false) ? SndInfoFormat.New : SndInfoFormat.Old;
|
||||||
|
}
|
||||||
|
|
||||||
// Read lumpname
|
// Read lumpname
|
||||||
if(!SkipWhitespace(true)) return false;
|
if(!SkipWhitespace(true)) return false;
|
||||||
string lumpname = StripTokenQuotes(ReadToken());
|
string lumpname = StripTokenQuotes(ReadToken());
|
||||||
|
|
Loading…
Reference in a new issue