1
0
Fork 0

More custom protocol work, code cleanup

500Hz monitors is upcoming, so adjust \r_displayRefresh range
This commit is contained in:
Eugene 2022-02-11 22:08:14 +02:00
parent 2e411ecfb1
commit 6b153e6cd7
3 changed files with 16 additions and 11 deletions

View File

@ -928,7 +928,7 @@ static void CL_PlayDemo_f( void ) {
clc.demoplaying = qtrue;
Q_strncpyz( cls.servername, shortname, sizeof( cls.servername ) );
if ( protocol < NEW_PROTOCOL_VERSION )
if ( protocol <= OLD_PROTOCOL_VERSION )
clc.compat = qtrue;
else
clc.compat = qfalse;
@ -3749,7 +3749,7 @@ static void CL_InitGLimp_Cvars( void )
r_glDriver = Cvar_Get( "r_glDriver", OPENGL_DRIVER_NAME, CVAR_ARCHIVE_ND | CVAR_LATCH );
r_displayRefresh = Cvar_Get( "r_displayRefresh", "0", CVAR_LATCH );
Cvar_CheckRange( r_displayRefresh, "0", "360", CV_INTEGER );
Cvar_CheckRange( r_displayRefresh, "0", "500", CV_INTEGER );
Cvar_SetDescription( r_displayRefresh, "Override monitor refresh rate in fullscreen mode:\n 0 - use current monitor refresh rate\n >0 - use custom refresh rate" );
vid_xpos = Cvar_Get( "vid_xpos", "3", CVAR_ARCHIVE );
@ -3806,6 +3806,7 @@ CL_Init
*/
void CL_Init( void ) {
const char *s;
cvar_t *cv;
Com_Printf( "----- Client Initialization -----\n" );
@ -3880,7 +3881,8 @@ void CL_Init( void ) {
cl_motdString = Cvar_Get( "cl_motdString", "", CVAR_ROM );
Cvar_Get( "cl_maxPing", "800", CVAR_ARCHIVE_ND );
cv = Cvar_Get( "cl_maxPing", "800", CVAR_ARCHIVE_ND );
Cvar_CheckRange( cv, "100", "999", CV_INTEGER );
cl_lanForcePackets = Cvar_Get( "cl_lanForcePackets", "1", CVAR_ARCHIVE_ND );
@ -4566,15 +4568,12 @@ void CL_GetPing( int n, char *buf, int buflen, int *pingtime )
Q_strncpyz( buf, str, buflen );
time = cl_pinglist[n].time;
if (!time)
if ( time == 0 )
{
// check for timeout
time = Sys_Milliseconds() - cl_pinglist[n].start;
maxPing = Cvar_VariableIntegerValue( "cl_maxPing" );
if( maxPing < 100 ) {
maxPing = 100;
}
if (time < maxPing)
if ( time < maxPing )
{
// not timed out yet
time = 0;

View File

@ -307,7 +307,7 @@ static void CL_ParseSnapshot( msg_t *msg ) {
// calculate ping time
for ( i = 0 ; i < PACKET_BACKUP ; i++ ) {
packetNum = ( clc.netchan.outgoingSequence - 1 - i ) & PACKET_MASK;
if ( cl.snap.ps.commandTime >= cl.outPackets[ packetNum ].p_serverTime ) {
if ( cl.snap.ps.commandTime - cl.outPackets[packetNum].p_serverTime >= 0 ) {
cl.snap.ping = cls.realtime - cl.outPackets[ packetNum ].p_realtime;
break;
}
@ -780,7 +780,7 @@ static void CL_ParseCommandString( msg_t *msg ) {
Com_Printf( " %3i(%3i) %s\n", seq, clc.serverCommandSequence, s );
// see if we have already executed stored it off
if ( clc.serverCommandSequence >= seq ) {
if ( clc.serverCommandSequence - seq >= 0 ) {
return;
}
clc.serverCommandSequence = seq;

View File

@ -142,11 +142,17 @@ void SV_GetChallenge( const netadr_t *from ) {
// legacy client query, don't send unneeded information
NET_OutOfBandPrint( NS_SERVER, from, "challengeResponse %i", challenge );
} else {
int sv_proto = com_protocol->integer;
if ( sv_proto == DEFAULT_PROTOCOL_VERSION ) {
// we support new protocol features by default
sv_proto = NEW_PROTOCOL_VERSION;
}
// Grab the client's challenge to echo back (if given)
clientChallenge = atoi( Cmd_Argv( 1 ) );
NET_OutOfBandPrint( NS_SERVER, from, "challengeResponse %i %i %i",
challenge, clientChallenge, NEW_PROTOCOL_VERSION );
challenge, clientChallenge, sv_proto );
}
}