Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Dec 9, 2015, 2:45:58 PM (9 years ago)
Author:
maxima
Message:

Merged presentation and fabiens branch. Had to modify hoverHUD and invaderHUD, because the text of the healthbar wasn't correctly displayed and the weapon settings of the hovership.

Location:
code/branches/presentationHS15
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • code/branches/presentationHS15

  • code/branches/presentationHS15/src/orxonox/worldentities/MobileEntity.h

    r10437 r10961  
    4747        linear velocity. Then the linear velocity is multiplied by the time since the last call of tick and then added to the position. The same happens with
    4848        the angular acceleration and velocity. With this procedure MobileEntities can change their position and orientation with time.
     49
     50        A MobileEntity can only have the collisition type WorldEntity::None, WorldEntity::Dynamic or WorldEntity::Kinematic. The collsion type WorldEntity::Static is illegal.
    4951    */
    5052
  • code/branches/presentationHS15/src/orxonox/worldentities/StaticEntity.h

    r10437 r10961  
    4444        it is called StaticEntity. It will keep the same position (always with respect to its parent) forever unless you call the
    4545        function @see setPosition to changee it.
     46
     47        A StaticEntity can only have the collisition type WorldEntity::None or WorldEntity::Static. The collsion types WorldEntity::Dynamic and WorldEntity::Kinematic are illegal.
    4648    */
    4749
  • code/branches/presentationHS15/src/orxonox/worldentities/pawns/Pawn.cc

    r10650 r10961  
    4646#include "weaponsystem/WeaponPack.h"
    4747#include "weaponsystem/WeaponSet.h"
     48#include "weaponsystem/Munition.h"
    4849#include "sound/WorldSound.h"
    4950
     
    6162
    6263        this->bAlive_ = true;
    63         this->bReload_ = false;
    6464
    6565        this->health_ = 0;
     
    7171        this->maxShieldHealth_ = 100; //otherwise shield might increase to float_max
    7272        this->shieldAbsorption_ = 0.5;
    73 
    74         this->reloadRate_ = 0;
    75         this->reloadWaitTime_ = 1.0f;
    76         this->reloadWaitCountdown_ = 0;
     73        this->shieldRechargeRate_ = 0;
     74        this->shieldRechargeWaitTime_ = 1.0f;
     75        this->shieldRechargeWaitCountdown_ = 0;
    7776
    7877        this->lastHitOriginator_ = 0;
     
    141140        XMLPortObject(Pawn, WeaponSlot, "weaponslots", addWeaponSlot, getWeaponSlot, xmlelement, mode);
    142141        XMLPortObject(Pawn, WeaponSet, "weaponsets", addWeaponSet, getWeaponSet, xmlelement, mode);
    143         XMLPortObject(Pawn, WeaponPack, "weapons", addWeaponPackXML, getWeaponPack, xmlelement, mode);
    144 
    145         XMLPortParam(Pawn, "reloadrate", setReloadRate, getReloadRate, xmlelement, mode).defaultValues(0);
    146         XMLPortParam(Pawn, "reloadwaittime", setReloadWaitTime, getReloadWaitTime, xmlelement, mode).defaultValues(1.0f);
     142        XMLPortObject(Pawn, WeaponPack, "weaponpacks", addWeaponPackXML, getWeaponPack, xmlelement, mode);
     143        XMLPortObject(Pawn, Munition, "munition", addMunitionXML, getMunitionXML, xmlelement, mode);
     144
     145        XMLPortParam(Pawn, "shieldrechargerate", setShieldRechargeRate, getShieldRechargeRate, xmlelement, mode).defaultValues(0);
     146        XMLPortParam(Pawn, "shieldrechargewaittime", setShieldRechargeWaitTime, getShieldRechargeWaitTime, xmlelement, mode).defaultValues(1.0f);
    147147
    148148        XMLPortParam(Pawn, "explosionSound",  setExplosionSound,  getExplosionSound,  xmlelement, mode);
     
    153153    void Pawn::registerVariables()
    154154    {
    155         registerVariable(this->bAlive_,           VariableDirection::ToClient);
    156         registerVariable(this->health_,           VariableDirection::ToClient);
    157         registerVariable(this->maxHealth_,        VariableDirection::ToClient);
    158         registerVariable(this->shieldHealth_,     VariableDirection::ToClient);
    159         registerVariable(this->maxShieldHealth_,  VariableDirection::ToClient);
    160         registerVariable(this->shieldAbsorption_, VariableDirection::ToClient);
    161         registerVariable(this->bReload_,          VariableDirection::ToServer);
    162         registerVariable(this->aimPosition_,      VariableDirection::ToServer);  // For the moment this variable gets only transfered to the server
     155        registerVariable(this->bAlive_,            VariableDirection::ToClient);
     156        registerVariable(this->health_,            VariableDirection::ToClient);
     157        registerVariable(this->maxHealth_,         VariableDirection::ToClient);
     158        registerVariable(this->shieldHealth_,      VariableDirection::ToClient);
     159        registerVariable(this->maxShieldHealth_,   VariableDirection::ToClient);
     160        registerVariable(this->shieldAbsorption_,  VariableDirection::ToClient);
     161        registerVariable(this->aimPosition_,       VariableDirection::ToServer);  // For the moment this variable gets only transfered to the server
    163162    }
    164163
     
    167166        SUPER(Pawn, tick, dt);
    168167
    169         this->bReload_ = false;
    170 
     168        // Recharge the shield
    171169        // TODO: use the existing timer functions instead
    172         if(this->reloadWaitCountdown_ > 0)
    173         {
    174             this->decreaseReloadCountdownTime(dt);
    175         }
    176         else
    177         {
    178             this->addShieldHealth(this->getReloadRate() * dt);
    179             this->resetReloadCountdown();
     170        if(this->shieldRechargeWaitCountdown_ > 0)
     171        {
     172            this->decreaseShieldRechargeCountdownTime(dt);
     173        }
     174        else
     175        {
     176            this->addShieldHealth(this->getShieldRechargeRate() * dt);
     177            this->resetShieldRechargeCountdown();
    180178        }
    181179
     
    229227    }
    230228
    231     void Pawn::setReloadRate(float reloadrate)
    232     {
    233         this->reloadRate_ = reloadrate;
    234     }
    235 
    236     void Pawn::setReloadWaitTime(float reloadwaittime)
    237     {
    238         this->reloadWaitTime_ = reloadwaittime;
    239     }
    240 
    241     void Pawn::decreaseReloadCountdownTime(float dt)
    242     {
    243         this->reloadWaitCountdown_ -= dt;
     229    void Pawn::setShieldRechargeRate(float shieldRechargeRate)
     230    {
     231        this->shieldRechargeRate_ = shieldRechargeRate;
     232    }
     233
     234    void Pawn::setShieldRechargeWaitTime(float shieldRechargeWaitTime)
     235    {
     236        this->shieldRechargeWaitTime_ = shieldRechargeWaitTime;
     237    }
     238
     239    void Pawn::decreaseShieldRechargeCountdownTime(float dt)
     240    {
     241        this->shieldRechargeWaitCountdown_ -= dt;
    244242    }
    245243
     
    252250        if (this->getGametype() && this->getGametype()->allowPawnDamage(this, originator))
    253251        {
     252            // Health-damage cannot be absorbed by shields.
     253            // Shield-damage only reduces shield health.
     254            // Normal damage can be (partially) absorbed by shields.
     255
    254256            if (shielddamage >= this->getShieldHealth())
    255257            {
     
    480482    }
    481483
    482     void Pawn::reload()
    483     {
    484         this->bReload_ = true;
    485     }
    486 
    487484    void Pawn::postSpawn()
    488485    {
     
    554551    }
    555552
     553    std::vector<WeaponPack *> * Pawn::getAllWeaponPacks()
     554    {
     555        if (this->weaponSystem_)
     556            return this->weaponSystem_->getAllWeaponPacks();
     557        else
     558            return 0;       
     559    }
     560
     561    void Pawn::addMunitionXML(Munition* munition)
     562    {
     563        if (this->weaponSystem_ && munition)
     564        {
     565            this->weaponSystem_->addMunition(munition);
     566        }
     567    }
     568
     569    Munition* Pawn::getMunitionXML() const
     570    {
     571        return NULL;
     572    }
     573
     574    Munition* Pawn::getMunition(SubclassIdentifier<Munition> * identifier)
     575    {
     576        if (weaponSystem_)
     577        {
     578            return weaponSystem_->getMunition(identifier);
     579        }
     580
     581        return NULL;
     582    }
     583
    556584    //Tell the Map (RadarViewable), if this is a playership
    557585    void Pawn::startLocalHumanControl()
    558586    {
    559 //        SUPER(ControllableEntity, changedPlayer());
     587//        SUPER(ControllableEntity, startLocalHumanControl());
    560588        ControllableEntity::startLocalHumanControl();
    561589        this->isHumanShip_ = true;
  • code/branches/presentationHS15/src/orxonox/worldentities/pawns/Pawn.h

    r10437 r10961  
    4242    /**
    4343    @brief
    44         Everything in Orxonoy that has a health attribute is a Pawn. After a Pawn is spawned its health is set to
     44        Everything in Orxonox that has a health attribute is a Pawn. After a Pawn is spawned its health is set to
    4545        its initial health. In every call of the Pawns tick function the game checks whether the pawns health is at
    4646        or below zero. If it is, the pawn gets killed.
    4747
    48         Pawns can carry pickups and fire weapons. The can also have shields.
     48        Pawns can carry pickups and fire weapons. They can also have shields.
    4949
    5050        Notice that every Pawn is a ControllableEntity.
     
    116116                { return this->shieldAbsorption_; }
    117117
    118             // TODO: Rename to shieldRechargeRate
    119             virtual void setReloadRate(float reloadrate);
    120             inline float getReloadRate() const
    121                 { return this->reloadRate_; }
    122 
    123             virtual void setReloadWaitTime(float reloadwaittime);
    124             inline float getReloadWaitTime() const
    125                 { return this->reloadWaitTime_; }
    126 
    127             inline void resetReloadCountdown()
    128                 { this->reloadWaitCountdown_ = 0; }
    129 
    130             inline void startReloadCountdown()
    131                 { this->reloadWaitCountdown_ = this->getReloadWaitTime(); } // TODO: Implement in Projectile.cc
    132 
    133             virtual void decreaseReloadCountdownTime(float dt);
     118            virtual void setShieldRechargeRate(float shieldRechargeRate);
     119            inline float getShieldRechargeRate() const
     120                { return this->shieldRechargeRate_; }
     121
     122            virtual void setShieldRechargeWaitTime(float shieldRechargeWaitTime);
     123            inline float getShieldRechargeWaitTime() const
     124                { return this->shieldRechargeWaitTime_; }
     125
     126            inline void resetShieldRechargeCountdown()
     127                { this->shieldRechargeWaitCountdown_ = 0; }
     128
     129            inline void startShieldRechargeCountdown()
     130                { this->shieldRechargeWaitCountdown_ = this->getShieldRechargeWaitTime(); } // TODO: Implement in Projectile.cc
     131
     132            virtual void decreaseShieldRechargeCountdownTime(float dt);
    134133
    135134            inline ControllableEntity* getLastHitOriginator() const
    136135                { return this->lastHitOriginator_; }
    137136
    138             //virtual void hit(Pawn* originator, const Vector3& force, float damage);
    139             //virtual void hit(Pawn* originator, btManifoldPoint& contactpoint, float damage);
    140137            virtual void hit(Pawn* originator, const Vector3& force, const btCollisionShape* cs, float damage, float healthdamage = 0.0f, float shielddamage = 0.0f);
    141138            virtual void hit(Pawn* originator, btManifoldPoint& contactpoint, const btCollisionShape* cs, float damage, float healthdamage = 0.0f, float shielddamage = 0.0f);
     
    144141
    145142            virtual void fired(unsigned int firemode);
    146             virtual void reload();
    147143            virtual void postSpawn();
    148144
     
    154150            void addWeaponPackXML(WeaponPack * wPack);
    155151            WeaponPack * getWeaponPack(unsigned int index) const;
     152            std::vector<WeaponPack *> * getAllWeaponPacks();
     153
     154            void addMunitionXML(Munition* munition);
     155            Munition* getMunitionXML() const;
     156           
     157            Munition* getMunition(SubclassIdentifier<Munition> * identifier);
    156158
    157159            virtual void addedWeaponPack(WeaponPack* wPack) {}
     
    207209            virtual void spawneffect();
    208210
    209             //virtual void damage(float damage, Pawn* originator = 0);
    210211            virtual void damage(float damage, float healthdamage = 0.0f, float shielddamage = 0.0f, Pawn* originator = NULL, const btCollisionShape* cs = NULL);
    211212
     
    226227            float initialShieldHealth_;
    227228            float shieldAbsorption_; ///< Has to be between 0 and 1
    228             float reloadRate_;
    229             float reloadWaitTime_;
    230             float reloadWaitCountdown_;
     229            float shieldRechargeRate_;
     230            float shieldRechargeWaitTime_;
     231            float shieldRechargeWaitCountdown_;
    231232
    232233            float damageMultiplier_; ///< Used by the Damage Boost Pickup.
     
    235236
    236237            WeaponSystem* weaponSystem_;
    237             bool bReload_;
    238238
    239239            std::string spawnparticlesource_;
  • code/branches/presentationHS15/src/orxonox/worldentities/pawns/SpaceShip.cc

    r10216 r10961  
    297297        }
    298298    }
     299
     300    void SpaceShip::gainBoostPower(float gainedBoostPower)
     301    {
     302        this->boostPower_ += gainedBoostPower;
     303       
     304        if (this->boostPower_ > this->initialBoostPower_)
     305        {
     306            this->boostPower_ = this->initialBoostPower_;
     307        }
     308
     309        // If the booster is in cooldown mode and we gained boost power, the abort the cooldown.
     310        if (this->isBoostCoolingDown() && this->boostPower_ > 0.0f)
     311        {
     312            timer_.stopTimer();
     313            this->boostCooledDown();
     314        }
     315    }
     316
    299317    /**
    300318    @brief
  • code/branches/presentationHS15/src/orxonox/worldentities/pawns/SpaceShip.h

    r10437 r10961  
    5353        - The <b>boost</b>, there are quite some parameters pertaining to boosting. The boost is a special move of the SpaceShip, where, for a limited amount of time, it can fly considerably faster than usual. The <b>boostPower</b> is the amount of power available for boosting. The <b>boostPowerRate</b> is the rate at which the boost power is replenished. The <b>boostRate</b> is the rate at which boosting uses power. And the <b>boostCooldownDuration</b> is the time the SpaceShip cannot boost, once all the boost power has been used up. Naturally all of these parameters must be non-negative.
    5454        - The <b>boost shaking</b>, when the SpaceShip boosts, the camera shakes to create a more immersive effect. Two parameters can be used to adjust the effect. The <b>shakeFrequency</b> is the frequency with which the camera shakes. And the <b>shakeAmplitude</b> is the amount with which the camera shakes. Again these parameters must bee non-negative.
    55         - The <b>lift</b> creates a more natural flight feeling through the addition of a lift force. There are again tow parameters that can be specified. The <b>lift</b> which is the lift force that is applied. And the <b>stallSpeed</b> which is the forward speed after which no more lift is generated.
     55        - The <b>lift</b> creates a more natural flight feeling through the addition of a lift force. There are again two parameters that can be specified. The <b>lift</b> which is the lift force that is applied. And the <b>stallSpeed</b> which is the forward speed after which no more lift is generated.
     56
     57        A spaceship always needs to have the collision type "dynamic". Other collision types are illegal.
    5658
    5759        As mentioned @ref orxonox::Engine Engines can be mounted on the SpaceShip. Here is a (primitive) example of a SpaceShip defined in XML:
     
    250252            inline float getShakeAmplitude() const
    251253                { return this->shakeAmplitude_; }
     254            /**
     255            @brief Add boost power. Is non-negative.
     256            @return Returns the current boost power.
     257            */
     258            void gainBoostPower(float gainedBoostPower);
    252259
    253260        protected:
     
    262269            bool bBoostCooldown_;         //!< Whether the SpaceShip is currently in boost cooldown, during which boosting is impossible.
    263270            float initialBoostPower_;     //!< The initial (and maximal) boost power.
    264             float boostPower_;            //!< The current boost power.
     271            float boostPower_;            //!< The current boost power. If the boost power is reduced to zero the boost cooldown will start.
    265272            float boostPowerRate_;        //!< The rate at which the boost power is recharged.
    266273            float boostRate_;             //!< The rate at which boost power is used up.
     
    289296            std::vector<Engine*> engineList_; //!< The list of all Engines mounted on this SpaceShip.
    290297
    291             Timer timer_;                          //!< Timer for the cooldown duration.
     298            Timer timer_;                          //!< Timer for the cooldown of the boost.
    292299            float shakeDt_;                        //!< Temporary variable for the shaking of the camera.
    293300            Vector3 cameraOriginalPosition_;       //!< The original position of the camera before shaking it.
Note: See TracChangeset for help on using the changeset viewer.