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

Function CL_CreateCmd

code/client/cl_input.cpp:677–725  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

675vec3_t cl_overriddenAngles = {0,0,0};
676qboolean cl_overrideAngles = qfalse;
677usercmd_t CL_CreateCmd( void ) {
678 usercmd_t cmd;
679 vec3_t oldAngles;
680
681 VectorCopy( cl.viewangles, oldAngles );
682
683 // keyboard angle adjustment
684 CL_AdjustAngles ();
685
686 memset( &cmd, 0, sizeof( cmd ) );
687
688 CL_CmdButtons( &cmd );
689
690 // get basic movement from keyboard
691 CL_KeyMove (&cmd);
692
693 // get basic movement from mouse
694 CL_MouseMove( &cmd );
695
696 // get basic movement from joystick
697 CL_JoystickMove( &cmd );
698
699 // check to make sure the angles haven't wrapped
700 if ( cl.viewangles[PITCH] - oldAngles[PITCH] > 90 ) {
701 cl.viewangles[PITCH] = oldAngles[PITCH] + 90;
702 } else if ( oldAngles[PITCH] - cl.viewangles[PITCH] > 90 ) {
703 cl.viewangles[PITCH] = oldAngles[PITCH] - 90;
704 }
705
706 if ( cl_overrideAngles )
707 {
708 VectorCopy( cl_overriddenAngles, cl.viewangles );
709 cl_overrideAngles = qfalse;
710 }
711 // store out the final values
712 CL_FinishMove( &cmd );
713
714 // draw debug graphs of turning for mouse testing
715 if ( cl_debugMove->integer ) {
716 if ( cl_debugMove->integer == 1 ) {
717 SCR_DebugGraph( abs(cl.viewangles[YAW] - oldAngles[YAW]), 0 );
718 }
719 if ( cl_debugMove->integer == 2 ) {
720 SCR_DebugGraph( abs(cl.viewangles[PITCH] - oldAngles[PITCH]), 0 );
721 }
722 }
723
724 return cmd;
725}
726
727
728/*

Callers 1

CL_CreateNewCommandsFunction · 0.70

Calls 8

VectorCopyFunction · 0.85
CL_AdjustAnglesFunction · 0.70
CL_CmdButtonsFunction · 0.70
CL_KeyMoveFunction · 0.70
CL_MouseMoveFunction · 0.70
CL_JoystickMoveFunction · 0.70
CL_FinishMoveFunction · 0.70
SCR_DebugGraphFunction · 0.70

Tested by

no test coverage detected