Index: code/trunk/src/modules/overlays/hud/CMakeLists.txt
===================================================================
--- code/trunk/src/modules/overlays/hud/CMakeLists.txt	(revision 9667)
+++ code/trunk/src/modules/overlays/hud/CMakeLists.txt	(revision 9939)
@@ -18,3 +18,4 @@
   PauseNotice.cc
   LastTeamStandingInfos.cc
+  CountDown.cc
 )
Index: code/trunk/src/modules/overlays/hud/CountDown.cc
===================================================================
--- code/trunk/src/modules/overlays/hud/CountDown.cc	(revision 9939)
+++ code/trunk/src/modules/overlays/hud/CountDown.cc	(revision 9939)
@@ -0,0 +1,113 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 2
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Johannes Ritz
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+/**
+    @file CountDown.cc
+    @brief Countdown HUD element, counting down from CountDown::counter_ to zero.
+    
+    In use it would like this:
+        @code
+        <OverlayGroup name="spacefightHUD" scale = "1, 1">
+          <CountDown
+              position    = "0.49, 0.05"
+              pickpoint   = "0.0, 0.0"
+              font        = "ShareTechMono"
+              textsize    = 0.06
+              colour      = "1.0, 1.0, 1.0, 1.0"
+              align       = "right"                  
+              counter     = "10.0"
+              speedfactor = "1.0"
+              active      = "false"
+           >
+            <events>
+              <activity>
+                <EventListener event="startcounting" />
+              </activity>
+            </events>
+          </CountDown>
+        </OverlayGroup>
+        @endcode
+        The counter is triggered by an event called "startcounting" and counts from 10 to 0.
+*/
+
+#include "CountDown.h"
+
+#include "core/CoreIncludes.h"
+#include "core/XMLPort.h"
+#include "infos/PlayerInfo.h"
+#include "util/Convert.h"
+
+namespace orxonox
+{
+    RegisterClass(CountDown);
+
+    CountDown::CountDown(Context* context) : OverlayText(context)
+    {
+        RegisterObject(CountDown);
+
+        this->owner_ = 0;
+        this->hasStopped_ = false;
+    }
+    
+    CountDown::~CountDown()
+    {
+    }
+    
+    void CountDown::XMLPort(Element& xmlelement, XMLPort::Mode mode)
+    {
+        SUPER(CountDown, XMLPort, xmlelement, mode);
+        XMLPortParam(CountDown, "counter", setCounter, getCounter, xmlelement, mode).defaultValues(10);
+        XMLPortParam(CountDown, "speedfactor", setSpeed, getSpeed, xmlelement, mode).defaultValues(1);
+    }
+    
+    void CountDown::tick(float dt)
+    {
+        SUPER(CountDown, tick, dt);
+        if (this->isActive() && !this->hasStopped_)
+        {
+            if (this->counter_ <= 0)
+            {
+                this->counter_ = 0;
+                this->hasStopped_ = true;
+                this->setCaption("");
+            }
+            else
+            {
+                this->counter_ -= dt*speed_;
+                this->setCaption(multi_cast<std::string>((int)this->counter_)); //TODO: evtl. initialize with +0.5f
+            }
+        }
+    }
+
+    void CountDown::changedOwner()
+    {
+        SUPER(CountDown, changedOwner);
+
+        this->owner_ = orxonox_cast<PlayerInfo*>(this->getOwner());
+    }
+}
Index: code/trunk/src/modules/overlays/hud/CountDown.h
===================================================================
--- code/trunk/src/modules/overlays/hud/CountDown.h	(revision 9939)
+++ code/trunk/src/modules/overlays/hud/CountDown.h	(revision 9939)
@@ -0,0 +1,68 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 2
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Johannes Ritz
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#ifndef _CountDown_H__
+#define _CountDown_H__
+
+#include "overlays/OverlaysPrereqs.h"
+
+#include "tools/interfaces/TimeFactorListener.h"
+#include "tools/interfaces/Tickable.h"
+#include "overlays/OverlayText.h"
+
+namespace orxonox
+{
+    class _OverlaysExport CountDown : public OverlayText, public Tickable
+    {
+        public:
+            CountDown(Context* context);
+            virtual ~CountDown();
+
+            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
+            virtual void changedOwner();
+            virtual void tick(float dt);
+
+            inline void setCounter(float value)
+                { this->counter_ = value + 0.99f; }
+            inline float getCounter() const
+                { return this->counter_; }
+            inline void setSpeed(float value)
+                { this->speed_ = value; }
+            inline float getSpeed() const
+                { return this->speed_; }
+                
+        protected:
+
+        private:
+            PlayerInfo* owner_;
+            float counter_;
+            float speed_;
+            bool hasStopped_;
+    };
+}
+#endif /* _CountDown_H__ */
Index: code/trunk/src/modules/overlays/hud/HUDNavigation.cc
===================================================================
--- code/trunk/src/modules/overlays/hud/HUDNavigation.cc	(revision 9667)
+++ code/trunk/src/modules/overlays/hud/HUDNavigation.cc	(revision 9939)
@@ -74,6 +74,6 @@
         OrxonoxOverlay(context)
     {
-        RegisterObject(HUDNavigation)
-;        this->setConfigValues();
+        RegisterObject(HUDNavigation);
+        this->setConfigValues();
 
         // Set default values
Index: code/trunk/src/modules/overlays/hud/HUDRadar.cc
===================================================================
--- code/trunk/src/modules/overlays/hud/HUDRadar.cc	(revision 9667)
+++ code/trunk/src/modules/overlays/hud/HUDRadar.cc	(revision 9939)
@@ -25,4 +25,5 @@
  *   Co-authors:
  *      Reto Grieder
+ *      Wolfgang Roenninger
  *
  */
@@ -41,4 +42,5 @@
 #include "Scene.h"
 #include "Radar.h"
+#include "core/config/ConfigValueIncludes.h"
 
 namespace orxonox
@@ -50,4 +52,5 @@
     {
         RegisterObject(HUDRadar);
+        this->setConfigValues();
 
         this->marker_ = static_cast<Ogre::PanelOverlayElement*>(Ogre::OverlayManager::getSingleton()
@@ -60,10 +63,23 @@
         this->setHalfDotSizeDistance(3000.0f);
         this->setMaximumDotSize(0.1f);
+        this->setMaximumDotSize3D(0.07f);
 
         this->shapeMaterials_[RadarViewable::Dot]      = "RadarDot.png";
         this->shapeMaterials_[RadarViewable::Triangle] = "RadarTriangle.png";
         this->shapeMaterials_[RadarViewable::Square]   = "RadarSquare.png";
-        this->setDetectionLimit( 10000.0f );
         this->owner_ = 0;
+
+        this->map3DFront_ = static_cast<Ogre::PanelOverlayElement*>(Ogre::OverlayManager::getSingleton()
+        	.createOverlayElement("Panel", "HUDRadar_mapDreiDFront_" + getUniqueNumberString()));
+        this->map3DFront_->setMaterialName("Orxonox/Radar3DFront");
+        this->overlay_->add2D(this->map3DFront_);
+        this->map3DFront_->hide();
+
+        this->map3DBack_ = static_cast<Ogre::PanelOverlayElement*>(Ogre::OverlayManager::getSingleton()
+        	.createOverlayElement("Panel", "HUDRadar_mapDreiDBack_" + getUniqueNumberString()));
+        this->map3DBack_->setMaterialName("Orxonox/Radar3DBack");
+        this->overlay_->add2D(this->map3DBack_);
+        this->map3DBack_->hide();
+
     }
 
@@ -73,4 +89,7 @@
         {
             Ogre::OverlayManager::getSingleton().destroyOverlayElement(this->marker_);
+            Ogre::OverlayManager::getSingleton().destroyOverlayElement(this->map3DFront_);
+            Ogre::OverlayManager::getSingleton().destroyOverlayElement(this->map3DBack_);
+
             for (std::map<RadarViewable*,Ogre::PanelOverlayElement*>::iterator it = this->radarObjects_.begin();
                 it != this->radarObjects_.end(); ++it)
@@ -80,4 +99,11 @@
         }
     }
+
+
+
+    void HUDRadar::setConfigValues()
+       {
+           SetConfigValue(RadarMode_, true);
+       }
 
     void HUDRadar::XMLPort(Element& xmlelement, XMLPort::Mode mode)
@@ -88,4 +114,11 @@
         XMLPortParam(HUDRadar, "halfDotSizeDistance", setHalfDotSizeDistance, getHalfDotSizeDistance, xmlelement, mode);
         XMLPortParam(HUDRadar, "maximumDotSize", setMaximumDotSize, getMaximumDotSize, xmlelement, mode);
+        XMLPortParam(HUDRadar, "maximumDotSize3D", setMaximumDotSize3D, getMaximumDotSize3D, xmlelement, mode);
+        XMLPortParam(HUDRadar, "material2D", set2DMaterial, get2DMaterial, xmlelement, mode);
+        XMLPortParam(HUDRadar, "material3DMiddle", set3DMaterial, get3DMaterial, xmlelement, mode);
+        XMLPortParam(HUDRadar, "material3DFront", set3DMaterialFront, get3DMaterialFront, xmlelement, mode);
+        XMLPortParam(HUDRadar, "material3DBack", set3DMaterialBack, get3DMaterialBack, xmlelement, mode);
+        XMLPortParam(HUDRadar, "mapAngle3D", setMapAngle, getMapAngle, xmlelement, mode);
+        XMLPortParam(HUDRadar, "detectionLimit", setDetectionLimit, getDetectionLimit, xmlelement, mode);
     }
 
@@ -152,4 +185,21 @@
         // update the distances for all objects
         std::map<RadarViewable*,Ogre::PanelOverlayElement*>::iterator it;
+
+
+        if(RadarMode_)
+        {
+        	this->setBackgroundMaterial(material3D_);
+        	this->map3DFront_->_notifyZOrder(this->overlay_->getZOrder() * 100 + 250); // it seems that the ZOrder of overlayelements is 100 times the ZOrder of the overlay
+        	this->map3DBack_->_notifyZOrder(this->overlay_->getZOrder() * 100 - 250); // 250 a little bit buffer so that the two shels are displayed all in the front / in the back
+        	this->map3DFront_->show();
+        	this->map3DBack_->show();
+        }
+        else
+        {
+        	this->setBackgroundMaterial(material2D_);
+        	this->map3DFront_->hide();
+        	this->map3DBack_->hide();
+        }
+
         for( it = this->radarObjects_.begin(); it != this->radarObjects_.end(); ++it )
         {
@@ -165,11 +215,34 @@
             float distance = (wePointer->getWorldPosition() - this->owner_->getPosition()).length();
             // calculate the size with 1/distance dependency for simplicity (instead of exp(-distance * lambda)
-            float size = maximumDotSize_ * halfDotSizeDistance_ / (halfDotSizeDistance_ + distance) * it->first->getRadarObjectScale();
+
+            float size;
+            if(RadarMode_)
+            	size = maximumDotSize3D_ * halfDotSizeDistance_ / (halfDotSizeDistance_ + distance) * it->first->getRadarObjectScale();
+            else
+            	size = maximumDotSize_ * halfDotSizeDistance_ / (halfDotSizeDistance_ + distance) * it->first->getRadarObjectScale();
             it->second->setDimensions(size, size);
 
             // calc position on radar...
-            Vector2 coord = get2DViewcoordinates(this->owner_->getPosition(), this->owner_->getOrientation() * WorldEntity::FRONT, this->owner_->getOrientation() * WorldEntity::UP, wePointer->getWorldPosition());
+            Vector2 coord;
+
+            if(RadarMode_)
+            {
+            	coord = get3DProjection(this->owner_->getPosition(), this->owner_->getOrientation() * WorldEntity::FRONT, this->owner_->getOrientation() * WorldEntity::UP, wePointer->getWorldPosition(), 0.6435011, detectionLimit_);
+
+            	// set zOrder on screen
+            	bool overXZPlain = isObjectHigherThanShipOnMap(this->owner_->getPosition(), this->owner_->getOrientation() * WorldEntity::FRONT, this->owner_->getOrientation() * WorldEntity::UP, wePointer->getWorldPosition(), this->mapAngle_);
+
+            	int zOrder = determineMap3DZOrder(this->owner_->getPosition(), this->owner_->getOrientation() * WorldEntity::FRONT, this->owner_->getOrientation() * WorldEntity::UP, wePointer->getWorldPosition(), detectionLimit_);
+            	if(overXZPlain == false /*&& (it->second->getZOrder() >  100 * this->overlay_->getZOrder())*/) // it appears that zOrder of attached Overlayelements is 100 times the zOrder of the Overlay
+            		it->second->_notifyZOrder(this->overlay_->getZOrder() * 100 - 70 + zOrder);
+            	if(overXZPlain == true /*&& (it->second->getZOrder() <= 100 * this->overlay_->getZOrder())*/)
+            		it->second->_notifyZOrder(this->overlay_->getZOrder() * 100 + 70 + zOrder);
+            }
+            else
+            	coord = get2DViewcoordinates(this->owner_->getPosition(), this->owner_->getOrientation() * WorldEntity::FRONT, this->owner_->getOrientation() * WorldEntity::UP, wePointer->getWorldPosition());
+
             coord *= math::pi / 3.5f; // small adjustment to make it fit the texture
             it->second->setPosition((1.0f + coord.x - size) * 0.5f, (1.0f - coord.y - size) * 0.5f);
+
             if( distance < detectionLimit_ || detectionLimit_ < 0 )
                 it->second->show();
@@ -182,4 +255,6 @@
                 this->marker_->setDimensions(size * 1.5f, size * 1.5f);
                 this->marker_->setPosition((1.0f + coord.x - size * 1.5f) * 0.5f, (1.0f - coord.y - size * 1.5f) * 0.5f);
+                if(RadarMode_)
+                	this->marker_->_notifyZOrder(it->second->getZOrder() -1);
                 this->marker_->show();
             }
Index: code/trunk/src/modules/overlays/hud/HUDRadar.h
===================================================================
--- code/trunk/src/modules/overlays/hud/HUDRadar.h	(revision 9667)
+++ code/trunk/src/modules/overlays/hud/HUDRadar.h	(revision 9939)
@@ -35,4 +35,5 @@
 #include <map>
 #include <vector>
+#include <string>
 
 #include "util/OgreForwardRefs.h"
@@ -51,4 +52,5 @@
         virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
         virtual void changedOwner();
+        void setConfigValues();
 
     private:
@@ -57,15 +59,32 @@
         void setHalfDotSizeDistance(float distance) { this->halfDotSizeDistance_ = distance; }
 
-        void setDetectionLimit( float limit )
-        { this->detectionLimit_ = limit; }
-        float getDetectionLimit() const
-        { return this->detectionLimit_; }
+        void setDetectionLimit( float limit ) { this->detectionLimit_ = limit; }
+        float getDetectionLimit() const { return this->detectionLimit_; }
 
         float getMaximumDotSize() const { return this->maximumDotSize_; }
         void setMaximumDotSize(float size) { this->maximumDotSize_ = size; }
 
+        float getMaximumDotSize3D() const { return this->maximumDotSize3D_; }
+        void setMaximumDotSize3D(float size) { this->maximumDotSize3D_ = size;}
+
+        std::string get2DMaterial() const {return this->material2D_; }
+        void set2DMaterial(std::string material2D) { this->material2D_ = material2D; }
+
+        std::string get3DMaterial() const {return this->material3D_; }
+        void set3DMaterial(std::string material3D) { this->material3D_ = material3D; }
+
+        std::string get3DMaterialFront() const {return this->material3DFront_; }
+        void set3DMaterialFront(std::string material3DFront) { this->material3DFront_ = material3DFront; }
+
+        std::string get3DMaterialBack() const {return this->material3DBack_; }
+        void set3DMaterialBack(std::string material3DBack) { this->material3DBack_ = material3DBack; }
+
         float getRadarSensitivity() const { return this->sensitivity_; }
         // used also by RadarListener interface!
         void setRadarSensitivity(float sensitivity) { this->sensitivity_ = sensitivity; }
+
+        // Determines angle between line of sight and x/z-plain on the 3D minimap
+        float getMapAngle() const { return this->mapAngle_; }
+        void setMapAngle(float mapAngle) { this->mapAngle_ = mapAngle; }
 
         // RadarListener interface
@@ -85,6 +104,18 @@
         Ogre::PanelOverlayElement* marker_;
 
+        bool RadarMode_; // Determines, if Radar runs in 3D or 2D Mode
+
         float halfDotSizeDistance_;
         float maximumDotSize_;
+        float maximumDotSize3D_;
+        float mapAngle_;
+
+        std::string material2D_;		//Material name for 2D map
+        std::string material3D_;		//Material names For the 3D minimap
+        std::string material3DFront_;
+        std::string material3DBack_;
+
+        Ogre::PanelOverlayElement* map3DFront_; //Overlayelements for the 3D minimap to be able to draw the points in a semi 3D matter
+        Ogre::PanelOverlayElement* map3DBack_;
 
         float sensitivity_;
