Browse Source

Remove some strange code.

hltopdown
Andrey Akhmichin 5 years ago
parent
commit
f6135287e6
  1. 30
      dlls/sound.cpp

30
dlls/sound.cpp

@ -1037,9 +1037,8 @@ void USENTENCEG_InitLRU( unsigned char *plru, int count )
int USENTENCEG_PickSequential( int isentenceg, char *szfound, int ipick, int freset ) int USENTENCEG_PickSequential( int isentenceg, char *szfound, int ipick, int freset )
{ {
char *szgroupname; const char *szgroupname;
unsigned char count; unsigned char count;
char sznum[8];
if( !fSentencesInit ) if( !fSentencesInit )
return -1; return -1;
@ -1056,10 +1055,7 @@ int USENTENCEG_PickSequential( int isentenceg, char *szfound, int ipick, int fre
if( ipick >= count ) if( ipick >= count )
ipick = count - 1; ipick = count - 1;
strcpy( szfound, "!" ); sprintf( szfound, "!%s%d", szgroupname, ipick );
strcat( szfound, szgroupname );
sprintf( sznum, "%d", ipick );
strcat( szfound, sznum );
if( ipick >= count ) if( ipick >= count )
{ {
@ -1083,11 +1079,10 @@ int USENTENCEG_PickSequential( int isentenceg, char *szfound, int ipick, int fre
int USENTENCEG_Pick( int isentenceg, char *szfound ) int USENTENCEG_Pick( int isentenceg, char *szfound )
{ {
char *szgroupname; const char *szgroupname;
unsigned char *plru; unsigned char *plru;
unsigned char i; unsigned char i;
unsigned char count; unsigned char count;
char sznum[8];
unsigned char ipick; unsigned char ipick;
int ffound = FALSE; int ffound = FALSE;
@ -1116,10 +1111,8 @@ int USENTENCEG_Pick( int isentenceg, char *szfound )
USENTENCEG_InitLRU( plru, count ); USENTENCEG_InitLRU( plru, count );
else else
{ {
strcpy( szfound, "!" ); sprintf( szfound, "!%s%d", szgroupname, ipick );
strcat( szfound, szgroupname );
sprintf( sznum, "%d", ipick );
strcat( szfound, sznum );
return ipick; return ipick;
} }
} }
@ -1227,7 +1220,6 @@ int SENTENCEG_PlaySequentialSz( edict_t *entity, const char *szgroupname, float
void SENTENCEG_Stop( edict_t *entity, int isentenceg, int ipick ) void SENTENCEG_Stop( edict_t *entity, int isentenceg, int ipick )
{ {
char buffer[64]; char buffer[64];
char sznum[8];
if( !fSentencesInit ) if( !fSentencesInit )
return; return;
@ -1235,10 +1227,7 @@ void SENTENCEG_Stop( edict_t *entity, int isentenceg, int ipick )
if( isentenceg < 0 || ipick < 0 ) if( isentenceg < 0 || ipick < 0 )
return; return;
strcpy( buffer, "!" ); sprintf( buffer, "!%s%d", rgsentenceg[isentenceg].szgroupname, ipick );
strcat( buffer, rgsentenceg[isentenceg].szgroupname );
sprintf( sznum, "%d", ipick );
strcat( buffer, sznum );
STOP_SOUND( entity, CHAN_VOICE, buffer ); STOP_SOUND( entity, CHAN_VOICE, buffer );
} }
@ -1369,9 +1358,8 @@ void SENTENCEG_Init()
int SENTENCEG_Lookup( const char *sample, char *sentencenum ) int SENTENCEG_Lookup( const char *sample, char *sentencenum )
{ {
char sznum[8];
int i; int i;
// this is a sentence name; lookup sentence number // this is a sentence name; lookup sentence number
// and give to engine as string. // and give to engine as string.
for( i = 0; i < gcallsentences; i++ ) for( i = 0; i < gcallsentences; i++ )
@ -1379,9 +1367,7 @@ int SENTENCEG_Lookup( const char *sample, char *sentencenum )
{ {
if( sentencenum ) if( sentencenum )
{ {
strcpy( sentencenum, "!" ); sprintf(sentencenum, "!%d", i);
sprintf( sznum, "%d", i );
strcat( sentencenum, sznum );
} }
return i; return i;
} }

Loading…
Cancel
Save