diff --git a/engine/client/cl_main.c b/engine/client/cl_main.c index c2486c65..56824244 100644 --- a/engine/client/cl_main.c +++ b/engine/client/cl_main.c @@ -76,6 +76,7 @@ static CVAR_DEFINE_AUTO( cl_upmax, "1200", FCVAR_ARCHIVE, "max allowed incoming CVAR_DEFINE_AUTO( cl_lw, "1", FCVAR_ARCHIVE|FCVAR_USERINFO, "enable client weapon predicting" ); CVAR_DEFINE_AUTO( cl_charset, "utf-8", FCVAR_ARCHIVE, "1-byte charset to use (iconv style)" ); +CVAR_DEFINE_AUTO( cl_trace_consistency, "0", FCVAR_ARCHIVE, "enable consistency info tracing (good for developers)" ); CVAR_DEFINE_AUTO( cl_trace_stufftext, "0", FCVAR_ARCHIVE, "enable stufftext (server-to-client console commands) tracing (good for developers)" ); CVAR_DEFINE_AUTO( cl_trace_messages, "0", FCVAR_ARCHIVE|FCVAR_CHEAT, "enable message names tracing (good for developers)" ); CVAR_DEFINE_AUTO( cl_trace_events, "0", FCVAR_ARCHIVE|FCVAR_CHEAT, "enable events tracing (good for developers)" ); @@ -3393,6 +3394,7 @@ static void CL_InitLocal( void ) Cvar_RegisterVariable( &rcon_address ); + Cvar_RegisterVariable( &cl_trace_consistency ); Cvar_RegisterVariable( &cl_trace_stufftext ); Cvar_RegisterVariable( &cl_trace_messages ); Cvar_RegisterVariable( &cl_trace_events ); diff --git a/engine/client/cl_parse.c b/engine/client/cl_parse.c index 9d3bc3cc..75b43f0e 100644 --- a/engine/client/cl_parse.c +++ b/engine/client/cl_parse.c @@ -1614,6 +1614,23 @@ void CL_UpdateUserPings( sizebuf_t *msg ) } } +static const char *CL_CheckTypeToString( int check_type ) +{ + // renamed so they have same width and look better in console output + switch( check_type ) + { + case force_exactfile: + return "exactfile"; + case force_model_samebounds: + return "samebounds"; + case force_model_specifybounds: + return "specbounds"; + case force_model_specifybounds_if_avail: + return "specbounds2"; + } + return "unknown"; +} + static void CL_SendConsistencyInfo( sizebuf_t *msg, connprotocol_t proto ) { qboolean user_changed_diskfile; @@ -1879,6 +1896,9 @@ static void CL_ParseConsistencyInfo( sizebuf_t *msg, connprotocol_t proto ) return; } + if( cl_trace_consistency.value ) + Con_Printf( "Server wants consistency of the following resources:\n" ); + skip_crc_change = NULL; lastcheck = 0; @@ -1910,7 +1930,7 @@ static void CL_ParseConsistencyInfo( sizebuf_t *msg, connprotocol_t proto ) pc = &cl.consistency_list[cl.num_consistency]; cl.num_consistency++; - memset( pc, 0, sizeof( consistency_t )); + memset( pc, 0, sizeof( *pc )); pc->filename = pResource->szFileName; pc->issound = (pResource->type == t_sound); pc->orig_index = delta; @@ -1923,6 +1943,9 @@ static void CL_ParseConsistencyInfo( sizebuf_t *msg, connprotocol_t proto ) pc->check_type = pResource->rguc_reserved[0]; } + if( cl_trace_consistency.value ) + Con_Printf( "%s\t%s\t%s\n", COM_ResourceTypeFromIndex( pResource->type ), CL_CheckTypeToString( pc->check_type ), pc->filename ); + skip_crc_change = pResource; lastcheck = delta; } diff --git a/engine/client/client.h b/engine/client/client.h index 22cedd24..9a56e89a 100644 --- a/engine/client/client.h +++ b/engine/client/client.h @@ -688,6 +688,7 @@ extern convar_t r_showtextures; extern convar_t cl_bmodelinterp; extern convar_t cl_lw; // local weapons extern convar_t cl_charset; +extern convar_t cl_trace_consistency; extern convar_t cl_trace_stufftext; extern convar_t cl_trace_messages; extern convar_t cl_trace_events; diff --git a/engine/common/common.h b/engine/common/common.h index b808b9f4..50c918f9 100644 --- a/engine/common/common.h +++ b/engine/common/common.h @@ -685,6 +685,7 @@ int CSCR_WriteGameCVars( file_t *cfg, const char *scriptfilename ); // // hpak.c // +const char *COM_ResourceTypeFromIndex( int index ); void HPAK_Init( void ); qboolean HPAK_GetDataPointer( const char *filename, struct resource_s *pRes, byte **buffer, int *size ); qboolean HPAK_ResourceForHash( const char *filename, byte *hash, struct resource_s *pRes ); diff --git a/engine/common/hpak.c b/engine/common/hpak.c index d5d4b3f6..0d268093 100644 --- a/engine/common/hpak.c +++ b/engine/common/hpak.c @@ -38,7 +38,7 @@ static void HPAK_MaxSize_f( void ) Con_Printf( S_ERROR "hpk_maxsize is deprecated, use hpk_max_size\n" ); } -static const char *HPAK_TypeFromIndex( int type ) +const char *COM_ResourceTypeFromIndex( int type ) { switch( type ) { @@ -461,7 +461,7 @@ static qboolean HPAK_Validate( const char *filename, qboolean quiet, qboolean de if( !quiet ) { - Con_Printf( "%i: %s %s %s: ", i, HPAK_TypeFromIndex( pRes->type ), + Con_Printf( "%i: %s %s %s: ", i, COM_ResourceTypeFromIndex( pRes->type ), Q_pretifymem( pRes->nDownloadSize, 2 ), pRes->szFileName ); } @@ -942,7 +942,7 @@ static void HPAK_List_f( void ) { entry = &directory.entries[nCurrent]; COM_FileBase( entry->resource.szFileName, lumpname, sizeof( lumpname )); - type = HPAK_TypeFromIndex( entry->resource.type ); + type = COM_ResourceTypeFromIndex( entry->resource.type ); size = Q_memprint( entry->resource.nDownloadSize ); Con_Printf( "%i: %10s %s %s\n : %s\n", nCurrent + 1, type, size, lumpname, MD5_Print( entry->resource.rgucMD5_hash )); @@ -1037,7 +1037,7 @@ static void HPAK_Extract_f( void ) continue; COM_FileBase( entry->resource.szFileName, lumpname, sizeof( lumpname ) ); - type = HPAK_TypeFromIndex( entry->resource.type ); + type = COM_ResourceTypeFromIndex( entry->resource.type ); size = Q_memprint( entry->resource.nDownloadSize ); Con_Printf( "Extracting %i: %10s %s %s\n", nCurrent + 1, type, size, lumpname );