[7346] | 1 | /*! |
---|
| 2 | * @file space_ship.h |
---|
| 3 | * Implements the Control of a Spaceship |
---|
[9958] | 4 | * Space Ships are the core class for all types of ships in Orxonox |
---|
[7346] | 5 | */ |
---|
| 6 | |
---|
| 7 | #ifndef _SPACE_SHIP_H |
---|
| 8 | #define _SPACE_SHIP_H |
---|
| 9 | |
---|
| 10 | #include "playable.h" |
---|
| 11 | #include "extendable.h" |
---|
| 12 | |
---|
| 13 | // Forward Declaration |
---|
| 14 | template<class T> class tList; |
---|
| 15 | class Vector; |
---|
| 16 | class Event; |
---|
| 17 | class ParticleEmitter; |
---|
| 18 | class ParticleSystem; |
---|
| 19 | |
---|
| 20 | class SpaceShip : public Playable |
---|
| 21 | { |
---|
[9869] | 22 | ObjectListDeclaration(SpaceShip); |
---|
[7346] | 23 | |
---|
| 24 | public: |
---|
| 25 | SpaceShip(const std::string& fileName); |
---|
| 26 | SpaceShip(const TiXmlElement* root = NULL); |
---|
| 27 | virtual ~SpaceShip(); |
---|
| 28 | |
---|
| 29 | virtual void loadParams(const TiXmlElement* root); |
---|
| 30 | |
---|
| 31 | virtual void setPlayDirection(const Quaternion& rot, float speed = 0.0f); |
---|
| 32 | |
---|
| 33 | virtual void enter(); |
---|
| 34 | virtual void leave(); |
---|
| 35 | |
---|
| 36 | virtual void reset(); |
---|
| 37 | |
---|
| 38 | virtual void postSpawn(); |
---|
| 39 | virtual void leftWorld(); |
---|
[9869] | 40 | |
---|
[9235] | 41 | virtual void destroy(WorldEntity* killer); |
---|
[9008] | 42 | virtual void respawn(); |
---|
[7346] | 43 | |
---|
| 44 | virtual void collidesWith(WorldEntity* entity, const Vector& location); |
---|
| 45 | virtual void tick(float time); |
---|
| 46 | virtual void draw() const; |
---|
| 47 | |
---|
| 48 | virtual void process(const Event &event); |
---|
| 49 | |
---|
[9950] | 50 | //Functions for GUI |
---|
[9957] | 51 | inline float getShieldCur() { return this->shieldCur; }; //!< returns current shield value |
---|
| 52 | inline float getShieldMax() { return this->shieldMax; }; //!< returns maximum shield value |
---|
[9950] | 53 | |
---|
[9957] | 54 | inline float getArmorCur() { return this->armorCur; }; //!< returns current armor value |
---|
| 55 | inline float getArmorMax() { return this->armorMax; }; //!< returns current armor value |
---|
[9950] | 56 | |
---|
[9957] | 57 | inline float getElectronicCur() { return this->electronicCur; }; //!< returns current electronic value |
---|
| 58 | inline float getElectronicMax() { return this->electronicMax; }; //!< returns current electronic value |
---|
[9950] | 59 | |
---|
| 60 | //damage handler |
---|
[9957] | 61 | virtual void damage(float pDamage, float eDamage); //!< pDamage physical damage, eDamage electronic damage |
---|
[9950] | 62 | |
---|
[7346] | 63 | private: |
---|
| 64 | void init(); |
---|
| 65 | |
---|
| 66 | void calculateVelocity(float time); |
---|
| 67 | |
---|
[9957] | 68 | void regen(float time); //!< handler for shield and electronic regeneration |
---|
[9943] | 69 | |
---|
[9961] | 70 | WeaponManager primWeaponMan; //!< the primary weapon manager: managing a list of energy weapons to wepaon-slot mapping |
---|
| 71 | WeaponManager secWeaponMan; //!< the secondary weapon manager: managing a list of special weapons to weapon-slot mapping |
---|
| 72 | short supportedPlaymodes; //!< What Playmodes are Supported in this Playable. |
---|
| 73 | Playable::Playmode playmode; //!< The current playmode. |
---|
| 74 | bool bPrimFire; |
---|
| 75 | bool bSecFire; |
---|
| 76 | |
---|
[9950] | 77 | //ship atributes |
---|
[9957] | 78 | float shieldCur; //!< current shield |
---|
| 79 | float shieldMax; //!< maximum shield |
---|
[9950] | 80 | float shieldEnergyShare; //!< percentage of reactor output |
---|
[9957] | 81 | float shieldRegen; //!< shield regeneration rate per tick |
---|
| 82 | float shieldTH; //!< shield threshhold for reactivation |
---|
[9950] | 83 | bool shieldActive; //!< wheather the shield is working |
---|
[9943] | 84 | |
---|
[9957] | 85 | float armorCur; //!< current armor |
---|
| 86 | float armorMax; //!< maximum armor |
---|
[9963] | 87 | float armorRegen; //!< armor regeneration per tick (usable on bioships?) |
---|
[9943] | 88 | |
---|
[9957] | 89 | float electronicCur; //!< current electronic |
---|
| 90 | float electronicMax; //!< maximum electronic |
---|
| 91 | float electronicRegen; //!< electronic regenration rate per tick |
---|
[9943] | 92 | |
---|
[9950] | 93 | int engineSpeedCur; //!< speed output |
---|
| 94 | int enginePowerConsume; //!< energy needed |
---|
| 95 | float engineEnergyShare; //!< percentage of reactor output |
---|
[9943] | 96 | |
---|
[9950] | 97 | int weaponEnergySlot; //!< number of energy weapon slots |
---|
| 98 | int weaponEnergyUsed; |
---|
| 99 | float weaponEnergyShare; |
---|
| 100 | int weaponSpecialSlot; //!< number of special weapon slots |
---|
| 101 | int weaponSpecialUsed; |
---|
[9943] | 102 | |
---|
[9950] | 103 | int reactorOutput; //!< reactor output |
---|
| 104 | int reactorCapacity; //!< reactor capacity |
---|
[9943] | 105 | |
---|
[9958] | 106 | |
---|
[9961] | 107 | int curWeaponPrimary; //!< current primary weapon config |
---|
| 108 | int curWeaponSecondary; //!< current secondary weapon config |
---|
[9958] | 109 | |
---|
[7346] | 110 | bool bUp; //!< up button pressed. |
---|
| 111 | bool bDown; //!< down button pressed. |
---|
| 112 | bool bLeft; //!< left button pressed. |
---|
| 113 | bool bRight; //!< right button pressed. |
---|
| 114 | bool bAscend; //!< ascend button pressed. |
---|
| 115 | bool bDescend; //!< descend button presses. |
---|
| 116 | // bool bFire; //!< fire button pressed.(moved to playable) |
---|
| 117 | bool bRollL; //!< rolling button pressed (left) |
---|
| 118 | bool bRollR; //!< rolling button pressed (right) |
---|
| 119 | |
---|
| 120 | float xMouse; //!< mouse moved in x-Direction |
---|
| 121 | float yMouse; //!< mouse moved in y-Direction |
---|
| 122 | float mouseSensitivity; //!< the mouse sensitivity |
---|
| 123 | int yInvert; |
---|
| 124 | int controlVelocityX; |
---|
| 125 | int controlVelocityY; |
---|
| 126 | // float cycle; //!< hovercycle |
---|
| 127 | |
---|
| 128 | Vector velocity; //!< the velocity of the player. |
---|
| 129 | Vector oldVelocity; //!< the velocity the player had last synced |
---|
| 130 | Quaternion mouseDir; //!< the direction where the player wants to fly |
---|
| 131 | Quaternion oldMouseDir; //!< the direction where the player wanted to fly |
---|
| 132 | float shipInertia; //!< the inertia of the ship(how fast the ship reacts to a mouse input) |
---|
| 133 | Quaternion rotQuat; |
---|
| 134 | Quaternion pitchDir; |
---|
| 135 | float travelSpeed; //!< the current speed of the player (to make soft movement) |
---|
| 136 | float acceleration; //!< the acceleration of the player. |
---|
| 137 | |
---|
| 138 | float airViscosity; |
---|
| 139 | |
---|
| 140 | byte oldMask; //!< used for synchronisation |
---|
| 141 | |
---|
| 142 | ParticleEmitter* burstEmitter; |
---|
| 143 | ParticleSystem* burstSystem; |
---|
| 144 | }; |
---|
| 145 | |
---|
| 146 | #endif /* _SPACE_SHIPS_H */ |
---|