Do not adjust the player position when loading a savegame (Fixes #2089)

openmw-39
scrawl 9 years ago
parent 92c2a10de4
commit 5bd8ef247d

@ -231,15 +231,15 @@ namespace MWBase
virtual float getTimeScaleFactor() const = 0;
virtual void changeToInteriorCell (const std::string& cellName, const ESM::Position& position, bool changeEvent=true) = 0;
virtual void changeToInteriorCell (const std::string& cellName, const ESM::Position& position, bool adjustPlayerPos, bool changeEvent=true) = 0;
///< Move to interior cell.
///< @param changeEvent If false, do not trigger cell change flag or detect worldspace changes
virtual void changeToExteriorCell (const ESM::Position& position, bool changeEvent=true) = 0;
virtual void changeToExteriorCell (const ESM::Position& position, bool adjustPlayerPos, bool changeEvent=true) = 0;
///< Move to exterior cell.
///< @param changeEvent If false, do not trigger cell change flag or detect worldspace changes
virtual void changeToCell (const ESM::CellId& cellId, const ESM::Position& position, bool changeEvent=true) = 0;
virtual void changeToCell (const ESM::CellId& cellId, const ESM::Position& position, bool adjustPlayerPos, bool changeEvent=true) = 0;
///< @param changeEvent If false, do not trigger cell change flag or detect worldspace changes
virtual const ESM::Cell *getExterior (const std::string& cellName) const = 0;

@ -49,7 +49,7 @@ namespace MWScript
world->getPlayer().setTeleported(true);
if (world->findExteriorPosition(cell, pos))
{
world->changeToExteriorCell(pos);
world->changeToExteriorCell(pos, true);
world->fixPosition(world->getPlayerPtr());
}
else
@ -57,7 +57,7 @@ namespace MWScript
// Change to interior even if findInteriorPosition()
// yields false. In this case position will be zero-point.
world->findInteriorPosition(cell, pos);
world->changeToInteriorCell(cell, pos);
world->changeToInteriorCell(cell, pos, true);
}
}
};
@ -82,7 +82,7 @@ namespace MWScript
pos.rot[0] = pos.rot[1] = pos.rot[2] = 0;
world->changeToExteriorCell (pos);
world->changeToExteriorCell (pos, true);
world->fixPosition(world->getPlayerPtr());
}
};

@ -495,7 +495,7 @@ void MWState::StateManager::loadGame (const Character *character, const std::str
const ESM::CellId& cellId = ptr.getCell()->getCell()->getCellId();
// Use detectWorldSpaceChange=false, otherwise some of the data we just loaded would be cleared again
MWBase::Environment::get().getWorld()->changeToCell (cellId, ptr.getRefData().getPosition(), false);
MWBase::Environment::get().getWorld()->changeToCell (cellId, ptr.getRefData().getPosition(), false, false);
// Vanilla MW will restart startup scripts when a save game is loaded. This is unintuitive,
// but some mods may be using it as a reload detector.

@ -64,9 +64,9 @@ namespace MWWorld
{
world->getPlayer().setTeleported(true);
if (mCellName.empty())
world->changeToExteriorCell (mPosition);
world->changeToExteriorCell (mPosition, true);
else
world->changeToInteriorCell (mCellName, mPosition);
world->changeToInteriorCell (mCellName, mPosition, true);
}
else
{

@ -444,7 +444,8 @@ namespace MWWorld
float z = pos.rot[2];
world->rotateObject(player, x, y, z);
player.getClass().adjustPosition(player, true);
if (adjustPlayerPos)
player.getClass().adjustPosition(player, true);
}
MWBase::MechanicsManager *mechMgr =
@ -493,7 +494,7 @@ namespace MWWorld
return mActiveCells;
}
void Scene::changeToInteriorCell (const std::string& cellName, const ESM::Position& position, bool changeEvent)
void Scene::changeToInteriorCell (const std::string& cellName, const ESM::Position& position, bool adjustPlayerPos, bool changeEvent)
{
CellStore *cell = MWBase::Environment::get().getWorld()->getInterior(cellName);
bool loadcell = (mCurrentCell == NULL);
@ -519,7 +520,8 @@ namespace MWWorld
float z = position.rot[2];
world->rotateObject(world->getPlayerPtr(), x, y, z);
world->getPlayerPtr().getClass().adjustPosition(world->getPlayerPtr(), true);
if (adjustPlayerPos)
world->getPlayerPtr().getClass().adjustPosition(world->getPlayerPtr(), true);
MWBase::Environment::get().getWindowManager()->fadeScreenIn(0.5);
return;
}

