[Orxonox-commit 1518] r6236 - code/branches/presentation2/src/orxonox/controllers

scheusso at orxonox.net scheusso at orxonox.net
Thu Dec 3 21:36:22 CET 2009


Author: scheusso
Date: 2009-12-03 21:36:22 +0100 (Thu, 03 Dec 2009)
New Revision: 6236

Modified:
   code/branches/presentation2/src/orxonox/controllers/NewHumanController.cc
   code/branches/presentation2/src/orxonox/controllers/NewHumanController.h
Log:
showing and hiding of overlays should now work correct with respawning and menu toggling


Modified: code/branches/presentation2/src/orxonox/controllers/NewHumanController.cc
===================================================================
--- code/branches/presentation2/src/orxonox/controllers/NewHumanController.cc	2009-12-03 19:48:25 UTC (rev 6235)
+++ code/branches/presentation2/src/orxonox/controllers/NewHumanController.cc	2009-12-03 20:36:22 UTC (rev 6236)
@@ -68,9 +68,10 @@
         arrowsSize_ = 0.4;
         controlMode_ = 0;
         acceleration_ = 0;
-        acceleration_ = false;
+        accelerating_ = false;
         firemode_ = -1;
         showArrows_ = true;
+        showOverlays_ = false;
 
         //currentPitch_ = 1;
         //currentYaw_ = 1;
@@ -128,7 +129,7 @@
 
         NewHumanController::localController_s = this;
 
-        controlPaused_ = true;
+        controlPaused_ = false;
 
 //HumanController::localController_s->getControllableEntity()->getCamera()->setDrag(true);
     }
@@ -168,21 +169,15 @@
                     this->crossHairOverlay_->setPosition(Vector2(static_cast<float>(this->currentYaw_)/2*-1+.5-overlaySize_/2, static_cast<float>(this->currentPitch_)/2*-1+.5-overlaySize_/2));
 
                     if ( this->controlMode_ == 0 || ( this->controlMode_ == 1 && this->firemode_ == 1 ) )
-                        alignArrows();
+                    {
+                        if ( this->showOverlays_ )
+                            alignArrows();
+                    }
                     else
                         hideArrows();
-
-                    this->crossHairOverlay_->show();
-                    this->centerOverlay_->show();
                 }
             }
-            else {
-                this->crossHairOverlay_->hide();
-                this->centerOverlay_->hide();
 
-                hideArrows();
-            }
-
             if ( this->acceleration_ > 0 )
             {
 /*
@@ -383,9 +378,20 @@
         this->controlMode_ = 0;
         this->currentYaw_ = 0;
         this->currentPitch_ = 0;
-//         if (this->getControllableEntity() && this->getControllableEntity()->getIdentifier()->getName() == "SpaceShip") {
-//             this->doResumeControl();
-//         }
+        if (this->getControllableEntity() && this->getControllableEntity()->getIdentifier()->getName() == "SpaceShip")
+        {
+            this->showOverlays_ = true;
+            if( !this->controlPaused_ )
+            {
+                this->showOverlays();
+                this->alignArrows();
+            }
+        }
+        else
+        {
+            this->showOverlays_ = false;
+            this->hideOverlays();
+        }
     }
 
     void NewHumanController::accelerate()
@@ -406,17 +412,15 @@
 
     void NewHumanController::doResumeControl() {
         this->controlPaused_ = false;
-        this->crossHairOverlay_->show();
-        this->centerOverlay_->show();
+        if( this->showOverlays_ ) {
+            this->showOverlays();
+        }
     }
 
     void NewHumanController::doPauseControl() {
         this->controlPaused_ = true;
-
-        this->crossHairOverlay_->hide();
-        this->centerOverlay_->hide();
-
-        hideArrows();
+        
+        this->hideOverlays();
     }
 
     void NewHumanController::alignArrows() {
@@ -448,6 +452,25 @@
         }
     }
 
+    void NewHumanController::showOverlays() {
+        this->crossHairOverlay_->show();
+        this->centerOverlay_->show();
+        
+        if (showArrows_) {
+            this->arrowsOverlay1_->show();
+            this->arrowsOverlay2_->show();
+            this->arrowsOverlay3_->show();
+            this->arrowsOverlay4_->show();
+        }
+    }
+
+    void NewHumanController::hideOverlays() {
+        this->crossHairOverlay_->hide();
+        this->centerOverlay_->hide();
+        
+        this->hideArrows();
+    }
+
     void NewHumanController::hideArrows() {
         if (showArrows_) {
             this->arrowsOverlay1_->hide();

Modified: code/branches/presentation2/src/orxonox/controllers/NewHumanController.h
===================================================================
--- code/branches/presentation2/src/orxonox/controllers/NewHumanController.h	2009-12-03 19:48:25 UTC (rev 6235)
+++ code/branches/presentation2/src/orxonox/controllers/NewHumanController.h	2009-12-03 20:36:22 UTC (rev 6236)
@@ -67,6 +67,8 @@
         protected:
             void updateTarget();
             void alignArrows();
+            void showOverlays();
+            void hideOverlays();
             void hideArrows();
 
             unsigned int                controlMode_;
@@ -86,6 +88,7 @@
             float                       acceleration_;
             int                         firemode_;
             bool                        showArrows_;
+            bool                        showOverlays_;
             ClassTreeMask               targetMask_;
     };
 }




More information about the Orxonox-commit mailing list