Emergency 20 Dokumentation  4.2.0
em5::Player Class Reference

EMERGENCY 5 player class. More...

#include <Player.h>

Inheritance diagram for em5::Player:

Classes

struct  BuyOption
 

Public Types

enum  CameraType { CameraType::UNKNOWN_CAMERA = 0, CameraType::INGAME_CAMERA, CameraType::FREE_CAMERA, CameraType::CUTSCENE_CAMERA }
 
enum  DebugFlag { DEBUG_PLAYER, DEBUG_UNITPOOL }
 
typedef std::vector< const BuyOption * > BuyOptionPointerArray
 
typedef qsf::EnumBitmask< uint8, DebugFlagDebugFlagSet
 
typedef std::vector< uint64EntityIdArray
 

Public Member Functions

 Player (uint32 index, bool isLocal, VersionSwitch::Edition gameEdition)
 Constructor. More...
 
virtual ~Player ()
 Destructor. More...
 
void startup ()
 Start up the player. More...
 
void shutdown ()
 Shutdown the player. More...
 
const std::string & getName () const
 Return the player's name. More...
 
void setName (const std::string &name)
 Set the player's name. More...
 
uint32 getPlayerIndex () const
 Return the player's index. More...
 
void setPlayerIndex (uint32 playerIndex)
 Set the player's index. More...
 
uint16 getTeamId () const
 Return the player's team ID. More...
 
void setTeamId (uint16 teamId)
 Set the player's team ID. More...
 
bool isPlayerLocal () const
 Returns the state of the player if he is local or not. More...
 
VersionSwitch::Edition getGameEdition () const
 Returns the player's game edition (e.g. Standard or Deluxe edition) More...
 
qsf::Color4 getPlayerColor () const
 
void setPlayerColor (const qsf::Color4 &color)
 
uint32 getUserData () const
 
void setUserData (const uint32 userData)
 
qsf::EntitygetMainCameraEntity () const
 Get the main camera entity. More...
 
qsf::CameraComponentgetMainCameraComponent () const
 Get the main camera component. More...
 
qsf::FreeMoveInputHandlergetMainCameraInputHandler () const
 Get the main camera input handler. More...
 
CameraType getCameraType () const
 
qsf::CameraComponentgetCameraComponent () const
 
void setCameraType (CameraType cameraType, qsf::CameraComponent *cameraComponent=nullptr, bool inputChange=true)
 
void resetCameraToStartTransform ()
 
void setCameraToTransform (const qsf::Transform &transform)
 
void setCameraToEntityTransform (const qsf::Entity &cameraEntity)
 
void setCameraToEntityTransform (const std::string &cameraEntityEventTag)
 
const glm::vec3 & getViewPosition () const
 
void setViewPosition (const glm::vec3 &viewPosition)
 
void updateViewTransform ()
 
qsf::Ray getCameraViewRay () const
 
qsf::CameraComponentgetStartCameraInMap (qsf::Map &map) const
 
UnitPoolgetUnitPool () const
 Return the player's unit pool. More...
 
void unblockUnitPool ()
 
const std::vector< uint64 > & getUnitGroupByIndex (uint32 index)
 Return the saved group; can be empty or misleading uints. More...
 
void setUnitGroupByIndex (uint32 index, const std::vector< uint64 > &savedIds)
 
uint32 getScore () const
 Return the score of the player. More...
 
void setScore (uint32 score)
 Set the score to the given value. More...
 
void addScore (int32 score)
 Add the given value to the score. More...
 
uint32 getCredits () const
 Return the player's credits. More...
 
void setCredits (uint32 credits)
 Set the credits to the given value. More...
 
void addCredits (int32 credits)
 Subtract the given value from the credits. More...
 
const BuyOptionPointerArraygetBuyOptions () const
 
void clearBuyOptions ()
 
void addBuyOption (const BuyOption &buyOption)
 
bool purchaseBuyOptionByIndex (uint32 index)
 
bool purchaseBuyOption (const BuyOption &buyOption)
 
bool hasUnboughtBuyOptions () const
 
void toggleDebugFlag (DebugFlag flag)
 Toggle debug flag. More...
 
void serialize (qsf::BinarySerializer &serializer)
 Serialization of the player. More...
 
void updateViewPosition (const qsf::JobArguments &)
 
void updateDynamicPssmLambda (const qsf::JobArguments &)
 

Static Public Attributes

static const uint32 MAIN_CAMERA_INPUT_HANDLER_ID
 

Detailed Description

EMERGENCY 5 player class.

Member Typedef Documentation

typedef std::vector<const BuyOption*> em5::Player::BuyOptionPointerArray
typedef std::vector<uint64> em5::Player::EntityIdArray

Member Enumeration Documentation

Enumerator
UNKNOWN_CAMERA 
INGAME_CAMERA 
FREE_CAMERA 
CUTSCENE_CAMERA 
Enumerator
DEBUG_PLAYER 
DEBUG_UNITPOOL 

Constructor & Destructor Documentation

