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

Method updateRecipePanel

src/interface/interface.cpp:20654–21045  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

20652}
20653
20654void GenericGUIMenu::AlchemyGUI_t::AlchemyRecipes_t::updateRecipePanel()
20655{
20656 Frame* recipeFrame = alchemy.recipesFrame;
20657 if ( !recipeFrame ) { return; }
20658
20659 const int player = alchemy.parentGUI.getPlayer();
20660 const int slotSize = players[player]->inventoryUI.getSlotSize();
20661 if ( !recipeFrame->isDisabled() && bOpen )
20662 {
20663 const real_t fpsScale = getFPSScale(50.0); // ported from 50Hz
20664 real_t setpointDiffX = fpsScale * std::max(.01, (1.0 - animx)) / 2.0;
20665 animx += setpointDiffX;
20666 animx = std::min(1.0, animx);
20667 if ( animx >= .9999 )
20668 {
20669 if ( !bFirstTimeSnapCursor )
20670 {
20671 bFirstTimeSnapCursor = true;
20672 if ( !inputs.getUIInteraction(player)->selectedItem
20673 && players[player]->GUI.activeModule == Player::GUI_t::MODULE_ALCHEMY )
20674 {
20675 //player.inventoryUI.warpMouseToSelectedSpell(nullptr, (Inputs::SET_CONTROLLER));
20676 }
20677 }
20678 isInteractable = true;
20679 }
20680 }
20681 else
20682 {
20683 animx = 0.0;
20684 isInteractable = false;
20685 scrollInertia = 0.0;
20686 }
20687
20688 auto baseFrame = recipeFrame->findFrame("recipe base");
20689 auto bacBackgroundImgFrame = recipeFrame->findFrame("recipe img frame");
20690 auto baseBackgroundImg = bacBackgroundImgFrame->findImage("recipe base img");
20691 baseBackgroundImg->path = "*#images/ui/Alchemy/Alchemy_Recipes_00.png";
20692 bool reversed = false;
20693 auto recipeFramePos = recipeFrame->getSize();
20694 static ConsoleVariable<int> cvar_alchemy_recipeOffsetX("/alch_recipe_offsetx", 8);
20695 static ConsoleVariable<int> cvar_alchemy_recipeOffsetY("/alch_recipe_offsety", 14);
20696 const int frameOffsetX = *cvar_alchemy_recipeOffsetX;
20697 const int frameOffsetY = *cvar_alchemy_recipeOffsetY;
20698 if ( players[player]->inventoryUI.inventoryPanelJustify == Player::PANEL_JUSTIFY_LEFT )
20699 {
20700 auto baseFrame = alchemy.alchFrame->findFrame("alchemy base");
20701 if ( players[player]->bUseCompactGUIWidth() )
20702 {
20703 recipeFramePos.x = baseFrame->getSize().x - animx * recipeFramePos.w + frameOffsetX;
20704 baseBackgroundImg->path = "*#images/ui/Alchemy/Alchemy_RecipesReverse_00.png";
20705 reversed = true;
20706 }
20707 else
20708 {
20709 recipeFramePos.x = baseFrame->getSize().x + baseFrame->getSize().w + animx * recipeFramePos.w - recipeFramePos.w - frameOffsetX;
20710 }
20711 }

Callers 1

updateAlchemyMenuMethod · 0.80

Calls 15

getFPSScaleFunction · 0.85
buildRecipeListFunction · 0.85
makeColorFunction · 0.85
hideRecipeFromListFunction · 0.85
uidToItemFunction · 0.85
getUIInteractionMethod · 0.80
findFrameMethod · 0.80
findImageMethod · 0.80
getSizeMethod · 0.80
bUseCompactGUIWidthMethod · 0.80
findSliderMethod · 0.80

Tested by

no test coverage detected