Index: branches/vs-enhencements/src/world_entities/space_ships/space_ship.cc
===================================================================
--- branches/vs-enhencements/src/world_entities/space_ships/space_ship.cc	(revision 10667)
+++ branches/vs-enhencements/src/world_entities/space_ships/space_ship.cc	(revision 10669)
@@ -158,45 +158,45 @@
   this->secWeaponMan.setParentEntity( this);
 
-  this->setWMSlotCount(1,8);
-  this->setWMSlotCount(2,6);
-
-  this->createWeaponSlot(1, 0, Vector(3.006, 1.028, .155), WTYPE_ALLDIRS | WTYPE_DIRECTIONAL);
-  this->createWeaponSlot(1, 1, Vector(3.006, 1.028, -.155), WTYPE_ALLDIRS | WTYPE_DIRECTIONAL);
-  this->createWeaponSlot(1, 2, Vector(4.03, .063, .876), WTYPE_ALLDIRS | WTYPE_DIRECTIONAL);
-  this->createWeaponSlot(1, 3, Vector(4.03, -.063, -.876), WTYPE_ALLDIRS | WTYPE_DIRECTIONAL);
-  this->createWeaponSlot(1, 4, Vector(1.431, -.612, 2.691), WTYPE_ALLDIRS | WTYPE_DIRECTIONAL);
-  this->createWeaponSlot(1, 5, Vector(1.431, -.612, -2.691), WTYPE_ALLDIRS | WTYPE_DIRECTIONAL);
-  this->createWeaponSlot(1, 6, Vector(1.431, -.612, 3.254), WTYPE_ALLDIRS | WTYPE_DIRECTIONAL);
-  this->createWeaponSlot(1, 7, Vector(1.431, -.612, -3.254), WTYPE_ALLDIRS | WTYPE_DIRECTIONAL);
-
-
-  this->addWeaponToSlot(1, 0, 0, "RFCannon");
-  this->addWeaponToSlot(1, 0, 1, "RFCannon");
-  this->addWeaponToSlot(1, 0, 2, "RFCannon");
-  this->addWeaponToSlot(1, 0, 3, "RFCannon");
-  this->addWeaponToSlot(1, 1, 0, "RFCannon");
-  this->addWeaponToSlot(1, 1, 1, "RFCannon");
-  this->addWeaponToSlot(1, 1, 2, "RFCannon");
-  this->addWeaponToSlot(1, 1, 3, "RFCannon");
-
-  this->addWeaponToSlot(1, 0, 4, "NadionLaser");
-  this->addWeaponToSlot(1, 0, 5, "NadionLaser");
-  this->addWeaponToSlot(1, 2, 4, "NadionLaser");
-  this->addWeaponToSlot(1, 2, 5, "NadionLaser");
-
-  this->addWeaponToSlot(1, 0, 6, "Disruptor");
-  this->addWeaponToSlot(1, 0, 7, "Disruptor");
-  this->addWeaponToSlot(1, 3, 6, "Disruptor");
-  this->addWeaponToSlot(1, 3, 7, "Disruptor");
-
-
-  this->createWeaponSlot(2, 0, Vector(1.5, 3, 0), WTYPE_ALLDIRS | WTYPE_DIRECTIONAL);
-  this->createWeaponSlot(2, 1, Vector(2.6, 0, 3.0), WTYPE_ALLDIRS | WTYPE_DIRECTIONAL);
-  this->createWeaponSlot(2, 2, Vector(1.5, 0, -.5), WTYPE_ALLDIRS | WTYPE_DIRECTIONAL);
-  this->createWeaponSlot(2, 3, Vector(1.5, 0, .5), WTYPE_ALLDIRS | WTYPE_DIRECTIONAL);
-  this->createWeaponSlot(2, 4, Vector(1.5, 0, .5), WTYPE_ALLDIRS | WTYPE_DIRECTIONAL);
-  this->createWeaponSlot(2, 5, Vector(1.5, 0, -.5), WTYPE_ALLDIRS | WTYPE_DIRECTIONAL);
-
-  this->addWeaponToSlot(2, 0, 2, "SwarmLauncher");
+  this->weaponMan.setSlotCount(8);
+  this->secWeaponMan.setSlotCount(6);
+
+  this->weaponMan.createWeaponSlot(0, 3.006, 1.028, .155, WTYPE_ALLDIRS | WTYPE_DIRECTIONAL);
+  this->weaponMan.createWeaponSlot(1, 3.006, 1.028, -.155, WTYPE_ALLDIRS | WTYPE_DIRECTIONAL);
+  this->weaponMan.createWeaponSlot(2, 4.03, .063, .876, WTYPE_ALLDIRS | WTYPE_DIRECTIONAL);
+  this->weaponMan.createWeaponSlot(3, 4.03, -.063, -.876, WTYPE_ALLDIRS | WTYPE_DIRECTIONAL);
+  this->weaponMan.createWeaponSlot(4, 1.431, -.612, 2.691, WTYPE_ALLDIRS | WTYPE_DIRECTIONAL);
+  this->weaponMan.createWeaponSlot(5, 1.431, -.612, -2.691, WTYPE_ALLDIRS | WTYPE_DIRECTIONAL);
+  this->weaponMan.createWeaponSlot(6, 1.431, -.612, 3.254, WTYPE_ALLDIRS | WTYPE_DIRECTIONAL);
+  this->weaponMan.createWeaponSlot(7, 1.431, -.612, -3.254, WTYPE_ALLDIRS | WTYPE_DIRECTIONAL);
+
+
+  this->weaponMan.addWeaponToSlot(0, 0, "RFCannon");
+  this->weaponMan.addWeaponToSlot(0, 1, "RFCannon");
+  this->weaponMan.addWeaponToSlot(0, 2, "RFCannon");
+  this->weaponMan.addWeaponToSlot(0, 3, "RFCannon");
+  this->weaponMan.addWeaponToSlot(1, 0, "RFCannon");
+  this->weaponMan.addWeaponToSlot(1, 1, "RFCannon");
+  this->weaponMan.addWeaponToSlot(1, 2, "RFCannon");
+  this->weaponMan.addWeaponToSlot(1, 3, "RFCannon");
+
+  this->weaponMan.addWeaponToSlot(0, 4, "NadionLaser");
+  this->weaponMan.addWeaponToSlot(0, 5, "NadionLaser");
+  this->weaponMan.addWeaponToSlot(2, 4, "NadionLaser");
+  this->weaponMan.addWeaponToSlot(2, 5, "NadionLaser");
+
+  this->weaponMan.addWeaponToSlot(0, 6, "Disruptor");
+  this->weaponMan.addWeaponToSlot(0, 7, "Disruptor");
+  this->weaponMan.addWeaponToSlot(3, 6, "Disruptor");
+  this->weaponMan.addWeaponToSlot(3, 7, "Disruptor");
+
+
+  this->secWeaponMan.createWeaponSlot(0, 1.5, 3, 0, WTYPE_ALLDIRS | WTYPE_DIRECTIONAL);
+  this->secWeaponMan.createWeaponSlot(1, 2.6, 0, 3.0, WTYPE_ALLDIRS | WTYPE_DIRECTIONAL);
+  this->secWeaponMan.createWeaponSlot(2, 1.5, 0, -.5, WTYPE_ALLDIRS | WTYPE_DIRECTIONAL);
+  this->secWeaponMan.createWeaponSlot(3, 1.5, 0, .5, WTYPE_ALLDIRS | WTYPE_DIRECTIONAL);
+  this->secWeaponMan.createWeaponSlot(4, 1.5, 0, .5, WTYPE_ALLDIRS | WTYPE_DIRECTIONAL);
+  this->secWeaponMan.createWeaponSlot(5, 1.5, 0, -.5, WTYPE_ALLDIRS | WTYPE_DIRECTIONAL);
+
+  this->secWeaponMan.addWeaponToSlot(0, 2, "SwarmLauncher");
 
 
@@ -231,24 +231,5 @@
   this->cameraNode.addNodeFlags(PNODE_PROHIBIT_CHILD_DELETE);
 
