diff --git a/apps/openmw/mwworld/player.cpp b/apps/openmw/mwworld/player.cpp index 33b29a99a5..c2dd8ff356 100644 --- a/apps/openmw/mwworld/player.cpp +++ b/apps/openmw/mwworld/player.cpp @@ -32,6 +32,27 @@ namespace MWWorld -mPlayer.ref.pos.pos[1])); } + void Player::moveRel (float &relX, float &relY, float &relZ) + { + // Move camera relative to its own direction + camera->moveRelative (Ogre::Vector3(relX,0,relZ)); + + // Up/down movement is always done relative the world axis. + camera->move (Ogre::Vector3(0,relY,0)); + + // Get new camera position, converting back to MW coords. + Ogre::Vector3 pos = camera->getPosition(); + relX = pos[0]; + relY = -pos[2]; + relZ = pos[1]; + + // TODO: Collision detection must be used to find the REAL new + // position. + + // Set the position + setPos(relX, relY, relZ); + } + void Player::setClass (const ESM::Class& class_) { ESM::Class *new_class = new ESM::Class (class_); diff --git a/apps/openmw/mwworld/player.hpp b/apps/openmw/mwworld/player.hpp index 84a0dfef4c..0b488116e8 100644 --- a/apps/openmw/mwworld/player.hpp +++ b/apps/openmw/mwworld/player.hpp @@ -15,58 +15,37 @@ namespace MWWorld namespace MWWorld { - class Player - { - ESMS::LiveCellRef mPlayer; - MWWorld::Ptr::CellStore *mCellStore; - Ogre::Camera *camera; - MWWorld::World& mWorld; - std::string mName; - bool mMale; - std::string mRace; - std::string mBirthsign; - ESM::Class *mClass; - - public: - - Player(Ogre::Camera *cam, const ESM::NPC *player, MWWorld::World& world); - - ~Player(); - - // Set the player position. Uses Morrowind coordinates. - void setPos(float _x, float _y, float _z, bool updateCamera = false); - - void setCell (MWWorld::Ptr::CellStore *cellStore) + class Player { - mCellStore = cellStore; - } + ESMS::LiveCellRef mPlayer; + MWWorld::Ptr::CellStore *mCellStore; + Ogre::Camera *camera; + MWWorld::World& mWorld; + std::string mName; + bool mMale; + std::string mRace; + std::string mBirthsign; + ESM::Class *mClass; - Ogre::Camera *getCamera() { return camera; } + public: - // Move the player relative to her own position and - // orientation. After the call, the new position is returned. - void moveRel(float &relX, float &relY, float &relZ) - { - using namespace Ogre; + Player(Ogre::Camera *cam, const ESM::NPC *player, MWWorld::World& world); - // Move camera relative to its own direction - camera->moveRelative(Vector3(relX,0,relZ)); + ~Player(); - // Up/down movement is always done relative the world axis. - camera->move(Vector3(0,relY,0)); + /// Set the player position. Uses Morrowind coordinates. + void setPos(float _x, float _y, float _z, bool updateCamera = false); - // Get new camera position, converting back to MW coords. - Vector3 pos = camera->getPosition(); - relX = pos[0]; - relY = -pos[2]; - relZ = pos[1]; + void setCell (MWWorld::Ptr::CellStore *cellStore) + { + mCellStore = cellStore; + } - // TODO: Collision detection must be used to find the REAL new - // position. + Ogre::Camera *getCamera() { return camera; } - // Set the position - setPos(relX, relY, relZ); - } + /// Move the player relative to her own position and + /// orientation. After the call, the new position is returned. + void moveRel (float &relX, float &relY, float &relZ); MWWorld::Ptr getPlayer() {