Browse Source

lowmemory: fix sentences

pull/2/head
mittorn 5 years ago
parent
commit
37cba10c14
  1. 4
      engine/client/cl_parse.c
  2. 6
      engine/common/protocol.h
  3. 4
      engine/server/sv_game.c

4
engine/client/cl_parse.c

@ -92,7 +92,7 @@ void CL_ParseSoundPacket( sizebuf_t *msg )
char sentenceName[32]; char sentenceName[32];
if( FBitSet( flags, SND_SEQUENCE )) if( FBitSet( flags, SND_SEQUENCE ))
Q_snprintf( sentenceName, sizeof( sentenceName ), "!#%i", sound + MAX_SOUNDS ); Q_snprintf( sentenceName, sizeof( sentenceName ), "!#%i", sound + MAX_SOUNDS_NONSENTENCE );
else Q_snprintf( sentenceName, sizeof( sentenceName ), "!%i", sound ); else Q_snprintf( sentenceName, sizeof( sentenceName ), "!%i", sound );
handle = S_RegisterSound( sentenceName ); handle = S_RegisterSound( sentenceName );
@ -156,7 +156,7 @@ void CL_ParseRestoreSoundPacket( sizebuf_t *msg )
char sentenceName[32]; char sentenceName[32];
if( flags & SND_SEQUENCE ) if( flags & SND_SEQUENCE )
Q_snprintf( sentenceName, sizeof( sentenceName ), "!%i", sound + MAX_SOUNDS ); Q_snprintf( sentenceName, sizeof( sentenceName ), "!%i", sound + MAX_SOUNDS_NONSENTENCE );
else Q_snprintf( sentenceName, sizeof( sentenceName ), "!%i", sound ); else Q_snprintf( sentenceName, sizeof( sentenceName ), "!%i", sound );
handle = S_RegisterSound( sentenceName ); handle = S_RegisterSound( sentenceName );

6
engine/common/protocol.h

@ -119,6 +119,7 @@ GNU General Public License for more details.
#define MAX_SOUND_BITS 11 #define MAX_SOUND_BITS 11
#define MAX_SOUNDS (1<<MAX_SOUND_BITS) // 11 bits == 2048 sounds #define MAX_SOUNDS (1<<MAX_SOUND_BITS) // 11 bits == 2048 sounds
#define MAX_SOUNDS_NONSENTENCE MAX_SOUNDS
#define MAX_ENTITY_BITS 13 // 13 bits = 8192 edicts #define MAX_ENTITY_BITS 13 // 13 bits = 8192 edicts
#define MAX_EDICTS (1<<MAX_ENTITY_BITS) #define MAX_EDICTS (1<<MAX_ENTITY_BITS)
@ -147,8 +148,9 @@ GNU General Public License for more details.
#define MAX_MODELS 256 #define MAX_MODELS 256
#define MAX_SOUND_BITS 8
#define MAX_SOUNDS (1<<MAX_SOUND_BITS) // 11 bits == 2048 sounds #define MAX_SOUNDS 512 // do not change MAX_SOUND_BITS
#define MAX_SOUNDS_NONSENTENCE 2048
#define MAX_CUSTOM_BITS 4 #define MAX_CUSTOM_BITS 4
#define MAX_CUSTOM (1<<MAX_CUSTOM_BITS)// 10 bits == 1024 generic file #define MAX_CUSTOM (1<<MAX_CUSTOM_BITS)// 10 bits == 1024 generic file

4
engine/server/sv_game.c

@ -2042,10 +2042,10 @@ int SV_BuildSoundMsg( sizebuf_t *msg, edict_t *ent, int chan, const char *sample
{ {
sound_idx = Q_atoi( sample + 1 ); sound_idx = Q_atoi( sample + 1 );
if( sound_idx >= MAX_SOUNDS ) if( sound_idx >= MAX_SOUNDS_NONSENTENCE )
{ {
SetBits( flags, SND_SENTENCE|SND_SEQUENCE ); SetBits( flags, SND_SENTENCE|SND_SEQUENCE );
sound_idx -= MAX_SOUNDS; sound_idx -= MAX_SOUNDS_NONSENTENCE;
} }
else SetBits( flags, SND_SENTENCE ); else SetBits( flags, SND_SENTENCE );
} }

Loading…
Cancel
Save