2011-01-04 14:58:22 +00:00
|
|
|
#ifndef GAME_MWWORLD_PLAYER_H
|
|
|
|
#define GAME_MWWORLD_PLAYER_H
|
2010-06-21 21:39:59 +00:00
|
|
|
|
2010-07-05 10:09:04 +00:00
|
|
|
#include "../mwworld/refdata.hpp"
|
2013-04-04 09:23:17 +00:00
|
|
|
#include "../mwworld/livecellref.hpp"
|
2010-07-05 10:09:04 +00:00
|
|
|
|
2012-04-08 10:25:33 +00:00
|
|
|
#include "../mwmechanics/drawstate.hpp"
|
2015-06-21 15:27:52 +00:00
|
|
|
#include "../mwmechanics/stat.hpp"
|
|
|
|
|
|
|
|
#include <components/esm/loadskil.hpp>
|
|
|
|
#include <components/esm/attr.hpp>
|
2012-04-08 10:25:33 +00:00
|
|
|
|
2013-04-04 09:23:17 +00:00
|
|
|
namespace ESM
|
|
|
|
{
|
|
|
|
struct NPC;
|
2014-01-16 11:03:23 +00:00
|
|
|
class ESMWriter;
|
|
|
|
class ESMReader;
|
2013-04-04 09:23:17 +00:00
|
|
|
}
|
|
|
|
|
2014-04-28 09:29:57 +00:00
|
|
|
namespace Loading
|
|
|
|
{
|
|
|
|
class Listener;
|
|
|
|
}
|
|
|
|
|
2011-01-04 14:58:22 +00:00
|
|
|
namespace MWWorld
|
2010-06-21 21:39:59 +00:00
|
|
|
{
|
2012-07-03 11:55:53 +00:00
|
|
|
class CellStore;
|
|
|
|
|
2011-01-08 14:11:37 +00:00
|
|
|
/// \brief NPC object representing the player and additional player data
|
2012-06-29 14:48:50 +00:00
|
|
|
class Player
|
2010-07-26 10:59:50 +00:00
|
|
|
{
|
2012-11-07 21:36:43 +00:00
|
|
|
LiveCellRef<ESM::NPC> mPlayer;
|
|
|
|
MWWorld::CellStore *mCellStore;
|
2012-11-08 14:50:18 +00:00
|
|
|
std::string mSign;
|
2012-11-07 21:36:43 +00:00
|
|
|
|
2015-06-03 17:41:19 +00:00
|
|
|
osg::Vec3f mLastKnownExteriorPosition;
|
2013-12-31 23:12:31 +00:00
|
|
|
|
2014-01-01 16:06:21 +00:00
|
|
|
ESM::Position mMarkedPosition;
|
|
|
|
// If no position was marked, this is NULL
|
|
|
|
CellStore* mMarkedCell;
|
|
|
|
|
2012-11-07 21:36:43 +00:00
|
|
|
bool mAutoMove;
|
|
|
|
int mForwardBackward;
|
2013-12-31 19:40:23 +00:00
|
|
|
bool mTeleported;
|
2014-04-05 14:26:14 +00:00
|
|
|
|
|
|
|
int mCurrentCrimeId; // the id assigned witnesses
|
2014-05-03 10:23:22 +00:00
|
|
|
int mPaidCrimeId; // the last id paid off (0 bounty)
|
2014-04-25 02:47:45 +00:00
|
|
|
|
2015-06-21 15:27:52 +00:00
|
|
|
// Saved skills and attributes prior to becoming a werewolf
|
|
|
|
MWMechanics::SkillValue mSaveSkills[ESM::Skill::Length];
|
|
|
|
MWMechanics::AttributeValue mSaveAttributes[ESM::Attribute::Length];
|
|
|
|
|
2015-07-02 17:14:28 +00:00
|
|
|
bool mAttackingOrSpell;
|
|
|
|
|
2011-01-06 09:07:01 +00:00
|
|
|
public:
|
2010-06-22 08:15:22 +00:00
|
|
|
|
2015-07-02 16:11:24 +00:00
|
|
|
Player(const ESM::NPC *player);
|
2010-06-21 21:39:59 +00:00
|
|
|
|
2015-06-21 15:27:52 +00:00
|
|
|
void saveSkillsAttributes();
|
|
|
|
void restoreSkillsAttributes();
|
|
|
|
void setWerewolfSkillsAttributes();
|
|
|
|
|
2014-01-01 16:06:21 +00:00
|
|
|
// For mark/recall magic effects
|
|
|
|
void markPosition (CellStore* markedCell, ESM::Position markedPosition);
|
|
|
|
void getMarkedPosition (CellStore*& markedCell, ESM::Position& markedPosition) const;
|
|
|
|
|
2013-12-31 23:12:31 +00:00
|
|
|
/// Interiors can not always be mapped to a world position. However
|
|
|
|
/// world position is still required for divine / almsivi magic effects
|
|
|
|
/// and the player arrow on the global map.
|
2015-06-03 17:41:19 +00:00
|
|
|
void setLastKnownExteriorPosition (const osg::Vec3f& position) { mLastKnownExteriorPosition = position; }
|
|
|
|
osg::Vec3f getLastKnownExteriorPosition() const { return mLastKnownExteriorPosition; }
|
2013-12-31 23:12:31 +00:00
|
|
|
|
2013-05-15 15:54:18 +00:00
|
|
|
void set (const ESM::NPC *player);
|
|
|
|
|
2013-04-04 09:23:17 +00:00
|
|
|
void setCell (MWWorld::CellStore *cellStore);
|
2010-06-21 21:39:59 +00:00
|
|
|
|
2013-04-04 09:23:17 +00:00
|
|
|
MWWorld::Ptr getPlayer();
|
2010-09-15 10:22:06 +00:00
|
|
|
|
2013-04-04 09:23:17 +00:00
|
|
|
void setBirthSign(const std::string &sign);
|
|
|
|
const std::string &getBirthSign() const;
|
2012-11-08 14:50:18 +00:00
|
|
|
|
2012-07-07 18:53:19 +00:00
|
|
|
void setDrawState (MWMechanics::DrawState_ state);
|
|
|
|
MWMechanics::DrawState_ getDrawState(); /// \todo constness
|
2012-04-08 10:25:33 +00:00
|
|
|
|
2015-11-14 01:43:24 +00:00
|
|
|
/// Activate the object under the crosshair, if any
|
|
|
|
void activate();
|
|
|
|
|
2014-04-05 14:26:14 +00:00
|
|
|
bool getAutoMove() const;
|
2011-02-03 11:16:59 +00:00
|
|
|
void setAutoMove (bool enable);
|
2011-01-18 14:20:36 +00:00
|
|
|
|
2011-02-03 11:16:59 +00:00
|
|
|
void setLeftRight (int value);
|
2011-01-18 14:20:36 +00:00
|
|
|
|
2011-02-03 11:16:59 +00:00
|
|
|
void setForwardBackward (int value);
|
2012-06-29 16:54:23 +00:00
|
|
|
void setUpDown(int value);
|
2011-01-18 14:20:36 +00:00
|
|
|
|
2013-02-07 01:51:47 +00:00
|
|
|
void setRunState(bool run);
|
2013-03-06 15:58:56 +00:00
|
|
|
void setSneak(bool sneak);
|
2013-03-31 09:57:22 +00:00
|
|
|
|
2013-06-12 14:07:46 +00:00
|
|
|
void yaw(float yaw);
|
|
|
|
void pitch(float pitch);
|
|
|
|
void roll(float roll);
|
2013-12-31 19:40:23 +00:00
|
|
|
|
|
|
|
bool wasTeleported() const;
|
|
|
|
void setTeleported(bool teleported);
|
2014-01-11 14:34:32 +00:00
|
|
|
|
2015-07-02 17:14:28 +00:00
|
|
|
void setAttackingOrSpell(bool attackingOrSpell);
|
|
|
|
bool getAttackingOrSpell() const;
|
|
|
|
|
2014-04-28 00:54:22 +00:00
|
|
|
///Checks all nearby actors to see if anyone has an aipackage against you
|
2014-04-25 02:47:45 +00:00
|
|
|
bool isInCombat();
|
|
|
|
|
2014-01-11 14:34:32 +00:00
|
|
|
void clear();
|
2014-01-16 11:03:23 +00:00
|
|
|
|
2014-04-28 09:29:57 +00:00
|
|
|
void write (ESM::ESMWriter& writer, Loading::Listener& progress) const;
|
2014-01-16 11:03:23 +00:00
|
|
|
|
2015-01-22 18:04:59 +00:00
|
|
|
bool readRecord (ESM::ESMReader& reader, uint32_t type);
|
2014-04-05 14:26:14 +00:00
|
|
|
|
|
|
|
int getNewCrimeId(); // get new id for witnesses
|
2014-05-03 10:23:22 +00:00
|
|
|
void recordCrimeId(); // record the paid crime id when bounty is 0
|
|
|
|
int getCrimeId() const; // get the last paid crime id
|
2011-01-18 14:20:36 +00:00
|
|
|
};
|
2010-06-21 21:39:59 +00:00
|
|
|
}
|
|
|
|
#endif
|