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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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
Note: See TracChangeset for help on using the changeset viewer.