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