[3471] | 1 | /*! |
---|
| 2 | \file player.h |
---|
| 3 | \brief Implements a basic controllable WorldEntity |
---|
| 4 | */ |
---|
| 5 | |
---|
| 6 | #ifndef _PLAYER_H |
---|
| 7 | #define _PLAYER_H |
---|
| 8 | |
---|
| 9 | #include "world_entity.h" |
---|
| 10 | |
---|
[3583] | 11 | template<class T> class tList; |
---|
| 12 | class Weapon; |
---|
[3873] | 13 | class WeaponManager; |
---|
[3608] | 14 | class Vector; |
---|
[3620] | 15 | class World; |
---|
[3471] | 16 | |
---|
| 17 | //! Basic controllable WorldEntity |
---|
| 18 | class Player : public WorldEntity |
---|
| 19 | { |
---|
| 20 | friend class World; |
---|
| 21 | |
---|
| 22 | public: |
---|
[3620] | 23 | Player(); |
---|
[4010] | 24 | Player(TiXmlElement* root); |
---|
[3531] | 25 | virtual ~Player(); |
---|
[3583] | 26 | |
---|
| 27 | void addWeapon(Weapon* weapon); |
---|
| 28 | void removeWeapon(Weapon* weapon); |
---|
[3471] | 29 | |
---|
| 30 | virtual void postSpawn(); |
---|
[3583] | 31 | virtual void leftWorld(); |
---|
[3578] | 32 | virtual void hit(WorldEntity* weapon, Vector* loc); |
---|
[3471] | 33 | virtual void collide(WorldEntity* other, Uint32 ownhitflags, Uint32 otherhitflags); |
---|
[3583] | 34 | |
---|
| 35 | virtual void tick(float time); |
---|
| 36 | virtual void draw(); |
---|
| 37 | |
---|
[3471] | 38 | virtual void command(Command* cmd); |
---|
| 39 | |
---|
| 40 | private: |
---|
| 41 | bool bUp; //!< up button pressed. |
---|
| 42 | bool bDown; //!< down button pressed. |
---|
| 43 | bool bLeft; //!< left button pressed. |
---|
| 44 | bool bRight; //!< right button pressed. |
---|
| 45 | bool bAscend; //!< ascend button pressed. |
---|
| 46 | bool bDescend; //!< descend button presses. |
---|
| 47 | bool bFire; //!< fire button pressed. |
---|
[3585] | 48 | bool bWeaponChange; //!< weapon change button pressed |
---|
[3471] | 49 | |
---|
[3583] | 50 | tList<Weapon>* weapons;//!< a list of weapon |
---|
[3585] | 51 | Weapon* activeWeapon; //!< the weapon that is currenty activated |
---|
[3755] | 52 | Weapon* activeWeaponL; //temporary -- FIX THIS |
---|
[3873] | 53 | WeaponManager* weaponMan; //!< the weapon manager: managing a list of weapon to wepaon-slot mapping |
---|
[3755] | 54 | |
---|
[3620] | 55 | World* myWorld; //!< reference to the world object |
---|
[3583] | 56 | |
---|
[3608] | 57 | Vector* velocity; //!< the velocity of the player. |
---|
[3471] | 58 | float travelSpeed; //!< the current speed of the player (to make soft movement) |
---|
| 59 | float acceleration; //!< the acceleration of the player. |
---|
| 60 | |
---|
| 61 | void move(float time); |
---|
[3620] | 62 | void weapon(void); |
---|
[3471] | 63 | |
---|
| 64 | }; |
---|
| 65 | |
---|
| 66 | #endif /* _PLAYER_H */ |
---|