diff options
author | tma <tma@edf5b092-35ff-0310-97b2-ce42778d08ea> | 2007-09-05 18:17:46 +0000 |
---|---|---|
committer | tma <tma@edf5b092-35ff-0310-97b2-ce42778d08ea> | 2007-09-05 18:17:46 +0000 |
commit | d37536edf4660f3c46e4876b6d72e9a200549ffe (patch) | |
tree | 637eb5f3e49f4075ecdef97a31f5e8157cee73a2 /code/client/cl_cgame.c | |
parent | 4496eacc4ec7406fd694693da5a7f9589933f7fd (diff) | |
download | ioquake3-aero-d37536edf4660f3c46e4876b6d72e9a200549ffe.tar.gz ioquake3-aero-d37536edf4660f3c46e4876b6d72e9a200549ffe.zip |
* Merge unified-sdl to trunk
* Bump Q3_VERSION to 1.35
git-svn-id: svn://svn.icculus.org/quake3/trunk@1161 edf5b092-35ff-0310-97b2-ce42778d08ea
Diffstat (limited to 'code/client/cl_cgame.c')
-rw-r--r-- | code/client/cl_cgame.c | 32 |
1 files changed, 28 insertions, 4 deletions
diff --git a/code/client/cl_cgame.c b/code/client/cl_cgame.c index 810f738..b53e304 100644 --- a/code/client/cl_cgame.c +++ b/code/client/cl_cgame.c @@ -697,7 +697,7 @@ intptr_t CL_CgameSystemCalls( intptr_t *args ) { return re.inPVS( VMA(1), VMA(2) ); default: - assert(0); // bk010102 + assert(0); Com_Error( ERR_DROP, "Bad cgame system trap: %ld", (long int) args[0] ); } return 0; @@ -906,8 +906,6 @@ void CL_FirstSnapshot( void ) { Cbuf_AddText( cl_activeAction->string ); Cvar_Set( "activeAction", "" ); } - - Sys_BeginProfiling(); } /* @@ -1010,9 +1008,35 @@ void CL_SetCGameTime( void ) { // while a normal demo may have different time samples // each time it is played back if ( cl_timedemo->integer ) { + int now = Sys_Milliseconds( ); + int frameDuration; + if (!clc.timeDemoStart) { - clc.timeDemoStart = Sys_Milliseconds(); + clc.timeDemoStart = clc.timeDemoLastFrame = now; + clc.timeDemoMinDuration = INT_MAX; + clc.timeDemoMaxDuration = 0; + } + + frameDuration = now - clc.timeDemoLastFrame; + clc.timeDemoLastFrame = now; + + // Ignore the first measurement as it'll always be 0 + if( clc.timeDemoFrames > 0 ) + { + if( frameDuration > clc.timeDemoMaxDuration ) + clc.timeDemoMaxDuration = frameDuration; + + if( frameDuration < clc.timeDemoMinDuration ) + clc.timeDemoMinDuration = frameDuration; + + // 255 ms = about 4fps + if( frameDuration > UCHAR_MAX ) + frameDuration = UCHAR_MAX; + + clc.timeDemoDurations[ ( clc.timeDemoFrames - 1 ) % + MAX_TIMEDEMO_DURATIONS ] = frameDuration; } + clc.timeDemoFrames++; cl.serverTime = clc.timeDemoBaseTime + clc.timeDemoFrames * 50; } |