em5::Player::Player ( uint32  index,
bool  isLocal,
VersionSwitch::Edition  gameEdition 
)

Constructor.

virtual em5::Player::~Player ( )
virtual

Destructor.

Member Function Documentation

void em5::Player::addBuyOption ( const BuyOption buyOption)
void em5::Player::addCredits ( int32  credits)
inline

Subtract the given value from the credits.

Parameters
[in]creditsAmount of credits to be added, can be negative as well
void em5::Player::addScore ( int32  score)
inline

Add the given value to the score.

Parameters
[in]scoreValue to add to the player's score, can be negative as well
void em5::Player::clearBuyOptions ( )
const BuyOptionPointerArray& em5::Player::getBuyOptions ( ) const
qsf::CameraComponent * em5::Player::getCameraComponent ( ) const
inline
Player::CameraType em5::Player::getCameraType ( ) const
inline
qsf::Ray em5::Player::getCameraViewRay ( ) const
uint32 em5::Player::getCredits ( ) const
inline

Return the player's credits.

Returns
Amount of credits the player currently owns
VersionSwitch::Edition em5::Player::getGameEdition ( ) const
inline

Returns the player's game edition (e.g. Standard or Deluxe edition)

qsf::CameraComponent * em5::Player::getMainCameraComponent ( ) const
inline

Get the main camera component.

qsf::Entity* em5::Player::getMainCameraEntity ( ) const

Get the main camera entity.

qsf::FreeMoveInputHandler* em5::Player::getMainCameraInputHandler ( ) const

Get the main camera input handler.

const std::string & em5::Player::getName ( ) const
inline

Return the player's name.

qsf::Color4 em5::Player::getPlayerColor ( ) const
inline
uint32 em5::Player::getPlayerIndex ( ) const
inline

Return the player's index.

uint32 em5::Player::getScore ( ) const
inline

Return the score of the player.

Returns
The player's current score
qsf::CameraComponent* em5::Player::getStartCameraInMap ( qsf::Map map) const
uint16 em5::Player::getTeamId ( ) const
inline

Return the player's team ID.

const std::vector<uint64>& em5::Player::getUnitGroupByIndex ( uint32  index)

Return the saved group; can be empty or misleading uints.

Parameters
[in]indexThe index of the saved group. Only valid for '0' - '8'
UnitPool & em5::Player::getUnitPool ( ) const
inline

Return the player's unit pool.

uint32 em5::Player::getUserData ( ) const
inline
const glm::vec3 & em5::Player::getViewPosition ( ) const
inline
bool em5::Player::hasUnboughtBuyOptions ( ) const
bool em5::Player::isPlayerLocal ( ) const
inline

Returns the state of the player if he is local or not.

bool em5::Player::purchaseBuyOption ( const BuyOption buyOption)
bool em5::Player::purchaseBuyOptionByIndex ( uint32  index)
void em5::Player::resetCameraToStartTransform ( )
void em5::Player::serialize ( qsf::BinarySerializer serializer)

Serialization of the player.

void em5::Player::setCameraToEntityTransform ( const qsf::Entity cameraEntity)
void em5::Player::setCameraToEntityTransform ( const std::string &  cameraEntityEventTag)
void em5::Player::setCameraToTransform ( const qsf::Transform transform)
void em5::Player::setCameraType ( CameraType  cameraType,
qsf::CameraComponent cameraComponent = nullptr,
bool  inputChange = true 
)
void em5::Player::setCredits ( uint32  credits)

Set the credits to the given value.

Parameters
[in]creditsAmount of credits to set
Note
  • Emits a message to inform e.g. the in-game HUD about the change
void em5::Player::setName ( const std::string &  name)
inline

Set the player's name.

void em5::Player::setPlayerColor ( const qsf::Color4 color)
inline
void em5::Player::setPlayerIndex ( uint32  playerIndex)
inline

Set the player's index.

void em5::Player::setScore ( uint32  score)

Set the score to the given value.

Parameters
[in]scoreScore value to set
Note
  • Emits a message to inform e.g. the in-game HUD about the change
void em5::Player::setTeamId ( uint16  teamId)
inline

Set the player's team ID.

void em5::Player::setUnitGroupByIndex ( uint32  index,
const std::vector< uint64 > &  savedIds 
)
void em5::Player::setUserData ( const uint32  userData)
inline
void em5::Player::setViewPosition ( const glm::vec3 &  viewPosition)
inline
void em5::Player::shutdown ( )

Shutdown the player.

void em5::Player::startup ( )

Start up the player.

void em5::Player::toggleDebugFlag ( DebugFlag  flag)
inline

Toggle debug flag.

void em5::Player::unblockUnitPool ( )
void em5::Player::updateDynamicPssmLambda ( const qsf::JobArguments )
void em5::Player::updateViewPosition ( const qsf::JobArguments )
void em5::Player::updateViewTransform ( )

Member Data Documentation

const uint32 em5::Player::MAIN_CAMERA_INPUT_HANDLER_ID
static

The documentation for this class was generated from the following files: