Index: code/branches/main_reto/src/CMakeLists.txt
===================================================================
--- code/branches/main_reto/src/CMakeLists.txt	(revision 189)
+++ code/branches/main_reto/src/CMakeLists.txt	(revision 190)
@@ -33,2 +33,4 @@
 TARGET_LINK_LIBRARIES(../bin/main ${OGRE_LIBRARIES} ${OIS_LIBRARIES} ${CEGUI_LIBRARIES} ${CEGUI_OGRE_LIBRARIES})
 
+#add main source dir
+ADD_SUBDIRECTORY(weapon)
Index: code/branches/main_reto/src/ammunition_dump.cc
===================================================================
--- code/branches/main_reto/src/ammunition_dump.cc	(revision 189)
+++ 	(revision )
@@ -1,42 +1,0 @@
-/*
- *   ORXONOX - the hottest 3D action shooter ever to exist
- *
- *
- *   License notice:
- *
- *   This program is free software: you can redistribute it and/or modify
- *   it under the terms of the GNU General Public License as published by
- *   the Free Software Foundation, either version 3 of the License, or
- *   (at your option) any later version.
- *
- *   This program is distributed in the hope that it will be useful,
- *   but WITHOUT ANY WARRANTY; without even the implied warranty of
- *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *   GNU General Public License for more details.
- *
- *   You should have received a copy of the GNU General Public License
- *   along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
- *
- *   Author:
- *      Reto Grieder
- *   Co-authors:
- *      ...
- *
- */
-
-#include "ammunition_dump.h"
-
-
-namespace orxonox {
-
-  AmmunitionDump::AmmunitionDump()
-  {
-  }
-
-
-  AmmunitionDump::~AmmunitionDump()
-  {
-  }
-
-}
Index: code/branches/main_reto/src/ammunition_dump.h
===================================================================
--- code/branches/main_reto/src/ammunition_dump.h	(revision 189)
+++ 	(revision )
@@ -1,53 +1,0 @@
-/*
- *   ORXONOX - the hottest 3D action shooter ever to exist
- *
- *
- *   License notice:
- *
- *   This program is free software: you can redistribute it and/or modify
- *   it under the terms of the GNU General Public License as published by
- *   the Free Software Foundation, either version 3 of the License, or
- *   (at your option) any later version.
- *
- *   This program is distributed in the hope that it will be useful,
- *   but WITHOUT ANY WARRANTY; without even the implied warranty of
- *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *   GNU General Public License for more details.
- *
- *   You should have received a copy of the GNU General Public License
- *   along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
- *
- *   Author:
- *      Reto Grieder
- *   Co-authors:
- *      ...
- *
- */
-
-
-#ifndef AmmunitionDump_H
-#define AmmunitionDump_H
-
-#include "OgrePrerequisites.h"
-
-#include "orxonox_prerequisites.h"
-
-
-namespace orxonox {
-
-  class AmmunitionDump
-  {
-  public:
-	  AmmunitionDump();
-	  ~AmmunitionDump();
-
-  protected:
-
-  protected:
-
-  };
-
-}
-
-#endif /* AmmunitionDump_H */
Index: code/branches/main_reto/src/barrel_gun.cc
===================================================================
--- code/branches/main_reto/src/barrel_gun.cc	(revision 189)
+++ 	(revision )
@@ -1,46 +1,0 @@
-/*
- *   ORXONOX - the hottest 3D action shooter ever to exist
- *
- *
- *   License notice:
- *
- *   This program is free software: you can redistribute it and/or modify
- *   it under the terms of the GNU General Public License as published by
- *   the Free Software Foundation, either version 3 of the License, or
- *   (at your option) any later version.
- *
- *   This program is distributed in the hope that it will be useful,
- *   but WITHOUT ANY WARRANTY; without even the implied warranty of
- *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *   GNU General Public License for more details.
- *
- *   You should have received a copy of the GNU General Public License
- *   along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
- *
- *   Author:
- *      Reto Grieder
- *   Co-authors:
- *      ...
- *
- */
-
-#include "OgreSceneManager.h"
-
-#include "barrel_gun.h"
-
-
-namespace orxonox {
-  using namespace Ogre;
-
-  BarrelGun::BarrelGun(SceneManager *sceneMgr) : sceneMgr_(sceneMgr)
-  {
-  	
-  }
-
-
-  BarrelGun::~BarrelGun()
-  {
-  }
-
-}
Index: code/branches/main_reto/src/barrel_gun.h
===================================================================
--- code/branches/main_reto/src/barrel_gun.h	(revision 189)
+++ 	(revision )
@@ -1,57 +1,0 @@
-/*
- *   ORXONOX - the hottest 3D action shooter ever to exist
- *
- *
- *   License notice:
- *
- *   This program is free software: you can redistribute it and/or modify
- *   it under the terms of the GNU General Public License as published by
- *   the Free Software Foundation, either version 3 of the License, or
- *   (at your option) any later version.
- *
- *   This program is distributed in the hope that it will be useful,
- *   but WITHOUT ANY WARRANTY; without even the implied warranty of
- *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *   GNU General Public License for more details.
- *
- *   You should have received a copy of the GNU General Public License
- *   along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
- *
- *   Author:
- *      Reto Grieder
- *   Co-authors:
- *      ...
- *
- */
-
-
-#ifndef BARREL_GUN_H
-#define BARREL_GUN_H
-
-#include "OgrePrerequisites.h"
-
-#include "orxonox_prerequisites.h"
-
-
-namespace orxonox {
-
-  class BarrelGun
-  {
-  public:
-    BarrelGun(Ogre::SceneManager*);
-	  virtual ~BarrelGun();
-
-  protected:
-
-  public:
-    Ogre::SceneManager *sceneMgr_;
-	  Ogre::Entity *weaponEntity_;
-
-  protected:
-
-  };
-
-}
-
-#endif /* BARREL_GUN_H */
Index: code/branches/main_reto/src/bullet.cc
===================================================================
--- code/branches/main_reto/src/bullet.cc	(revision 189)
+++ 	(revision )
@@ -1,49 +1,0 @@
-/*
- *   ORXONOX - the hottest 3D action shooter ever to exist
- *
- *
- *   License notice:
- *
- *   This program is free software: you can redistribute it and/or modify
- *   it under the terms of the GNU General Public License as published by
- *   the Free Software Foundation, either version 3 of the License, or
- *   (at your option) any later version.
- *
- *   This program is distributed in the hope that it will be useful,
- *   but WITHOUT ANY WARRANTY; without even the implied warranty of
- *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *   GNU General Public License for more details.
- *
- *   You should have received a copy of the GNU General Public License
- *   along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
- *
- *   Author:
- *      Reto Grieder
- *   Co-authors:
- *      ...
- *
- */
-
-#include "OgreSceneNode.h"
-#include "OgreEntity.h"
-#include "OgreVector3.h"
-
-#include "bullet.h"
-
-
-namespace orxonox {
-  using namespace Ogre;
-
-  Bullet::Bullet(SceneNode *node, Entity *entity, Vector3 speed)
-    : node_(node), entity_(entity), speed_(speed)
-  {
-	  node_->attachObject(entity_);
-  }
-
-
-  Bullet::~Bullet()
-  {
-  }
-
-}
Index: code/branches/main_reto/src/bullet.h
===================================================================
--- code/branches/main_reto/src/bullet.h	(revision 189)
+++ 	(revision )
@@ -1,58 +1,0 @@
-/*
- *   ORXONOX - the hottest 3D action shooter ever to exist
- *
- *
- *   License notice:
- *
- *   This program is free software: you can redistribute it and/or modify
- *   it under the terms of the GNU General Public License as published by
- *   the Free Software Foundation, either version 3 of the License, or
- *   (at your option) any later version.
- *
- *   This program is distributed in the hope that it will be useful,
- *   but WITHOUT ANY WARRANTY; without even the implied warranty of
- *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *   GNU General Public License for more details.
- *
- *   You should have received a copy of the GNU General Public License
- *   along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
- *
- *   Author:
- *      Reto Grieder
- *   Co-authors:
- *      ...
- *
- */
-
-
-#ifndef BULLET_H
-#define BULLET_H
-
-#include "OgrePrerequisites.h"
-
-#include "orxonox_prerequisites.h"
-
-
-namespace orxonox {
-
-  class Bullet
-  {
-  public:
-	  Bullet(Ogre::SceneNode*, Ogre::Entity*, Ogre::Vector3);
-	  ~Bullet();
-
-  protected:
-
-  public:
-    Ogre::SceneNode *node_;
-	  Ogre::Entity *entity_;
-	  Ogre::Vector3 speed_;
-
-  protected:
-
-  };
-
-}
-
-#endif /* BULLET_H */
Index: code/branches/main_reto/src/camera_manager.h
===================================================================
--- code/branches/main_reto/src/camera_manager.h	(revision 189)
+++ code/branches/main_reto/src/camera_manager.h	(revision 190)
Index: code/branches/main_reto/src/inertial_node.cc
===================================================================
--- code/branches/main_reto/src/inertial_node.cc	(revision 190)
+++ code/branches/main_reto/src/inertial_node.cc	(revision 190)
@@ -0,0 +1,126 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software: you can redistribute it and/or modify
+ *   it under the terms of the GNU General Public License as published by
+ *   the Free Software Foundation, either version 3 of the License, or
+ *   (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ *
+ *   Author:
+ *      Reto Grieder
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#include "OgreSceneNode.h"
+#include "OgreVector3.h"
+
+#include "inertial_node.h"
+
+
+namespace orxonox {
+  using namespace Ogre;
+
+  InertialNode::InertialNode(SceneNode *node, Vector3 speed)
+        : node_(node), speed_(speed), childListSize_(4), childListIndex_(0),
+        parentNode_(NULL)
+  {
+    childList_ = new InertialNode*[childListSize_];
+  }
+
+
+  InertialNode::InertialNode(orxonox::InertialNode *parentNode, Vector3 speed)
+        : parentNode_(parentNode), childListSize_(4), childListIndex_(0), speed_(speed)
+  {
+    childList_ = new InertialNode*[childListSize_];
+    node_ = parentNode_->getSceneNode()->createChildSceneNode();
+  }
+
+
+  InertialNode::~InertialNode()
+  {
+    if (childList_)
+    {
+      for (int i = 0; i < childListIndex_; i++)
+        if (childList_[i])
+          delete childList_[i];
+      delete childList_;
+    }
+  }
+
+
+  InertialNode* InertialNode::createChildNode()
+  {
+    InertialNode *temp = new InertialNode(this);
+    addChild(temp);
+    return temp;
+  }
+
+
+  InertialNode* InertialNode::getParentNode()
+  {
+    return parentNode_;
+  }
+
+
+  SceneNode* InertialNode::getSceneNode()
+  {
+    return node_;
+  }
+
+
+  Vector3 InertialNode::getSpeed()
+  {
+    return speed_;
+  }
+
+
+  Vector3 InertialNode::getWorldSpeed()
+  {
+    // go through the tree of Inertial nodes
+    Vector3 speed = speed_;
+    InertialNode *temp = parentNode_;
+    while (temp != NULL)
+    {
+      speed = temp->getSceneNode()->getOrientation() * speed + temp->getSpeed();
+      temp = temp->getParentNode();
+    }
+    return speed;
+  }
+
+
+  void InertialNode::addSpeed(Vector3 speed)
+  {
+    speed_ += speed;
+  }
+
+
+  void InertialNode::addChild(orxonox::InertialNode *node)
+  {
+    if (childListIndex_ == childListSize_)
+    {
+      // redimension the array
+      InertialNode **tempArray = new InertialNode*[2*childListSize_];
+      for (int i = 0; i < childListSize_; i++)
+        tempArray[i] = childList_[i];
+      childListSize_ *= 2;
+      delete childList_;
+      childList_ = tempArray;
+    }
+    childList_[childListIndex_++] = node;
+  }
+
+}
Index: code/branches/main_reto/src/inertial_node.h
===================================================================
--- code/branches/main_reto/src/inertial_node.h	(revision 190)
+++ code/branches/main_reto/src/inertial_node.h	(revision 190)
@@ -0,0 +1,77 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software: you can redistribute it and/or modify
+ *   it under the terms of the GNU General Public License as published by
+ *   the Free Software Foundation, either version 3 of the License, or
+ *   (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ *
+ *   Author:
+ *      Reto Grieder
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+
+#ifndef INERTIAL_NODE_H
+#define INERTIAL_NODE_H
+
+#include "OgrePrerequisites.h"
+
+#include "orxonox_prerequisites.h"
+
+
+namespace orxonox {
+
+  class InertialNode
+  {
+  public:
+    InertialNode(Ogre::SceneNode*, Ogre::Vector3);
+	  ~InertialNode();
+
+    InertialNode* createChildNode();
+
+    InertialNode* getParentNode();
+
+    Ogre::SceneNode* getSceneNode();
+
+    Ogre::Vector3 getSpeed();
+
+    Ogre::Vector3 getWorldSpeed();
+
+    void addSpeed(Ogre::Vector3);
+
+  protected:
+    InertialNode(InertialNode*, Ogre::Vector3 speed = Ogre::Vector3::ZERO);
+    void addChild(InertialNode*);
+
+  public:
+
+  protected:
+    InertialNode **childList_;
+    int childListSize_;
+    int childListIndex_;
+
+    Ogre::SceneNode *node_;
+	  Ogre::Vector3 speed_;
+
+    InertialNode* parentNode_;
+
+  };
+
+}
+
+#endif /* INERTIAL_NODE_H */
Index: code/branches/main_reto/src/main.cc
===================================================================
--- code/branches/main_reto/src/main.cc	(revision 189)
+++ code/branches/main_reto/src/main.cc	(revision 190)
@@ -44,5 +44,5 @@
   {
     try {
-      // create an orxonox aplication and run it
+      // create an orxonox application and run it
       orxonox::Orxonox myApp;
 
Index: code/branches/main_reto/src/ogre_control.h
===================================================================
--- code/branches/main_reto/src/ogre_control.h	(revision 189)
+++ code/branches/main_reto/src/ogre_control.h	(revision 190)
Index: code/branches/main_reto/src/orxonox.h
===================================================================
--- code/branches/main_reto/src/orxonox.h	(revision 189)
+++ code/branches/main_reto/src/orxonox.h	(revision 190)
Index: code/branches/main_reto/src/orxonox_prerequisites.h
===================================================================
--- code/branches/main_reto/src/orxonox_prerequisites.h	(revision 189)
+++ code/branches/main_reto/src/orxonox_prerequisites.h	(revision 190)
@@ -32,7 +32,6 @@
 namespace orxonox {
 
-  class AmmunitionDump;
-  class Bullet;
   class CameraManager;
+  class InertialNode;
   class OgreControl;
   class Orxonox;
@@ -40,6 +39,15 @@
   class OrxonoxScene;
   class RunManager;
-  class Weapon;
-  class WeaponManager;
+
+
+  namespace weapon {
+
+    class AmmunitionDump;
+    class Bullet;
+    class BulletManager;
+    class Weapon;
+    class WeaponManager;
+
+  }
 
 }
Index: code/branches/main_reto/src/orxonox_scene.h
===================================================================
--- code/branches/main_reto/src/orxonox_scene.h	(revision 189)
+++ code/branches/main_reto/src/orxonox_scene.h	(revision 190)
Index: code/branches/main_reto/src/orxonox_ship.cc
===================================================================
--- code/branches/main_reto/src/orxonox_ship.cc	(revision 189)
+++ code/branches/main_reto/src/orxonox_ship.cc	(revision 190)
@@ -33,11 +33,14 @@
 
 #include "bullet.h"
+#include "bullet_manager.h"
+#include "inertial_node.h"
+#include "weapon_manager.h"
 
 #include "orxonox_ship.h"
-#include "weapon_manager.h"
 
 
 namespace orxonox {
   using namespace Ogre;
+  using namespace weapon;
 
   /**
@@ -62,9 +65,11 @@
   * @param mNode The scene node which the ship will be attached to later.
   */
-  OrxonoxShip::OrxonoxShip(SceneManager *sceneMgr, SceneNode *node)
-	      : sceneMgr_(sceneMgr), rootNode_(node), currentSpeed_(Vector3(0, 0, 0)),
+  OrxonoxShip::OrxonoxShip(SceneManager *sceneMgr, SceneNode *node,
+        BulletManager *bulletManager)
+	      : sceneMgr_(sceneMgr), //currentSpeed_(Vector3(0, 0, 0)),
         baseThrust_(1000), currentThrust_(Vector3::ZERO),
-        objectCounter_(0), bulletSpeed_(400)
-  {
+        objectCounter_(0), bulletManager_(bulletManager)//, bulletSpeed_(400)
+  {
+    rootNode_ = new InertialNode(node, Vector3::ZERO);
   }
 
@@ -76,4 +81,8 @@
   OrxonoxShip::~OrxonoxShip()
   {
+    if (mainWeapon_)
+      delete mainWeapon_;
+    if (rootNode_)
+      delete rootNode_;
   }
 
@@ -95,12 +104,14 @@
 	  // TODO: names must be unique! use static variables..
 	  shipEntity_ = sceneMgr_->createEntity("Ship", "fish.mesh");
-	  SceneNode *fishNode = rootNode_->createChildSceneNode("fishNode");
-	  fishNode->yaw(Degree(-90));
-	  fishNode->attachObject(shipEntity_);
-	  fishNode->setScale(Vector3(10, 10, 10));
+	  InertialNode *fishNode = rootNode_->createChildNode();
+    fishNode->getSceneNode()->yaw(Degree(-90));
+	  fishNode->getSceneNode()->attachObject(shipEntity_);
+	  fishNode->getSceneNode()->setScale(Vector3(10, 10, 10));
 
     // initialise weapon(s)
-    SceneNode *mainWeaponNode = rootNode_->createChildSceneNode("mainWeaponNode");
-    mainWeapon_ = new WeaponManager(sceneMgr_, mainWeaponNode, 1);
+    InertialNode *mainWeaponNode = rootNode_->createChildNode();
+    mainWeapon_ = new WeaponManager(sceneMgr_, mainWeaponNode,
+          bulletManager_, 1);
+    mainWeapon_->addWeapon("Barrel Gun");
 
 	  return true;
@@ -110,10 +121,9 @@
   /**
   * Gets the ship to accelerate in the current direction.
-  * The value should be between 0 and 1, with one beeing full thrust and 0 none.
+  * The value should be between 0 and 1, with one beeing full thrust and 0 none
   * @param value Acceleration between 0 and 1
   */
   void OrxonoxShip::setMainThrust(const Real value)
   {
-	  //currentThrust_ = value * baseThrust_;
     currentThrust_.z = value * baseThrust_;
   }
@@ -122,10 +132,9 @@
   /**
   * Gets the ship to accelerate sideways regarding the current direction.
-  * The value should be between 0 and 1, with one beeing full thrust and 0 none.
+  * The value should be between 0 and 1, with one beeing full thrust and 0 none
   * @param value Acceleration between 0 and 1
   */
   void OrxonoxShip::setSideThrust(const Real value)
   {
-	  //currentSideThrust_ = value * baseThrust_;
     currentThrust_.x = value * baseThrust_;
   }
@@ -134,10 +143,9 @@
   /**
   * Gets the ship to accelerate up and down.
-  * The value should be between 0 and 1, with one beeing full thrust and 0 none.
+  * The value should be between 0 and 1, with one beeing full thrust and 0 none
   * @param value Acceleration between 0 and 1
   */
   void OrxonoxShip::setYThrust(const Real value)
   {
-    //currentYThrust_ = value * baseThrust_;
     currentThrust_.y = value * baseThrust_;
   }
@@ -150,5 +158,5 @@
   void OrxonoxShip::turnUpAndDown(const Radian &angle)
   {
-    rootNode_->pitch(-angle, Node::TS_LOCAL);
+    rootNode_->getSceneNode()->pitch(-angle, Node::TS_LOCAL);
   }
 
@@ -160,5 +168,5 @@
   void OrxonoxShip::turnLeftAndRight(const Radian &angle)
   {
-    rootNode_->yaw(-angle, Node::TS_PARENT);
+    rootNode_->getSceneNode()->yaw(-angle, Node::TS_PARENT);
   }
 
@@ -170,5 +178,5 @@
   Vector3 OrxonoxShip::getSpeed()
   {
-    return currentSpeed_;
+    return rootNode_->getSpeed();
   }
 
@@ -177,5 +185,5 @@
   * @return The Root Node.
   */
-  SceneNode* OrxonoxShip::getRootNode()
+  InertialNode* OrxonoxShip::getRootNode()
   {
     return rootNode_;
@@ -189,17 +197,7 @@
   * @return Bullet containing speed and entity.
   */
-  Bullet* OrxonoxShip::fire()
-  {
-	  // TODO: Names must be unique!
-	  SceneNode *temp = rootNode_->getParentSceneNode()->createChildSceneNode(
-          "BulletNode" + StringConverter::toString(objectCounter_));
-	  temp->setOrientation(rootNode_->getOrientation());
-	  temp->setPosition(rootNode_->getPosition());
-	  temp->setScale(Vector3(1, 1, 1) * 10);
-	  temp->yaw(Degree(-90));
-	  return new Bullet(temp, sceneMgr_->createEntity("bullet"
-          + StringConverter::toString(objectCounter_++), "Barrel.mesh"), currentSpeed_
-          + (rootNode_->getOrientation() * Vector3(0, 0, -1)).normalisedCopy()
-          * bulletSpeed_);
+  void OrxonoxShip::fire()
+  {
+    mainWeapon_->primaryFireRequest();
   }
 
@@ -214,11 +212,11 @@
   bool OrxonoxShip::tick(unsigned long time, Real deltaTime)
   {
-    Quaternion quad = rootNode_->getOrientation();
+    mainWeapon_->tick(time, deltaTime);
+
+    Quaternion quad = rootNode_->getSceneNode()->getOrientation();
     quad.normalise();
-    currentSpeed_ += quad * (Vector3(-1, -1, -1) * currentThrust_) * deltaTime;
-    //currentSpeed_ += quad * Vector3(0, 0, -1) * currentThrust_ * deltaTime;
-	  //currentSpeed_ += quad * Vector3(-1, 0,  0) * currentSideThrust_ * deltaTime;
-
-	  rootNode_->translate(currentSpeed_ * deltaTime);
+    rootNode_->addSpeed(quad * (Vector3(-1, -1, -1) * currentThrust_) * deltaTime);
+
+    rootNode_->getSceneNode()->translate(rootNode_->getSpeed() * deltaTime);
 
 	  return true;
Index: code/branches/main_reto/src/orxonox_ship.h
===================================================================
--- code/branches/main_reto/src/orxonox_ship.h	(revision 189)
+++ code/branches/main_reto/src/orxonox_ship.h	(revision 190)
@@ -40,5 +40,5 @@
   {
   public:
-	  OrxonoxShip(Ogre::SceneManager*, Ogre::SceneNode*);
+    OrxonoxShip(Ogre::SceneManager*, Ogre::SceneNode*, weapon::BulletManager*);
 	  virtual ~OrxonoxShip();
 
@@ -51,8 +51,8 @@
 	  void turnLeftAndRight(const Ogre::Radian&);
 
-    Ogre::SceneNode* getRootNode();
+    InertialNode* getRootNode();
     Ogre::Vector3 getSpeed();
 
-	  Bullet* fire();
+	  void fire();
 
 	  bool tick(unsigned long, Ogre::Real);
@@ -62,14 +62,17 @@
   protected:
 	  Ogre::SceneManager *sceneMgr_;
-	  Ogre::SceneNode *rootNode_;
+	  //Ogre::SceneNode *rootNode_;
+    InertialNode *rootNode_;
 	  Ogre::Entity *shipEntity_;
 
-	  Ogre::Vector3 currentSpeed_;  // relative to space
+	  //Ogre::Vector3 currentSpeed_;  // relative to space
 	  Ogre::Vector3 currentThrust_; // relative to the ship
     Ogre::Real baseThrust_;
 	  int objectCounter_;
-	  Ogre::Vector3 bulletSpeed_;
 
-    WeaponManager *mainWeapon_;
+    weapon::BulletManager *bulletManager_;
+	  //Ogre::Vector3 bulletSpeed_;
+
+    weapon::WeaponManager *mainWeapon_;
   };
 
Index: code/branches/main_reto/src/run_manager.cc
===================================================================
--- code/branches/main_reto/src/run_manager.cc	(revision 189)
+++ code/branches/main_reto/src/run_manager.cc	(revision 190)
@@ -52,5 +52,8 @@
 #include "orxonox_ship.h"
 #include "bullet.h"
+#include "bullet_manager.h"
 #include "camera_manager.h"
+#include "weapon_manager.h"
+#include "inertial_node.h"
 
 #include "run_manager.h"
@@ -58,4 +61,5 @@
 namespace orxonox {
   using namespace Ogre;
+  using namespace weapon;
 
   /**
@@ -97,4 +101,17 @@
     // background scene (world objects, skybox, lights, etc.)
     backgroundScene_ = new OrxonoxScene(sceneMgr_);
+
+
+    // BULLET LIST FOR THE TEST APPLICATION
+
+    // create a bullet manager
+    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;*/
+
 
     // PLAYER SPACESHIP
@@ -114,5 +131,5 @@
     // Construct a new spaceship and give it the node
     playerShip_ = new OrxonoxShip(sceneMgr_, sceneMgr_->getRootSceneNode()
-      ->createChildSceneNode("ShipNode", Vector3(20, 20, 20)));
+      ->createChildSceneNode("ShipNode", Vector3(20, 20, 20)), bulletManager_);
 
 
@@ -140,11 +157,4 @@
 
     
-    // BULLET LIST FOR THE TEST APPLICATION
-
-    // TODO: Use STL to make life easier. But it works this way too..
-    bullets_ = new Bullet*[10];
-    bulletsIndex_ = 0;
-    bulletsSize_ = 10;
-
 
     // HUMAN INTERFACE
@@ -205,9 +215,13 @@
     if (playerShip_)
       delete playerShip_;
+    if (bulletManager_)
+      delete bulletManager_;
+
+    WeaponManager::destroyWeapons();
 
     // clean up the bullet list
-    for (int i = 0; i < bulletsIndex_; i++)
+    /*for (int i = 0; i < bulletsIndex_; i++)
       delete bullets_[i];
-    delete bullets_;
+    delete bullets_;*/
   }
 
@@ -239,10 +253,12 @@
 
     // update the bullet positions
-    for (int i = 0; i < bulletsIndex_; i++)
+    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
@@ -447,7 +463,9 @@
       // Prevent continuous fire for the moment.
       leftButtonDown_ = true;
+
+      playerShip_->fire();
       
       // let ship fire one shot with its only weapon (Barrels..)
-      Bullet *tempBullet = playerShip_->fire();
+      /*Bullet *tempBullet = playerShip_->fire();
 
       // resize array if neccessary (double the size then)
@@ -464,5 +482,5 @@
 
       // add the bullet to the list
-      bullets_[bulletsIndex_++] = tempBullet;
+      bullets_[bulletsIndex_++] = tempBullet;*/
 
     }
@@ -556,5 +574,5 @@
   {
     camera_ = sceneMgr_->createCamera("PlayerCam");
-    playerShip_->getRootNode()->attachObject(camera_);
+    playerShip_->getRootNode()->getSceneNode()->attachObject(camera_);
     camera_->setNearClipDistance(5);
     camera_->setPosition(Vector3(0,10,500));
Index: code/branches/main_reto/src/run_manager.h
===================================================================
--- code/branches/main_reto/src/run_manager.h	(revision 189)
+++ code/branches/main_reto/src/run_manager.h	(revision 190)
@@ -109,7 +109,8 @@
 
     // Bullet array
-	  Bullet **bullets_;
+	  /*Bullet **bullets_;
 	  int bulletsSize_;
-	  int bulletsIndex_;
+	  int bulletsIndex_;*/
+    weapon::BulletManager *bulletManager_;
 
 	  // previously elapsed render time
Index: code/branches/main_reto/src/weapon.h
===================================================================
--- code/branches/main_reto/src/weapon.h	(revision 189)
+++ 	(revision )
@@ -1,53 +1,0 @@
-/*
- *   ORXONOX - the hottest 3D action shooter ever to exist
- *
- *
- *   License notice:
- *
- *   This program is free software: you can redistribute it and/or modify
- *   it under the terms of the GNU General Public License as published by
- *   the Free Software Foundation, either version 3 of the License, or
- *   (at your option) any later version.
- *
- *   This program is distributed in the hope that it will be useful,
- *   but WITHOUT ANY WARRANTY; without even the implied warranty of
- *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *   GNU General Public License for more details.
- *
- *   You should have received a copy of the GNU General Public License
- *   along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
- *
- *   Author:
- *      Reto Grieder
- *   Co-authors:
- *      ...
- *
- */
-
-
-#ifndef WEAPON_H
-#define WEAPON_H
-
-#include "OgreString.h"
-
-#include "orxonox_prerequisites.h"
-
-namespace orxonox {
-
-  class Weapon
-  {
-  public:
-    Weapon(const Ogre::String &name, int firePower, int firingRate)
-          : name_(name), firePower_(firePower), firingRate_(firingRate) { }
-    virtual ~Weapon() { }
-
-  public:
-    Ogre::String name_;
-    int firePower_;
-    int firingRate_;
-  };
-
-}
-
-#endif /* WEAPON_H */
Index: code/branches/main_reto/src/weapon/CMakeLists.txt
===================================================================
--- code/branches/main_reto/src/weapon/CMakeLists.txt	(revision 190)
+++ code/branches/main_reto/src/weapon/CMakeLists.txt	(revision 190)
@@ -0,0 +1,33 @@
+PROJECT(Orxonox)
+
+# create a few variables to simplify life
+SET(SRC_FILES
+	orxonox.cc
+	main.cc
+	ammunition_dump.cc
+	barrel_gun.cc
+	bullet.cc
+	camera_manager.cc
+	ogre_control.cc
+	orxonox_scene.cc
+	orxonox_ship.cc
+	run_manager.cc
+	weapon_manager.cc)
+SET(INC_FILES
+	ammunition_dump.h
+	barrel_gun.h
+	bullet.h
+	camera_manager.h
+	ogre_control.h
+	orxonox.h
+	orxonox_prerequisites.h
+	orxonox_scene.h
+	orxonox_ship.h
+	run_manager.h
+	weapon.h
+	weapon_manager.h)
+
+#Creates an executable
+ADD_EXECUTABLE(../../bin/main ${SRC_FILES} ${INC_FILES})
+#Links the executable against OGRE and OIS
+TARGET_LINK_LIBRARIES(../../bin/main ${OGRE_LIBRARIES} ${OIS_LIBRARIES} ${CEGUI_LIBRARIES} ${CEGUI_OGRE_LIBRARIES})
Index: code/branches/main_reto/src/weapon/ammunition_dump.cc
===================================================================
--- code/branches/main_reto/src/weapon/ammunition_dump.cc	(revision 190)
+++ code/branches/main_reto/src/weapon/ammunition_dump.cc	(revision 190)
@@ -0,0 +1,44 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software: you can redistribute it and/or modify
+ *   it under the terms of the GNU General Public License as published by
+ *   the Free Software Foundation, either version 3 of the License, or
+ *   (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ *
+ *   Author:
+ *      Reto Grieder
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#include "ammunition_dump.h"
+
+
+namespace orxonox {
+namespace weapon {
+
+  AmmunitionDump::AmmunitionDump()
+  {
+  }
+
+
+  AmmunitionDump::~AmmunitionDump()
+  {
+  }
+
+}
+}
Index: code/branches/main_reto/src/weapon/ammunition_dump.h
===================================================================
--- code/branches/main_reto/src/weapon/ammunition_dump.h	(revision 190)
+++ code/branches/main_reto/src/weapon/ammunition_dump.h	(revision 190)
@@ -0,0 +1,55 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software: you can redistribute it and/or modify
+ *   it under the terms of the GNU General Public License as published by
+ *   the Free Software Foundation, either version 3 of the License, or
+ *   (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ *
+ *   Author:
+ *      Reto Grieder
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+
+#ifndef AmmunitionDump_H
+#define AmmunitionDump_H
+
+#include "OgrePrerequisites.h"
+
+#include "orxonox_prerequisites.h"
+
+
+namespace orxonox {
+namespace weapon {
+
+  class AmmunitionDump
+  {
+  public:
+	  AmmunitionDump();
+	  ~AmmunitionDump();
+
+  protected:
+
+  protected:
+
+  };
+
+}
+}
+
+#endif /* AmmunitionDump_H */
Index: code/branches/main_reto/src/weapon/bullet.cc
===================================================================
--- code/branches/main_reto/src/weapon/bullet.cc	(revision 190)
+++ code/branches/main_reto/src/weapon/bullet.cc	(revision 190)
@@ -0,0 +1,51 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software: you can redistribute it and/or modify
+ *   it under the terms of the GNU General Public License as published by
+ *   the Free Software Foundation, either version 3 of the License, or
+ *   (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ *
+ *   Author:
+ *      Reto Grieder
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#include "OgreSceneNode.h"
+#include "OgreEntity.h"
+#include "OgreVector3.h"
+
+#include "bullet.h"
+
+
+namespace orxonox {
+namespace weapon {
+  using namespace Ogre;
+
+  Bullet::Bullet(SceneNode *node, Entity *entity, Vector3 speed)
+    : node_(node), entity_(entity), speed_(speed)
+  {
+	  node_->attachObject(entity_);
+  }
+
+
+  Bullet::~Bullet()
+  {
+  }
+
+}
+}
Index: code/branches/main_reto/src/weapon/bullet.h
===================================================================
--- code/branches/main_reto/src/weapon/bullet.h	(revision 190)
+++ code/branches/main_reto/src/weapon/bullet.h	(revision 190)
@@ -0,0 +1,60 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software: you can redistribute it and/or modify
+ *   it under the terms of the GNU General Public License as published by
+ *   the Free Software Foundation, either version 3 of the License, or
+ *   (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ *
+ *   Author:
+ *      Reto Grieder
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+
+#ifndef BULLET_H
+#define BULLET_H
+
+#include "OgrePrerequisites.h"
+
+#include "orxonox_prerequisites.h"
+
+
+namespace orxonox {
+namespace weapon {
+
+  class Bullet
+  {
+  public:
+	  Bullet(Ogre::SceneNode*, Ogre::Entity*, Ogre::Vector3);
+	  ~Bullet();
+
+  protected:
+
+  public:
+    Ogre::SceneNode *node_;
+	  Ogre::Entity *entity_;
+	  Ogre::Vector3 speed_;
+
+  protected:
+
+  };
+
+}
+}
+
+#endif /* BULLET_H */
Index: code/branches/main_reto/src/weapon/bullet_manager.cc
===================================================================
--- code/branches/main_reto/src/weapon/bullet_manager.cc	(revision 190)
+++ code/branches/main_reto/src/weapon/bullet_manager.cc	(revision 190)
@@ -0,0 +1,90 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software: you can redistribute it and/or modify
+ *   it under the terms of the GNU General Public License as published by
+ *   the Free Software Foundation, either version 3 of the License, or
+ *   (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ *
+ *   Author:
+ *      Reto Grieder
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#include "OgreSceneManager.h"
+
+#include "bullet_manager.h"
+#include "bullet.h"
+
+
+namespace orxonox {
+namespace weapon {
+  using namespace Ogre;
+
+  BulletManager::BulletManager(SceneManager *sceneMgr) : sceneMgr_(sceneMgr),
+        bulletsIndex_(0), bulletsSize_(8)
+  {
+    bullets_ = new Bullet*[bulletsSize_];
+  }
+
+
+  BulletManager::~BulletManager()
+  {
+    // clean up the bullet list
+    if (bullets_)
+    {
+      for (int i = 0; i < bulletsIndex_; i++)
+        delete bullets_[i];
+      delete bullets_;
+    }
+  }
+
+
+  void BulletManager::addBullet(Bullet *bullet)
+  {
+    // 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_++] = bullet;
+  }
+
+
+  bool BulletManager::tick(unsigned long time, Real deltaTime)
+  {
+    // update the bullet positions
+    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));
+    }
+
+    return true;
+  }
+
+}
+}
Index: code/branches/main_reto/src/weapon/bullet_manager.h
===================================================================
--- code/branches/main_reto/src/weapon/bullet_manager.h	(revision 190)
+++ code/branches/main_reto/src/weapon/bullet_manager.h	(revision 190)
@@ -0,0 +1,66 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software: you can redistribute it and/or modify
+ *   it under the terms of the GNU General Public License as published by
+ *   the Free Software Foundation, either version 3 of the License, or
+ *   (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ *
+ *   Author:
+ *      Reto Grieder
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+
+#ifndef BULLET_MANAGER_H
+#define BULLET_MANAGER_H
+
+#include "OgrePrerequisites.h"
+
+#include "orxonox_prerequisites.h"
+
+
+namespace orxonox {
+namespace weapon {
+
+  class BulletManager
+  {
+  public:
+    BulletManager(Ogre::SceneManager*);
+	  virtual ~BulletManager();
+
+    void addBullet(Bullet*);
+
+    bool tick(unsigned long, Ogre::Real);
+
+  protected:
+
+  public:
+    Ogre::SceneManager *sceneMgr_;
+
+  protected:
+    // Bullet array
+	  Bullet **bullets_;
+	  int bulletsSize_;
+	  int bulletsIndex_;
+
+  };
+
+}
+}
+
+#endif /* BULLET_MANAGER_H */
Index: code/branches/main_reto/src/weapon/weapon.h
===================================================================
--- code/branches/main_reto/src/weapon/weapon.h	(revision 190)
+++ code/branches/main_reto/src/weapon/weapon.h	(revision 190)
@@ -0,0 +1,60 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software: you can redistribute it and/or modify
+ *   it under the terms of the GNU General Public License as published by
+ *   the Free Software Foundation, either version 3 of the License, or
+ *   (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ *
+ *   Author:
+ *      Reto Grieder
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+
+#ifndef WEAPON_H
+#define WEAPON_H
+
+#include "OgrePrerequisites.h"
+#include "OgreString.h"
+
+#include "orxonox_prerequisites.h"
+
+namespace orxonox {
+namespace weapon {
+
+  class Weapon
+  {
+  public:
+    Weapon(const Ogre::String &name, int firePower, int firingRate,
+      Ogre::Real bulletSpeed)
+          : name_(name), firePower_(firePower), firingRate_(firingRate),
+          bulletSpeed_(bulletSpeed) { }
+
+    virtual ~Weapon() { }
+
+  public:
+    Ogre::String name_;
+    int firePower_;
+    int firingRate_;
+    Ogre::Real bulletSpeed_;
+  };
+
+}
+}
+
+#endif /* WEAPON_H */
Index: code/branches/main_reto/src/weapon/weapon_manager.cc
===================================================================
--- code/branches/main_reto/src/weapon/weapon_manager.cc	(revision 190)
+++ code/branches/main_reto/src/weapon/weapon_manager.cc	(revision 190)
@@ -0,0 +1,225 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software: you can redistribute it and/or modify
+ *   it under the terms of the GNU General Public License as published by
+ *   the Free Software Foundation, either version 3 of the License, or
+ *   (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ *
+ *   Author:
+ *      Reto Grieder
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#include "OgreSceneManager.h"
+#include "OgreEntity.h"
+#include "OgreSceneNode.h"
+#include "OgreVector3.h"
+#include "OgreStringConverter.h"
+
+#include "weapon.h"
+#include "bullet.h"
+#include "bullet_manager.h"
+#include "inertial_node.h"
+#include "weapon_manager.h"
+
+#define ACTION_LIST_SIZE 4
+
+
+namespace orxonox {
+namespace weapon {
+  using namespace Ogre;
+
+  Weapon** WeaponManager::weaponList_s = NULL;
+
+  WeaponManager::WeaponManager(SceneManager *sceneMgr, InertialNode *node,
+        BulletManager *bulletManager, int slotSize)
+        : sceneMgr_(sceneMgr), node_(node), slotSize_(slotSize), slotIndex_(0),
+        bulletCounter_(0), primaryFireRequest_(false), currentState_(IDLE),
+        secondaryFireRequest_(false), selectedWeapon_(0),
+        bulletManager_(bulletManager),
+        actionListReadIndex_(0), actionListWriteIndex_(0)
+  {
+  	slots_ = new Weapon*[slotSize];
+    actionList_ = new Action[ACTION_LIST_SIZE];
+    for (int i = 0; i < ACTION_LIST_SIZE; i++)
+      actionList_[i] = NOTHING;
+  }
+
+
+  WeaponManager::~WeaponManager()
+  {
+    if (slots_)
+      delete slots_;
+    if (actionList_)
+      delete actionList_;
+  }
+
+
+  bool WeaponManager::addWeapon(const Ogre::String &name)
+  {
+    if (!weaponList_s)
+      return false;
+
+    if (name == weaponList_s[0]->name_)
+    {
+      // this is ugly, but for the time being, it has to fit.
+      selectedWeapon_ = slotIndex_;
+      slots_[slotIndex_++] = weaponList_s[0];
+      return true;
+    }
+    else
+      return false;
+  }
+
+
+  bool WeaponManager::addAction(const Action act)
+  {
+    if (actionList_[actionListWriteIndex_] == NOTHING)
+    {
+      actionList_[actionListWriteIndex_] = act;
+      actionListWriteIndex_ = (actionListWriteIndex_ + 1) % ACTION_LIST_SIZE;
+      return true;
+    }
+    else
+      return false;
+  }
+
+
+  void WeaponManager::primaryFireRequest()
+  {
+    primaryFireRequest_ = true;
+  }
+
+
+  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(),
+          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_;
+    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()
+  {
+  }
+
+
+  bool WeaponManager::tick(unsigned long time, Real deltaTime)
+  {
+    // return if no weapon has been added
+    if (!slots_[slotIndex_])
+      return true;
+
+    switch (currentState_)
+    {
+    case IDLE:
+      // first, process actions
+      if (actionList_[actionListReadIndex_] != NOTHING)
+      {
+        actionListReadIndex_ = (actionListReadIndex_ + 1) % ACTION_LIST_SIZE;
+        break;
+      }
+
+      switch (actionList_[actionListReadIndex_])
+      {
+      case RELOAD:
+        break;
+
+      case ZOOM_IN:
+        break;
+
+      case ZOOM_OUT:
+        break;
+
+      default:
+        break;
+      }
+
+      // secondly, execute firing
+      if (primaryFireRequest_)
+        primaryFire();
+      else if (secondaryFireRequest_)
+        secondaryFire();
+
+      break;
+
+    case PRIMARY_FIRE:
+      break;
+
+    case SECONDARY_FIRE:
+      break;
+
+    case RELOADING:
+      break;
+    }
+
+    primaryFireRequest_ = false;
+    secondaryFireRequest_ = false;
+
+    return true;
+  }
+
+
+  // static
+  bool WeaponManager::loadWeapons()
+  {
+    weaponList_s = new Weapon*[5];
+    for (int i = 0; i < 5; i++)
+      weaponList_s[i] = NULL;
+    weaponList_s[0] = new Weapon("Barrel Gun", 10, 2, 500);
+    return true;
+  }
+
+
+  // static
+  void WeaponManager::destroyWeapons()
+  {
+    if (weaponList_s)
+    {
+      for (int i = 0; i < 5; i++)
+        if (weaponList_s[i])
+          delete weaponList_s[i];
+      delete weaponList_s;
+    }
+  }
+
+}
+}
Index: code/branches/main_reto/src/weapon/weapon_manager.h
===================================================================
--- code/branches/main_reto/src/weapon/weapon_manager.h	(revision 190)
+++ code/branches/main_reto/src/weapon/weapon_manager.h	(revision 190)
@@ -0,0 +1,112 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software: you can redistribute it and/or modify
+ *   it under the terms of the GNU General Public License as published by
+ *   the Free Software Foundation, either version 3 of the License, or
+ *   (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ *
+ *   Author:
+ *      Reto Grieder
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+
+#ifndef WEAPON_MANAGER_H
+#define WEAPON_MANAGER_H
+
+#include "OgrePrerequisites.h"
+
+#include "orxonox_prerequisites.h"
+
+
+namespace orxonox {
+namespace weapon {
+
+  class WeaponManager
+  {
+  public:
+    enum Action {
+      NOTHING  = 0,
+      RELOAD   = 1,
+      ZOOM_IN  = 2,
+      ZOOM_OUT = 3
+    };
+
+  protected:
+    enum State {
+      IDLE = 0,
+      PRIMARY_FIRE = 1,
+      SECONDARY_FIRE = 2,
+      RELOADING = 4
+    };
+
+  public:
+    WeaponManager(Ogre::SceneManager*, InertialNode*, BulletManager*, int);
+	  virtual ~WeaponManager();
+
+    bool addWeapon(const Ogre::String&);
+
+    bool addAction(const Action);
+
+    void primaryFireRequest();
+
+    void secondaryFireRequest();
+
+    bool tick(unsigned long, Ogre::Real);
+
+    bool static loadWeapons();
+
+    void static destroyWeapons();
+
+  protected:
+    void primaryFire();
+
+    void secondaryFire();
+
+  public:
+
+  protected:
+    Ogre::SceneManager *sceneMgr_;
+    //Ogre::SceneNode *node_;
+    InertialNode* node_;
+
+    Weapon **slots_;
+    int slotSize_;
+    int slotIndex_;
+    int selectedWeapon_;
+
+    int bulletCounter_;
+    BulletManager *bulletManager_;
+
+    bool primaryFireRequest_;
+    bool secondaryFireRequest_;
+
+    State currentState_;
+
+    Action *actionList_;
+    int actionListReadIndex_;
+    int actionListWriteIndex_;
+
+    static Weapon **weaponList_s;
+
+  };
+
+}
+}
+
+#endif /* WEAPON_MANAGER_H */
Index: code/branches/main_reto/src/weapon_manager.cc
===================================================================
--- code/branches/main_reto/src/weapon_manager.cc	(revision 189)
+++ 	(revision )
@@ -1,81 +1,0 @@
-/*
- *   ORXONOX - the hottest 3D action shooter ever to exist
- *
- *
- *   License notice:
- *
- *   This program is free software: you can redistribute it and/or modify
- *   it under the terms of the GNU General Public License as published by
- *   the Free Software Foundation, either version 3 of the License, or
- *   (at your option) any later version.
- *
- *   This program is distributed in the hope that it will be useful,
- *   but WITHOUT ANY WARRANTY; without even the implied warranty of
- *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *   GNU General Public License for more details.
- *
- *   You should have received a copy of the GNU General Public License
- *   along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
- *
- *   Author:
- *      Reto Grieder
- *   Co-authors:
- *      ...
- *
- */
-
-#include "OgreSceneManager.h"
-
-#include "weapon.h"
-#include "weapon_manager.h"
-
-
-namespace orxonox {
-  using namespace Ogre;
-
-  Weapon** WeaponManager::weaponList_s = NULL;
-
-  WeaponManager::WeaponManager(SceneManager *sceneMgr, SceneNode *node,
-        int slotSize)
-        : sceneMgr_(sceneMgr), node_(node), slotSize_(slotSize), slotIndex_(0)
-  {
-  	slots_ = new Weapon*[slotSize];
-  }
-
-
-  WeaponManager::~WeaponManager()
-  {
-    if (slots_)
-      delete slots_;
-  }
-
-
-  bool WeaponManager::addWeapon(const Ogre::String &name)
-  {
-    if (name == weaponList_s[0]->name_)
-    {
-      // this is ugly, but for the time being, it has to fit.
-      slots_[slotIndex_++] = weaponList_s[0];
-      return true;
-    }
-    else
-      return false;
-  }
-
-
-  // static
-  bool WeaponManager::loadWeapons()
-  {
-    weaponList_s[0] = new Weapon("Barrel Gun", 10, 2);
-    return true;
-  }
-
-
-  // static
-  void WeaponManager::destroyWeapons()
-  {
-    delete weaponList_s[0];
-  }
-
-}
Index: code/branches/main_reto/src/weapon_manager.h
===================================================================
--- code/branches/main_reto/src/weapon_manager.h	(revision 189)
+++ 	(revision )
@@ -1,65 +1,0 @@
-/*
- *   ORXONOX - the hottest 3D action shooter ever to exist
- *
- *
- *   License notice:
- *
- *   This program is free software: you can redistribute it and/or modify
- *   it under the terms of the GNU General Public License as published by
- *   the Free Software Foundation, either version 3 of the License, or
- *   (at your option) any later version.
- *
- *   This program is distributed in the hope that it will be useful,
- *   but WITHOUT ANY WARRANTY; without even the implied warranty of
- *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *   GNU General Public License for more details.
- *
- *   You should have received a copy of the GNU General Public License
- *   along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
- *
- *   Author:
- *      Reto Grieder
- *   Co-authors:
- *      ...
- *
- */
-
-
-#ifndef WEAPON_MANAGER_H
-#define WEAPON_MANAGER_H
-
-#include "OgrePrerequisites.h"
-
-#include "orxonox_prerequisites.h"
-
-
-namespace orxonox {
-
-  class WeaponManager
-  {
-  public:
-    WeaponManager(Ogre::SceneManager*, Ogre::SceneNode*, int);
-	  virtual ~WeaponManager();
-
-    bool addWeapon(const Ogre::String&);
-
-    bool static loadWeapons();
-
-    void static destroyWeapons();
-
-  protected:
-    Ogre::SceneManager *sceneMgr_;
-    Ogre::SceneNode *node_;
-
-    Weapon **slots_;
-    int slotSize_;
-    int slotIndex_;
-
-    static Weapon **weaponList_s;
-
-  };
-
-}
-
-#endif /* WEAPON_MANAGER_H */
