forked from mirror/openmw-tes3mp
Updated Bug #430 fix so it only moves the player now
This commit is contained in:
parent
b7aa7e4cef
commit
accf8b2f71
1 changed files with 48 additions and 46 deletions
|
@ -304,57 +304,59 @@ namespace MWWorld
|
||||||
|
|
||||||
void Scene::changeToInteriorCell (const std::string& cellName, const ESM::Position& position)
|
void Scene::changeToInteriorCell (const std::string& cellName, const ESM::Position& position)
|
||||||
{
|
{
|
||||||
std::cout << "Changing to interior\n";
|
CellStore *cell = MWBase::Environment::get().getWorld()->getInterior(cellName);
|
||||||
|
|
||||||
|
|
||||||
bool loadcell = (mCurrentCell == NULL);
|
bool loadcell = (mCurrentCell == NULL);
|
||||||
|
if(!loadcell)
|
||||||
|
loadcell = *mCurrentCell != *cell;
|
||||||
|
|
||||||
if(!loadcell)
|
if(!loadcell)
|
||||||
{
|
{
|
||||||
std::string nam = std::string(cellName);
|
MWBase::World *world = MWBase::Environment::get().getWorld();
|
||||||
std::string curnam = std::string(mCurrentCell->cell->mName);
|
world->moveObject(world->getPlayer().getPlayer(), position.pos[0], position.pos[1], position.pos[2]);
|
||||||
std::transform(nam.begin(), nam.end(), nam.begin(), ::tolower);
|
|
||||||
std::transform(curnam.begin(), curnam.end(), curnam.begin(), ::tolower);
|
float x = Ogre::Radian(position.rot[0]).valueDegrees();
|
||||||
loadcell = nam != curnam;
|
float y = Ogre::Radian(position.rot[1]).valueDegrees();
|
||||||
|
float z = Ogre::Radian(position.rot[2]).valueDegrees();
|
||||||
|
world->rotateObject(world->getPlayer().getPlayer(), x, y, z);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
if(loadcell)
|
|
||||||
|
std::cout << "Changing to interior\n";
|
||||||
|
|
||||||
|
// remove active
|
||||||
|
CellStoreCollection::iterator active = mActiveCells.begin();
|
||||||
|
|
||||||
|
// count number of cells to unload
|
||||||
|
int numUnload = 0;
|
||||||
|
while (active!=mActiveCells.end())
|
||||||
{
|
{
|
||||||
CellStore *cell = MWBase::Environment::get().getWorld()->getInterior(cellName);
|
++active;
|
||||||
|
++numUnload;
|
||||||
// remove active
|
|
||||||
CellStoreCollection::iterator active = mActiveCells.begin();
|
|
||||||
|
|
||||||
// count number of cells to unload
|
|
||||||
int numUnload = 0;
|
|
||||||
while (active!=mActiveCells.end())
|
|
||||||
{
|
|
||||||
++active;
|
|
||||||
++numUnload;
|
|
||||||
}
|
|
||||||
|
|
||||||
// unload
|
|
||||||
int current = 0;
|
|
||||||
active = mActiveCells.begin();
|
|
||||||
while (active!=mActiveCells.end())
|
|
||||||
{
|
|
||||||
MWBase::Environment::get().getWindowManager ()->setLoadingProgress ("Unloading cells", 0, current, numUnload);
|
|
||||||
|
|
||||||
unloadCell (active++);
|
|
||||||
++current;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Load cell.
|
|
||||||
std::cout << "cellName:" << cellName << std::endl;
|
|
||||||
|
|
||||||
|
|
||||||
MWBase::Environment::get().getWindowManager ()->setLoadingProgress ("Loading cells", 0, 0, 1);
|
|
||||||
loadCell (cell);
|
|
||||||
|
|
||||||
mCurrentCell = cell;
|
|
||||||
|
|
||||||
// adjust fog
|
|
||||||
mRendering.switchToInterior();
|
|
||||||
mRendering.configureFog(*cell);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// unload
|
||||||
|
int current = 0;
|
||||||
|
active = mActiveCells.begin();
|
||||||
|
while (active!=mActiveCells.end())
|
||||||
|
{
|
||||||
|
MWBase::Environment::get().getWindowManager ()->setLoadingProgress ("Unloading cells", 0, current, numUnload);
|
||||||
|
|
||||||
|
unloadCell (active++);
|
||||||
|
++current;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Load cell.
|
||||||
|
std::cout << "cellName: " << cell->cell->mName << std::endl;
|
||||||
|
|
||||||
|
MWBase::Environment::get().getWindowManager ()->setLoadingProgress ("Loading cells", 0, 0, 1);
|
||||||
|
loadCell (cell);
|
||||||
|
|
||||||
|
mCurrentCell = cell;
|
||||||
|
|
||||||
|
// adjust fog
|
||||||
|
mRendering.switchToInterior();
|
||||||
|
mRendering.configureFog(*mCurrentCell);
|
||||||
|
|
||||||
// adjust player
|
// adjust player
|
||||||
playerCellChange (mCurrentCell, position);
|
playerCellChange (mCurrentCell, position);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue