[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 | { |
---|
[9869] | 19 | ObjectListDeclaration(Helicopter); |
---|
[5996] | 20 | |
---|
| 21 | public: |
---|
| 22 | |
---|
[6002] | 23 | Helicopter(); |
---|
[7221] | 24 | Helicopter(const std::string& fileName); |
---|
[6002] | 25 | Helicopter(const TiXmlElement* root); |
---|
| 26 | virtual ~Helicopter(); |
---|
[5996] | 27 | |
---|
[6512] | 28 | virtual void loadParams(const TiXmlElement* root); |
---|
[7346] | 29 | virtual void setPlayDirection(const Quaternion& rot, float speed = 0.0f) {/* FIXME */}; |
---|
[5996] | 30 | |
---|
[6222] | 31 | virtual void enter(); |
---|
| 32 | virtual void leave(); |
---|
| 33 | |
---|
[5996] | 34 | virtual void postSpawn(); |
---|
| 35 | virtual void leftWorld(); |
---|
| 36 | |
---|
| 37 | virtual void collidesWith(WorldEntity* entity, const Vector& location); |
---|
| 38 | virtual void tick(float time); |
---|
[6005] | 39 | virtual void draw() const; |
---|
[5996] | 40 | |
---|
| 41 | virtual void process(const Event &event); |
---|
[9235] | 42 | |
---|
[8711] | 43 | virtual void moveUp(bool move){bAscend = move;}; |
---|
| 44 | virtual void moveDown(bool move){bDescend = move;}; |
---|
[5996] | 45 | |
---|
| 46 | |
---|
| 47 | |
---|
| 48 | private: |
---|
[6804] | 49 | void init(); |
---|
[5996] | 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 |
---|
[6637] | 64 | int yInvert; |
---|
[5996] | 65 | float mouseSensitivity; //!< the mouse sensitivity |
---|
[6947] | 66 | int controlVelocityX; //!< defines max velocity of Xaxis of mousecontrol |
---|
| 67 | int controlVelocityY; //!< defines max velocity of Yaxis of mousecontrol |
---|
[6804] | 68 | |
---|
[6947] | 69 | PNode topRotor; //!< the position of the toprotor |
---|
| 70 | PNode tailRotor; //!< the position of the tailrotor |
---|
[6804] | 71 | |
---|
[6947] | 72 | PNode cameraNode; //!< the position the camera is locked at (used to look up and down without turning the helicopter) |
---|
[5996] | 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. |
---|
[6222] | 78 | |
---|
[6162] | 79 | float airViscosity; |
---|
[5996] | 80 | |
---|
[9235] | 81 | OrxSound::SoundSource soundSource; |
---|
[9869] | 82 | OrxSound::SoundBuffer chopperBuffer; |
---|
[7810] | 83 | |
---|
[5996] | 84 | }; |
---|
| 85 | |
---|
[6002] | 86 | #endif /* _HELICOPTERS_H */ |
---|