Navigation Menu

Skip to content

Commit

Permalink
- allow setting Blood's relative volume hack value via SNDINFO.
Browse files Browse the repository at this point in the history
  • Loading branch information
coelckers committed Jan 15, 2023
1 parent bb7f009 commit 3ab1ae5
Showing 1 changed file with 26 additions and 1 deletion.
27 changes: 26 additions & 1 deletion source/core/music/s_advsound.cpp
Expand Up @@ -63,6 +63,7 @@ enum SICommands
SI_PitchSetDuke,
SI_DukeFlags,
SI_Loop,
SI_BloodRelVol,
};


Expand Down Expand Up @@ -97,6 +98,7 @@ static const char *SICommandStrings[] =
"$pitchsetduke",
"$dukeflags",
"$loop",
"$bloodrelvol",
NULL
};

Expand Down Expand Up @@ -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);
Expand All @@ -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
Expand Down

0 comments on commit 3ab1ae5

Please sign in to comment.