[Solved] Hide some tooltip info on doors, containers, and NPC

Feedback on past, current, and future development.
Post Reply
guigui
Posts: 33
Joined: 12 Apr 2020, 12:22

[Solved] Hide some tooltip info on doors, containers, and NPC

Post by guigui »

Hi!

I want to hide the trapped/locked/unlocked/destination infos on doors and containers, when you pass the crosshair on them. Same thing for the NPC names info.

I find something in mwclass/door.cpp:

Code: Select all

    MWGui::ToolTipInfo Door::getToolTipInfo(const MWWorld::ConstPtr& ptr, int count) const
    {
        const MWWorld::LiveCellRef<ESM::Door>* ref = ptr.get<ESM::Door>();

        MWGui::ToolTipInfo info;
        std::string_view name = getName(ptr);
        info.caption = MyGUI::TextIterator::toTagsString(MWGui::toUString(name));

        std::string text;

        if (ptr.getCellRef().getTeleport())
        {
            text += "\n#{sTo}";
            text += "\n" + getDestination(*ref);
        }

        int lockLevel = ptr.getCellRef().getLockLevel();
        if (lockLevel > 0 && lockLevel != ESM::UnbreakableLock)
            text += "\n#{sLockLevel}: " + MWGui::ToolTips::toString(ptr.getCellRef().getLockLevel());
        else if (ptr.getCellRef().getLockLevel() < 0)
            text += "\n#{sUnlocked}";
        if (!ptr.getCellRef().getTrap().empty())
            text += "\n#{sTrapped}";

        if (MWBase::Environment::get().getWindowManager()->getFullHelp())
        {
            text += MWGui::ToolTips::getCellRefString(ptr.getCellRef());
            text += MWGui::ToolTips::getMiscString(ref->mBase->mScript, "Script");
        }
        info.text = text;

        return info;
    }
same principle for mwclass/container.cpp .

So i imagine i just have to comment the corresponding lines, for example:

Code: Select all

            //text += "\n#{sTo}";
            //text += "\n" + getDestination(*ref);
        }

        int lockLevel = ptr.getCellRef().getLockLevel();
        if (lockLevel > 0 && lockLevel != ESM::UnbreakableLock)
            //text += "\n#{sLockLevel}: " + MWGui::ToolTips::toString(ptr.getCellRef().getLockLevel());
        else if (ptr.getCellRef().getLockLevel() < 0)
            //text += "\n#{sUnlocked}";
        if (!ptr.getCellRef().getTrap().empty())
            //text += "\n#{sTrapped}";
and recompile openmw.

It's ok?
Is there another solution without recompilation?

Concerning the NPC names, i just find mwgui/tooltips.hpp:

Code: Select all

        static std::string getSoulString(const MWWorld::CellRef& cellref);
        ///< Returns a string containing the name of the creature that the ID in the cellref's soul field belongs to.

Code: Select all

        // these do not create an actual tooltip, but they fill in the data that is required so the tooltip
        // system knows what to show in case this widget is hovered
        static void createSkillToolTip(MyGUI::Widget* widget, int skillId);
        static void createAttributeToolTip(MyGUI::Widget* widget, int attributeId);
        static void createSpecializationToolTip(MyGUI::Widget* widget, const std::string& name, int specId);
        static void createBirthsignToolTip(MyGUI::Widget* widget, const std::string& birthsignId);
        static void createRaceToolTip(MyGUI::Widget* widget, const ESM::Race* playerRace);
        static void createClassToolTip(MyGUI::Widget* widget, const ESM::Class& playerClass);
        static void createMagicEffectToolTip(MyGUI::Widget* widget, short id);
and mwclass/npc.ccp :

Code: Select all

    MWGui::ToolTipInfo Npc::getToolTipInfo(const MWWorld::ConstPtr& ptr, int count) const
    {
        const MWWorld::LiveCellRef<ESM::NPC>* ref = ptr.get<ESM::NPC>();

        bool fullHelp = MWBase::Environment::get().getWindowManager()->getFullHelp();
        MWGui::ToolTipInfo info;

        std::string_view name = getName(ptr);
        info.caption = MyGUI::TextIterator::toTagsString(MWGui::toUString(name));
        if (fullHelp && !ref->mBase->mName.empty() && ptr.getRefData().getCustomData()
            && ptr.getRefData().getCustomData()->asNpcCustomData().mNpcStats.isWerewolf())
        {
            info.caption += " (";
            info.caption += MyGUI::TextIterator::toTagsString(ref->mBase->mName);
            info.caption += ")";
        }

        if (fullHelp)
            info.text = MWGui::ToolTips::getMiscString(ref->mBase->mScript, "Script");

        return info;
    }
What can i do to hide the NPC names from the crosshair? <std::string_view name = "";> in place of <std::string_view name = getName(ptr);> ?
Another solution?

Thanks!
Last edited by guigui on 04 Mar 2023, 18:26, edited 1 time in total.
guigui
Posts: 33
Joined: 12 Apr 2020, 12:22

Re: Hide some tooltip info on doors, containers, and NPC

Post by guigui »

I have the answers to my questions:

To hide the trapped/locked/unlocked/destination infos on doors and containers, i must comment all the "if" function; example in mwclass/door.cpp:

// if (ptr.getCellRef().getTeleport())
// {
// text += "\n#{sTo}";
// text += "\n" + getDestination(*ref);
// }

int lockLevel = ptr.getCellRef().getLockLevel();
// if (lockLevel > 0 && lockLevel != ESM::UnbreakableLock)
// text += "\n#{sLockLevel}: " + MWGui::ToolTips::toString(ptr.getCellRef().getLockLevel());
// else if (ptr.getCellRef().getLockLevel() < 0)
// text += "\n#{sUnlocked}";
// if (!ptr.getCellRef().getTrap().empty())
// text += "\n#{sTrapped}";


Concerning the hiding of the NPC names, yes, just edit this mwclass/npc.ccp line:
std::string_view name = getName(ptr);
to
std::string_view name = "";


then build and install the OpenMW package.

Example for Arch Linux:
1) cd /your_user_folder/the_path_you_choose_to_put_the_softwares_source_files/
2) git clone https://aur.archlinux.org/openmw-git.git
3) cd openmw-git
4) makepkg -o
5) [edit the files you want...]
6) makepkg -sefi
Post Reply