feat(sound): add SI2::StopGlueMusic

This commit is contained in:
fallenoak 2025-11-27 11:40:28 -06:00
parent 5b714b0650
commit 485a93aa30
No known key found for this signature in database
GPG Key ID: 7628F8E61AEA070D
2 changed files with 13 additions and 0 deletions

View File

@ -1018,6 +1018,18 @@ void SI2::StartGlueMusic(const char* name) {
EventRegister(EVENT_ID_POLL, &SI2::GlueMusicUpdate);
}
int32_t SI2::StopGlueMusic(float fadeOutTime) {
EventUnregister(EVENT_ID_POLL, &SI2::GlueMusicUpdate);
s_GlueMusicName[0] = '\0';
if (fadeOutTime < 0.0f) {
fadeOutTime = -1.0f;
}
return SI2::StopOrFadeOut(&s_GlueMusicObject, 0, fadeOutTime, 1);
}
int32_t SI2::StopOrFadeOut(SOUNDKITOBJECT* object, int32_t stop, float fadeOutTime, int32_t a4) {
auto userData = static_cast<SI2USERDATA*>(object->m_sound.GetUserData());

View File

@ -36,6 +36,7 @@ class SI2 {
static void RegisterUserCVars();
static void RegisterScriptFunctions();
static void StartGlueMusic(const char* name);
static int32_t StopGlueMusic(float fadeOutTime);
static int32_t StopOrFadeOut(SOUNDKITOBJECT* object, int32_t stop, float fadeOutTime, int32_t a4);
};