Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 6315 for code


Ignore:
Timestamp:
Dec 10, 2009, 8:56:48 PM (15 years ago)
Author:
scheusso
Message:

fixed rocket on client (uninitialised values)

File:
1 edited

Legend:

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

    r6313 r6315  
    5555
    5656        this->localAngularVelocity_ = 0;
     57        this->bDestroy_ = false;
     58        this->lifetime_ = 100;
    5759       
    5860        if (GameMode::isMaster())
     
    6062            this->setCollisionType(WorldEntity::Kinematic);
    6163            this->setVelocity(0,0,-100);
    62             this->lifetime_ = 100;
    63             this->bDestroy_ = false;
    6464       
    6565            Model* model = new Model(this);
     
    8282
    8383            this->destroyTimer_.setTimer(this->lifetime_, false, createExecutor(createFunctor(&Rocket::destroyObject, this)));
     84           
     85            this->defSndWpnEngine_ = new WorldSound(this);
     86            this->defSndWpnEngine_->setLooping(true);
     87            this->defSndWpnEngine_->setSource("sounds/Rocket_engine.ogg");
     88            this->attach(defSndWpnEngine_);
     89
     90            this->defSndWpnLaunch_ = new WorldSound(this);
     91            this->defSndWpnLaunch_->setLooping(false);
     92            this->defSndWpnLaunch_->setSource("sounds/Rocket_launch.ogg");
     93            this->attach(defSndWpnLaunch_);
     94        }
     95        else
     96        {
     97            this->defSndWpnEngine_ = 0;
     98            this->defSndWpnLaunch_ = 0;
    8499        }
    85100       
     
    88103        camPosition->setAllowMouseLook(true);
    89104        this->addCameraPosition(camPosition);
    90 
    91         if( GameMode::isMaster() )
    92         {
    93             this->defSndWpnEngine_ = new WorldSound(this);
    94             this->defSndWpnEngine_->setLooping(true);
    95             this->defSndWpnEngine_->setSource("sounds/Rocket_engine.ogg");
    96             this->attach(defSndWpnEngine_);
    97 
    98             this->defSndWpnLaunch_ = new WorldSound(this);
    99             this->defSndWpnLaunch_->setLooping(false);
    100             this->defSndWpnLaunch_->setSource("sounds/Rocket_launch.ogg");
    101             this->attach(defSndWpnLaunch_);
    102         }
    103         else
    104         {
    105             this->defSndWpnEngine_ = 0;
    106             this->defSndWpnLaunch_ = 0;
    107         }
    108105    }
    109106
     
    120117                this->player_->stopTemporaryControl();
    121118            }
    122             if(this->defSndWpnEngine_->isPlaying())
    123             {
    124                 this->defSndWpnEngine_->stop();
    125             }
    126             if(this->defSndWpnLaunch_->isPlaying())
    127             {
    128                 this->defSndWpnLaunch_->stop();
    129             }
    130             delete this->defSndWpnEngine_;
    131             delete this->defSndWpnLaunch_;
     119            if ( this->defSndWpnEngine_ )
     120            {
     121                if ( this->defSndWpnEngine_->isPlaying() )
     122                    this->defSndWpnEngine_->stop();
     123                delete this->defSndWpnEngine_;
     124            }
     125            if ( this->defSndWpnLaunch_ )
     126            {
     127                if ( this->defSndWpnLaunch_->isPlaying())
     128                    this->defSndWpnLaunch_->stop();
     129                delete this->defSndWpnLaunch_;
     130            }
    132131        }
    133132    }
     
    150149        this->owner_->getPlayer()->startTemporaryControl(this);
    151150
    152         this->defSndWpnEngine_->play();
    153         this->defSndWpnLaunch_->play();
     151        if( GameMode::isMaster() )
     152        {
     153            this->defSndWpnEngine_->play();
     154            this->defSndWpnLaunch_->play();
     155        }
    154156    }
    155157
Note: See TracChangeset for help on using the changeset viewer.