forked from mirror/openmw-tes3mp
general player class cleanup
This commit is contained in:
parent
4a12be11bf
commit
4f51391003
2 changed files with 44 additions and 44 deletions
|
@ -32,6 +32,27 @@ namespace MWWorld
|
||||||
-mPlayer.ref.pos.pos[1]));
|
-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_)
|
void Player::setClass (const ESM::Class& class_)
|
||||||
{
|
{
|
||||||
ESM::Class *new_class = new ESM::Class (class_);
|
ESM::Class *new_class = new ESM::Class (class_);
|
||||||
|
|
|
@ -15,58 +15,37 @@ namespace MWWorld
|
||||||
|
|
||||||
namespace MWWorld
|
namespace MWWorld
|
||||||
{
|
{
|
||||||
class Player
|
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)
|
|
||||||
{
|
{
|
||||||
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
|
Player(Ogre::Camera *cam, const ESM::NPC *player, MWWorld::World& world);
|
||||||
// orientation. After the call, the new position is returned.
|
|
||||||
void moveRel(float &relX, float &relY, float &relZ)
|
|
||||||
{
|
|
||||||
using namespace Ogre;
|
|
||||||
|
|
||||||
// Move camera relative to its own direction
|
~Player();
|
||||||
camera->moveRelative(Vector3(relX,0,relZ));
|
|
||||||
|
|
||||||
// Up/down movement is always done relative the world axis.
|
/// Set the player position. Uses Morrowind coordinates.
|
||||||
camera->move(Vector3(0,relY,0));
|
void setPos(float _x, float _y, float _z, bool updateCamera = false);
|
||||||
|
|
||||||
// Get new camera position, converting back to MW coords.
|
void setCell (MWWorld::Ptr::CellStore *cellStore)
|
||||||
Vector3 pos = camera->getPosition();
|
{
|
||||||
relX = pos[0];
|
mCellStore = cellStore;
|
||||||
relY = -pos[2];
|
}
|
||||||
relZ = pos[1];
|
|
||||||
|
|
||||||
// TODO: Collision detection must be used to find the REAL new
|
Ogre::Camera *getCamera() { return camera; }
|
||||||
// position.
|
|
||||||
|
|
||||||
// Set the position
|
/// Move the player relative to her own position and
|
||||||
setPos(relX, relY, relZ);
|
/// orientation. After the call, the new position is returned.
|
||||||
}
|
void moveRel (float &relX, float &relY, float &relZ);
|
||||||
|
|
||||||
MWWorld::Ptr getPlayer()
|
MWWorld::Ptr getPlayer()
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue