Exemplo n.º 1
0
void RenderingManager::configureFog(const MWWorld::CellStore &mCell)
{
    Ogre::ColourValue color;
    color.setAsABGR (mCell.getCell()->mAmbi.mFog);

    configureFog (mCell.getCell()->mAmbi.mFogDensity, color);
}
Exemplo n.º 2
0
    MWWorld::Ptr getNearbyDoor(const MWWorld::Ptr& actor, float minSqr, bool closed)
    {
        MWWorld::CellStore *cell = actor.getCell();

        if(cell->getCell()->isExterior())
            return MWWorld::Ptr(); // check interior cells only

        // Check all the doors in this cell
        MWWorld::CellRefList<ESM::Door>& doors = cell->get<ESM::Door>();
        MWWorld::CellRefList<ESM::Door>::List& refList = doors.mList;
        MWWorld::CellRefList<ESM::Door>::List::iterator it = refList.begin();
        Ogre::Vector3 pos(actor.getRefData().getPosition().pos);

        /// TODO: How to check whether the actor is facing a door? Below code is for
        ///       the player, perhaps it can be adapted.
        //MWWorld::Ptr ptr = MWBase::Environment::get().getWorld()->getFacedObject();
        //if(!ptr.isEmpty())
            //std::cout << "faced door " << ptr.getClass().getName(ptr) << std::endl;

        /// TODO: The in-game observation of rot[2] value seems to be the
        ///       opposite of the code in World::activateDoor() ::confused::
        for (; it != refList.end(); ++it)
        {
            MWWorld::LiveCellRef<ESM::Door>& ref = *it;
            if(pos.squaredDistance(Ogre::Vector3(ref.mData.getPosition().pos)) < minSqr)
                if((closed && ref.mData.getLocalRotation().rot[2] == 0) ||
                   (!closed && ref.mData.getLocalRotation().rot[2] >= 1))
                {
                    return MWWorld::Ptr(&ref, actor.getCell()); // found, stop searching
                }
        }
        return MWWorld::Ptr(); // none found
    }
Exemplo n.º 3
0
 virtual void execute (Interpreter::Runtime& runtime)
 {
     MWWorld::CellStore *cell = MWBase::Environment::get().getWorld()->getPlayerPtr().getCell();
     if (cell->getCell()->hasWater())
         runtime.push (cell->getWaterLevel());
     else
         runtime.push (-std::numeric_limits<float>().max());
 }
Exemplo n.º 4
0
void RenderingManager::configureAmbient(MWWorld::CellStore &mCell)
{
    if (mCell.getCell()->mData.mFlags & ESM::Cell::Interior)
        mAmbientColor.setAsABGR (mCell.getCell()->mAmbi.mAmbient);
    setAmbientMode();

    // Create a "sun" that shines light downwards. It doesn't look
    // completely right, but leave it for now.
    if(!mSun)
    {
        mSun = mRendering.getScene()->createLight();
        mSun->setType(Ogre::Light::LT_DIRECTIONAL);
    }
    if (mCell.getCell()->mData.mFlags & ESM::Cell::Interior)
    {
        Ogre::ColourValue colour;
        colour.setAsABGR (mCell.getCell()->mAmbi.mSunlight);
        mSun->setDiffuseColour (colour);
        mSun->setDirection(0,-1,0);
    }
}
Exemplo n.º 5
0
                virtual void execute (Interpreter::Runtime& runtime)
                {
                    Interpreter::Type_Float level = runtime[0].mFloat;

                    MWWorld::CellStore *cell = MWBase::Environment::get().getWorld()->getPlayerPtr().getCell();

                    if (cell->getCell()->isExterior())
                        throw std::runtime_error("Can't set water level in exterior cell");

                    cell->setWaterLevel (cell->getWaterLevel()+level);
                    MWBase::Environment::get().getWorld()->setWaterHeight(cell->getWaterLevel());
                }
Exemplo n.º 6
0
 virtual void execute (Interpreter::Runtime& runtime)
 {
     if (!MWMechanics::getPlayer().isInCell())
     {
         runtime.push(0.f);
         return;
     }
     MWWorld::CellStore *cell = MWMechanics::getPlayer().getCell();
     if (cell->getCell()->hasWater())
         runtime.push (cell->getWaterLevel());
     else
         runtime.push (-std::numeric_limits<float>::max());
 }
Exemplo n.º 7
0
 virtual void execute (Interpreter::Runtime& runtime)
 {
     if (!MWMechanics::getPlayer().isInCell())
     {
         runtime.push(0.f);
         return;
     }
     MWWorld::CellStore *cell = MWMechanics::getPlayer().getCell();
     if (cell->isExterior())
         runtime.push(0.f); // vanilla oddity, return 0 even though water is actually at -1
     else if (cell->getCell()->hasWater())
         runtime.push (cell->getWaterLevel());
     else
         runtime.push (-std::numeric_limits<float>::max());
 }