-  // widget handling
-  /*
-  this->electronicWidget = new OrxGui::GLGuiEnergyWidgetVertical();
-  this->electronicWidget->setDisplayedName(std::string(this->getClassName()) + " Electronics:");
-  this->electronicWidget->setSize2D(30,400);
-  this->electronicWidget->setAbsCoor2D(150,200);
-  this->electronicWidget->shiftDir2D(270);
-  this->updateElectronicWidget();
-  this->shieldWidget = new OrxGui::GLGuiEnergyWidgetVertical();
-  this->shieldWidget->setDisplayedName(std::string(this->getClassName()) + " Shield:");
-  this->shieldWidget->setSize2D(30,400);
-  this->shieldWidget->setAbsCoor2D(200,200);
-  this->shieldWidget->shiftDir2D(270);
-  this->updateShieldWidget();
-  if (this->hasPlayer())
-  {
-    State::getPlayer()->hud().setShiledWidget(this->shieldWidget);
-    State::getPlayer()->hud().setEnergyWidget(this->electronicWidget);
-  }
-  */
+
   this->electronicWidget = NULL;
   this->shieldWidget = NULL;
@@ -308,26 +289,6 @@
   this->setSupportedPlaymodes(Playable::Horizontal | Playable::Vertical);
 
-  /// FIXME
-//   this->trail = new Trail( 5, 10, .2, this);
-//   this->trail->setTexture( "textures/engine.png");
-//
-//   this->trailL = new Trail( 5, 10, .2, this);
-//   this->trailL->setTexture( "textures/engine.png");
-//
-//   this->trailR = new ( 5, 10, .2, this);
-//   this->trailR->setTexture( "textures/engine.png");
-
 
   this->toList(OM_GROUP_00);
