protected override void ClearData() { base.ClearData(); _altSound = null; idConsole.Warning("TODO: ClearData"); /*_entryCount = 0; * _leadInCount = 0;*/ }
private bool ParseMaterial(idLexer lexer) { _parameters.MinDistance = 1; _parameters.MaxDistance = 10; _parameters.Volume = 1; _speakerMask = 0; _altSound = null; idToken token; string tokenValue; int sampleCount = 0; while (true) { if ((token = lexer.ExpectAnyToken()) == null) { return(false); } tokenValue = token.ToString().ToLower(); if (tokenValue == "}") { break; } // minimum number of sounds else if (tokenValue == "minsamples") { sampleCount = lexer.ParseInt(); } else if (tokenValue == "description") { _description = lexer.ReadTokenOnLine().ToString(); } else if (tokenValue == "mindistance") { _parameters.MinDistance = lexer.ParseFloat(); } else if (tokenValue == "maxdistance") { _parameters.MaxDistance = lexer.ParseFloat(); } else if (tokenValue == "shakes") { token = lexer.ExpectAnyToken(); if (token.Type == TokenType.Number) { _parameters.Shakes = token.ToFloat(); } else { lexer.UnreadToken = token; _parameters.Shakes = 1.0f; } } else if (tokenValue == "reverb") { float reg0 = lexer.ParseFloat(); if (lexer.ExpectTokenString(",") == false) { return(false); } float reg1 = lexer.ParseFloat(); // no longer supported } else if (tokenValue == "volume") { _parameters.Volume = lexer.ParseFloat(); } // leadinVolume is used to allow light breaking leadin sounds to be much louder than the broken loop else if (tokenValue == "leadinvolume") { _leadInVolume = lexer.ParseFloat(); } else if (tokenValue == "mask_center") { _speakerMask |= 1 << (int)Speakers.Center; } else if (tokenValue == "mask_left") { _speakerMask |= 1 << (int)Speakers.Left; } else if (tokenValue == "mask_right") { _speakerMask |= 1 << (int)Speakers.Right; } else if (tokenValue == "mask_backright") { _speakerMask |= 1 << (int)Speakers.BackRight; } else if (tokenValue == "mask_backleft") { _speakerMask |= 1 << (int)Speakers.BackLeft; } else if (tokenValue == "mask_lfe") { _speakerMask |= 1 << (int)Speakers.Lfe; } else if (tokenValue == "soundclass") { _parameters.SoundClass = lexer.ParseInt(); if (_parameters.SoundClass < 0) { lexer.Warning("SoundClass out of range"); return(false); } } else if (tokenValue == "altsound") { if ((token = lexer.ExpectAnyToken()) == null) { return(false); } _altSound = idE.DeclManager.FindSound(token.ToString()); } else if (tokenValue == "ordered") { // no longer supported } else if (tokenValue == "no_dups") { _parameters.Flags |= SoundMaterialFlags.NoDuplicates; } else if (tokenValue == "no_flicker") { _parameters.Flags |= SoundMaterialFlags.NoFlicker; } else if (tokenValue == "plain") { // no longer supported } else if (tokenValue == "looping") { _parameters.Flags |= SoundMaterialFlags.Looping; } else if (tokenValue == "no_occlusion") { _parameters.Flags |= SoundMaterialFlags.NoOcclusion; } else if (tokenValue == "private") { _parameters.Flags |= SoundMaterialFlags.PrivateSound; } else if (tokenValue == "antiprivate") { _parameters.Flags |= SoundMaterialFlags.AntiPrivateSound; } else if (tokenValue == "playonce") { _parameters.Flags |= SoundMaterialFlags.PlayOnce; } else if (tokenValue == "global") { _parameters.Flags |= SoundMaterialFlags.Global; } else if (tokenValue == "unclamped") { _parameters.Flags |= SoundMaterialFlags.Unclamped; } else if (tokenValue == "omnidirectional") { _parameters.Flags |= SoundMaterialFlags.OmniDirectional; } // onDemand can't be a parms, because we must track all references and overrides would confuse it else if (tokenValue == "ondemand") { // no longer loading sounds on demand // _onDemand = true; } // the wave files else if (tokenValue == "leadin") { // add to the leadin list if ((token = lexer.ReadToken()) == null) { lexer.Warning("Expected sound after leadin"); return(false); } idConsole.Warning("TODO: leadin"); /*if(soundSystemLocal.soundCache && numLeadins < maxSamples) * { * leadins[numLeadins] = soundSystemLocal.soundCache->FindSound(token.c_str(), onDemand); * numLeadins++; * }*/ } else if ((tokenValue.EndsWith(".wav") == true) || (tokenValue.EndsWith(".ogg") == true)) { idConsole.Warning("TODO: .wav|.ogg"); /*// add to the wav list * if(soundSystemLocal.soundCache && numEntries < maxSamples) * { * token.BackSlashesToSlashes(); * idStr lang = cvarSystem->GetCVarString("sys_lang"); * if(lang.Icmp("english") != 0 && token.Find("sound/vo/", false) >= 0) * { * idStr work = token; * work.ToLower(); * work.StripLeading("sound/vo/"); * work = va("sound/vo/%s/%s", lang.c_str(), work.c_str()); * if(fileSystem->ReadFile(work, NULL, NULL) > 0) * { * token = work; * } * else * { * // also try to find it with the .ogg extension * work.SetFileExtension(".ogg"); * if(fileSystem->ReadFile(work, NULL, NULL) > 0) * { * token = work; * } * } * } * entries[numEntries] = soundSystemLocal.soundCache->FindSound(token.c_str(), onDemand); * numEntries++; * }*/ } else { lexer.Warning("unknown token '{0}'", token.ToString()); return(false); } } if (_parameters.Shakes > 0.0f) { idConsole.Warning("TODO: CheckShakesAndOgg()"); } return(true); }
private bool ParseMaterial(idLexer lexer) { _parameters.MinDistance = 1; _parameters.MaxDistance = 10; _parameters.Volume = 1; _speakerMask = 0; _altSound = null; idToken token; string tokenValue; int sampleCount = 0; while(true) { if((token = lexer.ExpectAnyToken()) == null) { return false; } tokenValue = token.ToString().ToLower(); if(tokenValue == "}") { break; } // minimum number of sounds else if(tokenValue == "minsamples") { sampleCount = lexer.ParseInt(); } else if(tokenValue == "description") { _description = lexer.ReadTokenOnLine().ToString(); } else if(tokenValue == "mindistance") { _parameters.MinDistance = lexer.ParseFloat(); } else if(tokenValue == "maxdistance") { _parameters.MaxDistance = lexer.ParseFloat(); } else if(tokenValue == "shakes") { token = lexer.ExpectAnyToken(); if(token.Type == TokenType.Number) { _parameters.Shakes = token.ToFloat(); } else { lexer.UnreadToken = token; _parameters.Shakes = 1.0f; } } else if(tokenValue == "reverb") { float reg0 = lexer.ParseFloat(); if(lexer.ExpectTokenString(",") == false) { return false; } float reg1 = lexer.ParseFloat(); // no longer supported } else if(tokenValue == "volume") { _parameters.Volume = lexer.ParseFloat(); } // leadinVolume is used to allow light breaking leadin sounds to be much louder than the broken loop else if(tokenValue == "leadinvolume") { _leadInVolume = lexer.ParseFloat(); } else if(tokenValue == "mask_center") { _speakerMask |= 1 << (int) Speakers.Center; } else if(tokenValue == "mask_left") { _speakerMask |= 1 << (int) Speakers.Left; } else if(tokenValue == "mask_right") { _speakerMask |= 1 << (int) Speakers.Right; } else if(tokenValue == "mask_backright") { _speakerMask |= 1 << (int) Speakers.BackRight; } else if(tokenValue == "mask_backleft") { _speakerMask |= 1 << (int) Speakers.BackLeft; } else if(tokenValue == "mask_lfe") { _speakerMask |= 1 << (int) Speakers.Lfe; } else if(tokenValue == "soundclass") { _parameters.SoundClass = lexer.ParseInt(); if(_parameters.SoundClass < 0) { lexer.Warning("SoundClass out of range"); return false; } } else if(tokenValue == "altsound") { if((token = lexer.ExpectAnyToken()) == null) { return false; } _altSound = idE.DeclManager.FindSound(token.ToString()); } else if(tokenValue == "ordered") { // no longer supported } else if(tokenValue == "no_dups") { _parameters.Flags |= SoundMaterialFlags.NoDuplicates; } else if(tokenValue == "no_flicker") { _parameters.Flags |= SoundMaterialFlags.NoFlicker; } else if(tokenValue == "plain") { // no longer supported } else if(tokenValue == "looping") { _parameters.Flags |= SoundMaterialFlags.Looping; } else if(tokenValue == "no_occlusion") { _parameters.Flags |= SoundMaterialFlags.NoOcclusion; } else if(tokenValue == "private") { _parameters.Flags |= SoundMaterialFlags.PrivateSound; } else if(tokenValue == "antiprivate") { _parameters.Flags |= SoundMaterialFlags.AntiPrivateSound; } else if(tokenValue == "playonce") { _parameters.Flags |= SoundMaterialFlags.PlayOnce; } else if(tokenValue == "global") { _parameters.Flags |= SoundMaterialFlags.Global; } else if(tokenValue == "unclamped") { _parameters.Flags |= SoundMaterialFlags.Unclamped; } else if(tokenValue == "omnidirectional") { _parameters.Flags |= SoundMaterialFlags.OmniDirectional; } // onDemand can't be a parms, because we must track all references and overrides would confuse it else if(tokenValue == "ondemand") { // no longer loading sounds on demand // _onDemand = true; } // the wave files else if(tokenValue == "leadin") { // add to the leadin list if((token = lexer.ReadToken()) == null) { lexer.Warning("Expected sound after leadin"); return false; } idConsole.Warning("TODO: leadin"); /*if(soundSystemLocal.soundCache && numLeadins < maxSamples) { leadins[numLeadins] = soundSystemLocal.soundCache->FindSound(token.c_str(), onDemand); numLeadins++; }*/ } else if((tokenValue.EndsWith(".wav") == true) || (tokenValue.EndsWith(".ogg") == true)) { idConsole.Warning("TODO: .wav|.ogg"); /*// add to the wav list if(soundSystemLocal.soundCache && numEntries < maxSamples) { token.BackSlashesToSlashes(); idStr lang = cvarSystem->GetCVarString("sys_lang"); if(lang.Icmp("english") != 0 && token.Find("sound/vo/", false) >= 0) { idStr work = token; work.ToLower(); work.StripLeading("sound/vo/"); work = va("sound/vo/%s/%s", lang.c_str(), work.c_str()); if(fileSystem->ReadFile(work, NULL, NULL) > 0) { token = work; } else { // also try to find it with the .ogg extension work.SetFileExtension(".ogg"); if(fileSystem->ReadFile(work, NULL, NULL) > 0) { token = work; } } } entries[numEntries] = soundSystemLocal.soundCache->FindSound(token.c_str(), onDemand); numEntries++; }*/ } else { lexer.Warning("unknown token '{0}'", token.ToString()); return false; } } if(_parameters.Shakes > 0.0f) { idConsole.Warning("TODO: CheckShakesAndOgg()"); } return true; }
protected override void ClearData() { base.ClearData(); _altSound = null; idConsole.Warning("TODO: ClearData"); /*_entryCount = 0; _leadInCount = 0;*/ }