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

Function InventorySwitch

Descent3/Inventory.cpp:1332–1359  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

1330
1331// moves to the next/prev item in the inventory list (forward==TRUE means forward, forward==FALSE means go backwards)
1332void InventorySwitch(bool forward) {
1333 int ctype, cid;
1334
1335 Players[Player_num].inventory.GetPosTypeID(ctype, cid);
1336
1337 if (ctype != 0) {
1338 if (forward) {
1339 Players[Player_num].inventory.NextPos();
1340 } else {
1341 Players[Player_num].inventory.PrevPos();
1342 }
1343
1344 int ntype, nid;
1345 Players[Player_num].inventory.GetPosTypeID(ntype, nid);
1346
1347 if (ntype != ctype || nid != cid) {
1348 // AddHUDMessage(TXT_WPNSELECT, Players[Player_num].inventory.GetPosName());
1349 Sound_system.Play2dSound(SOUND_CHANGE_INVENTORY);
1350
1351 ain_hear hear;
1352 hear.f_directly_player = true;
1353 hear.hostile_level = 0.0f;
1354 hear.curiosity_level = 0.3f;
1355 hear.max_dist = AI_SOUND_SHORT_DIST;
1356 AINotify(&Objects[Players[Player_num].objnum], AIN_HEAR_NOISE, (void *)&hear);
1357 }
1358 }
1359}
1360
1361// moves to the next/prev item in the counter measures list (forward==TRUE means forward, forward==FALSE means go
1362// backwards)

Callers 2

DoKeyboardMiscFunction · 0.85
DoControllerMiscFunction · 0.85

Calls 5

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

Tested by

no test coverage detected