Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jul 12, 2010, 2:06:15 PM (14 years ago)
Author:
scheusso
Message:

some rocket related fixes

Location:
code/branches/presentation3/src
Files:
4 edited

Legend:

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

    r7127 r7154  
    4141#include "controllers/Controller.h"
    4242#include "sound/WorldSound.h"
     43#include "Scene.h"
    4344
    4445namespace orxonox
     
    116117        if(this->isInitialized())
    117118        {
    118             if (GameMode::isMaster() && this->player_)
    119                 this->player_->stopTemporaryControl();
     119            if (GameMode::isMaster())
     120            {
     121                this->destructionEffect();
     122
     123                if (this->getPlayer() && this->getController())
     124                    this->player_->stopTemporaryControl();
     125            }
    120126
    121127            if ( this->defSndWpnEngine_ )
     
    140146    {
    141147        this->owner_ = owner;
    142         this->originalControllableEntity_ = this->owner_->getPlayer()->getControllableEntity();
    143148        this->player_ = this->owner_->getPlayer();
    144149        this->owner_->getPlayer()->startTemporaryControl(this);
     
    228233    void Rocket::fired(unsigned int firemode)
    229234    {
    230         if (this->owner_)
    231         {
    232             {
    233                 ParticleSpawner* effect = new ParticleSpawner(this->owner_->getCreator());
    234                 effect->setPosition(this->getPosition());
    235                 effect->setOrientation(this->getOrientation());
    236                 effect->setDestroyAfterLife(true);
    237                 effect->setSource("Orxonox/explosion4");
    238                 effect->setLifetime(2.0f);
    239             }
    240 
    241             {
    242                 ParticleSpawner* effect = new ParticleSpawner(this->owner_->getCreator());
    243                 effect->setPosition(this->getPosition());
    244                 effect->setOrientation(this->getOrientation());
    245                 effect->setDestroyAfterLife(true);
    246                 effect->setSource("Orxonox/smoke4");
    247                 effect->setLifetime(3.0f);
    248             }
     235//         if (this->owner_)
     236//         {
    249237            this->destroy();
    250         }
     238//         }
     239    }
     240   
     241    void Rocket::destructionEffect()
     242    {
     243        ParticleSpawner *effect1, *effect2;
     244        if( this->owner_ )
     245        {
     246            effect1 = new ParticleSpawner(this->owner_->getCreator());
     247            effect2 = new ParticleSpawner(this->owner_->getCreator());
     248        }
     249        else
     250        {
     251            effect1 = new ParticleSpawner(static_cast<BaseObject*>(this->getScene().get()));
     252            effect2 = new ParticleSpawner(static_cast<BaseObject*>(this->getScene().get()));
     253        }
     254       
     255        effect1->setPosition(this->getPosition());
     256        effect1->setOrientation(this->getOrientation());
     257        effect1->setDestroyAfterLife(true);
     258        effect1->setSource("Orxonox/explosion4");
     259        effect1->setLifetime(2.0f);
     260       
     261        effect2->setPosition(this->getPosition());
     262        effect2->setOrientation(this->getOrientation());
     263        effect2->setDestroyAfterLife(true);
     264        effect2->setSource("Orxonox/smoke4");
     265        effect2->setLifetime(3.0f);
    251266    }
    252267
  • code/branches/presentation3/src/modules/weapons/projectiles/Rocket.h

    r6417 r7154  
    5757            virtual bool collidesAgainst(WorldEntity* otherObject, btManifoldPoint& contactPoint);
    5858            void destroyObject();
     59            void destructionEffect();
    5960
    6061            virtual void moveFrontBack(const Vector2& value){}
     
    119120            float damage_;
    120121            bool bDestroy_;
    121             ControllableEntity* originalControllableEntity_;
    122122
    123123            WeakPtr<PlayerInfo> player_;
  • code/branches/presentation3/src/modules/weapons/weaponmodes/RocketFire.cc

    r7153 r7154  
    6666        rocket->setOrientation(this->getMuzzleOrientation());
    6767        rocket->setPosition(this->getMuzzlePosition());
    68 //         rocket->setVelocity(this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn()->getVelocity() + this->getMuzzleDirection() * this->speed_);
    69         rocket->setVelocity(Vector3(1,0,0));
     68        rocket->setVelocity(this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn()->getVelocity() + this->getMuzzleDirection() * this->speed_);
    7069        rocket->scale(2);
    7170
  • code/branches/presentation3/src/orxonox/infos/PlayerInfo.cc

    r6417 r7154  
    177177            return;
    178178
    179 //         assert( this->temporaryControllableEntity_==0 );
     179        assert( this->oldControllableEntity_==0 );
    180180
    181181        this->oldControllableEntity_ = this->controllableEntity_;
     
    184184
    185185        entity->setPlayer(this);
     186        entity->setController(this->controller_);
    186187
    187188        if (this->controller_)
     
    222223            return;
    223224
     225        this->controllableEntity_->setController(0);
     226       
    224227        this->controllableEntity_ = this->oldControllableEntity_;
    225228        this->controllableEntityID_ = this->controllableEntity_->getObjectID();
Note: See TracChangeset for help on using the changeset viewer.