| 1 | /*! | 
|---|
| 2 |  * @file md2_creature.h | 
|---|
| 3 |  * Implements the control of a md2 model | 
|---|
| 4 |  */ | 
|---|
| 5 |  | 
|---|
| 6 | #ifndef _MD2_CREATURE_H | 
|---|
| 7 | #define _MD2_CREATURE_H | 
|---|
| 8 |  | 
|---|
| 9 | #include "playable.h" | 
|---|
| 10 |  | 
|---|
| 11 |  | 
|---|
| 12 | template<class T> class tList; | 
|---|
| 13 | class Vector; | 
|---|
| 14 | class Event; | 
|---|
| 15 |  | 
|---|
| 16 | class MD2Creature : public Playable | 
|---|
| 17 | { | 
|---|
| 18 |  | 
|---|
| 19 |   public: | 
|---|
| 20 |  | 
|---|
| 21 |     MD2Creature(const char* fileName); | 
|---|
| 22 |     MD2Creature(const TiXmlElement* root = NULL); | 
|---|
| 23 |     virtual ~MD2Creature(); | 
|---|
| 24 |  | 
|---|
| 25 |     virtual void loadParams(const TiXmlElement* root); | 
|---|
| 26 |  | 
|---|
| 27 |     virtual void enter(); | 
|---|
| 28 |     virtual void leave(); | 
|---|
| 29 |  | 
|---|
| 30 |     virtual void postSpawn(); | 
|---|
| 31 |     virtual void leftWorld(); | 
|---|
| 32 |  | 
|---|
| 33 |     virtual void collidesWith(WorldEntity* entity, const Vector& location); | 
|---|
| 34 |     virtual void tick(float time); | 
|---|
| 35 |     virtual void draw() const; | 
|---|
| 36 |  | 
|---|
| 37 |     virtual void process(const Event &event); | 
|---|
| 38 |  | 
|---|
| 39 |  | 
|---|
| 40 |  | 
|---|
| 41 |   private: | 
|---|
| 42 |     void init(); | 
|---|
| 43 |  | 
|---|
| 44 |     void calculateVelocity(float time); | 
|---|
| 45 |  | 
|---|
| 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                  bRollL;             //!< rolling button pressed (left) | 
|---|
| 54 |     bool                  bRollR;             //!< rolling button pressed (right) | 
|---|
| 55 |     bool                  bStrafeL;           //!< strafe to the left side | 
|---|
| 56 |     bool                  bStrafeR;           //!< strafe to the rith side | 
|---|
| 57 |     bool                  bJump;              //!< jump | 
|---|
| 58 |  | 
|---|
| 59 |     PNode                 cameraConnNode;     //!< The Node the camera is connected to. | 
|---|
| 60 |  | 
|---|
| 61 |     float                 xMouse;             //!< mouse moved in x-Direction | 
|---|
| 62 |     float                 yMouse;             //!< mouse moved in y-Direction | 
|---|
| 63 |     float                 mouseSensitivity;   //!< the mouse sensitivity | 
|---|
| 64 |     float                 cycle;              //!< hovercycle | 
|---|
| 65 |  | 
|---|
| 66 |     Vector                velocity;           //!< the velocity of the player. | 
|---|
| 67 |     Quaternion            mouseDirX;           //!< the direction where the player wants to fly | 
|---|
| 68 |     Quaternion            mouseDirY;           //!< the direction where the player wants to fly | 
|---|
| 69 |     float                 travelSpeed;        //!< the current speed of the player (to make soft movement) | 
|---|
| 70 |     float                 acceleration;       //!< the acceleration of the player. | 
|---|
| 71 |  | 
|---|
| 72 |     float                 airViscosity; | 
|---|
| 73 |  | 
|---|
| 74 | }; | 
|---|
| 75 |  | 
|---|
| 76 | #endif /* _MD2_CREATURE_H */ | 
|---|