Index: code/branches/main_reto_vs05/src/weapon/weapon_manager.cc
===================================================================
--- code/branches/main_reto_vs05/src/weapon/weapon_manager.cc	(revision 189)
+++ 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 189)
+++ 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;
