Index: branches/playability/src/util/hud.cc
===================================================================
--- branches/playability/src/util/hud.cc	(revision 10335)
+++ branches/playability/src/util/hud.cc	(revision 10347)
@@ -341,7 +341,11 @@
   this->notifier->setWidgetSize(0.25 * this->resX, 0.6 * this->resY);
 
-  int overlayWidth = this->resX * (overlayPercentage)/(200);
-  if (overlayWidth < 100)
-    overlayWidth = 100;
+  int overlayWidth = 0;
+  if (overlayPercentage >= 20)
+    overlayWidth = this->resX * (overlayPercentage)/(200);
+  else
+    overlayWidth = this->resX * 0.1;
+  //if (overlayWidth < 100)
+    //overlayWidth = 100;
 
   this->rightRect->hide();
@@ -385,8 +389,59 @@
     this->_radar->addEntityList(&State::getObjectManager()->getEntityList(OM_GROUP_01), Color(0, 0, 1));
     this->_radar->setAbsCoor2D(0, 0.01 * this->resY);
-    this->_radar->setWidgetSize(0.18 * this->resX, 0.2 * this->resY);
+    this->_radar->setWidgetSize(overlayWidth, overlayWidth);
     this->_radar->setRange(300);
     this->_radar->show();
-
+    
+    int statWidgetsNumber = 0;
+    float expectedArmorSizeX = 0;
+    float expectedArmorSizeY = 0;
+    float newSizeY = 0; float newSizeX = 0;
+    float moduloWidth = 0;
+
+    if (this->armorWidget != NULL)
+    {
+      expectedArmorSizeX = 150;
+      expectedArmorSizeY = 50;
+      statWidgetsNumber++;
+    }
+
+    if (this->shieldWidget != NULL)
+      statWidgetsNumber++;
+    
+    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());
@@ -395,4 +450,5 @@
     if (this->energyWidget != NULL)
       this->energyWidget->setRelCoor2D(20,0.2*this->resY + this->armorWidget->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);
@@ -411,4 +467,5 @@
   std::list<OrxGui::GLGuiEnergyWidgetVertical*>::iterator weaponWidget;
   Vector2D pos = Vector2D(overlayWidth, 0.4*this->resY);
+  float largestWidgetSizeX = 0;
   //PRINTF(0)("Cur Pos: %f,%f\n",pos.x,pos.y);
   // out of reasons i can't get behind, this version is segfaulting when calling getSizeX2D or getSizeY2D. the other
@@ -418,8 +475,11 @@
   {
     float ySize = (*weaponWidget)->getSizeY2D();
+    float xSize = (*weaponWidget)->getSizeX2D();
+    if (xSize > largestWidgetSizeX)
+      largestWidgetSizeX = xSize;
     if (pos.x < ySize)
     {
       pos.x = overlayWidth;
-      pos.y += (*weaponWidget)->getSizeX2D();
+      pos.y += largestWidgetSizeX;
     }
     pos.x -= ySize;
@@ -429,17 +489,27 @@
     //printf("update thing %s::%s\n", (*weaponWidget)->getClassCName(), (*weaponWidget)->getName());
   }
-
-  pos.y += 160;
-  pos.x = 0; //overlayWidth + this->rightRect->getAbsCoor2D().x;
+  
+  weaponWidget = this->weaponsWidgetsSec.begin();
+  float expectedWidgetSizeY = 0;
+  if (weaponWidget != this->weaponsWidgetsSec.end())
+  {
+    expectedWidgetSizeY = (*weaponWidget)->getSizeY2D();
+  }
+  pos.y = resY - expectedWidgetSizeY * 0.6;
+  pos.x = overlayWidth + this->rightRect->getAbsCoor2D().x;
+
   for (weaponWidget = this->weaponsWidgetsSec.begin(); weaponWidget != this->weaponsWidgetsSec.end(); weaponWidget++)
   {
     float ySize = (*weaponWidget)->getSizeY2D();
+    float xSize = (*weaponWidget)->getSizeX2D();
+    if (xSize > largestWidgetSizeX)
+      largestWidgetSizeX = xSize;
     if (pos.x < ySize)
     {
       pos.x = overlayWidth;
-      pos.y += (*weaponWidget)->getSizeX2D();
+      pos.y -= largestWidgetSizeX + expectedWidgetSizeY * 0.6;
     }
     pos.x -= ySize;
-    PRINTF(0)("secweaponwidget y-size: %f/n", (*weaponWidget)->getSizeY2D());
+    //PRINTF(0)("secweaponwidget y-size: %f/n", (*weaponWidget)->getSizeY2D());
     (*weaponWidget)->setAbsCoor2D(pos.x + this->rightRect->getAbsCoor2D().x, pos.y);
     (*weaponWidget)->show();
