mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2025-10-30 08:01:28 +00:00
Separate StopMusic and UnloadMusic
(cherry picked from commit db37bfc921)
This commit is contained in:
parent
64cc452077
commit
dc20a41c25
2 changed files with 25 additions and 37 deletions
|
|
@ -1464,11 +1464,13 @@ static boolean S_LoadMusic(const char *mname)
|
||||||
static void S_UnloadMusic(void)
|
static void S_UnloadMusic(void)
|
||||||
{
|
{
|
||||||
I_UnloadSong();
|
I_UnloadSong();
|
||||||
music_name[0] = 0;
|
|
||||||
#ifndef HAVE_SDL //SDL uses RWOPS
|
#ifndef HAVE_SDL //SDL uses RWOPS
|
||||||
Z_ChangeTag(music_data, PU_CACHE);
|
Z_ChangeTag(music_data, PU_CACHE);
|
||||||
#endif
|
#endif
|
||||||
music_data = NULL;
|
music_data = NULL;
|
||||||
|
|
||||||
|
music_name[0] = 0;
|
||||||
music_flags = 0;
|
music_flags = 0;
|
||||||
music_looping = false;
|
music_looping = false;
|
||||||
}
|
}
|
||||||
|
|
@ -1529,13 +1531,7 @@ void S_StopMusic(void)
|
||||||
|
|
||||||
S_SpeedMusic(1.0f);
|
S_SpeedMusic(1.0f);
|
||||||
I_StopSong();
|
I_StopSong();
|
||||||
I_UnloadSong();
|
S_UnloadMusic(); // for now, stopping also means you unload the song
|
||||||
|
|
||||||
#ifndef HAVE_SDL //SDL uses RWOPS
|
|
||||||
Z_ChangeTag(music_data, PU_CACHE);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
music_name[0] = 0;
|
|
||||||
|
|
||||||
if (cv_closedcaptioning.value)
|
if (cv_closedcaptioning.value)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -484,19 +484,7 @@ FUNCMATH void I_InitMusic(void)
|
||||||
|
|
||||||
void I_ShutdownMusic(void)
|
void I_ShutdownMusic(void)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_LIBGME
|
I_UnloadSong();
|
||||||
if (gme)
|
|
||||||
{
|
|
||||||
Mix_HookMusic(NULL, NULL);
|
|
||||||
gme_delete(gme);
|
|
||||||
gme = NULL;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
if (!music)
|
|
||||||
return;
|
|
||||||
Mix_HookMusicFinished(NULL);
|
|
||||||
Mix_FreeMusic(music);
|
|
||||||
music = NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// ------------------------
|
/// ------------------------
|
||||||
|
|
@ -565,10 +553,8 @@ boolean I_SetSongSpeed(float speed)
|
||||||
|
|
||||||
boolean I_LoadSong(char *data, size_t len)
|
boolean I_LoadSong(char *data, size_t len)
|
||||||
{
|
{
|
||||||
I_Assert(!music);
|
if (music || gme)
|
||||||
#ifdef HAVE_LIBGME
|
I_UnloadSong();
|
||||||
I_Assert(!gme);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef HAVE_LIBGME
|
#ifdef HAVE_LIBGME
|
||||||
if ((UINT8)data[0] == 0x1F
|
if ((UINT8)data[0] == 0x1F
|
||||||
|
|
@ -710,11 +696,20 @@ boolean I_LoadSong(char *data, size_t len)
|
||||||
|
|
||||||
void I_UnloadSong(void)
|
void I_UnloadSong(void)
|
||||||
{
|
{
|
||||||
// \todo unhook looper
|
|
||||||
//var_cleanup();
|
|
||||||
//Mix_FreeMusic(music);
|
|
||||||
//music = NULL;
|
|
||||||
I_StopSong();
|
I_StopSong();
|
||||||
|
|
||||||
|
#ifdef HAVE_LIBGME
|
||||||
|
if (gme)
|
||||||
|
{
|
||||||
|
gme_delete(gme);
|
||||||
|
gme = NULL;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
if (music)
|
||||||
|
{
|
||||||
|
Mix_FreeMusic(music);
|
||||||
|
music = NULL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean I_PlaySong(boolean looping)
|
boolean I_PlaySong(boolean looping)
|
||||||
|
|
@ -750,17 +745,14 @@ void I_StopSong(void)
|
||||||
if (gme)
|
if (gme)
|
||||||
{
|
{
|
||||||
Mix_HookMusic(NULL, NULL);
|
Mix_HookMusic(NULL, NULL);
|
||||||
gme_delete(gme);
|
|
||||||
gme = NULL;
|
|
||||||
current_track = -1;
|
current_track = -1;
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
if (!music)
|
if (music)
|
||||||
return;
|
{
|
||||||
Mix_HookMusicFinished(NULL);
|
Mix_HookMusicFinished(NULL);
|
||||||
Mix_FreeMusic(music);
|
Mix_HaltMusic();
|
||||||
music = NULL;
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void I_PauseSong(void)
|
void I_PauseSong(void)
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue