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