Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
May 23, 2011, 3:54:40 PM (13 years ago)
Author:
simonmie
Message:

comments added, unused parts removed, some spam messages removed

Location:
code/branches/gameimmersion/src/modules/weapons
Files:
14 edited

Legend:

Unmodified
Added
Removed
  • code/branches/gameimmersion/src/modules/weapons/projectiles/BasicProjectile.cc

    r8538 r8542  
    5959    }
    6060
     61    /* The function called when a projectile hits another thing.
     62     * calls the hit-function, starts the reload countdown, displays visual effects
     63     * hit is defined in src/orxonox/worldentities/pawns/pawn.cc
     64     */
    6165    bool BasicProjectile::basicCollidesAgainst(WorldEntity* otherObject, btManifoldPoint& contactPoint, Pawn* owner, BasicProjectile* this_)
    6266    {
    6367        if (!this_->getBDestroy() && GameMode::isMaster())
    6468        {
    65             if (otherObject == /*this->*/owner/*_*/) //prevents you from shooting yourself
     69            if (otherObject == owner) //prevents you from shooting yourself
    6670                return false;
    6771
    68             this_->setBDestroy(true); //if something is hit, the object is destroyed and can't hit something else
    69 // instead of returning false, bDestroy is returned
     72            this_->setBDestroy(true); // If something is hit, the object is destroyed and can't hit something else.
     73                                      // The projectile is destroyed by its tick()-function (in the following tick).
    7074
    7175            Pawn* victim = orxonox_cast<Pawn*>(otherObject); //if otherObject isn't a Pawn, then victim is NULL
     
    7882            if (victim)
    7983            {
    80                 victim->hit(/*this->*/owner/*_*/, contactPoint, this_->getDamage(), this_->getHealthDamage(), this_->getShieldDamage());
     84                victim->hit(owner, contactPoint, this_->getDamage(), this_->getHealthDamage(), this_->getShieldDamage());
    8185                victim->startReloadCountdown();
    8286            }
    8387
    8488            // visual effects for being hit, depending on whether the shield is hit or not
    85             if (/*this->*/owner/*_*/) //if the owner does not exist (anymore??), no effects are displayed.
     89            if (owner) //if the owner does not exist (anymore?), no effects are displayed.
    8690            {
    87                 if (!victim || (victim && !victim->hasShield())) //same like below
     91                if (!victim || (victim && !victim->hasShield()))
    8892                {
    8993                    {
    90                         ParticleSpawner* effect = new ParticleSpawner(/*this->*/owner/*_*/->getCreator());
     94                        ParticleSpawner* effect = new ParticleSpawner(owner->getCreator());
    9195                        effect->setPosition(entity->getPosition());
    9296                        effect->setOrientation(entity->getOrientation());
     
    97101                        // second effect with same condition
    98102                    {
    99                         ParticleSpawner* effect = new ParticleSpawner(/*this->*/owner/*_*/->getCreator());
     103                        ParticleSpawner* effect = new ParticleSpawner(owner->getCreator());
    100104                        effect->setPosition(entity->getPosition());
    101105                        effect->setOrientation(entity->getOrientation());
     
    105109                    }
    106110                }
    107                         // victim->isAlive() is not false until the next tick, so getHealth() is used instead
     111
     112                // victim->isAlive() is not false until the next tick, so getHealth() > 0 is used instead
    108113                if (victim && victim->hasShield() && (this_->getDamage() > 0 || this_->getShieldDamage() > 0) && victim->getHealth() > 0)
    109114                {
    110                     ParticleSpawner* effect = new ParticleSpawner(/*this->*/owner/*_*/->getCreator());
     115                    ParticleSpawner* effect = new ParticleSpawner(owner->getCreator());
    111116                    effect->setPosition(entity->getPosition());
    112117                    effect->setOrientation(entity->getOrientation());
     
    117122            }
    118123
    119 //            if (victim)
    120 //            {
    121 //                victim->hit(/*this->*/owner/*_*/, contactPoint, this_->getDamage(), this_->getHealthDamage(), this_->getShieldDamage());
    122 //                victim->startReloadCountdown();
    123 //            }
    124124        }
    125125        return false;
    126126    }
    127 
    128 /*    void BasicProjectile::destroyObject()
    129     {
    130         if (GameMode::isMaster())
    131             this->destroy();
    132     }
    133 */
    134127}
  • code/branches/gameimmersion/src/modules/weapons/projectiles/BasicProjectile.h

    r8538 r8542  
    7878
    7979            bool bDestroy_;
    80 //            Timer destroyTimer_;
    8180    };
    8281}
  • code/branches/gameimmersion/src/modules/weapons/projectiles/Projectile.cc

    r8538 r8542  
    2323 *      Fabian 'x3n' Landau
    2424 *   Co-authors:
    25  *      ...
     25 *      simonmie
    2626 *
    2727 */
     
    4646
    4747        this->setConfigValues();
    48 //        this->bDestroy_ = false;
    49 //        this->owner_ = 0;
    50 //        this->damage_ = 115;
    51 ///////////////////me
    52 //        this->healthdamage_ = 0;
    53 //        this->shielddamage_ = 0;
    54 ///////////////////end me
     48        this->owner_ = 0;
    5549
    5650        // Get notification about collisions
    57 
    5851        if (GameMode::isMaster())
    5952        {
     
    9891    }
    9992
     93    /* Calls the collidesAgainst function of BasicProjectile
     94     */
    10095    bool Projectile::collidesAgainst(WorldEntity* otherObject, btManifoldPoint& contactPoint)
    10196    {
     
    10398    }
    10499
    105 //////////////////////////me edit
    106 /*    bool Projectile::collidesAgainst(WorldEntity* otherObject, btManifoldPoint& contactPoint)
    107     {
    108         if (!this->bDestroy_ && GameMode::isMaster())
    109         {
    110             if (otherObject == this->owner_)
    111                 return false;
    112 
    113             this->bDestroy_ = true;
    114 
    115             Pawn* victim = orxonox_cast<Pawn*>(otherObject); //if otherObject isn't a Pawn, then victim is NULL
    116 
    117             if (this->owner_)
    118             {
    119                 if (!victim || (victim && !victim->hasShield())) //same like below
    120                 {
    121                     ParticleSpawner* effect = new ParticleSpawner(this->owner_->getCreator());
    122                     effect->setPosition(this->getPosition());
    123                     effect->setOrientation(this->getOrientation());
    124                     effect->setDestroyAfterLife(true);
    125                     effect->setSource("Orxonox/explosion3");
    126                     effect->setLifetime(2.0f);
    127                 }
    128                 if (!victim || (victim && !victim->hasShield())) //same like above
    129                 {
    130                     ParticleSpawner* effect = new ParticleSpawner(this->owner_->getCreator());
    131                     effect->setPosition(this->getPosition());
    132                     effect->setOrientation(this->getOrientation());
    133                     effect->setDestroyAfterLife(true);
    134                     effect->setSource("Orxonox/smoke4");
    135                     effect->setLifetime(3.0f);
    136                 }
    137                 if (victim && victim->hasShield())
    138                 {
    139                     ParticleSpawner* effect = new ParticleSpawner(this->owner_->getCreator());
    140                     effect->setPosition(this->getPosition());
    141                     effect->setOrientation(this->getOrientation());
    142                     effect->setDestroyAfterLife(true);
    143                     effect->setSource("Orxonox/engineglow");
    144                     effect->setLifetime(0.5f);
    145                 }
    146             }
    147 
    148             if (victim)
    149             {
    150                 victim->hit(this->owner_, contactPoint, this->damage_, this->healthdamage_, this->shielddamage_);
    151                 victim->startReloadCountdown();
    152             }
    153         }
    154         return false;
    155     }
    156 //////////////////////////////////////////////////////////////////////end edit
    157 */
    158100    void Projectile::setOwner(Pawn* owner)
    159101    {
  • code/branches/gameimmersion/src/modules/weapons/projectiles/Projectile.h

    r8538 r8542  
    2323 *      Fabian 'x3n' Landau
    2424 *   Co-authors:
    25  *      ...
     25 *      simonmie
    2626 *
    2727 */
     
    5151            virtual bool collidesAgainst(WorldEntity* otherObject, btManifoldPoint& contactPoint);
    5252
    53 /*            inline void setDamage(float damage)
    54                 { this->damage_ = damage;  COUT(3) << "DAMAGE-SET-FUNKTION WIRD AUFGERUFEN" << endl; }
    55             inline float getDamage() const
    56                 { return this->damage_; }
    57 */
    58 
    59 
    6053            void setOwner(Pawn* owner);
    6154            inline Pawn* getOwner() const
    6255                { return this->owner_; }
    6356
    64 /*///////////////////me
    65 
    66             inline void setHealthDamage(float healthdamage)
    67                 { this->healthdamage_ = healthdamage; }
    68             inline float getHealthDamage() const
    69                 { return this->healthdamage_; }
    70 
    71             inline void setShieldDamage(float shielddamage)
    72                 { this->shielddamage_ = shielddamage; COUT(3) << "SHIELDDAMAGE SET TO " << shielddamage << endl; } //ShieldDamage wird korrekt gesettet vom XML-File
    73             inline float getShieldDamage() const
    74                 { return this->shielddamage_; }
    75 
    76 ///////////////////end me
    77 */
    7857
    7958        private:
    8059            WeakPtr<Pawn> owner_;
    8160            float lifetime_;
    82 /*            float damage_;
    83 ///////me
    84             float healthdamage_;
    85             float shielddamage_;
    86 ///////end me
    87             bool bDestroy_;
    88 */            Timer destroyTimer_;
     61            Timer destroyTimer_;
    8962    };
    9063}
  • code/branches/gameimmersion/src/modules/weapons/projectiles/Rocket.cc

    r8538 r8542  
    2323 *      Oliver Scheuss
    2424 *   Co-authors:
    25  *      ...
     25 *      simonmie
    2626 *
    2727 */
     
    4343#include "Scene.h"
    4444
    45 #include "BasicProjectile.h"
    46 
    4745namespace orxonox
    4846{
     
    5957
    6058        this->localAngularVelocity_ = 0;
    61 //        this->bDestroy_ = false;
    6259        this->lifetime_ = 100;
    6360
     
    183180    }
    184181
     182    /* Calls the collidesAgainst function of BasicProjectile
     183     */
    185184    bool Rocket::collidesAgainst(WorldEntity* otherObject, btManifoldPoint& contactPoint)
    186185    {
    187186        return BasicProjectile::basicCollidesAgainst(otherObject,contactPoint,this->getOwner(),this);
    188 
    189 /* * /        if (!this->bDestroy_ && GameMode::isMaster())
    190         {
    191             if (otherObject == this->owner_)
    192                 return false;
    193 
    194             this->bDestroy_ = true;
    195 
    196             if (this->owner_)
    197             {
    198                 {
    199                     ParticleSpawner* effect = new ParticleSpawner(this->owner_->getCreator());
    200                     effect->setPosition(this->getPosition());
    201                     effect->setOrientation(this->getOrientation());
    202                     effect->setDestroyAfterLife(true);
    203                     effect->setSource("Orxonox/explosion4");
    204                     effect->setLifetime(2.0f);
    205                 }
    206 
    207                 {
    208                     ParticleSpawner* effect = new ParticleSpawner(this->owner_->getCreator());
    209                     effect->setPosition(this->getPosition());
    210                     effect->setOrientation(this->getOrientation());
    211                     effect->setDestroyAfterLife(true);
    212                     effect->setSource("Orxonox/smoke4");
    213                     effect->setLifetime(3.0f);
    214                 }
    215             }
    216 
    217             Pawn* victim = orxonox_cast<Pawn*>(otherObject);
    218             if (victim)
    219                 victim->hit(this->owner_, contactPoint, this->damage_);
    220 //             this->destroy();
    221         }
    222 / * */        return false;
    223187    }
    224188
     
    237201    void Rocket::fired(unsigned int firemode)
    238202    {
    239 //         if (this->owner_)
    240 //         {
    241             this->destroy();
    242 //         }
     203        this->destroy();
    243204    }
    244205
  • code/branches/gameimmersion/src/modules/weapons/projectiles/Rocket.h

    r8538 r8542  
    2323 *      Oliver Scheuss
    2424 *   Co-authors:
    25  *      ...
     25 *      simonmie
    2626 *
    2727 */
     
    116116            WeakPtr<Pawn> owner_;
    117117            Vector3 localAngularVelocity_;
    118 //            float damage_;
    119 //            bool bDestroy_;
    120118
    121119            WeakPtr<PlayerInfo> player_;
  • code/branches/gameimmersion/src/modules/weapons/projectiles/SimpleRocket.cc

    r8538 r8542  
    2323 *      Oliver Scheuss
    2424 *   Co-authors:
    25  *      ...
     25 *      simonmie
    2626 *
    2727 */
     
    5353
    5454        this->localAngularVelocity_ = 0;
    55 //        this->bDestroy_ = false;
    5655        this->lifetime_ = 120;
    5756
    5857        this->setMass(15);
    59         COUT(4) << "simplerocket constructed\n";
     58//        COUT(4) << "simplerocket constructed\n";
    6059
    6160        if (GameMode::isMaster())
     
    163162
    164163
    165 
    166 
     164    /* Calls the collidesAgainst function of BasicProjectile
     165     */
    167166    bool SimpleRocket::collidesAgainst(WorldEntity* otherObject, btManifoldPoint& contactPoint)
    168167    {
    169168        return BasicProjectile::basicCollidesAgainst(otherObject,contactPoint,this->getOwner(),this);
    170 /*        if (!this->bDestroy_ && GameMode::isMaster())
    171         {
    172             if (otherObject == this->owner_)
    173                 return false;
    174 
    175             this->bDestroy_ = true;
    176 
    177             if (this->owner_)
    178             {
    179                 {
    180                     ParticleSpawner* effect = new ParticleSpawner(this->owner_->getCreator());
    181                     effect->setPosition(this->getPosition());
    182                     effect->setOrientation(this->getOrientation());
    183                     effect->setDestroyAfterLife(true);
    184                     effect->setSource("Orxonox/explosion4");
    185                     effect->setLifetime(2.0f);
    186                 }
    187 
    188                 {
    189                     ParticleSpawner* effect = new ParticleSpawner(this->owner_->getCreator());
    190                     effect->setPosition(this->getPosition());
    191                     effect->setOrientation(this->getOrientation());
    192                     effect->setDestroyAfterLife(true);
    193                     effect->setSource("Orxonox/smoke4");
    194                     effect->setLifetime(3.0f);
    195                 }
    196             }
    197 
    198             float dmg = this->damage_;
    199 //             if (this->owner_)
    200 //                 dmg = this->owner_->getPickups().processModifiers(ModifierType::Damage, dmg, false);
    201 
    202             Pawn* victim = orxonox_cast<Pawn*>(otherObject);
    203             if (victim)
    204                 victim->hit(this->owner_, contactPoint, dmg);
    205         }
    206         return false;
    207 */
    208169    }
    209170
  • code/branches/gameimmersion/src/modules/weapons/projectiles/SimpleRocket.h

    r8538 r8542  
    2323 *      Oliver Scheuss
    2424 *   Co-authors:
    25  *      ...
     25 *      simonmie
    2626 *
    2727 */
     
    121121            WeakPtr<Pawn> owner_;
    122122            Vector3 localAngularVelocity_;
    123 //            float damage_;
    124 //            bool bDestroy_;
    125123            bool fuel_; //!< Bool is true while the rocket "has fuel"
    126124
  • code/branches/gameimmersion/src/modules/weapons/weaponmodes/EnergyDrink.cc

    r8492 r8542  
    2323 *      Hagen Seifert
    2424 *   Co-authors:
    25  *      ...
     25 *      simonmie
    2626 *
    2727 */
     
    9797    }
    9898
     99    /* Creates the projectile object, sets its properties to the EnergyDrink properties, calls muendungsfeuer()
     100     */
    99101    void EnergyDrink::shot()
    100102    {
  • code/branches/gameimmersion/src/modules/weapons/weaponmodes/FusionFire.cc

    r8492 r8542  
    2323 *      Martin Polak
    2424 *   Co-authors:
    25  *      ...
     25 *      simonmie
    2626 *
    2727 */
     
    5454    }
    5555
     56    /* Creates the projectile (BillboardProjectile) object, sets its properties to the FusionFire properties
     57     */
    5658    void FusionFire::fire()
    5759    {
  • code/branches/gameimmersion/src/modules/weapons/weaponmodes/HsW01.cc

    r8492 r8542  
    2323 *      Hagen Seifert
    2424 *   Co-authors:
    25  *      ...
     25 *      simonmie
    2626 *
    2727 */
     
    109109    }
    110110
     111    /* Creates the projectile object, sets its properties to the HsW01 properties, calls muendungsfeuer()
     112     */
    111113    void HsW01::shot()
    112114    {
  • code/branches/gameimmersion/src/modules/weapons/weaponmodes/LaserFire.cc

    r8492 r8542  
    2323 *      Martin Polak
    2424 *   Co-authors:
    25  *      ...
     25 *      simonmie
    2626 *
    2727 */
     
    5151    }
    5252
     53    /* Creates the projectile object, sets its properties to the LaserFire properties
     54     */
    5355    void LaserFire::fire()
    5456    {
  • code/branches/gameimmersion/src/modules/weapons/weaponmodes/LightningGun.cc

    r8492 r8542  
    2323 *      Joel Smely
    2424 *   Co-authors:
    25  *      ...
     25 *      simonmie
    2626 *
    2727 */
     
    5656    }
    5757
     58    /* Creates the projectile (LightningGunProjectile) object, sets its properties to the LightningGun properties
     59     */
    5860    void LightningGun::fire()
    5961    {
  • code/branches/gameimmersion/src/modules/weapons/weaponmodes/RocketFire.cc

    r8492 r8542  
    2323 *      Oliver Scheuss
    2424 *   Co-authors:
    25  *      ...
     25 *      simonmie
    2626 *
    2727 */
     
    5959    }
    6060
     61    /* Creates the Rocket object, sets its properties to the RocketFire properties
     62     */
    6163    void RocketFire::fire()
    6264    {
     
    7173        rocket->setOwner(this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn());
    7274        rocket->setDamage(this->getDamage());
    73 //        rocket->setShieldDamage(this->getShieldDamage());
     75//        rocket->setShieldDamage(this->getShieldDamage()); //correct this!
    7476//        rocket->setHealthDamage(this->getHealthDamage());
    7577    }
Note: See TracChangeset for help on using the changeset viewer.