MCPcopy Create free account
hub / github.com/DescentDevelopers/Descent3 / ReadPlayerControls

Function ReadPlayerControls

Descent3/Controls.cpp:721–750  ·  view source on GitHub ↗

Read the keyboard & other controllers. Fills in the specified structure.

Source from the content-addressed store, hash-verified

719
720// Read the keyboard & other controllers. Fills in the specified structure.
721void ReadPlayerControls(game_controls *controls) {
722 if (!Control_system_init) {
723 memset(controls, 0, sizeof(game_controls));
724 return;
725 }
726 //@@ Control_frametime = Frametime;
727 // keyboard uses game frametime
728 // controller uses polled control frametime
729
730 if (!Control_poll_flag) {
731 memset(controls, 0, sizeof(game_controls));
732 return;
733 }
734
735 PollControls();
736 DoWeapons(controls); // controls for weapon firing operations
737 DoMisc(controls);
738 DoMovement(controls); // controls for moving the object
739
740 // only read at the specified rate to keep things consistant. manager control system timer
741 // Control_current_time += Frametime;
742 // Control_frametime = Control_current_time - Control_interval_time;
743 // if (Control_frametime >= CONTROL_POLL_RATE) {
744 // Control_interval_time = Control_current_time;
745 // DoMovement(controls); // controls for moving the object
746 // return 1;
747 //}
748 // else
749 // return 0;
750}
751
752// ---------------------------------------------------------------------------
753// CONTROL FUNCTIONS

Callers 1

DoFlyingControlFunction · 0.85

Calls 4

PollControlsFunction · 0.85
DoWeaponsFunction · 0.85
DoMiscFunction · 0.85
DoMovementFunction · 0.85

Tested by

no test coverage detected