[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 | |
---|
[6002] | 15 | class Helicopter : public Playable |
---|
[5996] | 16 | { |
---|
| 17 | |
---|
| 18 | public: |
---|
| 19 | |
---|
[6002] | 20 | Helicopter(); |
---|
[7221] | 21 | Helicopter(const std::string& fileName); |
---|
[6002] | 22 | Helicopter(const TiXmlElement* root); |
---|
| 23 | virtual ~Helicopter(); |
---|
[5996] | 24 | |
---|
[6512] | 25 | virtual void loadParams(const TiXmlElement* root); |
---|
[7346] | 26 | virtual void setPlayDirection(const Quaternion& rot, float speed = 0.0f) {/* FIXME */}; |
---|
[5996] | 27 | |
---|
[6222] | 28 | virtual void enter(); |
---|
| 29 | virtual void leave(); |
---|
| 30 | |
---|
[5996] | 31 | virtual void postSpawn(); |
---|
| 32 | virtual void leftWorld(); |
---|
| 33 | |
---|
| 34 | virtual void collidesWith(WorldEntity* entity, const Vector& location); |
---|
| 35 | virtual void tick(float time); |
---|
[6005] | 36 | virtual void draw() const; |
---|
[5996] | 37 | |
---|
| 38 | virtual void process(const Event &event); |
---|
[8408] | 39 | |
---|
| 40 | virtual void moveUp(bool move){bUp = move;}; |
---|
[5996] | 41 | |
---|
| 42 | |
---|
| 43 | |
---|
| 44 | private: |
---|
[6804] | 45 | void init(); |
---|
[5996] | 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 | |
---|
| 58 | float xMouse; //!< mouse moved in x-Direction |
---|
| 59 | float yMouse; //!< mouse moved in y-Direction |
---|
[6637] | 60 | int yInvert; |
---|
[5996] | 61 | float mouseSensitivity; //!< the mouse sensitivity |
---|
[6947] | 62 | int controlVelocityX; //!< defines max velocity of Xaxis of mousecontrol |
---|
| 63 | int controlVelocityY; //!< defines max velocity of Yaxis of mousecontrol |
---|
[6804] | 64 | |
---|
[6947] | 65 | PNode topRotor; //!< the position of the toprotor |
---|
| 66 | PNode tailRotor; //!< the position of the tailrotor |
---|
[6804] | 67 | |
---|
[6947] | 68 | PNode cameraNode; //!< the position the camera is locked at (used to look up and down without turning the helicopter) |
---|
[5996] | 69 | |
---|
| 70 | Vector velocity; //!< the velocity of the player. |
---|
| 71 | Vector velocityDir; //!< the direction of the velocity of the spaceship |
---|
| 72 | float travelSpeed; //!< the current speed of the player (to make soft movement) |
---|
| 73 | float acceleration; //!< the acceleration of the player. |
---|
[6222] | 74 | |
---|
[6162] | 75 | float airViscosity; |
---|
[5996] | 76 | |
---|
[7810] | 77 | OrxSound::SoundSource soundSource; |
---|
| 78 | OrxSound::SoundBuffer*chopperBuffer; |
---|
| 79 | |
---|
[5996] | 80 | }; |
---|
| 81 | |
---|
[8408] | 82 | //CREATE_SCRIPTABLE_CLASS(Helicopter, CL_HELICOPTER, |
---|
| 83 | // addMethod("moveUp", ExecutorLua1<Object,bool>(&Helicopter::moveUp)) |
---|
| 84 | // ); |
---|
| 85 | |
---|
| 86 | |
---|
[6002] | 87 | #endif /* _HELICOPTERS_H */ |
---|