nodigimusic nomusic nosound -> digital_disabled midi_disabled sound_disabled

(cherry picked from commit 07738fb0bcf640a4349337373f451fe68e024b2a)
This commit is contained in:
mazmazz 2018-08-23 12:42:15 -04:00
parent 44557d9c9d
commit a414ccf24a
5 changed files with 51 additions and 71 deletions

View file

@ -122,17 +122,17 @@ postimg_t postimgtype2 = postimg_none;
INT32 postimgparam2; INT32 postimgparam2;
#ifdef _XBOX #ifdef _XBOX
boolean nomidimusic = true, nosound = true; boolean midi_disabled = true, sound_disabled = true;
boolean nodigimusic = true; boolean digital_disabled = true;
#else #else
boolean nomidimusic = false, nosound = false; boolean midi_disabled = false, sound_disabled = false;
boolean nodigimusic = false; // No fmod-based music boolean digital_disabled = false; // No fmod-based music
#endif #endif
// These variables are only true if // These variables are only true if
// the respective sound system is initialized // whether the respective sound system is disabled
// and active, but no sounds/music should play. // or they're init'ed, but the player just toggled them
boolean music_disabled = false; boolean midi_disabled = false;
boolean sound_disabled = false; boolean sound_disabled = false;
boolean digital_disabled = false; boolean digital_disabled = false;
@ -1212,23 +1212,23 @@ void D_SRB2Main(void)
// setting up sound // setting up sound
if (dedicated) if (dedicated)
{ {
nosound = true; sound_disabled = true;
nomidimusic = nodigimusic = true; midi_disabled = digital_disabled = true;
} }
else else
{ {
CONS_Printf("S_InitSfxChannels(): Setting up sound channels.\n"); CONS_Printf("S_InitSfxChannels(): Setting up sound channels.\n");
} }
if (M_CheckParm("-nosound")) if (M_CheckParm("-nosound"))
nosound = true; sound_disabled = true;
if (M_CheckParm("-nomusic")) // combines -nomidimusic and -nodigmusic if (M_CheckParm("-nomusic")) // combines -nomidimusic and -nodigmusic
nomidimusic = nodigimusic = true; midi_disabled = digital_disabled = true;
else else
{ {
if (M_CheckParm("-nomidimusic")) if (M_CheckParm("-nomidimusic"))
nomidimusic = true; ; // WARNING: DOS version initmusic in I_StartupSound midi_disabled = true; ; // WARNING: DOS version initmusic in I_StartupSound
if (M_CheckParm("-nodigmusic")) if (M_CheckParm("-nodigmusic"))
nodigimusic = true; // WARNING: DOS version initmusic in I_StartupSound digital_disabled = true; // WARNING: DOS version initmusic in I_StartupSound
} }
I_StartupSound(); I_StartupSound();
I_InitMusic(); I_InitMusic();

View file

@ -85,10 +85,7 @@ extern boolean fromlevelselect;
// Internal parameters for sound rendering. // Internal parameters for sound rendering.
// ======================================== // ========================================
extern boolean nomidimusic; // defined in d_main.c extern boolean midi_disabled;
extern boolean nosound;
extern boolean nodigimusic;
extern boolean music_disabled;
extern boolean sound_disabled; extern boolean sound_disabled;
extern boolean digital_disabled; extern boolean digital_disabled;

View file

@ -6950,11 +6950,11 @@ static void M_ChangeControl(INT32 choice)
// Toggles sound systems in-game. // Toggles sound systems in-game.
static void M_ToggleSFX(void) static void M_ToggleSFX(void)
{ {
if (nosound) if (sound_disabled)
{ {
nosound = false; sound_disabled = false;
I_StartupSound(); I_StartupSound();
if (nosound) return; if (sound_disabled) return;
S_InitSfxChannels(cv_soundvolume.value); S_InitSfxChannels(cv_soundvolume.value);
M_StartMessage(M_GetText("SFX Enabled\n"), NULL, MM_NOTHING); M_StartMessage(M_GetText("SFX Enabled\n"), NULL, MM_NOTHING);
} }
@ -6975,22 +6975,17 @@ static void M_ToggleSFX(void)
} }
static void M_ToggleDigital(void) static void M_ToggleDigital(void)
{
if (nodigimusic)
{
nodigimusic = false;
I_InitDigMusic();
if (nodigimusic) return;
S_InitSfxChannels(cv_soundvolume.value);
S_StopMusic();
S_ChangeMusicInternal("lclear", false);
M_StartMessage(M_GetText("Digital Music Enabled\n"), NULL, MM_NOTHING);
}
else
{ {
if (digital_disabled) if (digital_disabled)
{ {
digital_disabled = false; digital_disabled = false;
I_InitMusic();
if (digital_disabled) return;
S_StopMusic();
if (Playing())
P_RestoreMusic(&players[consoleplayer]);
else
S_ChangeMusicInternal("lclear", false);
M_StartMessage(M_GetText("Digital Music Enabled\n"), NULL, MM_NOTHING); M_StartMessage(M_GetText("Digital Music Enabled\n"), NULL, MM_NOTHING);
} }
else else
@ -7000,34 +6995,27 @@ static void M_ToggleDigital(void)
M_StartMessage(M_GetText("Digital Music Disabled\n"), NULL, MM_NOTHING); M_StartMessage(M_GetText("Digital Music Disabled\n"), NULL, MM_NOTHING);
} }
} }
}
static void M_ToggleMIDI(void) static void M_ToggleMIDI(void)
{ {
if (nomidimusic) if (midi_disabled)
{ {
nomidimusic = false; midi_disabled = false;
I_InitMIDIMusic(); I_InitMusic();
if (nomidimusic) return; if (midi_disabled) return;
S_InitSfxChannels(cv_soundvolume.value); if (Playing())
P_RestoreMusic(&players[consoleplayer]);
else
S_ChangeMusicInternal("lclear", false); S_ChangeMusicInternal("lclear", false);
M_StartMessage(M_GetText("MIDI Music Enabled\n"), NULL, MM_NOTHING); M_StartMessage(M_GetText("MIDI Music Enabled\n"), NULL, MM_NOTHING);
} }
else else
{ {
if (music_disabled) midi_disabled = true;
{
music_disabled = false;
M_StartMessage(M_GetText("MIDI Music Enabled\n"), NULL, MM_NOTHING);
}
else
{
music_disabled = true;
S_StopMusic(); S_StopMusic();
M_StartMessage(M_GetText("MIDI Music Disabled\n"), NULL, MM_NOTHING); M_StartMessage(M_GetText("MIDI Music Disabled\n"), NULL, MM_NOTHING);
} }
} }
}
// =============== // ===============
// VIDEO MODE MENU // VIDEO MODE MENU

