mirror of
https://github.com/YGGverse/xash3d-fwgs.git
synced 2025-01-29 16:24:16 +00:00
engine: server: sv_init: enabled handling sound resources specifically
This is for timely precaching on client side. Otherwise, files are being downloaded to client, but not precached immediatly after it, and therefore causing a late precaching of sound (obvious, this is bad)
This commit is contained in:
parent
714b4f45e4
commit
a03019f5e4
@ -276,9 +276,17 @@ model_t *SV_ModelHandle( int modelindex )
|
|||||||
return sv.models[modelindex];
|
return sv.models[modelindex];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static resourcetype_t SV_DetermineResourceType( const char *filename )
|
||||||
|
{
|
||||||
|
if( !Q_strncmp( filename, "sound/", 6 ) && Sound_SupportedFileFormat( COM_FileExtension( filename )))
|
||||||
|
return t_sound;
|
||||||
|
else
|
||||||
|
return t_generic;
|
||||||
|
}
|
||||||
|
|
||||||
void SV_ReadResourceList( const char *filename )
|
void SV_ReadResourceList( const char *filename )
|
||||||
{
|
{
|
||||||
string token;
|
string token;
|
||||||
byte *afile;
|
byte *afile;
|
||||||
char *pfile;
|
char *pfile;
|
||||||
|
|
||||||
@ -295,8 +303,23 @@ void SV_ReadResourceList( const char *filename )
|
|||||||
if( !COM_IsSafeFileToDownload( token ))
|
if( !COM_IsSafeFileToDownload( token ))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
Con_DPrintf( " %s\n", token );
|
COM_FixSlashes( token );
|
||||||
SV_GenericIndex( token );
|
resourcetype_t restype = SV_DetermineResourceType( token );
|
||||||
|
Con_DPrintf( " %s (%s)\n", token, COM_GetResourceTypeName( restype ));
|
||||||
|
switch( restype )
|
||||||
|
{
|
||||||
|
// TODO do we need to handle other resource types specifically too?
|
||||||
|
case t_sound:
|
||||||
|
{
|
||||||
|
const char *filepath = token;
|
||||||
|
filepath += 6; // skip "sound/" part
|
||||||
|
SV_SoundIndex( filepath );
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
SV_GenericIndex( token );
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Con_DPrintf( "----------------------------------\n" );
|
Con_DPrintf( "----------------------------------\n" );
|
||||||
|
Loading…
x
Reference in New Issue
Block a user