mirror of
https://github.com/OpenMW/openmw.git
synced 2025-03-31 13:06:40 +00:00
fixes teleport to exterior cells.
fixes linux compile fix compile bis
This commit is contained in:
parent
502e4ad892
commit
1bbf4a3acf
7 changed files with 29 additions and 31 deletions
|
@ -301,7 +301,8 @@ namespace ESSImport
|
|||
marker.mWorldX = notepos[0];
|
||||
marker.mWorldY = notepos[1];
|
||||
marker.mNote = note;
|
||||
marker.mCell = cell.getCellId();
|
||||
marker.mCellId = cell.getCellId();
|
||||
marker.mCell = cell.getCellId().getCellRefId();
|
||||
mMarkers.push_back(marker);
|
||||
}
|
||||
|
||||
|
|
|
@ -49,7 +49,7 @@ namespace MWWorld
|
|||
std::string getDescription() const;
|
||||
const MoodData& getMood() const { return mMood; }
|
||||
float getWaterHeight() const { return mWaterHeight; }
|
||||
const ESM::RefId& getId() const { return mId; };
|
||||
const ESM::RefId& getId() const { return mId; }
|
||||
|
||||
private:
|
||||
bool mIsExterior;
|
||||
|
|
|
@ -73,25 +73,10 @@ namespace MWWorld
|
|||
ESM::Position CellRef::getDoorDest() const
|
||||
{
|
||||
|
||||
auto esm3Visit = [&](const ESM::CellRef& ref) -> ESM::Position {
|
||||
// So the destinaion pos is always in relationship to the destination cells origin, interior or exterior
|
||||
// alike
|
||||
ESM::Position pos = ref.mDoorDest;
|
||||
if (ref.mDestCell.empty()) // Exterior cell case
|
||||
{
|
||||
const osg::Vec2i index = positionToCellIndex(ref.mDoorDest.pos[0], ref.mDoorDest.pos[1]);
|
||||
pos.pos[0] -= index.x() * Constants::CellSizeInUnits;
|
||||
pos.pos[1] -= index.y() * Constants::CellSizeInUnits;
|
||||
}
|
||||
|
||||
return pos;
|
||||
};
|
||||
|
||||
return std::visit(
|
||||
ESM::VisitOverload{
|
||||
[&](const ESM4::Reference& ref) { return ref.mDoor.destPos; },
|
||||
esm3Visit,
|
||||
},
|
||||
return std::visit(ESM::VisitOverload{
|
||||
[&](const ESM4::Reference& ref) { return ref.mDoor.destPos; },
|
||||
[&](const ESM::CellRef& ref) -> ESM::Position { return ref.mDoorDest; },
|
||||
},
|
||||
mCellRef.mVariant);
|
||||
}
|
||||
|
||||
|
|
|
@ -920,16 +920,18 @@ namespace MWWorld
|
|||
MWBase::Environment::get().getWorld()->getPostProcessor()->setExteriorFlag(cell->getCell()->isQuasiExterior());
|
||||
}
|
||||
|
||||
void Scene::changeToExteriorCell(const ESM::Position& position, bool adjustPlayerPos, bool changeEvent)
|
||||
void Scene::changeToExteriorCell(
|
||||
const ESM::RefId& extCellId, const ESM::Position& position, bool adjustPlayerPos, bool changeEvent)
|
||||
{
|
||||
const osg::Vec2i cellIndex = positionToCellIndex(position.pos[0], position.pos[1]);
|
||||
|
||||
if (changeEvent)
|
||||
MWBase::Environment::get().getWindowManager()->fadeScreenOut(0.5);
|
||||
CellStore* current = mWorld.getWorldModel().getCell(extCellId);
|
||||
|
||||
const osg::Vec2i cellIndex(current->getCell()->getGridX(), current->getCell()->getGridY());
|
||||
|
||||
changeCellGrid(position.asVec3(), cellIndex.x(), cellIndex.y(), changeEvent);
|
||||
|
||||
CellStore* current = mWorld.getWorldModel().getExterior(cellIndex.x(), cellIndex.y());
|
||||
changePlayerCell(current, position, adjustPlayerPos);
|
||||
|
||||
if (changeEvent)
|
||||
|
|
|
@ -167,7 +167,8 @@ namespace MWWorld
|
|||
///< Move to interior cell.
|
||||
/// @param changeEvent Set cellChanged flag?
|
||||
|
||||
void changeToExteriorCell(const ESM::Position& position, bool adjustPlayerPos, bool changeEvent = true);
|
||||
void changeToExteriorCell(
|
||||
const ESM::RefId& extCellId, const ESM::Position& position, bool adjustPlayerPos, bool changeEvent = true);
|
||||
///< Move to exterior cell.
|
||||
/// @param changeEvent Set cellChanged flag?
|
||||
|
||||
|
|
|
@ -378,7 +378,12 @@ namespace MWWorld
|
|||
pos.rot[0] = 0;
|
||||
pos.rot[1] = 0;
|
||||
pos.rot[2] = 0;
|
||||
mWorldScene->changeToExteriorCell(pos, true);
|
||||
|
||||
osg::Vec2i exteriorCellPos = positionToCellIndex(pos.pos[0], pos.pos[1]);
|
||||
ESM::CellId CellId;
|
||||
CellId.mPaged = true;
|
||||
CellId.mIndex = { exteriorCellPos.x(), exteriorCellPos.y() };
|
||||
mWorldScene->changeToExteriorCell(CellId.getCellRefId(), pos, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -981,7 +986,11 @@ namespace MWWorld
|
|||
mRendering->notifyWorldSpaceChanged();
|
||||
}
|
||||
removeContainerScripts(getPlayerPtr());
|
||||
mWorldScene->changeToExteriorCell(position, adjustPlayerPos, changeEvent);
|
||||
osg::Vec2i exteriorCellPos = positionToCellIndex(position.pos[0], position.pos[1]);
|
||||
ESM::CellId CellId;
|
||||
CellId.mPaged = true;
|
||||
CellId.mIndex = { exteriorCellPos.x(), exteriorCellPos.y() };
|
||||
mWorldScene->changeToExteriorCell(CellId.getCellRefId(), position, adjustPlayerPos, changeEvent);
|
||||
addContainerScripts(getPlayerPtr(), getPlayerPtr().getCell());
|
||||
mRendering->getCamera()->instantTransition();
|
||||
}
|
||||
|
@ -1018,7 +1027,7 @@ namespace MWWorld
|
|||
}
|
||||
removeContainerScripts(getPlayerPtr());
|
||||
if (exteriorCell)
|
||||
mWorldScene->changeToExteriorCell(position, adjustPlayerPos, changeEvent);
|
||||
mWorldScene->changeToExteriorCell(cellId, position, adjustPlayerPos, changeEvent);
|
||||
else
|
||||
mWorldScene->changeToInteriorCell(destinationCell->getNameId(), position, adjustPlayerPos, changeEvent);
|
||||
addContainerScripts(getPlayerPtr(), getPlayerPtr().getCell());
|
||||
|
@ -1194,7 +1203,7 @@ namespace MWWorld
|
|||
if (mWorldScene->isCellActive(*newCell))
|
||||
mWorldScene->changePlayerCell(newCell, pos, false);
|
||||
else
|
||||
mWorldScene->changeToExteriorCell(pos, false);
|
||||
mWorldScene->changeToExteriorCell(newCell->getCell()->getId(), pos, false);
|
||||
}
|
||||
addContainerScripts(getPlayerPtr(), newCell);
|
||||
newPtr = getPlayerPtr();
|
||||
|
|
|
@ -267,11 +267,11 @@ MWWorld::CellStore* MWWorld::WorldModel::getCell(const ESM::RefId& id)
|
|||
{
|
||||
std::pair<int, int> coord
|
||||
= std::make_pair(newCellStore->getCell()->getGridX(), newCellStore->getCell()->getGridY());
|
||||
mExteriors.emplace(coord, newCellStore).first;
|
||||
mExteriors.emplace(coord, newCellStore);
|
||||
}
|
||||
else
|
||||
{
|
||||
mInteriors.emplace(newCellStore->getCell()->getNameId(), newCellStore).first;
|
||||
mInteriors.emplace(newCellStore->getCell()->getNameId(), newCellStore);
|
||||
}
|
||||
if (newCellStore->getState() != CellStore::State_Loaded)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue