Skip to content

Commit

Permalink
port: add option to disable death music in MP
Browse files Browse the repository at this point in the history
  • Loading branch information
fgsfdsfgs committed Nov 26, 2023
1 parent 94e8e1b commit 2d3e3d1
Show file tree
Hide file tree
Showing 4 changed files with 70 additions and 0 deletions.
1 change: 1 addition & 0 deletions port/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ PD_CONSTRUCTOR static void gameConfigInit(void)
configRegisterFloat("Game.ScreenShakeIntensity", &g_ViShakeIntensityMult, 0.f, 10.f);
configRegisterInt("Game.TickRateDivisor", &g_TickRateDiv, 0, 10);
configRegisterInt("Game.SkipIntro", &g_SkipIntro, 0, 1);
configRegisterInt("Game.DisableMpDeathMusic", &g_MusicDisableMpDeath, 0, 1);
for (s32 j = 0; j < MAX_PLAYERS; ++j) {
const s32 i = j + 1;
configRegisterFloat(strFmt("Game.Player%d.FovY", i), &g_PlayerExtCfg[j].fovy, 5.f, 175.f);
Expand Down
58 changes: 58 additions & 0 deletions port/src/optionsmenu.c
Original file line number Diff line number Diff line change
Expand Up @@ -724,6 +724,56 @@ struct menudialogdef g_ExtendedVideoMenuDialog = {
NULL,
};

static MenuItemHandlerResult menuhandlerDisableMpDeathMusic(s32 operation, struct menuitem *item, union handlerdata *data)
{
switch (operation) {
case MENUOP_GET:
return g_MusicDisableMpDeath;
case MENUOP_SET:
g_MusicDisableMpDeath = data->checkbox.value;
break;
}

return 0;
}

struct menuitem g_ExtendedAudioMenuItems[] = {
{
MENUITEMTYPE_CHECKBOX,
0,
MENUITEMFLAG_LITERAL_TEXT,
(uintptr_t)"Disable MP Death Music",
0,
menuhandlerDisableMpDeathMusic,
},
{
MENUITEMTYPE_SEPARATOR,
0,
0,
0,
0,
NULL,
},
{
MENUITEMTYPE_SELECTABLE,
0,
MENUITEMFLAG_SELECTABLE_CLOSESDIALOG,
L_OPTIONS_213, // "Back"
0,
NULL,
},
{ MENUITEMTYPE_END },
};

struct menudialogdef g_ExtendedAudioMenuDialog = {
MENUDIALOGTYPE_DEFAULT,
(uintptr_t)"Extended Audio Options",
g_ExtendedAudioMenuItems,
NULL,
MENUDIALOGFLAG_LITERAL_TEXT,
NULL,
};

static MenuItemHandlerResult menuhandlerCrouchMode(s32 operation, struct menuitem *item, union handlerdata *data)
{
static const char *opts[] = {
Expand Down Expand Up @@ -1107,6 +1157,14 @@ struct menuitem g_ExtendedMenuItems[] = {
0,
(void *)&g_ExtendedVideoMenuDialog,
},
{
MENUITEMTYPE_SELECTABLE,
0,
MENUITEMFLAG_SELECTABLE_OPENSDIALOG | MENUITEMFLAG_LITERAL_TEXT,
(uintptr_t)"Audio\n",
0,
(void *)&g_ExtendedAudioMenuDialog,
},
{
MENUITEMTYPE_SELECTABLE,
0,
Expand Down
10 changes: 10 additions & 0 deletions src/game/music.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@ s32 g_MusicAge60 = 0; // The current age of the MP track being played
s32 g_MusicLife60 = TICKS(120); // The max age of any MP track (this value is changed in MP code)
s32 g_MusicSilenceTimer60 = 0; // Counts down the 2 second silence between MP track changes

#ifndef PLATFORM_N64
s32 g_MusicDisableMpDeath = false;
#endif

#if VERSION < VERSION_NTSC_1_0
const char var7f1b2030nb[] = "MUSIC : musicPlayLevel\n";
const char var7f1b2048nb[] = "MUSIC : SWITCHING TO CORRECT AMBIENT TUNE\n";
Expand Down Expand Up @@ -516,6 +520,12 @@ void _musicStartMpDeath(f32 arg0)

void musicStartMpDeath(void)
{
#ifndef PLATFORM_N64
if (g_MusicDisableMpDeath) {
return;
}
#endif

#if VERSION >= VERSION_NTSC_1_0
musicSaveInterval();
#endif
Expand Down
1 change: 1 addition & 0 deletions src/include/data.h
Original file line number Diff line number Diff line change
Expand Up @@ -546,6 +546,7 @@ extern s32 g_PrevFrameFb;
extern s32 g_BlurFb;
extern s32 g_BlurFbCapTimer;
extern s32 g_TickRateDiv;
extern s32 g_MusicDisableMpDeath;

#define PLAYER_EXTCFG() g_PlayerExtCfg[g_Vars.currentplayerstats->mpindex & 3]
#define PLAYER_DEFAULT_FOV (PLAYER_EXTCFG().fovy)
Expand Down

0 comments on commit 2d3e3d1

Please sign in to comment.