示例#1
0
void HUD::setValue(const std::string& id, const MWMechanics::DynamicStat<int>& value)
{
    static const char *ids[] =
    {
        "HBar", "MBar", "FBar", 0
    };

    for (int i=0; ids[i]; ++i)
        if (ids[i]==id)
        {
            switch (i)
            {
                case 0:
                    health->setProgressRange (value.getModified());
                    health->setProgressPosition (value.getCurrent());
                    break;
                case 1:
                    magicka->setProgressRange (value.getModified());
                    magicka->setProgressPosition (value.getCurrent());
                    break;
                case 2:
                    stamina->setProgressRange (value.getModified());
                    stamina->setProgressPosition (value.getCurrent());
                    break;
            }
        }
}
示例#2
0
文件: hud.cpp 项目: zeidrich/openmw
void HUD::setValue(const std::string& id, const MWMechanics::DynamicStat<float>& value)
{
    static const char *ids[] =
    {
        "HBar", "MBar", "FBar", 0
    };

    for (int i=0; ids[i]; ++i)
        if (ids[i]==id)
        {
            MyGUI::Widget* w;
            std::string valStr = boost::lexical_cast<std::string>(value.getCurrent()) + "/" + boost::lexical_cast<std::string>(value.getModified());
            switch (i)
            {
                case 0:
                    mHealth->setProgressRange (value.getModified());
                    mHealth->setProgressPosition (value.getCurrent());
                    getWidget(w, "HealthFrame");
                    w->setUserString("Caption_HealthDescription", "#{sHealthDesc}\n" + valStr);
                    break;
                case 1:
                    mMagicka->setProgressRange (value.getModified());
                    mMagicka->setProgressPosition (value.getCurrent());
                    getWidget(w, "MagickaFrame");
                    w->setUserString("Caption_HealthDescription", "#{sIntDesc}\n" + valStr);
                    break;
                case 2:
                    mStamina->setProgressRange (value.getModified());
                    mStamina->setProgressPosition (value.getCurrent());
                    getWidget(w, "FatigueFrame");
                    w->setUserString("Caption_HealthDescription", "#{sFatDesc}\n" + valStr);
                    break;
            }
        }
}
示例#3
0
文件: hud.cpp 项目: AAlderman/openmw
    void HUD::setValue(const std::string& id, const MWMechanics::DynamicStat<float>& value)
    {
        int current = std::max(0, static_cast<int>(value.getCurrent()));
        int modified = static_cast<int>(value.getModified());

        MyGUI::Widget* w;
        std::string valStr = MyGUI::utility::toString(current) + "/" + MyGUI::utility::toString(modified);
        if (id == "HBar")
        {
            mHealth->setProgressRange(modified);
            mHealth->setProgressPosition(current);
            getWidget(w, "HealthFrame");
            w->setUserString("Caption_HealthDescription", "#{sHealthDesc}\n" + valStr);
        }
        else if (id == "MBar")
        {
            mMagicka->setProgressRange (modified);
            mMagicka->setProgressPosition (current);
            getWidget(w, "MagickaFrame");
            w->setUserString("Caption_HealthDescription", "#{sIntDesc}\n" + valStr);
        }
        else if (id == "FBar")
        {
            mStamina->setProgressRange (modified);
            mStamina->setProgressPosition (current);
            getWidget(w, "FatigueFrame");
            w->setUserString("Caption_HealthDescription", "#{sFatDesc}\n" + valStr);
        }
    }
