bool ParseShader(Lexer src) { int i; parms.minDistance = 1; parms.maxDistance = 10; parms.volume = 1; parms.shakes = 0; parms.soundShaderFlags = 0; parms.soundClass = 0; speakerMask = 0; altSound = null; for (i = 0; i < ISoundSystem.SOUND_MAX_LIST_WAVS; i++) { leadins[i] = null; entries[i] = null; } numEntries = 0; numLeadins = 0; var maxSamples = SoundSystemLocal.s_maxSoundsPerShader.Integer; if (C.com_makingBuild.Bool || maxSamples <= 0 || maxSamples > ISoundSystem.SOUND_MAX_LIST_WAVS) { maxSamples = ISoundSystem.SOUND_MAX_LIST_WAVS; } string tokenS; while (true) { if (!src.ExpectAnyToken(out var token)) { return(false); } // end of definition else if (token == "}") { break; } // minimum number of sounds else if (string.Equals(token, "minSamples", StringComparison.OrdinalIgnoreCase)) { maxSamples = MathX.ClampInt(src.ParseInt(), ISoundSystem.SOUND_MAX_LIST_WAVS, maxSamples); } // description else if (string.Equals(token, "description", StringComparison.OrdinalIgnoreCase)) { src.ReadTokenOnLine(out token); desc = token; } // mindistance else if (string.Equals(token, "mindistance", StringComparison.OrdinalIgnoreCase)) { parms.minDistance = src.ParseFloat(); } // maxdistance else if (string.Equals(token, "maxdistance", StringComparison.OrdinalIgnoreCase)) { parms.maxDistance = src.ParseFloat(); } // shakes screen else if (string.Equals(token, "shakes", StringComparison.OrdinalIgnoreCase)) { src.ExpectAnyToken(out token); if (token.type == TT.NUMBER) { parms.shakes = token.FloatValue; } else { src.UnreadToken(token); parms.shakes = 1f; } } // reverb else if (string.Equals(token, "reverb")) { src.ParseFloat(); if (!src.ExpectTokenString(",")) { src.FreeSource(); return(false); } src.ParseFloat(); // no longer supported } // volume else if (string.Equals(token, "volume", StringComparison.OrdinalIgnoreCase)) { parms.volume = src.ParseFloat(); } // leadinVolume is used to allow light breaking leadin sounds to be much louder than the broken loop else if (string.Equals(token, "leadinVolume", StringComparison.OrdinalIgnoreCase)) { leadinVolume = src.ParseFloat(); } // speaker mask else if (string.Equals(token, "mask_center", StringComparison.OrdinalIgnoreCase)) { speakerMask |= 1 << (int)SPEAKER.CENTER; } // speaker mask else if (string.Equals(token, "mask_left", StringComparison.OrdinalIgnoreCase)) { speakerMask |= 1 << (int)SPEAKER.LEFT; } // speaker mask else if (string.Equals(token, "mask_right", StringComparison.OrdinalIgnoreCase)) { speakerMask |= 1 << (int)SPEAKER.RIGHT; } // speaker mask else if (string.Equals(token, "mask_backright", StringComparison.OrdinalIgnoreCase)) { speakerMask |= 1 << (int)SPEAKER.BACKRIGHT; } // speaker mask else if (string.Equals(token, "mask_backleft", StringComparison.OrdinalIgnoreCase)) { speakerMask |= 1 << (int)SPEAKER.BACKLEFT; } // speaker mask else if (string.Equals(token, "mask_lfe", StringComparison.OrdinalIgnoreCase)) { speakerMask |= 1 << (int)SPEAKER.LFE; } // soundClass else if (string.Equals(token, "soundClass", StringComparison.OrdinalIgnoreCase)) { parms.soundClass = src.ParseInt(); if (parms.soundClass < 0 || parms.soundClass >= ISoundSystem.SOUND_MAX_CLASSES) { src.Warning("SoundClass out of range"); return(false); } } // altSound else if (string.Equals(token, "altSound", StringComparison.OrdinalIgnoreCase)) { if (!src.ExpectAnyToken(out token)) { return(false); } altSound = (SoundShader)declManager.FindSound(token); } // ordered else if (string.Equals(token, "ordered", StringComparison.OrdinalIgnoreCase)) { } // no longer supported // no_dups else if (string.Equals(token, "no_dups", StringComparison.OrdinalIgnoreCase)) { parms.soundShaderFlags |= ISoundSystem.SSF_NO_DUPS; } // no_flicker else if (string.Equals(token, "no_flicker", StringComparison.OrdinalIgnoreCase)) { parms.soundShaderFlags |= ISoundSystem.SSF_NO_FLICKER; } // plain else if (string.Equals(token, "plain", StringComparison.OrdinalIgnoreCase)) { } // no longer supported // looping else if (string.Equals(token, "looping", StringComparison.OrdinalIgnoreCase)) { parms.soundShaderFlags |= ISoundSystem.SSF_LOOPING; } // no occlusion else if (string.Equals(token, "no_occlusion", StringComparison.OrdinalIgnoreCase)) { parms.soundShaderFlags |= ISoundSystem.SSF_NO_OCCLUSION; } // private else if (string.Equals(token, "private", StringComparison.OrdinalIgnoreCase)) { parms.soundShaderFlags |= ISoundSystem.SSF_PRIVATE_SOUND; } // antiPrivate else if (string.Equals(token, "antiPrivate", StringComparison.OrdinalIgnoreCase)) { parms.soundShaderFlags |= ISoundSystem.SSF_ANTI_PRIVATE_SOUND; } // once else if (string.Equals(token, "playonce", StringComparison.OrdinalIgnoreCase)) { parms.soundShaderFlags |= ISoundSystem.SSF_PLAY_ONCE; } // global else if (string.Equals(token, "global", StringComparison.OrdinalIgnoreCase)) { parms.soundShaderFlags |= ISoundSystem.SSF_GLOBAL; } // unclamped else if (string.Equals(token, "unclamped", StringComparison.OrdinalIgnoreCase)) { parms.soundShaderFlags |= ISoundSystem.SSF_UNCLAMPED; } // omnidirectional else if (string.Equals(token, "omnidirectional", StringComparison.OrdinalIgnoreCase)) { parms.soundShaderFlags |= ISoundSystem.SSF_OMNIDIRECTIONAL; } // onDemand can't be a parms, because we must track all references and overrides would confuse it else if (string.Equals(token, "onDemand", StringComparison.OrdinalIgnoreCase)) /*onDemand = true;*/ } {