Index: code/branches/main_reto_vs05/src/orxonox_ship.cc
===================================================================
--- code/branches/main_reto_vs05/src/orxonox_ship.cc	(revision 193)
+++ code/branches/main_reto_vs05/src/orxonox_ship.cc	(revision 194)
@@ -26,9 +26,10 @@
  */
 
-#include "OgreSceneManager.h"
+#include "OgreMath.h"
+#include "OgreVector3.h"
+#include "OgreQuaternion.h"
 #include "OgreSceneNode.h"
 #include "OgreEntity.h"
-#include "OgreVector3.h"
-#include "OgreStringConverter.h"
+#include "OgreSceneManager.h"
 
 #include "inertial_node.h"
@@ -197,7 +198,7 @@
   * @return Bullet containing speed and entity.
   */
-  void OrxonoxShip::fire()
-  {
-    mainWeapon_->primaryFireRequest();
+  WeaponManager* OrxonoxShip::getMainWeapon()
+  {
+    return mainWeapon_;
   }
 
Index: code/branches/main_reto_vs05/src/orxonox_ship.h
===================================================================
--- code/branches/main_reto_vs05/src/orxonox_ship.h	(revision 193)
+++ code/branches/main_reto_vs05/src/orxonox_ship.h	(revision 194)
@@ -54,5 +54,5 @@
     Ogre::Vector3 getSpeed();
 
-	  void fire();
+    weapon::WeaponManager* getMainWeapon();
 
 	  bool tick(unsigned long, Ogre::Real);
Index: code/branches/main_reto_vs05/src/run_manager.cc
===================================================================
--- code/branches/main_reto_vs05/src/run_manager.cc	(revision 193)
+++ code/branches/main_reto_vs05/src/run_manager.cc	(revision 194)
@@ -88,5 +88,5 @@
   */
   RunManager::RunManager(OgreControl * ogre)
-        : ogre_(ogre), window_(ogre->getRenderWindow()), leftButtonDown_(false),
+        : ogre_(ogre), window_(ogre->getRenderWindow()), //leftButtonDown_(false),
         statsOn_(true), screenShotCounter_(0), timeUntilNextToggle_(0),
         filtering_(TFO_BILINEAR), aniso_(1), sceneDetailIndex_(0),
@@ -109,9 +109,4 @@
     bulletManager_ = new BulletManager(sceneMgr_);
     WeaponManager::loadWeapons();
-
-    // TODO: Use STL to make life easier. But it works this way too..
-    /*bullets_ = new Bullet*[10];
-    bulletsIndex_ = 0;
-    bulletsSize_ = 10;*/
 
 
@@ -220,9 +215,4 @@
 
     WeaponManager::destroyWeapons();
-
-    // clean up the bullet list
-    /*for (int i = 0; i < bulletsIndex_; i++)
-      delete bullets_[i];
-    delete bullets_;*/
   }
 
@@ -256,10 +246,4 @@
     bulletManager_->tick(time, deltaTime);
 
-    /*for (int i = 0; i < bulletsIndex_; i++)
-    {
-      bullets_[i]->node_->translate(bullets_[i]->speed_*deltaTime);
-      bullets_[i]->node_->yaw(Degree(deltaTime*100));
-      bullets_[i]->node_->roll(Degree(deltaTime*300));
-    }*/
 
     // HUMAN INTERFACE
@@ -366,4 +350,7 @@
     else
       playerShip_->setYThrust(0);
+
+    if (keyboard_->isKeyDown(KC_G))
+      playerShip_->getMainWeapon()->addAction(WeaponManager::RELOAD);
 
     if( keyboard_->isKeyDown(KC_ESCAPE) || keyboard_->isKeyDown(KC_Q) )
@@ -457,42 +444,12 @@
     const MouseState &ms = mouse_->getMouseState();
 
-    // This is a 'hack' to show some flying barrels..
-    // Usually, the Bullet created by the ship should be managed
-    // by the physics engine..
-    if (ms.buttonDown(MB_Left) && !leftButtonDown_)
-    {
-      // Prevent continuous fire for the moment.
-      leftButtonDown_ = true;
-
-      playerShip_->fire();
-      
-      // let ship fire one shot with its only weapon (Barrels..)
-      /*Bullet *tempBullet = playerShip_->fire();
-
-      // resize array if neccessary (double the size then)
-      if (bulletsIndex_ >= bulletsSize_)
-      {
-        // redimension the array
-        Bullet **tempArray = new Bullet*[2*bulletsSize_];
-        for (int i = 0; i < bulletsSize_; i++)
-          tempArray[i] = bullets_[i];
-        bulletsSize_ *= 2;
-        delete bullets_;
-        bullets_ = tempArray;
-      }
-
-      // add the bullet to the list
-      bullets_[bulletsIndex_++] = tempBullet;*/
-
-    }
-    else if (!ms.buttons)
-      leftButtonDown_ = false;
-
-    // space ship steering. This should definitely be done in the steering object
-    // Simply give it the mouse movements.
+    if (ms.buttonDown(MB_Left))
+      playerShip_->getMainWeapon()->primaryFireRequest();
+
+    if (ms.buttonDown(MB_Right))
+      playerShip_->getMainWeapon()->secondaryFireRequest();
+
     playerShip_->turnUpAndDown(Radian(ms.Y.rel * mouseSensitivity_));
     playerShip_->turnLeftAndRight(Radian(ms.X.rel * mouseSensitivity_));
