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

Function CounterMeasuresSwitch

Descent3/Inventory.cpp:1363–1390  ·  view source on GitHub ↗

moves to the next/prev item in the counter measures list (forward==TRUE means forward, forward==FALSE means go backwards)

Source from the content-addressed store, hash-verified

1361// moves to the next/prev item in the counter measures list (forward==TRUE means forward, forward==FALSE means go
1362// backwards)
1363void CounterMeasuresSwitch(bool forward) {
1364 int ctype, cid;
1365
1366 Players[Player_num].counter_measures.GetPosTypeID(ctype, cid);
1367
1368 if (ctype != 0) {
1369 if (forward) {
1370 Players[Player_num].counter_measures.NextPos();
1371 } else {
1372 Players[Player_num].counter_measures.PrevPos();
1373 }
1374
1375 int ntype, nid;
1376 Players[Player_num].counter_measures.GetPosTypeID(ntype, nid);
1377
1378 if (ntype != ctype || nid != cid) {
1379 AddHUDMessage(TXT_WPNSELECT, Players[Player_num].counter_measures.GetPosName());
1380 Sound_system.Play2dSound(SOUND_CHANGE_COUNTERMEASURE);
1381
1382 ain_hear hear;
1383 hear.f_directly_player = true;
1384 hear.hostile_level = 0.0f;
1385 hear.curiosity_level = 0.3f;
1386 hear.max_dist = AI_SOUND_SHORT_DIST;
1387 AINotify(&Objects[Players[Player_num].objnum], AIN_HEAR_NOISE, (void *)&hear);
1388 }
1389 }
1390}
1391
1392// repositions the pos so its in the correct spot
1393void Inventory::ValidatePos(bool forward) {

Callers 2

DoKeyboardMiscFunction · 0.85
DoControllerMiscFunction · 0.85

Calls 7

AddHUDMessageFunction · 0.85
AINotifyFunction · 0.85
GetPosTypeIDMethod · 0.80
NextPosMethod · 0.80
PrevPosMethod · 0.80
GetPosNameMethod · 0.80
Play2dSoundMethod · 0.80

Tested by

no test coverage detected