Browse Source

engine: s_mouth: fix another signed char

pull/2/head
Alibek Omarov 5 years ago
parent
commit
13c1e807ad
  1. 14
      engine/client/s_mouth.c

14
engine/client/s_mouth.c

@ -57,7 +57,7 @@ void SND_CloseMouth( channel_t *ch )
void SND_MoveMouth8( channel_t *ch, wavdata_t *pSource, int count ) void SND_MoveMouth8( channel_t *ch, wavdata_t *pSource, int count )
{ {
cl_entity_t *clientEntity; cl_entity_t *clientEntity;
char *pdata = NULL; signed char *pdata = NULL;
mouth_t *pMouth = NULL; mouth_t *pMouth = NULL;
int scount, pos = 0; int scount, pos = 0;
int savg, data; int savg, data;
@ -77,7 +77,7 @@ void SND_MoveMouth8( channel_t *ch, wavdata_t *pSource, int count )
count = S_GetOutputData( pSource, (void**)&pdata, pos, count, ch->use_loop ); count = S_GetOutputData( pSource, (void**)&pdata, pos, count, ch->use_loop );
if( pdata == NULL ) return; if( pdata == NULL ) return;
i = 0; i = 0;
scount = pMouth->sndcount; scount = pMouth->sndcount;
savg = 0; savg = 0;
@ -85,7 +85,7 @@ void SND_MoveMouth8( channel_t *ch, wavdata_t *pSource, int count )
while( i < count && scount < CAVGSAMPLES ) while( i < count && scount < CAVGSAMPLES )
{ {
data = pdata[i]; data = pdata[i];
savg += abs( data ); savg += abs( data );
i += 80 + ((byte)data & 0x1F); i += 80 + ((byte)data & 0x1F);
scount++; scount++;
@ -94,7 +94,7 @@ void SND_MoveMouth8( channel_t *ch, wavdata_t *pSource, int count )
pMouth->sndavg += savg; pMouth->sndavg += savg;
pMouth->sndcount = (byte)scount; pMouth->sndcount = (byte)scount;
if( pMouth->sndcount >= CAVGSAMPLES ) if( pMouth->sndcount >= CAVGSAMPLES )
{ {
pMouth->mouthopen = pMouth->sndavg / CAVGSAMPLES; pMouth->mouthopen = pMouth->sndavg / CAVGSAMPLES;
pMouth->sndavg = 0; pMouth->sndavg = 0;
@ -125,7 +125,7 @@ void SND_MoveMouth16( channel_t *ch, wavdata_t *pSource, int count )
count = S_GetOutputData( pSource, (void**)&pdata, pos, count, ch->use_loop ); count = S_GetOutputData( pSource, (void**)&pdata, pos, count, ch->use_loop );
if( pdata == NULL ) return; if( pdata == NULL ) return;
i = 0; i = 0;
scount = pMouth->sndcount; scount = pMouth->sndcount;
savg = 0; savg = 0;
@ -134,7 +134,7 @@ void SND_MoveMouth16( channel_t *ch, wavdata_t *pSource, int count )
{ {
data = pdata[i]; data = pdata[i];
data = (bound( -32767, data, 0x7ffe ) >> 8); data = (bound( -32767, data, 0x7ffe ) >> 8);
savg += abs( data ); savg += abs( data );
i += 80 + ((byte)data & 0x1F); i += 80 + ((byte)data & 0x1F);
scount++; scount++;
@ -143,7 +143,7 @@ void SND_MoveMouth16( channel_t *ch, wavdata_t *pSource, int count )
pMouth->sndavg += savg; pMouth->sndavg += savg;
pMouth->sndcount = (byte)scount; pMouth->sndcount = (byte)scount;
if( pMouth->sndcount >= CAVGSAMPLES ) if( pMouth->sndcount >= CAVGSAMPLES )
{ {
pMouth->mouthopen = pMouth->sndavg / CAVGSAMPLES; pMouth->mouthopen = pMouth->sndavg / CAVGSAMPLES;
pMouth->sndavg = 0; pMouth->sndavg = 0;

Loading…
Cancel
Save