mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2024-11-15 09:11:48 +00:00
Toggle Digi/MIDI music in menu accurately; add S_MusicType
This commit is contained in:
parent
86f151db65
commit
4aa100aa57
3 changed files with 27 additions and 17 deletions
|
@ -9484,7 +9484,8 @@ static void M_ToggleDigital(INT32 choice)
|
|||
else
|
||||
{
|
||||
digital_disabled = true;
|
||||
S_StopMusic();
|
||||
if (S_MusicType() != MU_MID)
|
||||
S_StopMusic();
|
||||
//M_StartMessage(M_GetText("Digital Music Disabled\n"), NULL, MM_NOTHING);
|
||||
}
|
||||
}
|
||||
|
@ -9527,7 +9528,8 @@ static void M_ToggleMIDI(INT32 choice)
|
|||
else
|
||||
{
|
||||
midi_disabled = true;
|
||||
S_StopMusic();
|
||||
if (S_MusicType() == MU_MID)
|
||||
S_StopMusic();
|
||||
//M_StartMessage(M_GetText("MIDI Music Disabled\n"), NULL, MM_NOTHING);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1377,6 +1377,11 @@ boolean S_MusicPaused(void)
|
|||
return I_MusicPaused();
|
||||
}
|
||||
|
||||
musictype_t S_MusicType(void)
|
||||
{
|
||||
return I_GetMusicType();
|
||||
}
|
||||
|
||||
const char *S_MusicName(void)
|
||||
{
|
||||
return music_name;
|
||||
|
@ -1411,20 +1416,24 @@ static boolean S_LoadMusic(const char *mname)
|
|||
if (S_MusicDisabled())
|
||||
return false;
|
||||
|
||||
if (S_DigMusicDisabled())
|
||||
{
|
||||
if (!S_MIDIExists(mname))
|
||||
return false;
|
||||
if (!S_DigMusicDisabled() && S_DigExists(mname))
|
||||
mlumpnum = W_GetNumForName(va("o_%s", mname));
|
||||
else if (!S_MIDIMusicDisabled() && S_MIDIExists(mname))
|
||||
mlumpnum = W_GetNumForName(va("d_%s", mname));
|
||||
else if (S_DigMusicDisabled() && S_DigExists(mname))
|
||||
{
|
||||
CONS_Alert(CONS_NOTICE, "Digital music is disabled!\n");
|
||||
return false;
|
||||
}
|
||||
else if (S_MIDIMusicDisabled() && S_MIDIExists(mname))
|
||||
{
|
||||
CONS_Alert(CONS_NOTICE, "MIDI music is disabled!\n");
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (S_DigExists(mname))
|
||||
mlumpnum = W_GetNumForName(va("o_%s", mname));
|
||||
else if (S_MIDIExists(mname))
|
||||
mlumpnum = W_GetNumForName(va("d_%s", mname));
|
||||
else
|
||||
return false;
|
||||
CONS_Alert(CONS_ERROR, M_GetText("Music lump %.6s not found!\n"), mname);
|
||||
return false;
|
||||
}
|
||||
|
||||
// load & register it
|
||||
|
@ -1448,8 +1457,8 @@ static void S_UnloadMusic(void)
|
|||
|
||||
static boolean S_PlayMusic(boolean looping)
|
||||
{
|
||||
if (S_DigMusicDisabled())
|
||||
return false; // try midi
|
||||
if (S_MusicDisabled())
|
||||
return false;
|
||||
|
||||
if (!I_PlaySong(looping))
|
||||
{
|
||||
|
@ -1478,10 +1487,7 @@ void S_ChangeMusic(const char *mmusic, UINT16 mflags, boolean looping)
|
|||
S_StopMusic(); // shutdown old music
|
||||
|
||||
if (!S_LoadMusic(mmusic))
|
||||
{
|
||||
CONS_Alert(CONS_ERROR, M_GetText("Music lump %.6s not found!\n"), mmusic);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!S_PlayMusic(looping))
|
||||
{
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
#ifndef __S_SOUND__
|
||||
#define __S_SOUND__
|
||||
|
||||
#include "i_sound.h" // musictype_t
|
||||
#include "sounds.h"
|
||||
#include "m_fixed.h"
|
||||
#include "command.h"
|
||||
|
@ -134,6 +135,7 @@ boolean S_MIDIMusicDisabled(void);
|
|||
boolean S_MusicDisabled(void);
|
||||
boolean S_MusicPlaying(void);
|
||||
boolean S_MusicPaused(void);
|
||||
musictype_t S_MusicType(void);
|
||||
const char *S_MusicName(void);
|
||||
boolean S_MusicExists(const char *mname, boolean checkMIDI, boolean checkDigi);
|
||||
#define S_DigExists(a) S_MusicExists(a, false, true)
|
||||
|
|
Loading…
Reference in a new issue