- allow setting Blood's relative volume hack value via SNDINFO.

This commit is contained in:
Christoph Oelckers 2023-01-15 16:18:48 +01:00
parent bb7f00988a
commit 3ab1ae5f7a

View file

@ -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 <logical name> <start> <end>
// loop <logical name> <start> <end>
// 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 <logical name> <value>
// 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