mirror of
https://github.com/FWGS/xash3d-fwgs.git
synced 2026-08-05 03:24:56 +08:00
engine: client: s/cls.legacymode/cls.net_protocol/g
This commit is contained in:
@@ -50,7 +50,7 @@ const char *CL_MsgInfo( int cmd )
|
|||||||
// get engine message name
|
// get engine message name
|
||||||
const char *svc_string = NULL;
|
const char *svc_string = NULL;
|
||||||
|
|
||||||
switch( cls.legacymode )
|
switch( cls.net_protocol )
|
||||||
{
|
{
|
||||||
case PROTO_CURRENT:
|
case PROTO_CURRENT:
|
||||||
svc_string = svc_strings[cmd];
|
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, &cls.starting_count, sizeof( int ));
|
||||||
FS_Write( fp, ¤t_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_Write( fp, MSG_GetData( msg ), MSG_GetMaxBytes( msg ));
|
||||||
FS_Close( fp );
|
FS_Close( fp );
|
||||||
|
|
||||||
@@ -207,7 +207,7 @@ void CL_ReplayBufferDat_f( void )
|
|||||||
FS_Read( f, ¤t_count, sizeof( current_count ));
|
FS_Read( f, ¤t_count, sizeof( current_count ));
|
||||||
FS_Read( f, &protocol, sizeof( protocol ));
|
FS_Read( f, &protocol, sizeof( protocol ));
|
||||||
|
|
||||||
cls.legacymode = protocol;
|
cls.net_protocol = protocol;
|
||||||
|
|
||||||
len = FS_Read( f, buffer, sizeof( buffer ));
|
len = FS_Read( f, buffer, sizeof( buffer ));
|
||||||
FS_Close( f );
|
FS_Close( f );
|
||||||
|
|||||||
@@ -412,7 +412,7 @@ static void CL_WriteDemoHeader( const char *name )
|
|||||||
|
|
||||||
demo.header.id = IDEMOHEADER;
|
demo.header.id = IDEMOHEADER;
|
||||||
demo.header.dem_protocol = DEMO_PROTOCOL;
|
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;
|
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.mapname, clgame.mapname, sizeof( demo.header.mapname ));
|
||||||
Q_strncpy( demo.header.comment, clgame.maptitle, sizeof( demo.header.comment ));
|
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
|
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 ));
|
memset( demo.cmds, 0, sizeof( demo.cmds ));
|
||||||
demo.angle_position = 1;
|
demo.angle_position = 1;
|
||||||
@@ -1555,7 +1555,7 @@ void CL_PlayDemo_f( void )
|
|||||||
|
|
||||||
if( neg ) cls.forcetrack = -cls.forcetrack;
|
if( neg ) cls.forcetrack = -cls.forcetrack;
|
||||||
CL_DemoStartPlayback( DEMO_QUAKE1 );
|
CL_DemoStartPlayback( DEMO_QUAKE1 );
|
||||||
cls.legacymode = PROTO_QUAKE;
|
cls.net_protocol = PROTO_QUAKE;
|
||||||
return; // quake demo is started
|
return; // quake demo is started
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1591,7 +1591,7 @@ void CL_PlayDemo_f( void )
|
|||||||
CL_DemoStartPlayback( DEMO_XASH3D );
|
CL_DemoStartPlayback( DEMO_XASH3D );
|
||||||
|
|
||||||
// must be after DemoStartPlayback, as CL_Disconnect_f resets the protocol
|
// 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?
|
// g-cont. is this need?
|
||||||
Q_strncpy( cls.servername, demoname, sizeof( cls.servername ));
|
Q_strncpy( cls.servername, demoname, sizeof( cls.servername ));
|
||||||
|
|||||||
@@ -171,7 +171,7 @@ int CL_IsDevOverviewMode( void )
|
|||||||
|
|
||||||
connprotocol_t CL_Protocol( void )
|
connprotocol_t CL_Protocol( void )
|
||||||
{
|
{
|
||||||
return cls.legacymode;
|
return cls.net_protocol;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CL_SetCheatState( qboolean multiplayer, qboolean allow_cheats )
|
void CL_SetCheatState( qboolean multiplayer, qboolean allow_cheats )
|
||||||
@@ -235,7 +235,7 @@ static void CL_CreateResourceList( void )
|
|||||||
Cvar_DirectSet( &cl_logoext, "bmp" );
|
Cvar_DirectSet( &cl_logoext, "bmp" );
|
||||||
|
|
||||||
Q_snprintf( szFileName, sizeof( szFileName ), "logos/remapped.%s", cl_logoext.string );
|
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 );
|
CL_ConvertImageToWAD3( szFileName );
|
||||||
Q_strncpy( szFileName, "tempdecal.wad", sizeof( 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
|
Cvar_SetValue( "scr_loading", 0.0f ); // reset progress bar
|
||||||
Netchan_ReportFlow( &cls.netchan );
|
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");
|
||||||
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 };
|
byte data[MAX_CMD_BUFFER] = { 0 };
|
||||||
runcmd_t *pcmd;
|
runcmd_t *pcmd;
|
||||||
int numbackup, maxbackup, maxcmds;
|
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
|
// FIXME: on Xash protocol we don't send move commands until ca_active
|
||||||
// to prevent outgoing_command outrun incoming_acknowledged
|
// to prevent outgoing_command outrun incoming_acknowledged
|
||||||
@@ -1374,7 +1374,7 @@ static void CL_CheckForResend( void )
|
|||||||
cls.state = ca_connecting;
|
cls.state = ca_connecting;
|
||||||
Q_strncpy( cls.servername, "localhost", sizeof( cls.servername ));
|
Q_strncpy( cls.servername, "localhost", sizeof( cls.servername ));
|
||||||
NET_NetadrSetType( &cls.serveradr, NA_LOOPBACK );
|
NET_NetadrSetType( &cls.serveradr, NA_LOOPBACK );
|
||||||
cls.legacymode = PROTO_CURRENT;
|
cls.net_protocol = PROTO_CURRENT;
|
||||||
|
|
||||||
// we don't need a challenge on the localhost
|
// we don't need a challenge on the localhost
|
||||||
CL_SendConnectPacket( PROTO_CURRENT, 0 );
|
CL_SendConnectPacket( PROTO_CURRENT, 0 );
|
||||||
@@ -1449,7 +1449,7 @@ static void CL_CheckForResend( void )
|
|||||||
// but tell us that test is allowed
|
// but tell us that test is allowed
|
||||||
// in this case, just send connect packet and hope for the best
|
// in this case, just send connect packet and hope for the best
|
||||||
if( cls.bandwidth_test.passed || cls.bandwidth_test.failed )
|
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
|
else
|
||||||
CL_SendBandwidthTest( adr, false );
|
CL_SendBandwidthTest( adr, false );
|
||||||
}
|
}
|
||||||
@@ -1512,7 +1512,7 @@ static void CL_Connect_f( void )
|
|||||||
Key_SetKeyDest( key_console );
|
Key_SetKeyDest( key_console );
|
||||||
|
|
||||||
cls.state = ca_connecting;
|
cls.state = ca_connecting;
|
||||||
cls.legacymode = proto;
|
cls.net_protocol = proto;
|
||||||
Q_strncpy( cls.servername, server, sizeof( cls.servername ));
|
Q_strncpy( cls.servername, server, sizeof( cls.servername ));
|
||||||
cls.connect_time = MAX_HEARTBEAT; // CL_CheckForResend() will fire immediately
|
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
|
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 )
|
if( setup_netchan )
|
||||||
{
|
{
|
||||||
CL_SetupNetchanForProtocol( cls.legacymode );
|
CL_SetupNetchanForProtocol( cls.net_protocol );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -1762,7 +1762,7 @@ void CL_Disconnect( void )
|
|||||||
CL_Stop_f();
|
CL_Stop_f();
|
||||||
|
|
||||||
// send a disconnect message to the server
|
// send a disconnect message to the server
|
||||||
CL_SendDisconnectMessage( cls.legacymode );
|
CL_SendDisconnectMessage( cls.net_protocol );
|
||||||
SteamBroker_TerminateGameConnection();
|
SteamBroker_TerminateGameConnection();
|
||||||
CL_ClearState ();
|
CL_ClearState ();
|
||||||
|
|
||||||
@@ -1780,7 +1780,7 @@ void CL_Disconnect( void )
|
|||||||
cls.connect_retry = 0;
|
cls.connect_retry = 0;
|
||||||
memset( &cls.bandwidth_test, 0, sizeof( cls.bandwidth_test ));
|
memset( &cls.bandwidth_test, 0, sizeof( cls.bandwidth_test ));
|
||||||
cls.signon = 0;
|
cls.signon = 0;
|
||||||
cls.legacymode = PROTO_CURRENT;
|
cls.net_protocol = PROTO_CURRENT;
|
||||||
|
|
||||||
// back to menu in non-developer mode
|
// back to menu in non-developer mode
|
||||||
if( host_developer.value || cls.key_dest == key_menu )
|
if( host_developer.value || cls.key_dest == key_menu )
|
||||||
@@ -1808,7 +1808,7 @@ void CL_Crashed( void )
|
|||||||
CL_Stop_f(); // stop any demos
|
CL_Stop_f(); // stop any demos
|
||||||
|
|
||||||
// send a disconnect message to the server
|
// send a disconnect message to the server
|
||||||
CL_SendDisconnectMessage( cls.legacymode );
|
CL_SendDisconnectMessage( cls.net_protocol );
|
||||||
|
|
||||||
Host_WriteOpenGLConfig();
|
Host_WriteOpenGLConfig();
|
||||||
Host_WriteConfig(); // write config
|
Host_WriteConfig(); // write config
|
||||||
@@ -1914,7 +1914,7 @@ static void CL_Reconnect_f( void )
|
|||||||
|
|
||||||
if( !COM_StringEmptyOrNULL( cls.servername ))
|
if( !COM_StringEmptyOrNULL( cls.servername ))
|
||||||
{
|
{
|
||||||
connprotocol_t proto = cls.legacymode;
|
connprotocol_t proto = cls.net_protocol;
|
||||||
|
|
||||||
if( cls.state >= ca_connected )
|
if( cls.state >= ca_connected )
|
||||||
CL_Disconnect();
|
CL_Disconnect();
|
||||||
@@ -1923,7 +1923,7 @@ static void CL_Reconnect_f( void )
|
|||||||
cls.demonum = cls.movienum = -1; // not in the demo loop now
|
cls.demonum = cls.movienum = -1; // not in the demo loop now
|
||||||
cls.state = ca_connecting;
|
cls.state = ca_connecting;
|
||||||
cls.signon = 0;
|
cls.signon = 0;
|
||||||
cls.legacymode = proto; // don't change protocol
|
cls.net_protocol = proto; // don't change protocol
|
||||||
|
|
||||||
Con_Printf( "reconnecting...\n" );
|
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
|
// try to autodetect protocol by challenge response
|
||||||
if( !Q_strcmp( c, S2C_GOLDSRC_CHALLENGE ))
|
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;
|
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 ));
|
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
|
// when connecting to old server or server that has bandwidth test disabled
|
||||||
// it might be more preferrable to have some sane fragment size
|
// it might be more preferrable to have some sane fragment size
|
||||||
if( !Q_atoi( Cmd_Argv( 2 )))
|
if( !Q_atoi( Cmd_Argv( 2 )))
|
||||||
{
|
{
|
||||||
Cvar_SetValue( "cl_dlmax", FRAGMENT_DEFAULT_SIZE );
|
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
|
else
|
||||||
{
|
{
|
||||||
@@ -2544,7 +2544,7 @@ static void CL_Challenge( const char *c, netadr_t from )
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
// challenge from the server we are connecting to
|
// 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
|
// server connection
|
||||||
if( !Q_strcmp( c, S2C_GOLDSRC_CONNECTION ) || !Q_strcmp( c, S2C_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 ))
|
else if( !Q_strcmp( c, A2A_INFO ))
|
||||||
{
|
{
|
||||||
@@ -2809,7 +2809,7 @@ static void CL_ReadNetMessage( void )
|
|||||||
size_t curSize;
|
size_t curSize;
|
||||||
void (*parsefn)( sizebuf_t *msg );
|
void (*parsefn)( sizebuf_t *msg );
|
||||||
|
|
||||||
switch( cls.legacymode )
|
switch( cls.net_protocol )
|
||||||
{
|
{
|
||||||
case PROTO_QUAKE:
|
case PROTO_QUAKE:
|
||||||
parsefn = CL_ParseQuakeMessage;
|
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 ));
|
MSG_Init( &msg, "Resource Registration", msg_buf, sizeof( msg_buf ));
|
||||||
|
|
||||||
if( CL_PrecacheResources( ))
|
if( CL_PrecacheResources( ))
|
||||||
CL_RegisterResources( &msg, cls.legacymode );
|
CL_RegisterResources( &msg, cls.net_protocol );
|
||||||
|
|
||||||
if( MSG_GetNumBytesWritten( &msg ) > 0 )
|
if( MSG_GetNumBytesWritten( &msg ) > 0 )
|
||||||
{
|
{
|
||||||
@@ -3165,7 +3165,7 @@ tell server about changed userinfo
|
|||||||
*/
|
*/
|
||||||
void CL_UpdateInfo( const char *key, const char *value )
|
void CL_UpdateInfo( const char *key, const char *value )
|
||||||
{
|
{
|
||||||
switch( cls.legacymode )
|
switch( cls.net_protocol )
|
||||||
{
|
{
|
||||||
case PROTO_GOLDSRC:
|
case PROTO_GOLDSRC:
|
||||||
if( cl_advertise_engine_in_name.value && !Q_stricmp( key, "name" ) && Q_strnicmp( value, "[Xash3D]", 8 ))
|
if( cl_advertise_engine_in_name.value && !Q_stricmp( key, "name" ) && Q_strnicmp( value, "[Xash3D]", 8 ))
|
||||||
|
|||||||
@@ -647,7 +647,7 @@ typedef struct
|
|||||||
string internetservers_customfilter;
|
string internetservers_customfilter;
|
||||||
|
|
||||||
// multiprotocol support
|
// multiprotocol support
|
||||||
connprotocol_t legacymode;
|
connprotocol_t net_protocol;
|
||||||
int extensions;
|
int extensions;
|
||||||
|
|
||||||
netadr_t serveradr;
|
netadr_t serveradr;
|
||||||
|
|||||||
@@ -469,7 +469,7 @@ void CL_BatchResourceRequest( qboolean initialize )
|
|||||||
{
|
{
|
||||||
if( done_downloading && CL_PrecacheResources( ))
|
if( done_downloading && CL_PrecacheResources( ))
|
||||||
{
|
{
|
||||||
CL_RegisterResources( &msg, cls.legacymode );
|
CL_RegisterResources( &msg, cls.net_protocol );
|
||||||
}
|
}
|
||||||
|
|
||||||
Netchan_CreateFragments( &cls.netchan, &msg );
|
Netchan_CreateFragments( &cls.netchan, &msg );
|
||||||
|
|||||||
Reference in New Issue
Block a user