================= CL_CreateNewCommands Create a new usercmd_t structure for this frame ================= */
| 733 | ================= |
| 734 | */ |
| 735 | void CL_CreateNewCommands( void ) { |
| 736 | int cmdNum; |
| 737 | |
| 738 | // no need to create usercmds until we have a gamestate |
| 739 | // if ( cls.state < CA_PRIMED ) |
| 740 | // return; |
| 741 | |
| 742 | frame_msec = com_frameTime - old_com_frameTime; |
| 743 | |
| 744 | // if running over 1000fps, act as if each frame is 1ms |
| 745 | // prevents divisions by zero |
| 746 | if ( frame_msec < 1 ) |
| 747 | frame_msec = 1; |
| 748 | |
| 749 | // if running less than 5fps, truncate the extra time to prevent |
| 750 | // unexpected moves after a hitch |
| 751 | if ( frame_msec > 200 ) |
| 752 | frame_msec = 200; |
| 753 | |
| 754 | old_com_frameTime = com_frameTime; |
| 755 | |
| 756 | // generate a command for this frame |
| 757 | cl.cmdNumber++; |
| 758 | cmdNum = cl.cmdNumber & CMD_MASK; |
| 759 | cl.cmds[cmdNum] = CL_CreateCmd(); |
| 760 | } |
| 761 | |
| 762 | /* |
| 763 | ================= |
no test coverage detected