| 889 | #define GCV_VALID_RESULT(_r) (CONTROLLER_CTL1_INFO(CONTROLLER_INFO(ccfgdata)) != (int8_t)NULL_CONTROLLER) |
| 890 | |
| 891 | int cfg_element_ui::DoUI() { |
| 892 | extern void ddio_MouseQueueFlush(); |
| 893 | |
| 894 | int retval = UID_OK; |
| 895 | bool quit = false, catch_press = false; |
| 896 | int8_t adj; |
| 897 | |
| 898 | m_alpha = 16; |
| 899 | adj = -1; |
| 900 | |
| 901 | ui_HideCursor(); |
| 902 | |
| 903 | Descent->delay(0.3f); |
| 904 | ResumeControls(); |
| 905 | Control_poll_flag = false; // under multiplayer, the game frame is still running, so don't let |
| 906 | // assignments make it down to game frame (HACK) |
| 907 | newuiMessageBox::GetSheet()->Realize(); |
| 908 | while (!quit) { |
| 909 | int key; |
| 910 | |
| 911 | Descent->defer(); |
| 912 | key = ddio_KeyInKey(); |
| 913 | |
| 914 | // quit if escape pressed |
| 915 | if (key == KEY_ESC) { |
| 916 | retval = UID_CANCEL; |
| 917 | quit = true; |
| 918 | } |
| 919 | |
| 920 | // input must go here. |
| 921 | switch (m_type) { |
| 922 | case ctKey: { |
| 923 | // perform simple key processing. |
| 924 | if (key > 0) { |
| 925 | if (Ctltext_KeyBindings[key & 0xff]) { |
| 926 | m_element = (key & 0xff); |
| 927 | quit = true; |
| 928 | } else { |
| 929 | // here tell user that this key can't be bound. |
| 930 | } |
| 931 | } |
| 932 | break; |
| 933 | } |
| 934 | case ctButton: |
| 935 | case ctMouseButton: |
| 936 | case ctPOV: |
| 937 | case ctPOV2: |
| 938 | case ctPOV3: |
| 939 | case ctPOV4: { |
| 940 | ct_config_data ccfgdata; |
| 941 | ct_type new_type; |
| 942 | |
| 943 | // get each type of input. |
| 944 | Controller->poll(); |
| 945 | |
| 946 | ccfgdata = Controller->get_controller_value(ctMouseButton); |
| 947 | new_type = ctMouseButton; |
| 948 | if (!GCV_VALID_RESULT(ccfgdata)) { |
no test coverage detected