MCPcopy Create free account
hub / github.com/TurningWheel/Barony / handleModuleNavigation

Method handleModuleNavigation

src/player.cpp:1286–2096  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1284}
1285
1286Player::GUI_t::GUIModules Player::GUI_t::handleModuleNavigation(bool checkDestinationOnly, bool checkLeftNavigation)
1287{
1288 auto& input = Input::inputs[player.playernum];
1289 if ( player.shootmode || gamePaused || !inputs.hasController(player.playernum)
1290 || nohud || !player.isLocalPlayer() )
1291 {
1292 if ( !checkDestinationOnly )
1293 {
1294 input.consumeBinaryToggle("UINavLeftBumper");
1295 input.consumeBinaryToggle("UINavRightBumper");
1296 }
1297 return MODULE_NONE;
1298 }
1299
1300 bool bCompactView = false;
1301 if ( player.bUseCompactGUIHeight() || player.bUseCompactGUIWidth() )
1302 {
1303 bCompactView = true;
1304 }
1305
1306 if ( input.binaryToggle("UINavLeftBumper")
1307 || (checkLeftNavigation && checkDestinationOnly) )
1308 {
1309 if ( activeModule == MODULE_INVENTORY
1310 && (player.inventoryUI.bFirstTimeSnapCursor || checkDestinationOnly ) )
1311 {
1312 if ( player.shopGUI.bOpen && player.gui_mode == GUI_MODE_SHOP )
1313 {
1314 if ( inputs.getUIInteraction(player.playernum)->selectedItem )
1315 {
1316 if ( !checkDestinationOnly ) // no action
1317 {
1318 activateModule(MODULE_INVENTORY);
1319 warpControllerToModule(false);
1320 input.consumeBinaryToggle("UINavLeftBumper");
1321 inputs.getVirtualMouse(player.playernum)->draw_cursor = false;
1322 soundModuleNavigation();
1323 }
1324 return MODULE_INVENTORY;
1325 }
1326 else
1327 {
1328 if ( !checkDestinationOnly )
1329 {
1330 player.inventory_mode = INVENTORY_MODE_ITEM;
1331 activateModule(MODULE_SHOP);
1332 warpControllerToModule(false);
1333 input.consumeBinaryToggle("UINavLeftBumper");
1334 inputs.getVirtualMouse(player.playernum)->draw_cursor = false;
1335 soundModuleNavigation();
1336 }
1337 return MODULE_SHOP;
1338 }
1339 }
1340 else if ( GenericGUI[player.playernum].tinkerGUI.bOpen )
1341 {
1342 return MODULE_NONE;
1343 }

Callers 1

ingameHudFunction · 0.80

Calls 10

hasControllerMethod · 0.80
isLocalPlayerMethod · 0.80
bUseCompactGUIHeightMethod · 0.80
bUseCompactGUIWidthMethod · 0.80
getUIInteractionMethod · 0.80
getVirtualMouseMethod · 0.80
consumeBinaryToggleMethod · 0.45
binaryToggleMethod · 0.45
isActiveMethod · 0.45

Tested by

no test coverage detected