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 std::string& fileName); |
---|
22 | MD2Creature(const TiXmlElement* root = NULL); |
---|
23 | virtual ~MD2Creature(); |
---|
24 | |
---|
25 | virtual void loadParams(const TiXmlElement* root); |
---|
26 | virtual void setPlayDirection(const Quaternion& rot, float speed = 0.0f) {/* 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 | bool bMouseMotion; //!< mouse motion evet |
---|
60 | |
---|
61 | PNode cameraConnNode; //!< The Node the camera is connected to. |
---|
62 | |
---|
63 | float xMouse; //!< mouse moved in x-Direction |
---|
64 | float yMouse; //!< mouse moved in y-Direction |
---|
65 | float mouseSensitivity; //!< the mouse sensitivity |
---|
66 | float cycle; //!< hovercycle |
---|
67 | |
---|
68 | Vector velocity; //!< the velocity of the player. |
---|
69 | Quaternion mouseDirX; //!< the direction where the player wants to fly |
---|
70 | Quaternion mouseDirY; //!< the direction where the player wants to fly |
---|
71 | float travelSpeed; //!< the current speed of the player (to make soft movement) |
---|
72 | float acceleration; //!< the acceleration of the player. |
---|
73 | |
---|
74 | float airViscosity; |
---|
75 | |
---|
76 | }; |
---|
77 | |
---|
78 | #endif /* _MD2_CREATURE_H */ |
---|