mirror of
https://git.do.srb2.org/KartKrew/Kart-Public.git
synced 2025-01-12 21:01:00 +00:00
Merge branch 'public-musicplus-feature-endoflevel' into 'next'
Fade out music at end of level, before intermission See merge request STJr/SRB2!472
This commit is contained in:
commit
47eb711097
4 changed files with 42 additions and 2 deletions
|
@ -131,6 +131,7 @@ extern UINT8 skincolor_redteam, skincolor_blueteam, skincolor_redring, skincolor
|
||||||
|
|
||||||
extern tic_t countdowntimer;
|
extern tic_t countdowntimer;
|
||||||
extern boolean countdowntimeup;
|
extern boolean countdowntimeup;
|
||||||
|
extern boolean exitfadestarted;
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
|
|
|
@ -131,6 +131,7 @@ UINT8 skincolor_bluering = SKINCOLOR_STEELBLUE;
|
||||||
|
|
||||||
tic_t countdowntimer = 0;
|
tic_t countdowntimer = 0;
|
||||||
boolean countdowntimeup = false;
|
boolean countdowntimeup = false;
|
||||||
|
boolean exitfadestarted = false;
|
||||||
|
|
||||||
cutscene_t *cutscenes[128];
|
cutscene_t *cutscenes[128];
|
||||||
|
|
||||||
|
@ -3701,7 +3702,7 @@ void G_InitNew(UINT8 pultmode, const char *mapname, boolean resetplayer, boolean
|
||||||
{
|
{
|
||||||
// Clear a bunch of variables
|
// Clear a bunch of variables
|
||||||
tokenlist = token = sstimer = redscore = bluescore = lastmap = 0;
|
tokenlist = token = sstimer = redscore = bluescore = lastmap = 0;
|
||||||
countdown = countdown2 = 0;
|
countdown = countdown2 = exitfadestarted = 0;
|
||||||
|
|
||||||
for (i = 0; i < MAXPLAYERS; i++)
|
for (i = 0; i < MAXPLAYERS; i++)
|
||||||
{
|
{
|
||||||
|
|
|
@ -2311,7 +2311,7 @@ static void P_LevelInitStuff(void)
|
||||||
players[i].lives = cv_startinglives.value;
|
players[i].lives = cv_startinglives.value;
|
||||||
}
|
}
|
||||||
|
|
||||||
players[i].realtime = countdown = countdown2 = 0;
|
players[i].realtime = countdown = countdown2 = exitfadestarted = 0;
|
||||||
|
|
||||||
players[i].gotcontinue = false;
|
players[i].gotcontinue = false;
|
||||||
|
|
||||||
|
|
38
src/p_user.c
38
src/p_user.c
|
@ -8824,6 +8824,44 @@ void P_PlayerThink(player_t *player)
|
||||||
if (player->exiting && countdown2)
|
if (player->exiting && countdown2)
|
||||||
player->exiting = 5;
|
player->exiting = 5;
|
||||||
|
|
||||||
|
// Same check as below, just at 1 second before
|
||||||
|
// so we can fade music
|
||||||
|
if (!exitfadestarted &&
|
||||||
|
player->exiting > 0 && player->exiting <= 1*TICRATE &&
|
||||||
|
(!multiplayer || gametype == GT_COOP ? !mapheaderinfo[gamemap-1]->musinterfadeout : true) &&
|
||||||
|
// don't fade if we're fading during intermission. follows Y_StartIntermission intertype = int_coop
|
||||||
|
(gametype == GT_RACE || gametype == GT_COMPETITION ? countdown2 == 0 : true) && // don't fade on timeout
|
||||||
|
player->lives > 0 && // don't fade on game over (competition)
|
||||||
|
P_IsLocalPlayer(player))
|
||||||
|
{
|
||||||
|
if (cv_playersforexit.value)
|
||||||
|
{
|
||||||
|
INT32 i;
|
||||||
|
|
||||||
|
for (i = 0; i < MAXPLAYERS; i++)
|
||||||
|
{
|
||||||
|
if (!playeringame[i] || players[i].spectator || players[i].bot)
|
||||||
|
continue;
|
||||||
|
if (players[i].lives <= 0)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (!players[i].exiting || players[i].exiting > 1*TICRATE)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (i == MAXPLAYERS)
|
||||||
|
{
|
||||||
|
exitfadestarted = true;
|
||||||
|
S_FadeOutStopMusic(1*MUSICRATE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
exitfadestarted = true;
|
||||||
|
S_FadeOutStopMusic(1*MUSICRATE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (player->exiting == 2 || countdown2 == 2)
|
if (player->exiting == 2 || countdown2 == 2)
|
||||||
{
|
{
|
||||||
if (cv_playersforexit.value) // Count to be sure everyone's exited
|
if (cv_playersforexit.value) // Count to be sure everyone's exited
|
||||||
|
|
Loading…
Reference in a new issue