From 3ab1ae5f7a7dbfe3846fd649d79cd58847cd868e Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 15 Jan 2023 16:18:48 +0100 Subject: [PATCH] - allow setting Blood's relative volume hack value via SNDINFO. --- source/core/music/s_advsound.cpp | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/source/core/music/s_advsound.cpp b/source/core/music/s_advsound.cpp index fa6d87431..adb174078 100644 --- a/source/core/music/s_advsound.cpp +++ b/source/core/music/s_advsound.cpp @@ -63,6 +63,7 @@ enum SICommands SI_PitchSetDuke, SI_DukeFlags, SI_Loop, + SI_BloodRelVol, }; @@ -97,6 +98,7 @@ static const char *SICommandStrings[] = "$pitchsetduke", "$dukeflags", "$loop", + "$bloodrelvol", NULL }; @@ -383,7 +385,7 @@ static void S_AddSNDINFO (int lump) } case SI_Loop: { - // dukesound + // loop // Sets loop points for the given sound in samples. Only really useful for WAV - for Ogg and FLAC use the metadata they can contain. sc.MustGetString(); auto sfxid = soundEngine->FindSoundTentative(sc.String, DEFAULT_LIMIT); @@ -395,6 +397,29 @@ static void S_AddSNDINFO (int lump) break; } + case SI_BloodRelVol: { + // bloodrelvol + // Sets Blood's hacky volume modifier. + sc.MustGetString(); + auto sfxid = soundEngine->FindSoundTentative(sc.String, DEFAULT_LIMIT); + auto sfx = soundEngine->GetWritableSfx(sfxid); + sc.MustGetNumber(); + if (isBlood()) + { + auto sfx = soundEngine->GetWritableSfx(sfxid); + if (sfx->UserData.Size() < 1) + { + sfx->UserData.Resize(1); + } + sfx->UserData[0] = sc.Number; + } + else + { + sc.ScriptMessage("'$bloodrelvol' is not available in the current game and will be ignored"); + } + break; + } + default: { // Got a logical sound mapping