[6034] | 1 | /*! |
---|
| 2 | * @file space_ship.h |
---|
| 3 | * Implements the Control of a Spaceship |
---|
| 4 | */ |
---|
| 5 | |
---|
| 6 | #ifndef _SPACE_SHIP_H |
---|
| 7 | #define _SPACE_SHIP_H |
---|
| 8 | |
---|
| 9 | #include "playable.h" |
---|
[6243] | 10 | #include "extendable.h" |
---|
[6034] | 11 | |
---|
[6162] | 12 | |
---|
[6034] | 13 | template<class T> class tList; |
---|
| 14 | class Vector; |
---|
| 15 | class Event; |
---|
| 16 | |
---|
[6547] | 17 | class SpaceShip : public Playable |
---|
[6034] | 18 | { |
---|
| 19 | |
---|
| 20 | public: |
---|
| 21 | |
---|
| 22 | SpaceShip(); |
---|
| 23 | SpaceShip(const char* fileName); |
---|
| 24 | SpaceShip(const TiXmlElement* root); |
---|
| 25 | virtual ~SpaceShip(); |
---|
| 26 | |
---|
| 27 | void init(); |
---|
[6512] | 28 | virtual void loadParams(const TiXmlElement* root); |
---|
[6034] | 29 | |
---|
[6222] | 30 | virtual void enter(); |
---|
| 31 | virtual void leave(); |
---|
| 32 | |
---|
[6034] | 33 | virtual void postSpawn(); |
---|
| 34 | virtual void leftWorld(); |
---|
| 35 | |
---|
| 36 | virtual void collidesWith(WorldEntity* entity, const Vector& location); |
---|
| 37 | virtual void tick(float time); |
---|
| 38 | virtual void draw() const; |
---|
| 39 | |
---|
| 40 | virtual void process(const Event &event); |
---|
| 41 | |
---|
[6424] | 42 | virtual int writeBytes(const byte* data, int length, int sender); |
---|
| 43 | virtual int readBytes(byte* data, int maxLength, int * reciever); |
---|
[6034] | 44 | |
---|
[6424] | 45 | |
---|
[6034] | 46 | private: |
---|
| 47 | |
---|
| 48 | void calculateVelocity(float time); |
---|
| 49 | void weaponAction(); |
---|
| 50 | |
---|
| 51 | // !! temporary !! |
---|
| 52 | void ADDWEAPON(); |
---|
| 53 | |
---|
| 54 | bool bUp; //!< up button pressed. |
---|
| 55 | bool bDown; //!< down button pressed. |
---|
| 56 | bool bLeft; //!< left button pressed. |
---|
| 57 | bool bRight; //!< right button pressed. |
---|
| 58 | bool bAscend; //!< ascend button pressed. |
---|
| 59 | bool bDescend; //!< descend button presses. |
---|
| 60 | bool bFire; //!< fire button pressed. |
---|
| 61 | bool bRollL; //!< rolling button pressed (left) |
---|
| 62 | bool bRollR; //!< rolling button pressed (right) |
---|
| 63 | |
---|
| 64 | float xMouse; //!< mouse moved in x-Direction |
---|
| 65 | float yMouse; //!< mouse moved in y-Direction |
---|
| 66 | float mouseSensitivity; //!< the mouse sensitivity |
---|
[6693] | 67 | int yInvert; |
---|
| 68 | int controlVelocityX; |
---|
| 69 | int controlVelocityY; |
---|
| 70 | // float cycle; //!< hovercycle |
---|
[6034] | 71 | |
---|
| 72 | Vector velocity; //!< the velocity of the player. |
---|
[6162] | 73 | Quaternion mouseDir; //!< the direction where the player wants to fly |
---|
[6693] | 74 | float shipInertia; //!< the inertia of the ship(how fast the ship reacts to a mouse input) |
---|
[6426] | 75 | Quaternion rotQuat; |
---|
[6693] | 76 | Quaternion pitchDir; |
---|
[6034] | 77 | float travelSpeed; //!< the current speed of the player (to make soft movement) |
---|
| 78 | float acceleration; //!< the acceleration of the player. |
---|
| 79 | |
---|
| 80 | float airViscosity; |
---|
| 81 | |
---|
[6634] | 82 | int oldMask; |
---|
| 83 | |
---|
[6034] | 84 | }; |
---|
| 85 | |
---|
| 86 | #endif /* _SPACE_SHIPS_H */ |
---|