Index: orxonox/branches/weaponSystem/src/lib/sound/sound_engine.h
===================================================================
--- orxonox/branches/weaponSystem/src/lib/sound/sound_engine.h	(revision 4877)
+++ orxonox/branches/weaponSystem/src/lib/sound/sound_engine.h	(revision 4878)
@@ -37,4 +37,7 @@
 
 //! A class that represents a SoundSource
+/**
+ * @todo ability to play back different SoundBuffers on the same SounSource
+ */
 class SoundSource : public BaseObject
 {
Index: orxonox/branches/weaponSystem/src/util/loading/factory.h
===================================================================
--- orxonox/branches/weaponSystem/src/util/loading/factory.h	(revision 4877)
+++ orxonox/branches/weaponSystem/src/util/loading/factory.h	(revision 4878)
@@ -15,6 +15,6 @@
 
 /*!
-  \file factory.h
-  \brief A loadable object handler
+ * @file factory.h
+ * @brief A loadable object handler
 */
 
@@ -31,9 +31,9 @@
 
 /**
-    Creates a factory to a Loadable Class.
-    this should be used at the beginning of all the Classes that should be loadable (in the cc-file)
-  @todo make factoryName a BaseObject-parameter. (else it would be redundant)
+ * Creates a factory to a Loadable Class.
+ * this should be used at the beginning of all the Classes that should be loadable (in the cc-file)
 */
-#define CREATE_FACTORY(CLASS_NAME) tFactory<CLASS_NAME>* global_##CLASS_NAME##_Factory = new tFactory<CLASS_NAME>(#CLASS_NAME)
+#define CREATE_FACTORY(CLASS_NAME) \
+    tFactory<CLASS_NAME>* global_##CLASS_NAME##_Factory = new tFactory<CLASS_NAME>(#CLASS_NAME)
 
 //! The Factory is a loadable object handler
@@ -48,5 +48,5 @@
 
   static void registerFactory( Factory* factory);
-  /** \brief sets the Next factory in the list @param nextFactory the next factory */
+  /** sets the Next factory in the list @param nextFactory the next factory */
   inline void setNext( Factory* nextFactory) { this->next = nextFactory; };
   /** @returns the first factory */
@@ -54,7 +54,4 @@
   /** @returns the next factory */
   Factory* getNext() const { return this->next; };
-
-
-  private:
 
   private:
Index: orxonox/branches/weaponSystem/src/world_entities/player.cc
===================================================================
--- orxonox/branches/weaponSystem/src/world_entities/player.cc	(revision 4877)
+++ orxonox/branches/weaponSystem/src/world_entities/player.cc	(revision 4878)
@@ -241,5 +241,5 @@
   if( this->bRight &&  TrackManager::getInstance()->getWidth() > this->getRelCoor().z*2)
     accel = accel + (orthDirection*acceleration);
-  if( this->bAscend )
+  if( this->bAscend ) { /* FIXME */ }
   if( this->bDescend) {/* FIXME */} /* @todo up and down player movement */
 
@@ -250,5 +250,5 @@
 
 /**
- *  weapon manipulation by the player
+ * weapon manipulation by the player
 */
 void Player::weaponAction()
@@ -271,27 +271,15 @@
 {
   if( event.type == KeyMapper::PEV_UP)
-    {
       this->bUp = event.bPressed;
-    }
   else if( event.type == KeyMapper::PEV_DOWN)
-    {
       this->bDown = event.bPressed;
-    }
   else if( event.type == KeyMapper::PEV_RIGHT)
-    {
       this->bRight= event.bPressed;
-    }
   else if( event.type == KeyMapper::PEV_LEFT)
-    {
       this->bLeft = event.bPressed;
-    }
   else if( event.type == KeyMapper::PEV_FIRE1)
-    {
-       this->bFire = event.bPressed;
-    }
+      this->bFire = event.bPressed;
   else if( event.type == KeyMapper::PEV_NEXT_WEAPON)
-    {
       if( !event.bPressed) this->bWeaponChange = !this->bWeaponChange;
-    }
-
-}
+
+}
Index: orxonox/branches/weaponSystem/src/world_entities/weapons/test_gun.cc
===================================================================
--- orxonox/branches/weaponSystem/src/world_entities/weapons/test_gun.cc	(revision 4877)
+++ orxonox/branches/weaponSystem/src/world_entities/weapons/test_gun.cc	(revision 4878)
@@ -50,5 +50,4 @@
 
   this->model = (Model*)ResourceManager::getInstance()->load("models/test_gun.obj", OBJ, RP_CAMPAIGN);
-  this->idleTime = 0.2f;
   this->leftRight = leftRight;
 
