Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
May 18, 2006, 4:25:18 PM (19 years ago)
Author:
amaechler
Message:

branches/atmospheric_engine: bug fixes and cleanup

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/atmospheric_engine/src/lib/graphics/effects/rain_effect.cc

    r7691 r7696  
    2424#include "spark_particles.h"
    2525#include "plane_emitter.h"
     26#include "shell_command.h"
    2627
    2728#include "parser/tinyxml/tinyxml.h"
    2829
    29 //SHELL_COMMAND(activate, RainEffect, activateRain);
    30 //SHELL_COMMAND(deactivate, RainEffect, deactivateRain);
     30SHELL_COMMAND(activate, RainEffect, activateRain);
     31SHELL_COMMAND(deactivate, RainEffect, deactivateRain);
    3132
    3233using namespace std;
     
    4344                this->loadParams(root);
    4445
    45         //load sound
     46        //load rain sound
    4647        if (this->rainBuffer != NULL)
    4748                ResourceManager::getInstance()->unload(this->rainBuffer);
    4849        this->rainBuffer = (SoundBuffer*)ResourceManager::getInstance()->load("sound/rain.wav", WAV);
     50
     51        //load wind sound
     52        if (this->rainWindForce > 0) {
     53                if (this->windBuffer != NULL)
     54                        ResourceManager::getInstance()->unload(this->windBuffer);
     55                this->windBuffer = (SoundBuffer*)ResourceManager::getInstance()->load("sound/wind.wav", WAV);
     56        }
    4957
    5058        this->activate();
     
    5462{
    5563        this->deactivate();
     64
     65        if (this->rainBuffer != NULL)
     66                ResourceManager::getInstance()->unload(this->rainBuffer);
     67
     68        if (this->windBuffer != NULL)
     69                ResourceManager::getInstance()->unload(this->windBuffer);
    5670}
    5771
     
    114128
    115129        this->emitter->setSpread(this->rainWindForce / 50, 0.2);
    116 
     130       
    117131        this->soundSource.loop(this->rainBuffer);
    118         PRINTF(0)( "Playing RainSound\n" );
     132        if (this->rainWindForce > 0)
     133                this->soundSource.loop(this->windBuffer);
    119134}
    120135
     
    123138{
    124139        PRINTF(0)("Deactivating RainEffect\n");
     140        this->emitter->setSystem(NULL);
    125141
    126         this->emitter->setSystem(NULL);
     142        this->soundSource.stop();
    127143}
     144
     145void RainEffect::activateRain()
     146{
     147        this->activate();
     148}
     149
     150void RainEffect::deactivateRain()
     151{
     152        this->deactivate();
     153}
     154
    128155
    129156void RainEffect::tick (float dt)
Note: See TracChangeset for help on using the changeset viewer.