mirror of
https://git.do.srb2.org/KartKrew/Kart-Public.git
synced 2025-01-14 22:00:50 +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
|
else
|
||||||
{
|
{
|
||||||
digital_disabled = true;
|
digital_disabled = true;
|
||||||
|
if (S_MusicType() != MU_MID)
|
||||||
S_StopMusic();
|
S_StopMusic();
|
||||||
M_StartMessage(M_GetText("Digital Music Disabled\n"), NULL, MM_NOTHING);
|
M_StartMessage(M_GetText("Digital Music Disabled\n"), NULL, MM_NOTHING);
|
||||||
}
|
}
|
||||||
|
@ -7012,6 +7013,7 @@ static void M_ToggleMIDI(void)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
midi_disabled = true;
|
midi_disabled = true;
|
||||||
|
if (S_MusicType() == MU_MID)
|
||||||
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);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1245,6 +1245,11 @@ boolean S_MusicPaused(void)
|
||||||
return I_MusicPaused();
|
return I_MusicPaused();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
musictype_t S_MusicType(void)
|
||||||
|
{
|
||||||
|
return I_GetMusicType();
|
||||||
|
}
|
||||||
|
|
||||||
const char *S_MusicName(void)
|
const char *S_MusicName(void)
|
||||||
{
|
{
|
||||||
return music_name;
|
return music_name;
|
||||||
|
@ -1279,19 +1284,23 @@ static boolean S_LoadMusic(const char *mname)
|
||||||
if (S_MusicDisabled())
|
if (S_MusicDisabled())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (S_DigMusicDisabled())
|
if (!S_DigMusicDisabled() && S_DigExists(mname))
|
||||||
{
|
mlumpnum = W_GetNumForName(va("o_%s", mname));
|
||||||
if (!S_MIDIExists(mname))
|
else if (!S_MIDIMusicDisabled() && S_MIDIExists(mname))
|
||||||
return false;
|
|
||||||
mlumpnum = W_GetNumForName(va("d_%s", 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
|
else
|
||||||
{
|
{
|
||||||
if (S_DigExists(mname))
|
CONS_Alert(CONS_ERROR, M_GetText("Music lump %.6s not found!\n"), mname);
|
||||||
mlumpnum = W_GetNumForName(va("o_%s", mname));
|
|
||||||
else if (S_MIDIExists(mname))
|
|
||||||
mlumpnum = W_GetNumForName(va("d_%s", mname));
|
|
||||||
else
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1328,8 +1337,8 @@ static void S_UnloadMusic(void)
|
||||||
|
|
||||||
static boolean S_PlayMusic(boolean looping)
|
static boolean S_PlayMusic(boolean looping)
|
||||||
{
|
{
|
||||||
if (S_DigMusicDisabled())
|
if (S_MusicDisabled())
|
||||||
return false; // try midi
|
return false;
|
||||||
|
|
||||||
if (!I_PlaySong(looping))
|
if (!I_PlaySong(looping))
|
||||||
{
|
{
|
||||||
|
@ -1362,10 +1371,7 @@ void S_ChangeMusic(const char *mmusic, UINT16 mflags, boolean looping)
|
||||||
S_StopMusic(); // shutdown old music
|
S_StopMusic(); // shutdown old music
|
||||||
|
|
||||||
if (!S_LoadMusic(mmusic))
|
if (!S_LoadMusic(mmusic))
|
||||||
{
|
|
||||||
CONS_Alert(CONS_ERROR, M_GetText("Music lump %.6s not found!\n"), mmusic);
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
if (!S_PlayMusic(looping))
|
if (!S_PlayMusic(looping))
|
||||||
{
|
{
|
||||||
|
|
|
@ -14,6 +14,7 @@
|
||||||
#ifndef __S_SOUND__
|
#ifndef __S_SOUND__
|
||||||
#define __S_SOUND__
|
#define __S_SOUND__
|
||||||
|
|
||||||
|
#include "i_sound.h" // musictype_t
|
||||||
#include "sounds.h"
|
#include "sounds.h"
|
||||||
#include "m_fixed.h"
|
#include "m_fixed.h"
|
||||||
#include "command.h"
|
#include "command.h"
|
||||||
|
@ -106,6 +107,7 @@ boolean S_MIDIMusicDisabled(void);
|
||||||
boolean S_MusicDisabled(void);
|
boolean S_MusicDisabled(void);
|
||||||
boolean S_MusicPlaying(void);
|
boolean S_MusicPlaying(void);
|
||||||
boolean S_MusicPaused(void);
|
boolean S_MusicPaused(void);
|
||||||
|
musictype_t S_MusicType(void);
|
||||||
const char *S_MusicName(void);
|
const char *S_MusicName(void);
|
||||||
boolean S_MusicExists(const char *mname, boolean checkMIDI, boolean checkDigi);
|
boolean S_MusicExists(const char *mname, boolean checkMIDI, boolean checkDigi);
|
||||||
#define S_DigExists(a) S_MusicExists(a, false, true)
|
#define S_DigExists(a) S_MusicExists(a, false, true)
|
||||||
|
|
Loading…
Reference in a new issue