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