Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/branches/playability/src/world_entities/space_ships/space_ship.h @ 9975

Last change on this file since 9975 was 9975, checked in by marcscha, 17 years ago

fixes

File size: 7.1 KB
Line 
1/*!
2 * @file space_ship.h
3 * Implements the Control of a Spaceship
4 * Space Ships are the core class for all types of ships in Orxonox
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
14template<class T> class tList;
15class Vector;
16class Event;
17class ParticleEmitter;
18class ParticleSystem;
19
20class SpaceShip : public Playable
21{
22  ObjectListDeclaration(SpaceShip);
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    void setTravelSpeed(float travelSpeed);
33    void setTravelHeight(float travelHeight);
34    void setTravelDistance(const Vector2D& distance);
35    void setTravelDistance(float x, float y);
36
37    void setAirFriction(float friction) { this->airFriction = friction; };
38
39    virtual void enter();
40    virtual void leave();
41
42    virtual void reset();
43
44    virtual void postSpawn();
45    virtual void leftWorld();
46
47    virtual void destroy(WorldEntity* killer);
48    virtual void respawn();
49
50    virtual void collidesWith(WorldEntity* entity, const Vector& location);
51    virtual void tick(float time);
52    virtual void draw() const;
53
54    virtual void process(const Event &event);
55
56    inline WeaponManager getWeaponManagerSecondary() { return this->secWeaponMan; };
57
58    //Functions for GUI
59    inline float getShieldCur() { return this->shieldCur; };        //!< returns current shield value
60    inline float getShieldMax() { return this->shieldMax; };        //!< returns maximum shield value
61
62    inline float getArmorCur() { return this->armorCur; };          //!< returns current armor value
63    inline float getArmorMax() { return this->armorMax; };          //!< returns current armor value
64
65    inline float getElectronicCur() { return this->electronicCur; }; //!< returns current electronic value
66    inline float getElectronicMax() { return this->electronicMax; }; //!< returns current electronic value
67
68    //damage handler
69    virtual void damage(float pDamage, float eDamage);  //!< pDamage physical damage, eDamage electronic damage
70
71    virtual void enterPlaymode(Playable::Playmode playmode);
72    virtual void movement (float dt);
73
74  private:
75    void init();
76
77    void calculateVelocity(float time);
78
79    void regen(float time);  //!< handler for shield and electronic regeneration
80
81    void weaponRegen(float time);   //!< weapon energy regeneration
82
83    //WeaponManager         weaponMan;      //!< the primary weapon manager: managing a list of energy weapons to wepaon-slot mapping
84    WeaponManager         secWeaponMan;       //!< the secondary weapon manager: managing a list of special weapons to weapon-slot mapping
85    short                 supportedPlaymodes; //!< What Playmodes are Supported in this Playable.
86    Playable::Playmode    playmode;           //!< The current playmode.
87    bool                  bSecFire;
88
89    //ship atributes
90    float       shieldCur;          //!< current shield
91    float       shieldMax;          //!< maximum shield
92    float       shieldEnergyShare;  //!< percentage of reactor output
93    float       shieldRegen;        //!< shield regeneration rate per second
94    float       shieldTH;           //!< shield threshhold for reactivation
95    bool        shieldActive;       //!< wheather the shield is working
96
97    float       armorCur;           //!< current armor
98    float       armorMax;           //!< maximum armor
99    float       armorRegen;         //!< armor regeneration per tick (usable on bioships?)
100
101    float       electronicCur;      //!< current electronic
102    float       electronicMax;      //!< maximum electronic
103    float       electronicRegen;    //!< electronic regenration rate per tick
104
105    float       engineSpeedCur;     //!< speed output for movement = speed base + energy share part
106    float       engineSpeedBase;    //!< speed base
107    int         enginePowerConsume; //!< energy needed
108    float       engineEnergyShare;  //!< percentage of reactor output
109
110    int         weaponEnergySlot;   //!< number of energy weapon slots
111    int         weaponEnergyUsed;
112    float       weaponEnergyShare;
113    float       weaponEnergyRegen;
114    int         weaponSpecialSlot;  //!< number of special weapon slots
115    int         weaponSpecialUsed;
116
117    float       reactorOutput;      //!< reactor output
118    float       reactorCapacity;    //!< reactor capacity
119
120    int         curWeaponPrimary;   //!< current primary weapon config
121    int         curWeaponSecondary; //!< current secondary weapon config
122
123    bool                  bUp;                //!< up button pressed.
124    bool                  bDown;              //!< down button pressed.
125    bool                  bLeft;              //!< left button pressed.
126    bool                  bRight;             //!< right button pressed.
127    bool                  bAscend;            //!< ascend button pressed.
128    bool                  bDescend;           //!< descend button presses.
129//    bool                  bFire;              //!< fire button pressed.(moved to playable)
130    bool                  bRollL;             //!< rolling button pressed (left)
131    bool                  bRollR;             //!< rolling button pressed (right)
132
133    float                 xMouse;             //!< mouse moved in x-Direction
134    float                 yMouse;             //!< mouse moved in y-Direction
135    float                 mouseSensitivity;   //!< the mouse sensitivity
136    int                   yInvert;
137    int                   controlVelocityX;
138    int                   controlVelocityY;
139//    float                 cycle;              //!< hovercycle
140
141    Vector                velocity;           //!< the velocity of the player.
142    Vector                oldVelocity;        //!< the velocity the player had last synced
143
144// 2D-traveling
145    PNode*                travelNode;
146    float                 travelSpeed;        //!< the current speed of the Ship (to make soft movement)
147
148// Camera
149    PNode                 cameraNode;
150    float                 cameraLook;
151    float                 rotation;
152
153    // FIXME until other fixme removal needed
154    Quaternion            mouseDir;           //!< the direction where the player wants to fly
155    Quaternion            oldMouseDir;        //!< the direction where the player wanted to fly
156    float                 shipInertia;        //!< the inertia of the ship(how fast the ship reacts to a mouse input)
157
158    Quaternion            rotQuat;
159    Quaternion            pitchDir;
160    float                 dogdeSpeed;        //!< the dogde Speed of the ship.
161    // FIXME
162
163    Quaternion            direction;          //!< the direction of the ship.
164    float                 acceleration;       //!< the acceleration of the ship.
165    float                 airFriction;        //!< AirFriction.
166    float                 airViscosity;
167
168    byte                  oldMask;            //!< used for synchronisation
169
170    ParticleEmitter*      burstEmitter;
171    ParticleSystem*       burstSystem;
172};
173
174#endif /* _SPACE_SHIPS_H */
Note: See TracBrowser for help on using the repository browser.