From 1113a13621a549fa180910f0767592e51a5f43a8 Mon Sep 17 00:00:00 2001 From: James R Date: Fri, 10 Jan 2020 12:55:03 -0800 Subject: [PATCH] 1upsound always plays a sound instead of jingle --- src/p_user.c | 7 +++++++ src/s_sound.c | 9 +++++++++ src/s_sound.h | 2 ++ 3 files changed, 18 insertions(+) diff --git a/src/p_user.c b/src/p_user.c index a97e62052..f56b321e1 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -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); diff --git a/src/s_sound.c b/src/s_sound.c index 0235d8376..019f5c765 100644 --- a/src/s_sound.c +++ b/src/s_sound.c @@ -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); diff --git a/src/s_sound.h b/src/s_sound.h index 18f2d3743..9a4cbe48b 100644 --- a/src/s_sound.h +++ b/src/s_sound.h @@ -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) \