Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

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

finally: vertical scroller moves implemented :-)

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