Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Dec 21, 2013, 11:16:54 PM (11 years ago)
Author:
jo
Message:

presentationHS13 branch merged into trunk

Location:
code/trunk
Files:
22 edited

Legend:

Unmodified
Added
Removed
  • code/trunk

  • code/trunk/src/orxonox/MoodManager.h

    r9667 r9939  
    5151
    5252        private:
    53             virtual void moodChanged(const std::string& mood) = 0;
     53            virtual bool moodChanged(const std::string& mood) = 0;
    5454
    5555            static void changedMood(const std::string& mood);
  • code/trunk/src/orxonox/controllers/NewHumanController.cc

    r9667 r9939  
    443443
    444444        if (pawn)
    445             pawn->setAimPosition( mouseRay.getOrigin() + mouseRay.getDirection() * 1200 );
     445            pawn->setAimPosition( mouseRay.getOrigin() + mouseRay.getDirection() * 3000 );
    446446
    447447        if( this->getControllableEntity() && this->getControllableEntity()->getTarget() != 0 )
  • code/trunk/src/orxonox/gamestates/GSMainMenu.cc

    r9667 r9939  
    8585    {
    8686        if (GameMode::playsSound())
    87             this->ambient_->destroy();
     87            this->ambient_->destroy(); //CHECK Thilo destroy ?preDestroy()? !!!!!!!
    8888
    8989        InputManager::getInstance().destroyState("MainMenuHackery");
  • code/trunk/src/orxonox/gametypes/Gametype.cc

    r9667 r9939  
    171171                    entity->setOrientation(oldentity->getWorldOrientation());
    172172                }
    173 
    174173                it->first->startControl(entity);
    175174            }
  • code/trunk/src/orxonox/graphics/ParticleEmitter.cc

    r9667 r9939  
    4545    RegisterClass(ParticleEmitter);
    4646
    47     ParticleEmitter::ParticleEmitter(Context* context) : StaticEntity(context)
     47    ParticleEmitter::ParticleEmitter(Context* context) : MovableEntity(context)
    4848    {
    4949        RegisterObject(ParticleEmitter);
  • code/trunk/src/orxonox/graphics/ParticleEmitter.h

    r9667 r9939  
    3333
    3434#include <string>
    35 #include "worldentities/StaticEntity.h"
     35#include "worldentities/MovableEntity.h"
    3636
    3737namespace orxonox
    3838{
    39     class _OrxonoxExport ParticleEmitter : public StaticEntity
     39    class _OrxonoxExport ParticleEmitter : public MovableEntity
    4040    {
    4141        public:
  • code/trunk/src/orxonox/infos/PlayerInfo.cc

    r9667 r9939  
    229229            return;
    230230
    231         this->controllableEntity_->getController()->setActive(false);
     231        Controller* tmp =this->controllableEntity_->getController();
     232        if (tmp == NULL)
     233        {
     234                orxout(verbose) <<  "PlayerInfo: pauseControl, Controller is NULL " << endl;
     235                return;
     236        }
     237        tmp->setActive(false);
    232238        //this->controllableEntity_->getController()->setControllableEntity(NULL);
    233239        this->controllableEntity_->setController(0);
  • code/trunk/src/orxonox/interfaces/RadarViewable.h

    r9667 r9939  
    6363        virtual void setRadarName(const std::string& name)
    6464            {
     65            // The following if-clause hides objects with radarname "HIDDEN"
     66                if (name == "HIDDEN")
     67                {
     68                    this->bVisibility_ = 0;
     69                    this->settingsChanged();
     70                }
    6571                if (this->radarName_ != name)
    6672                {
  • code/trunk/src/orxonox/items/MultiStateEngine.cc

    r9667 r9939  
    6161            this->defEngineSndNormal_->setLooping(true);
    6262            this->defEngineSndBoost_->setLooping(true);
     63            this->defEngineSndNormal_->setVolume(0.8f);
     64            this->defEngineSndBoost_->setVolume(0.5f);
    6365            this->lua_ = new LuaState();
    6466        }
  • code/trunk/src/orxonox/sound/AmbientSound.cc

    r8861 r9939  
    7979    }
    8080
    81     void AmbientSound::setAmbientSource(const std::string& source)
     81    bool AmbientSound::setAmbientSource(const std::string& source)
    8282    {
    8383        this->ambientSource_ = source;
    84         this->moodChanged(MoodManager::getInstance().getMood());
     84        return(this->moodChanged(MoodManager::getInstance().getMood()));
    8585    }
    8686
    87     void AmbientSound::moodChanged(const std::string& mood)
     87    bool AmbientSound::moodChanged(const std::string& mood)
    8888    {
    8989        if (GameMode::playsSound())
     
    9595                orxout(user_info) << "Loading ambient sound " << path << "..." << endl; // TODO: make this output internal if we implement sound streaming
    9696                this->setSource(path);
     97
     98                // all went fine
     99                return true;
    97100            }
    98101            else
    99102            {
    100103                orxout(internal_warning, context::sound) << this->ambientSource_ << ": Not a valid name! Ambient sound will not change." << endl;
     104
     105                // everything went southways
     106                return false;
    101107            }
    102108        }
     109        return false;
    103110    }
    104111
  • code/trunk/src/orxonox/sound/AmbientSound.h

    r7856 r9939  
    5454        void pause();
    5555
    56         void setAmbientSource(const std::string& source);
     56        bool setAmbientSource(const std::string& source);
    5757        inline const std::string& getAmbientSource() const
    5858            { return this->ambientSource_; }
     
    6868        void preDestroy();
    6969        float getRealVolume();
    70         void moodChanged(const std::string& mood);
     70        bool moodChanged(const std::string& mood);
    7171        inline void ambientSourceChanged()
    7272            { this->setAmbientSource(this->ambientSource_); }
  • code/trunk/src/orxonox/sound/BaseSound.cc

    r9667 r9939  
    4747    BaseSound::BaseSound()
    4848        : bPooling_(false)
    49         , volume_(1.0)
     49        , volume_(0.7)
    5050        , bLooping_(false)
    5151        , state_(Stopped)
  • code/trunk/src/orxonox/sound/SoundManager.cc

    r9667 r9939  
    218218            .description("Defines the overall volume.")
    219219            .callback(this, &SoundManager::checkSoundVolumeValidity);
    220         SetConfigValueAlias(volume_[SoundType::Music], "ambientVolume_", 1.0f)
     220        SetConfigValueAlias(volume_[SoundType::Music], "ambientVolume_", 0.7f)
    221221            .description("Defines the ambient volume.")
    222222            .callback(this, &SoundManager::checkAmbientVolumeValidity);
  • code/trunk/src/orxonox/sound/WorldAmbientSound.cc

    r9667 r9939  
    3333#include "core/XMLPort.h"
    3434#include "AmbientSound.h"
     35#include "core/command/ConsoleCommand.h"
     36#include <exception>
     37
    3538
    3639namespace orxonox
    3740{
     41        SetConsoleCommand("WorldAmbientSound", "nextsong",      &WorldAmbientSound::nextSong);
     42
    3843    RegisterClass(WorldAmbientSound);
    3944
     
    4449        this->ambientSound_ = new AmbientSound();
    4550        this->registerVariables();
     51        soundList_.push_back("Earth.ogg");
     52        soundList_.push_back("Jupiter.ogg");
     53        soundList_.push_back("Mars.ogg");
     54        soundList_.push_back("allgorythm-lift_up.ogg");
     55        soundList_.push_back("allgorythm-resonance_blaster.ogg");
     56        soundList_.push_back("AlphaCentauri.ogg");
     57        soundList_.push_back("Asteroid_rocks.ogg");
     58        soundList_.push_back("Ganymede.ogg");
     59        soundList_.push_back("luke_grey_-_hypermode.ogg");
     60
    4661    }
    47 
    4862    WorldAmbientSound::~WorldAmbientSound()
    4963    {
     
    5165        {
    5266            this->ambientSound_->destroy();
     67            WorldAmbientSound::soundList_.clear();
    5368        }
    5469    }
     
    94109            this->ambientSound_->stop();
    95110    }
     111
     112    void WorldAmbientSound::nextSong()
     113    {
     114
     115        //HACK: Assuption - there is only one WorldAmbientSound in a level and only one level is used.
     116        for (ObjectList<WorldAmbientSound>::iterator it = ObjectList<WorldAmbientSound>::begin();
     117             it != ObjectList<WorldAmbientSound>::end(); ++it)
     118        {
     119                while(it->ambientSound_->setAmbientSource(WorldAmbientSound::soundList_[WorldAmbientSound::soundNumber_]) == false){
     120                        WorldAmbientSound::soundNumber_ = (WorldAmbientSound::soundNumber_ + 1) % WorldAmbientSound::soundList_.size();
     121                }
     122                WorldAmbientSound::soundNumber_ = (WorldAmbientSound::soundNumber_ + 1) % WorldAmbientSound::soundList_.size();
     123        }
     124    }
    96125}
  • code/trunk/src/orxonox/sound/WorldAmbientSound.h

    r9667 r9939  
    3434#include "core/BaseObject.h"
    3535#include "network/synchronisable/Synchronisable.h"
     36#include <string>
     37#include <vector>
     38
    3639
    3740namespace orxonox
     
    5457            void play();
    5558
     59            //This function changes the current ambient song.
     60            //You can call nextSong() active in the level
     61            //by pressing the key 'M'.
     62            static void nextSong();
     63
    5664        private:
    5765            void registerVariables();
    5866
     67            //Vector with the diffrent available level sounds.
     68            //The sound names are pushed in the WorldAmbientSound-constructor.
     69            static std::vector<std::string> soundList_;
     70
     71            // This value will be initialized below, don't make this into
     72            // a const, since we want to change it in nextSong().
     73            static int soundNumber_;
     74
     75
    5976            AmbientSound* ambientSound_;
    6077    };
     78
     79    // This is an initialization for the soundnumber variable. Since it is
     80    // static, we have to initialize it this way.
     81    int WorldAmbientSound::soundNumber_ = 0;
     82    std::vector<std::string> WorldAmbientSound::soundList_;
     83
    6184}
    6285
  • code/trunk/src/orxonox/sound/WorldSound.cc

    r9667 r9939  
    8181            alSourcef(this->audioSource_, AL_REFERENCE_DISTANCE, refDist);
    8282            // TODO: 500 is very magical here. Derive something better
    83             alSourcef(this->audioSource_, AL_MAX_DISTANCE, refDist * 500);
     83            alSourcef(this->audioSource_, AL_MAX_DISTANCE, refDist * 20);
    8484        }
    8585        this->tick(0); // update position, orientation and velocity
  • code/trunk/src/orxonox/weaponsystem/WeaponMode.cc

    r9667 r9939  
    7979            this->defSndWpnFire_ = new WorldSound(this->getContext());
    8080            this->defSndWpnFire_->setLooping(false);
     81            this->defSndWpnFire_->setVolume(0.8f);
    8182            this->bSoundAttached_ = false;
    8283        }
  • code/trunk/src/orxonox/worldentities/BigExplosion.cc

    r9667 r9939  
    4343    RegisterClass(BigExplosion);
    4444
    45     BigExplosion::BigExplosion(Context* context) : StaticEntity(context)
     45    BigExplosion::BigExplosion(Context* context) : MobileEntity(context)
    4646    {
    4747        RegisterObject(BigExplosion);
     48
     49        if ( GameMode::showsGraphics() && ( !this->getScene() || !this->getScene()->getSceneManager() ) )
     50            ThrowException(AbortLoading, "Can't create BigExplosion, no scene or no scene manager given.");
     51
     52        this->bStop_ = false;
     53        this->LOD_ = LODParticle::Normal;
     54
     55        if ( GameMode::showsGraphics() )
     56        {
     57            try
     58            {
     59                this->init();
     60            }
     61            catch (const std::exception& ex)
     62            {
     63                orxout(internal_error) << "Couldn't load particle effect in BigExplosion: " << ex.what() << endl;
     64                this->initZero();
     65            }
     66        }
     67        else
     68        {
     69            this->initZero();
     70        }
     71
     72        if (GameMode::isMaster())
     73        {
     74            this->destroyTimer_.setTimer(rnd(2, 4), false, createExecutor(createFunctor(&BigExplosion::stop, this)));
     75        }
     76
     77        this->registerVariables();
     78    }
     79
     80    BigExplosion::BigExplosion(Context* context, Vector3 initVelocity) : MobileEntity(context)
     81    {
     82        RegisterObject(BigExplosion);
     83        this->setVelocity(initVelocity);
    4884
    4985        if ( GameMode::showsGraphics() && ( !this->getScene() || !this->getScene()->getSceneManager() ) )
     
    100136        this->debris4_->setSyncMode(0);
    101137
    102         this->explosion_ = new StaticEntity(this->getContext());
     138        this->explosion_ = new MobileEntity(this->getContext());
    103139        this->explosion_->setSyncMode(0);
    104140
     
    148184        this->debrisEntity4_->attach(debris4_);
    149185
     186        // ///////////////////////
     187        // TODO: particleSpawner is a static entity. It should probably be dynamic, for better explosions.
     188        //
    150189        ParticleSpawner* effect = new ParticleSpawner(this->getContext());
     190        orxout() << "vel " << this->getVelocity() << endl;
     191        // effect->setVelocity(this->getVelocity());
    151192        effect->setDestroyAfterLife(true);
    152193        effect->setSource("Orxonox/explosion2b");
     
    155196
    156197        ParticleSpawner* effect2 = new ParticleSpawner(this->getContext());
     198        // effect2->setVelocity(Vector3(rnd(-1, 1), rnd(-1, 1), rnd(-1, 1))*rnd(10, 200));
    157199        effect2->setDestroyAfterLife(true);
    158200        effect2->setSource("Orxonox/smoke6");
  • code/trunk/src/orxonox/worldentities/BigExplosion.h

    r9667 r9939  
    2222 *   Author:
    2323 *      Benjamin de Capitani
    24  *   Co-authors:
     24 *   Co-authors:§
    2525 *      ...
    2626 *
     
    3333
    3434#include "tools/Timer.h"
    35 #include "StaticEntity.h"
     35#include "MobileEntity.h"
    3636
    3737namespace orxonox
    3838{
    39     class _OrxonoxExport BigExplosion : public StaticEntity
     39    class _OrxonoxExport BigExplosion : public MobileEntity
    4040    {
    4141        public:
    4242            BigExplosion(Context* context);
     43            BigExplosion(Context* context, Vector3 initVelocity);
    4344            virtual ~BigExplosion();
    4445
     
    6061            bool                  bStop_;
    6162
    62             StaticEntity*         explosion_;
     63            MobileEntity*         explosion_;
    6364
    6465            MovableEntity*        debrisEntity1_;
  • code/trunk/src/orxonox/worldentities/pawns/Pawn.cc

    r9667 r9939  
    4646#include "weaponsystem/WeaponPack.h"
    4747#include "weaponsystem/WeaponSet.h"
     48#include "sound/WorldSound.h"
    4849
    4950#include "controllers/FormationController.h"
     
    100101
    101102        this->setSyncMode(ObjectDirection::Bidirectional); // needed to synchronise e.g. aimposition
     103
     104        if (GameMode::isMaster())
     105        {
     106            this->explosionSound_ = new WorldSound(this->getContext());
     107            this->explosionSound_->setVolume(1.0f);
     108        }
     109        else
     110        {
     111            this->explosionSound_ = 0;
     112        }
    102113    }
    103114
     
    109120                this->weaponSystem_->destroy();
    110121        }
     122
    111123    }
    112124
     
    135147        XMLPortParam(Pawn, "reloadwaittime", setReloadWaitTime, getReloadWaitTime, xmlelement, mode).defaultValues(1.0f);
    136148
     149        XMLPortParam(Pawn, "explosionSound",  setExplosionSound,  getExplosionSound,  xmlelement, mode);
     150
    137151        XMLPortParam ( RadarViewable, "radarname", setRadarName, getRadarName, xmlelement, mode );
    138152    }
     153
    139154
    140155    void Pawn::registerVariables()
     
    290305    void Pawn::kill()
    291306    {
    292         this->damage(this->health_);
     307        this->damage(this->health_);
    293308        this->death();
    294309    }
     
    314329        if (this->getGametype() && this->getGametype()->allowPawnDeath(this, this->lastHitOriginator_))
    315330        {
    316             // Set bAlive_ to false and wait for PawnManager to do the destruction
     331            explosionSound_->play();
     332                // Set bAlive_ to false and wait for PawnManager to do the destruction
    317333            this->bAlive_ = false;
    318334
     
    365381        this->setDestroyWhenPlayerLeft(false);
    366382
    367         BigExplosion* chunk = new BigExplosion(this->getContext());
     383        orxout() << "big explosion: " << this->getVelocity() << endl;
     384        BigExplosion* chunk = new BigExplosion(this->getContext(), this->getVelocity());
    368385        chunk->setPosition(this->getPosition());
     386        // chunk->setVelocity(this->getVelocity());
    369387
    370388    }
     
    376394            effect->setPosition(this->getPosition());
    377395            effect->setOrientation(this->getOrientation());
     396            effect->setVelocity(this->getVelocity());
    378397            effect->setDestroyAfterLife(true);
    379398            effect->setSource("Orxonox/explosion2b");
     
    384403            effect->setPosition(this->getPosition());
    385404            effect->setOrientation(this->getOrientation());
     405            effect->setVelocity(this->getVelocity());
    386406            effect->setDestroyAfterLife(true);
    387407            effect->setSource("Orxonox/smoke6");
     
    392412            effect->setPosition(this->getPosition());
    393413            effect->setOrientation(this->getOrientation());
     414            effect->setVelocity(this->getVelocity());
    394415            effect->setDestroyAfterLife(true);
    395416            effect->setSource("Orxonox/sparks");
     
    527548
    528549
     550    void Pawn::setExplosionSound(const std::string &explosionSound)
     551    {
     552        if(explosionSound_ )
     553            explosionSound_->setSource(explosionSound);
     554        else
     555            assert(0); // This should never happen, because soundpointer is only available on master
     556    }
     557
     558    const std::string& Pawn::getExplosionSound()
     559    {
     560        if( explosionSound_ )
     561            return explosionSound_->getSource();
     562        else
     563            assert(0);
     564        return BLANKSTRING;
     565    }
     566
    529567
    530568}
  • code/trunk/src/orxonox/worldentities/pawns/Pawn.h

    r9667 r9939  
    3636#include "interfaces/RadarViewable.h"
    3737#include "worldentities/ControllableEntity.h"
     38
    3839
    3940namespace orxonox // tolua_export
     
    178179            virtual void changedVisibility();
    179180
     181            void setExplosionSound(const std::string& engineSound);
     182            const std::string& getExplosionSound();
     183
    180184        protected:
    181185            virtual void preDestroy();
     
    231235
    232236            Vector3 aimPosition_;
     237
     238            WorldSound* explosionSound_;
     239
    233240    }; // tolua_export
    234241} // tolua_export
Note: See TracChangeset for help on using the changeset viewer.