Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jun 5, 2007, 2:48:15 PM (17 years ago)
Author:
nicolasc
Message:

moved "ship attributes" to world entity
electronic and shield widget not yet working

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/vs-enhencements/src/world_entities/space_ships/space_ship.h

    r10669 r10670  
    1212#include "playable.h"
    1313#include "extendable.h"
     14#include "world_entity.h"
    1415
    1516// Forward Declaration
     
    6465
    6566    //!< functions for XML loading
    66     inline void setReactor(float output) {this->reactorOutput = output; };
    67     inline void setShield(float cur, float max, float th, float regen)
    68         { this->shieldCur = cur; this->shieldMax = max; this->shieldTH = th; this->shieldRegen = regen;};
    69     inline void setArmor(float cur, float max) { this->setHealth(cur); this->setHealthMax(max); };
    70     inline void setElectronic(float cur, float max, float th, float regen)
    71         { this->electronicCur = cur; this->electronicMax = max; this->electronicTH = th; this->electronicRegen = regen; };
    72     inline void setEngine( float speedBase) {this->engineSpeedBase = speedBase; };
    73     inline void setEnergyShare(float shield, float weapon, float engine)
     67    void setReactor(float output) {this->reactorOutput = output; };
     68    void setEngine( float speedBase) {this->engineSpeedBase = speedBase; };
     69    void loadEnergyShare(float shield, float weapon, float engine)
    7470        { float tmp = shield + weapon + engine; if (unlikely (tmp > 1)) { tmp = 1/tmp; }
    75           // dirty safety hack, prevents total share being bigger than 1!!
     71          // HACK dirty safety hack, prevents total share being bigger than 1!!
    7672          this->shieldEnergyShare = shield * tmp;
    7773          this->weaponEnergyShare = weapon * tmp;
     
    7975    inline void setWeapon(float regen) { this->weaponEnergyRegen = regen; };
    8076
    81     //!< Resynchonizes armor with health in WE!!
    82 //     inline void updateHealth() { this->setHealth(this->armorCur); this->setHealthMax(this->armorMax); };
    83 
    8477    void addWeaponToSlot(int wm, int config, int slot, const std::string& weaponName);
    85 
    86     //Functions for GUI
    87     inline float getShieldCur() { return this->shieldCur; };        //!< returns current shield value
    88     inline float getShieldMax() { return this->shieldMax; };        //!< returns maximum shield value
    89 
    90     inline float getArmorCur() { return this->getHealth(); };          //!< returns current armor value
    91     inline float getArmorMax() { return this->getHealthMax(); };          //!< returns current armor value
    92 
    93     inline float getElectronicCur() { return this->electronicCur; }; //!< returns current electronic value
    94     inline float getElectronicMax() { return this->electronicMax; }; //!< returns current electronic value
    9578
    9679    inline PNode* getTravelNode() { return this->travelNode; };
     
    121104    //void calculateVelocity(float time);
    122105
    123     void regen(float time);  //!< handler for shield and electronic regeneration
     106//    void regen(float time);  //!< handler for shield and electronic regeneration
    124107
    125108    void weaponRegen(float time);   //!< weapon energy regeneration
    126109
    127     inline bool systemFailure() {  return (this->electronicCur < float(rand())/float(RAND_MAX) * this->electronicTH); };
    128 
    129     void updateElectronicWidget();
    130     void updateShieldWidget();
     110//     inline bool systemFailure() {  return (this->getElectronic() < float(rand())/float(RAND_MAX) * this->getElectronicTH()); };
     111
     112//     void updateElectronicWidget();
     113//     void updateShieldWidget();
    131114
    132115    //WeaponManager         weaponMan;      //!< the primary weapon manager: managing a list of energy weapons to wepaon-slot mapping
     
    136119
    137120    //ship atributes
    138     float       shieldCur;          //!< current shield
    139     float       shieldMax;          //!< maximum shield
    140     float       shieldEnergyShare;  //!< percentage of reactor output
    141     float       shieldRegen;        //!< shield regeneration rate per second
    142     float       shieldTH;           //!< shield threshhold for reactivation
    143     bool        shieldActive;       //!< wheather the shield is working
    144     OrxGui::GLGuiEnergyWidgetVertical* shieldWidget; //!< holds the widget that shows the shield bar
     121//    float       shieldCur;          //!< current shield
     122//    float       shieldMax;          //!< maximum shield
     123//    float       shieldRegen;        //!< shield regeneration rate per second
     124//    float       shieldTH;           //!< shield threshhold for reactivation
     125//    bool        shieldActive;       //!< wheather the shield is working
     126//    OrxGui::GLGuiEnergyWidgetVertical* shieldWidget; //!< holds the widget that shows the shield bar
    145127
    146128//    float       armorCur;           //!< current armor
    147129//    float       armorMax;           //!< maximum armor
    148     float       armorRegen;         //!< armor regeneration per tick (usable on bioships?)
     130//    float       armorRegen;         //!< armor regeneration per tick (usable on bioships?)
    149131    //note that the armor widget is set on the health- widget in world- entity (see in player.cc)
    150132
    151     float       electronicCur;      //!< current electronic
    152     float       electronicMax;      //!< maximum electronic
    153     float       electronicRegen;    //!< electronic regenration rate per tick
    154     float       electronicTH;       //!< Threshhold for electronic failure
    155     OrxGui::GLGuiEnergyWidgetVertical* electronicWidget; //!< holds the widget that shows the electronic bar
     133//    float       electronicCur;      //!< current electronic
     134//    float       electronicMax;      //!< maximum electronic
     135//    float       electronicRegen;    //!< electronic regenration rate per tick
     136//    float       electronicTH;       //!< Threshhold for electronic failure
     137//    OrxGui::GLGuiEnergyWidgetVertical* electronicWidget; //!< holds the widget that shows the electronic bar
    156138
    157139    float       engineSpeedCur;     //!< speed output for movement = speed base + energy share part
     
    159141    int         enginePowerConsume; //!< energy needed
    160142    float       engineEnergyShare;  //!< percentage of reactor output
     143    float       shieldEnergyShare;  //!< percentage of reactor output
    161144
    162145    int         weaponEnergySlot;   //!< number of energy weapon slots
Note: See TracChangeset for help on using the changeset viewer.