From 806067f48ff6223d414c211e019cb2e5b4b08c6b Mon Sep 17 00:00:00 2001 From: James R Date: Tue, 5 Dec 2023 04:15:21 -0800 Subject: [PATCH] Add Music_BatchExempt, temporarily exemplify a tune from batch operations --- src/music.cpp | 10 ++++++++++ src/music.h | 4 ++++ src/music_manager.hpp | 6 ++++++ src/music_tune.hpp | 1 + 4 files changed, 21 insertions(+) diff --git a/src/music.cpp b/src/music.cpp index 6da57fca3..b8b79065c 100644 --- a/src/music.cpp +++ b/src/music.cpp @@ -353,3 +353,13 @@ const char* Music_CurrentId(void) { return g_tunes.current_id(); } + +void Music_BatchExempt(const char* id) +{ + Tune* tune = g_tunes.find(id); + + if (tune) + { + tune->resist_once = true; + } +} diff --git a/src/music.h b/src/music.h index c7712a472..a85b1913f 100644 --- a/src/music.h +++ b/src/music.h @@ -92,6 +92,10 @@ void Music_Remap(const char *id, const char *song); // Set whether a tune should loop. void Music_Loop(const char *id, boolean loop); +// Temporarily exemplify a tune from batch operations, such +// as Music_StopAll. +void Music_BatchExempt(const char *id); + // // Query properties. diff --git a/src/music_manager.hpp b/src/music_manager.hpp index 90924c75e..38110d46c 100644 --- a/src/music_manager.hpp +++ b/src/music_manager.hpp @@ -73,6 +73,12 @@ public: { for (auto& [_, tune] : map_) { + if (tune.resist_once) + { + tune.resist_once = false; + continue; + } + if (!tune.resist) { f(tune); diff --git a/src/music_tune.hpp b/src/music_tune.hpp index b22efb23d..ec9aac6dd 100644 --- a/src/music_tune.hpp +++ b/src/music_tune.hpp @@ -57,6 +57,7 @@ public: // from TuneManager::stop_all etc. It must be // stopped/paused individually. bool resist = false; + bool resist_once = false; // set at runtime // This tune shows a credit when first played (not // resumed).