mirror of
https://git.do.srb2.org/KartKrew/Kart-Public.git
synced 2025-02-07 08:51:40 +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++)
|
for (i = 0; i < MAXPLAYERS; i++)
|
||||||
{
|
{
|
||||||
if (playeringame[i] && !players[i].spectator)
|
if (!playeringame[i] || players[i].spectator)
|
||||||
pcount++;
|
continue;
|
||||||
|
if (players[i].kartstuff[k_position] > pcount)
|
||||||
|
pcount = players[i].kartstuff[k_position];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pcount <= 1)
|
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"));
|
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]);
|
P_DoPlayerExit(&players[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5298,7 +5303,7 @@ static void K_drawBattleFullscreen(void)
|
||||||
{
|
{
|
||||||
if (stplyr == &players[displayplayer])
|
if (stplyr == &players[displayplayer])
|
||||||
V_DrawFadeScreen(0xFF00, 16);
|
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);
|
V_DrawFixedPatch(x<<FRACBITS, y<<FRACBITS, scale, splitflags, kp_battlewin, NULL);
|
||||||
else if (splitscreen < 2)
|
else if (splitscreen < 2)
|
||||||
V_DrawFixedPatch(x<<FRACBITS, y<<FRACBITS, scale, splitflags, kp_battlelose, NULL);
|
V_DrawFixedPatch(x<<FRACBITS, y<<FRACBITS, scale, splitflags, kp_battlelose, NULL);
|
||||||
|
|
101
src/p_user.c
101
src/p_user.c
|
@ -1136,61 +1136,50 @@ void P_RestoreMusic(player_t *player)
|
||||||
S_SpeedMusic(1.0f);
|
S_SpeedMusic(1.0f);
|
||||||
|
|
||||||
// SRB2kart - We have some different powers than vanilla, some of which tweak the music.
|
// 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)))
|
if (leveltime < (starttime + (TICRATE/2)))
|
||||||
S_ChangeMusicInternal("kstart", false); //S_StopMusic();
|
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
|
else
|
||||||
{
|
{
|
||||||
// Event - Battle Finish
|
// Event - Level Finish
|
||||||
if (G_BattleGametype() && player->exiting)
|
if (splitscreen
|
||||||
{
|
&& (players[displayplayer].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
|
|
||||||
|| players[secondarydisplayplayer].exiting
|
|| players[secondarydisplayplayer].exiting
|
||||||
|| players[thirddisplayplayer].exiting
|
|| players[thirddisplayplayer].exiting
|
||||||
|| players[fourthdisplayplayer].exiting))
|
|| players[fourthdisplayplayer].exiting))
|
||||||
S_ChangeMusicInternal("krok", true);
|
|
||||||
else if (!splitscreen && G_RaceGametype() && player->exiting)
|
|
||||||
{
|
{
|
||||||
if (player->kartstuff[k_position] == 1)
|
if (G_RaceGametype())
|
||||||
S_ChangeMusicInternal("krwin", true);
|
|
||||||
else if (K_IsPlayerLosing(player))
|
|
||||||
S_ChangeMusicInternal("krlose", true);
|
|
||||||
else
|
|
||||||
S_ChangeMusicInternal("krok", true);
|
S_ChangeMusicInternal("krok", true);
|
||||||
|
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);
|
||||||
|
else if (K_IsPlayerLosing(player))
|
||||||
|
S_ChangeMusicInternal("krlose", true);
|
||||||
|
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
|
else
|
||||||
{
|
{
|
||||||
// Event - Final Lap
|
// Event - Final Lap
|
||||||
|
@ -1694,7 +1683,6 @@ void P_DoPlayerExit(player_t *player)
|
||||||
else if (!countdown)
|
else if (!countdown)
|
||||||
countdown = cv_countdowntime.value*TICRATE + 1; // Use cv_countdowntime
|
countdown = cv_countdowntime.value*TICRATE + 1; // Use cv_countdowntime
|
||||||
|
|
||||||
|
|
||||||
if (K_IsPlayerLosing(player))
|
if (K_IsPlayerLosing(player))
|
||||||
S_StartSound(player->mo, sfx_klose);
|
S_StartSound(player->mo, sfx_klose);
|
||||||
else
|
else
|
||||||
|
@ -1734,25 +1722,12 @@ void P_DoPlayerExit(player_t *player)
|
||||||
{
|
{
|
||||||
if (!splitscreen)
|
if (!splitscreen)
|
||||||
{
|
{
|
||||||
INT32 pos = 1;
|
if (player->kartstuff[k_position] == 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);
|
S_ChangeMusicInternal("kbwin", false);
|
||||||
else if (pos <= 3)
|
else if (K_IsPlayerLosing(player))
|
||||||
S_ChangeMusicInternal("kbok", false);
|
|
||||||
else
|
|
||||||
S_ChangeMusicInternal("kblose", false);
|
S_ChangeMusicInternal("kblose", false);
|
||||||
|
else
|
||||||
|
S_ChangeMusicInternal("kbok", false);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
S_ChangeMusicInternal("kbok", false);
|
S_ChangeMusicInternal("kbok", false);
|
||||||
|
|
Loading…
Reference in a new issue