@ -103,7 +103,7 @@ namespace MWWorld
bool hasCellChanged() const;
///< Has the set of active cells changed, since the last frame?
void changeToInteriorCell (const std::string& cellName, const ESM::Position& position, bool changeEvent=true);
void changeToInteriorCell (const std::string& cellName, const ESM::Position& position, bool adjustPlayerPos, bool changeEvent=true);
///< Move to interior cell.
/// @param changeEvent Set cellChanged flag?

@ -251,13 +251,13 @@ namespace MWWorld
if (findExteriorPosition (mStartCell, pos))
{
changeToExteriorCell (pos);
changeToExteriorCell (pos, true);
fixPosition(getPlayerPtr());
}
else
{
findInteriorPosition (mStartCell, pos);
changeToInteriorCell (mStartCell, pos);
changeToInteriorCell (mStartCell, pos, true);
}
}
else
@ -962,7 +962,7 @@ namespace MWWorld
return mTimeScale->getFloat();
}
void World::changeToInteriorCell (const std::string& cellName, const ESM::Position& position, bool changeEvent)
void World::changeToInteriorCell (const std::string& cellName, const ESM::Position& position, bool adjustPlayerPos, bool changeEvent)
{
mPhysics->clearQueuedMovement();
@ -976,11 +976,11 @@ namespace MWWorld
}
removeContainerScripts(getPlayerPtr());
mWorldScene->changeToInteriorCell(cellName, position, changeEvent);
mWorldScene->changeToInteriorCell(cellName, position, adjustPlayerPos, changeEvent);
addContainerScripts(getPlayerPtr(), getPlayerPtr().getCell());
}
void World::changeToExteriorCell (const ESM::Position& position, bool changeEvent)
void World::changeToExteriorCell (const ESM::Position& position, bool adjustPlayerPos, bool changeEvent)
{
mPhysics->clearQueuedMovement();
@ -991,17 +991,17 @@ namespace MWWorld
mRendering->notifyWorldSpaceChanged();
}
removeContainerScripts(getPlayerPtr());
mWorldScene->changeToExteriorCell(position, true, changeEvent);
mWorldScene->changeToExteriorCell(position, adjustPlayerPos, changeEvent);
addContainerScripts(getPlayerPtr(), getPlayerPtr().getCell());
}
void World::changeToCell (const ESM::CellId& cellId, const ESM::Position& position, bool changeEvent)
void World::changeToCell (const ESM::CellId& cellId, const ESM::Position& position, bool adjustPlayerPos, bool changeEvent)
{
if (!changeEvent)
mCurrentWorldSpace = cellId.mWorldspace;
if (cellId.mPaged)
changeToExteriorCell (position, changeEvent);
changeToExteriorCell (position, adjustPlayerPos, changeEvent);
else
changeToInteriorCell (cellId.mWorldspace, position, changeEvent);
}
@ -1137,7 +1137,7 @@ namespace MWWorld
if (isPlayer)
{
if (!newCell->isExterior())
changeToInteriorCell(Misc::StringUtils::lowerCase(newCell->getCell()->mName), pos);
changeToInteriorCell(Misc::StringUtils::lowerCase(newCell->getCell()->mName), pos, false);
else
{
if (mWorldScene->isCellActive(*newCell))

@ -324,15 +324,15 @@ namespace MWWorld
virtual float getTimeScaleFactor() const;
virtual void changeToInteriorCell (const std::string& cellName, const ESM::Position& position, bool changeEvent = true);
virtual void changeToInteriorCell (const std::string& cellName, const ESM::Position& position, bool adjustPlayerPos, bool changeEvent = true);
///< Move to interior cell.
///< @param changeEvent If false, do not trigger cell change flag or detect worldspace changes
virtual void changeToExteriorCell (const ESM::Position& position, bool changeEvent = true);
virtual void changeToExteriorCell (const ESM::Position& position, bool adjustPlayerPos, bool changeEvent = true);
///< Move to exterior cell.
///< @param changeEvent If false, do not trigger cell change flag or detect worldspace changes
virtual void changeToCell (const ESM::CellId& cellId, const ESM::Position& position, bool changeEvent=true);
virtual void changeToCell (const ESM::CellId& cellId, const ESM::Position& position, bool adjustPlayerPos, bool changeEvent=true);
///< @param changeEvent If false, do not trigger cell change flag or detect worldspace changes
virtual const ESM::Cell *getExterior (const std::string& cellName) const;

Loading…
Cancel
Save