-
-  //FIXME Just testaddition to show the wobblegrid
-/*
-  this->test  = new Wobblegrid(5);
-  test->setTexture("textures/blub.png");
-
-  test->setAbsCoor( this->getAbsCoor() + Vector(0, 2, 0));
-  test->setParent( this);
-*/
-
 }
 
@@ -350,12 +311,33 @@
   State::getCamera()->setParent(this);
 
-  LoadParam(root, "reactor", this, SpaceShip, setReactor);
-  LoadParam(root, "shield", this, SpaceShip, setShield);
-  LoadParam(root, "armor", this, SpaceShip, setArmor);
-  LoadParam(root, "electronic", this, SpaceShip, setElectronic);
-  LoadParam(root, "engine", this, SpaceShip, setEngine);
-  LoadParam(root, "energyshare", this, SpaceShip, setEnergyShare);
-  LoadParam(root, "weapon", this, SpaceShip, setWeapon);
-
+  LoadParam(root, "setReactor", this, SpaceShip, setReactor)
+  .describe("set reactor output");
+  LoadParam(root, "setShield", this, SpaceShip, setShield)
+  .describe("set shield parameters: current strenght , max strenght, threshhold value (0..1), regeneration rate");
+  LoadParam(root, "setArmor", this, SpaceShip, setArmor)
+  .describe("set armor/health parameters: current strenght , max strenght");
+  LoadParam(root, "setElectronic", this, SpaceShip, setElectronic)
+  .describe("set electronics parameters: current strenght , max strenght, threshhold value (0..1), regeneration rate");
+  LoadParam(root, "setEngine", this, SpaceShip, setEngine)
+  .describe("set base speed");
+  LoadParam(root, "setEnergyShare", this, SpaceShip, setEnergyShare)
+  .describe("set energy partitioning: shield, weapons, engine (sum should be 1)");
+  LoadParam(root, "setWeapon", this, SpaceShip, setWeapon)
+  .describe("set weapon regeneration");
+
+/*
+  LOAD_PARAM_START_CYCLE(root, element);
+  {
+    LoadParamXML_CYCLE(element, "weaponMan", this->weaponMan, WeaponManager, loadWeapons)
+    .describe("loads Weapons");
+  }
+  LOAD_PARAM_END_CYCLE(element);
+
+  LOAD_PARAM_START_CYCLE(root, element);
+  {
+    LoadParamXML_CYCLE(element, "secWeaponMan", this->secWeaponMan, WeaponManager, loadWeapons)
+    .describe("loads Weapons");
+  }
+  LOAD_PARAM_END_CYCLE(element);*/
 }
 
@@ -370,7 +352,11 @@
   bForward = bBackward = bLeft = bRight = bAscend = bDescend = bRollL = bRollR = bFire = bSecFire = false;
 
-  //xMouse = yMouse = 0;
-
-  this->setHealth(80);
+
+//   this->armorCur = this->armorMax;
+  this->setHealth(this->getHealthMax());
+  this->shieldCur = this->shieldMax;
+  this->shieldActive = true;
+  this->electronicCur = this->electronicMax;
+//   this->updateHealth();
   this->velocity = Vector(0.0, 0.0, 0.0);
 }
@@ -383,8 +369,4 @@
   State::getPlayer()->hud().setRadarCenterNode(this->travelNode);
   State::getPlayer()->hud().setOverlayActive(true);
-  //dynamic_cast <OrxGui::GLGuiEnergyWidgetVertical*> (State::getPlayer()->hud().getArmorWidget())->setDisplayedName("Armor");
-  //dynamic_cast<Element2D*>(this->secWeaponMan.getFixedTarget())->setVisibility( true);
-  //this->attachCamera();
- // this->setPlaymode(Playable::Horizontal);
 }
 
@@ -396,6 +378,4 @@
   State::getCamera()->setEventHandling(true);
   State::getPlayer()->hud().setRadarCenterNode(NULL);
-  //dynamic_cast<Element2D*>(this->secWeaponMan.getFixedTarget())->setVisibility( false);
-  //this->detachCamera();
 }
 
@@ -408,6 +388,4 @@
   if(this->hasPlayer())
     Playable::postSpawn();
-
-  //setCollision(new CollisionCluster(1.0, Vector(0,0,0)));
 }
 
@@ -695,5 +673,5 @@
       pDamage += this->shieldCur;
       if( !this->shieldActive) {
-        this->armorCur -= pDamage / 2; // remaining damages hits armor at half rate
+        this->decreaseHealth( pDamage / 2); // remaining damages hits armor at half rate
         this->electronicCur -= eDamage;
       }
@@ -701,8 +679,8 @@
   }
   else {
-    this->armorCur = this->armorCur - pDamage;
+    this->decreaseHealth(pDamage);
     this->electronicCur = this->electronicCur - eDamage;
   }
-  if( this->armorCur <= 0) { /* FIXME implement shipcrash*/ }
+  if( this->getHealth() <= 0) { /* FIXME implement shipcrash*/ }
     this->destroy(this);
 
@@ -710,16 +688,16 @@
   updateShieldWidget();
 
-  this->setHealth( this->armorCur);
+//   this->setHealth( this->armorCur);
 }
 
 
 void SpaceShip::regen(float time){
-  float tmp;
-  if (this->armorCur != this->armorMax || this->armorRegen != 0){
-    tmp = this->armorCur + this->armorRegen * time;
-    if ( tmp > electronicMax)
-      this->armorCur = this->armorMax;
+  static float tmp, armorCur, armorMax;
+  if (armorCur != armorMax || this->armorRegen != 0){
+    tmp = armorCur + armorRegen * time;
+    if ( tmp > armorMax)
+      armorCur = armorMax;
     else
-      this->armorCur = tmp;
+      armorCur = tmp;
   }
   if (this->shieldCur != this->shieldMax || this->shieldRegen != 0){
@@ -1205,8 +1183,8 @@
 };
 
-void SpaceShip::addWeaponToSlot(int wm, int config, int slot, const std::string& weaponName){
-  if (wm == 1) { this->weaponMan.addWeapon( Weapon::createWeapon( weaponName ), config, slot); }
-  if (wm == 1) { this->weaponMan.addWeapon( Weapon::createWeapon( weaponName ), config, slot); }
-  else return;
-}
-
+// void SpaceShip::addWeaponToSlot(int wm, int config, int slot, const std::string& weaponName){
+//   if (wm == 1) { this->weaponMan.addWeapon( Weapon::createWeapon( weaponName ), config, slot); }
+//   if (wm == 1) { this->weaponMan.addWeapon( Weapon::createWeapon( weaponName ), config, slot); }
+//   else return;
+// }
+
