diff --git a/engine/client/cl_debug.c b/engine/client/cl_debug.c index 1016b0ff..1e728d92 100644 --- a/engine/client/cl_debug.c +++ b/engine/client/cl_debug.c @@ -50,7 +50,7 @@ const char *CL_MsgInfo( int cmd ) // get engine message name const char *svc_string = NULL; - switch( cls.legacymode ) + switch( cls.net_protocol ) { case PROTO_CURRENT: svc_string = svc_strings[cmd]; @@ -146,7 +146,7 @@ static void CL_WriteErrorMessage( int current_count, sizebuf_t *msg ) FS_Write( fp, &cls.starting_count, sizeof( int )); FS_Write( fp, ¤t_count, sizeof( int )); - FS_Write( fp, &cls.legacymode, sizeof( cls.legacymode )); + FS_Write( fp, &cls.net_protocol, sizeof( cls.net_protocol )); FS_Write( fp, MSG_GetData( msg ), MSG_GetMaxBytes( msg )); FS_Close( fp ); @@ -207,7 +207,7 @@ void CL_ReplayBufferDat_f( void ) FS_Read( f, ¤t_count, sizeof( current_count )); FS_Read( f, &protocol, sizeof( protocol )); - cls.legacymode = protocol; + cls.net_protocol = protocol; len = FS_Read( f, buffer, sizeof( buffer )); FS_Close( f ); diff --git a/engine/client/cl_demo.c b/engine/client/cl_demo.c index c7d3c3c8..e1c46ca3 100644 --- a/engine/client/cl_demo.c +++ b/engine/client/cl_demo.c @@ -412,7 +412,7 @@ static void CL_WriteDemoHeader( const char *name ) demo.header.id = IDEMOHEADER; demo.header.dem_protocol = DEMO_PROTOCOL; - demo.header.net_protocol = CL_GetDemoNetProtocol( cls.legacymode ); + demo.header.net_protocol = CL_GetDemoNetProtocol( cls.net_protocol ); demo.header.host_fps = host_maxfps.value ? bound( MIN_FPS, host_maxfps.value, maxfps ) : maxfps; Q_strncpy( demo.header.mapname, clgame.mapname, sizeof( demo.header.mapname )); Q_strncpy( demo.header.comment, clgame.maptitle, sizeof( demo.header.comment )); @@ -723,7 +723,7 @@ static void CL_DemoStartPlayback( int mode ) demo.starttime = CL_GetDemoPlaybackClock(); // for determining whether to read another message - CL_SetupNetchanForProtocol( cls.legacymode ); + CL_SetupNetchanForProtocol( cls.net_protocol ); memset( demo.cmds, 0, sizeof( demo.cmds )); demo.angle_position = 1; @@ -1555,7 +1555,7 @@ void CL_PlayDemo_f( void ) if( neg ) cls.forcetrack = -cls.forcetrack; CL_DemoStartPlayback( DEMO_QUAKE1 ); - cls.legacymode = PROTO_QUAKE; + cls.net_protocol = PROTO_QUAKE; return; // quake demo is started } @@ -1591,7 +1591,7 @@ void CL_PlayDemo_f( void ) CL_DemoStartPlayback( DEMO_XASH3D ); // must be after DemoStartPlayback, as CL_Disconnect_f resets the protocol - cls.legacymode = CL_GetProtocolFromDemo( demo.header.net_protocol ); + cls.net_protocol = CL_GetProtocolFromDemo( demo.header.net_protocol ); // g-cont. is this need? Q_strncpy( cls.servername, demoname, sizeof( cls.servername )); diff --git a/engine/client/cl_main.c b/engine/client/cl_main.c index 34bcca7a..c33a20b0 100644 --- a/engine/client/cl_main.c +++ b/engine/client/cl_main.c @@ -171,7 +171,7 @@ int CL_IsDevOverviewMode( void ) connprotocol_t CL_Protocol( void ) { - return cls.legacymode; + return cls.net_protocol; } void CL_SetCheatState( qboolean multiplayer, qboolean allow_cheats ) @@ -235,7 +235,7 @@ static void CL_CreateResourceList( void ) Cvar_DirectSet( &cl_logoext, "bmp" ); Q_snprintf( szFileName, sizeof( szFileName ), "logos/remapped.%s", cl_logoext.string ); - if( cls.legacymode == PROTO_GOLDSRC ) + if( cls.net_protocol == PROTO_GOLDSRC ) { CL_ConvertImageToWAD3( szFileName ); Q_strncpy( szFileName, "tempdecal.wad", sizeof( szFileName )); @@ -335,7 +335,7 @@ static void CL_CheckClientState( void ) Cvar_SetValue( "scr_loading", 0.0f ); // reset progress bar Netchan_ReportFlow( &cls.netchan ); - if( cls.legacymode == PROTO_GOLDSRC ) + if( cls.net_protocol == PROTO_GOLDSRC ) { CL_ServerCommand(true, "specmode 4\n"); CL_ServerCommand(true, "specmode 4\n"); @@ -868,7 +868,7 @@ static void CL_WritePacket( void ) byte data[MAX_CMD_BUFFER] = { 0 }; runcmd_t *pcmd; int numbackup, maxbackup, maxcmds; - const connprotocol_t proto = cls.legacymode; + const connprotocol_t proto = cls.net_protocol; // FIXME: on Xash protocol we don't send move commands until ca_active // to prevent outgoing_command outrun incoming_acknowledged @@ -1374,7 +1374,7 @@ static void CL_CheckForResend( void ) cls.state = ca_connecting; Q_strncpy( cls.servername, "localhost", sizeof( cls.servername )); NET_NetadrSetType( &cls.serveradr, NA_LOOPBACK ); - cls.legacymode = PROTO_CURRENT; + cls.net_protocol = PROTO_CURRENT; // we don't need a challenge on the localhost CL_SendConnectPacket( PROTO_CURRENT, 0 ); @@ -1449,7 +1449,7 @@ static void CL_CheckForResend( void ) // but tell us that test is allowed // in this case, just send connect packet and hope for the best if( cls.bandwidth_test.passed || cls.bandwidth_test.failed ) - CL_SendConnectPacket( cls.legacymode, cls.bandwidth_test.challenge ); + CL_SendConnectPacket( cls.net_protocol, cls.bandwidth_test.challenge ); else CL_SendBandwidthTest( adr, false ); } @@ -1512,7 +1512,7 @@ static void CL_Connect_f( void ) Key_SetKeyDest( key_console ); cls.state = ca_connecting; - cls.legacymode = proto; + cls.net_protocol = proto; Q_strncpy( cls.servername, server, sizeof( cls.servername )); cls.connect_time = MAX_HEARTBEAT; // CL_CheckForResend() will fire immediately cls.max_fragment_size = FRAGMENT_MAX_SIZE; // guess a we can establish connection with maximum fragment size @@ -1717,7 +1717,7 @@ static void CL_Reconnect( qboolean setup_netchan ) { if( setup_netchan ) { - CL_SetupNetchanForProtocol( cls.legacymode ); + CL_SetupNetchanForProtocol( cls.net_protocol ); } else { @@ -1762,7 +1762,7 @@ void CL_Disconnect( void ) CL_Stop_f(); // send a disconnect message to the server - CL_SendDisconnectMessage( cls.legacymode ); + CL_SendDisconnectMessage( cls.net_protocol ); SteamBroker_TerminateGameConnection(); CL_ClearState (); @@ -1780,7 +1780,7 @@ void CL_Disconnect( void ) cls.connect_retry = 0; memset( &cls.bandwidth_test, 0, sizeof( cls.bandwidth_test )); cls.signon = 0; - cls.legacymode = PROTO_CURRENT; + cls.net_protocol = PROTO_CURRENT; // back to menu in non-developer mode if( host_developer.value || cls.key_dest == key_menu ) @@ -1808,7 +1808,7 @@ void CL_Crashed( void ) CL_Stop_f(); // stop any demos // send a disconnect message to the server - CL_SendDisconnectMessage( cls.legacymode ); + CL_SendDisconnectMessage( cls.net_protocol ); Host_WriteOpenGLConfig(); Host_WriteConfig(); // write config @@ -1914,7 +1914,7 @@ static void CL_Reconnect_f( void ) if( !COM_StringEmptyOrNULL( cls.servername )) { - connprotocol_t proto = cls.legacymode; + connprotocol_t proto = cls.net_protocol; if( cls.state >= ca_connected ) CL_Disconnect(); @@ -1923,7 +1923,7 @@ static void CL_Reconnect_f( void ) cls.demonum = cls.movienum = -1; // not in the demo loop now cls.state = ca_connecting; cls.signon = 0; - cls.legacymode = proto; // don't change protocol + cls.net_protocol = proto; // don't change protocol Con_Printf( "reconnecting...\n" ); } @@ -2511,7 +2511,7 @@ static void CL_Challenge( const char *c, netadr_t from ) // try to autodetect protocol by challenge response if( !Q_strcmp( c, S2C_GOLDSRC_CHALLENGE )) { - cls.legacymode = PROTO_GOLDSRC; + cls.net_protocol = PROTO_GOLDSRC; cls.steam_auth = Q_atoi( Cmd_Argv( 2 )) == 3; @@ -2527,14 +2527,14 @@ static void CL_Challenge( const char *c, netadr_t from ) cls.bandwidth_test.challenge = Q_atoi( Cmd_Argv( 1 )); - if( cls.legacymode == PROTO_CURRENT && cl_test_bandwidth.value && !cls.bandwidth_test.passed ) + if( cls.net_protocol == PROTO_CURRENT && cl_test_bandwidth.value && !cls.bandwidth_test.passed ) { // when connecting to old server or server that has bandwidth test disabled // it might be more preferrable to have some sane fragment size if( !Q_atoi( Cmd_Argv( 2 ))) { Cvar_SetValue( "cl_dlmax", FRAGMENT_DEFAULT_SIZE ); - CL_SendConnectPacket( cls.legacymode, cls.bandwidth_test.challenge ); + CL_SendConnectPacket( cls.net_protocol, cls.bandwidth_test.challenge ); } else { @@ -2544,7 +2544,7 @@ static void CL_Challenge( const char *c, netadr_t from ) else { // challenge from the server we are connecting to - CL_SendConnectPacket( cls.legacymode, cls.bandwidth_test.challenge ); + CL_SendConnectPacket( cls.net_protocol, cls.bandwidth_test.challenge ); } } @@ -2689,7 +2689,7 @@ static void CL_ConnectionlessPacket( netadr_t from, sizebuf_t *msg ) // server connection if( !Q_strcmp( c, S2C_GOLDSRC_CONNECTION ) || !Q_strcmp( c, S2C_CONNECTION )) { - CL_ClientConnect( cls.legacymode, c, from ); + CL_ClientConnect( cls.net_protocol, c, from ); } else if( !Q_strcmp( c, A2A_INFO )) { @@ -2809,7 +2809,7 @@ static void CL_ReadNetMessage( void ) size_t curSize; void (*parsefn)( sizebuf_t *msg ); - switch( cls.legacymode ) + switch( cls.net_protocol ) { case PROTO_QUAKE: parsefn = CL_ParseQuakeMessage; @@ -3105,7 +3105,7 @@ void CL_ProcessFile( qboolean successfully_received, const char *filename ) MSG_Init( &msg, "Resource Registration", msg_buf, sizeof( msg_buf )); if( CL_PrecacheResources( )) - CL_RegisterResources( &msg, cls.legacymode ); + CL_RegisterResources( &msg, cls.net_protocol ); if( MSG_GetNumBytesWritten( &msg ) > 0 ) { @@ -3165,7 +3165,7 @@ tell server about changed userinfo */ void CL_UpdateInfo( const char *key, const char *value ) { - switch( cls.legacymode ) + switch( cls.net_protocol ) { case PROTO_GOLDSRC: if( cl_advertise_engine_in_name.value && !Q_stricmp( key, "name" ) && Q_strnicmp( value, "[Xash3D]", 8 )) diff --git a/engine/client/client.h b/engine/client/client.h index fdcb685b..39a73f62 100644 --- a/engine/client/client.h +++ b/engine/client/client.h @@ -647,7 +647,7 @@ typedef struct string internetservers_customfilter; // multiprotocol support - connprotocol_t legacymode; + connprotocol_t net_protocol; int extensions; netadr_t serveradr; diff --git a/engine/client/parse/cl_parse.c b/engine/client/parse/cl_parse.c index 77fe1d8e..f14ae2bf 100644 --- a/engine/client/parse/cl_parse.c +++ b/engine/client/parse/cl_parse.c @@ -469,7 +469,7 @@ void CL_BatchResourceRequest( qboolean initialize ) { if( done_downloading && CL_PrecacheResources( )) { - CL_RegisterResources( &msg, cls.legacymode ); + CL_RegisterResources( &msg, cls.net_protocol ); } Netchan_CreateFragments( &cls.netchan, &msg );