示例#4
0
文件: layouts.cpp 项目: dhardy/openmw
void StatsWindow::setValue (const std::string& id, const MWMechanics::DynamicStat<int>& value)
{
    static const char *ids[] =
    {
        "HBar", "MBar", "FBar",
        0
    };

    for (int i=0; ids[i]; ++i)
        if (ids[i]==id)
        {
            std::string id (ids[i]);
            setBar (id, id + "T", value.getCurrent(), value.getModified());
        }
}
示例#5
0
void StatsWindow::setValue (const std::string& id, const MWMechanics::DynamicStat<int>& value)
{
    static const char *ids[] =
    {
        "HBar", "MBar", "FBar",
        0
    };

    for (int i=0; ids[i]; ++i)
    {
        if (ids[i]==id)
        {
            std::string id (ids[i]);
            setBar (id, id + "T", value.getCurrent(), value.getModified());

            // health, magicka, fatigue tooltip
            MyGUI::Widget* w;
            std::string valStr =  boost::lexical_cast<std::string>(value.getCurrent()) + "/" + boost::lexical_cast<std::string>(value.getModified());
            if (i==0)
            {
                getWidget(w, "Health");
                w->setUserString("Caption_HealthDescription", "#{sHealthDesc}\n" + valStr);
            }
            else if (i==1)
            {
                getWidget(w, "Magicka");
                w->setUserString("Caption_HealthDescription", "#{sIntDesc}\n" + valStr);
            }
            else if (i==2)
            {
                getWidget(w, "Fatigue");
                w->setUserString("Caption_HealthDescription", "#{sFatDesc}\n" + valStr);
            }
        }
    }
}
示例#6
0
void ReviewDialog::setFatigue(const MWMechanics::DynamicStat<float>& value)
{
    mFatigue->setValue(value.getCurrent(), value.getModified());
    std::string valStr =  boost::lexical_cast<std::string>(value.getCurrent()) + "/" + boost::lexical_cast<std::string>(value.getModified());
    mFatigue->setUserString("Caption_HealthDescription", "#{sFatDesc}\n" + valStr);
}
示例#7
0
 void ReviewDialog::setFatigue(const MWMechanics::DynamicStat<float>& value)
 {
     mFatigue->setValue(static_cast<int>(value.getCurrent()), static_cast<int>(value.getModified()));
     std::string valStr =  MyGUI::utility::toString(value.getCurrent()) + "/" + MyGUI::utility::toString(value.getModified());
     mFatigue->setUserString("Caption_HealthDescription", "#{sFatDesc}\n" + valStr);
 }
示例#8
0
文件: review.cpp 项目: dhardy/openmw
void ReviewDialog::setFatigue(const MWMechanics::DynamicStat<int>& value)
{
    fatigue->setValue(value.getCurrent(), value.getModified());
}
示例#9
0
文件: review.cpp 项目: dhardy/openmw
void ReviewDialog::setMagicka(const MWMechanics::DynamicStat<int>& value)
{
    magicka->setValue(value.getCurrent(), value.getModified());
}
示例#10
0
文件: review.cpp 项目: dhardy/openmw
void ReviewDialog::setHealth(const MWMechanics::DynamicStat<int>& value)
{
    health->setValue(value.getCurrent(), value.getModified());
}
示例#11
0
文件: actors.cpp 项目: emoose/openmw
    void Actors::update (std::vector<std::pair<std::string, Ogre::Vector3> >& movement, float duration,
        bool paused)
    {
        mDuration += duration;

        if (mDuration>=0.25)
        {
            float totalDuration = mDuration;
            mDuration = 0;
            
            std::set<MWWorld::Ptr>::iterator iter (mActors.begin());

            while (iter!=mActors.end())
            {
                if (!MWWorld::Class::get (*iter).getCreatureStats (*iter).isDead())
                {
                    updateActor (*iter, totalDuration);

                    if (iter->getTypeName()==typeid (ESM::NPC).name())
                        updateNpc (*iter, totalDuration, paused);
                }

                if (MWWorld::Class::get (*iter).getCreatureStats (*iter).isDead())
                {
                    // workaround: always keep player alive for now
                    // \todo remove workaround, once player death can be handled
                    if (iter->getRefData().getHandle()=="player")
                    {
                        MWMechanics::DynamicStat<float> stat (
                            MWWorld::Class::get (*iter).getCreatureStats (*iter).getHealth());
                            
                        if (stat.getModified()<1)
                        {
                            stat.setModified (1, 0);
                            MWWorld::Class::get (*iter).getCreatureStats (*iter).setHealth (stat);
                        }

                        MWWorld::Class::get (*iter).getCreatureStats (*iter).resurrect();
                        ++iter;
                        continue;
                    }

                    ++mDeathCount[MWWorld::Class::get (*iter).getId (*iter)];

                    MWBase::Environment::get().getWorld()->playAnimationGroup (*iter, "death1", 0);

                    if (MWWorld::Class::get (*iter).isEssential (*iter))
                        MWBase::Environment::get().getWindowManager()->messageBox (
                            "#{sKilledEssential}", std::vector<std::string>());

                    mActors.erase (iter++);
                }
                else
                    ++iter;
            }
        }

        for (std::set<MWWorld::Ptr>::iterator iter (mActors.begin()); iter!=mActors.end();
            ++iter)
        {
            Ogre::Vector3 vector = MWWorld::Class::get (*iter).getMovementVector (*iter);

            if (vector!=Ogre::Vector3::ZERO)
                movement.push_back (std::make_pair (iter->getRefData().getHandle(), vector));
        }
    }