| 4438 | } |
| 4439 | |
| 4440 | void Player::HUD_t::updateFrameTooltip(Item* item, const int x, const int y, int justify, Frame* parentFrame) |
| 4441 | { |
| 4442 | const int player = this->player.playernum; |
| 4443 | if ( !item ) |
| 4444 | { |
| 4445 | return; |
| 4446 | } |
| 4447 | |
| 4448 | Frame* tooltipContainerFrame = nullptr; |
| 4449 | Frame* frameMain = nullptr; |
| 4450 | Frame* frameInventory = nullptr; |
| 4451 | Frame* frameInteract = nullptr; |
| 4452 | Frame* frameTooltipPrompt = nullptr; |
| 4453 | Frame* titleOnlyFrame = nullptr; |
| 4454 | if ( parentFrame != nullptr ) |
| 4455 | { |
| 4456 | // hacks for compendium tooltips |
| 4457 | char name[32]; |
| 4458 | snprintf(name, sizeof(name), "player tooltip container %d", 0); |
| 4459 | if ( tooltipContainerFrame = parentFrame->findFrame(name) ) |
| 4460 | { |
| 4461 | snprintf(name, sizeof(name), "player title only tooltip %d", 0); |
| 4462 | titleOnlyFrame = tooltipContainerFrame->findFrame(name); |
| 4463 | snprintf(name, sizeof(name), "player tooltip %d", 0); |
| 4464 | frameMain = tooltipContainerFrame->findFrame(name); |
| 4465 | snprintf(name, sizeof(name), "player interact %d", 0); |
| 4466 | frameInteract = parentFrame->findFrame(name); |
| 4467 | snprintf(name, sizeof(name), "player item prompt %d", 0); |
| 4468 | frameTooltipPrompt = tooltipContainerFrame->findFrame(name); |
| 4469 | } |
| 4470 | } |
| 4471 | else |
| 4472 | { |
| 4473 | tooltipContainerFrame = this->player.inventoryUI.tooltipContainerFrame; |
| 4474 | frameMain = this->player.inventoryUI.tooltipFrame; |
| 4475 | frameInventory = this->player.inventoryUI.frame; |
| 4476 | frameInteract = this->player.inventoryUI.interactFrame; |
| 4477 | frameTooltipPrompt = this->player.inventoryUI.tooltipPromptFrame; |
| 4478 | titleOnlyFrame = this->player.inventoryUI.titleOnlyTooltipFrame; |
| 4479 | if ( !frameInventory ) |
| 4480 | { |
| 4481 | return; |
| 4482 | } |
| 4483 | } |
| 4484 | |
| 4485 | bool compendiumTooltip = false; |
| 4486 | if ( parentFrame && !strcmp(parentFrame->getName(), "compendium") ) |
| 4487 | { |
| 4488 | compendiumTooltip = true; |
| 4489 | } |
| 4490 | |
| 4491 | if ( tooltipContainerFrame ) |
| 4492 | { |
| 4493 | if ( compendiumTooltip ) |
| 4494 | { |
| 4495 | tooltipContainerFrame->setSize(SDL_Rect{ 0, 0, parentFrame->getSize().w, parentFrame->getSize().h }); |
| 4496 | } |
| 4497 | else |
no test coverage detected