mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2025-10-30 08:01:28 +00:00
Merge branch 'music-joining' into 'master'
Fix music on midgame server join Closes #473 See merge request KartKrew/Kart!1351
This commit is contained in:
commit
87aab3c881
7 changed files with 47 additions and 29 deletions
|
|
@ -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];
|
||||
|
|
|
|||
|
|
@ -184,6 +184,7 @@ boolean P_PlayerHitFloor(player_t *player, boolean fromAir, angle_t oldPitch, an
|
|||
|
||||
void P_SetObjectMomZ(mobj_t *mo, fixed_t value, boolean relative);
|
||||
void P_RestoreMusic(player_t *player);
|
||||
void P_StartPositionMusic(boolean exact);
|
||||
void P_EndingMusic(void);
|
||||
mobj_t *P_SpawnGhostMobj(mobj_t *mobj);
|
||||
mobj_t *P_SpawnFakeShadow(mobj_t *mobj, UINT8 offset);
|
||||
|
|
|
|||
|
|
@ -8062,13 +8062,11 @@ boolean P_LoadLevel(boolean fromnetsave, boolean reloadinggamestate)
|
|||
|
||||
// Fade out music here. Deduct 2 tics so the fade volume actually reaches 0.
|
||||
// But don't halt the music! S_Start will take care of that. This dodges a MIDI crash bug.
|
||||
if (!(reloadinggamestate || gamestate != GS_LEVEL))
|
||||
if (gamestate == GS_LEVEL)
|
||||
S_FadeMusic(0, FixedMul(
|
||||
FixedDiv((F_GetWipeLength(wipedefs[wipe_level_toblack])-2)*NEWTICRATERATIO, NEWTICRATE), MUSICRATE));
|
||||
|
||||
if (reloadinggamestate)
|
||||
;
|
||||
else if (K_PodiumSequence())
|
||||
if (K_PodiumSequence())
|
||||
{
|
||||
// mapmusrng is set by local player position in K_ResetCeremony
|
||||
S_InitLevelMusic(true);
|
||||
|
|
|
|||
17
src/p_tick.c
17
src/p_tick.c
|
|
@ -901,22 +901,7 @@ void P_Ticker(boolean run)
|
|||
}
|
||||
|
||||
// POSITION!! music
|
||||
if (encoremode)
|
||||
{
|
||||
// Encore humming starts immediately.
|
||||
if (leveltime == 1)
|
||||
S_ChangeMusicInternal("encore", true);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Plays the POSITION music after the camera spin
|
||||
if (leveltime == introtime)
|
||||
S_ChangeMusicInternal(
|
||||
(mapheaderinfo[gamemap-1]->positionmus[0]
|
||||
? mapheaderinfo[gamemap-1]->positionmus
|
||||
: "postn"
|
||||
), true);
|
||||
}
|
||||
P_StartPositionMusic(true); // exact times only
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
32
src/p_user.c
32
src/p_user.c
|
|
@ -705,6 +705,37 @@ void P_PlayVictorySound(mobj_t *source)
|
|||
S_StartSound(source, sfx_kwin);
|
||||
}
|
||||
|
||||
//
|
||||
// P_StartPositionMusic
|
||||
//
|
||||
// Consistently sets starting music!
|
||||
//
|
||||
void P_StartPositionMusic(boolean exact)
|
||||
{
|
||||
if (encoremode)
|
||||
{
|
||||
if (exact
|
||||
? (leveltime != 1)
|
||||
: (leveltime < 1))
|
||||
return;
|
||||
|
||||
S_ChangeMusicInternal("encore", true);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (exact
|
||||
? (leveltime != introtime)
|
||||
: (leveltime < introtime))
|
||||
return;
|
||||
|
||||
S_ChangeMusicInternal(
|
||||
(mapheaderinfo[gamemap-1]->positionmus[0]
|
||||
? mapheaderinfo[gamemap-1]->positionmus
|
||||
: "postn"
|
||||
), true);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// P_EndingMusic
|
||||
//
|
||||
|
|
@ -882,6 +913,7 @@ void P_RestoreMusic(player_t *player)
|
|||
if ((K_CheckBossIntro() == false)
|
||||
&& (leveltime < (starttime + (TICRATE/2)))) // see also where time overs are handled
|
||||
{
|
||||
P_StartPositionMusic(false); // inexact timing permitted
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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
|
||||
//
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue