395
397
=================
398
CL_DemoFrameDurationSDev
401
static float CL_DemoFrameDurationSDev( void )
406
float variance = 0.0f;
408
if( ( clc.timeDemoFrames - 1 ) > MAX_TIMEDEMO_DURATIONS )
409
numFrames = MAX_TIMEDEMO_DURATIONS;
411
numFrames = clc.timeDemoFrames - 1;
413
for( i = 0; i < numFrames; i++ )
414
mean += clc.timeDemoDurations[ i ];
417
for( i = 0; i < numFrames; i++ )
419
float x = clc.timeDemoDurations[ i ];
421
variance += ( ( x - mean ) * ( x - mean ) );
423
variance /= numFrames;
425
return sqrt( variance );
397
431
=================
399
void CL_DemoCompleted( void ) {
400
if (cl_timedemo && cl_timedemo->integer) {
433
void CL_DemoCompleted( void )
435
char buffer[ MAX_STRING_CHARS ];
437
if( cl_timedemo && cl_timedemo->integer )
403
441
time = Sys_Milliseconds() - clc.timeDemoStart;
405
Com_Printf ("%i frames, %3.1f seconds: %3.1f fps\n", clc.timeDemoFrames,
406
time/1000.0, clc.timeDemoFrames*1000.0 / time);
444
// Millisecond times are frame durations:
445
// minimum/average/maximum/std deviation
446
Com_sprintf( buffer, sizeof( buffer ),
447
"%i frames %3.1f seconds %3.1f fps %d.0/%.1f/%d.0/%.1f ms\n",
450
clc.timeDemoFrames*1000.0 / time,
451
clc.timeDemoMinDuration,
452
time / (float)clc.timeDemoFrames,
453
clc.timeDemoMaxDuration,
454
CL_DemoFrameDurationSDev( ) );
455
Com_Printf( "%s", buffer );
457
// Write a log of all the frame durations
458
if( cl_timedemoLog && strlen( cl_timedemoLog->string ) > 0 )
464
if( ( clc.timeDemoFrames - 1 ) > MAX_TIMEDEMO_DURATIONS )
465
numFrames = MAX_TIMEDEMO_DURATIONS;
467
numFrames = clc.timeDemoFrames - 1;
469
f = FS_FOpenFileWrite( cl_timedemoLog->string );
472
FS_Printf( f, "# %s", buffer );
474
for( i = 0; i < numFrames; i++ )
475
FS_Printf( f, "%d\n", clc.timeDemoDurations[ i ] );
478
Com_Printf( "%s written\n", cl_timedemoLog->string );
482
Com_Printf( "Couldn't open %s for writing\n",
483
cl_timedemoLog->string );
671
750
=====================
673
752
void CL_MapLoading( void ) {
753
if ( com_dedicated->integer ) {
754
cls.state = CA_DISCONNECTED;
755
Key_SetCatcher( KEYCATCH_CONSOLE );
674
759
if ( !com_cl_running->integer ) {
681
766
// if we are already connected to the local host, stay connected
682
767
if ( cls.state >= CA_CONNECTED && !Q_stricmp( cls.servername, "localhost" ) ) {
692
777
CL_Disconnect( qtrue );
693
778
Q_strncpyz( cls.servername, "localhost", sizeof(cls.servername) );
694
779
cls.state = CA_CHALLENGING; // so the connect screen is drawn
696
781
SCR_UpdateScreen();
697
782
clc.connectTime = -RETRANSMIT_TIMEOUT;
698
783
NET_StringToAdr( cls.servername, &clc.serverAddress);
942
if ( Cvar_VariableValue( "fs_restrict" ) ) {
943
Q_strncpyz( nums, "demota", sizeof( nums ) );
945
// only grab the alphanumeric values from the cdkey, to avoid any dashes or spaces
947
l = strlen( cl_cdkey );
951
for ( i = 0 ; i < l ; i++ ) {
952
if ( ( cl_cdkey[i] >= '0' && cl_cdkey[i] <= '9' )
1029
// only grab the alphanumeric values from the cdkey, to avoid any dashes or spaces
1031
l = strlen( cl_cdkey );
1035
for ( i = 0 ; i < l ; i++ ) {
1036
if ( ( cl_cdkey[i] >= '0' && cl_cdkey[i] <= '9' )
953
1037
|| ( cl_cdkey[i] >= 'a' && cl_cdkey[i] <= 'z' )
954
1038
|| ( cl_cdkey[i] >= 'A' && cl_cdkey[i] <= 'Z' )
956
nums[j] = cl_cdkey[i];
1040
nums[j] = cl_cdkey[i];
963
1046
fs = Cvar_Get ("cl_anonymous", "0", CVAR_INIT|CVAR_SYSTEMINFO );
965
NET_OutOfBandPrint(NS_CLIENT, cls.authorizeServer, va("getKeyAuthorize %i %s", fs->integer, nums) );
1048
NET_OutOfBandPrint(NS_CLIENT, cls.authorizeServer, "getKeyAuthorize %i %s", fs->integer, nums );
1192
1275
=================
1194
1277
void CL_SendPureChecksums( void ) {
1195
const char *pChecksums;
1196
1278
char cMsg[MAX_INFO_VALUE];
1199
1280
// if we are pure we need to send back a command with our referenced pk3 checksums
1200
pChecksums = FS_ReferencedPakPureChecksums();
1281
Com_sprintf(cMsg, sizeof(cMsg), "cp %d %s", cl.serverId, FS_ReferencedPakPureChecksums());
1204
Com_sprintf(cMsg, sizeof(cMsg), "Yf ");
1205
Q_strcat(cMsg, sizeof(cMsg), va("%d ", cl.serverId) );
1206
Q_strcat(cMsg, sizeof(cMsg), pChecksums);
1207
for (i = 0; i < 2; i++) {
1210
1283
CL_AddReliableCommand( cMsg );
2148
2221
// bring up the cd error dialog if needed
2149
2222
cls.cddialog = qfalse;
2150
2223
VM_Call( uivm, UI_SET_ACTIVE_MENU, UIMENU_NEED_CD );
2151
} else if ( cls.state == CA_DISCONNECTED && !( cls.keyCatchers & KEYCATCH_UI )
2224
} else if ( cls.state == CA_DISCONNECTED && !( Key_GetCatcher( ) & KEYCATCH_UI )
2152
2225
&& !com_sv_running->integer ) {
2153
2226
// if disconnected, bring up the menu
2154
2227
S_StopAllSounds();
2582
2659
cl_timeout = Cvar_Get ("cl_timeout", "200", 0);
2661
cl_master = Cvar_Get ("cl_master", MASTER_SERVER_NAME, CVAR_ARCHIVE);
2584
2662
cl_timeNudge = Cvar_Get ("cl_timeNudge", "0", CVAR_TEMP );
2585
2663
cl_shownet = Cvar_Get ("cl_shownet", "0", CVAR_TEMP );
2586
2664
cl_showSend = Cvar_Get ("cl_showSend", "0", CVAR_TEMP );
2590
2668
cl_activeAction = Cvar_Get( "activeAction", "", CVAR_TEMP );
2592
2670
cl_timedemo = Cvar_Get ("timedemo", "0", 0);
2671
cl_timedemoLog = Cvar_Get ("cl_timedemoLog", "", CVAR_ARCHIVE);
2593
2672
cl_autoRecordDemo = Cvar_Get ("cl_autoRecordDemo", "0", CVAR_ARCHIVE);
2594
2673
cl_aviFrameRate = Cvar_Get ("cl_aviFrameRate", "25", CVAR_ARCHIVE);
2595
2674
cl_aviMotionJpeg = Cvar_Get ("cl_aviMotionJpeg", "1", CVAR_ARCHIVE);
2613
2692
cl_showMouseRate = Cvar_Get ("cl_showmouserate", "0", 0);
2615
2694
cl_allowDownload = Cvar_Get ("cl_allowDownload", "0", CVAR_ARCHIVE);
2617
2696
cl_cURLLib = Cvar_Get("cl_cURLLib", DEFAULT_CURL_LIB, CVAR_ARCHIVE);
3161
3235
to.type = NA_BROADCAST;
3162
3236
NET_SendPacket( NS_CLIENT, strlen( message ), message, to );
3164
to.type = NA_BROADCAST_IPX;
3165
NET_SendPacket( NS_CLIENT, strlen( message ), message, to );
3191
3262
// reset the list, waiting for response
3192
3263
// -1 is used to distinguish a "no response"
3265
NET_StringToAdr( cl_master->string, &to );
3194
3267
if( cls.masterNum == 1 ) {
3195
NET_StringToAdr( MASTER_SERVER_NAME, &to );
3196
3268
cls.nummplayerservers = -1;
3197
3269
cls.pingUpdateSource = AS_MPLAYER;
3200
NET_StringToAdr( MASTER_SERVER_NAME, &to );
3201
3272
cls.numglobalservers = -1;
3202
3273
cls.pingUpdateSource = AS_GLOBAL;
3212
3283
for (i=3; i<count; i++)
3213
3284
buffptr += sprintf( buffptr, " %s", Cmd_Argv(i) );
3215
// if we are a demo, automatically add a "demo" keyword
3216
if ( Cvar_VariableValue( "fs_restrict" ) ) {
3217
buffptr += sprintf( buffptr, " demo" );
3220
NET_OutOfBandPrint( NS_SERVER, to, command );
3286
NET_OutOfBandPrint( NS_SERVER, to, "%s", command );
3582
3648
=================
3584
3650
qboolean CL_CDKeyValidate( const char *key, const char *checksum ) {
3591
if( len != CDKEY_LEN ) {
3595
if( checksum && strlen( checksum ) != CDCHKSUM_LEN ) {
3600
// for loop gets rid of conditional assignment warning
3601
for (i = 0; i < len; i++) {
3603
if (ch>='a' && ch<='z') {
3630
sprintf(chs, "%02x", sum);
3632
if (checksum && !Q_stricmp(chs, checksum)) {