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

View file

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

View file

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

View file

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

View file

@ -226,7 +226,7 @@ void S_RegisterSoundStuff(void)
{
if (dedicated)
{
nosound = true;
sound_disabled = true;
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 *listenmobj2 = NULL;
if (sound_disabled || !sound_started || nosound)
if (sound_disabled || !sound_started)
return;
// Don't want a sound? Okay then...
@ -716,7 +716,7 @@ void S_UpdateSounds(void)
return;
}
if (dedicated || nosound)
if (dedicated || sound_disabled)
return;
if (players[displayplayer].awayviewtics)
@ -1175,7 +1175,7 @@ void S_InitSfxChannels(INT32 sfxVolume)
}
// 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.
CONS_Printf(M_GetText("Loading sounds... "));
@ -1220,24 +1220,19 @@ static char music_name[7]; // up to 6-character name
/// 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 (
(nodigimusic && nomidimusic) ||
(music_disabled && digital_disabled) ||
(nodigimusic && music_disabled) ||
(nomidimusic && digital_disabled)
);
return (midi_disabled && digital_disabled);
}
boolean S_MusicPlaying(void)
@ -1333,7 +1328,7 @@ static void S_UnloadMusic(void)
static boolean S_PlayMusic(boolean looping)
{
if (nodigimusic || digital_disabled)
if (S_DigMusicDisabled())
return false; // try midi
if (!I_PlaySong(looping))