| 761 | static unsigned int frameCount; |
| 762 | float avgFrametime=0.0; |
| 763 | void 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; |
no test coverage detected