Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

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

Some surprises for comming wednesday

File size: 7.5 KB
RevLine 
[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
[10073]5 * By default is on OM_GROUP_00
6 * If player boards the ship, it is moved to OM_GROUP_01
[7346]7 */
8
9#ifndef _SPACE_SHIP_H
10#define _SPACE_SHIP_H
11
12#include "playable.h"
13#include "extendable.h"
14
15// Forward Declaration
16template<class T> class tList;
17class Vector;
18class Event;
19class ParticleEmitter;
20class ParticleSystem;
[10081]21class Trail;
[7346]22
23class SpaceShip : public Playable
24{
[9869]25  ObjectListDeclaration(SpaceShip);
[7346]26
27  public:
28    SpaceShip(const std::string& fileName);
29    SpaceShip(const TiXmlElement* root = NULL);
30    virtual ~SpaceShip();
31
32    virtual void loadParams(const TiXmlElement* root);
33
34    virtual void setPlayDirection(const Quaternion& rot, float speed = 0.0f);
[10019]35    /*
[9971]36    void setTravelHeight(float travelHeight);
37    void setTravelDistance(const Vector2D& distance);
38    void setTravelDistance(float x, float y);
[10019]39    */
[7346]40
[10017]41    //void setAirFriction(float friction) { this->airFriction = friction; };
[9971]42
[7346]43    virtual void enter();
44    virtual void leave();
45
46    virtual void reset();
47
48    virtual void postSpawn();
49    virtual void leftWorld();
[9869]50
[9235]51    virtual void destroy(WorldEntity* killer);
[9008]52    virtual void respawn();
[7346]53
54    virtual void collidesWith(WorldEntity* entity, const Vector& location);
55    virtual void tick(float time);
56    virtual void draw() const;
57
58    virtual void process(const Event &event);
59
[10030]60    inline WeaponManager& getWeaponManagerSecondary() { return this->secWeaponMan; };
[9965]61
[9950]62    //Functions for GUI
[9957]63    inline float getShieldCur() { return this->shieldCur; };        //!< returns current shield value
64    inline float getShieldMax() { return this->shieldMax; };        //!< returns maximum shield value
[9950]65
[9957]66    inline float getArmorCur() { return this->armorCur; };          //!< returns current armor value
67    inline float getArmorMax() { return this->armorMax; };          //!< returns current armor value
[9950]68
[9957]69    inline float getElectronicCur() { return this->electronicCur; }; //!< returns current electronic value
70    inline float getElectronicMax() { return this->electronicMax; }; //!< returns current electronic value
[9950]71
72    //damage handler
[9957]73    virtual void damage(float pDamage, float eDamage);  //!< pDamage physical damage, eDamage electronic damage
[9950]74
[9971]75    virtual void enterPlaymode(Playable::Playmode playmode);
[10032]76    void setPlaymodeXML(const std::string& playmode);
[9971]77    virtual void movement (float dt);
78
[7346]79  private:
80    void init();
81
[10032]82    //void calculateVelocity(float time);
[7346]83
[9957]84    void regen(float time);  //!< handler for shield and electronic regeneration
[9943]85
[9965]86    void weaponRegen(float time);   //!< weapon energy regeneration
87
[10022]88    inline bool systemFailure() {  return (this->electronicCur < float(rand())/float(RAND_MAX) * this->electronicTH); };
[10020]89
[9965]90    //WeaponManager         weaponMan;      //!< the primary weapon manager: managing a list of energy weapons to wepaon-slot mapping
[9961]91    WeaponManager         secWeaponMan;       //!< the secondary weapon manager: managing a list of special weapons to weapon-slot mapping
92    short                 supportedPlaymodes; //!< What Playmodes are Supported in this Playable.
93    Playable::Playmode    playmode;           //!< The current playmode.
94
[9950]95    //ship atributes
[9957]96    float       shieldCur;          //!< current shield
97    float       shieldMax;          //!< maximum shield
[9950]98    float       shieldEnergyShare;  //!< percentage of reactor output
[9970]99    float       shieldRegen;        //!< shield regeneration rate per second
[9957]100    float       shieldTH;           //!< shield threshhold for reactivation
[9950]101    bool        shieldActive;       //!< wheather the shield is working
[9943]102
[9957]103    float       armorCur;           //!< current armor
104    float       armorMax;           //!< maximum armor
[9963]105    float       armorRegen;         //!< armor regeneration per tick (usable on bioships?)
[9943]106
[9957]107    float       electronicCur;      //!< current electronic
108    float       electronicMax;      //!< maximum electronic
109    float       electronicRegen;    //!< electronic regenration rate per tick
[10020]110    float       electronicTH;       //!< Threshhold for electronic failure
[9943]111
[9970]112    float       engineSpeedCur;     //!< speed output for movement = speed base + energy share part
113    float       engineSpeedBase;    //!< speed base
[9950]114    int         enginePowerConsume; //!< energy needed
115    float       engineEnergyShare;  //!< percentage of reactor output
[9943]116
[9950]117    int         weaponEnergySlot;   //!< number of energy weapon slots
118    int         weaponEnergyUsed;
119    float       weaponEnergyShare;
[9965]120    float       weaponEnergyRegen;
[9950]121    int         weaponSpecialSlot;  //!< number of special weapon slots
122    int         weaponSpecialUsed;
[9943]123
[9965]124    float       reactorOutput;      //!< reactor output
125    float       reactorCapacity;    //!< reactor capacity
[9943]126
[9961]127    int         curWeaponPrimary;   //!< current primary weapon config
128    int         curWeaponSecondary; //!< current secondary weapon config
[9958]129
[10017]130    bool                  bForward;                //!< up button pressed.
131    bool                  bBackward;              //!< down button pressed.
[7346]132    bool                  bLeft;              //!< left button pressed.
133    bool                  bRight;             //!< right button pressed.
134    bool                  bAscend;            //!< ascend button pressed.
135    bool                  bDescend;           //!< descend button presses.
136    bool                  bRollL;             //!< rolling button pressed (left)
137    bool                  bRollR;             //!< rolling button pressed (right)
[10023]138    bool                  bSecFire;           //!< second fire button pressed
[7346]139
[10017]140    /*
[7346]141    float                 xMouse;             //!< mouse moved in x-Direction
142    float                 yMouse;             //!< mouse moved in y-Direction
143    float                 mouseSensitivity;   //!< the mouse sensitivity
144    int                   yInvert;
145    int                   controlVelocityX;
146    int                   controlVelocityY;
[10017]147    */
[7346]148
[10043]149    Vector                velocity;           //!< the velocity of the player.
[10078]150    Vector                oldPos;
[10017]151
[9971]152// 2D-traveling
153    PNode*                travelNode;
154    float                 travelSpeed;        //!< the current speed of the Ship (to make soft movement)
[10019]155    Vector2D              travelDistancePlus;     //!< Travel-Distance away from the TravelNode
156    Vector2D              travelDistanceMinus;
[9971]157
158// Camera
159    PNode                 cameraNode;
160    float                 cameraLook;
161    float                 rotation;
[10017]162    float                 cameraSpeed;
[9971]163
[10017]164    /*
[7346]165    Quaternion            mouseDir;           //!< the direction where the player wants to fly
166    Quaternion            oldMouseDir;        //!< the direction where the player wanted to fly
167    float                 shipInertia;        //!< the inertia of the ship(how fast the ship reacts to a mouse input)
168    Quaternion            rotQuat;
169    Quaternion            pitchDir;
[9971]170    float                 dogdeSpeed;        //!< the dogde Speed of the ship.
[10017]171    */
[7346]172
[10032]173    //Quaternion            direction;          //!< the direction of the ship.
[9971]174    float                 acceleration;       //!< the acceleration of the ship.
[10017]175    //float                 airFriction;        //!< AirFriction.
176    //float                 airViscosity;
[7346]177
178    byte                  oldMask;            //!< used for synchronisation
179
[10081]180    Trail*                trail;              //!< Burst trail
181    Trail*                trailL;              //!< Burst trail
182    Trail*                trailR;              //!< Burst trail
183
[7346]184};
185
186#endif /* _SPACE_SHIPS_H */
Note: See TracBrowser for help on using the repository browser.