@@ -145,5 +144,5 @@
 void TestGun::fire()
 {
-  if( !this->hasWeaponIdleTimeElapsed())
+  if( !this->stateTimeElapsed())
     {
       this->weaponIdle();
@@ -158,5 +157,4 @@
   pj->setVelocity(this->getVelocity());
   State::getWorldEntityList()->add(pj);
-  this->localTime = 0;
 
   this->animation1->replay();
@@ -191,5 +189,5 @@
 void TestGun::tick (float time)
 {
-  this->localTime += time;
+  this->stateTime += time;
 }
 
Index: orxonox/branches/weaponSystem/src/world_entities/weapons/weapon.cc
===================================================================
--- orxonox/branches/weaponSystem/src/world_entities/weapons/weapon.cc	(revision 4877)
+++ orxonox/branches/weaponSystem/src/world_entities/weapons/weapon.cc	(revision 4878)
@@ -25,10 +25,11 @@
 
 /**
- *  standard constructor
-
-   creates a new weapon
+ * standard constructor
+ *
+ * creates a new weapon
 */
 Weapon::Weapon (PNode* parent, const Vector& coordinate, const Quaternion& direction)
 {
+  this->init();
   parent->addChild(this, PNODE_ALL);
   this->setRelCoor(coordinate);
@@ -36,7 +37,6 @@
 }
 
-
 /**
- *  standard deconstructor
+ * standard deconstructor
 */
 Weapon::~Weapon ()
@@ -50,50 +50,29 @@
 }
 
+void Weapon::init()
+{
+  this->currentState     = WS_INACTIVE;
+  this->stateTime        = 0.0;
+  for (int i = 0; i < WS_STATE_COUNT; i++)
+  {
+    this->times[i] = 0.0;
+    this->animation[i] = NULL;
+  }
+  for (int i = 0; i < WA_ACTION_COUNT; i++)
+    this->soundBuffers[i] = NULL;
+
+  this->weaponSource = NULL;
+  this->minCharge;
+  this->maxCharge;
+
+  this->active = false;
+  this->projectile = NULL;
+}
 
 /**
-  *  enables the weapon
-
-    a weapon can be enabled/disabled because of various reasons. if a weapon is
-    been enabled, it can interact in a world. elswhere it wont react to any
-    action.
-*/
-void Weapon::enable()
-{
-  this->enabled = true;
-}
-
-
-/**
-  *  disables the weapon
-
-    a weapon can be enabled/disabled because of various reasons. if a weapon is
-    been enabled, it can interact in a world. elswhere it wont react to any
-    action.
-*/
-void Weapon::disable()
-{
-  this->enabled = false;
-}
-
-
-/**
-  *  checks if the weapon is enabled
-  * @returns true if enabled
-
-    a weapon can be ebabled/disabled because of various reasons. if a weapon is
-    been enabled, it can interact in a world. elswhere it wont react to any
-    action.
-*/
-bool Weapon::isEnabled()
-{
-  return this->enabled;
-}
-
-
-/**
- *  sets a new projectile to the weapon
+ * sets a new projectile to the weapon
  * @param new projectile for this weapon
-
-   weapon an projectile are independent, so you can combine them as you want
+ *
+ * weapon an projectile are independent, so you can combine them as you want
 */
 void Weapon::setProjectile(Projectile* projectile)
@@ -104,8 +83,8 @@
 
 /**
- *  sets a new projectile to the weapon
+ * sets a new projectile to the weapon
  * @returns the current projectile of this weapon
-
-   weapon an projectile are independent, so you can combine them as you want
+ *
+ * weapon an projectile are independent, so you can combine them as you want
 */
 Projectile* Weapon::getProjectile()
@@ -116,9 +95,9 @@
 
 /**
- *  this activates the weapon
-
-   This is needed, since there can be more than one weapon on a ship. the
-   activation can be connected with an animation. for example the weapon is
-   been armed out.
+ * this activates the weapon
+ *
+ * This is needed, since there can be more than one weapon on a ship. the
+ * activation can be connected with an animation. for example the weapon is
+ * been armed out.
 */
 void Weapon::activate()
@@ -127,9 +106,9 @@
 
 /**
- *  this deactivates the weapon
-
-   This is needed, since there can be more than one weapon on a ship. the
-   activation can be connected with an animation. for example the weapon is
-   been armed out.
+ * this deactivates the weapon
+ *
+ * This is needed, since there can be more than one weapon on a ship. the
+ * activation can be connected with an animation. for example the weapon is
+ * been armed out.
 */
 void Weapon::deactivate()
@@ -137,22 +116,10 @@
 
 /**
- *  asks if the current weapon is active
- * @returns true if it the weapon is active
-*/
-bool Weapon::isActive()
-{}
-
-
-
-
-
-
-/**
- *  is called, when the weapon gets hit (=collide with something)
+ * is called, when the weapon gets hit (=collide with something)
  * @param from which entity it is been hit
  * @param where it is been hit
-
-   this may not be used, since it would make the game relay complicated when one
-   can destroy the weapons of enemies or vice versa.
+ *
+ * this may not be used, since it would make the game relay complicated when one
+ * can destroy the weapons of enemies or vice versa.
 */
 void Weapon::hit (WorldEntity* entity, const Vector& position)
@@ -162,7 +129,7 @@
 /**
  *  is called, when the weapon is destroyed
-
-   this is in conjunction with the hit function, so when a weapon is able to get
-   hit, it can also be destoryed.
+ *
+ * this is in conjunction with the hit function, so when a weapon is able to get
+ * hit, it can also be destoryed.
 */
 void Weapon::destroy ()
Index: orxonox/branches/weaponSystem/src/world_entities/weapons/weapon.h
===================================================================
--- orxonox/branches/weaponSystem/src/world_entities/weapons/weapon.h	(revision 4877)
+++ orxonox/branches/weaponSystem/src/world_entities/weapons/weapon.h	(revision 4878)
@@ -78,8 +78,4 @@
   void loadParams(const TiXmlElement* root);
 
-  void enable();
-  void disable();
-  bool isEnabled();
-
   void setProjectile(Projectile* projectile);
   Projectile* getProjectile();
@@ -87,16 +83,17 @@
   virtual void activate();
   virtual void deactivate();
-  bool isActive();
+  virtual void fire() = 0;
+  //virtual void reload();
+  //virtual void charge();
+  bool isActive() const { return this->active; };
 
-
-  /** @param idle time in ms  */
-  inline void setWeaponIdleTime(float idleTime) { this->idleTime = idleTime; };
-  /** @returns idle time in ms */
-  inline float getWeaponIdleTime() const { return this->idleTime; };
-  /** @return true if idletime is elapsed else otherwise */
-  inline bool hasWeaponIdleTimeElapsed() const { return (this->localTime > this->idleTime)?true:false; };
+  // FUNCTIONS TO SET THE WEAPONS PROPERTIES.
+  void setStateDuration(const char* state, float duration);
+  void setStateDuration(WeaponState state, float duration);
+  float getStateDuration(WeaponState state) { return (state < WS_STATE_COUNT)?this->times[state]:0.0; };
+  /** @return true if idletime is elapsed, false otherwise */
+  inline bool stateTimeElapsed() const { return (this->stateTime > this->times[currentState])?true:false; };
 
   /**  fires the weapon */
-  virtual void fire() = 0;
   virtual void hit (WorldEntity* weapon, const Vector& loc);
   virtual void destroy();
@@ -107,13 +104,9 @@
 
  protected:
-  float                localTime;                        //<! this is the local time. important for shooting attributes like frequency
-  float                idleTime;                         //<! the time a weapon needs before it can shoot again. eg. shooting frequency or actication/deactivateion delay
-  float                slowDownFactor;                   //<! if the shooting frequency is a linear function of time...
-
   ////////////
   // PHASES //
   ////////////
   WeaponState          currentState;                     //!< The State the weapon is in.
-  float                stateTime;                        //!< how long the state has teken until now.
+  float                stateTime;                        //!< how long the state has taken until now.
   float                times[WS_STATE_COUNT];            //!< Times to stay in the different States @see WeaponState.
   SoundBuffer*         soundBuffers[WA_ACTION_COUNT];    //!< SoundBuffers for all actions @see WeaponAction.
@@ -127,7 +120,6 @@
 
  private:
-   bool                 enabled;                         //<! states if the weapon is enabled or not
-   Projectile*          projectile;                      //<! the projectile used for this weapon
-  //WeaponSound sound;
+   bool                 active;                          //!< states wheter the weapon is enabled or not
+   Projectile*          projectile;                      //!< the projectile used for this weapon
 };
 
