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

Method activateModule

src/interface/interface.cpp:1281–1358  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1279}
1280
1281void Player::GUI_t::activateModule(Player::GUI_t::GUIModules module)
1282{
1283 GUIModules oldModule = activeModule;
1284 activeModule = module;
1285
1286 if ( oldModule != activeModule )
1287 {
1288 Frame* hudCursor = nullptr;
1289 if ( player.hud.cursorFrame )
1290 {
1291 hudCursor = player.hud.cursorFrame->findFrame("hud cursor");
1292 }
1293 if ( hudCursor && player.inventoryUI.selectedItemCursorFrame )
1294 {
1295 if ( (oldModule == MODULE_INVENTORY
1296 || oldModule == MODULE_HOTBAR
1297 || oldModule == MODULE_SPELLS
1298 || oldModule == MODULE_CHEST
1299 || oldModule == MODULE_SHOP
1300 || oldModule == MODULE_ALCHEMY
1301 || oldModule == MODULE_MAILBOX
1302 || oldModule == MODULE_TINKERING
1303 || oldModule == MODULE_FEATHER
1304 || oldModule == MODULE_ASSISTSHRINE)
1305 && !(activeModule == MODULE_INVENTORY
1306 || activeModule == MODULE_HOTBAR
1307 || activeModule == MODULE_SPELLS
1308 || activeModule == MODULE_CHEST
1309 || activeModule == MODULE_SHOP
1310 || activeModule == MODULE_ALCHEMY
1311 || activeModule == MODULE_MAILBOX
1312 || activeModule == MODULE_TINKERING
1313 || activeModule == MODULE_FEATHER
1314 || activeModule == MODULE_ASSISTSHRINE)
1315 && !bActiveModuleHasNoCursor()
1316 && hoveringOverModuleButton() == MODULE_NONE )
1317 {
1318 SDL_Rect size = player.inventoryUI.selectedItemCursorFrame->getSize();
1319 if ( !player.inventoryUI.selectedItemCursorFrame->isDisabled() )
1320 {
1321 size.x += player.hud.cursor.cursorToSlotOffset;
1322 size.y += player.hud.cursor.cursorToSlotOffset;
1323 size.w -= (2 * (player.hud.cursor.cursorToSlotOffset) - 1);
1324 size.h -= (2 * (player.hud.cursor.cursorToSlotOffset) - 1);
1325 player.hud.updateCursorAnimation(size.x, size.y, size.w, size.h, true);
1326 }
1327 }
1328 else if ( ((activeModule == MODULE_INVENTORY
1329 || activeModule == MODULE_HOTBAR
1330 || activeModule == MODULE_SPELLS
1331 || activeModule == MODULE_CHEST
1332 || activeModule == MODULE_SHOP
1333 || activeModule == MODULE_ALCHEMY
1334 || activeModule == MODULE_MAILBOX
1335 || activeModule == MODULE_TINKERING
1336 || activeModule == MODULE_FEATHER
1337 || activeModule == MODULE_ASSISTSHRINE)
1338 && !(oldModule == MODULE_INVENTORY

Callers 15

actChestMethod · 0.80
selectHotbarSlotMethod · 0.80
net.cppFile · 0.80
closeShopMethod · 0.80
openStatusScreenMethod · 0.80
closeAllGUIsMethod · 0.80
openGUIMethod · 0.80
closeTinkerMenuMethod · 0.80
onTinkerChangeTabActionFunction · 0.80

Calls 3

findFrameMethod · 0.80
getSizeMethod · 0.80
isDisabledMethod · 0.45

Tested by

no test coverage detected