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

Function ResolvePreviewSoundArray

engine/PoseidonOpenAL/SoundSystemOAL.cpp:53–83  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

51}
52
53bool ResolvePreviewSoundArray(const char* entryName, SoundPars& pars)
54{
55 const ParamEntry* preview = PreviewConfig();
56 const ParamEntry* entry = preview ? preview->FindEntry(entryName) : nullptr;
57 if (!entry || !GetValue(pars, *entry) || pars.name.GetLength() <= 0)
58 return false;
59
60 RString raw = (*entry)[0];
61 const char* rawPath = raw;
62 while (*rawPath == '\\' || *rawPath == '/')
63 ++rawPath;
64
65 // CfgSFX preview arrays are global-package samples, not mission-relative
66 // sounds. GetSoundName() correctly maps weapon effects into DTA/Sound.pbo,
67 // but legacy Preview entries also use "voice\..." and "music\..." for
68 // DTA/Voice.pbo and DTA/Music.pbo. Keep those rooted at their own banks
69 // instead of letting GetSoundName() rewrite them under "sound\".
70 if (_strnicmp(rawPath, "voice\\", 6) == 0 || _strnicmp(rawPath, "voice/", 6) == 0 ||
71 _strnicmp(rawPath, "music\\", 6) == 0 || _strnicmp(rawPath, "music/", 6) == 0)
72 {
73 char normalized[256];
74 strncpy(normalized, rawPath, sizeof(normalized) - 1);
75 normalized[sizeof(normalized) - 1] = 0;
76 for (char* c = normalized; *c; ++c)
77 if (*c == '/')
78 *c = '\\';
79 strlwr(normalized);
80 pars.name = normalized;
81 }
82 return pars.name.GetLength() > 0;
83}
84} // namespace
85
86SoundSystemOAL::SoundSystemOAL()

Callers 3

StartCategoryPreviewMethod · 0.85
StartDevicePreviewMethod · 0.85
ProcessPreviewMethod · 0.85

Calls 5

PreviewConfigFunction · 0.85
GetValueFunction · 0.85
strlwrFunction · 0.50
FindEntryMethod · 0.45
GetLengthMethod · 0.45

Tested by

no test coverage detected