1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-23 22:37:55 +02:00

Improvement for wandering monster tooltip/hover text:

- show Visions information only on right-click (H3 logic)
- show threat level only on right-click and only if UI tweaks are on
This commit is contained in:
Ivan Savenko
2023-11-02 15:49:21 +02:00
parent 2bf599bbee
commit f039b20653
3 changed files with 58 additions and 26 deletions

View File

@@ -515,14 +515,16 @@ CreatureTooltip::CreatureTooltip(Point pos, const CGCreature * creature)
{
OBJ_CONSTRUCTION_CAPTURING_ALL_NO_DISPOSE;
auto creatureData = (*CGI->creh)[creature->stacks.begin()->second->getCreatureID()].get();
creatureImage = std::make_shared<CAnimImage>(graphics->getAnimation(AnimationPath::builtin("TWCRPORT")), creatureData->getIconIndex());
auto creatureID = creature->getCreature();
int32_t creatureIconIndex = CGI->creatures()->getById(creatureID)->getIconIndex();
creatureImage = std::make_shared<CAnimImage>(graphics->getAnimation(AnimationPath::builtin("TWCRPORT")), creatureIconIndex);
creatureImage->center(Point(parent->pos.x + parent->pos.w / 2, parent->pos.y + creatureImage->pos.h / 2 + 11));
bool isHeroSelected = LOCPLINT->localState->getCurrentHero() != nullptr;
std::string textContent = isHeroSelected
? creature->getHoverText(LOCPLINT->localState->getCurrentHero())
: creature->getHoverText(LOCPLINT->playerID);
? creature->getPopupText(LOCPLINT->localState->getCurrentHero())
: creature->getPopupText(LOCPLINT->playerID);
//TODO: window is bigger than OH3
//TODO: vertical alignment does not match H3. Commented below example that matches H3 for creatures count but supports only 1 line: