CHANGED MIND: Nix'd S_MIDIMusic, I_PlaySong, and I_RegisterSong

* music_lumpnum, music_data, music_handle are gone
* Relevant interfaces I_PlaySong are transferred to I_StartDigSong
This commit is contained in:
mazmazz 2018-08-23 07:49:09 -04:00
parent 58fbb4636f
commit 8b46bce155
4 changed files with 27 additions and 94 deletions

View File

@ -84,13 +84,6 @@ void I_InitMIDIMusic(void){}
void I_ShutdownMIDIMusic(void){}
INT32 I_RegisterSong(void *data, size_t len)
{
(void)data;
(void)len;
return -1;
}
boolean I_PlaySong(INT32 handle, INT32 looping)
{
(void)handle;

View File

@ -423,19 +423,6 @@ void I_ShutdownMusic(void)
I_ShutdownDigMusic();
}
boolean I_PlaySong(INT32 handle, INT32 looping)
{
handle = 0;
if (nomidimusic)
return false;
islooping = looping;
musicdies = gametic + NEWTICRATE*30;
if (play_midi(currsong,looping)==0)
return true;
return false;
}
void I_PauseSong (INT32 handle)
{
handle = 0;
@ -486,11 +473,24 @@ void I_UnRegisterSong(INT32 handle)
//destroy_midi(currsong);
}
INT32 I_RegisterSong(void *data, size_t len)
boolean I_StartDigSong(const char *musicname, INT32 looping)
{
/////////////////
// Load the song!
char *data;
size_t len;
lumpnum_t lumpnum = W_CheckNumForName(va("D_%s",musicname));
if (lumpnum == LUMPERROR)
return false;
data = (char *)W_CacheLumpNum(lumpnum, PU_MUSIC);
len = W_LumpLength(lumpnum);
int e = len; //Alam: For error
if (nomidimusic)
return 0;
return false;
if (memcmp(data,"MThd",4)==0) // support mid file in WAD !!!
{
@ -499,24 +499,25 @@ INT32 I_RegisterSong(void *data, size_t len)
else
{
CONS_Printf("Music Lump is not a MIDI lump\n");
return 0;
return false;
}
if (currsong==NULL)
{
CONS_Printf("Not a valid mid file : %d\n",e);
return 0;
return false;
}
return 1;
}
/////////////////
// Play the song!
handle = 0;
if (nomidimusic)
return false;
/// \todo Add OGG/MP3 support for dos
boolean I_StartDigSong(const char *musicname, INT32 looping)
{
musicname = NULL;
looping = 0;
//CONS_Printf("I_StartDigSong: Not yet supported under DOS.\n");
islooping = looping;
musicdies = gametic + NEWTICRATE*30;
if (play_midi(currsong,looping)==0)
return true;
return false;
}

View File

@ -83,20 +83,6 @@ void I_InitMIDIMusic(void){}
void I_ShutdownMIDIMusic(void){}
INT32 I_RegisterSong(void *data, size_t len)
{
(void)data;
(void)len;
return -1;
}
boolean I_PlaySong(INT32 handle, boolean looping)
{
(void)handle;
(void)looping;
return false;
}
void I_StopSong(INT32 handle)
{
(void)handle;

View File

@ -1308,53 +1308,9 @@ const char *compat_special_music_slots[16] =
#define music_playing (music_name[0]) // String is empty if no music is playing
static char music_name[7]; // up to 6-character name
static lumpnum_t music_lumpnum; // lump number of music (used??)
static void *music_data; // music raw data
static INT32 music_handle; // once registered, the handle for the music
static boolean mus_paused = 0; // whether songs are mus_paused
static boolean S_MIDIMusic(const char *mname, boolean looping)
{
lumpnum_t mlumpnum;
void *mdata;
INT32 mhandle;
if (nomidimusic || music_disabled)
return false; // didn't search.
if (W_CheckNumForName(va("d_%s", mname)) == LUMPERROR)
return false;
mlumpnum = W_GetNumForName(va("d_%s", mname));
// load & register it
mdata = W_CacheLumpNum(mlumpnum, PU_MUSIC);
mhandle = I_RegisterSong(mdata, W_LumpLength(mlumpnum));
#ifdef MUSSERV
if (msg_id != -1)
{
struct musmsg msg_buffer;
msg_buffer.msg_type = 6;
memset(msg_buffer.msg_text, 0, sizeof (msg_buffer.msg_text));
sprintf(msg_buffer.msg_text, "d_%s", mname);
msgsnd(msg_id, (struct msgbuf*)&msg_buffer, sizeof (msg_buffer.msg_text), IPC_NOWAIT);
}
#endif
// play it
if (!I_PlaySong(mhandle, looping))
return false;
strncpy(music_name, mname, 7);
music_name[6] = 0;
music_lumpnum = mlumpnum;
music_data = mdata;
music_handle = mhandle;
return true;
}
static boolean S_DigMusic(const char *mname, boolean looping)
{
if (nodigimusic || digital_disabled)
@ -1365,9 +1321,6 @@ static boolean S_DigMusic(const char *mname, boolean looping)
strncpy(music_name, mname, 7);
music_name[6] = 0;
music_lumpnum = LUMPERROR;
music_data = NULL;
music_handle = 0;
return true;
}
@ -1386,7 +1339,7 @@ void S_ChangeMusic(const char *mmusic, UINT16 mflags, boolean looping)
if (strncmp(music_name, mmusic, 6))
{
S_StopMusic(); // shutdown old music
if (!S_DigMusic(mmusic, looping) && !S_MIDIMusic(mmusic, looping))
if (!S_DigMusic(mmusic, looping))
{
CONS_Alert(CONS_ERROR, M_GetText("Music lump %.6s not found!\n"), mmusic);
return;