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(); |
---|
22 | MD2Creature(const char* fileName); |
---|
23 | MD2Creature(const TiXmlElement* root); |
---|
24 | virtual ~MD2Creature(); |
---|
25 | |
---|
26 | void init(); |
---|
27 | virtual void loadParams(const TiXmlElement* root); |
---|
28 | |
---|
29 | virtual void enter(); |
---|
30 | virtual void leave(); |
---|
31 | |
---|
32 | void addWeapon(Weapon* weapon ); |
---|
33 | void removeWeapon(Weapon* weapon); |
---|
34 | |
---|
35 | virtual void postSpawn(); |
---|
36 | virtual void leftWorld(); |
---|
37 | |
---|
38 | virtual void collidesWith(WorldEntity* entity, const Vector& location); |
---|
39 | virtual void tick(float time); |
---|
40 | virtual void draw() const; |
---|
41 | |
---|
42 | virtual void process(const Event &event); |
---|
43 | |
---|
44 | |
---|
45 | |
---|
46 | private: |
---|
47 | |
---|
48 | void calculateVelocity(float time); |
---|
49 | void weaponAction(); |
---|
50 | |
---|
51 | // !! temporary !! |
---|
52 | void ADDWEAPON(); |
---|
53 | |
---|
54 | bool bUp; //!< up button pressed. |
---|
55 | bool bDown; //!< down button pressed. |
---|
56 | bool bLeft; //!< left button pressed. |
---|
57 | bool bRight; //!< right button pressed. |
---|
58 | bool bAscend; //!< ascend button pressed. |
---|
59 | bool bDescend; //!< descend button presses. |
---|
60 | bool bFire; //!< fire button pressed. |
---|
61 | bool bRollL; //!< rolling button pressed (left) |
---|
62 | bool bRollR; //!< rolling button pressed (right) |
---|
63 | bool bStrafeL; //!< strafe to the left side |
---|
64 | bool bStrafeR; //!< strafe to the rith side |
---|
65 | bool bJump; //!< jump |
---|
66 | |
---|
67 | PNode cameraConnNode; //!< The Node the camera is connected to. |
---|
68 | |
---|
69 | float xMouse; //!< mouse moved in x-Direction |
---|
70 | float yMouse; //!< mouse moved in y-Direction |
---|
71 | float mouseSensitivity; //!< the mouse sensitivity |
---|
72 | float cycle; //!< hovercycle |
---|
73 | |
---|
74 | Vector velocity; //!< the velocity of the player. |
---|
75 | Quaternion mouseDirX; //!< the direction where the player wants to fly |
---|
76 | Quaternion mouseDirY; //!< the direction where the player wants to fly |
---|
77 | float travelSpeed; //!< the current speed of the player (to make soft movement) |
---|
78 | float acceleration; //!< the acceleration of the player. |
---|
79 | |
---|
80 | float airViscosity; |
---|
81 | |
---|
82 | }; |
---|
83 | |
---|
84 | #endif /* _MD2_CREATURE_H */ |
---|