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

Function SetPrimaryWeapon

Descent3/weapon.cpp:1073–1101  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1071}
1072
1073void SetPrimaryWeapon(int index, int slot) {
1074 dynamic_wb_info *p_dwb = &Player_object->dynamic_wb[index];
1075
1076 if (index < NUM_PRIMARY_SLOTS)
1077 Weapon_slot_mask &= ~(1 << slot);
1078 else
1079 Weapon_slot_mask |= (1 << slot);
1080
1081 if (index != Players[Player_num].weapon[PW_PRIMARY].index) {
1082 ClearPlayerFiring(Player_object, PW_PRIMARY);
1083 Players[Player_num].weapon[PW_PRIMARY].index = index;
1084
1085 AddHUDMessage(TXT_WPNSELECT, TXT(Static_weapon_names_msg[index]));
1086 // SetGaugeModified(GGF_PRIMARYLOAD, true);
1087 Sound_system.Play2dSound(SOUND_CHANGE_PRIMARY);
1088
1089 ain_hear hear;
1090 hear.f_directly_player = true;
1091 hear.hostile_level = 0.2f;
1092 hear.curiosity_level = 0.5f;
1093 hear.max_dist = AI_SOUND_SHORT_DIST;
1094 AINotify(&Objects[Players[Player_num].objnum], AIN_HEAR_NOISE, (void *)&hear);
1095
1096 // Stop any firing activity
1097 p_dwb->last_fire_time = Gametime;
1098 // resets reticle to current weapon.
1099 ResetReticle();
1100 }
1101}
1102
1103void SetSecondaryWeapon(int index, int slot) {
1104 dynamic_wb_info *p_dwb = &Player_object->dynamic_wb[index];

Callers 1

SelectPrimaryWeaponFunction · 0.85

Calls 5

ClearPlayerFiringFunction · 0.85
AddHUDMessageFunction · 0.85
AINotifyFunction · 0.85
ResetReticleFunction · 0.85
Play2dSoundMethod · 0.80

Tested by

no test coverage detected