mirror of
https://git.do.srb2.org/KartKrew/Kart-Public.git
synced 2025-01-14 13:51:31 +00:00
Toggle Digi/MIDI music in menu accurately; add S_MusicType
(cherry picked from commit 4aa100aa575cc7fc14a743085222c806ba2c714a)
This commit is contained in:
parent
17cf310b84
commit
7e7899ae83
3 changed files with 27 additions and 17 deletions
|
@ -6991,6 +6991,7 @@ static void M_ToggleDigital(void)
|
|||
else
|
||||
{
|
||||
digital_disabled = true;
|
||||
if (S_MusicType() != MU_MID)
|
||||
S_StopMusic();
|
||||
M_StartMessage(M_GetText("Digital Music Disabled\n"), NULL, MM_NOTHING);
|
||||
}
|
||||
|
@ -7012,6 +7013,7 @@ static void M_ToggleMIDI(void)
|
|||
else
|
||||
{
|
||||
midi_disabled = true;
|
||||
if (S_MusicType() == MU_MID)
|
||||
S_StopMusic();
|
||||
M_StartMessage(M_GetText("MIDI Music Disabled\n"), NULL, MM_NOTHING);
|
||||
}
|
||||
|
|
|
@ -1245,6 +1245,11 @@ boolean S_MusicPaused(void)
|
|||
return I_MusicPaused();
|
||||
}
|
||||
|
||||
musictype_t S_MusicType(void)
|
||||
{
|
||||
return I_GetMusicType();
|
||||
}
|
||||
|
||||
const char *S_MusicName(void)
|
||||
{
|
||||
return music_name;
|
||||
|
@ -1279,19 +1284,23 @@ 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
|
||||
CONS_Alert(CONS_ERROR, M_GetText("Music lump %.6s not found!\n"), mname);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -1328,8 +1337,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))
|
||||
{
|
||||
|
@ -1362,10 +1371,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"
|
||||
|
@ -106,6 +107,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