View file

@ -8228,7 +8228,7 @@ void P_PrecipitationEffects(void)
if (!playeringame[displayplayer] || !players[displayplayer].mo) if (!playeringame[displayplayer] || !players[displayplayer].mo)
return; return;
if (nosound || sound_disabled) if (sound_disabled)
return; // Sound off? D'aw, no fun. return; // Sound off? D'aw, no fun.
if (players[displayplayer].mo->subsector->sector->ceilingpic == skyflatnum) if (players[displayplayer].mo->subsector->sector->ceilingpic == skyflatnum)

View file

@ -226,7 +226,7 @@ void S_RegisterSoundStuff(void)
{ {
if (dedicated) if (dedicated)
{ {
nosound = true; sound_disabled = true;
return; return;
} }
@ -400,7 +400,7 @@ void S_StartSoundAtVolume(const void *origin_p, sfxenum_t sfx_id, INT32 volume)
mobj_t *listenmobj = players[displayplayer].mo; mobj_t *listenmobj = players[displayplayer].mo;
mobj_t *listenmobj2 = NULL; mobj_t *listenmobj2 = NULL;
if (sound_disabled || !sound_started || nosound) if (sound_disabled || !sound_started)
return; return;
// Don't want a sound? Okay then... // Don't want a sound? Okay then...
@ -716,7 +716,7 @@ void S_UpdateSounds(void)
return; return;
} }
if (dedicated || nosound) if (dedicated || sound_disabled)
return; return;
if (players[displayplayer].awayviewtics) if (players[displayplayer].awayviewtics)
@ -1175,7 +1175,7 @@ void S_InitSfxChannels(INT32 sfxVolume)
} }
// precache sounds if requested by cmdline, or precachesound var true // precache sounds if requested by cmdline, or precachesound var true
if (!nosound && (M_CheckParm("-precachesound") || precachesound.value)) if (!sound_disabled && (M_CheckParm("-precachesound") || precachesound.value))
{ {
// Initialize external data (all sounds) at start, keep static. // Initialize external data (all sounds) at start, keep static.
CONS_Printf(M_GetText("Loading sounds... ")); CONS_Printf(M_GetText("Loading sounds... "));
@ -1220,24 +1220,19 @@ static char music_name[7]; // up to 6-character name
/// Music Status /// Music Status
/// ------------------------ /// ------------------------
boolean S_DigMusicDisabled() boolean S_DigMusicDisabled(void)
{ {
return (nodigimusic || digital_disabled); return digital_disabled;
} }
boolean S_MIDIMusicDisabled() boolean S_MIDIMusicDisabled(void)
{ {
return (nomidimusic || music_disabled); return midi_disabled;
} }
boolean S_MusicDisabled() boolean S_MusicDisabled(void)
{ {
return ( return (midi_disabled && digital_disabled);
(nodigimusic && nomidimusic) ||
(music_disabled && digital_disabled) ||
(nodigimusic && music_disabled) ||
(nomidimusic && digital_disabled)
);
} }
boolean S_MusicPlaying(void) boolean S_MusicPlaying(void)
@ -1333,7 +1328,7 @@ static void S_UnloadMusic(void)
static boolean S_PlayMusic(boolean looping) static boolean S_PlayMusic(boolean looping)
{ {
if (nodigimusic || digital_disabled) if (S_DigMusicDisabled())
return false; // try midi return false; // try midi
if (!I_PlaySong(looping)) if (!I_PlaySong(looping))