mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-02-04 03:40:14 +00:00
Replicate vanilla Position/SetPos behavior more closely (bug #3109)
This commit is contained in:
parent
886c77bced
commit
3a0e374dc6
@ -4,6 +4,7 @@
|
||||
Bug #2969: Scripted items can stack
|
||||
Bug #2987: Editor: some chance and AI data fields can overflow
|
||||
Bug #3006: 'else if' operator breaks script compilation
|
||||
Bug #3109: SetPos/Position handles actors differently
|
||||
Bug #3282: Unintended behaviour when assigning F3 and Windows keys
|
||||
Bug #3623: Fix HiDPI on Windows
|
||||
Bug #3733: Normal maps are inverted on mirrored UVs
|
||||
|
@ -278,7 +278,7 @@ namespace MWBase
|
||||
virtual void deleteObject (const MWWorld::Ptr& ptr) = 0;
|
||||
virtual void undeleteObject (const MWWorld::Ptr& ptr) = 0;
|
||||
|
||||
virtual MWWorld::Ptr moveObject (const MWWorld::Ptr& ptr, float x, float y, float z) = 0;
|
||||
virtual MWWorld::Ptr moveObject (const MWWorld::Ptr& ptr, float x, float y, float z, bool moveToActive=false) = 0;
|
||||
///< @return an updated Ptr in case the Ptr's cell changes
|
||||
|
||||
virtual MWWorld::Ptr moveObject(const MWWorld::Ptr &ptr, MWWorld::CellStore* newCell, float x, float y, float z, bool movePhysics=true) = 0;
|
||||
|
@ -226,11 +226,11 @@ namespace MWScript
|
||||
MWWorld::Ptr updated = ptr;
|
||||
if(axis == "x")
|
||||
{
|
||||
updated = MWBase::Environment::get().getWorld()->moveObject(ptr,pos,ay,az);
|
||||
updated = MWBase::Environment::get().getWorld()->moveObject(ptr,pos,ay,az,true);
|
||||
}
|
||||
else if(axis == "y")
|
||||
{
|
||||
updated = MWBase::Environment::get().getWorld()->moveObject(ptr,ax,pos,az);
|
||||
updated = MWBase::Environment::get().getWorld()->moveObject(ptr,ax,pos,az,true);
|
||||
}
|
||||
else if(axis == "z")
|
||||
{
|
||||
@ -245,7 +245,7 @@ namespace MWScript
|
||||
pos = terrainHeight;
|
||||
}
|
||||
|
||||
updated = MWBase::Environment::get().getWorld()->moveObject(ptr,ax,ay,pos);
|
||||
updated = MWBase::Environment::get().getWorld()->moveObject(ptr,ax,ay,pos,true);
|
||||
}
|
||||
else
|
||||
throw std::runtime_error ("invalid axis: " + axis);
|
||||
@ -388,7 +388,7 @@ namespace MWScript
|
||||
}
|
||||
else
|
||||
{
|
||||
ptr = MWBase::Environment::get().getWorld()->moveObject(ptr, x, y, z);
|
||||
ptr = MWBase::Environment::get().getWorld()->moveObject(ptr, x, y, z, true);
|
||||
}
|
||||
dynamic_cast<MWScript::InterpreterContext&>(runtime.getContext()).updatePtr(base,ptr);
|
||||
|
||||
|
@ -1307,23 +1307,24 @@ namespace MWWorld
|
||||
return newPtr;
|
||||
}
|
||||
|
||||
MWWorld::Ptr World::moveObjectImp(const Ptr& ptr, float x, float y, float z, bool movePhysics)
|
||||
MWWorld::Ptr World::moveObjectImp(const Ptr& ptr, float x, float y, float z, bool movePhysics, bool moveToActive)
|
||||
{
|
||||
CellStore *cell = ptr.getCell();
|
||||
int cellX, cellY;
|
||||
positionToIndex(x, y, cellX, cellY);
|
||||
|
||||
if (cell->isExterior()) {
|
||||
int cellX, cellY;
|
||||
positionToIndex(x, y, cellX, cellY);
|
||||
CellStore* cell = ptr.getCell();
|
||||
CellStore* newCell = getExterior(cellX, cellY);
|
||||
bool isCellActive = getPlayerPtr().getCell()->isExterior() && mWorldScene->isCellActive(*newCell);
|
||||
|
||||
cell = getExterior(cellX, cellY);
|
||||
}
|
||||
if (cell->isExterior() || (moveToActive && isCellActive && ptr.getClass().isActor()))
|
||||
cell = newCell;
|
||||
|
||||
return moveObject(ptr, cell, x, y, z, movePhysics);
|
||||
}
|
||||
|
||||
MWWorld::Ptr World::moveObject (const Ptr& ptr, float x, float y, float z)
|
||||
MWWorld::Ptr World::moveObject (const Ptr& ptr, float x, float y, float z, bool moveToActive)
|
||||
{
|
||||
return moveObjectImp(ptr, x, y, z);
|
||||
return moveObjectImp(ptr, x, y, z, true, moveToActive);
|
||||
}
|
||||
|
||||
void World::scaleObject (const Ptr& ptr, float scale)
|
||||
|
@ -130,7 +130,7 @@ namespace MWWorld
|
||||
|
||||
void rotateObjectImp (const Ptr& ptr, const osg::Vec3f& rot, bool adjust);
|
||||
|
||||
Ptr moveObjectImp (const Ptr& ptr, float x, float y, float z, bool movePhysics=true);
|
||||
Ptr moveObjectImp (const Ptr& ptr, float x, float y, float z, bool movePhysics=true, bool moveToActive=false);
|
||||
///< @return an updated Ptr in case the Ptr's cell changes
|
||||
|
||||
Ptr copyObjectToCell(const ConstPtr &ptr, CellStore* cell, ESM::Position pos, int count, bool adjustPos);
|
||||
@ -382,7 +382,7 @@ namespace MWWorld
|
||||
|
||||
void undeleteObject (const Ptr& ptr) override;
|
||||
|
||||
MWWorld::Ptr moveObject (const Ptr& ptr, float x, float y, float z) override;
|
||||
MWWorld::Ptr moveObject (const Ptr& ptr, float x, float y, float z, bool moveToActive=false) override;
|
||||
///< @return an updated Ptr in case the Ptr's cell changes
|
||||
|
||||
MWWorld::Ptr moveObject (const Ptr& ptr, CellStore* newCell, float x, float y, float z, bool movePhysics=true) override;
|
||||
|
Loading…
x
Reference in New Issue
Block a user