| 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 | #include "physics_interface.h" | 
|---|
| 11 | #include "event_listener.h" | 
|---|
| 12 |  | 
|---|
| 13 | template<class T> class tList; | 
|---|
| 14 | class Weapon; | 
|---|
| 15 | class WeaponManager; | 
|---|
| 16 | class Vector; | 
|---|
| 17 | class World; | 
|---|
| 18 | class Event; | 
|---|
| 19 |  | 
|---|
| 20 | //! Basic controllable WorldEntity | 
|---|
| 21 | class Player : public WorldEntity, public PhysicsInterface, public EventListener | 
|---|
| 22 | { | 
|---|
| 23 |   friend class World; | 
|---|
| 24 |    | 
|---|
| 25 |  public: | 
|---|
| 26 |   Player(); | 
|---|
| 27 |   Player(const TiXmlElement* root); | 
|---|
| 28 |   virtual ~Player(); | 
|---|
| 29 |  | 
|---|
| 30 |   void addWeapon(Weapon* weapon); | 
|---|
| 31 |   void removeWeapon(Weapon* weapon); | 
|---|
| 32 |    | 
|---|
| 33 |   virtual void postSpawn(); | 
|---|
| 34 |   virtual void leftWorld(); | 
|---|
| 35 |   virtual void hit(WorldEntity* weapon, Vector* loc); | 
|---|
| 36 |   virtual void collide(WorldEntity* other, Uint32 ownhitflags, Uint32 otherhitflags); | 
|---|
| 37 |  | 
|---|
| 38 |   virtual void tick(float time);   | 
|---|
| 39 |   virtual void draw(); | 
|---|
| 40 |  | 
|---|
| 41 |   virtual void command(Command* cmd); | 
|---|
| 42 |  | 
|---|
| 43 |   virtual void process(const Event &event); | 
|---|
| 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. | 
|---|
| 53 |   bool bWeaponChange;    //!< weapon change button pressed | 
|---|
| 54 |  | 
|---|
| 55 |   tList<Weapon>* weapons;//!< a list of weapon | 
|---|
| 56 |   Weapon* activeWeapon;  //!< the weapon that is currenty activated | 
|---|
| 57 |   Weapon* activeWeaponL;  //temporary -- FIX THIS | 
|---|
| 58 |   WeaponManager* weaponMan; //!< the weapon manager: managing a list of weapon to wepaon-slot mapping | 
|---|
| 59 |  | 
|---|
| 60 |   World* myWorld;        //!< reference to the world object | 
|---|
| 61 |  | 
|---|
| 62 |   Vector* velocity;       //!< the velocity of the player. | 
|---|
| 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); | 
|---|
| 67 |   void weapon(void); | 
|---|
| 68 |    | 
|---|
| 69 | }; | 
|---|
| 70 |  | 
|---|
| 71 | #endif /* _PLAYER_H */ | 
|---|