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