mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-25 06:35:30 +00:00
general player class cleanup
This commit is contained in:
parent
4a12be11bf
commit
4f51391003
@ -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_);
|
||||
|
@ -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()
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user