Use S_AttemptToRestoreMusic to handle music after server connection

Resolves #473
This commit is contained in:
toaster 2023-07-22 18:56:54 +01:00
parent 2fd7c7717c
commit 2dbb11af89
3 changed files with 11 additions and 9 deletions

View file

@ -3960,6 +3960,9 @@ static void Got_AddPlayer(UINT8 **p, INT32 playernum)
playerconsole[newplayernum] = console;
G_BuildLocalSplitscreenParty(newplayernum);
if (node == mynode && splitscreenplayer == 0)
S_AttemptToRestoreMusic(); // Earliest viable point
if (netgame)
{
char joinmsg[256];

View file

@ -1362,7 +1362,7 @@ static UINT32 queue_fadeinms;
static tic_t pause_starttic;
static void S_AttemptToRestoreMusic(void)
void S_AttemptToRestoreMusic(void)
{
switch (gamestate)
{
@ -1376,6 +1376,9 @@ static void S_AttemptToRestoreMusic(void)
case GS_INTERMISSION:
S_ChangeMusicInternal("racent", true);
break;
case GS_CEREMONY:
S_ChangeMusicEx(mapmusname, mapmusflags, true, mapmusposition, 0, 0);
break;
case GS_TITLESCREEN:
S_ChangeMusicInternal("_title", looptitle);
break;
@ -2975,14 +2978,7 @@ void S_InitLevelMusic(boolean fromnetsave)
mapmusresume = 0;
}
S_StopMusic(); // Starting ambience should always be restarted, if playing.
if (leveltime < (starttime + (TICRATE/2))) // SRB2Kart
{
;
}
else
S_ChangeMusicEx(mapmusname, mapmusflags, true, mapmusposition, 0, 0);
S_StopMusic();
S_ResetMusicStack();
music_stack_noposition = false;

View file

@ -346,6 +346,9 @@ void S_ResumeAudio(void);
void S_EnableSound(void);
void S_DisableSound(void);
// Attempt to restore music based on gamestate.
void S_AttemptToRestoreMusic(void);
//
// Music Fading
//