Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 1859 for code


Ignore:
Timestamp:
Sep 30, 2008, 4:25:16 PM (16 years ago)
Author:
rgrieder
Message:

Disabled all spaceship effects per default.

Location:
code/branches/orxonox_tutorial/src/orxonox/objects
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • code/branches/orxonox_tutorial/src/orxonox/objects/SpaceShip.cc

    r1855 r1859  
    205205    void SpaceShip::init()
    206206    {
    207         if (Settings::showsGraphics())
     207        if (this->hasSpecialEffects())
    208208        {
    209209            // START CREATING THRUSTERS
     
    258258
    259259            // START CREATING ADDITIONAL EFFECTS
    260             if (this->hasSpecialEffects())
    261             {
    262                 this->backlight_ = new Backlight(this->maxSpeed_, 0.8);
    263                 this->attachObject(this->backlight_);
    264                 this->backlight_->setPosition(-2.35, 0, 0.2);
    265                 this->backlight_->setColour(this->getProjectileColour());
    266 
    267                 this->smoke_ = new ParticleSpawner();
    268                 this->smoke_->setParticle("Orxonox/smoke5", LODParticle::normal, 0, 0, 3);
    269                 this->attachObject(this->smoke_);
    270 
    271                 this->fire_ = new ParticleSpawner();
    272                 this->fire_->setParticle("Orxonox/fire3", LODParticle::normal, 0, 0, 1);
    273                 this->attachObject(this->fire_);
    274             }
     260            this->backlight_ = new Backlight(this->maxSpeed_, 0.8);
     261            this->attachObject(this->backlight_);
     262            this->backlight_->setPosition(-2.35, 0, 0.2);
     263            this->backlight_->setColour(this->getProjectileColour());
     264
     265            this->smoke_ = new ParticleSpawner();
     266            this->smoke_->setParticle("Orxonox/smoke5", LODParticle::normal, 0, 0, 3);
     267            this->attachObject(this->smoke_);
     268
     269            this->fire_ = new ParticleSpawner();
     270            this->fire_->setParticle("Orxonox/fire3", LODParticle::normal, 0, 0, 1);
     271            this->attachObject(this->fire_);
    275272            // END CREATING ADDITIONAL EFFECTS
    276 
    277             if (!this->isExactlyA(Class(SpaceShipAI)))
    278             {
    279                 // START of testing crosshair
    280                 this->crosshairNear_.setBillboardSet("Orxonox/Crosshair", ColourValue(1.0, 1.0, 0.0), 1);
    281                 this->crosshairFar_.setBillboardSet("Orxonox/Crosshair", ColourValue(1.0, 1.0, 0.0), 1);
    282 
    283                 this->chNearNode_ = this->getNode()->createChildSceneNode(this->getName() + "near", Vector3(50.0, 0.0, 0.0));
    284                 this->chNearNode_->setInheritScale(false);
    285                 this->chFarNode_ = this->getNode()->createChildSceneNode(this->getName() + "far", Vector3(200.0, 0.0, 0.0));
    286                 this->chFarNode_->setInheritScale(false);
    287 
    288                 this->chNearNode_->attachObject(this->crosshairNear_.getBillboardSet());
    289                 this->chNearNode_->setScale(0.2, 0.2, 0.2);
    290 
    291                 this->chFarNode_->attachObject(this->crosshairFar_.getBillboardSet());
    292                 this->chFarNode_->setScale(0.4, 0.4, 0.4);
    293                 // END of testing crosshair
    294             }
    295         }
    296         // END of testing crosshair
     273        }
     274
     275        if (!this->isExactlyA(Class(SpaceShipAI)))
     276        {
     277            // START of testing crosshair
     278            this->crosshairNear_.setBillboardSet("Orxonox/Crosshair", ColourValue(1.0, 1.0, 0.0), 1);
     279            this->crosshairFar_.setBillboardSet("Orxonox/Crosshair", ColourValue(1.0, 1.0, 0.0), 1);
     280
     281            this->chNearNode_ = this->getNode()->createChildSceneNode(this->getName() + "near", Vector3(50.0, 0.0, 0.0));
     282            this->chNearNode_->setInheritScale(false);
     283            this->chFarNode_ = this->getNode()->createChildSceneNode(this->getName() + "far", Vector3(200.0, 0.0, 0.0));
     284            this->chFarNode_->setInheritScale(false);
     285
     286            this->chNearNode_->attachObject(this->crosshairNear_.getBillboardSet());
     287            this->chNearNode_->setScale(0.2, 0.2, 0.2);
     288
     289            this->chFarNode_->attachObject(this->crosshairFar_.getBillboardSet());
     290            this->chFarNode_->setScale(0.4, 0.4, 0.4);
     291            // END of testing crosshair
     292        }
    297293
    298294        createCamera();
     
    311307        SUPER(SpaceShip, changedVisibility);
    312308
    313         this->tt1_->setEnabled(this->isVisible());
    314         this->tt2_->setEnabled(this->isVisible());
    315         this->redBillboard_.setVisible(this->isVisible());
    316         this->greenBillboard_.setVisible(this->isVisible());
     309        if (this->hasSpecialEffects())
     310        {
     311            this->tt1_->setEnabled(this->isVisible());
     312            this->tt2_->setEnabled(this->isVisible());
     313            this->redBillboard_.setVisible(this->isVisible());
     314            this->greenBillboard_.setVisible(this->isVisible());
     315            this->rightThrusterFlare_.setVisible(this->isVisible());
     316            this->leftThrusterFlare_.setVisible(this->isVisible());
     317            this->smoke_->setVisible(this->isVisible());
     318            this->fire_->setVisible(this->isVisible());
     319            this->backlight_->setVisible(this->isVisible());
     320        }
    317321        this->crosshairNear_.setVisible(this->isVisible());
    318322        this->crosshairFar_.setVisible(this->isVisible());
    319         this->rightThrusterFlare_.setVisible(this->isVisible());
    320         this->leftThrusterFlare_.setVisible(this->isVisible());
    321         this->smoke_->setVisible(this->isVisible());
    322         this->fire_->setVisible(this->isVisible());
    323         this->backlight_->setVisible(this->isVisible());
    324323    }
    325324
     
    328327        SUPER(SpaceShip, changedActivity);
    329328
    330         this->tt1_->setEnabled(this->isVisible());
    331         this->tt2_->setEnabled(this->isVisible());
    332         this->redBillboard_.setVisible(this->isVisible());
    333         this->greenBillboard_.setVisible(this->isVisible());
     329        if (this->hasSpecialEffects())
     330        {
     331            this->tt1_->setEnabled(this->isVisible());
     332            this->tt2_->setEnabled(this->isVisible());
     333            this->redBillboard_.setVisible(this->isVisible());
     334            this->greenBillboard_.setVisible(this->isVisible());
     335            this->rightThrusterFlare_.setVisible(this->isVisible());
     336            this->leftThrusterFlare_.setVisible(this->isVisible());
     337        }
    334338        this->crosshairNear_.setVisible(this->isVisible());
    335339        this->crosshairFar_.setVisible(this->isVisible());
    336         this->rightThrusterFlare_.setVisible(this->isVisible());
    337         this->leftThrusterFlare_.setVisible(this->isVisible());
    338340    }
    339341
     
    445447            this->cam_->tick(dt);
    446448
    447         if (Settings::showsGraphics())
     449        if (this->hasSpecialEffects())
    448450        {
    449451            if (this->smoke_)
     
    565567            this->yaw(Radian(this->mouseYRotation_ * dt));
    566568
    567         if (this->acceleration_.x > 0)
    568         {
    569             this->tt1_->setEnabled(true);
    570             this->tt2_->setEnabled(true);
    571         }
    572         else
    573         {
    574             this->tt1_->setEnabled(false);
    575             this->tt2_->setEnabled(false);
     569        if (this->hasSpecialEffects())
     570        {
     571            if (this->acceleration_.x > 0)
     572            {
     573                this->tt1_->setEnabled(true);
     574                this->tt2_->setEnabled(true);
     575            }
     576            else
     577            {
     578                this->tt1_->setEnabled(false);
     579                this->tt2_->setEnabled(false);
     580            }
    576581        }
    577582
  • code/branches/orxonox_tutorial/src/orxonox/objects/SpaceShip.h

    r1855 r1859  
    100100           
    101101            virtual float getReloadTime() { return this->reloadTime_; }
    102             virtual bool hasSpecialEffects() { return false; }
     102            virtual bool hasSpecialEffects() { return true; }
    103103
    104104            inline const Vector3& getDir() const
  • code/branches/orxonox_tutorial/src/orxonox/objects/TutorialShip.cc

    r1857 r1859  
    33 *                    > www.orxonox.net <
    44 *
    5  *
    6  *   License notice:
    7  *
    8  *   This program is free software; you can redistribute it and/or
    9  *   modify it under the terms of the GNU General Public License
    10  *   as published by the Free Software Foundation; either version 2
    11  *   of the License, or (at your option) any later version.
    12  *
    13  *   This program is distributed in the hope that it will be useful,
    14  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
    15  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    16  *   GNU General Public License for more details.
    17  *
    18  *   You should have received a copy of the GNU General Public License
    19  *   along with this program; if not, write to the Free Software
    20  *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
    21  *
    22  *   Author:
    23  *      Oliver 'greenman' Scheuss, Reto '1337' Grieder
    24  *   Co-authors:
    25  *      ...
    26  *
     5 *                         TUTORIAL
    276 */
    287
     
    3615#include "util/Convert.h"
    3716#include "util/Debug.h"
    38 #include "util/Math.h"
    3917#include "core/ConfigValueIncludes.h"
    4018#include "core/ConsoleCommand.h"
     
    9068        // are loaded too.
    9169        SUPER(TutorialShip, XMLPort, xmlelement, mode);
     70
     71        // Display a message in shell/logfile/console
     72        COUT(3) << "TutorialShip was loaded." << std::endl;
    9273    }
    9374
     
    10586    }
    10687
    107     // virtual function used by back end class SpaceShip.
    108     float TutorialShip::getReloadTime()
    109     {
    110         return this->reloadTime_;
    111     }
     88    /*** NOT SO IMPORTATANT... ***/
    11289
    11390    // run time update method. Gets called every frame with the delta time that
     
    11996    }
    12097
     98    // virtual function used by back end class SpaceShip.
     99    float TutorialShip::getReloadTime()
     100    {
     101        return this->reloadTime_;
     102    }
     103
    121104    // Fire a projectile. Delegated to the back end class SpaceShip.
    122105    // Function content is insignificant for the tutorial.
Note: See TracChangeset for help on using the changeset viewer.