[Orxonox-commit 385] r2978 - in branches/gametypes/src/orxonox: objects/gametypes objects/worldentities/triggers overlays/hud

Aurelian at orxonox.net Aurelian at orxonox.net
Sun May 17 21:23:42 CEST 2009


Author: Aurelian
Date: 2009-05-17 21:23:41 +0200 (Sun, 17 May 2009)
New Revision: 2978

Modified:
   branches/gametypes/src/orxonox/objects/gametypes/Asteroids.cc
   branches/gametypes/src/orxonox/objects/gametypes/Gametype.h
   branches/gametypes/src/orxonox/objects/worldentities/triggers/CheckPoint.cc
   branches/gametypes/src/orxonox/overlays/hud/HUDTimer.cc
Log:
some fixes on the timer, visibility of checkpoint removed (done in the xml-file)

Modified: branches/gametypes/src/orxonox/objects/gametypes/Asteroids.cc
===================================================================
--- branches/gametypes/src/orxonox/objects/gametypes/Asteroids.cc	2009-05-14 12:35:54 UTC (rev 2977)
+++ branches/gametypes/src/orxonox/objects/gametypes/Asteroids.cc	2009-05-17 19:23:41 UTC (rev 2978)
@@ -43,20 +43,18 @@
     {
         RegisterObject(Asteroids);
         this->firstCheckpointReached_ = false;
-        this->timeLimit_ = 30;
     }
 
     void Asteroids::tick(float dt)
     {
         SUPER(Asteroids, tick, dt);
  
-        if (firstCheckpointReached_)
+        if (firstCheckpointReached_ && !this->timerIsActive_)
         {
-            this->timeLimit_ = this->time_;
             this->startTimer();
         }
 
-        if (this->time_ < 0 && !this->hasEnded())
+        if (this->time_ < 0 && !this->hasEnded() && this->timerIsActive_)
         {
             this->end();
         }

Modified: branches/gametypes/src/orxonox/objects/gametypes/Gametype.h
===================================================================
--- branches/gametypes/src/orxonox/objects/gametypes/Gametype.h	2009-05-14 12:35:54 UTC (rev 2977)
+++ branches/gametypes/src/orxonox/objects/gametypes/Gametype.h	2009-05-17 19:23:41 UTC (rev 2978)
@@ -129,7 +129,10 @@
             virtual void removeTime(float t);
 
             inline  void startTimer()
-              { this->timerIsActive_ = true; }
+            { 
+                this->time_ = this->timeLimit_;
+                this->timerIsActive_ = true;
+            }
 
             inline void stopTimer()
               { this->timerIsActive_ = false; }
@@ -140,6 +143,9 @@
             inline bool getTimerIsActive()
               { return timerIsActive_; }
 
+            inline void setTimeLimit(float t)
+              { this->timeLimit_ = t; }
+
             virtual void resetTimer();
             virtual void resetTimer(float t);
 

Modified: branches/gametypes/src/orxonox/objects/worldentities/triggers/CheckPoint.cc
===================================================================
--- branches/gametypes/src/orxonox/objects/worldentities/triggers/CheckPoint.cc	2009-05-14 12:35:54 UTC (rev 2977)
+++ branches/gametypes/src/orxonox/objects/worldentities/triggers/CheckPoint.cc	2009-05-17 19:23:41 UTC (rev 2978)
@@ -49,7 +49,7 @@
     this->setDistance(50);
     this->bIsFirst_ = false;
     this->bIsDestination_ = false;
-    this->setVisible(true);
+    //this->setVisible(true);
   }
 
   CheckPoint::~CheckPoint()
@@ -76,6 +76,7 @@
 
         if (bIsTriggered && bIsFirst_)
         {
+            gametype->setTimeLimit(addTime_);
             gametype->firstCheckpointReached(true);
         }
      

Modified: branches/gametypes/src/orxonox/overlays/hud/HUDTimer.cc
===================================================================
--- branches/gametypes/src/orxonox/overlays/hud/HUDTimer.cc	2009-05-14 12:35:54 UTC (rev 2977)
+++ branches/gametypes/src/orxonox/overlays/hud/HUDTimer.cc	2009-05-17 19:23:41 UTC (rev 2978)
@@ -62,7 +62,7 @@
 
     if (gametype->getTimerIsActive())
     {
-      this->setCaption(convertToString((int)gametype->getTime()));
+      this->setCaption(convertToString((int)gametype->getTime() + 1));
     }
   }
 




More information about the Orxonox-commit mailing list