Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

Last change on this file since 10120 was 10120, checked in by muellmic, 17 years ago

some interface hacks

File size: 8.3 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
[10095]54    inline Vector getVelocity() { return this->velocity; };
55
[7346]56    virtual void collidesWith(WorldEntity* entity, const Vector& location);
57    virtual void tick(float time);
58    virtual void draw() const;
59
60    virtual void process(const Event &event);
61
[10030]62    inline WeaponManager& getWeaponManagerSecondary() { return this->secWeaponMan; };
[9965]63
[9950]64    //Functions for GUI
[9957]65    inline float getShieldCur() { return this->shieldCur; };        //!< returns current shield value
66    inline float getShieldMax() { return this->shieldMax; };        //!< returns maximum shield value
[9950]67
[9957]68    inline float getArmorCur() { return this->armorCur; };          //!< returns current armor value
69    inline float getArmorMax() { return this->armorMax; };          //!< returns current armor value
[9950]70
[9957]71    inline float getElectronicCur() { return this->electronicCur; }; //!< returns current electronic value
72    inline float getElectronicMax() { return this->electronicMax; }; //!< returns current electronic value
[9950]73
74    //damage handler
[9957]75    virtual void damage(float pDamage, float eDamage);  //!< pDamage physical damage, eDamage electronic damage
[9950]76
[10120]77    //included by Michel: ((
[9971]78    virtual void enterPlaymode(Playable::Playmode playmode);
[10120]79    void setPlaymodeXML(const std::string& playmode); //recieves the playmode from a string (useful for script implementation)
[9971]80    virtual void movement (float dt);
81
[10120]82    //))
83
[10113]84    void nextWeaponConfig();
85    void previousWeaponConfig();
86
[10117]87    virtual void hit(float damage, WorldEntity* killer);
[10113]88
[7346]89  private:
90    void init();
91
[10032]92    //void calculateVelocity(float time);
[7346]93
[9957]94    void regen(float time);  //!< handler for shield and electronic regeneration
[9943]95
[9965]96    void weaponRegen(float time);   //!< weapon energy regeneration
97
[10022]98    inline bool systemFailure() {  return (this->electronicCur < float(rand())/float(RAND_MAX) * this->electronicTH); };
[10020]99
[10120]100    void updateElectronicWidget();
101    void updateShieldWidget();
102
[9965]103    //WeaponManager         weaponMan;      //!< the primary weapon manager: managing a list of energy weapons to wepaon-slot mapping
[9961]104    WeaponManager         secWeaponMan;       //!< the secondary weapon manager: managing a list of special weapons to weapon-slot mapping
105    short                 supportedPlaymodes; //!< What Playmodes are Supported in this Playable.
106    Playable::Playmode    playmode;           //!< The current playmode.
107
[9950]108    //ship atributes
[9957]109    float       shieldCur;          //!< current shield
110    float       shieldMax;          //!< maximum shield
[9950]111    float       shieldEnergyShare;  //!< percentage of reactor output
[9970]112    float       shieldRegen;        //!< shield regeneration rate per second
[9957]113    float       shieldTH;           //!< shield threshhold for reactivation
[9950]114    bool        shieldActive;       //!< wheather the shield is working
[10120]115    OrxGui::GLGuiEnergyWidgetVertical* shieldWidget; //!< holds the widget that shows the shield bar
[9943]116
[9957]117    float       armorCur;           //!< current armor
118    float       armorMax;           //!< maximum armor
[9963]119    float       armorRegen;         //!< armor regeneration per tick (usable on bioships?)
[10120]120    //note that the armor widget is set on the health- widget in world- entity (see in player.cc)
[9943]121
[9957]122    float       electronicCur;      //!< current electronic
123    float       electronicMax;      //!< maximum electronic
124    float       electronicRegen;    //!< electronic regenration rate per tick
[10020]125    float       electronicTH;       //!< Threshhold for electronic failure
[10120]126    OrxGui::GLGuiEnergyWidgetVertical* electronicWidget; //!< holds the widget that shows the electronic bar
[9943]127
[9970]128    float       engineSpeedCur;     //!< speed output for movement = speed base + energy share part
129    float       engineSpeedBase;    //!< speed base
[9950]130    int         enginePowerConsume; //!< energy needed
131    float       engineEnergyShare;  //!< percentage of reactor output
[9943]132
[9950]133    int         weaponEnergySlot;   //!< number of energy weapon slots
134    int         weaponEnergyUsed;
135    float       weaponEnergyShare;
[9965]136    float       weaponEnergyRegen;
[9950]137    int         weaponSpecialSlot;  //!< number of special weapon slots
138    int         weaponSpecialUsed;
[9943]139
[9965]140    float       reactorOutput;      //!< reactor output
141    float       reactorCapacity;    //!< reactor capacity
[9943]142
[9961]143    int         curWeaponPrimary;   //!< current primary weapon config
144    int         curWeaponSecondary; //!< current secondary weapon config
[9958]145
[10017]146    bool                  bForward;                //!< up button pressed.
147    bool                  bBackward;              //!< down button pressed.
[7346]148    bool                  bLeft;              //!< left button pressed.
149    bool                  bRight;             //!< right button pressed.
150    bool                  bAscend;            //!< ascend button pressed.
151    bool                  bDescend;           //!< descend button presses.
152    bool                  bRollL;             //!< rolling button pressed (left)
153    bool                  bRollR;             //!< rolling button pressed (right)
[10023]154    bool                  bSecFire;           //!< second fire button pressed
[7346]155
[10017]156    /*
[7346]157    float                 xMouse;             //!< mouse moved in x-Direction
158    float                 yMouse;             //!< mouse moved in y-Direction
159    float                 mouseSensitivity;   //!< the mouse sensitivity
160    int                   yInvert;
161    int                   controlVelocityX;
162    int                   controlVelocityY;
[10017]163    */
[7346]164
[10043]165    Vector                velocity;           //!< the velocity of the player.
[10078]166    Vector                oldPos;
[10017]167
[9971]168// 2D-traveling
169    PNode*                travelNode;
170    float                 travelSpeed;        //!< the current speed of the Ship (to make soft movement)
[10098]171    Vector                travelVelocity;     //!< object internal velocity vector for relative movement to the track node
[10019]172    Vector2D              travelDistancePlus;     //!< Travel-Distance away from the TravelNode
173    Vector2D              travelDistanceMinus;
[9971]174
175// Camera
176    PNode                 cameraNode;
177    float                 cameraLook;
178    float                 rotation;
[10017]179    float                 cameraSpeed;
[9971]180
[10017]181    /*
[7346]182    Quaternion            mouseDir;           //!< the direction where the player wants to fly
183    Quaternion            oldMouseDir;        //!< the direction where the player wanted to fly
184    float                 shipInertia;        //!< the inertia of the ship(how fast the ship reacts to a mouse input)
185    Quaternion            rotQuat;
186    Quaternion            pitchDir;
[9971]187    float                 dogdeSpeed;        //!< the dogde Speed of the ship.
[10017]188    */
[7346]189
[10032]190    //Quaternion            direction;          //!< the direction of the ship.
[9971]191    float                 acceleration;       //!< the acceleration of the ship.
[10017]192    //float                 airFriction;        //!< AirFriction.
193    //float                 airViscosity;
[7346]194
195    byte                  oldMask;            //!< used for synchronisation
196
[10081]197    Trail*                trail;              //!< Burst trail
198    Trail*                trailL;              //!< Burst trail
199    Trail*                trailR;              //!< Burst trail
200
[7346]201};
202
203#endif /* _SPACE_SHIPS_H */
Note: See TracBrowser for help on using the repository browser.