- R_TimeReport("---");
- Collision_Cache_NewFrame();
- R_TimeReport("photoncache");
-#ifdef CONFIG_VIDEO_CAPTURE
- // decide the simulation time
- if (cls.capturevideo.active)
- {
- //***
- if (cls.capturevideo.realtime)
- clframetime = cl.realframetime = max(cl_timer, 1.0 / cls.capturevideo.framerate);
- else
- {
- clframetime = 1.0 / cls.capturevideo.framerate;
- cl.realframetime = max(cl_timer, clframetime);
- }
- }
- else if (vid_activewindow && cl_maxfps.value >= 1 && !cls.timedemo)
-
-#else
- if (vid_activewindow && cl_maxfps.value >= 1 && !cls.timedemo)
-#endif
- {
- clframetime = cl.realframetime = max(cl_timer, 1.0 / cl_maxfps.value);
- // when running slow, we need to sleep to keep input responsive
- wait = bound(0, cl_maxfps_alwayssleep.value * 1000, 100000);
- if (wait > 0)
- Sys_Sleep((int)wait);
- }
- else if (!vid_activewindow && cl_maxidlefps.value >= 1 && !cls.timedemo)
- clframetime = cl.realframetime = max(cl_timer, 1.0 / cl_maxidlefps.value);
- else
- clframetime = cl.realframetime = cl_timer;
-
- // apply slowmo scaling
- clframetime *= cl.movevars_timescale;
- // scale playback speed of demos by slowmo cvar
- if (cls.demoplayback)
- {
- clframetime *= host_timescale.value;
- // if demo playback is paused, don't advance time at all
- if (cls.demopaused)
- clframetime = 0;
- }
- else
- {
- // host_framerate overrides all else
- if (host_framerate.value)
- clframetime = host_framerate.value;
-
- if (cl.paused || host.paused)
- clframetime = 0;
- }
-
- if (cls.timedemo)
- clframetime = cl.realframetime = cl_timer;
-
- // deduct the frame time from the accumulator
- cl_timer -= cl.realframetime;
-
- cl.oldtime = cl.time;
- cl.time += clframetime;
-
- // update video
- if (host_speeds.integer)
- time1 = Sys_DirtyTime();
- R_TimeReport("pre-input");
-
- // Collect input into cmd
- CL_Input();
-
- R_TimeReport("input");
-
- // check for new packets
- NetConn_ClientFrame();
-
- // read a new frame from a demo if needed
- CL_ReadDemoMessage();
- R_TimeReport("clientnetwork");
-
- // now that packets have been read, send input to server
- CL_SendMove();
- R_TimeReport("sendmove");
-
- // update client world (interpolate entities, create trails, etc)
- CL_UpdateWorld();
- R_TimeReport("lerpworld");
-
- CL_Video_Frame();
-
- R_TimeReport("client");
-
- CL_UpdateScreen();
- R_TimeReport("render");
-
- if (host_speeds.integer)
- time2 = Sys_DirtyTime();
-
- // update audio
- if(cl.csqc_usecsqclistener)
- {
- S_Update(&cl.csqc_listenermatrix);
- cl.csqc_usecsqclistener = false;
- }
- else
- S_Update(&r_refdef.view.matrix);
-
- CDAudio_Update();
- R_TimeReport("audio");
-
- // reset gathering of mouse input
- in_mouse_x = in_mouse_y = 0;
-
- if (host_speeds.integer)
- {
- pass1 = (int)((time1 - time3)*1000000);
- time3 = Sys_DirtyTime();
- pass2 = (int)((time2 - time1)*1000000);
- pass3 = (int)((time3 - time2)*1000000);
- Con_Printf("%6ius total %6ius server %6ius gfx %6ius snd\n",
- pass1+pass2+pass3, pass1, pass2, pass3);
- }