| 25390 | } |
| 25391 | |
| 25392 | void GenericGUIMenu::ItemEffectGUI_t::updateItemEffectMenu() |
| 25393 | { |
| 25394 | const int playernum = parentGUI.getPlayer(); |
| 25395 | auto player = players[playernum]; |
| 25396 | |
| 25397 | if ( !player->isLocalPlayer() ) |
| 25398 | { |
| 25399 | closeItemEffectMenu(); |
| 25400 | return; |
| 25401 | } |
| 25402 | |
| 25403 | if ( !itemEffectFrame ) |
| 25404 | { |
| 25405 | return; |
| 25406 | } |
| 25407 | |
| 25408 | itemEffectFrame->setSize(SDL_Rect{ players[playernum]->camera_virtualx1(), |
| 25409 | players[playernum]->camera_virtualy1(), |
| 25410 | tinkerBaseWidth, |
| 25411 | players[playernum]->camera_virtualHeight() }); |
| 25412 | |
| 25413 | if ( !itemEffectFrame->isDisabled() && bOpen ) |
| 25414 | { |
| 25415 | if ( player->inventoryUI.getSelectedSlotY() < 0 && player->inventoryUI.bCompactView ) |
| 25416 | { |
| 25417 | if ( !panelJustifyInverted ) |
| 25418 | { |
| 25419 | animx = 0.0; // reinit animation |
| 25420 | } |
| 25421 | panelJustifyInverted = true; |
| 25422 | } |
| 25423 | else |
| 25424 | { |
| 25425 | if ( panelJustifyInverted ) |
| 25426 | { |
| 25427 | animx = 0.0; // reinit animation |
| 25428 | } |
| 25429 | panelJustifyInverted = false; |
| 25430 | } |
| 25431 | |
| 25432 | if ( !ItemEffectHasBeenCreated() ) |
| 25433 | { |
| 25434 | createItemEffectMenu(); |
| 25435 | } |
| 25436 | |
| 25437 | const real_t fpsScale = getFPSScale(50.0); // ported from 50Hz |
| 25438 | real_t setpointDiffX = fpsScale * std::max(.01, (1.0 - animx)) / 2.0; |
| 25439 | animx += setpointDiffX; |
| 25440 | animx = std::min(1.0, animx); |
| 25441 | if ( animx >= .9999 ) |
| 25442 | { |
| 25443 | if ( !bFirstTimeSnapCursor ) |
| 25444 | { |
| 25445 | bFirstTimeSnapCursor = true; |
| 25446 | //if ( !inputs.getUIInteraction(playernum)->selectedItem |
| 25447 | // && player->GUI.activeModule == Player::GUI_t::MODULE_TINKERING ) |
| 25448 | //{ |
| 25449 | // warpMouseToSelectedTinkerItem(nullptr, (Inputs::SET_CONTROLLER)); |
no test coverage detected