From: TimePath Date: Tue, 17 Nov 2015 08:28:31 +0000 (+1100) Subject: Playersounds: fix volume X-Git-Tag: xonotic-v0.8.2~1653^2~2 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=0c7361d8b53fde11f3979eeabbaaff9002e97864;p=xonotic%2Fxonotic-data.pk3dir.git Playersounds: fix volume --- diff --git a/qcsrc/common/effects/qc/globalsound.qc b/qcsrc/common/effects/qc/globalsound.qc index d29c18a60..df0cbc575 100644 --- a/qcsrc/common/effects/qc/globalsound.qc +++ b/qcsrc/common/effects/qc/globalsound.qc @@ -67,6 +67,7 @@ float r = ReadByte() / 255; string sample = GlobalSound_sample(gs.m_globalsoundstr, r); int who = ReadByte(); + entity e = entcs_receiver[who - 1]; int chan = ReadByte(); float vol = ReadByte() / 255; float atten = ReadByte() / 64; @@ -74,10 +75,11 @@ o.x = ReadCoord(); o.y = ReadCoord(); o.z = ReadCoord(); - if (who == player_currententnum) + // TODO: is this really what we want to be doing? Footsteps that follow the player at head height? + if (who == player_currententnum) e = findfloat(world, entnum, who); // play at camera position for full volume + else if (e) e.origin = o; + if (e) { - // client knows better, play at current position to unlag - entity e = findfloat(world, entnum, who); sound7(e, chan, sample, vol, atten, 0, 0); } else @@ -94,8 +96,8 @@ { entity ps = PlayerSounds_from(ReadByte()); float r = ReadByte() / 255; - int who = ReadByte() - 1; - entity e = entcs_receiver[who]; + int who = ReadByte(); + entity e = entcs_receiver[who - 1]; UpdatePlayerSounds(e); string s = e.(ps.m_playersoundfld); string sample = GlobalSound_sample(s, r); @@ -106,16 +108,17 @@ o.x = ReadCoord(); o.y = ReadCoord(); o.z = ReadCoord(); + if (who == player_currententnum) e = findfloat(world, entnum, who); // play at camera position for full volume + else if (e) e.origin = o; if (e) { // TODO: for non-visible players, origin should probably continue to be updated as long as the sound is playing - e.origin = o; sound7(e, chan, sample, vol, atten, 0, 0); } else { - LOG_WARNINGF("Missing entcs data for player %d\n", who); - // Can this happen? + LOG_WARNINGF("Missing entcs data for player %d\n", who); + // Can this happen? entity e = new(playersound); e.origin = o; sound8(e, o, chan, sample, vol, atten, 0, 0);