[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(); |
---|
[3531] | 24 | virtual ~Player(); |
---|
[3583] | 25 | |
---|
| 26 | void addWeapon(Weapon* weapon); |
---|
| 27 | void removeWeapon(Weapon* weapon); |
---|
[3471] | 28 | |
---|
| 29 | virtual void postSpawn(); |
---|
[3583] | 30 | virtual void leftWorld(); |
---|
[3578] | 31 | virtual void hit(WorldEntity* weapon, Vector* loc); |
---|
[3471] | 32 | virtual void collide(WorldEntity* other, Uint32 ownhitflags, Uint32 otherhitflags); |
---|
[3583] | 33 | |
---|
| 34 | virtual void tick(float time); |
---|
| 35 | virtual void draw(); |
---|
| 36 | |
---|
[3471] | 37 | virtual void command(Command* cmd); |
---|
| 38 | |
---|
| 39 | private: |
---|
| 40 | bool bUp; //!< up button pressed. |
---|
| 41 | bool bDown; //!< down button pressed. |
---|
| 42 | bool bLeft; //!< left button pressed. |
---|
| 43 | bool bRight; //!< right button pressed. |
---|
| 44 | bool bAscend; //!< ascend button pressed. |
---|
| 45 | bool bDescend; //!< descend button presses. |
---|
| 46 | bool bFire; //!< fire button pressed. |
---|
[3585] | 47 | bool bWeaponChange; //!< weapon change button pressed |
---|
[3471] | 48 | |
---|
[3583] | 49 | tList<Weapon>* weapons;//!< a list of weapon |
---|
[3585] | 50 | Weapon* activeWeapon; //!< the weapon that is currenty activated |
---|
[3755] | 51 | Weapon* activeWeaponL; //temporary -- FIX THIS |
---|
[3873] | 52 | WeaponManager* weaponMan; //!< the weapon manager: managing a list of weapon to wepaon-slot mapping |
---|
[3755] | 53 | |
---|
[3620] | 54 | World* myWorld; //!< reference to the world object |
---|
[3583] | 55 | |
---|
[3608] | 56 | Vector* velocity; //!< the velocity of the player. |
---|
[3471] | 57 | float travelSpeed; //!< the current speed of the player (to make soft movement) |
---|
| 58 | float acceleration; //!< the acceleration of the player. |
---|
| 59 | |
---|
| 60 | void move(float time); |
---|
[3620] | 61 | void weapon(void); |
---|
[3471] | 62 | |
---|
| 63 | }; |
---|
| 64 | |
---|
| 65 | #endif /* _PLAYER_H */ |
---|