forked from teamnwah/openmw-tes3coop
started making CellStore into a proper class; encapsulated mCell member
This commit is contained in:
parent
550e5eb686
commit
7693f712bc
28 changed files with 161 additions and 145 deletions
|
@ -110,7 +110,7 @@ bool MWDialogue::Filter::testPlayer (const ESM::DialInfo& info) const
|
|||
|
||||
// check cell
|
||||
if (!info.mCell.empty())
|
||||
if (!Misc::StringUtils::ciEqual(player.getCell()->mCell->mName, info.mCell))
|
||||
if (!Misc::StringUtils::ciEqual(player.getCell()->getCell()->mName, info.mCell))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
|
@ -445,7 +445,7 @@ bool MWDialogue::Filter::getSelectStructBoolean (const SelectWrapper& select) co
|
|||
|
||||
case SelectWrapper::Function_NotCell:
|
||||
|
||||
return !Misc::StringUtils::ciEqual(mActor.getCell()->mCell->mName, select.getName());
|
||||
return !Misc::StringUtils::ciEqual(mActor.getCell()->getCell()->mName, select.getName());
|
||||
|
||||
case SelectWrapper::Function_NotLocal:
|
||||
{
|
||||
|
|
|
@ -356,7 +356,7 @@ namespace MWGui
|
|||
ESM::Position markedPosition;
|
||||
MWBase::Environment::get().getWorld()->getPlayer().getMarkedPosition(markedCell, markedPosition);
|
||||
if (markedCell && markedCell->isExterior() == !mInterior
|
||||
&& (!mInterior || Misc::StringUtils::ciEqual(markedCell->mCell->mName, mPrefix)))
|
||||
&& (!mInterior || Misc::StringUtils::ciEqual(markedCell->getCell()->mName, mPrefix)))
|
||||
{
|
||||
MarkerPosition markerPos;
|
||||
MyGUI::IntPoint widgetPos = getMarkerPosition(markedPosition.pos[0], markedPosition.pos[1], markerPos);
|
||||
|
|
|
@ -109,7 +109,11 @@ namespace MWGui
|
|||
int x,y;
|
||||
MWBase::Environment::get().getWorld()->positionToIndex(mPtr.get<ESM::NPC>()->mBase->mTransport[i].mPos.pos[0],
|
||||
mPtr.get<ESM::NPC>()->mBase->mTransport[i].mPos.pos[1],x,y);
|
||||
if(cellname == "") {cellname = MWBase::Environment::get().getWorld()->getExterior(x,y)->mCell->mName; interior= false;}
|
||||
if (cellname == "")
|
||||
{
|
||||
cellname = MWBase::Environment::get().getWorld()->getExterior(x,y)->getCell()->mName;
|
||||
interior = false;
|
||||
}
|
||||
addDestination(cellname,mPtr.get<ESM::NPC>()->mBase->mTransport[i].mPos,interior);
|
||||
}
|
||||
|
||||
|
|
|
@ -129,7 +129,7 @@ namespace MWGui
|
|||
MWWorld::Ptr player = world->getPlayerPtr();
|
||||
if (mSleeping && player.getCell()->isExterior())
|
||||
{
|
||||
std::string regionstr = player.getCell()->mCell->mRegion;
|
||||
std::string regionstr = player.getCell()->getCell()->mRegion;
|
||||
if (!regionstr.empty())
|
||||
{
|
||||
const ESM::Region *region = world->getStore().get<ESM::Region>().find (regionstr);
|
||||
|
|
|
@ -739,22 +739,22 @@ namespace MWGui
|
|||
mMap->setCellName( name );
|
||||
mHud->setCellName( name );
|
||||
|
||||
if (cell->mCell->isExterior())
|
||||
if (cell->getCell()->isExterior())
|
||||
{
|
||||
if (!cell->mCell->mName.empty())
|
||||
mMap->addVisitedLocation ("#{sCell=" + name + "}", cell->mCell->getGridX (), cell->mCell->getGridY ());
|
||||
if (!cell->getCell()->mName.empty())
|
||||
mMap->addVisitedLocation ("#{sCell=" + name + "}", cell->getCell()->getGridX (), cell->getCell()->getGridY ());
|
||||
|
||||
mMap->cellExplored(cell->mCell->getGridX(), cell->mCell->getGridY());
|
||||
mMap->cellExplored (cell->getCell()->getGridX(), cell->getCell()->getGridY());
|
||||
|
||||
mMap->setCellPrefix("Cell");
|
||||
mHud->setCellPrefix("Cell");
|
||||
mMap->setActiveCell( cell->mCell->getGridX(), cell->mCell->getGridY() );
|
||||
mHud->setActiveCell( cell->mCell->getGridX(), cell->mCell->getGridY() );
|
||||
mMap->setActiveCell (cell->getCell()->getGridX(), cell->getCell()->getGridY());
|
||||
mHud->setActiveCell (cell->getCell()->getGridX(), cell->getCell()->getGridY());
|
||||
}
|
||||
else
|
||||
{
|
||||
mMap->setCellPrefix( cell->mCell->mName );
|
||||
mHud->setCellPrefix( cell->mCell->mName );
|
||||
mMap->setCellPrefix (cell->getCell()->mName );
|
||||
mHud->setCellPrefix (cell->getCell()->mName );
|
||||
|
||||
Ogre::Vector3 worldPos;
|
||||
if (!MWBase::Environment::get().getWorld()->findInteriorPositionInWorldSpace(cell, worldPos))
|
||||
|
|
|
@ -33,12 +33,12 @@ bool MWMechanics::AiActivate::execute (const MWWorld::Ptr& actor,float duration)
|
|||
MWBase::World *world = MWBase::Environment::get().getWorld();
|
||||
ESM::Position pos = actor.getRefData().getPosition();
|
||||
Movement &movement = actor.getClass().getMovementSettings(actor);
|
||||
const ESM::Cell *cell = actor.getCell()->mCell;
|
||||
const ESM::Cell *cell = actor.getCell()->getCell();
|
||||
|
||||
MWWorld::Ptr player = world->getPlayerPtr();
|
||||
if(cell->mData.mX != player.getCell()->mCell->mData.mX)
|
||||
if(cell->mData.mX != player.getCell()->getCell()->mData.mX)
|
||||
{
|
||||
int sideX = sgn(cell->mData.mX - player.getCell()->mCell->mData.mX);
|
||||
int sideX = sgn(cell->mData.mX - player.getCell()->getCell()->mData.mX);
|
||||
//check if actor is near the border of an inactive cell. If so, stop walking.
|
||||
if(sideX * (pos.pos[0] - cell->mData.mX*ESM::Land::REAL_SIZE) >
|
||||
sideX * (ESM::Land::REAL_SIZE/2.0f - 200.0f))
|
||||
|
@ -47,9 +47,9 @@ bool MWMechanics::AiActivate::execute (const MWWorld::Ptr& actor,float duration)
|
|||
return false;
|
||||
}
|
||||
}
|
||||
if(cell->mData.mY != player.getCell()->mCell->mData.mY)
|
||||
if(cell->mData.mY != player.getCell()->getCell()->mData.mY)
|
||||
{
|
||||
int sideY = sgn(cell->mData.mY - player.getCell()->mCell->mData.mY);
|
||||
int sideY = sgn(cell->mData.mY - player.getCell()->getCell()->mData.mY);
|
||||
//check if actor is near the border of an inactive cell. If so, stop walking.
|
||||
if(sideY * (pos.pos[1] - cell->mData.mY*ESM::Land::REAL_SIZE) >
|
||||
sideY * (ESM::Land::REAL_SIZE/2.0f - 200.0f))
|
||||
|
|
|
@ -305,7 +305,7 @@ namespace MWMechanics
|
|||
float dist = Ogre::Math::Abs((newPathTarget - currPathTarget).length());
|
||||
|
||||
float targetPosThreshold;
|
||||
bool isOutside = actor.getCell()->mCell->isExterior();
|
||||
bool isOutside = actor.getCell()->getCell()->isExterior();
|
||||
if (isOutside)
|
||||
targetPosThreshold = 300;
|
||||
else
|
||||
|
|
|
@ -86,24 +86,24 @@ namespace MWMechanics
|
|||
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
||||
ESM::Position pos = actor.getRefData().getPosition();
|
||||
bool cellChange = actor.getCell()->mCell->mData.mX != mCellX || actor.getCell()->mCell->mData.mY != mCellY;
|
||||
bool cellChange = actor.getCell()->getCell()->mData.mX != mCellX || actor.getCell()->getCell()->mData.mY != mCellY;
|
||||
|
||||
if(actor.getCell()->mCell->mData.mX != player.getCell()->mCell->mData.mX)
|
||||
if(actor.getCell()->getCell()->mData.mX != player.getCell()->getCell()->mData.mX)
|
||||
{
|
||||
int sideX = sgn(actor.getCell()->mCell->mData.mX - player.getCell()->mCell->mData.mX);
|
||||
int sideX = sgn(actor.getCell()->getCell()->mData.mX - player.getCell()->getCell()->mData.mX);
|
||||
// Check if actor is near the border of an inactive cell. If so, pause walking.
|
||||
if(sideX * (pos.pos[0] - actor.getCell()->mCell->mData.mX * ESM::Land::REAL_SIZE) > sideX * (ESM::Land::REAL_SIZE /
|
||||
if(sideX * (pos.pos[0] - actor.getCell()->getCell()->mData.mX * ESM::Land::REAL_SIZE) > sideX * (ESM::Land::REAL_SIZE /
|
||||
2.0 - 200))
|
||||
{
|
||||
MWWorld::Class::get(actor).getMovementSettings(actor).mPosition[1] = 0;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if(actor.getCell()->mCell->mData.mY != player.getCell()->mCell->mData.mY)
|
||||
if(actor.getCell()->getCell()->mData.mY != player.getCell()->getCell()->mData.mY)
|
||||
{
|
||||
int sideY = sgn(actor.getCell()->mCell->mData.mY - player.getCell()->mCell->mData.mY);
|
||||
int sideY = sgn(actor.getCell()->getCell()->mData.mY - player.getCell()->getCell()->mData.mY);
|
||||
// Check if actor is near the border of an inactive cell. If so, pause walking.
|
||||
if(sideY*(pos.pos[1] - actor.getCell()->mCell->mData.mY * ESM::Land::REAL_SIZE) > sideY * (ESM::Land::REAL_SIZE /
|
||||
if(sideY*(pos.pos[1] - actor.getCell()->getCell()->mData.mY * ESM::Land::REAL_SIZE) > sideY * (ESM::Land::REAL_SIZE /
|
||||
2.0 - 200))
|
||||
{
|
||||
MWWorld::Class::get(actor).getMovementSettings(actor).mPosition[1] = 0;
|
||||
|
@ -114,8 +114,8 @@ namespace MWMechanics
|
|||
|
||||
if(!mPathFinder.isPathConstructed() || cellChange)
|
||||
{
|
||||
mCellX = actor.getCell()->mCell->mData.mX;
|
||||
mCellY = actor.getCell()->mCell->mData.mY;
|
||||
mCellX = actor.getCell()->getCell()->mData.mX;
|
||||
mCellY = actor.getCell()->getCell()->mData.mY;
|
||||
|
||||
ESM::Pathgrid::Point dest;
|
||||
dest.mX = mX;
|
||||
|
|
|
@ -42,7 +42,7 @@ bool MWMechanics::AiFollow::execute (const MWWorld::Ptr& actor,float duration)
|
|||
}
|
||||
else
|
||||
{
|
||||
if(mCellId == actor.getCell()->mCell->mName)
|
||||
if(mCellId == actor.getCell()->getCell()->mName)
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -36,12 +36,12 @@ namespace MWMechanics
|
|||
MWBase::World *world = MWBase::Environment::get().getWorld();
|
||||
ESM::Position pos = actor.getRefData().getPosition();
|
||||
Movement &movement = actor.getClass().getMovementSettings(actor);
|
||||
const ESM::Cell *cell = actor.getCell()->mCell;
|
||||
const ESM::Cell *cell = actor.getCell()->getCell();
|
||||
|
||||
MWWorld::Ptr player = world->getPlayerPtr();
|
||||
if(cell->mData.mX != player.getCell()->mCell->mData.mX)
|
||||
if(cell->mData.mX != player.getCell()->getCell()->mData.mX)
|
||||
{
|
||||
int sideX = sgn(cell->mData.mX - player.getCell()->mCell->mData.mX);
|
||||
int sideX = sgn(cell->mData.mX - player.getCell()->getCell()->mData.mX);
|
||||
//check if actor is near the border of an inactive cell. If so, stop walking.
|
||||
if(sideX * (pos.pos[0] - cell->mData.mX*ESM::Land::REAL_SIZE) >
|
||||
sideX * (ESM::Land::REAL_SIZE/2.0f - 200.0f))
|
||||
|
@ -50,9 +50,9 @@ namespace MWMechanics
|
|||
return false;
|
||||
}
|
||||
}
|
||||
if(cell->mData.mY != player.getCell()->mCell->mData.mY)
|
||||
if(cell->mData.mY != player.getCell()->getCell()->mData.mY)
|
||||
{
|
||||
int sideY = sgn(cell->mData.mY - player.getCell()->mCell->mData.mY);
|
||||
int sideY = sgn(cell->mData.mY - player.getCell()->getCell()->mData.mY);
|
||||
//check if actor is near the border of an inactive cell. If so, stop walking.
|
||||
if(sideY * (pos.pos[1] - cell->mData.mY*ESM::Land::REAL_SIZE) >
|
||||
sideY * (ESM::Land::REAL_SIZE/2.0f - 200.0f))
|
||||
|
|
|
@ -103,10 +103,10 @@ namespace MWMechanics
|
|||
if(!mStoredAvailableNodes)
|
||||
{
|
||||
mStoredAvailableNodes = true;
|
||||
mPathgrid = world->getStore().get<ESM::Pathgrid>().search(*actor.getCell()->mCell);
|
||||
mPathgrid = world->getStore().get<ESM::Pathgrid>().search(*actor.getCell()->getCell());
|
||||
|
||||
mCellX = actor.getCell()->mCell->mData.mX;
|
||||
mCellY = actor.getCell()->mCell->mData.mY;
|
||||
mCellX = actor.getCell()->getCell()->mData.mX;
|
||||
mCellY = actor.getCell()->getCell()->mData.mY;
|
||||
|
||||
if(!mPathgrid)
|
||||
mDistance = 0;
|
||||
|
@ -117,7 +117,7 @@ namespace MWMechanics
|
|||
{
|
||||
mXCell = 0;
|
||||
mYCell = 0;
|
||||
if(actor.getCell()->mCell->isExterior())
|
||||
if(actor.getCell()->getCell()->isExterior())
|
||||
{
|
||||
mXCell = mCellX * ESM::Land::REAL_SIZE;
|
||||
mYCell = mCellY * ESM::Land::REAL_SIZE;
|
||||
|
@ -157,7 +157,7 @@ namespace MWMechanics
|
|||
mDistance = 0;
|
||||
|
||||
// Don't try to move if you are in a new cell (ie: positioncell command called) but still play idles.
|
||||
if(mDistance && (mCellX != actor.getCell()->mCell->mData.mX || mCellY != actor.getCell()->mCell->mData.mY))
|
||||
if(mDistance && (mCellX != actor.getCell()->getCell()->mData.mX || mCellY != actor.getCell()->getCell()->mData.mY))
|
||||
mDistance = 0;
|
||||
|
||||
if(mChooseAction)
|
||||
|
|
|
@ -299,14 +299,14 @@ namespace MWMechanics
|
|||
if(!allowShortcuts)
|
||||
{
|
||||
const ESM::Pathgrid *pathGrid =
|
||||
MWBase::Environment::get().getWorld()->getStore().get<ESM::Pathgrid>().search(*mCell->mCell);
|
||||
MWBase::Environment::get().getWorld()->getStore().get<ESM::Pathgrid>().search(*mCell->getCell());
|
||||
float xCell = 0;
|
||||
float yCell = 0;
|
||||
|
||||
if (mCell->isExterior())
|
||||
{
|
||||
xCell = mCell->mCell->mData.mX * ESM::Land::REAL_SIZE;
|
||||
yCell = mCell->mCell->mData.mY * ESM::Land::REAL_SIZE;
|
||||
xCell = mCell->getCell()->mData.mX * ESM::Land::REAL_SIZE;
|
||||
yCell = mCell->getCell()->mData.mY * ESM::Land::REAL_SIZE;
|
||||
}
|
||||
int startNode = getClosestPoint(pathGrid, startPoint.mX - xCell, startPoint.mY - yCell,startPoint.mZ);
|
||||
int endNode = getClosestPoint(pathGrid, endPoint.mX - xCell, endPoint.mY - yCell, endPoint.mZ);
|
||||
|
|
|
@ -503,7 +503,7 @@ namespace MWMechanics
|
|||
MWBase::Environment::get().getWorld()->getPlayer().getMarkedPosition(markedCell, markedPosition);
|
||||
if (markedCell)
|
||||
{
|
||||
MWWorld::ActionTeleport action(markedCell->isExterior() ? "" : markedCell->mCell->mName,
|
||||
MWWorld::ActionTeleport action(markedCell->isExterior() ? "" : markedCell->getCell()->mName,
|
||||
markedPosition);
|
||||
action.execute(target);
|
||||
}
|
||||
|
|
|
@ -334,7 +334,7 @@ void Animation::addExtraLight(Ogre::SceneManager *sceneMgr, NifOgre::ObjectScene
|
|||
));
|
||||
objlist->mControllers.push_back(Ogre::Controller<Ogre::Real>(src, dest, func));
|
||||
|
||||
bool interior = !(mPtr.isInCell() && mPtr.getCell()->mCell->isExterior());
|
||||
bool interior = !(mPtr.isInCell() && mPtr.getCell()->getCell()->isExterior());
|
||||
bool quadratic = fallback->getFallbackBool("LightAttenuation_OutQuadInLin") ?
|
||||
!interior : fallback->getFallbackBool("LightAttenuation_UseQuadratic");
|
||||
|
||||
|
|
|
@ -230,22 +230,22 @@ void Debugging::togglePathgrid()
|
|||
void Debugging::enableCellPathgrid(MWWorld::CellStore *store)
|
||||
{
|
||||
const ESM::Pathgrid *pathgrid =
|
||||
MWBase::Environment::get().getWorld()->getStore().get<ESM::Pathgrid>().search(*store->mCell);
|
||||
MWBase::Environment::get().getWorld()->getStore().get<ESM::Pathgrid>().search(*store->getCell());
|
||||
if (!pathgrid) return;
|
||||
|
||||
Vector3 cellPathGridPos(0, 0, 0);
|
||||
if (store->mCell->isExterior())
|
||||
if (store->getCell()->isExterior())
|
||||
{
|
||||
cellPathGridPos.x = store->mCell->mData.mX * ESM::Land::REAL_SIZE;
|
||||
cellPathGridPos.y = store->mCell->mData.mY * ESM::Land::REAL_SIZE;
|
||||
cellPathGridPos.x = store->getCell()->mData.mX * ESM::Land::REAL_SIZE;
|
||||
cellPathGridPos.y = store->getCell()->mData.mY * ESM::Land::REAL_SIZE;
|
||||
}
|
||||
SceneNode *cellPathGrid = mPathGridRoot->createChildSceneNode(cellPathGridPos);
|
||||
cellPathGrid->attachObject(createPathgridLines(pathgrid));
|
||||
cellPathGrid->attachObject(createPathgridPoints(pathgrid));
|
||||
|
||||
if (store->mCell->isExterior())
|
||||
if (store->getCell()->isExterior())
|
||||
{
|
||||
mExteriorPathgridNodes[std::make_pair(store->mCell->getGridX(), store->mCell->getGridY())] = cellPathGrid;
|
||||
mExteriorPathgridNodes[std::make_pair(store->getCell()->getGridX(), store->getCell()->getGridY())] = cellPathGrid;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -256,10 +256,10 @@ void Debugging::enableCellPathgrid(MWWorld::CellStore *store)
|
|||
|
||||
void Debugging::disableCellPathgrid(MWWorld::CellStore *store)
|
||||
{
|
||||
if (store->mCell->isExterior())
|
||||
if (store->getCell()->isExterior())
|
||||
{
|
||||
ExteriorPathgridNodes::iterator it =
|
||||
mExteriorPathgridNodes.find(std::make_pair(store->mCell->getGridX(), store->mCell->getGridY()));
|
||||
mExteriorPathgridNodes.find(std::make_pair(store->getCell()->getGridX(), store->getCell()->getGridY()));
|
||||
if (it != mExteriorPathgridNodes.end())
|
||||
{
|
||||
destroyCellPathgridNode(it->second);
|
||||
|
|
|
@ -115,8 +115,8 @@ void LocalMap::requestMap(MWWorld::CellStore* cell, float zMin, float zMax)
|
|||
mCameraRotNode->setOrientation(Quaternion::IDENTITY);
|
||||
mCellCamera->setOrientation(Quaternion(Ogre::Math::Cos(Ogre::Degree(0)/2.f), 0, 0, -Ogre::Math::Sin(Ogre::Degree(0)/2.f)));
|
||||
|
||||
int x = cell->mCell->getGridX();
|
||||
int y = cell->mCell->getGridY();
|
||||
int x = cell->getCell()->getGridX();
|
||||
int y = cell->getCell()->getGridY();
|
||||
|
||||
std::string name = "Cell_"+coordStr(x, y);
|
||||
|
||||
|
@ -182,7 +182,7 @@ void LocalMap::requestMap(MWWorld::CellStore* cell,
|
|||
const int segsX = std::ceil( length.x / sSize );
|
||||
const int segsY = std::ceil( length.y / sSize );
|
||||
|
||||
mInteriorName = cell->mCell->mName;
|
||||
mInteriorName = cell->getCell()->mName;
|
||||
|
||||
for (int x=0; x<segsX; ++x)
|
||||
{
|
||||
|
@ -192,7 +192,7 @@ void LocalMap::requestMap(MWWorld::CellStore* cell,
|
|||
Vector2 newcenter = start + 4096;
|
||||
|
||||
render(newcenter.x - center.x, newcenter.y - center.y, zMin, zMax, sSize, sSize,
|
||||
cell->mCell->mName + "_" + coordStr(x,y));
|
||||
cell->getCell()->mName + "_" + coordStr(x,y));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -422,9 +422,9 @@ void RenderingManager::postRenderTargetUpdate(const RenderTargetEvent &evt)
|
|||
|
||||
void RenderingManager::waterAdded (MWWorld::CellStore *store)
|
||||
{
|
||||
if(store->mCell->mData.mFlags & ESM::Cell::HasWater)
|
||||
if (store->getCell()->mData.mFlags & ESM::Cell::HasWater)
|
||||
{
|
||||
mWater->changeCell(store->mCell);
|
||||
mWater->changeCell (store->getCell());
|
||||
mWater->setActive(true);
|
||||
}
|
||||
else
|
||||
|
@ -501,9 +501,9 @@ bool RenderingManager::toggleRenderMode(int mode)
|
|||
void RenderingManager::configureFog(MWWorld::CellStore &mCell)
|
||||
{
|
||||
Ogre::ColourValue color;
|
||||
color.setAsABGR (mCell.mCell->mAmbi.mFog);
|
||||
color.setAsABGR (mCell.getCell()->mAmbi.mFog);
|
||||
|
||||
configureFog(mCell.mCell->mAmbi.mFogDensity, color);
|
||||
configureFog (mCell.getCell()->mAmbi.mFogDensity, color);
|
||||
}
|
||||
|
||||
void RenderingManager::configureFog(const float density, const Ogre::ColourValue& colour)
|
||||
|
@ -553,8 +553,8 @@ void RenderingManager::setAmbientMode()
|
|||
|
||||
void RenderingManager::configureAmbient(MWWorld::CellStore &mCell)
|
||||
{
|
||||
if (mCell.mCell->mData.mFlags & ESM::Cell::Interior)
|
||||
mAmbientColor.setAsABGR (mCell.mCell->mAmbi.mAmbient);
|
||||
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
|
||||
|
@ -564,10 +564,10 @@ void RenderingManager::configureAmbient(MWWorld::CellStore &mCell)
|
|||
mSun = mRendering.getScene()->createLight();
|
||||
mSun->setType(Ogre::Light::LT_DIRECTIONAL);
|
||||
}
|
||||
if (mCell.mCell->mData.mFlags & ESM::Cell::Interior)
|
||||
if (mCell.getCell()->mData.mFlags & ESM::Cell::Interior)
|
||||
{
|
||||
Ogre::ColourValue colour;
|
||||
colour.setAsABGR (mCell.mCell->mAmbi.mSunlight);
|
||||
colour.setAsABGR (mCell.getCell()->mAmbi.mSunlight);
|
||||
mSun->setDiffuseColour (colour);
|
||||
mSun->setDirection(0,-1,0);
|
||||
}
|
||||
|
@ -650,12 +650,12 @@ void RenderingManager::setGlare(bool glare)
|
|||
|
||||
void RenderingManager::requestMap(MWWorld::CellStore* cell)
|
||||
{
|
||||
if (cell->mCell->isExterior())
|
||||
if (cell->getCell()->isExterior())
|
||||
{
|
||||
assert(mTerrain);
|
||||
|
||||
Ogre::AxisAlignedBox dims = mObjects->getDimensions(cell);
|
||||
Ogre::Vector2 center(cell->mCell->getGridX() + 0.5, cell->mCell->getGridY() + 0.5);
|
||||
Ogre::Vector2 center (cell->getCell()->getGridX() + 0.5, cell->getCell()->getGridY() + 0.5);
|
||||
dims.merge(mTerrain->getWorldBoundingBox(center));
|
||||
|
||||
if (dims.isFinite())
|
||||
|
|
|
@ -88,7 +88,7 @@ namespace MWScript
|
|||
virtual void execute (Interpreter::Runtime& runtime)
|
||||
{
|
||||
bool interior =
|
||||
!MWBase::Environment::get().getWorld()->getPlayerPtr().getCell()->mCell->isExterior();
|
||||
!MWBase::Environment::get().getWorld()->getPlayerPtr().getCell()->getCell()->isExterior();
|
||||
|
||||
runtime.push (interior ? 1 : 0);
|
||||
}
|
||||
|
@ -103,7 +103,7 @@ namespace MWScript
|
|||
std::string name = runtime.getStringLiteral (runtime[0].mInteger);
|
||||
runtime.pop();
|
||||
|
||||
const ESM::Cell *cell = MWBase::Environment::get().getWorld()->getPlayerPtr().getCell()->mCell;
|
||||
const ESM::Cell *cell = MWBase::Environment::get().getWorld()->getPlayerPtr().getCell()->getCell();
|
||||
|
||||
std::string current = cell->mName;
|
||||
|
||||
|
@ -131,7 +131,7 @@ namespace MWScript
|
|||
virtual void execute (Interpreter::Runtime& runtime)
|
||||
{
|
||||
MWWorld::CellStore *cell = MWBase::Environment::get().getWorld()->getPlayerPtr().getCell();
|
||||
if (cell->mCell->hasWater())
|
||||
if (cell->getCell()->hasWater())
|
||||
runtime.push (cell->mWaterLevel);
|
||||
else
|
||||
runtime.push (-std::numeric_limits<float>().max());
|
||||
|
@ -148,7 +148,7 @@ namespace MWScript
|
|||
|
||||
MWWorld::CellStore *cell = MWBase::Environment::get().getWorld()->getPlayerPtr().getCell();
|
||||
|
||||
if (cell->mCell->isExterior())
|
||||
if (cell->getCell()->isExterior())
|
||||
throw std::runtime_error("Can't set water level in exterior cell");
|
||||
|
||||
cell->mWaterLevel = level;
|
||||
|
@ -166,7 +166,7 @@ namespace MWScript
|
|||
|
||||
MWWorld::CellStore *cell = MWBase::Environment::get().getWorld()->getPlayerPtr().getCell();
|
||||
|
||||
if (cell->mCell->isExterior())
|
||||
if (cell->getCell()->isExterior())
|
||||
throw std::runtime_error("Can't set water level in exterior cell");
|
||||
|
||||
cell->mWaterLevel +=level;
|
||||
|
|
|
@ -480,7 +480,7 @@ namespace MWSound
|
|||
static float sTimePassed = 0.0;
|
||||
MWBase::World *world = MWBase::Environment::get().getWorld();
|
||||
const MWWorld::Ptr player = world->getPlayerPtr();
|
||||
const ESM::Cell *cell = player.getCell()->mCell;
|
||||
const ESM::Cell *cell = player.getCell()->getCell();
|
||||
|
||||
sTimePassed += duration;
|
||||
if(!cell->isExterior() || sTimePassed < sTimeToNextEnvSound)
|
||||
|
@ -548,7 +548,7 @@ namespace MWSound
|
|||
|
||||
MWWorld::Ptr player =
|
||||
MWBase::Environment::get().getWorld()->getPlayerPtr();
|
||||
const ESM::Cell *cell = player.getCell()->mCell;
|
||||
const ESM::Cell *cell = player.getCell()->getCell();
|
||||
|
||||
Environment env = Env_Normal;
|
||||
if((cell->mData.mFlags&cell->HasWater) && mListenerPos.z < cell->mWater)
|
||||
|
|
|
@ -301,7 +301,7 @@ void MWState::StateManager::loadGame (const Character *character, const Slot *sl
|
|||
|
||||
MWWorld::Ptr ptr = MWBase::Environment::get().getWorld()->getPlayer().getPlayer();
|
||||
|
||||
ESM::CellId cellId = ptr.getCell()->mCell->getCellId();
|
||||
ESM::CellId cellId = ptr.getCell()->getCell()->getCellId();
|
||||
|
||||
MWBase::Environment::get().getWorld()->changeToCell (cellId, ptr.getRefData().getPosition());
|
||||
}
|
||||
|
|
|
@ -83,8 +83,8 @@ bool MWWorld::Cells::hasState (const CellStore& cellStore) const
|
|||
if (cellStore.mState==CellStore::State_Loaded)
|
||||
return true;
|
||||
|
||||
if (cellStore.mCell->mData.mFlags & ESM::Cell::Interior)
|
||||
return cellStore.mCell->mData.mFlags & ESM::Cell::HasWater;
|
||||
if (cellStore.getCell()->mData.mFlags & ESM::Cell::Interior)
|
||||
return cellStore.getCell()->mData.mFlags & ESM::Cell::HasWater;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -145,6 +145,11 @@ namespace MWWorld
|
|||
mWaterLevel = cell->mWater;
|
||||
}
|
||||
|
||||
const ESM::Cell *CellStore::getCell() const
|
||||
{
|
||||
return mCell;
|
||||
}
|
||||
|
||||
void CellStore::load (const MWWorld::ESMStore &store, std::vector<ESM::ESMReader> &esm)
|
||||
{
|
||||
if (mState!=State_Loaded)
|
||||
|
|
|
@ -49,19 +49,26 @@ namespace MWWorld
|
|||
}
|
||||
};
|
||||
|
||||
/// A storage struct for one single cell reference.
|
||||
/// \brief Mutable state of a cell
|
||||
class CellStore
|
||||
{
|
||||
public:
|
||||
public:
|
||||
|
||||
enum State
|
||||
{
|
||||
State_Unloaded, State_Preloaded, State_Loaded
|
||||
};
|
||||
enum State
|
||||
{
|
||||
State_Unloaded, State_Preloaded, State_Loaded
|
||||
};
|
||||
|
||||
CellStore (const ESM::Cell *cell_);
|
||||
private:
|
||||
|
||||
const ESM::Cell *mCell;
|
||||
|
||||
public:
|
||||
|
||||
CellStore (const ESM::Cell *cell_);
|
||||
|
||||
const ESM::Cell *getCell() const;
|
||||
|
||||
const ESM::Cell *mCell;
|
||||
State mState;
|
||||
std::vector<std::string> mIds;
|
||||
|
||||
|
|
|
@ -574,7 +574,7 @@ namespace MWWorld
|
|||
for(;iter != mMovementQueue.end();iter++)
|
||||
{
|
||||
float waterlevel = -std::numeric_limits<float>::max();
|
||||
const ESM::Cell *cell = iter->first.getCell()->mCell;
|
||||
const ESM::Cell *cell = iter->first.getCell()->getCell();
|
||||
if(cell->hasWater())
|
||||
waterlevel = cell->mWater;
|
||||
|
||||
|
|
|
@ -191,7 +191,7 @@ namespace MWWorld
|
|||
ESM::Player player;
|
||||
|
||||
mPlayer.save (player.mObject);
|
||||
player.mCellId = mCellStore->mCell->getCellId();
|
||||
player.mCellId = mCellStore->getCell()->getCellId();
|
||||
|
||||
player.mBirthsign = mSign;
|
||||
|
||||
|
@ -203,7 +203,7 @@ namespace MWWorld
|
|||
{
|
||||
player.mHasMark = true;
|
||||
player.mMarkedPosition = mMarkedPosition;
|
||||
player.mMarkedCell = mMarkedCell->mCell->getCellId();
|
||||
player.mMarkedCell = mMarkedCell->getCell()->getCellId();
|
||||
}
|
||||
else
|
||||
player.mHasMark = false;
|
||||
|
|
|
@ -97,15 +97,15 @@ namespace MWWorld
|
|||
}
|
||||
}
|
||||
|
||||
if ((*iter)->mCell->isExterior())
|
||||
if ((*iter)->getCell()->isExterior())
|
||||
{
|
||||
ESM::Land* land =
|
||||
MWBase::Environment::get().getWorld()->getStore().get<ESM::Land>().search(
|
||||
(*iter)->mCell->getGridX(),
|
||||
(*iter)->mCell->getGridY()
|
||||
(*iter)->getCell()->getGridX(),
|
||||
(*iter)->getCell()->getGridY()
|
||||
);
|
||||
if (land)
|
||||
mPhysics->removeHeightField( (*iter)->mCell->getGridX(), (*iter)->mCell->getGridY() );
|
||||
mPhysics->removeHeightField ((*iter)->getCell()->getGridX(), (*iter)->getCell()->getGridY());
|
||||
}
|
||||
|
||||
mRendering.removeCell(*iter);
|
||||
|
@ -128,18 +128,18 @@ namespace MWWorld
|
|||
float worldsize = ESM::Land::REAL_SIZE;
|
||||
|
||||
// Load terrain physics first...
|
||||
if (cell->mCell->isExterior())
|
||||
if (cell->getCell()->isExterior())
|
||||
{
|
||||
ESM::Land* land =
|
||||
MWBase::Environment::get().getWorld()->getStore().get<ESM::Land>().search(
|
||||
cell->mCell->getGridX(),
|
||||
cell->mCell->getGridY()
|
||||
cell->getCell()->getGridX(),
|
||||
cell->getCell()->getGridY()
|
||||
);
|
||||
if (land) {
|
||||
mPhysics->addHeightField (
|
||||
land->mLandData->mHeights,
|
||||
cell->mCell->getGridX(),
|
||||
cell->mCell->getGridY(),
|
||||
cell->getCell()->getGridX(),
|
||||
cell->getCell()->getGridY(),
|
||||
0,
|
||||
worldsize / (verts-1),
|
||||
verts)
|
||||
|
@ -218,10 +218,10 @@ namespace MWWorld
|
|||
int numUnload = 0;
|
||||
while (active!=mActiveCells.end())
|
||||
{
|
||||
if ((*active)->mCell->isExterior())
|
||||
if ((*active)->getCell()->isExterior())
|
||||
{
|
||||
if (std::abs (X-(*active)->mCell->getGridX())<=1 &&
|
||||
std::abs (Y-(*active)->mCell->getGridY())<=1)
|
||||
if (std::abs (X-(*active)->getCell()->getGridX())<=1 &&
|
||||
std::abs (Y-(*active)->getCell()->getGridY())<=1)
|
||||
{
|
||||
// keep cells within the new 3x3 grid
|
||||
++active;
|
||||
|
@ -235,10 +235,10 @@ namespace MWWorld
|
|||
active = mActiveCells.begin();
|
||||
while (active!=mActiveCells.end())
|
||||
{
|
||||
if ((*active)->mCell->isExterior())
|
||||
if ((*active)->getCell()->isExterior())
|
||||
{
|
||||
if (std::abs (X-(*active)->mCell->getGridX())<=1 &&
|
||||
std::abs (Y-(*active)->mCell->getGridY())<=1)
|
||||
if (std::abs (X-(*active)->getCell()->getGridX())<=1 &&
|
||||
std::abs (Y-(*active)->getCell()->getGridY())<=1)
|
||||
{
|
||||
// keep cells within the new 3x3 grid
|
||||
++active;
|
||||
|
@ -257,10 +257,10 @@ namespace MWWorld
|
|||
|
||||
while (iter!=mActiveCells.end())
|
||||
{
|
||||
assert ((*iter)->mCell->isExterior());
|
||||
assert ((*iter)->getCell()->isExterior());
|
||||
|
||||
if (x==(*iter)->mCell->getGridX() &&
|
||||
y==(*iter)->mCell->getGridY())
|
||||
if (x==(*iter)->getCell()->getGridX() &&
|
||||
y==(*iter)->getCell()->getGridY())
|
||||
break;
|
||||
|
||||
++iter;
|
||||
|
@ -280,10 +280,10 @@ namespace MWWorld
|
|||
|
||||
while (iter!=mActiveCells.end())
|
||||
{
|
||||
assert ((*iter)->mCell->isExterior());
|
||||
assert ((*iter)->getCell()->isExterior());
|
||||
|
||||
if (x==(*iter)->mCell->getGridX() &&
|
||||
y==(*iter)->mCell->getGridY())
|
||||
if (x==(*iter)->getCell()->getGridX() &&
|
||||
y==(*iter)->getCell()->getGridY())
|
||||
break;
|
||||
|
||||
++iter;
|
||||
|
@ -302,10 +302,10 @@ namespace MWWorld
|
|||
|
||||
while (iter!=mActiveCells.end())
|
||||
{
|
||||
assert ((*iter)->mCell->isExterior());
|
||||
assert ((*iter)->getCell()->isExterior());
|
||||
|
||||
if (X==(*iter)->mCell->getGridX() &&
|
||||
Y==(*iter)->mCell->getGridY())
|
||||
if (X==(*iter)->getCell()->getGridX() &&
|
||||
Y==(*iter)->getCell()->getGridY())
|
||||
break;
|
||||
|
||||
++iter;
|
||||
|
@ -407,7 +407,7 @@ namespace MWWorld
|
|||
loadingListener->setProgressRange(refsToLoad);
|
||||
|
||||
// Load cell.
|
||||
std::cout << "cellName: " << cell->mCell->mName << std::endl;
|
||||
std::cout << "cellName: " << cell->getCell()->mName << std::endl;
|
||||
|
||||
//Loading Interior loading text
|
||||
|
||||
|
|
|
@ -664,7 +664,7 @@ void WeatherManager::changeWeather(const std::string& region, const unsigned int
|
|||
|
||||
mRegionOverrides[Misc::StringUtils::lowerCase(region)] = weather;
|
||||
|
||||
std::string playerRegion = MWBase::Environment::get().getWorld()->getPlayerPtr().getCell()->mCell->mRegion;
|
||||
std::string playerRegion = MWBase::Environment::get().getWorld()->getPlayerPtr().getCell()->getCell()->mRegion;
|
||||
if (Misc::StringUtils::ciEqual(region, playerRegion))
|
||||
setWeather(weather);
|
||||
}
|
||||
|
@ -695,7 +695,7 @@ void WeatherManager::switchToNextWeather(bool instantly)
|
|||
MWBase::World* world = MWBase::Environment::get().getWorld();
|
||||
if (world->isCellExterior() || world->isCellQuasiExterior())
|
||||
{
|
||||
std::string regionstr = Misc::StringUtils::lowerCase(world->getPlayerPtr().getCell()->mCell->mRegion);
|
||||
std::string regionstr = Misc::StringUtils::lowerCase(world->getPlayerPtr().getCell()->getCell()->mRegion);
|
||||
|
||||
if (mWeatherUpdateTime <= 0 || regionstr != mCurrentRegion)
|
||||
{
|
||||
|
|
|
@ -506,10 +506,10 @@ namespace MWWorld
|
|||
if (!cell)
|
||||
cell = mWorldScene->getCurrentCell();
|
||||
|
||||
if (!cell->mCell->isExterior() || !cell->mCell->mName.empty())
|
||||
return cell->mCell->mName;
|
||||
if (!cell->getCell()->isExterior() || !cell->getCell()->mName.empty())
|
||||
return cell->getCell()->mName;
|
||||
|
||||
if (const ESM::Region* region = getStore().get<ESM::Region>().search (cell->mCell->mRegion))
|
||||
if (const ESM::Region* region = getStore().get<ESM::Region>().search (cell->getCell()->mRegion))
|
||||
return region->mName;
|
||||
|
||||
return getStore().get<ESM::GameSetting>().find ("sDefaultCellname")->mValue.getString();
|
||||
|
@ -946,11 +946,11 @@ namespace MWWorld
|
|||
if (isPlayer)
|
||||
{
|
||||
if (!newCell.isExterior())
|
||||
changeToInteriorCell(Misc::StringUtils::lowerCase(newCell.mCell->mName), pos);
|
||||
changeToInteriorCell(Misc::StringUtils::lowerCase(newCell.getCell()->mName), pos);
|
||||
else
|
||||
{
|
||||
int cellX = newCell.mCell->getGridX();
|
||||
int cellY = newCell.mCell->getGridY();
|
||||
int cellX = newCell.getCell()->getGridX();
|
||||
int cellY = newCell.getCell()->getGridY();
|
||||
mWorldScene->changeCell(cellX, cellY, pos, false);
|
||||
}
|
||||
addContainerScripts (getPlayerPtr(), &newCell);
|
||||
|
@ -1465,7 +1465,7 @@ namespace MWWorld
|
|||
CellStore *currentCell = mWorldScene->getCurrentCell();
|
||||
if (currentCell)
|
||||
{
|
||||
return currentCell->mCell->isExterior();
|
||||
return currentCell->getCell()->isExterior();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -1475,7 +1475,7 @@ namespace MWWorld
|
|||
CellStore *currentCell = mWorldScene->getCurrentCell();
|
||||
if (currentCell)
|
||||
{
|
||||
if (!(currentCell->mCell->mData.mFlags & ESM::Cell::QuasiEx))
|
||||
if (!(currentCell->getCell()->mData.mFlags & ESM::Cell::QuasiEx))
|
||||
return false;
|
||||
else
|
||||
return true;
|
||||
|
@ -1757,7 +1757,7 @@ namespace MWWorld
|
|||
bool
|
||||
World::isUnderwater(const MWWorld::CellStore* cell, const Ogre::Vector3 &pos) const
|
||||
{
|
||||
if (!(cell->mCell->mData.mFlags & ESM::Cell::HasWater)) {
|
||||
if (!(cell->getCell()->mData.mFlags & ESM::Cell::HasWater)) {
|
||||
return false;
|
||||
}
|
||||
return pos.z < cell->mWaterLevel;
|
||||
|
@ -1816,7 +1816,7 @@ namespace MWWorld
|
|||
const OEngine::Physic::PhysicActor *physactor = mPhysEngine->getCharacter(refdata.getHandle());
|
||||
if((!physactor->getOnGround()&&physactor->getCollisionMode()) || isUnderwater(currentCell, playerPos))
|
||||
return 2;
|
||||
if((currentCell->mCell->mData.mFlags&ESM::Cell::NoSleep) ||
|
||||
if((currentCell->getCell()->mData.mFlags&ESM::Cell::NoSleep) ||
|
||||
Class::get(player).getNpcStats(player).isWerewolf())
|
||||
return 1;
|
||||
|
||||
|
|
Loading…
Reference in a new issue