Index: orxonox/branches/weaponSystem/src/world_entities/world_entity.cc
===================================================================
--- orxonox/branches/weaponSystem/src/world_entities/world_entity.cc	(revision 4877)
+++ orxonox/branches/weaponSystem/src/world_entities/world_entity.cc	(revision 4878)
@@ -62,5 +62,5 @@
 
 /**
- *  loads a Model onto a WorldEntity
+ * loads a Model onto a WorldEntity
  * @param fileName the name of the model to load
 */
@@ -79,8 +79,8 @@
 
 /**
- *  sets the character attributes of a worldentity
+ * sets the character attributes of a worldentity
  * @param character attributes
-
-   these attributes don't have to be set, only use them, if you need them
+ *
+ * these attributes don't have to be set, only use them, if you need them
 */
 void WorldEntity::setCharacterAttributes(CharacterAttributes* charAttr)
@@ -89,5 +89,5 @@
 
 /**
- *  gets the Character attributes of this worldentity
+ * gets the Character attributes of this worldentity
  * @returns character attributes
 */
@@ -95,25 +95,9 @@
 {}
 
-
-/**
- *  set the WorldEntity's collision hull
- * @param newhull: a pointer to a completely assembled CollisionCluster
-
-   Any previously assigned collision hull will be deleted on reassignment
-*/
-/*
-void WorldEntity::setCollision (CollisionCluster* newhull)
-{
-  if( newhull == NULL) return;
-  if( collisioncluster != NULL) delete collisioncluster;
-  collisioncluster = newhull;
-}
-*/
-
 /**
  *  this function is called, when two entities collide
  * @param entity: the world entity with whom it collides
-
-   Implement behaviour like damage application or other miscellaneous collision stuff in this function
+ *
+ * Implement behaviour like damage application or other miscellaneous collision stuff in this function
 */
 void WorldEntity::collideWith(WorldEntity* entity)
