SNDINFO parser: added support for GZDoom's new sound assignment format. Fixes #1017

This commit is contained in:
biwa 2024-02-03 15:10:56 +01:00
parent 29643d98b4
commit f9dd98695b

View file

@ -17,6 +17,14 @@ namespace CodeImp.DoomBuilder.ZDoom
private Dictionary<int, AmbientSoundInfo> ambientsounds;
private Dictionary<string, SoundInfo> sounds;
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
@ -390,6 +398,17 @@ namespace CodeImp.DoomBuilder.ZDoom
logicalname = StripTokenQuotes(logicalname);
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
if(!SkipWhitespace(true)) return false;
string lumpname = StripTokenQuotes(ReadToken());