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

Function DoKeyboardMisc

Descent3/Controls.cpp:1137–1244  ·  view source on GitHub ↗

Inventory/CounterMeasure states

Source from the content-addressed store, hash-verified

1135
1136// Inventory/CounterMeasure states
1137void DoKeyboardMisc(game_controls *controls) {
1138 static int energy_to_shields_id = -1;
1139 int type, id, i;
1140
1141 ct_packet prev_inv_key, next_inv_key;
1142 ct_packet prev_cntm_key, next_cntm_key;
1143 ct_packet use_inv_key, use_inv_key_digital, use_cntm_key, use_taunt[4];
1144 ct_packet toggle_headlight;
1145 ct_packet toggle_rearview, toggle_rearview_switch;
1146 ct_packet key_slide1, key_bank;
1147
1148 // read controls
1149 Controller->get_packet(ctfPREV_INVKEY, &prev_inv_key);
1150 Controller->get_packet(ctfNEXT_INVKEY, &next_inv_key);
1151 Controller->get_packet(ctfPREV_CNTMSKEY, &prev_cntm_key);
1152 Controller->get_packet(ctfNEXT_CNTMSKEY, &next_cntm_key);
1153 Controller->get_packet(ctfINV_USEKEY, &use_inv_key);
1154 Controller->get_packet(ctfINV_USEKEY, &use_inv_key_digital, ctDigital);
1155 Controller->get_packet(ctfCNTMS_USEKEY, &use_cntm_key);
1156 Controller->get_packet(ctfHEADLIGHT_KEY, &toggle_headlight);
1157 Controller->get_packet(ctfREARVIEW_KEY, &toggle_rearview);
1158 Controller->get_packet(ctfREARVIEW_KEY, &toggle_rearview_switch, ctDigital);
1159 Controller->get_packet(ctfAUDIOTAUNT1_KEY, &use_taunt[0]);
1160 Controller->get_packet(ctfAUDIOTAUNT2_KEY, &use_taunt[1]);
1161 Controller->get_packet(ctfAUDIOTAUNT3_KEY, &use_taunt[2]);
1162 Controller->get_packet(ctfAUDIOTAUNT4_KEY, &use_taunt[3]);
1163
1164 Controller->get_packet(ctfTOGGLE_SLIDEKEY, &key_slide1);
1165 Controller->get_packet(ctfTOGGLE_BANKKEY, &key_bank);
1166
1167 // check modifiers like toggles
1168 if (key_slide1.value) {
1169 controls->toggle_slide = true;
1170 }
1171 if (key_bank.value) {
1172 controls->toggle_bank = true;
1173 }
1174
1175 // downcount, only once for audiotaunts
1176 if (use_taunt[0].value != 0.0f) {
1177 MultiSendRequestPlayTaunt(0);
1178 }
1179 if (use_taunt[1].value != 0.0f) {
1180 MultiSendRequestPlayTaunt(1);
1181 }
1182 if (use_taunt[2].value != 0.0f) {
1183 MultiSendRequestPlayTaunt(2);
1184 }
1185 if (use_taunt[3].value != 0.0f) {
1186 MultiSendRequestPlayTaunt(3);
1187 }
1188
1189 // these are all down count values (so do operation X times)
1190 for (i = 0; i < (int)prev_cntm_key.value; i++)
1191 CounterMeasuresSwitch(false);
1192
1193 for (i = 0; i < (int)next_cntm_key.value; i++)
1194 CounterMeasuresSwitch(true);

Callers 1

DoMiscFunction · 0.85

Calls 13

CounterMeasuresSwitchFunction · 0.85
UseCountermeasureFunction · 0.85
AddHUDMessageFunction · 0.85
InventorySwitchFunction · 0.85
FindObjectIDNameFunction · 0.85
DoEnergyToShieldsFunction · 0.85
UseInventoryItemFunction · 0.85
SizeMethod · 0.80
GetPosNameMethod · 0.80
GetPosTypeIDMethod · 0.80

Tested by

no test coverage detected