Use pitchadj as a % instead, its slightly more intuitive.

git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3622 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
Spoike 2010-11-06 23:54:36 +00:00
parent 2dbf289fc4
commit 84a5466ce7
4 changed files with 9 additions and 7 deletions

View File

@ -3464,9 +3464,9 @@ void CLNQ_ParseStartSoundPacket(void)
attenuation = DEFAULT_SOUND_PACKET_ATTENUATION;
if (field_mask & FTESND_PITCHADJ)
pitchadj = MSG_ReadChar();
pitchadj = MSG_ReadByte();
else
pitchadj = 0;
pitchadj = 100;
if (field_mask & DPSND_LARGEENTITY)
{

View File

@ -880,6 +880,8 @@ void S_StartSoundCard(soundcardinfo_t *sc, int entnum, int entchannel, sfx_t *sf
#endif
vol = fvol*255;
if (!pitchadj)
pitchadj = 100;
// pick a channel to play on
target_chan = SND_PickChannel(sc, entnum, entchannel);
@ -919,7 +921,7 @@ void S_StartSoundCard(soundcardinfo_t *sc, int entnum, int entchannel, sfx_t *sf
startpos = scache->length - snd_speed*10;
}
target_chan->sfx = sfx;
target_chan->rate = (1<<PITCHSHIFT) + pitchadj;
target_chan->rate = ((1<<PITCHSHIFT) * pitchadj) / 100;
target_chan->pos = startpos*target_chan->rate;
target_chan->end = sc->paintedtime + ((scache->length - startpos)<<PITCHSHIFT)/target_chan->rate;
target_chan->looping = false;

View File

@ -603,7 +603,7 @@ enum clcq2_ops_e
#define DPSND_LOOPING (1<<2) // a long, supposedly
#define DPSND_LARGEENTITY (1<<3)
#define DPSND_LARGESOUND (1<<4)
#define FTESND_PITCHADJ (1<<7) //a char (final rate is (1<<8)+pitch as 24.8 fixed point)
#define FTESND_PITCHADJ (1<<7) //a byte (speed percent (0=100%))
#define DEFAULT_SOUND_PACKET_VOLUME 255
#define DEFAULT_SOUND_PACKET_ATTENUATION 1.0

View File

@ -857,7 +857,7 @@ void SV_StartSound (int ent, vec3_t origin, int seenmask, int channel, char *sam
extfield_mask |= DPSND_LARGEENTITY;
if (sound_num > 0xff)
extfield_mask |= DPSND_LARGESOUND;
if (pitchadj)
if (pitchadj && (pitchadj != 100))
extfield_mask |= FTESND_PITCHADJ;
#ifdef PEXT_SOUNDDBL
@ -871,7 +871,7 @@ void SV_StartSound (int ent, vec3_t origin, int seenmask, int channel, char *sam
if (extfield_mask & NQSND_ATTENUATION)
MSG_WriteByte (&sv.multicast, attenuation*64);
if (extfield_mask & FTESND_PITCHADJ)
MSG_WriteChar (&sv.multicast, pitchadj);
MSG_WriteByte (&sv.multicast, pitchadj);
if (extfield_mask & DPSND_LARGEENTITY)
{
MSG_WriteShort (&sv.multicast, ent);
@ -926,7 +926,7 @@ void SV_StartSound (int ent, vec3_t origin, int seenmask, int channel, char *sam
if (extfield_mask & NQSND_ATTENUATION)
MSG_WriteByte (&sv.nqmulticast, attenuation*64);
if (extfield_mask & FTESND_PITCHADJ)
MSG_WriteChar (&sv.nqmulticast, pitchadj);
MSG_WriteByte (&sv.nqmulticast, pitchadj);
if (extfield_mask & DPSND_LARGEENTITY)
{
MSG_WriteShort (&sv.nqmulticast, ent);