[Orxonox-commit 1602] r6320 - in code/branches/presentation2/src: libraries/util orxonox/controllers orxonox/sound

scheusso at orxonox.net scheusso at orxonox.net
Fri Dec 11 02:05:01 CET 2009


Author: scheusso
Date: 2009-12-11 02:05:00 +0100 (Fri, 11 Dec 2009)
New Revision: 6320

Modified:
   code/branches/presentation2/src/libraries/util/Serialise.h
   code/branches/presentation2/src/orxonox/controllers/NewHumanController.cc
   code/branches/presentation2/src/orxonox/sound/AmbientSound.cc
   code/branches/presentation2/src/orxonox/sound/BaseSound.cc
   code/branches/presentation2/src/orxonox/sound/BaseSound.h
   code/branches/presentation2/src/orxonox/sound/WorldSound.cc
Log:
various fixes for client: NHC, sound, callback handling of Vector4 & Quaternion

Modified: code/branches/presentation2/src/libraries/util/Serialise.h
===================================================================
--- code/branches/presentation2/src/libraries/util/Serialise.h	2009-12-10 23:04:21 UTC (rev 6319)
+++ code/branches/presentation2/src/libraries/util/Serialise.h	2009-12-11 01:05:00 UTC (rev 6320)
@@ -548,7 +548,7 @@
     {
         return checkEquality(variable.w, mem) && checkEquality(variable.x, mem+returnSize(variable.w)) &&
             checkEquality(variable.y, mem+returnSize(variable.w)+returnSize(variable.x)) &&
-            checkEquality(variable.y, mem+returnSize(variable.w)+returnSize(variable.x)+returnSize(variable.y));
+            checkEquality(variable.z, mem+returnSize(variable.w)+returnSize(variable.x)+returnSize(variable.y));
     }
     
     // =========== Quaternion
@@ -578,7 +578,7 @@
     {
         return checkEquality(variable.w, mem) && checkEquality(variable.x, mem+returnSize(variable.w)) &&
             checkEquality(variable.y, mem+returnSize(variable.w)+returnSize(variable.x)) &&
-            checkEquality(variable.y, mem+returnSize(variable.w)+returnSize(variable.x)+returnSize(variable.y));
+            checkEquality(variable.z, mem+returnSize(variable.w)+returnSize(variable.x)+returnSize(variable.y));
     }
     
     // =========== ColourValue

Modified: code/branches/presentation2/src/orxonox/controllers/NewHumanController.cc
===================================================================
--- code/branches/presentation2/src/orxonox/controllers/NewHumanController.cc	2009-12-10 23:04:21 UTC (rev 6319)
+++ code/branches/presentation2/src/orxonox/controllers/NewHumanController.cc	2009-12-11 01:05:00 UTC (rev 6320)
@@ -61,6 +61,15 @@
         : HumanController(creator)
         , crossHairOverlay_(NULL)
         , centerOverlay_(NULL)
+        , arrowsOverlay1_(NULL)
+        , arrowsOverlay2_(NULL)
+        , arrowsOverlay3_(NULL)
+        , arrowsOverlay4_(NULL)
+        , damageOverlayTop_(NULL)
+        , damageOverlayRight_(NULL)
+        , damageOverlayBottom_(NULL)
+        , damageOverlayLeft_(NULL)
+        , damageOverlayTT_(0)
     {
         RegisterObject(NewHumanController);
 
@@ -559,6 +568,8 @@
     }
 
     void NewHumanController::showOverlays() {
+        if( !GameMode::showsGraphics() )
+            return;
         this->crossHairOverlay_->show();
         this->centerOverlay_->show();
 
@@ -571,6 +582,8 @@
     }
 
     void NewHumanController::hideOverlays() {
+        if( !GameMode::showsGraphics() )
+            return;
         this->crossHairOverlay_->hide();
         this->centerOverlay_->hide();
 
@@ -585,6 +598,8 @@
     }
 
     void NewHumanController::hideArrows() {
+        if( !GameMode::showsGraphics() )
+            return;
         if (showArrows_) {
             this->arrowsOverlay1_->hide();
             this->arrowsOverlay2_->hide();

Modified: code/branches/presentation2/src/orxonox/sound/AmbientSound.cc
===================================================================
--- code/branches/presentation2/src/orxonox/sound/AmbientSound.cc	2009-12-10 23:04:21 UTC (rev 6319)
+++ code/branches/presentation2/src/orxonox/sound/AmbientSound.cc	2009-12-11 01:05:00 UTC (rev 6320)
@@ -57,11 +57,10 @@
     void AmbientSound::registerVariables()
     {
         registerVariable(volume_, ObjectDirection::ToClient, new NetworkCallback<BaseSound>(static_cast<BaseSound*>(this), &BaseSound::volumeChanged));
-//         registerVariable(source_, ObjectDirection::ToClient, new NetworkCallback<BaseSound>(static_cast<BaseSound*>(this), &BaseSound::sourceChanged));
         registerVariable(ambientSource_, ObjectDirection::ToClient, new NetworkCallback<AmbientSound>(this, &AmbientSound::ambientSourceChanged));
         registerVariable(bLooping_, ObjectDirection::ToClient, new NetworkCallback<BaseSound>(static_cast<BaseSound*>(this), &BaseSound::loopingChanged));
         registerVariable(pitch_, ObjectDirection::ToClient, new NetworkCallback<BaseSound>(static_cast<BaseSound*>(this), &BaseSound::pitchChanged));
-        registerVariable((int&)(BaseSound::state_), ObjectDirection::ToClient);
+        registerVariable((int&)(BaseSound::state_), ObjectDirection::ToClient, new NetworkCallback<BaseSound>(static_cast<BaseSound*>(this), &BaseSound::stateChanged));
     }
 
     void AmbientSound::XMLPort(Element& xmlelement, XMLPort::Mode mode)
@@ -83,6 +82,8 @@
         {
             SoundManager::getInstance().registerAmbientSound(this);
         }
+        else
+            BaseSound::play();
     }
 
     void AmbientSound::doPlay()
@@ -96,6 +97,8 @@
         {
             SoundManager::getInstance().unregisterAmbientSound(this);
         }
+        else
+            BaseSound::stop();
     }
 
     void AmbientSound::doStop()
