Skip to content

Commit

Permalink
Fix underwater breathing sounds playing when standing in shallow water
Browse files Browse the repository at this point in the history
halflife issue #3110
  • Loading branch information
Solokiller committed Jun 4, 2021
1 parent 570da84 commit c2902f8
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions dlls/player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1137,15 +1137,18 @@ void CBasePlayer::WaterMove()

// make bubbles

air = (int)(pev->air_finished - gpGlobals->time);
if (!RANDOM_LONG(0,0x1f) && RANDOM_LONG(0,AIRTIME-1) >= air)
if (pev->waterlevel == 3)
{
switch (RANDOM_LONG(0,3))
air = (int)(pev->air_finished - gpGlobals->time);
if (!RANDOM_LONG(0, 0x1f) && RANDOM_LONG(0, AIRTIME - 1) >= air)
{
switch (RANDOM_LONG(0, 3))
{
case 0: EMIT_SOUND(ENT(pev), CHAN_BODY, "player/pl_swim1.wav", 0.8, ATTN_NORM); break;
case 1: EMIT_SOUND(ENT(pev), CHAN_BODY, "player/pl_swim2.wav", 0.8, ATTN_NORM); break;
case 2: EMIT_SOUND(ENT(pev), CHAN_BODY, "player/pl_swim3.wav", 0.8, ATTN_NORM); break;
case 3: EMIT_SOUND(ENT(pev), CHAN_BODY, "player/pl_swim4.wav", 0.8, ATTN_NORM); break;
}
}
}

Expand Down

0 comments on commit c2902f8

Please sign in to comment.