Menus/Sound Options: add Continuous Attack Music option

- On by default (current behavior)
- Off
  - Restart music in Attack modes
  - Also plays POSITION music
This commit is contained in:
James R 2024-03-13 22:43:35 -07:00
parent 74a04f0ab0
commit d3034bba54
5 changed files with 42 additions and 5 deletions

View file

@ -316,6 +316,7 @@ consvar_t cv_apng_downscale = Player("apng_downscale", "On").on_off();
void Captioning_OnChange(void);
consvar_t cv_closedcaptioning = Player("closedcaptioning", "Off").on_off().onchange(Captioning_OnChange);
consvar_t cv_continuousmusic = Player("continuousmusic", "On").on_off();
consvar_t cv_controlperkey = Player("controlperkey", "One").values({{1, "One"}, {2, "Several"}});
// actual general (maximum) sound & music volume, saved into the config

View file

@ -379,6 +379,22 @@ typedef enum
daopt_replaycons,
} daopt_e;
typedef enum
{
sopt_volume,
sopt_sfxvolume,
sopt_musicvolume,
sopt_spacer1,
sopt_chatnotifs,
sopt_charvoices,
sopt_attackmusic,
sopt_spacer2,
sopt_advanced,
sopt_tabbedout,
sopt_spacer3,
sopt_restart,
} sopt_e;
extern menuitem_t OPTIONS_Profiles[];
extern menu_t OPTIONS_ProfilesDef;

View file

@ -14,7 +14,7 @@
#include "../s_sound.h" // sounds consvars
#include "../g_game.h" // cv_chatnotifications
extern "C" consvar_t cv_mastervolume;
extern "C" consvar_t cv_mastervolume, cv_continuousmusic;
using srb2::Draw;
@ -200,6 +200,18 @@ void tick_routine(void)
}
}
void init_routine(void)
{
OPTIONS_Sound[sopt_attackmusic].status = IT_SECRET;
if (M_SecretUnlocked(SECRET_TIMEATTACK, true) ||
M_SecretUnlocked(SECRET_PRISONBREAK, true) ||
M_SecretUnlocked(SECRET_SPECIALATTACK, true))
{
OPTIONS_Sound[sopt_attackmusic].status = IT_STRING | IT_CVAR;
}
}
boolean input_routine(INT32)
{
UINT8 pid = 0; // todo: Add ability for any splitscreen player to bring up the menu.
@ -238,6 +250,9 @@ menuitem_t OPTIONS_Sound[] =
{IT_STRING | IT_CVAR, "Character Voices", "How often to play character voices in a race.",
NULL, {.cvar = &cv_kartvoices}, 0, 0},
{IT_STRING | IT_CVAR, "Continuous Attack Music", "Keep music playing seamlessly when retrying in Attack modes.",
NULL, {.cvar = &cv_continuousmusic}, 0, 0},
{IT_SPACE | IT_NOTHING, NULL, NULL,
NULL, {NULL}, 0, 0},
@ -267,7 +282,7 @@ menu_t OPTIONS_SoundDef = {
draw_routine,
M_DrawOptionsCogs,
tick_routine,
NULL,
init_routine,
NULL,
input_routine,
};

View file

@ -124,6 +124,8 @@
#include <tracy/tracy/TracyC.h>
extern "C" consvar_t cv_continuousmusic;
//
// Map MD5, calculated on level load.
// Sent to clients in PT_SERVERINFO.
@ -8257,7 +8259,10 @@ boolean P_UseContinuousLevelMusic(void)
if (gametyperules & GTR_BOSS)
return false;
return (gametyperules & GTR_NOPOSITION) || modeattacking != ATTACKING_NONE;
if (modeattacking != ATTACKING_NONE)
return cv_continuousmusic.value;
return (gametyperules & GTR_NOPOSITION) != 0;
}
void P_LoadLevelMusic(void)

View file

@ -1061,14 +1061,14 @@ void P_Ticker(boolean run)
}
// POSITION!! music
if (modeattacking == ATTACKING_NONE)
if (modeattacking == ATTACKING_NONE || !P_UseContinuousLevelMusic())
{
P_StartPositionMusic(true); // exact times only
}
}
}
if (modeattacking != ATTACKING_NONE)
if (modeattacking != ATTACKING_NONE && P_UseContinuousLevelMusic())
{
if (leveltime == 4)
{