mirror of
https://git.do.srb2.org/STJr/UltimateZoneBuilder.git
synced 2025-01-19 06:51:09 +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
|
@ -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());
|
||||
|
|
Loading…
Reference in a new issue