* Merge unified-sdl to trunk
* Bump Q3_VERSION to 1.35
This commit is contained in:
parent
39abffeb3b
commit
672cfbf16f
188 changed files with 5071 additions and 41739 deletions
|
@ -43,6 +43,7 @@ cvar_t *cl_freezeDemo;
|
|||
cvar_t *cl_shownet;
|
||||
cvar_t *cl_showSend;
|
||||
cvar_t *cl_timedemo;
|
||||
cvar_t *cl_timedemoLog;
|
||||
cvar_t *cl_autoRecordDemo;
|
||||
cvar_t *cl_aviFrameRate;
|
||||
cvar_t *cl_aviMotionJpeg;
|
||||
|
@ -391,19 +392,96 @@ CLIENT SIDE DEMO PLAYBACK
|
|||
=======================================================================
|
||||
*/
|
||||
|
||||
/*
|
||||
=================
|
||||
CL_DemoFrameDurationSDev
|
||||
=================
|
||||
*/
|
||||
static float CL_DemoFrameDurationSDev( void )
|
||||
{
|
||||
int i;
|
||||
int numFrames;
|
||||
float mean = 0.0f;
|
||||
float variance = 0.0f;
|
||||
|
||||
if( ( clc.timeDemoFrames - 1 ) > MAX_TIMEDEMO_DURATIONS )
|
||||
numFrames = MAX_TIMEDEMO_DURATIONS;
|
||||
else
|
||||
numFrames = clc.timeDemoFrames - 1;
|
||||
|
||||
for( i = 0; i < numFrames; i++ )
|
||||
mean += clc.timeDemoDurations[ i ];
|
||||
mean /= numFrames;
|
||||
|
||||
for( i = 0; i < numFrames; i++ )
|
||||
{
|
||||
float x = clc.timeDemoDurations[ i ];
|
||||
|
||||
variance += ( ( x - mean ) * ( x - mean ) );
|
||||
}
|
||||
variance /= numFrames;
|
||||
|
||||
return sqrt( variance );
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
CL_DemoCompleted
|
||||
=================
|
||||
*/
|
||||
void CL_DemoCompleted( void ) {
|
||||
if (cl_timedemo && cl_timedemo->integer) {
|
||||
void CL_DemoCompleted( void )
|
||||
{
|
||||
char buffer[ MAX_STRING_CHARS ];
|
||||
|
||||
if( cl_timedemo && cl_timedemo->integer )
|
||||
{
|
||||
int time;
|
||||
|
||||
time = Sys_Milliseconds() - clc.timeDemoStart;
|
||||
if ( time > 0 ) {
|
||||
Com_Printf ("%i frames, %3.1f seconds: %3.1f fps\n", clc.timeDemoFrames,
|
||||
time/1000.0, clc.timeDemoFrames*1000.0 / time);
|
||||
if( time > 0 )
|
||||
{
|
||||
// Millisecond times are frame durations:
|
||||
// minimum/average/maximum/std deviation
|
||||
Com_sprintf( buffer, sizeof( buffer ),
|
||||
"%i frames %3.1f seconds %3.1f fps %d.0/%.1f/%d.0/%.1f ms\n",
|
||||
clc.timeDemoFrames,
|
||||
time/1000.0,
|
||||
clc.timeDemoFrames*1000.0 / time,
|
||||
clc.timeDemoMinDuration,
|
||||
time / (float)clc.timeDemoFrames,
|
||||
clc.timeDemoMaxDuration,
|
||||
CL_DemoFrameDurationSDev( ) );
|
||||
Com_Printf( buffer );
|
||||
|
||||
// Write a log of all the frame durations
|
||||
if( cl_timedemoLog && strlen( cl_timedemoLog->string ) > 0 )
|
||||
{
|
||||
int i;
|
||||
int numFrames;
|
||||
fileHandle_t f;
|
||||
|
||||
if( ( clc.timeDemoFrames - 1 ) > MAX_TIMEDEMO_DURATIONS )
|
||||
numFrames = MAX_TIMEDEMO_DURATIONS;
|
||||
else
|
||||
numFrames = clc.timeDemoFrames - 1;
|
||||
|
||||
f = FS_FOpenFileWrite( cl_timedemoLog->string );
|
||||
if( f )
|
||||
{
|
||||
FS_Printf( f, "# %s", buffer );
|
||||
|
||||
for( i = 0; i < numFrames; i++ )
|
||||
FS_Printf( f, "%d\n", clc.timeDemoDurations[ i ] );
|
||||
|
||||
FS_FCloseFile( f );
|
||||
Com_Printf( "%s written\n", cl_timedemoLog->string );
|
||||
}
|
||||
else
|
||||
{
|
||||
Com_Printf( "Couldn't open %s for writing\n",
|
||||
cl_timedemoLog->string );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -658,7 +736,7 @@ void CL_FlushMemory( void ) {
|
|||
Hunk_ClearToMark();
|
||||
}
|
||||
|
||||
CL_StartHunkUsers();
|
||||
CL_StartHunkUsers( qfalse );
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -671,6 +749,12 @@ memory on the hunk from cgame, ui, and renderer
|
|||
=====================
|
||||
*/
|
||||
void CL_MapLoading( void ) {
|
||||
if ( com_dedicated->integer ) {
|
||||
cls.state = CA_DISCONNECTED;
|
||||
cls.keyCatchers = KEYCATCH_CONSOLE;
|
||||
return;
|
||||
}
|
||||
|
||||
if ( !com_cl_running->integer ) {
|
||||
return;
|
||||
}
|
||||
|
@ -830,7 +914,7 @@ void CL_ForwardCommandToServer( const char *string ) {
|
|||
}
|
||||
|
||||
if ( clc.demoplaying || cls.state < CA_CONNECTED || cmd[0] == '+' ) {
|
||||
Com_Printf ("Unknown command \"%s\"\n", cmd);
|
||||
Com_Printf ("Unknown command \"%s" S_COLOR_WHITE "\"\n", cmd);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -939,26 +1023,22 @@ void CL_RequestAuthorization( void ) {
|
|||
return;
|
||||
}
|
||||
|
||||
if ( Cvar_VariableValue( "fs_restrict" ) ) {
|
||||
Q_strncpyz( nums, "demota", sizeof( nums ) );
|
||||
} else {
|
||||
// only grab the alphanumeric values from the cdkey, to avoid any dashes or spaces
|
||||
j = 0;
|
||||
l = strlen( cl_cdkey );
|
||||
if ( l > 32 ) {
|
||||
l = 32;
|
||||
}
|
||||
for ( i = 0 ; i < l ; i++ ) {
|
||||
if ( ( cl_cdkey[i] >= '0' && cl_cdkey[i] <= '9' )
|
||||
// only grab the alphanumeric values from the cdkey, to avoid any dashes or spaces
|
||||
j = 0;
|
||||
l = strlen( cl_cdkey );
|
||||
if ( l > 32 ) {
|
||||
l = 32;
|
||||
}
|
||||
for ( i = 0 ; i < l ; i++ ) {
|
||||
if ( ( cl_cdkey[i] >= '0' && cl_cdkey[i] <= '9' )
|
||||
|| ( cl_cdkey[i] >= 'a' && cl_cdkey[i] <= 'z' )
|
||||
|| ( cl_cdkey[i] >= 'A' && cl_cdkey[i] <= 'Z' )
|
||||
) {
|
||||
nums[j] = cl_cdkey[i];
|
||||
j++;
|
||||
}
|
||||
) {
|
||||
nums[j] = cl_cdkey[i];
|
||||
j++;
|
||||
}
|
||||
nums[j] = 0;
|
||||
}
|
||||
nums[j] = 0;
|
||||
|
||||
fs = Cvar_Get ("cl_anonymous", "0", CVAR_INIT|CVAR_SYSTEMINFO );
|
||||
|
||||
|
@ -1276,7 +1356,7 @@ void CL_Vid_Restart_f( void ) {
|
|||
CL_InitRef();
|
||||
|
||||
// startup all the client stuff
|
||||
CL_StartHunkUsers();
|
||||
CL_StartHunkUsers( qfalse );
|
||||
|
||||
// start the cgame if connected
|
||||
if ( cls.state > CA_CONNECTED && cls.state != CA_CINEMATIC ) {
|
||||
|
@ -2316,7 +2396,7 @@ After the server has cleared the hunk, these will need to be restarted
|
|||
This is the only place that any of these functions are called from
|
||||
============================
|
||||
*/
|
||||
void CL_StartHunkUsers( void ) {
|
||||
void CL_StartHunkUsers( qboolean rendererOnly ) {
|
||||
if (!com_cl_running) {
|
||||
return;
|
||||
}
|
||||
|
@ -2330,6 +2410,10 @@ void CL_StartHunkUsers( void ) {
|
|||
CL_InitRenderer();
|
||||
}
|
||||
|
||||
if ( rendererOnly ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( !cls.soundStarted ) {
|
||||
cls.soundStarted = qtrue;
|
||||
S_Init();
|
||||
|
@ -2590,6 +2674,7 @@ void CL_Init( void ) {
|
|||
cl_activeAction = Cvar_Get( "activeAction", "", CVAR_TEMP );
|
||||
|
||||
cl_timedemo = Cvar_Get ("timedemo", "0", 0);
|
||||
cl_timedemoLog = Cvar_Get ("cl_timedemoLog", "", CVAR_ARCHIVE);
|
||||
cl_autoRecordDemo = Cvar_Get ("cl_autoRecordDemo", "0", CVAR_ARCHIVE);
|
||||
cl_aviFrameRate = Cvar_Get ("cl_aviFrameRate", "25", CVAR_ARCHIVE);
|
||||
cl_aviMotionJpeg = Cvar_Get ("cl_aviMotionJpeg", "1", CVAR_ARCHIVE);
|
||||
|
@ -3203,11 +3288,6 @@ void CL_GlobalServers_f( void ) {
|
|||
for (i=3; i<count; i++)
|
||||
buffptr += sprintf( buffptr, " %s", Cmd_Argv(i) );
|
||||
|
||||
// if we are a demo, automatically add a "demo" keyword
|
||||
if ( Cvar_VariableValue( "fs_restrict" ) ) {
|
||||
buffptr += sprintf( buffptr, " demo" );
|
||||
}
|
||||
|
||||
NET_OutOfBandPrint( NS_SERVER, to, command );
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue