MCPcopy Create free account
hub / github.com/BohemiaInteractive/CWR / FindSFX

Function FindSFX

engine/Poseidon/UI/OptionsUI.cpp:319–407  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

317 Poseidon::Foundation::WarningMessage("Environmental sound %s not found", (const char*)name);
318}
319
320static void PreferExistingVoiceLanguageOverride(SoundPars& pars);
321
322void FindSFX(RString name, SoundEntry& emptySound, AutoArray<SoundEntry>& sounds)
323{
324 // ignore @ - not used now
325 if (name[0] == '@')
326 {
327 name = (const char*)name + 1;
328 }
329
330 // find in mission
331 const ParamEntry* cls = ExtParsMission.FindEntry("CfgSFX");
332 const ParamEntry* entry = cls ? cls->FindEntry(name) : nullptr;
333 if (entry)
334 {
335 // load empty sound
336 emptySound = DynSound::LoadEntry((*entry) >> "empty");
337 if (emptySound.name.GetLength() > 0)
338 {
339 emptySound.name = GetMissionDirectory() + emptySound.name;
340 }
341 // load sound scheme
342 const ParamEntry& list = (*entry) >> "sounds";
343 int n = list.GetSize();
344 sounds.Resize(n);
345 for (int i = 0; i < n; i++)
346 {
347 RString name = list[i];
348 SoundEntry& sound = sounds[i];
349 sound = DynSound::LoadEntry((*entry) >> name);
350 if (sound.name.GetLength() > 0)
351 {
352 sound.name = GetMissionDirectory() + sound.name;
353 PreferExistingVoiceLanguageOverride(sound);
354 }
355 }
356 // return sound location
357 return; // ExtParsMission.GetName();
358 }
359
360 // find in campaign
361 cls = ExtParsCampaign.FindEntry("CfgSFX");
362 entry = cls ? cls->FindEntry(name) : nullptr;
363 if (entry)
364 {
365 // load empty sound
366 emptySound = DynSound::LoadEntry((*entry) >> "empty");
367 if (emptySound.name.GetLength() > 0)
368 {
369 emptySound.name = BaseDirectory + RString("dtaExt\\") + emptySound.name;
370 }
371 // load sound scheme
372 const ParamEntry& list = (*entry) >> "sounds";
373 int n = list.GetSize();
374 sounds.Resize(n);
375 for (int i = 0; i < n; i++)
376 {

Callers 1

LoadMethod · 0.85

Calls 7

GetMissionDirectoryFunction · 0.85
WarningMessageFunction · 0.85
RStringClass · 0.50
FindEntryMethod · 0.45
GetLengthMethod · 0.45
GetSizeMethod · 0.45
ResizeMethod · 0.45

Tested by

no test coverage detected