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