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

Function SetSecondaryWeapon

Descent3/weapon.cpp:1103–1134  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1101}
1102
1103void SetSecondaryWeapon(int index, int slot) {
1104 dynamic_wb_info *p_dwb = &Player_object->dynamic_wb[index];
1105
1106 if (index < (NUM_SECONDARY_SLOTS + SECONDARY_INDEX))
1107 Weapon_slot_mask &= ~(1 << slot);
1108 else
1109 Weapon_slot_mask |= (1 << slot);
1110
1111 // Stop any firing activity
1112 ClearPlayerFiring(Player_object, PW_SECONDARY);
1113
1114 if (index != Players[Player_num].weapon[PW_SECONDARY].index) {
1115 Players[Player_num].weapon[PW_SECONDARY].index = index;
1116
1117 AddHUDMessage(TXT_WPNSELECT, TXT(Static_weapon_names_msg[index]));
1118 // SetGaugeModified(GGF_SECONDARYLOAD, true);
1119 Sound_system.Play2dSound(SOUND_CHANGE_SECONDARY);
1120
1121 ain_hear hear;
1122 hear.f_directly_player = true;
1123 hear.hostile_level = 0.1f;
1124 hear.curiosity_level = 0.3f;
1125 hear.max_dist = AI_SOUND_SHORT_DIST;
1126 AINotify(&Objects[Players[Player_num].objnum], AIN_HEAR_NOISE, (void *)&hear);
1127
1128 // Stop any firing activity
1129 ClearPlayerFiring(Player_object, PW_SECONDARY);
1130 p_dwb->last_fire_time = Gametime;
1131 // resets reticle to current weapon.
1132 ResetReticle();
1133 }
1134}
1135
1136///////////////////////////////////////////////////////////////////////////
1137// Weapon AUTO selection

Callers 1

SelectSecondaryWeaponFunction · 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