MCPcopy Create free account
hub / github.com/JACoders/OpenJK / CL_Frame

Function CL_Frame

code/client/cl_main.cpp:763–884  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

761static unsigned int frameCount;
762float avgFrametime=0.0;
763void CL_Frame ( int msec,float fractionMsec ) {
764
765 if ( !com_cl_running->integer ) {
766 return;
767 }
768
769 // load the ref / cgame if needed
770 CL_StartHunkUsers();
771
772 if ( cls.state == CA_DISCONNECTED && !( Key_GetCatcher( ) & KEYCATCH_UI )
773 && !com_sv_running->integer ) {
774 // if disconnected, bring up the menu
775 if (!CL_CheckPendingCinematic()) // this avoid having the menu flash for one frame before pending cinematics
776 {
777 UI_SetActiveMenu( "mainMenu",NULL );
778 }
779 }
780
781
782 // if recording an avi, lock to a fixed fps
783 if ( cl_avidemo->integer ) {
784 // save the current screen
785 if ( cls.state == CA_ACTIVE ) {
786 if (cl_avidemo->integer > 0) {
787 Cbuf_ExecuteText( EXEC_NOW, "screenshot silent\n" );
788 } else {
789 Cbuf_ExecuteText( EXEC_NOW, "screenshot_tga silent\n" );
790 }
791 }
792 // fixed time for next frame
793 if (cl_avidemo->integer > 0) {
794 msec = 1000 / cl_avidemo->integer;
795 } else {
796 msec = 1000 / -cl_avidemo->integer;
797 }
798 }
799
800 // save the msec before checking pause
801 cls.realFrametime = msec;
802
803 // decide the simulation time
804 cls.frametime = msec;
805 if(cl_framerate->integer)
806 {
807 avgFrametime+=msec;
808 char mess[256];
809 if(!(frameCount&0x1f))
810 {
811 sprintf(mess,"Frame rate=%f\n\n",1000.0f*(1.0/(avgFrametime/32.0f)));
812 // OutputDebugString(mess);
813 Com_Printf(mess);
814 avgFrametime=0.0f;
815 }
816 frameCount++;
817 }
818 cls.frametimeFraction=fractionMsec;
819 cls.realtime += msec;
820 cls.realtimeFraction+=fractionMsec;

Callers 1

Com_FrameFunction · 0.50

Calls 15

CL_CheckPendingCinematicFunction · 0.85
CL_StartHunkUsersFunction · 0.70
Key_GetCatcherFunction · 0.70
SCR_DebugGraphFunction · 0.70
CL_CheckUserinfoFunction · 0.70
CL_CheckTimeoutFunction · 0.70
CL_SendCmdFunction · 0.70
CL_CheckForResendFunction · 0.70
CL_SetCGameTimeFunction · 0.70
Con_CloseFunction · 0.70
SCR_UpdateScreenFunction · 0.70
S_UpdateFunction · 0.70

Tested by

no test coverage detected