1 | |
---|
2 | /*! |
---|
3 | * @file helicopter.h |
---|
4 | * Implements the Control of a Helicopter |
---|
5 | */ |
---|
6 | |
---|
7 | #ifndef _HELICOPTER_H |
---|
8 | #define _HELICOPTER_H |
---|
9 | |
---|
10 | #include "playable.h" |
---|
11 | |
---|
12 | #include "sound_buffer.h" |
---|
13 | #include "sound_source.h" |
---|
14 | |
---|
15 | #include "script_class.h" |
---|
16 | |
---|
17 | class Helicopter : public Playable |
---|
18 | { |
---|
19 | ObjectListDeclaration(Helicopter); |
---|
20 | |
---|
21 | public: |
---|
22 | |
---|
23 | Helicopter(); |
---|
24 | Helicopter(const std::string& fileName); |
---|
25 | Helicopter(const TiXmlElement* root); |
---|
26 | virtual ~Helicopter(); |
---|
27 | |
---|
28 | virtual void loadParams(const TiXmlElement* root); |
---|
29 | virtual void setPlayDirection(const Quaternion& rot, float speed = 0.0f) {/* FIXME */}; |
---|
30 | |
---|
31 | virtual void enter(); |
---|
32 | virtual void leave(); |
---|
33 | |
---|
34 | virtual void postSpawn(); |
---|
35 | virtual void leftWorld(); |
---|
36 | |
---|
37 | virtual void collidesWith(WorldEntity* entity, const Vector& location); |
---|
38 | virtual void tick(float time); |
---|
39 | virtual void draw() const; |
---|
40 | |
---|
41 | virtual void process(const Event &event); |
---|
42 | |
---|
43 | virtual void moveUp(bool move){bAscend = move;}; |
---|
44 | virtual void moveDown(bool move){bDescend = move;}; |
---|
45 | |
---|
46 | |
---|
47 | |
---|
48 | private: |
---|
49 | void init(); |
---|
50 | void calculateVelocity(float time); |
---|
51 | |
---|
52 | bool bUp; //!< up button pressed. |
---|
53 | bool bDown; //!< down button pressed. |
---|
54 | bool bLeft; //!< left button pressed. |
---|
55 | bool bRight; //!< right button pressed. |
---|
56 | bool bAscend; //!< ascend button pressed. |
---|
57 | bool bDescend; //!< descend button presses. |
---|
58 | bool bFire; //!< fire button pressed. |
---|
59 | bool bRollL; //!< rolling button pressed (left) |
---|
60 | bool bRollR; //!< rolling button pressed (right) |
---|
61 | |
---|
62 | float xMouse; //!< mouse moved in x-Direction |
---|
63 | float yMouse; //!< mouse moved in y-Direction |
---|
64 | int yInvert; |
---|
65 | float mouseSensitivity; //!< the mouse sensitivity |
---|
66 | int controlVelocityX; //!< defines max velocity of Xaxis of mousecontrol |
---|
67 | int controlVelocityY; //!< defines max velocity of Yaxis of mousecontrol |
---|
68 | |
---|
69 | PNode topRotor; //!< the position of the toprotor |
---|
70 | PNode tailRotor; //!< the position of the tailrotor |
---|
71 | |
---|
72 | PNode cameraNode; //!< the position the camera is locked at (used to look up and down without turning the helicopter) |
---|
73 | |
---|
74 | Vector velocity; //!< the velocity of the player. |
---|
75 | Vector velocityDir; //!< the direction of the velocity of the spaceship |
---|
76 | float travelSpeed; //!< the current speed of the player (to make soft movement) |
---|
77 | float acceleration; //!< the acceleration of the player. |
---|
78 | |
---|
79 | float airViscosity; |
---|
80 | |
---|
81 | OrxSound::SoundSource soundSource; |
---|
82 | OrxSound::SoundBuffer chopperBuffer; |
---|
83 | |
---|
84 | }; |
---|
85 | |
---|
86 | #endif /* _HELICOPTERS_H */ |
---|