@@ -109,6 +112,8 @@
         {
             SoundManager::getInstance().pauseAmbientSound(this);
         }
+        else
+            BaseSound::pause();
     }
     
     float AmbientSound::getVolumeGain()
@@ -135,7 +140,7 @@
         }
     }
 
-    void AmbientSound::changedActivity() 
+    void AmbientSound::changedActivity()
     {
         SUPER(AmbientSound, changedActivity);
         if (this->isActive())

Modified: code/branches/presentation2/src/orxonox/sound/BaseSound.cc
===================================================================
--- code/branches/presentation2/src/orxonox/sound/BaseSound.cc	2009-12-10 23:04:21 UTC (rev 6319)
+++ code/branches/presentation2/src/orxonox/sound/BaseSound.cc	2009-12-11 01:05:00 UTC (rev 6320)
@@ -220,4 +220,22 @@
         if (this->isPaused())
             alSourcePause(this->audioSource_);
     }
+    
+    void BaseSound::stateChanged()
+    {
+        CCOUT(0) << "changed state to " << this->state_ << endl;
+        switch( this->state_ )
+        {
+            case Playing:
+                this->play();
+                break;
+            case Paused:
+                this->pause();
+                break;
+            case Stopped:
+            default:
+                this->stop();
+                break;
+        }
+    }
 }

Modified: code/branches/presentation2/src/orxonox/sound/BaseSound.h
===================================================================
--- code/branches/presentation2/src/orxonox/sound/BaseSound.h	2009-12-10 23:04:21 UTC (rev 6319)
+++ code/branches/presentation2/src/orxonox/sound/BaseSound.h	2009-12-11 01:05:00 UTC (rev 6320)
@@ -58,9 +58,9 @@
         virtual void stop();
         virtual void pause();
 
-        bool isPlaying() { return this->state_ == Playing; }
-        bool isPaused()  { return this->state_ == Paused; }
-        bool isStopped() { return this->state_ == Stopped; }
+        bool isPlaying() const { return this->state_ == Playing; }
+        bool isPaused()  const { return this->state_ == Paused; }
+        bool isStopped() const { return this->state_ == Stopped; }
 
         void setPlaying(bool val)
             { val ? this->play() : this->stop(); }
@@ -83,6 +83,8 @@
         float getPitch() const   { return this->pitch_; }
         void setPitch(float pitch);
         inline void pitchChanged(){ this->setPitch(this->pitch_); }
+        
+        void stateChanged();
 
         //ALuint getALAudioSource(void);
 

Modified: code/branches/presentation2/src/orxonox/sound/WorldSound.cc
===================================================================
--- code/branches/presentation2/src/orxonox/sound/WorldSound.cc	2009-12-10 23:04:21 UTC (rev 6319)
+++ code/branches/presentation2/src/orxonox/sound/WorldSound.cc	2009-12-11 01:05:00 UTC (rev 6320)
@@ -59,7 +59,7 @@
         registerVariable(volume_, ObjectDirection::ToClient, new NetworkCallback<BaseSound>(static_cast<BaseSound*>(this), &BaseSound::volumeChanged));
         registerVariable(source_, ObjectDirection::ToClient, new NetworkCallback<BaseSound>(static_cast<BaseSound*>(this), &BaseSound::sourceChanged));
         registerVariable(bLooping_, ObjectDirection::ToClient, new NetworkCallback<BaseSound>(static_cast<BaseSound*>(this), &BaseSound::loopingChanged));
-        registerVariable((int&)(BaseSound::state_), ObjectDirection::ToClient);
+        registerVariable((int&)(BaseSound::state_), ObjectDirection::ToClient, new NetworkCallback<BaseSound>(static_cast<BaseSound*>(this), &BaseSound::stateChanged));
         registerVariable(pitch_, ObjectDirection::ToClient, new NetworkCallback<BaseSound>(static_cast<BaseSound*>(this), &BaseSound::pitchChanged));
     }
 




More information about the Orxonox-commit mailing list