Merge branch 'extra-life-jingle' into 'master'

Optionally use a sound for 1-Up

See merge request STJr/SRB2!668
This commit is contained in:
James R 2020-01-15 23:38:21 -05:00
commit 55cc978f40
4 changed files with 20 additions and 1 deletions

View File

@ -1375,8 +1375,9 @@ static menuitem_t OP_SoundOptionsMenu[] =
{IT_HEADER, NULL, "Miscellaneous", NULL, 102},
{IT_STRING | IT_CVAR, NULL, "Closed Captioning", &cv_closedcaptioning, 114},
{IT_STRING | IT_CVAR, NULL, "Reset Music Upon Dying", &cv_resetmusic, 124},
{IT_STRING | IT_CVAR, NULL, "Default 1-Up sound", &cv_1upsound, 134},
{IT_STRING | IT_SUBMENU, NULL, "Advanced Settings...", &OP_SoundAdvancedDef, 144},
{IT_STRING | IT_SUBMENU, NULL, "Advanced Settings...", &OP_SoundAdvancedDef, 154},
};
#ifdef HAVE_OPENMPT

View File

@ -1463,6 +1463,13 @@ void P_PlayLivesJingle(player_t *player)
S_StartSound(NULL, sfx_oneup);
else if (mariomode)
S_StartSound(NULL, sfx_marioa);
else if (cv_1upsound.value)
{
if (S_sfx[sfx_oneup].lumpnum != LUMPERROR)
S_StartSound(NULL, sfx_oneup);
else
S_StartSound(NULL, sfx_chchng);/* at least play something! */
}
else
{
P_PlayJingle(player, JT_1UP);

View File

@ -117,6 +117,14 @@ static consvar_t surround = {"surround", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL
consvar_t cv_resetmusic = {"resetmusic", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_resetmusicbyheader = {"resetmusicbyheader", "Yes", CV_SAVE, CV_YesNo, NULL, 0, NULL, NULL, 0, 0, NULL};
static CV_PossibleValue_t cons_1upsound_t[] = {
{0, "Jingle"},
{1, "Sound"},
{0}
};
consvar_t cv_1upsound = {"1upsound", "Jingle", CV_SAVE, cons_1upsound_t, NULL, 0, NULL, NULL, 0, 0, NULL};
// Sound system toggles, saved into the config
consvar_t cv_gamedigimusic = {"digimusic", "On", CV_SAVE|CV_CALL|CV_NOINIT, CV_OnOff, GameDigiMusic_OnChange, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_gamemidimusic = {"midimusic", "On", CV_SAVE|CV_CALL|CV_NOINIT, CV_OnOff, GameMIDIMusic_OnChange, 0, NULL, NULL, 0, 0, NULL};
@ -287,6 +295,7 @@ void S_RegisterSoundStuff(void)
CV_RegisterVar(&cv_samplerate);
CV_RegisterVar(&cv_resetmusic);
CV_RegisterVar(&cv_resetmusicbyheader);
CV_RegisterVar(&cv_1upsound);
CV_RegisterVar(&cv_playsoundsifunfocused);
CV_RegisterVar(&cv_playmusicifunfocused);
CV_RegisterVar(&cv_gamesounds);

View File

@ -35,6 +35,8 @@ extern consvar_t cv_numChannels;
extern consvar_t cv_resetmusic;
extern consvar_t cv_resetmusicbyheader;
extern consvar_t cv_1upsound;
#define RESETMUSIC (!modeattacking && \
(cv_resetmusicbyheader.value ? \
(mapheaderinfo[gamemap-1]->musforcereset != -1 ? mapheaderinfo[gamemap-1]->musforcereset : cv_resetmusic.value) \