/** * @brief Plays a sound of the given quest. * @param quest The quest. * @param sound_id Id of the sound to play: filename without extension, * relative to the sounds directory. */ void play_sound(const Quest& quest, const QString& sound_id) { if (!initialized) { initialize(); } if (!open_quest(quest)) { qWarning() << "Failed to open quest " << quest.get_root_path(); return; } if (!Solarus::Sound::exists(sound_id.toStdString())) { qWarning() << "Cannot open sound file " << sound_id; return; } Solarus::Sound::play(sound_id.toStdString()); close_quest(); }
/** * @brief Plays a music of the given quest. * @param quest The quest. * @param music_id Id of the music to play: filename without extension, * relative to the musics directory. */ void play_music(Quest& quest, const QString& music_id) { if (!initialized) { initialize(); } if (!open_quest(quest)) { qWarning() << "Failed to open quest " << quest.get_root_path(); return; } if (!Solarus::Music::exists(music_id.toStdString())) { qWarning() << "Cannot open music file " << music_id; return; } Solarus::Music::play(music_id.toStdString(), true); close_quest(); quest.set_current_music_id(music_id); }