|
|
|
@ -15,58 +15,37 @@ namespace MWWorld
|
|
|
|
|
|
|
|
|
|
namespace MWWorld
|
|
|
|
|
{
|
|
|
|
|
class Player
|
|
|
|
|
{
|
|
|
|
|
ESMS::LiveCellRef<ESM::NPC, MWWorld::RefData> 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<ESM::NPC, MWWorld::RefData> 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()
|
|
|
|
|
{
|
|
|
|
|