-    //playerShip_->mRootNode->pitch(Degree(-ms.Y.rel * 0.13), Ogre::Node::TransformSpace::TS_LOCAL);
-    //playerShip_->mRootNode->yaw(Degree(-ms.X.rel * 0.13), Ogre::Node::TransformSpace::TS_PARENT);
 
     // keep rendering
Index: code/branches/main_reto_vs05/src/run_manager.h
===================================================================
--- code/branches/main_reto_vs05/src/run_manager.h	(revision 193)
+++ code/branches/main_reto_vs05/src/run_manager.h	(revision 194)
@@ -93,5 +93,5 @@
 	  // just to stop toggles flipping too fast
 	  Ogre::Real timeUntilNextToggle_;
-	  bool leftButtonDown_;
+	  //bool leftButtonDown_;
 	  Ogre::TextureFilterOptions filtering_;
 	  int aniso_;
Index: code/branches/main_reto_vs05/src/weapon/weapon_manager.cc
===================================================================
--- code/branches/main_reto_vs05/src/weapon/weapon_manager.cc	(revision 193)
+++ code/branches/main_reto_vs05/src/weapon/weapon_manager.cc	(revision 194)
@@ -52,11 +52,8 @@
         bulletCounter_(0), primaryFireRequest_(false), currentState_(IDLE),
         secondaryFireRequest_(false), selectedWeapon_(0),
-        bulletManager_(bulletManager),
-        actionListReadIndex_(0), actionListWriteIndex_(0)
+        bulletManager_(bulletManager), secondaryFired_(false),
+        timeSinceNextActionAdded_(0), actionAdded_(false), nextAction_(NOTHING)
   {
   	slots_ = new Weapon*[slotSize];
-    actionList_ = new Action[ACTION_LIST_SIZE];
-    for (int i = 0; i < ACTION_LIST_SIZE; i++)
-      actionList_[i] = NOTHING;
   }
 
@@ -66,6 +63,4 @@
     if (slots_)
       delete slots_;
-    if (actionList_)
-      delete actionList_;
   }
 
