mirror of
https://github.com/FWGS/xash3d-fwgs
synced 2024-11-22 09:56:22 +01:00
engine: client: reduce reads of cls.legacymode
This commit is contained in:
parent
0d4296e0e1
commit
8452bec877
@ -681,7 +681,8 @@ static void CL_CreateCmd( void )
|
|||||||
void CL_WriteUsercmd( sizebuf_t *msg, int from, int to )
|
void CL_WriteUsercmd( sizebuf_t *msg, int from, int to )
|
||||||
{
|
{
|
||||||
const usercmd_t nullcmd = { 0 };
|
const usercmd_t nullcmd = { 0 };
|
||||||
usercmd_t *f, *t;
|
const usercmd_t *f;
|
||||||
|
usercmd_t *t;
|
||||||
|
|
||||||
Assert( from == -1 || ( from >= 0 && from < MULTIPLAYER_BACKUP ));
|
Assert( from == -1 || ( from >= 0 && from < MULTIPLAYER_BACKUP ));
|
||||||
Assert( to >= 0 && to < MULTIPLAYER_BACKUP );
|
Assert( to >= 0 && to < MULTIPLAYER_BACKUP );
|
||||||
@ -717,8 +718,8 @@ static void CL_WritePacket( void )
|
|||||||
qboolean send_command = false;
|
qboolean send_command = false;
|
||||||
byte data[MAX_CMD_BUFFER];
|
byte data[MAX_CMD_BUFFER];
|
||||||
int i, from, to, key, size;
|
int i, from, to, key, size;
|
||||||
int numbackup = 2;
|
int numbackup = 2, maxbackup;
|
||||||
int numcmds;
|
int numcmds, maxcmds;
|
||||||
int newcmds;
|
int newcmds;
|
||||||
int cmdnumber;
|
int cmdnumber;
|
||||||
|
|
||||||
@ -732,25 +733,32 @@ static void CL_WritePacket( void )
|
|||||||
MSG_Init( &buf, "ClientData", data, sizeof( data ));
|
MSG_Init( &buf, "ClientData", data, sizeof( data ));
|
||||||
|
|
||||||
// Determine number of backup commands to send along
|
// Determine number of backup commands to send along
|
||||||
if( cls.legacymode == PROTO_GOLDSRC )
|
switch( cls.legacymode )
|
||||||
numbackup = bound( 0, cl_cmdbackup.value, MAX_GOLDSRC_BACKUP_CMDS );
|
{
|
||||||
else if( cls.legacymode == PROTO_LEGACY )
|
case PROTO_GOLDSRC:
|
||||||
numbackup = bound( 0, cl_cmdbackup.value, MAX_LEGACY_BACKUP_CMDS );
|
maxbackup = MAX_GOLDSRC_BACKUP_CMDS;
|
||||||
else
|
maxcmds = MAX_GOLDSRC_TOTAL_CMDS;
|
||||||
numbackup = bound( 0, cl_cmdbackup.value, MAX_BACKUP_COMMANDS );
|
break;
|
||||||
|
case PROTO_LEGACY:
|
||||||
|
maxbackup = MAX_LEGACY_BACKUP_CMDS;
|
||||||
|
maxcmds = MAX_LEGACY_TOTAL_CMDS;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
maxbackup = MAX_BACKUP_COMMANDS;
|
||||||
|
maxcmds = MAX_TOTAL_CMDS;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
numbackup = bound( 0, cl_cmdbackup.value, maxbackup );
|
||||||
|
|
||||||
if( cls.state == ca_connected )
|
if( cls.state == ca_connected )
|
||||||
numbackup = 0;
|
numbackup = 0;
|
||||||
|
|
||||||
// clamp cmdrate
|
// clamp cmdrate
|
||||||
if( cl_cmdrate.value < 10.0f )
|
if( cl_cmdrate.value < 10.0f )
|
||||||
{
|
|
||||||
Cvar_DirectSet( &cl_cmdrate, "10" );
|
Cvar_DirectSet( &cl_cmdrate, "10" );
|
||||||
}
|
|
||||||
else if( cl_cmdrate.value > 100.0f )
|
else if( cl_cmdrate.value > 100.0f )
|
||||||
{
|
|
||||||
Cvar_DirectSet( &cl_cmdrate, "100" );
|
Cvar_DirectSet( &cl_cmdrate, "100" );
|
||||||
}
|
|
||||||
|
|
||||||
// Check to see if we can actually send this command
|
// Check to see if we can actually send this command
|
||||||
|
|
||||||
@ -823,12 +831,7 @@ static void CL_WritePacket( void )
|
|||||||
newcmds = ( cls.netchan.outgoing_sequence - cls.lastoutgoingcommand );
|
newcmds = ( cls.netchan.outgoing_sequence - cls.lastoutgoingcommand );
|
||||||
|
|
||||||
// put an upper/lower bound on this
|
// put an upper/lower bound on this
|
||||||
if( cls.legacymode == PROTO_GOLDSRC )
|
newcmds = bound( 0, newcmds, maxcmds );
|
||||||
newcmds = bound( 0, newcmds, MAX_GOLDSRC_TOTAL_CMDS );
|
|
||||||
else if( cls.legacymode == PROTO_LEGACY )
|
|
||||||
newcmds = bound( 0, newcmds, MAX_LEGACY_TOTAL_CMDS );
|
|
||||||
else
|
|
||||||
newcmds = bound( 0, newcmds, MAX_TOTAL_CMDS );
|
|
||||||
|
|
||||||
if( cls.state == ca_connected )
|
if( cls.state == ca_connected )
|
||||||
newcmds = 0;
|
newcmds = 0;
|
||||||
@ -1597,26 +1600,24 @@ static void CL_Reconnect( qboolean setup_netchan )
|
|||||||
{
|
{
|
||||||
uint flags = 0;
|
uint flags = 0;
|
||||||
|
|
||||||
if( cls.legacymode == PROTO_GOLDSRC )
|
switch( cls.legacymode )
|
||||||
{
|
{
|
||||||
|
case PROTO_GOLDSRC:
|
||||||
SetBits( flags, NETCHAN_USE_MUNGE | NETCHAN_USE_BZIP2 | NETCHAN_GOLDSRC );
|
SetBits( flags, NETCHAN_USE_MUNGE | NETCHAN_USE_BZIP2 | NETCHAN_GOLDSRC );
|
||||||
}
|
break;
|
||||||
else if( cls.legacymode == PROTO_LEGACY )
|
case PROTO_LEGACY:
|
||||||
{
|
if( FBitSet( Q_atoi( Cmd_Argv( 1 )), NET_LEGACY_EXT_SPLIT ))
|
||||||
unsigned int extensions = Q_atoi( Cmd_Argv( 1 ) );
|
|
||||||
|
|
||||||
if( FBitSet( extensions, NET_LEGACY_EXT_SPLIT ))
|
|
||||||
{
|
{
|
||||||
SetBits( flags, NETCHAN_USE_LEGACY_SPLIT );
|
SetBits( flags, NETCHAN_USE_LEGACY_SPLIT );
|
||||||
Con_Reportf( "^2NET_EXT_SPLIT enabled^7 (packet sizes is %d/%d)\n", (int)cl_dlmax.value, 65536 );
|
Con_Reportf( "^2NET_EXT_SPLIT enabled^7 (packet sizes is %d/%d)\n", (int)cl_dlmax.value, 65536 );
|
||||||
}
|
}
|
||||||
}
|
break;
|
||||||
else
|
default:
|
||||||
{
|
|
||||||
cls.extensions = Q_atoi( Info_ValueForKey( Cmd_Argv( 1 ), "ext" ));
|
cls.extensions = Q_atoi( Info_ValueForKey( Cmd_Argv( 1 ), "ext" ));
|
||||||
|
|
||||||
if( FBitSet( cls.extensions, NET_EXT_SPLITSIZE ))
|
if( FBitSet( cls.extensions, NET_EXT_SPLITSIZE ))
|
||||||
Con_Reportf( "^2NET_EXT_SPLITSIZE enabled^7 (packet size is %d)\n", (int)cl_dlmax.value );
|
Con_Reportf( "^2NET_EXT_SPLITSIZE enabled^7 (packet size is %d)\n", (int)cl_dlmax.value );
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
Netchan_Setup( NS_CLIENT, &cls.netchan, net_from, Cvar_VariableInteger( "net_qport" ), NULL, CL_GetFragmentSize, flags );
|
Netchan_Setup( NS_CLIENT, &cls.netchan, net_from, Cvar_VariableInteger( "net_qport" ), NULL, CL_GetFragmentSize, flags );
|
||||||
@ -2350,6 +2351,8 @@ static void CL_ConnectionlessPacket( netadr_t from, sizebuf_t *msg )
|
|||||||
// in case we're in console or it's classic mainui which doesn't support messageboxes
|
// in case we're in console or it's classic mainui which doesn't support messageboxes
|
||||||
if( !UI_IsVisible() || !UI_ShowMessageBox( formatted_msg ))
|
if( !UI_IsVisible() || !UI_ShowMessageBox( formatted_msg ))
|
||||||
Msg( "%s\n", formatted_msg );
|
Msg( "%s\n", formatted_msg );
|
||||||
|
|
||||||
|
CL_Disconnect_f();
|
||||||
}
|
}
|
||||||
else if( !Q_strcmp( c, "updatemsg" ))
|
else if( !Q_strcmp( c, "updatemsg" ))
|
||||||
{
|
{
|
||||||
|
@ -586,7 +586,7 @@ void CL_LegacyPrecache_f( void )
|
|||||||
int spawncount, i;
|
int spawncount, i;
|
||||||
model_t *mod;
|
model_t *mod;
|
||||||
|
|
||||||
if( !cls.legacymode )
|
if( cls.legacymode != PROTO_LEGACY )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
spawncount = Q_atoi( Cmd_Argv( 1 ));
|
spawncount = Q_atoi( Cmd_Argv( 1 ));
|
||||||
|
@ -1894,7 +1894,7 @@ S_VoiceRecordStart_f
|
|||||||
*/
|
*/
|
||||||
static void S_VoiceRecordStart_f( void )
|
static void S_VoiceRecordStart_f( void )
|
||||||
{
|
{
|
||||||
if( cls.state != ca_active || cls.legacymode )
|
if( cls.state != ca_active )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Voice_RecordStart();
|
Voice_RecordStart();
|
||||||
|
@ -396,6 +396,9 @@ void Voice_RecordStart( void )
|
|||||||
{
|
{
|
||||||
Voice_RecordStop();
|
Voice_RecordStop();
|
||||||
|
|
||||||
|
if( !voice.initialized )
|
||||||
|
return;
|
||||||
|
|
||||||
if( voice_inputfromfile.value )
|
if( voice_inputfromfile.value )
|
||||||
{
|
{
|
||||||
voice.input_file = FS_LoadSound( "voice_input.wav", NULL, 0 );
|
voice.input_file = FS_LoadSound( "voice_input.wav", NULL, 0 );
|
||||||
@ -415,7 +418,7 @@ void Voice_RecordStart( void )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if( !Voice_IsRecording() )
|
if( !Voice_IsRecording( ) && voice.device_opened )
|
||||||
voice.is_recording = VoiceCapture_Activate( true );
|
voice.is_recording = VoiceCapture_Activate( true );
|
||||||
|
|
||||||
if( Voice_IsRecording() )
|
if( Voice_IsRecording() )
|
||||||
|
Loading…
Reference in New Issue
Block a user