Read the keyboard & other controllers. Fills in the specified structure.
| 719 | |
| 720 | // Read the keyboard & other controllers. Fills in the specified structure. |
| 721 | void 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 |
no test coverage detected