@@ -90,8 +85,8 @@
   bool WeaponManager::addAction(const Action act)
   {
-    if (actionList_[actionListWriteIndex_] == NOTHING)
-    {
-      actionList_[actionListWriteIndex_] = act;
-      actionListWriteIndex_ = (actionListWriteIndex_ + 1) % ACTION_LIST_SIZE;
+    if (nextAction_ != NOTHING)
+    {
+      nextAction_ = act;
+      actionAdded_ = true;
       return true;
     }
@@ -109,8 +104,4 @@
   void WeaponManager::primaryFire()
   {
-    currentState_ = PRIMARY_FIRE;
-
-    // TODO: add the name of the weapon manager. but for that,
-    // the factory is required.
     SceneNode *temp = sceneMgr_->getRootSceneNode()->createChildSceneNode(
           node_->getSceneNode()->getWorldPosition(),
@@ -124,20 +115,50 @@
     speed += node_->getWorldSpeed();
 
+	  temp->setScale(Vector3(1, 1, 1) * 4);
+	  temp->yaw(Degree(-90));
+
+	  bulletManager_->addBullet(new Bullet(temp, bulletEntity, speed));
+  }
+
+
+  void WeaponManager::primaryFiring(unsigned int time)
+  {
+    if (time > 100)
+    {
+      currentState_ = IDLE;
+    }
+  }
+
+
+  void WeaponManager::secondaryFireRequest()
+  {
+    secondaryFireRequest_ = true;
+  }
+
+
+  void WeaponManager::secondaryFire()
+  {
+    SceneNode *temp = sceneMgr_->getRootSceneNode()->createChildSceneNode(
+          node_->getSceneNode()->getWorldPosition(),
+          node_->getSceneNode()->getWorldOrientation());
+
+    Entity* bulletEntity = sceneMgr_->createEntity("BulletEntity"
+          + StringConverter::toString(bulletCounter_++), "Barrel.mesh");
+
+    Vector3 speed = (temp->getOrientation() * Vector3(0, 0, -1))
+          .normalisedCopy() * slots_[selectedWeapon_]->bulletSpeed_*0.5;
+    speed += node_->getWorldSpeed();
+
 	  temp->setScale(Vector3(1, 1, 1) * 10);
 	  temp->yaw(Degree(-90));
 
 	  bulletManager_->addBullet(new Bullet(temp, bulletEntity, speed));
-  
-    currentState_ = IDLE;
-  }
-
-
-  void WeaponManager::secondaryFireRequest()
-  {
-    secondaryFireRequest_ = true;
-  }
-
-  void WeaponManager::secondaryFire()
-  {
+  }
+
+
+  void WeaponManager::secondaryFiring(unsigned int time)
+  {
+    if (time > 250)
+      currentState_ = IDLE;
   }
 
@@ -149,44 +170,69 @@
       return true;
 
+    // process action adder
+    if (actionAdded_)
+    {
+      timeSinceNextActionAdded_ = time;
+      actionAdded_ = false;
+    }
+
     switch (currentState_)
     {
     case IDLE:
-      // first, process actions
-      if (actionList_[actionListReadIndex_] != NOTHING)
+      // first, process next action
+      if (nextAction_ != NOTHING)
       {
-        actionListReadIndex_ = (actionListReadIndex_ + 1) % ACTION_LIST_SIZE;
-        break;
+        actionStartTime_ = time;
+        switch (nextAction_)
+        {
+        case RELOAD:
+          break;
+
+        case CHANGE_AMMO:
+          break;
+
+        case SPECIAL:
+          break;
+
+        default:
+          break;
+        }
+
+        // pay attention when multithreaded!
+        nextAction_ = NOTHING;
       }
-
-      switch (actionList_[actionListReadIndex_])
+      else
       {
-      case RELOAD:
-        break;
-
-      case ZOOM_IN:
-        break;
-
-      case ZOOM_OUT:
-        break;
-
-      default:
-        break;
+        // secondly, execute firing
+        if (primaryFireRequest_ && !(secondaryFired_ && secondaryFireRequest_))
+        {
+          actionStartTime_ = time;
+          currentState_ = PRIMARY_FIRE;
+          secondaryFired_ = false;
+          primaryFire();
+        }
+        else if (secondaryFireRequest_)
+        {
+          actionStartTime_ = time;
+          currentState_ = SECONDARY_FIRE;
+          secondaryFired_ = true;
+          secondaryFire();
+        }
       }
 
-      // secondly, execute firing
-      if (primaryFireRequest_)
-        primaryFire();
-      else if (secondaryFireRequest_)
-        secondaryFire();
-
       break;
 
     case PRIMARY_FIRE:
+      primaryFiring((unsigned int)(time - actionStartTime_));
       break;
 
     case SECONDARY_FIRE:
+      secondaryFiring((unsigned int)(time - actionStartTime_));
       break;
 
     case RELOADING:
+      break;
+
+    case CHANGING_AMMO:
       break;
     }
@@ -194,4 +240,7 @@
     primaryFireRequest_ = false;
     secondaryFireRequest_ = false;
+
+    if (time - timeSinceNextActionAdded_ > nextActionValidityPeriod_)
+      nextAction_ = NOTHING;
 
     return true;
@@ -205,5 +254,5 @@
     for (int i = 0; i < 5; i++)
       weaponList_s[i] = NULL;
-    weaponList_s[0] = new Weapon("Barrel Gun", 10, 2, 500);
+    weaponList_s[0] = new Weapon("Barrel Gun", 10, 2, 1000);
     return true;
   }
Index: code/branches/main_reto_vs05/src/weapon/weapon_manager.h
===================================================================
--- code/branches/main_reto_vs05/src/weapon/weapon_manager.h	(revision 193)
+++ code/branches/main_reto_vs05/src/weapon/weapon_manager.h	(revision 194)
@@ -44,6 +44,6 @@
       NOTHING  = 0,
       RELOAD   = 1,
-      ZOOM_IN  = 2,
-      ZOOM_OUT = 3
+      CHANGE_AMMO  = 2,
+      SPECIAL  = 3
     };
 
@@ -53,5 +53,6 @@
       PRIMARY_FIRE = 1,
       SECONDARY_FIRE = 2,
-      RELOADING = 4
+      RELOADING = 3,
+      CHANGING_AMMO = 4,
     };
 
@@ -77,5 +78,9 @@
     void primaryFire();
 
+    void primaryFiring(unsigned int);
+
     void secondaryFire();
+
+    void secondaryFiring(unsigned int);
 
   public:
@@ -97,9 +102,13 @@
     bool secondaryFireRequest_;
 
+    unsigned long actionStartTime_;
+
     State currentState_;
+    bool secondaryFired_;
 
-    Action *actionList_;
-    int actionListReadIndex_;
-    int actionListWriteIndex_;
+    Action nextAction_;
+    bool actionAdded_;
+    unsigned long timeSinceNextActionAdded_;
+    static const unsigned long nextActionValidityPeriod_ = 500;
 
     static Weapon **weaponList_s;
