Merge branch 'continuous-music-option' into 'master'

Continous Attack Music option

See merge request KartKrew/Kart!2105
This commit is contained in:
AJ Martinez 2024-03-16 04:02:24 +00:00
commit bb7c00171c
6 changed files with 48 additions and 9 deletions

View file

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

View file

@ -379,6 +379,22 @@ typedef enum
daopt_replaycons, daopt_replaycons,
} daopt_e; } 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 menuitem_t OPTIONS_Profiles[];
extern menu_t OPTIONS_ProfilesDef; extern menu_t OPTIONS_ProfilesDef;

View file

@ -1037,6 +1037,10 @@ void M_Drawer(void)
// Used for the secrets menu, to hide yet-to-be-unlocked stuff. // Used for the secrets menu, to hide yet-to-be-unlocked stuff.
static const char *M_CreateSecretMenuOption(const char *str) static const char *M_CreateSecretMenuOption(const char *str)
{ {
#if 1
(void)str;
return "???";
#else
static char qbuf[64]; static char qbuf[64];
int i; int i;
@ -1055,6 +1059,7 @@ static const char *M_CreateSecretMenuOption(const char *str)
qbuf[63] = '\0'; qbuf[63] = '\0';
return qbuf; return qbuf;
#endif
} }
// //
@ -4660,7 +4665,7 @@ box_found:
if (currentMenu->menuitems[i].mvar1) if (currentMenu->menuitems[i].mvar1)
y = currentMenu->y+currentMenu->menuitems[i].mvar1; y = currentMenu->y+currentMenu->menuitems[i].mvar1;
V_DrawMenuString(x, y, V_TRANSLUCENT|V_OLDSPACING, M_CreateSecretMenuOption(currentMenu->menuitems[i].text)); V_DrawMenuString(x + 8, y, V_TRANSLUCENT|V_OLDSPACING, M_CreateSecretMenuOption(currentMenu->menuitems[i].text));
y += SMALLLINEHEIGHT; y += SMALLLINEHEIGHT;
break; break;
case IT_HEADERTEXT: // draws 16 pixels to the left, in yellow text case IT_HEADERTEXT: // draws 16 pixels to the left, in yellow text

View file

@ -14,7 +14,7 @@
#include "../s_sound.h" // sounds consvars #include "../s_sound.h" // sounds consvars
#include "../g_game.h" // cv_chatnotifications #include "../g_game.h" // cv_chatnotifications
extern "C" consvar_t cv_mastervolume; extern "C" consvar_t cv_mastervolume, cv_continuousmusic;
using srb2::Draw; 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) boolean input_routine(INT32)
{ {
UINT8 pid = 0; // todo: Add ability for any splitscreen player to bring up the menu. UINT8 pid = 0; // todo: Add ability for any splitscreen player to bring up the menu.
@ -238,15 +250,15 @@ menuitem_t OPTIONS_Sound[] =
{IT_STRING | IT_CVAR, "Character Voices", "How often to play character voices in a race.", {IT_STRING | IT_CVAR, "Character Voices", "How often to play character voices in a race.",
NULL, {.cvar = &cv_kartvoices}, 0, 0}, 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, {IT_SPACE | IT_NOTHING, NULL, NULL,
NULL, {NULL}, 0, 0}, NULL, {NULL}, 0, 0},
{IT_HEADER, "Advanced...", NULL, {IT_HEADER, "Advanced...", NULL,
NULL, {NULL}, 0, 0}, NULL, {NULL}, 0, 0},
{IT_STRING | IT_CVAR, "Reverse L/R Channels", "Reverse left & right channels for Stereo playback.",
NULL, {.cvar = &stereoreverse}, 0, 0},
{IT_STRING | IT_CVAR, "Hear Tabbed-out", "Keep playing game audio when the window is out of focus (FOCUS LOST).", {IT_STRING | IT_CVAR, "Hear Tabbed-out", "Keep playing game audio when the window is out of focus (FOCUS LOST).",
NULL, {.cvar = &cv_bgaudio}, 0, 0}, NULL, {.cvar = &cv_bgaudio}, 0, 0},
@ -270,7 +282,7 @@ menu_t OPTIONS_SoundDef = {
draw_routine, draw_routine,
M_DrawOptionsCogs, M_DrawOptionsCogs,
tick_routine, tick_routine,
NULL, init_routine,
NULL, NULL,
input_routine, input_routine,
}; };

View file

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

View file

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