| 51 | } |
| 52 | |
| 53 | bool 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 | |
| 86 | SoundSystemOAL::SoundSystemOAL() |
no test coverage detected