mirror of
https://git.do.srb2.org/KartKrew/Kart-Public.git
synced 2025-02-20 19:02:37 +00:00
Engine tweak
This commit is contained in:
parent
6a0b1526b9
commit
c4d1b80e97
1 changed files with 13 additions and 22 deletions
35
src/k_kart.c
35
src/k_kart.c
|
@ -3690,31 +3690,22 @@ static void K_UpdateEngineSounds(player_t *player, ticcmd_t *cmd)
|
|||
if (player->kartstuff[k_enginesnd] > 12)
|
||||
player->kartstuff[k_enginesnd] = 12;
|
||||
|
||||
// Display player's engines are quieter
|
||||
if ((player == &players[displayplayer])
|
||||
|| (player == &players[secondarydisplayplayer] && splitscreen)
|
||||
|| (player == &players[thirddisplayplayer] && splitscreen > 1)
|
||||
|| (player == &players[fourthdisplayplayer] && splitscreen > 2))
|
||||
volume = FixedDiv(volume<<FRACBITS, FixedSqrt(((splitscreen+1)*3)<<FRACBITS))>>FRACBITS;
|
||||
else
|
||||
for (i = 0; i < MAXPLAYERS; i++)
|
||||
{
|
||||
for (i = 0; i < MAXPLAYERS; i++)
|
||||
{
|
||||
if (!playeringame[i] || !players[i].mo || players[i].spectator || players[i].exiting)
|
||||
continue;
|
||||
if ((i == displayplayer)
|
||||
|| (i == secondarydisplayplayer && splitscreen)
|
||||
|| (i == thirddisplayplayer && splitscreen > 1)
|
||||
|| (i == fourthdisplayplayer && splitscreen > 2))
|
||||
continue;
|
||||
if (P_AproxDistance(P_AproxDistance(player->mo->x-players[i].mo->x,
|
||||
player->mo->y-players[i].mo->y), player->mo->z-players[i].mo->z) <= 3072<<FRACBITS) // engine sounds' approx. range
|
||||
numcloseplayers++;
|
||||
}
|
||||
if (numcloseplayers > 1)
|
||||
volume = FixedDiv(volume<<FRACBITS, FixedSqrt(numcloseplayers<<FRACBITS))>>FRACBITS;
|
||||
if (!playeringame[i] || !players[i].mo || players[i].spectator || players[i].exiting)
|
||||
continue;
|
||||
if (((i == displayplayer)
|
||||
|| (i == secondarydisplayplayer && splitscreen)
|
||||
|| (i == thirddisplayplayer && splitscreen > 1)
|
||||
|| (i == fourthdisplayplayer && splitscreen > 2))
|
||||
|| (P_AproxDistance(P_AproxDistance(player->mo->x-players[i].mo->x,
|
||||
player->mo->y-players[i].mo->y), player->mo->z-players[i].mo->z) <= 3072<<FRACBITS)) // engine sounds' approx. range
|
||||
numcloseplayers++;
|
||||
}
|
||||
|
||||
if (numcloseplayers > 1)
|
||||
volume /= numcloseplayers;
|
||||
|
||||
S_StartSoundAtVolume(player->mo, (sfx_krta00 + player->kartstuff[k_enginesnd]) + (class*numsnds), volume);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue