Index: trunk/src/util/hud.cc
===================================================================
--- trunk/src/util/hud.cc	(revision 10516)
+++ trunk/src/util/hud.cc	(revision 10698)
@@ -11,5 +11,5 @@
    ### File Specific:
    main-programmer: Benjamin Grauer
-   co-programmer: ...
+   co-programmer: Benjamin Knecht
 */
 
@@ -52,7 +52,7 @@
   this->energyWidget = NULL;
   this->shieldWidget = NULL;
-  this->armorWidget = NULL;
-  //this->leftRect = NULL;
-  //this->rightRect = NULL;
+  this->healthWidget = NULL;
+  this->leftRect = NULL;
+  this->rightRect = NULL;
   this->resX = 1;
   this->resY = 1;
@@ -62,10 +62,16 @@
   this->rightRect = new OrxGui::GLGuiImage();
   this->leftRect = new OrxGui::GLGuiImage();
+  this->topRect = new OrxGui::GLGuiImage();
+  this->bottomRect = new OrxGui::GLGuiImage();
+  this->middleRect = new OrxGui::GLGuiImage();
 
   this->inputLine = new OrxGui::GLGuiInputLine();
-  this->inputLine->setParent2D(this);
+  //this->inputLine->setParent2D(this);
   this->notifier = new OrxGui::GLGuiNotifier();
-  this->notifier->setParent2D(this);
-  notifier->setAbsCoor2D(100,100);
+  this->notifier->setParent2D(this->bottomRect);
+  notifier->setRelCoor2D(5,5);
+  
+  this->barSocket = new OrxGui::GLGuiImage();
+  this->barSocket->setParent2D(this->bottomRect);
 
   this->_radar = new OrxGui::GLGuiRadar();
@@ -88,6 +94,11 @@
 
   delete this->_radar;
+  delete this->barSocket;
   delete this->rightRect;
   delete this->leftRect;
+  delete this->topRect;
+  delete this->bottomRect;
+  delete this->middleRect;
+
   //if (this->shipValuesBox != NULL)
     //delete this->shipValuesBox;
@@ -135,8 +146,8 @@
   }
 
-  this->updateResolution();
-}
-
-void Hud::setShiledWidget(OrxGui::GLGuiWidget* widget)
+  this->updateResolution();  
+}
+
+void Hud::setShieldWidget(OrxGui::GLGuiWidget* widget)
 {
   /*
@@ -169,28 +180,67 @@
 }
 
-void Hud::setArmorWidget(OrxGui::GLGuiWidget* widget)
-{
-  /*
-  if (this->shipValuesBox == NULL)
-    this->createShipValuesBox();
-  */
-
-// decopple old widget
-  if (this->armorWidget != NULL)
-  {
-    this->armorWidget->hide();
-  }
-
-  this->armorWidget = widget;
-  if (this->armorWidget != NULL)
-  {
-    //this->armorWidget->shiftDir2D(270);
-    //this->shipValuesBox->pack(this->armorWidget);
-    //dynamic_cast<OrxGui::GLGuiEnergyWidgetVertical*> (this->armorWidget)->setStandardSettings();
-    this->armorWidget->setParent2D(this->leftRect);
-    dynamic_cast<OrxGui::GLGuiEnergyWidgetVertical*> (this->armorWidget)->setDisplayedImage("textures/gui/gui_health_icon.png");
-    this->armorWidget->show();
-    /*    this->armorWidget->frontMaterial().setDiffuseMap("hud_energy_bar.png");
-        this->armorWidget->frontMaterial().setBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);*/
+void Hud::setHealthWidget(OrxGui::GLGuiWidget* widget)
+{
+	if( this->playmode == FirstPerson )
+	{
+		this->healthWidget = new OrxGui::GLGuiBar();
+		dynamic_cast<OrxGui::GLGuiBar*> (this->healthWidget)->setMaximum(dynamic_cast<OrxGui::GLGuiEnergyWidgetVertical*> (widget)->getBarWidget()->maximum());
+		dynamic_cast<OrxGui::GLGuiBar*> (this->healthWidget)->setValue(dynamic_cast<OrxGui::GLGuiEnergyWidgetVertical*> (widget)->getBarWidget()->value());
+		this->healthWidget->setParent2D(this->barSocket);
+	}
+	else
+	{
+	  /*
+	  if (this->shipValuesBox == NULL)
+	    this->createShipValuesBox();
+	  */
+	
+	// decopple old widget
+	  if (this->healthWidget != NULL)
+	  {
+	    this->healthWidget->hide();
+	  }
+	
+	  this->healthWidget = widget;
+	  if (this->healthWidget != NULL)
+	  {
+	    //this->healthWidget->shiftDir2D(270);
+	    //this->shipValuesBox->pack(this->healthWidget);
+	    //dynamic_cast<OrxGui::GLGuiEnergyWidgetVertical*> (this->healthWidget)->setStandardSettings();
+	    this->healthWidget->setParent2D(this->leftRect);
+	    //dynamic_cast<OrxGui::GLGuiEnergyWidgetVertical*> (this->healthWidget)->setDisplayedImage("textures/gui/gui_health_icon.png");
+	    this->healthWidget->show();
+	    /*    this->healthWidget->frontMaterial().setDiffuseMap("hud_energy_bar.png");
+	        this->healthWidget->frontMaterial().setBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);*/
+	  }
+	}
+
+  this->updateResolution();
+}
+
+
+void Hud::setImplantWidget(OrxGui::GLGuiWidget* widget)
+{
+  //if (this->shipValuesBox == NULL)
+    //this->createShipValuesBox();
+
+  // decopple old widget
+  if (this->implantWidget != NULL)
+  {
+    this->implantWidget->hide();
+  }
+
+  this->implantWidget = widget;
+  if (this->implantWidget != NULL)
+  {
+    //this->energyWidget->shiftDir2D(270);
+    //dynamic_cast<OrxGui::GLGuiEnergyWidgetVertical*> (this->energyWidget)->setDisplayedName("Electronics");
+    //this->shipValuesBox->pack(this->energyWidget);
+    //dynamic_cast<OrxGui::GLGuiEnergyWidgetVertical*> (this->energyWidget)->setStandardSettings();
+    this->implantWidget->setParent2D(this->leftRect);
+    dynamic_cast<OrxGui::GLGuiEnergyWidgetVertical*> (this->implantWidget)->setDisplayedImage("textures/gui/gui_electronics_icon.png");
+    this->implantWidget->show();
+    /*    this->energyWidget->frontMaterial().setDiffuseMap("hud_energy_bar.png");
+        this->energyWidget->frontMaterial().setBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);*/
   }
 
@@ -341,6 +391,9 @@
 
   this->setSize2D(.2 * this->resX, this->resY);
-  this->notifier->setAbsCoor2D(0.7 * this->resX, 0.3 * this->resY);
-  this->notifier->setWidgetSize(0.25 * this->resX, 0.6 * this->resY);
+  if( this->playmode != FirstPerson )
+  {
+	  this->notifier->setAbsCoor2D(0.7 * this->resX, 0.3 * this->resY);
+	  this->notifier->setWidgetSize(0.25 * this->resX, 0.6 * this->resY);
+  }
 
   int overlayWidth = 0;
@@ -348,5 +401,5 @@
     overlayWidth = this->resX * (overlayPercentage)/(200);
   else
-    overlayWidth = this->resX * 0.1;
+    overlayWidth = this->resX / 10; // fixed warning!
   //if (overlayWidth < 100)
     //overlayWidth = 100;
@@ -354,21 +407,35 @@
   this->rightRect->hide();
   this->leftRect->hide();
-
-  this->leftRect->setParent2D(this);
-  this->leftRect->setWidgetSize(float(overlayWidth), float(this->resY));
-  this->leftRect->setAbsCoor2D(0,0);
-  this->leftRect->setBackgroundTexture(Texture());
-  this->leftRect->setBackgroundColor(Color(0,0,0.7,0.2));
-  this->leftRect->setForegroundTexture(Texture());
-  this->leftRect->setForegroundColor(Color(0,0,0,0));
-
-  this->rightRect->setParent2D(this);
-  this->rightRect->setWidgetSize(float(overlayWidth), float(this->resY));
-  this->rightRect->setAbsCoor2D(this->resX - overlayWidth,0);
-  this->rightRect->setBackgroundTexture(Texture());
-  this->rightRect->setBackgroundColor(Color(0,0,0.7,0.2));
-  this->rightRect->setForegroundTexture(Texture());
-  this->rightRect->setForegroundColor(Color(0,0,0,0));
-
+  
+  if( this->playmode != FirstPerson )
+  {
+	  this->leftRect->setParent2D(this);
+	  this->leftRect->setWidgetSize(float(overlayWidth), float(this->resY));
+	  this->leftRect->setAbsCoor2D(0,0);
+	  this->leftRect->setBackgroundTexture(Texture());
+	  this->leftRect->setBackgroundColor(Color(0,0,0.7,0.2));
+	  this->leftRect->setForegroundTexture(Texture());
+	  this->leftRect->setForegroundColor(Color(0,0,0,0));
+	
+	  this->rightRect->setParent2D(this);
+	  this->rightRect->setWidgetSize(float(overlayWidth), float(this->resY));
+	  this->rightRect->setAbsCoor2D(this->resX - overlayWidth,0);
+	  this->rightRect->setBackgroundTexture(Texture());
+	  this->rightRect->setBackgroundColor(Color(0,0,0.7,0.2));
+	  this->rightRect->setForegroundTexture(Texture());
+	  this->rightRect->setForegroundColor(Color(0,0,0,0));
+  }
+  else
+  {
+	  this->bottomRect->setParent2D(this);
+	  this->bottomRect->setWidgetSize(float(this->resX), float(overlayWidth));
+	  this->bottomRect->setAbsCoor2D(0, this->resY - overlayWidth);
+	  this->topRect->setParent2D(this);
+	  this->topRect->setWidgetSize(float(this->resX), float(overlayWidth));
+	  this->topRect->setAbsCoor2D(0, 0);
+	  this->middleRect->setParent2D(this);
+	  this->middleRect->setWidgetSize(float(this->resY)/2, float(this->resY)/2);
+	  this->middleRect->setAbsCoor2D(float(this->resX - this->resY/2)/2, float(this->resY)/4);
+  }
 
   if (this->overlayActive == true)
@@ -382,5 +449,8 @@
   {
     PRINTF(4)("UPDATING RADAR\n");
-    this->_radar->setParent2D(this->leftRect);
+    if( this->playmode != FirstPerson )
+    	this->_radar->setParent2D(this->leftRect);
+    else
+    	this->_radar->setParent2D(this->topRect);
     if (radarCenterNode == NULL)
       this->_radar->setCenterNode(State::getPlayer()->getPlayable());
@@ -397,63 +467,75 @@
     
     int statWidgetsNumber = 0;
-    float expectedArmorSizeX = 0;
-    float expectedArmorSizeY = 0;
+    float expectedHealthSizeX = 0;
+    float expectedHealthSizeY = 0;
     float newSizeY = 0; float newSizeX = 0;
     float moduloWidth = 0;
 
-    if (this->armorWidget != NULL)
-    {
-      expectedArmorSizeX = 150;
-      expectedArmorSizeY = 50;
-      statWidgetsNumber++;
-    }
-
+	if( this->playmode != FirstPerson )
+	{
+	    if (this->healthWidget != NULL)
+	    {
+	      expectedHealthSizeX = 150;
+	      expectedHealthSizeY = 50;
+	      statWidgetsNumber++;
+	    }
+
+	    if (this->shieldWidget != NULL)
+	      statWidgetsNumber++;
+	    
+	    if (this->energyWidget != NULL)
+	      statWidgetsNumber++;
+	
+	    if (expectedHealthSizeY * statWidgetsNumber > overlayWidth)
+	    {
+	      newSizeY = overlayWidth / float(statWidgetsNumber);
+	      newSizeX = expectedHealthSizeX;
+	      PRINTF(0)("Statwidgets resized\n");
+	    }
+	    else
+	    {
+	      newSizeY = expectedHealthSizeY;
+	      newSizeX = expectedHealthSizeX;
+	      moduloWidth = int(overlayWidth) % int(expectedHealthSizeY * statWidgetsNumber);
+	    }
+	
+	    float posY = overlayWidth + newSizeX;
+	
+	    if (this->healthWidget != NULL)
+	    {
+	      this->healthWidget->setSize2D(newSizeX, newSizeY);
+	      this->healthWidget->setRelCoor2D((statWidgetsNumber - 1) * newSizeY + 3 * moduloWidth / (statWidgetsNumber + 1),posY);
+	    }
+	    if (this->shieldWidget != NULL)
+	    {
+	      this->shieldWidget->setSize2D(newSizeX, newSizeY);
+	      this->shieldWidget->setRelCoor2D((statWidgetsNumber - 2) * newSizeY + 2 *moduloWidth / (statWidgetsNumber + 1),posY);
+	    }
+	    if (this->energyWidget != NULL)
+	    {
+	      this->energyWidget->setSize2D(newSizeX, newSizeY);
+	      this->energyWidget->setRelCoor2D(moduloWidth / (statWidgetsNumber + 1),posY);
+	    }
+	}
+	else
+	{
+		this->barSocket->setParent2D(this->bottomRect);
+		this->barSocket->setWidgetSize( float(overlayWidth), float(overlayWidth));
+		this->barSocket->setRelCoor2D(0,this->resX - float(overlayWidth));
+		
+		this->healthWidget->setRelCoor2D(10,-20);
+	}
+	
+
+    /*
+    if (this->healthWidget != NULL)
+      this->healthWidget->setRelCoor2D(100,0.2*this->resY + this->healthWidget->getSizeX2D());
     if (this->shieldWidget != NULL)
-      statWidgetsNumber++;
-    
+      this->shieldWidget->setRelCoor2D(60,0.2*this->resY + this->healthWidget->getSizeX2D());
     if (this->energyWidget != NULL)
-      statWidgetsNumber++;
-
-    if (expectedArmorSizeY * statWidgetsNumber > overlayWidth)
-    {
-      newSizeY = overlayWidth / float(statWidgetsNumber);
-      newSizeX = expectedArmorSizeX;
-      PRINTF(0)("Statwidgets resized\n");
-    }
-    else
-    {
-      newSizeY = expectedArmorSizeY;
-      newSizeX = expectedArmorSizeX;
-      moduloWidth = int(overlayWidth) % int(expectedArmorSizeY * statWidgetsNumber);
-    }
-
-    float posY = overlayWidth + newSizeX;
-
-    if (this->armorWidget != NULL)
-    {
-      this->armorWidget->setSize2D(newSizeX, newSizeY);
-      this->armorWidget->setRelCoor2D((statWidgetsNumber - 1) * newSizeY + 3 * moduloWidth / (statWidgetsNumber + 1),posY);
-    }
-    if (this->shieldWidget != NULL)
-    {
-      this->shieldWidget->setSize2D(newSizeX, newSizeY);
-      this->shieldWidget->setRelCoor2D((statWidgetsNumber - 2) * newSizeY + 2 *moduloWidth / (statWidgetsNumber + 1),posY);
-    }
-    if (this->energyWidget != NULL)
-    {
-      this->energyWidget->setSize2D(newSizeX, newSizeY);
-      this->energyWidget->setRelCoor2D(moduloWidth / (statWidgetsNumber + 1),posY);
-    }
-
-    /*
-    if (this->armorWidget != NULL)
-      this->armorWidget->setRelCoor2D(100,0.2*this->resY + this->armorWidget->getSizeX2D());
-    if (this->shieldWidget != NULL)
-      this->shieldWidget->setRelCoor2D(60,0.2*this->resY + this->armorWidget->getSizeX2D());
-    if (this->energyWidget != NULL)
-      this->energyWidget->setRelCoor2D(20,0.2*this->resY + this->armorWidget->getSizeX2D());
+      this->energyWidget->setRelCoor2D(20,0.2*this->resY + this->healthWidget->getSizeX2D());
     */
-    //this->shieldWidget->setRelCoor2D(0.1*this->resX + this->armorWidget->getSizeX2D(),0);
-    //this->energyWidget->setRelCoor2D(0.1*this->resX + this->armorWidget->getSizeX2D() + this->shieldWidget->getSizeX2D(),0);
+    //this->shieldWidget->setRelCoor2D(0.1*this->resX + this->healthWidget->getSizeX2D(),0);
+    //this->energyWidget->setRelCoor2D(0.1*this->resX + this->healthWidget->getSizeX2D() + this->shieldWidget->getSizeX2D(),0);
   }
 