@@ -127,6 +111,6 @@
  * @param weapon: the laser/rocket/shoot that hits.
  * @param loc: place where it is hit
-
-   calculate the damage depending
+ *
+ * calculate the damage depending
 */
 void WorldEntity::hit(WorldEntity* weapon, Vector* loc) {}
@@ -135,7 +119,7 @@
 /**
  *  this is called immediately after the Entity has been constructed and initialized
-
-   Put any initialisation code that requires knowledge of location (placement if the Entity is free) and owner of the entity here.
-   DO NOT place such code in the constructor, those variables are set AFTER the entity is constucted.
+ *
+ * Put any initialisation code that requires knowledge of location (placement if the Entity is free) and owner of the entity here.
+ * DO NOT place such code in the constructor, those variables are set AFTER the entity is constucted.
 */
 void WorldEntity::postSpawn ()
@@ -146,7 +130,7 @@
 /**
  *  this method is called by the world if the WorldEntity leaves valid gamespace
-
-   For free entities this means it left the Track boundaries. With bound entities it means its Location adresses a
-   place that is not in the world anymore. In both cases you might have to take extreme measures (a.k.a. call destroy).
+ *
+ * For free entities this means it left the Track boundaries. With bound entities it means its Location adresses a
+ * place that is not in the world anymore. In both cases you might have to take extreme measures (a.k.a. call destroy).
 */
 void WorldEntity::leftWorld ()
@@ -158,6 +142,6 @@
  *  this method is called every frame
  * @param time: the time in seconds that has passed since the last tick
-
-   Handle all stuff that should update with time inside this method (movement, animation, etc.)
+ *
+ * Handle all stuff that should update with time inside this method (movement, animation, etc.)
 */
 void WorldEntity::tick(float time)
@@ -167,6 +151,7 @@
 /**
  *  the entity is drawn onto the screen with this function
-
-   This is a central function of an entity: call it to let the entity painted to the screen. Just override this function with whatever you want to be drawn.
+ *
+ * This is a central function of an entity: call it to let the entity painted to the screen.
+ * Just override this function with whatever you want to be drawn.
 */
 void WorldEntity::draw()
Index: orxonox/branches/weaponSystem/src/world_entities/world_entity.h
===================================================================
--- orxonox/branches/weaponSystem/src/world_entities/world_entity.h	(revision 4877)
+++ orxonox/branches/weaponSystem/src/world_entities/world_entity.h	(revision 4878)
@@ -1,5 +1,5 @@
 /*!
-    \file world_entity.h
-  *  Definition of the basic WorldEntity
+ * @file world_entity.h
+ * Definition of the basic WorldEntity
 */
 
@@ -8,5 +8,4 @@
 
 #include "p_node.h"
-#include "comincl.h"
 #include "resource_manager.h"
 #include "factory.h"
@@ -16,5 +15,5 @@
 
 
-
+// FORWARD DECLARATION
 class CharacterAttributes;
 class SoundEngine;
@@ -23,5 +22,5 @@
 
 
-//! Basic class from which all interactive stuff in the world is derived from
+//! Basis-class all interactive stuff in the world is derived from
 class WorldEntity : public PNode
 {
@@ -53,7 +52,7 @@
   virtual unsigned int getFaceCount () const { if (this->model) return this->model->getFaceCount(); else return 0; };
 
+  virtual void tick (float time);
   virtual void draw ();
   void drawBVTree(int depth, int drawMode);
-  virtual void tick (float time);
 
  protected:
