mirror of
https://git.do.srb2.org/KartKrew/Kart-Public.git
synced 2025-01-31 05:20:51 +00:00
Change how battle music/patch is decided
This commit is contained in:
parent
6574e1f0fc
commit
4032a14581
2 changed files with 47 additions and 67 deletions
13
src/k_kart.c
13
src/k_kart.c
|
@ -421,8 +421,10 @@ boolean K_IsPlayerLosing(player_t *player)
|
|||
|
||||
for (i = 0; i < MAXPLAYERS; i++)
|
||||
{
|
||||
if (playeringame[i] && !players[i].spectator)
|
||||
pcount++;
|
||||
if (!playeringame[i] || players[i].spectator)
|
||||
continue;
|
||||
if (players[i].kartstuff[k_position] > pcount)
|
||||
pcount = players[i].kartstuff[k_position];
|
||||
}
|
||||
|
||||
if (pcount <= 1)
|
||||
|
@ -4013,7 +4015,10 @@ void K_CheckBumpers(void)
|
|||
CONS_Printf(M_GetText("%s recieved %d point%s for winning!\n"), player_names[winnernum], winnerscoreadd, (winnerscoreadd == 1 ? "" : "s"));
|
||||
}
|
||||
|
||||
for (i = 0; i < MAXPLAYERS; i++)
|
||||
for (i = 0; i < MAXPLAYERS; i++) // This can't go in the earlier loop because winning adds points
|
||||
K_KartUpdatePosition(&players[i]);
|
||||
|
||||
for (i = 0; i < MAXPLAYERS; i++) // and it can't be merged with this loop because it needs to be all updated before exiting... multi-loops suck...
|
||||
P_DoPlayerExit(&players[i]);
|
||||
}
|
||||
|
||||
|
@ -5298,7 +5303,7 @@ static void K_drawBattleFullscreen(void)
|
|||
{
|
||||
if (stplyr == &players[displayplayer])
|
||||
V_DrawFadeScreen(0xFF00, 16);
|
||||
if (stplyr->kartstuff[k_bumper])
|
||||
if ((!splitscreen && !K_IsPlayerLosing(stplyr)) || stplyr->kartstuff[k_bumper])
|
||||
V_DrawFixedPatch(x<<FRACBITS, y<<FRACBITS, scale, splitflags, kp_battlewin, NULL);
|
||||
else if (splitscreen < 2)
|
||||
V_DrawFixedPatch(x<<FRACBITS, y<<FRACBITS, scale, splitflags, kp_battlelose, NULL);
|
||||
|
|
89
src/p_user.c
89
src/p_user.c
|
@ -1136,53 +1136,26 @@ void P_RestoreMusic(player_t *player)
|
|||
S_SpeedMusic(1.0f);
|
||||
|
||||
// SRB2kart - We have some different powers than vanilla, some of which tweak the music.
|
||||
// Event - Race Start
|
||||
// Event - Level Start
|
||||
if (leveltime < (starttime + (TICRATE/2)))
|
||||
S_ChangeMusicInternal("kstart", false); //S_StopMusic();
|
||||
// Item - Grow
|
||||
else if (player->kartstuff[k_growshrinktimer] > 1 && player->playerstate == PST_LIVE)
|
||||
S_ChangeMusicInternal("kgrow", true);
|
||||
// Item - Invincibility
|
||||
else if (player->kartstuff[k_invincibilitytimer] > 1 && player->playerstate == PST_LIVE)
|
||||
S_ChangeMusicInternal("kinvnc", false);
|
||||
else
|
||||
{
|
||||
// Event - Battle Finish
|
||||
if (G_BattleGametype() && player->exiting)
|
||||
{
|
||||
if (!splitscreen)
|
||||
{
|
||||
INT32 pos = 1;
|
||||
UINT8 i;
|
||||
|
||||
for (i = 0; i < MAXPLAYERS; i++) // Calculate position to ensure what music to play
|
||||
{
|
||||
if (!playeringame[i] || players[i].spectator)
|
||||
continue;
|
||||
if (players[i].kartstuff[k_bumper] > player->kartstuff[k_bumper])
|
||||
pos++;
|
||||
else if (players[i].score > player->score)
|
||||
pos++;
|
||||
}
|
||||
|
||||
if (pos == 1)
|
||||
S_ChangeMusicInternal("kbwin", false);
|
||||
else if (pos <= 3)
|
||||
S_ChangeMusicInternal("kbok", false);
|
||||
else
|
||||
S_ChangeMusicInternal("kblose", false);
|
||||
}
|
||||
else
|
||||
S_ChangeMusicInternal("kbok", false);
|
||||
}
|
||||
// Event - Race Finish
|
||||
else if (splitscreen && G_RaceGametype()
|
||||
&& (players[consoleplayer].exiting
|
||||
// Event - Level Finish
|
||||
if (splitscreen
|
||||
&& (players[displayplayer].exiting
|
||||
|| players[secondarydisplayplayer].exiting
|
||||
|| players[thirddisplayplayer].exiting
|
||||
|| players[fourthdisplayplayer].exiting))
|
||||
{
|
||||
if (G_RaceGametype())
|
||||
S_ChangeMusicInternal("krok", true);
|
||||
else if (!splitscreen && G_RaceGametype() && player->exiting)
|
||||
else if (G_BattleGametype())
|
||||
S_ChangeMusicInternal("kbok", false);
|
||||
}
|
||||
else if (!splitscreen && player->exiting)
|
||||
{
|
||||
if (G_RaceGametype())
|
||||
{
|
||||
if (player->kartstuff[k_position] == 1)
|
||||
S_ChangeMusicInternal("krwin", true);
|
||||
|
@ -1191,6 +1164,22 @@ void P_RestoreMusic(player_t *player)
|
|||
else
|
||||
S_ChangeMusicInternal("krok", true);
|
||||
}
|
||||
else if (G_BattleGametype())
|
||||
{
|
||||
if (player->kartstuff[k_position] == 1)
|
||||
S_ChangeMusicInternal("kbwin", false);
|
||||
else if (K_IsPlayerLosing(player))
|
||||
S_ChangeMusicInternal("kblose", false);
|
||||
else
|
||||
S_ChangeMusicInternal("kbok", false);
|
||||
}
|
||||
}
|
||||
// Item - Grow
|
||||
else if (player->kartstuff[k_growshrinktimer] > 1 && player->playerstate == PST_LIVE)
|
||||
S_ChangeMusicInternal("kgrow", true);
|
||||
// Item - Invincibility
|
||||
else if (player->kartstuff[k_invincibilitytimer] > 1 && player->playerstate == PST_LIVE)
|
||||
S_ChangeMusicInternal("kinvnc", false);
|
||||
else
|
||||
{
|
||||
// Event - Final Lap
|
||||
|
@ -1694,7 +1683,6 @@ void P_DoPlayerExit(player_t *player)
|
|||
else if (!countdown)
|
||||
countdown = cv_countdowntime.value*TICRATE + 1; // Use cv_countdowntime
|
||||
|
||||
|
||||
if (K_IsPlayerLosing(player))
|
||||
S_StartSound(player->mo, sfx_klose);
|
||||
else
|
||||
|
@ -1734,25 +1722,12 @@ void P_DoPlayerExit(player_t *player)
|
|||
{
|
||||
if (!splitscreen)
|
||||
{
|
||||
INT32 pos = 1;
|
||||
UINT8 i;
|
||||
|
||||
for (i = 0; i < MAXPLAYERS; i++) // Calculate position to ensure what music to play
|
||||
{
|
||||
if (!playeringame[i] || players[i].spectator)
|
||||
continue;
|
||||
if (players[i].kartstuff[k_bumper] > player->kartstuff[k_bumper])
|
||||
pos++;
|
||||
else if (players[i].score > player->score)
|
||||
pos++;
|
||||
}
|
||||
|
||||
if (pos == 1)
|
||||
if (player->kartstuff[k_position] == 1)
|
||||
S_ChangeMusicInternal("kbwin", false);
|
||||
else if (pos <= 3)
|
||||
S_ChangeMusicInternal("kbok", false);
|
||||
else
|
||||
else if (K_IsPlayerLosing(player))
|
||||
S_ChangeMusicInternal("kblose", false);
|
||||
else
|
||||
S_ChangeMusicInternal("kbok", false);
|
||||
}
|
||||
else
|
||||
S_ChangeMusicInternal("kbok", false);
|
||||
|
|
Loading…
Reference in a new issue