|
|
@ -240,7 +240,7 @@ namespace MWWorld
|
|
|
|
mActiveCells.erase(*iter);
|
|
|
|
mActiveCells.erase(*iter);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void Scene::loadCell (CellStore *cell, Loading::Listener* loadingListener)
|
|
|
|
void Scene::loadCell (CellStore *cell, Loading::Listener* loadingListener, bool respawn)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
std::pair<CellStoreCollection::iterator, bool> result = mActiveCells.insert(cell);
|
|
|
|
std::pair<CellStoreCollection::iterator, bool> result = mActiveCells.insert(cell);
|
|
|
|
|
|
|
|
|
|
|
@ -270,12 +270,13 @@ namespace MWWorld
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
cell->respawn();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// register local scripts
|
|
|
|
// register local scripts
|
|
|
|
// do this before insertCell, to make sure we don't add scripts from levelled creature spawning twice
|
|
|
|
// do this before insertCell, to make sure we don't add scripts from levelled creature spawning twice
|
|
|
|
MWBase::Environment::get().getWorld()->getLocalScripts().addCell (cell);
|
|
|
|
MWBase::Environment::get().getWorld()->getLocalScripts().addCell (cell);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (respawn)
|
|
|
|
|
|
|
|
cell->respawn();
|
|
|
|
|
|
|
|
|
|
|
|
// ... then references. This is important for adjustPosition to work correctly.
|
|
|
|
// ... then references. This is important for adjustPosition to work correctly.
|
|
|
|
/// \todo rescale depending on the state of a new GMST
|
|
|
|
/// \todo rescale depending on the state of a new GMST
|
|
|
|
insertCell (*cell, true, loadingListener);
|
|
|
|
insertCell (*cell, true, loadingListener);
|
|
|
@ -329,7 +330,7 @@ namespace MWWorld
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void Scene::changeCellGrid (int X, int Y)
|
|
|
|
void Scene::changeCellGrid (int X, int Y, bool changeEvent)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
Loading::Listener* loadingListener = MWBase::Environment::get().getWindowManager()->getLoadingScreen();
|
|
|
|
Loading::Listener* loadingListener = MWBase::Environment::get().getWindowManager()->getLoadingScreen();
|
|
|
|
Loading::ScopedLoad load(loadingListener);
|
|
|
|
Loading::ScopedLoad load(loadingListener);
|
|
|
@ -403,7 +404,7 @@ namespace MWWorld
|
|
|
|
{
|
|
|
|
{
|
|
|
|
CellStore *cell = MWBase::Environment::get().getWorld()->getExterior(x, y);
|
|
|
|
CellStore *cell = MWBase::Environment::get().getWorld()->getExterior(x, y);
|
|
|
|
|
|
|
|
|
|
|
|
loadCell (cell, loadingListener);
|
|
|
|
loadCell (cell, loadingListener, changeEvent);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -411,7 +412,8 @@ namespace MWWorld
|
|
|
|
CellStore* current = MWBase::Environment::get().getWorld()->getExterior(X,Y);
|
|
|
|
CellStore* current = MWBase::Environment::get().getWorld()->getExterior(X,Y);
|
|
|
|
MWBase::Environment::get().getWindowManager()->changeCell(current);
|
|
|
|
MWBase::Environment::get().getWindowManager()->changeCell(current);
|
|
|
|
|
|
|
|
|
|
|
|
mCellChanged = true;
|
|
|
|
if (changeEvent)
|
|
|
|
|
|
|
|
mCellChanged = true;
|
|
|
|
|
|
|
|
|
|
|
|
mPreloader->updateCache(mRendering.getReferenceTime());
|
|
|
|
mPreloader->updateCache(mRendering.getReferenceTime());
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -484,7 +486,7 @@ namespace MWWorld
|
|
|
|
return mActiveCells;
|
|
|
|
return mActiveCells;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void Scene::changeToInteriorCell (const std::string& cellName, const ESM::Position& position)
|
|
|
|
void Scene::changeToInteriorCell (const std::string& cellName, const ESM::Position& position, bool changeEvent)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
CellStore *cell = MWBase::Environment::get().getWorld()->getInterior(cellName);
|
|
|
|
CellStore *cell = MWBase::Environment::get().getWorld()->getInterior(cellName);
|
|
|
|
bool loadcell = (mCurrentCell == NULL);
|
|
|
|
bool loadcell = (mCurrentCell == NULL);
|
|
|
@ -530,7 +532,7 @@ namespace MWWorld
|
|
|
|
loadingListener->setProgressRange(refsToLoad);
|
|
|
|
loadingListener->setProgressRange(refsToLoad);
|
|
|
|
|
|
|
|
|
|
|
|
// Load cell.
|
|
|
|
// Load cell.
|
|
|
|
loadCell (cell, loadingListener);
|
|
|
|
loadCell (cell, loadingListener, changeEvent);
|
|
|
|
|
|
|
|
|
|
|
|
changePlayerCell(cell, position, true);
|
|
|
|
changePlayerCell(cell, position, true);
|
|
|
|
|
|
|
|
|
|
|
@ -540,21 +542,24 @@ namespace MWWorld
|
|
|
|
// Sky system
|
|
|
|
// Sky system
|
|
|
|
MWBase::Environment::get().getWorld()->adjustSky();
|
|
|
|
MWBase::Environment::get().getWorld()->adjustSky();
|
|
|
|
|
|
|
|
|
|
|
|
mCellChanged = true; MWBase::Environment::get().getWindowManager()->fadeScreenIn(0.5);
|
|
|
|
if (changeEvent)
|
|
|
|
|
|
|
|
mCellChanged = true;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
MWBase::Environment::get().getWindowManager()->fadeScreenIn(0.5);
|
|
|
|
|
|
|
|
|
|
|
|
MWBase::Environment::get().getWindowManager()->changeCell(mCurrentCell);
|
|
|
|
MWBase::Environment::get().getWindowManager()->changeCell(mCurrentCell);
|
|
|
|
|
|
|
|
|
|
|
|
mPreloader->updateCache(mRendering.getReferenceTime());
|
|
|
|
mPreloader->updateCache(mRendering.getReferenceTime());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void Scene::changeToExteriorCell (const ESM::Position& position, bool adjustPlayerPos)
|
|
|
|
void Scene::changeToExteriorCell (const ESM::Position& position, bool adjustPlayerPos, bool changeEvent)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
int x = 0;
|
|
|
|
int x = 0;
|
|
|
|
int y = 0;
|
|
|
|
int y = 0;
|
|
|
|
|
|
|
|
|
|
|
|
MWBase::Environment::get().getWorld()->positionToIndex (position.pos[0], position.pos[1], x, y);
|
|
|
|
MWBase::Environment::get().getWorld()->positionToIndex (position.pos[0], position.pos[1], x, y);
|
|
|
|
|
|
|
|
|
|
|
|
changeCellGrid(x, y);
|
|
|
|
changeCellGrid(x, y, changeEvent);
|
|
|
|
|
|
|
|
|
|
|
|
CellStore* current = MWBase::Environment::get().getWorld()->getExterior(x, y);
|
|
|
|
CellStore* current = MWBase::Environment::get().getWorld()->getExterior(x, y);
|
|
|
|
changePlayerCell(current, position, adjustPlayerPos);
|
|
|
|
changePlayerCell(current, position, adjustPlayerPos);
|
|
|
|