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

Function DoControllerWeapons

Descent3/Controls.cpp:1061–1105  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1059}
1060
1061void DoControllerWeapons(game_controls *controls) {
1062 ct_packet fire_primary_count, fire_primary_time;
1063 ct_packet fire_secondary_count, fire_secondary_time;
1064 ct_packet fire_flare_count;
1065 ct_packet cycle_prim, cycle_sec;
1066 ct_packet automap_key;
1067 int i;
1068
1069 // read controls
1070 Controller->get_packet(ctfFIREPRIMARY_BUTTON, &fire_primary_time);
1071 Controller->get_packet(ctfFIREPRIMARY_BUTTON, &fire_primary_count, ctDownCount);
1072 Controller->get_packet(ctfFIRESECONDARY_BUTTON, &fire_secondary_time);
1073 Controller->get_packet(ctfFIRESECONDARY_BUTTON, &fire_secondary_count, ctDownCount);
1074 Controller->get_packet(ctfFIREFLARE_BUTTON, &fire_flare_count, ctDownCount);
1075 Controller->get_packet(ctfWPNSEL_PCYCLEBTN, &cycle_prim);
1076 Controller->get_packet(ctfWPNSEL_SCYCLEBTN, &cycle_sec);
1077 Controller->get_packet(ctfAUTOMAP_BUTTON, &automap_key);
1078
1079 // weapon fire
1080 if (fire_primary_count.value > 0 || fire_primary_time.value) {
1081 controls->fire_primary_down_state = true;
1082 controls->fire_primary_down_count = (int)fire_primary_count.value;
1083 controls->fire_primary_down_time = fire_primary_time.value;
1084 }
1085 if (fire_secondary_count.value > 0 || fire_secondary_time.value) {
1086 controls->fire_secondary_down_count = (int)fire_secondary_count.value;
1087 controls->fire_secondary_down_time = fire_secondary_time.value;
1088 }
1089
1090 // Flare
1091 if (fire_flare_count.value > 0)
1092 controls->fire_flare_down_count = (int)fire_flare_count.value;
1093
1094 // automap
1095 if (automap_key.value) {
1096 Game_interface_mode = GAME_TELCOM_AUTOMAP;
1097 }
1098
1099 // do cycling weapons
1100 for (i = 0; i < (int)cycle_prim.value; i++)
1101 SwitchPlayerWeapon(PW_PRIMARY);
1102
1103 for (i = 0; i < (int)cycle_sec.value; i++)
1104 SwitchPlayerWeapon(PW_SECONDARY);
1105}
1106
1107void DoMisc(game_controls *controls) {
1108 controls->toggle_slide = false;

Callers 1

DoWeaponsFunction · 0.85

Calls 2

SwitchPlayerWeaponFunction · 0.85
get_packetMethod · 0.45

Tested by

no test coverage detected