[7346] | 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" |
---|
| 10 | #include "extendable.h" |
---|
| 11 | |
---|
| 12 | // Forward Declaration |
---|
| 13 | template<class T> class tList; |
---|
| 14 | class Vector; |
---|
| 15 | class Event; |
---|
| 16 | class ParticleEmitter; |
---|
| 17 | class ParticleSystem; |
---|
| 18 | |
---|
| 19 | class SpaceShip : public Playable |
---|
| 20 | { |
---|
[9869] | 21 | ObjectListDeclaration(SpaceShip); |
---|
[7346] | 22 | |
---|
| 23 | public: |
---|
| 24 | SpaceShip(const std::string& fileName); |
---|
| 25 | SpaceShip(const TiXmlElement* root = NULL); |
---|
| 26 | virtual ~SpaceShip(); |
---|
| 27 | |
---|
| 28 | virtual void loadParams(const TiXmlElement* root); |
---|
| 29 | |
---|
| 30 | virtual void setPlayDirection(const Quaternion& rot, float speed = 0.0f); |
---|
| 31 | |
---|
| 32 | virtual void enter(); |
---|
| 33 | virtual void leave(); |
---|
| 34 | |
---|
| 35 | virtual void reset(); |
---|
| 36 | |
---|
| 37 | virtual void postSpawn(); |
---|
| 38 | virtual void leftWorld(); |
---|
[9869] | 39 | |
---|
[9235] | 40 | virtual void destroy(WorldEntity* killer); |
---|
[9008] | 41 | virtual void respawn(); |
---|
[7346] | 42 | |
---|
| 43 | virtual void collidesWith(WorldEntity* entity, const Vector& location); |
---|
| 44 | virtual void tick(float time); |
---|
| 45 | virtual void draw() const; |
---|
| 46 | |
---|
| 47 | virtual void process(const Event &event); |
---|
| 48 | |
---|
| 49 | private: |
---|
| 50 | void init(); |
---|
| 51 | |
---|
| 52 | void calculateVelocity(float time); |
---|
| 53 | |
---|
[9943] | 54 | |
---|
| 55 | int shield //!< current shield |
---|
| 56 | int shieldMax //!< maximum shield |
---|
| 57 | float shieldEnergyShare //!< percentage of reactor output |
---|
| 58 | |
---|
| 59 | int armor //!< current armor |
---|
| 60 | int armorMax //!< maximum armor |
---|
| 61 | |
---|
| 62 | int electronic //!< current electronic |
---|
| 63 | int electronicMax //!< maximum electronic |
---|
| 64 | |
---|
| 65 | int engineSpeed //!< speed output |
---|
| 66 | int enginePowerConsume //!< energy needed |
---|
| 67 | float engineEnergyShare //!< percentage of reactor output |
---|
| 68 | |
---|
| 69 | int weaponEnergySlot //!< number of energy weapon slots |
---|
| 70 | int weaponEnergyUsed |
---|
| 71 | int weaponSpecialSlot //!< number of special weapon slots |
---|
| 72 | int weaponSpecialUsed |
---|
| 73 | |
---|
| 74 | int reactorOutput //!< reactor output |
---|
| 75 | int reactorCapacity //!< reactor capacity |
---|
| 76 | |
---|
[7346] | 77 | bool bUp; //!< up button pressed. |
---|
| 78 | bool bDown; //!< down button pressed. |
---|
| 79 | bool bLeft; //!< left button pressed. |
---|
| 80 | bool bRight; //!< right button pressed. |
---|
| 81 | bool bAscend; //!< ascend button pressed. |
---|
| 82 | bool bDescend; //!< descend button presses. |
---|
| 83 | // bool bFire; //!< fire button pressed.(moved to playable) |
---|
| 84 | bool bRollL; //!< rolling button pressed (left) |
---|
| 85 | bool bRollR; //!< rolling button pressed (right) |
---|
| 86 | |
---|
| 87 | float xMouse; //!< mouse moved in x-Direction |
---|
| 88 | float yMouse; //!< mouse moved in y-Direction |
---|
| 89 | float mouseSensitivity; //!< the mouse sensitivity |
---|
| 90 | int yInvert; |
---|
| 91 | int controlVelocityX; |
---|
| 92 | int controlVelocityY; |
---|
| 93 | // float cycle; //!< hovercycle |
---|
| 94 | |
---|
| 95 | Vector velocity; //!< the velocity of the player. |
---|
| 96 | Vector oldVelocity; //!< the velocity the player had last synced |
---|
| 97 | Quaternion mouseDir; //!< the direction where the player wants to fly |
---|
| 98 | Quaternion oldMouseDir; //!< the direction where the player wanted to fly |
---|
| 99 | float shipInertia; //!< the inertia of the ship(how fast the ship reacts to a mouse input) |
---|
| 100 | Quaternion rotQuat; |
---|
| 101 | Quaternion pitchDir; |
---|
| 102 | float travelSpeed; //!< the current speed of the player (to make soft movement) |
---|
| 103 | float acceleration; //!< the acceleration of the player. |
---|
| 104 | |
---|
| 105 | float airViscosity; |
---|
| 106 | |
---|
| 107 | byte oldMask; //!< used for synchronisation |
---|
| 108 | |
---|
| 109 | ParticleEmitter* burstEmitter; |
---|
| 110 | ParticleSystem* burstSystem; |
---|
| 111 | }; |
---|
| 112 | |
---|
| 113 | #endif /* _SPACE_SHIPS_H */ |
---|