+ if (cls.state != ca_dedicated && (cl_timer > 0 || cls.timedemo))
+ {
+ // 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)
+ clframetime = cl.realframetime = max(cl_timer, 1.0 / cl_maxfps.value);
+ else if (!vid_activewindow && cl_maxidlefps.value >= 1)
+ 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 *= slowmo.value;
+ // if demo playback is paused, don't advance time at all
+ if (cls.demopaused)
+ clframetime = 0;
+ }
+
+ // host_framerate overrides all else
+ if (host_framerate.value)
+ clframetime = host_framerate.value;
+
+ 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;
+
+ // Collect input into cmd
+ CL_Input();
+
+ // check for new packets
+ NetConn_ClientFrame();
+
+ // read a new frame from a demo if needed
+ CL_ReadDemoMessage();
+
+ // now that packets have been read, send input to server
+ CL_SendMove();
+
+ // update client world (interpolate entities, create trails, etc)
+ CL_UpdateWorld();
+
+ // update video
+ if (host_speeds.integer)
+ time1 = Sys_DoubleTime();
+
+ CL_Video_Frame();
+ CL_Gecko_Frame();
+
+ CL_UpdateScreen();
+
+ if (host_speeds.integer)
+ time2 = Sys_DoubleTime();
+
+ // update audio
+ if(cl.csqc_usecsqclistener)
+ {
+ S_Update(&cl.csqc_listenermatrix);
+ cl.csqc_usecsqclistener = false;
+ }
+ else
+ S_Update(&r_refdef.view.matrix);
+
+ CDAudio_Update();
+
+ if (host_speeds.integer)
+ {
+ pass1 = (int)((time1 - time3)*1000000);
+ time3 = Sys_DoubleTime();
+ 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);
+ }
+ }