Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

Merging game immersion branch into presentation branch.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/presentation/src/modules/weapons/projectiles/Rocket.cc

    r7848 r8578  
    2323 *      Oliver Scheuss
    2424 *   Co-authors:
    25  *      ...
     25 *      simonmie
    2626 *
    2727 */
     
    5252        Constructor. Registers the object and initializes some default values.
    5353    */
    54     Rocket::Rocket(BaseObject* creator) : ControllableEntity(creator)
     54    Rocket::Rocket(BaseObject* creator) : ControllableEntity(creator), BasicProjectile()
    5555    {
    5656        RegisterObject(Rocket);// - register the Rocket class to the core
    5757
    5858        this->localAngularVelocity_ = 0;
    59         this->bDestroy_ = false;
    6059        this->lifetime_ = 100;
    6160
     
    146145    {
    147146        this->owner_ = owner;
    148         this->player_ = this->owner_->getPlayer();
    149         this->owner_->getPlayer()->startTemporaryControl(this);
     147        this->player_ = this->getOwner()->getPlayer();
     148        this->getOwner()->getPlayer()->startTemporaryControl(this);
    150149
    151150        if( GameMode::isMaster() )
     
    175174        if( GameMode::isMaster() )
    176175        {
    177             if( this->bDestroy_ )
     176            if( this->getBDestroy() )
    178177                this->destroy();
    179178
     
    181180    }
    182181
     182    /* Calls the collidesAgainst function of BasicProjectile
     183     */
    183184    bool Rocket::collidesAgainst(WorldEntity* otherObject, btManifoldPoint& contactPoint)
    184185    {
    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;
     186        return BasicProjectile::basicCollidesAgainst(otherObject,contactPoint,this->getOwner(),this);
    219187    }
    220188
     
    233201    void Rocket::fired(unsigned int firemode)
    234202    {
    235 //         if (this->owner_)
    236 //         {
    237             this->destroy();
    238 //         }
     203        this->destroy();
    239204    }
    240205
     
    242207    {
    243208        ParticleSpawner *effect1, *effect2;
    244         if( this->owner_ )
    245         {
    246             effect1 = new ParticleSpawner(this->owner_->getCreator());
    247             effect2 = new ParticleSpawner(this->owner_->getCreator());
     209        if( this->getOwner() )
     210        {
     211            effect1 = new ParticleSpawner(this->getOwner()->getCreator());
     212            effect2 = new ParticleSpawner(this->getOwner()->getCreator());
    248213        }
    249214        else
Note: See TracChangeset for help on using the changeset viewer.