Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
May 25, 2011, 9:28:29 PM (13 years ago)
Author:
dafrick
Message:

Reverse merge to revert last, failed, merge. Apparently you can't partially commit a merge.

Location:
code/branches/presentation/src/modules/weapons/projectiles
Files:
2 deleted
7 edited

Legend:

Unmodified
Added
Removed
  • code/branches/presentation/src/modules/weapons/projectiles/CMakeLists.txt

    r8578 r8579  
    66  Rocket.cc
    77  SimpleRocket.cc
    8   BasicProjectile.cc
    98)
  • code/branches/presentation/src/modules/weapons/projectiles/Projectile.cc

    r8578 r8579  
    2323 *      Fabian 'x3n' Landau
    2424 *   Co-authors:
    25  *      simonmie
     25 *      ...
    2626 *
    2727 */
     
    4141    CreateFactory(Projectile);
    4242
    43     Projectile::Projectile(BaseObject* creator) : MovableEntity(creator), BasicProjectile()
     43    Projectile::Projectile(BaseObject* creator) : MovableEntity(creator)
    4444    {
    4545        RegisterObject(Projectile);
    4646
    4747        this->setConfigValues();
     48        this->bDestroy_ = false;
    4849        this->owner_ = 0;
     50        this->damage_ = 15;
    4951
    5052        // Get notification about collisions
     53
    5154        if (GameMode::isMaster())
    5255        {
     
    8184            return;
    8285
    83         if (this->getBDestroy())
     86        if (this->bDestroy_)
    8487            this->destroy(); // TODO: use a scheduler instead of deleting the object right here in tick()
    8588    }
     
    9194    }
    9295
    93     /* Calls the collidesAgainst function of BasicProjectile
    94      */
    9596    bool Projectile::collidesAgainst(WorldEntity* otherObject, btManifoldPoint& contactPoint)
    9697    {
    97         return BasicProjectile::basicCollidesAgainst(otherObject,contactPoint,this->getOwner(),this);
     98        if (!this->bDestroy_ && GameMode::isMaster())
     99        {
     100            if (otherObject == this->owner_)
     101                return false;
     102
     103            this->bDestroy_ = true;
     104
     105            if (this->owner_)
     106            {
     107                {
     108                    ParticleSpawner* effect = new ParticleSpawner(this->owner_->getCreator());
     109                    effect->setPosition(this->getPosition());
     110                    effect->setOrientation(this->getOrientation());
     111                    effect->setDestroyAfterLife(true);
     112                    effect->setSource("Orxonox/explosion3");
     113                    effect->setLifetime(2.0f);
     114                }
     115                {
     116                    ParticleSpawner* effect = new ParticleSpawner(this->owner_->getCreator());
     117                    effect->setPosition(this->getPosition());
     118                    effect->setOrientation(this->getOrientation());
     119                    effect->setDestroyAfterLife(true);
     120                    effect->setSource("Orxonox/smoke4");
     121                    effect->setLifetime(3.0f);
     122                }
     123            }
     124
     125            Pawn* victim = orxonox_cast<Pawn*>(otherObject);
     126            if (victim)
     127                victim->hit(this->owner_, contactPoint, this->damage_);
     128        }
     129        return false;
    98130    }
    99131
  • code/branches/presentation/src/modules/weapons/projectiles/Projectile.h

    r8578 r8579  
    2323 *      Fabian 'x3n' Landau
    2424 *   Co-authors:
    25  *      simonmie
     25 *      ...
    2626 *
    2727 */
     
    3535#include "worldentities/MovableEntity.h"
    3636
    37 #include "BasicProjectile.h"
    38 
    3937namespace orxonox
    4038{
    41     class _WeaponsExport Projectile : public MovableEntity, public BasicProjectile
     39    class _WeaponsExport Projectile : public MovableEntity
    4240    {
    4341        public:
     
    5149            virtual bool collidesAgainst(WorldEntity* otherObject, btManifoldPoint& contactPoint);
    5250
     51            inline void setDamage(float damage)
     52                { this->damage_ = damage; }
     53            inline float getDamage() const
     54                { return this->damage_; }
     55
    5356            void setOwner(Pawn* owner);
    5457            inline Pawn* getOwner() const
    5558                { return this->owner_; }
    5659
    57 
    5860        private:
    5961            WeakPtr<Pawn> owner_;
    6062            float lifetime_;
     63            float damage_;
     64            bool bDestroy_;
    6165            Timer destroyTimer_;
    6266    };
  • code/branches/presentation/src/modules/weapons/projectiles/Rocket.cc

    r8578 r8579  
    2323 *      Oliver Scheuss
    2424 *   Co-authors:
    25  *      simonmie
     25 *      ...
    2626 *
    2727 */
     
    5252        Constructor. Registers the object and initializes some default values.
    5353    */
    54     Rocket::Rocket(BaseObject* creator) : ControllableEntity(creator), BasicProjectile()
     54    Rocket::Rocket(BaseObject* creator) : ControllableEntity(creator)
    5555    {
    5656        RegisterObject(Rocket);// - register the Rocket class to the core
    5757
    5858        this->localAngularVelocity_ = 0;
     59        this->bDestroy_ = false;
    5960        this->lifetime_ = 100;
    6061
     
    145146    {
    146147        this->owner_ = owner;
    147         this->player_ = this->getOwner()->getPlayer();
    148         this->getOwner()->getPlayer()->startTemporaryControl(this);
     148        this->player_ = this->owner_->getPlayer();
     149        this->owner_->getPlayer()->startTemporaryControl(this);
    149150
    150151        if( GameMode::isMaster() )
     
    174175        if( GameMode::isMaster() )
    175176        {
    176             if( this->getBDestroy() )
     177            if( this->bDestroy_ )
    177178                this->destroy();
    178179
     
    180181    }
    181182
    182     /* Calls the collidesAgainst function of BasicProjectile
    183      */
    184183    bool Rocket::collidesAgainst(WorldEntity* otherObject, btManifoldPoint& contactPoint)
    185184    {
    186         return BasicProjectile::basicCollidesAgainst(otherObject,contactPoint,this->getOwner(),this);
     185        if (!this->bDestroy_ && GameMode::isMaster())
     186        {
     187            if (otherObject == this->owner_)
     188                return false;
     189
     190            this->bDestroy_ = true;
     191
     192            if (this->owner_)
     193            {
     194                {
     195                    ParticleSpawner* effect = new ParticleSpawner(this->owner_->getCreator());
     196                    effect->setPosition(this->getPosition());
     197                    effect->setOrientation(this->getOrientation());
     198                    effect->setDestroyAfterLife(true);
     199                    effect->setSource("Orxonox/explosion4");
     200                    effect->setLifetime(2.0f);
     201                }
     202
     203                {
     204                    ParticleSpawner* effect = new ParticleSpawner(this->owner_->getCreator());
     205                    effect->setPosition(this->getPosition());
     206                    effect->setOrientation(this->getOrientation());
     207                    effect->setDestroyAfterLife(true);
     208                    effect->setSource("Orxonox/smoke4");
     209                    effect->setLifetime(3.0f);
     210                }
     211            }
     212
     213            Pawn* victim = orxonox_cast<Pawn*>(otherObject);
     214            if (victim)
     215                victim->hit(this->owner_, contactPoint, this->damage_);
     216//             this->destroy();
     217        }
     218        return false;
    187219    }
    188220
     
    201233    void Rocket::fired(unsigned int firemode)
    202234    {
    203         this->destroy();
     235//         if (this->owner_)
     236//         {
     237            this->destroy();
     238//         }
    204239    }
    205240
     
    207242    {
    208243        ParticleSpawner *effect1, *effect2;
    209         if( this->getOwner() )
    210         {
    211             effect1 = new ParticleSpawner(this->getOwner()->getCreator());
    212             effect2 = new ParticleSpawner(this->getOwner()->getCreator());
     244        if( this->owner_ )
     245        {
     246            effect1 = new ParticleSpawner(this->owner_->getCreator());
     247            effect2 = new ParticleSpawner(this->owner_->getCreator());
    213248        }
    214249        else
  • code/branches/presentation/src/modules/weapons/projectiles/Rocket.h

    r8578 r8579  
    2323 *      Oliver Scheuss
    2424 *   Co-authors:
    25  *      simonmie
     25 *      ...
    2626 *
    2727 */
     
    3434#include "tools/Timer.h"
    3535#include "worldentities/ControllableEntity.h"
    36 
    37 #include "BasicProjectile.h"
    3836
    3937namespace orxonox
     
    4846        Oli Scheuss
    4947    */
    50     class _WeaponsExport Rocket : public ControllableEntity, public BasicProjectile
     48    class _WeaponsExport Rocket : public ControllableEntity
    5149    {
    5250        public:
     
    111109                { return this->owner_; }
    112110
     111            inline void setDamage(float damage)
     112                { this->damage_ = damage; }
     113            inline float getDamage() const
     114                { return this->damage_; }
    113115            virtual void fired(unsigned int firemode);
    114116
     
    116118            WeakPtr<Pawn> owner_;
    117119            Vector3 localAngularVelocity_;
     120            float damage_;
     121            bool bDestroy_;
    118122
    119123            WeakPtr<PlayerInfo> player_;
  • code/branches/presentation/src/modules/weapons/projectiles/SimpleRocket.cc

    r8578 r8579  
    2323 *      Oliver Scheuss
    2424 *   Co-authors:
    25  *      simonmie
     25 *      ...
    2626 *
    2727 */
     
    4848    CreateFactory(SimpleRocket);
    4949
    50     SimpleRocket::SimpleRocket(BaseObject* creator) : ControllableEntity(creator), BasicProjectile()
     50    SimpleRocket::SimpleRocket(BaseObject* creator) : ControllableEntity(creator)
    5151    {
    5252        RegisterObject(SimpleRocket);// - register the SimpleRocket class to the core
    5353
    5454        this->localAngularVelocity_ = 0;
     55        this->bDestroy_ = false;
    5556        this->lifetime_ = 120;
    5657
    5758        this->setMass(15);
    58 //        COUT(4) << "simplerocket constructed\n";
     59        COUT(4) << "simplerocket constructed\n";
    5960
    6061        if (GameMode::isMaster())
     
    114115                this->disableFire();
    115116
    116             if( this->getBDestroy() )
     117            if( this->bDestroy_ )
    117118                this->destroy();
    118119        }
     
    158159    {
    159160        this->owner_ = owner;
    160         this->player_ = this->getOwner()->getPlayer();
    161     }
    162 
    163 
    164     /* Calls the collidesAgainst function of BasicProjectile
    165      */
     161        this->player_ = this->owner_->getPlayer();
     162    }
     163
     164
     165
     166
    166167    bool SimpleRocket::collidesAgainst(WorldEntity* otherObject, btManifoldPoint& contactPoint)
    167168    {
    168         return BasicProjectile::basicCollidesAgainst(otherObject,contactPoint,this->getOwner(),this);
     169        if (!this->bDestroy_ && GameMode::isMaster())
     170        {
     171            if (otherObject == this->owner_)
     172                return false;
     173
     174            this->bDestroy_ = true;
     175
     176            if (this->owner_)
     177            {
     178                {
     179                    ParticleSpawner* effect = new ParticleSpawner(this->owner_->getCreator());
     180                    effect->setPosition(this->getPosition());
     181                    effect->setOrientation(this->getOrientation());
     182                    effect->setDestroyAfterLife(true);
     183                    effect->setSource("Orxonox/explosion4");
     184                    effect->setLifetime(2.0f);
     185                }
     186
     187                {
     188                    ParticleSpawner* effect = new ParticleSpawner(this->owner_->getCreator());
     189                    effect->setPosition(this->getPosition());
     190                    effect->setOrientation(this->getOrientation());
     191                    effect->setDestroyAfterLife(true);
     192                    effect->setSource("Orxonox/smoke4");
     193                    effect->setLifetime(3.0f);
     194                }
     195            }
     196
     197            float dmg = this->damage_;
     198//             if (this->owner_)
     199//                 dmg = this->owner_->getPickups().processModifiers(ModifierType::Damage, dmg, false);
     200
     201            Pawn* victim = orxonox_cast<Pawn*>(otherObject);
     202            if (victim)
     203                victim->hit(this->owner_, contactPoint, dmg);
     204        }
     205        return false;
    169206    }
    170207
  • code/branches/presentation/src/modules/weapons/projectiles/SimpleRocket.h

    r8578 r8579  
    2323 *      Oliver Scheuss
    2424 *   Co-authors:
    25  *      simonmie
     25 *      ...
    2626 *
    2727 */
     
    3636#include "graphics/ParticleSpawner.h"
    3737
    38 #include "BasicProjectile.h"
    39 
    4038namespace orxonox
    4139{
     
    4846       Gabriel Nadler (Original file: Oli Scheuss)
    4947    */
    50     class _WeaponsExport SimpleRocket : public ControllableEntity, public BasicProjectile
     48    class _WeaponsExport SimpleRocket : public ControllableEntity
    5149    {
    5250        public:
     
    113111            inline Pawn* getOwner() const
    114112                { return this->owner_; }
    115 
    116113            inline bool hasFuel() const
    117114            { return this->fuel_; }
     115
     116            inline void setDamage(float damage)
     117                { this->damage_ = damage; }
     118            inline float getDamage() const
     119                { return this->damage_; }
    118120
    119121
     
    121123            WeakPtr<Pawn> owner_;
    122124            Vector3 localAngularVelocity_;
     125            float damage_;
     126            bool bDestroy_;
    123127            bool fuel_; //!< Bool is true while the rocket "has fuel"
    124128
Note: See TracChangeset for help on using the changeset viewer.