Merge branch 'cross_cell-borders' of https://github.com/greye/openmw.git into object_movement_creation

This commit is contained in:
gugus 2012-08-11 09:53:06 +02:00
commit 54221aab89
2 changed files with 18 additions and 18 deletions

View file

@ -254,27 +254,28 @@ RenderingManager::rotateObject(
Ogre::Vector3 &rot,
bool adjust)
{
if (ptr.getRefData().getHandle() == "player") {
if (adjust) {
return mPlayer->adjustRotation(rot);
} else {
return mPlayer->setRotation(rot);
}
bool isPlayer = ptr.getRefData().getHandle() == "player";
bool force = true;
if (isPlayer) {
force = (adjust) ? mPlayer->adjustRotation(rot) : mPlayer->setRotation(rot);
}
MWWorld::Class::get(ptr).adjustRotation(ptr, rot.x, rot.y, rot.z);
if (adjust) {
float *f = ptr.getRefData().getPosition().rot;
rot.x += f[0], rot.y += f[1], rot.z += f[2];
rot.x += Ogre::Radian(f[0]).valueDegrees();
rot.y += Ogre::Radian(f[1]).valueDegrees();
rot.z += Ogre::Radian(f[2]).valueDegrees();
}
if (!isPlayer) {
Ogre::Quaternion xr(Ogre::Degree(rot.x), Ogre::Vector3::UNIT_X);
Ogre::Quaternion yr(Ogre::Degree(rot.y), Ogre::Vector3::UNIT_Y);
Ogre::Quaternion zr(Ogre::Degree(rot.z), Ogre::Vector3::UNIT_Z);
ptr.getRefData().getBaseNode()->setOrientation(xr * yr * zr);
}
Ogre::Quaternion xr(Ogre::Degree(rot.x), Ogre::Vector3::UNIT_X);
Ogre::Quaternion yr(Ogre::Degree(rot.y), Ogre::Vector3::UNIT_Y);
Ogre::Quaternion zr(Ogre::Degree(rot.z), Ogre::Vector3::UNIT_Z);
ptr.getRefData().getBaseNode()->setOrientation(xr * yr * zr);
return true;
return force;
}
void

View file

@ -140,19 +140,18 @@ namespace MWWorld
const ESM::Position& pos,
bool adjustPlayerPos)
{
MWBase::Environment::get().getWorld()->getPlayer().setCell (cell);
bool hasWater = cell->cell->data.flags & cell->cell->HasWater;
mPhysics->setCurrentWater(hasWater, cell->cell->water);
MWBase::World *world = MWBase::Environment::get().getWorld();
world->getPlayer().setCell(cell);
MWWorld::Ptr player = world->getPlayer().getPlayer();
if (adjustPlayerPos) {
world->moveObject(player, pos.pos[0], pos.pos[1], pos.pos[2]);
world->rotateObject(player, pos.rot[0], pos.rot[1], pos.rot[2]);
}
world->getPlayer().setCell(cell);
MWMechanics::MechanicsManager *mechMgr =
MWBase::Environment::get().getMechanicsManager();