| 1015 | } |
| 1016 | |
| 1017 | void DoKeyboardWeapons(game_controls *controls) { |
| 1018 | ct_packet fire_primary_key_time; |
| 1019 | ct_packet fire_secondary_key_time; |
| 1020 | ct_packet fire_flare_key_count; |
| 1021 | ct_packet automap_key; |
| 1022 | ct_packet cycle_prim, cycle_sec; |
| 1023 | int i; |
| 1024 | |
| 1025 | // read controls |
| 1026 | Controller->get_packet(ctfFIREPRIMARY_KEY, &fire_primary_key_time); |
| 1027 | Controller->get_packet(ctfFIRESECONDARY_KEY, &fire_secondary_key_time); |
| 1028 | Controller->get_packet(ctfFIREFLARE_KEY, &fire_flare_key_count); |
| 1029 | Controller->get_packet(ctfAUTOMAP_KEY, &automap_key); |
| 1030 | Controller->get_packet(ctfWPNSEL_PCYCLEKEY, &cycle_prim); |
| 1031 | Controller->get_packet(ctfWPNSEL_SCYCLEKEY, &cycle_sec); |
| 1032 | |
| 1033 | // weapon fire |
| 1034 | if (fire_primary_key_time.value > 0) { |
| 1035 | controls->fire_primary_down_state = true; |
| 1036 | controls->fire_primary_down_count = 1; |
| 1037 | controls->fire_primary_down_time = fire_primary_key_time.value; |
| 1038 | } |
| 1039 | |
| 1040 | if (fire_secondary_key_time.value > 0) { |
| 1041 | controls->fire_secondary_down_count = 1; |
| 1042 | controls->fire_secondary_down_time = fire_secondary_key_time.value; |
| 1043 | } |
| 1044 | |
| 1045 | // flare |
| 1046 | controls->fire_flare_down_count = fire_flare_key_count.value; |
| 1047 | |
| 1048 | // automap |
| 1049 | if (automap_key.value) { |
| 1050 | Game_interface_mode = GAME_TELCOM_AUTOMAP; |
| 1051 | } |
| 1052 | |
| 1053 | // do cycling weapons |
| 1054 | for (i = 0; i < (int)cycle_prim.value; i++) |
| 1055 | SwitchPlayerWeapon(PW_PRIMARY); |
| 1056 | |
| 1057 | for (i = 0; i < (int)cycle_sec.value; i++) |
| 1058 | SwitchPlayerWeapon(PW_SECONDARY); |
| 1059 | } |
| 1060 | |
| 1061 | void DoControllerWeapons(game_controls *controls) { |
| 1062 | ct_packet fire_primary_count, fire_primary_time; |
no test coverage detected