* Plays the specified track if it's not already playing. * @param name Name of the music. * @param random Pick a random track? */
| 185 | * @param random Pick a random track? |
| 186 | */ |
| 187 | void ResourcePack::playMusic(const std::string &name, bool random) |
| 188 | { |
| 189 | if (!Options::mute && _playingMusic != name) |
| 190 | { |
| 191 | int loop = -1; |
| 192 | _playingMusic = name; |
| 193 | |
| 194 | // hacks |
| 195 | if (name == "GMGEO1") |
| 196 | _playingMusic = "GMGEO"; |
| 197 | else if (!Options::musicAlwaysLoop && (name == "GMSTORY" || name == "GMWIN" || name == "GMLOSE")) |
| 198 | loop = 0; |
| 199 | |
| 200 | if (random) |
| 201 | { |
| 202 | getRandomMusic(name)->play(loop); |
| 203 | } |
| 204 | else |
| 205 | { |
| 206 | getMusic(name)->play(loop); |
| 207 | } |
| 208 | } |
| 209 | } |
| 210 | |
| 211 | /** |
| 212 | * Returns a specific sound from the resource set. |
no test coverage detected