Index: /orxonox/trunk/orxonox.kdevelop
===================================================================
--- /orxonox/trunk/orxonox.kdevelop	(revision 4884)
+++ /orxonox/trunk/orxonox.kdevelop	(revision 4885)
@@ -5,80 +5,18 @@
     <email>orxonox-dev@mail.datacore.ch</email>
     <version>$VERSION$</version>
-    <projectmanagement>KDevAutoProject</projectmanagement>
+    <projectmanagement>KDevCustomProject</projectmanagement>
     <primarylanguage>C++</primarylanguage>
     <ignoreparts/>
-    <projectdirectory>.</projectdirectory>
-    <absoluteprojectpath>false</absoluteprojectpath>
-    <description/>
-    <secondaryLanguages/>
-    <versioncontrol/>
   </general>
-  <kdevautoproject>
-    <general>
-      <activetarget>src/subprojects/particles/particles</activetarget>
-      <useconfiguration>default</useconfiguration>
-    </general>
+  <kdevcustomproject>
     <run>
-      <mainprogram>src/orxonox</mainprogram>
+      <mainprogram>orxonox</mainprogram>
       <directoryradio>executable</directoryradio>
-      <customdirectory>/</customdirectory>
-      <programargs/>
-      <terminal>false</terminal>
-      <autocompile>true</autocompile>
-      <envvars/>
-      <runarguments>
-        <orxonox/>
-      </runarguments>
     </run>
-    <configurations>
-      <optimized>
-        <builddir>optimized</builddir>
-        <ccompiler>GccOptions</ccompiler>
-        <cxxcompiler>GppOptions</cxxcompiler>
-        <f77compiler>G77Options</f77compiler>
-        <cxxflags>-O2 -g0</cxxflags>
-      </optimized>
-      <debug>
-        <configargs>--enable-debug=full</configargs>
-        <builddir>debug</builddir>
-        <ccompiler>GccOptions</ccompiler>
-        <cxxcompiler>GppOptions</cxxcompiler>
-        <f77compiler>G77Options</f77compiler>
-        <cxxflags>-O0 -g3</cxxflags>
-        <envvars/>
-      </debug>
-      <default>
-        <envvars/>
-      </default>
-    </configurations>
-    <make>
-      <envvars>
-        <envvar value="1" name="WANT_AUTOCONF_2_5" />
-        <envvar value="1" name="WANT_AUTOMAKE_1_6" />
-      </envvars>
-      <abortonerror>false</abortonerror>
-      <numberofjobs>3</numberofjobs>
-      <dontact>false</dontact>
-      <makebin>make</makebin>
-      <prio>0</prio>
-    </make>
-  </kdevautoproject>
+  </kdevcustomproject>
   <kdevdebugger>
     <general>
-      <dbgshell>libtool</dbgshell>
-      <programargs/>
-      <gdbpath/>
-      <configGdbScript/>
-      <runShellScript/>
-      <runGdbScript/>
-      <breakonloadinglibs>true</breakonloadinglibs>
-      <separatetty>false</separatetty>
-      <floatingtoolbar>false</floatingtoolbar>
+      <dbgshell/>
     </general>
-    <display>
-      <staticmembers>false</staticmembers>
-      <demanglenames>true</demanglenames>
-      <outputradix>10</outputradix>
-    </display>
   </kdevdebugger>
   <kdevdoctreeview>
@@ -142,5 +80,5 @@
       <includeTypes>true</includeTypes>
       <includeEnums>true</includeEnums>
-      <includeTypedefs>true</includeTypedefs>
+      <includeTypedefs>false</includeTypedefs>
       <automaticCodeCompletion>true</automaticCodeCompletion>
       <automaticArgumentsHint>true</automaticArgumentsHint>
@@ -150,12 +88,4 @@
       <headerCompletionDelay>250</headerCompletionDelay>
     </codecompletion>
-    <creategettersetter>
-      <prefixGet/>
-      <prefixSet>set</prefixSet>
-      <prefixVariable>m_,_</prefixVariable>
-      <parameterName>theValue</parameterName>
-      <inlineGet>true</inlineGet>
-      <inlineSet>true</inlineSet>
-    </creategettersetter>
   </kdevcppsupport>
   <kdevfileview>
@@ -165,24 +95,7 @@
     </groups>
     <tree>
-      <hidepatterns>*.o,*~</hidepatterns>
+      <hidepatterns>*.o,*.lo,*~,*in</hidepatterns>
       <hidenonprojectfiles>false</hidenonprojectfiles>
     </tree>
   </kdevfileview>
-  <cppsupportpart>
-    <filetemplates>
-      <interfacesuffix>.h</interfacesuffix>
-      <implementationsuffix>.cc</implementationsuffix>
-    </filetemplates>
-  </cppsupportpart>
-  <kdevdocumentation>
-    <projectdoc>
-      <docsystem/>
-      <docurl/>
-      <usermanualurl/>
-    </projectdoc>
-  </kdevdocumentation>
-  <ctagspart>
-    <customArguments/>
-    <customTagfilePath/>
-  </ctagspart>
 </kdevelop>
Index: /orxonox/trunk/src/defs/debug.h
===================================================================
--- /orxonox/trunk/src/defs/debug.h	(revision 4884)
+++ /orxonox/trunk/src/defs/debug.h	(revision 4885)
@@ -69,5 +69,5 @@
 #define DEBUG_MODULE_LIGHT              0
 #define DEBUG_MODULE_PLAYER             1
-#define DEBUG_MODULE_WEAPON             0
+#define DEBUG_MODULE_WEAPON             4
 #define DEBUG_MODULE_MATH               0
 #define DEBUG_MODULE_FONT               1
Index: /orxonox/trunk/src/lib/sound/sound_engine.cc
===================================================================
--- /orxonox/trunk/src/lib/sound/sound_engine.cc	(revision 4884)
+++ /orxonox/trunk/src/lib/sound/sound_engine.cc	(revision 4885)
@@ -91,5 +91,5 @@
  *  creates a SoundSource at position sourceNode with the SoundBuffer buffer
 */
-SoundSource::SoundSource(SoundBuffer* buffer, PNode* sourceNode)
+SoundSource::SoundSource(const PNode* sourceNode, const SoundBuffer* buffer)
 {
   this->setClassID(CL_SOUND_SOURCE, "SoundSource");
@@ -106,5 +106,6 @@
   if ((result = alGetError()) != AL_NO_ERROR)
     SoundEngine::PrintALErrorString(result);
-  alSourcei (this->sourceID, AL_BUFFER,   this->buffer->getID());
+  if (this->buffer != NULL)
+    alSourcei (this->sourceID, AL_BUFFER,   this->buffer->getID());
   alSourcef (this->sourceID, AL_PITCH,    1.0      );
   alSourcef (this->sourceID, AL_GAIN,     1.0      );
@@ -121,5 +122,4 @@
 }
 
-
 /**
  *  Plays back a SoundSource
@@ -128,4 +128,17 @@
 {
   alSourcePlay(this->sourceID);
+}
+
+/**
+ * Plays back buffer on this Source
+ * @param buffer the buffer to play back on this Source
+ */
+void SoundSource::play(const SoundBuffer* buffer)
+{
+  alSourcei (this->sourceID, AL_BUFFER, buffer->getID());
+  alSourcePlay(this->sourceID);
+
+  if (unlikely(this->buffer != NULL))
+    alSourcei (this->sourceID, AL_BUFFER, this->buffer->getID());
 }
 
@@ -230,5 +243,5 @@
 SoundSource* SoundEngine::createSource(const char* fileName, PNode* sourceNode)
 {
-  return new SoundSource((SoundBuffer*)ResourceManager::getInstance()->load(fileName, WAV, RP_LEVEL), sourceNode);
+  return new SoundSource(sourceNode, (SoundBuffer*)ResourceManager::getInstance()->load(fileName, WAV, RP_LEVEL));
 }
 
Index: /orxonox/trunk/src/lib/sound/sound_engine.h
===================================================================
--- /orxonox/trunk/src/lib/sound/sound_engine.h	(revision 4884)
+++ /orxonox/trunk/src/lib/sound/sound_engine.h	(revision 4885)
@@ -27,5 +27,5 @@
 
   /** @returns the ID of the buffer used in this SoundBuffer */
-  inline ALuint getID() { return this->bufferID; }
+  inline ALuint getID() const { return this->bufferID; }
 
  private:
@@ -40,9 +40,10 @@
 {
  public:
-  SoundSource(SoundBuffer* buffer, PNode* sourceNode = NULL);
+  SoundSource(const PNode* sourceNode = NULL, const SoundBuffer* buffer = NULL);
   ~SoundSource();
 
   // user interaction
   void play();
+  void play(const SoundBuffer* buffer);
   void stop();
   void pause();
@@ -53,14 +54,14 @@
   inline ALuint getID() const { return this->sourceID; }
   /** @returns the SoundBuffer of this Source */
-  inline SoundBuffer* getBuffer() const { return this->buffer; }
+  inline const SoundBuffer* getBuffer() const { return this->buffer; }
   /** @returns the SourceNode of this Source */
-  inline PNode* getNode() const { return this->sourceNode;}
+  inline const PNode* getNode() const { return this->sourceNode;}
 
   void setRolloffFactor(ALfloat rolloffFactor);
 
  private:
-  ALuint           sourceID;              //!< The ID of the Source
-  SoundBuffer*     buffer;                //!< The buffer to play in this source.
-  PNode*           sourceNode;            //!< The SourceNode represente the position/velocity... of this source.
+  ALuint                 sourceID;              //!< The ID of the Source
+  const SoundBuffer*     buffer;                //!< The buffer to play in this source.
+  const PNode*           sourceNode;            //!< The SourceNode represente the position/velocity... of this source.
 };
 
Index: /orxonox/trunk/src/orxonox.cc
===================================================================
--- /orxonox/trunk/src/orxonox.cc	(revision 4884)
+++ /orxonox/trunk/src/orxonox.cc	(revision 4885)
@@ -51,5 +51,5 @@
 #include <string.h>
 
-int verbose = 3;
+int verbose = 4;
 
 using namespace std;
Index: /orxonox/trunk/src/story_entities/world.cc
===================================================================
--- /orxonox/trunk/src/story_entities/world.cc	(revision 4884)
+++ /orxonox/trunk/src/story_entities/world.cc	(revision 4885)
@@ -841,5 +841,5 @@
   while( entity != NULL )
     {
-      if( entity->bDraw ) entity->draw();
+      if( entity->isVisible() ) entity->draw();
       //entity = this->entities->nextElement();
       entity = iterator->nextElement();
Index: /orxonox/trunk/src/util/animation/t_animation.h
===================================================================
--- /orxonox/trunk/src/util/animation/t_animation.h	(revision 4884)
+++ /orxonox/trunk/src/util/animation/t_animation.h	(revision 4885)
@@ -205,5 +205,5 @@
               this->nextKeyFrame = this->keyFrameList->nextElement(this->currentKeyFrame);
 
-              printf("%p from:%f to:%f\n", this->currentKeyFrame,this->currentKeyFrame->value, this->nextKeyFrame->value);
+              //printf("%p from:%f to:%f\n", this->currentKeyFrame,this->currentKeyFrame->value, this->nextKeyFrame->value);
               this->setAnimFunc(this->currentKeyFrame->animFunc);
             }
Index: /orxonox/trunk/src/util/loading/factory.h
===================================================================
--- /orxonox/trunk/src/util/loading/factory.h	(revision 4884)
+++ /orxonox/trunk/src/util/loading/factory.h	(revision 4885)
@@ -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/trunk/src/util/loading/game_loader.cc
===================================================================
--- /orxonox/trunk/src/util/loading/game_loader.cc	(revision 4884)
+++ /orxonox/trunk/src/util/loading/game_loader.cc	(revision 4885)
@@ -19,5 +19,4 @@
 #include "campaign.h"
 #include "world.h"
-#include "player.h"
 #include "orxonox.h"
 #include "camera.h"
Index: /orxonox/trunk/src/util/loading/game_loader.h
===================================================================
--- /orxonox/trunk/src/util/loading/game_loader.h	(revision 4884)
+++ /orxonox/trunk/src/util/loading/game_loader.h	(revision 4885)
@@ -1,5 +1,5 @@
 /*!
-    \file game_loader.h
-  *  loads campaigns, worlds and all other story_entities
+ * @file game_loader.h
+ *  loads campaigns, worlds and all other story_entities
 */
 
@@ -18,6 +18,4 @@
 class Campaign;
 class World;
-class Camera;
-class CammandNode;
 class Factory;
 class TiXmlElement;
Index: /orxonox/trunk/src/world_entities/player.cc
===================================================================
--- /orxonox/trunk/src/world_entities/player.cc	(revision 4884)
+++ /orxonox/trunk/src/world_entities/player.cc	(revision 4885)
@@ -23,14 +23,11 @@
 
 #include "weapon_manager.h"
-#include "weapon.h"
 #include "test_gun.h"
 #include "world.h"
 
 #include "list.h"
-#include "stdincl.h"
 
 #include "event_handler.h"
 
-#include "projectile.h"
 #include "event.h"
 
@@ -41,14 +38,9 @@
 
 /**
- *  creates a new Player
+ * creates a new Player
  * @param isFree if the player is free
 */
 Player::Player()
 {
-  /*
-    this is the debug player - actualy we would have to make a new
-     class derivated from Player for each player. for now, we just use
-     the player.cc for debug also
-  */
   this->init();
 
@@ -75,5 +67,4 @@
   delete this->weaponMan;
 }
-
 
 /**
@@ -119,5 +110,5 @@
 
 /**
- *
+ * loads the Settings of a Player from an XML-element.
  * @param root the XML-element to load the Player's properties from
  */
@@ -132,5 +123,5 @@
 
 /**
- *  adds a weapon to the weapon list of player
+ * adds a weapon to the weapon list of player
  * @param weapon to add
 */
@@ -219,15 +210,10 @@
 void Player::tick (float time)
 {
-  //printf("%p\n", this);
-  //this->getRelCoor().debug();
-
-  /* link tick to weapon */
-  //this->activeWeapon->tick(time);
-  //this->activeWeaponL->tick(time); //FIX FIX DELETE REMOVE
-  this->weaponMan->tick(time);
   // player controlled movement
   this->move(time);
+
+  this->weaponMan->tick(time);
   // weapon system manipulation
-  this->weapon();
+  this->weaponAction();
 }
 
@@ -255,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 */
 
@@ -264,7 +250,7 @@
 
 /**
- *  weapon manipulation by the player
-*/
-void Player::weapon()
+ * weapon manipulation by the player
+*/
+void Player::weaponAction()
 {
   if( this->bFire)
@@ -279,22 +265,4 @@
 }
 
-
-/**
- *  The connection to the command node
- * @param cmd the Command unit from witch to map
-
-   here the commands are mapped to the players movement/weaponary
-*/
-void Player::command (Command* cmd)
-{
-  PRINTF(3)("recieved command [%s]\n", cmd->cmd);
-  if( !strcmp( cmd->cmd, CONFIG_NAME_PLAYER_UP)) this->bUp = !cmd->bUp;
-  if( !strcmp( cmd->cmd, CONFIG_NAME_PLAYER_DOWN)) this->bDown = !cmd->bUp;
-  if( !strcmp( cmd->cmd, CONFIG_NAME_PLAYER_LEFT)) this->bLeft = !cmd->bUp;
-  if( !strcmp( cmd->cmd, CONFIG_NAME_PLAYER_RIGHT)) this->bRight = !cmd->bUp;
-  if( !strcmp( cmd->cmd, CONFIG_NAME_PLAYER_FIRE)) this->bFire = !cmd->bUp;
-  if( !strcmp( cmd->cmd, CONFIG_NAME_PLAYER_NEXT_WEAPON)) if(cmd->bUp) this->bWeaponChange = !this->bWeaponChange;
-}
-
 /**
  * @todo switch statement ??
@@ -303,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/trunk/src/world_entities/player.h
===================================================================
--- /orxonox/trunk/src/world_entities/player.h	(revision 4884)
+++ /orxonox/trunk/src/world_entities/player.h	(revision 4885)
@@ -1,5 +1,5 @@
 /*!
-    \file player.h
-  *  Implements a basic controllable WorldEntity
+ * @file player.h
+ * Implements a basic controllable WorldEntity
  */
 
@@ -15,9 +15,12 @@
 class WeaponManager;
 class Vector;
-class World;
 class Event;
-class Crosshair;
 
 //! Basic controllable WorldEntity
+/**
+  *  this is the debug player - actualy we would have to make a new
+     class derivated from Player for each player. for now, we just use
+     the player.cc for debug also
+*/
 class Player : public WorldEntity, public PhysicsInterface, public EventListener
 {
@@ -43,6 +46,4 @@
     virtual void draw();
 
-    virtual void command(Command* cmd);
-
     virtual void process(const Event &event);
 
@@ -50,29 +51,22 @@
   private:
     void move(float time);
-    void weapon();
+    void weaponAction();
 
 
   private:
-    bool bUp;              //!< up button pressed.
-    bool bDown;            //!< down button pressed.
-    bool bLeft;            //!< left button pressed.
-    bool bRight;           //!< right button pressed.
-    bool bAscend;          //!< ascend button pressed.
-    bool bDescend;         //!< descend button presses.
-    bool bFire;            //!< fire button pressed.
-    bool bWeaponChange;    //!< weapon change button pressed
+    bool                  bUp;                //!< up button pressed.
+    bool                  bDown;              //!< down button pressed.
+    bool                  bLeft;              //!< left button pressed.
+    bool                  bRight;             //!< right button pressed.
+    bool                  bAscend;            //!< ascend button pressed.
+    bool                  bDescend;           //!< descend button presses.
+    bool                  bFire;              //!< fire button pressed.
+    bool                  bWeaponChange;      //!< weapon change button pressed
 
-    tList<Weapon>* weapons;//!< a list of weapon
-    Weapon* activeWeapon;  //!< the weapon that is currenty activated
-    Weapon* activeWeaponL;  //temporary -- FIX THIS
-    WeaponManager* weaponMan; //!< the weapon manager: managing a list of weapon to wepaon-slot mapping
+    WeaponManager*        weaponMan;          //!< the weapon manager: managing a list of weapon to wepaon-slot mapping
 
-    World* myWorld;        //!< reference to the world object
-
-    Vector* velocity;       //!< the velocity of the player.
-    float travelSpeed;     //!< the current speed of the player (to make soft movement)
-    float acceleration;    //!< the acceleration of the player.
-
-    Crosshair*  crosshair; //!< the crosshair of the player
+    Vector*               velocity;           //!< the velocity of the player.
+    float                 travelSpeed;        //!< the current speed of the player (to make soft movement)
+    float                 acceleration;       //!< the acceleration of the player.
 };
 
Index: /orxonox/trunk/src/world_entities/weapons/test_gun.cc
===================================================================
--- /orxonox/trunk/src/world_entities/weapons/test_gun.cc	(revision 4884)
+++ /orxonox/trunk/src/world_entities/weapons/test_gun.cc	(revision 4885)
@@ -50,5 +50,4 @@
 
   this->model = (Model*)ResourceManager::getInstance()->load("models/test_gun.obj", OBJ, RP_CAMPAIGN);
-  this->idleTime = 0.2f;
   this->leftRight = leftRight;
 
@@ -92,11 +91,19 @@
       this->animation3->addKeyFrame(Vector(-2.6, 0.1, -2.0), Quaternion(), 0.1, ANIM_LINEAR, ANIM_CONSTANT);
     }
-
+/*
   this->fireSound = (SoundBuffer*)ResourceManager::getInstance()->load("sound/shot1.wav", WAV);
   this->weaponSource = new SoundSource(this->fireSound, this);
-  this->weaponSource->setRolloffFactor(.1);
+  this->weaponSource->setRolloffFactor(.1);*/
   Projectile* p = new TestBullet(this);
-//  ObjectManager::getInstance()->cache(CL_TEST_BULLET, 100, p);
+
+  //  ObjectManager::getInstance()->cache(CL_TEST_BULLET, 100, p);
   //ObjectManager::getInstance()->debug();
+
+  this->setStateDuration(WS_SHOOTING, .2);
+
+  this->energy = 100;
+  this->minCharge = 2;
+
+  this->setActionSound(WA_SHOOT, "sound/shot1.wav");
 }
 
@@ -145,12 +152,7 @@
 void TestGun::fire()
 {
-  if( !this->hasWeaponIdleTimeElapsed())
-    {
-      this->weaponIdle();
-      return;
-    }
-
-    Projectile* pj =  new TestBullet(this);//dynamic_cast<Projectile*>(ObjectManager::getInstance()->getFromDeadList(CL_TEST_BULLET & CL_MASK_LOWLEVEL_CLASS));
-  weaponSource->play();
+  this->energyLoaded -= this->minCharge;
+  Projectile* pj =  new TestBullet(this);//dynamic_cast<Projectile*>(ObjectManager::getInstance()->getFromDeadList(CL_TEST_BULLET & CL_MASK_LOWLEVEL_CLASS));
+//  weaponSource->play();
 
   pj->setAbsCoor(this->getAbsCoor() + this->projectileOffset);
@@ -158,5 +160,4 @@
   pj->setVelocity(this->getVelocity());
   State::getWorldEntityList()->add(pj);
-  this->localTime = 0;
 
   this->animation1->replay();
@@ -184,13 +185,4 @@
 void TestGun::destroy ()
 {}
-
-
-/**
- *  tick signal for time dependent/driven stuff
-*/
-void TestGun::tick (float time)
-{
-  this->localTime += time;
-}
 
 
Index: /orxonox/trunk/src/world_entities/weapons/test_gun.h
===================================================================
--- /orxonox/trunk/src/world_entities/weapons/test_gun.h	(revision 4884)
+++ /orxonox/trunk/src/world_entities/weapons/test_gun.h	(revision 4885)
@@ -34,6 +34,4 @@
 class TestGun : public Weapon
 {
-  friend class World;
-
   public:
     TestGun (PNode* parent, const Vector& coordinate, const Quaternion& direction, int leftRight);
@@ -47,5 +45,4 @@
     virtual void destroy();
 
-    virtual void tick(float time);
     virtual void weaponIdle();
     virtual void draw();
Index: /orxonox/trunk/src/world_entities/weapons/weapon.cc
===================================================================
--- /orxonox/trunk/src/world_entities/weapons/weapon.cc	(revision 4884)
+++ /orxonox/trunk/src/world_entities/weapons/weapon.cc	(revision 4885)
@@ -13,5 +13,9 @@
    main-programmer: Patrick Boenzli
    co-programmer: Benjamin Grauer
-*/
+
+   2005-07-15: Benjamin Grauer: restructurating the entire Class
+*/
+
+#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_WEAPON
 
 #include "weapon.h"
@@ -23,12 +27,15 @@
 #include "list.h"
 #include "state.h"
-
-/**
- *  standard constructor
-
-   creates a new weapon
+#include "animation3d.h"
+#include "sound_engine.h"
+
+/**
+ * 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,133 +43,231 @@
 }
 
-
-/**
- *  standard deconstructor
+/**
+ * standard deconstructor
 */
 Weapon::~Weapon ()
 {
-  // model will be deleted from WorldEntity-destructor
-  //this->worldEntities = NULL;
-
-  /* dont delete objectComponentsX here, they will be killed when the pnodes are cleaned out */
-
-  /* all animations are deleted via the animation player*/
-}
-
-
-/**
-  *  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
- * @param new projectile for this weapon
-
-   weapon an projectile are independent, so you can combine them as you want
-*/
-void Weapon::setProjectile(Projectile* projectile)
-{
-  this->projectile = projectile;
-}
-
-
-/**
- *  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
-*/
-Projectile* Weapon::getProjectile()
-{
-  return this->projectile;
-}
-
-
-/**
- *  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.
+  for (int i = 0; i < WS_STATE_COUNT; i++)
+    if (this->animation[i])
+      delete this->animation[i];
+  for (int i = 0; i < WA_ACTION_COUNT; i++)
+    if (this->soundBuffers[i])
+      ResourceManager::getInstance()->unload(this->soundBuffers[i]);
+}
+
+/**
+ * initializes the Weapon with ALL default values
+ */
+void Weapon::init()
+{
+  this->currentState     = WS_INACTIVE;
+  this->requestedAction  = WA_NONE;
+  this->stateDuration    = 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->requestedAction = WA_NONE;
+  this->soundSource = new SoundSource(this);
+
+  this->active = true;
+  this->projectile = NULL;
+
+  this->minCharge = 1.0;
+  this->maxCharge = 1.0;
+  this->energyLoaded = .0;
+  this->energyLoadedMax = 10.0;
+  this->energy = .0;
+  this->energyMax = 100.0;
+}
+
+
+void Weapon::setActionSound(WeaponAction action, const char* soundFile)
+{
+  if (action >= WA_ACTION_COUNT)
+    return;
+  else if (soundFile != NULL)
+  {
+    this->soundBuffers[action] = (SoundBuffer*)ResourceManager::getInstance()->load(soundFile, WAV);
+    if (this->soundBuffers[action] != NULL)
+    {
+      PRINTF(4)("Loaded sound %s to action %s\n", soundFile, actionToChar(action));
+    }
+    else
+    {
+      PRINTF(4)("failed to load sound %s to %s\n", soundFile, actionToChar(action));
+    }
+  }
+  else
+    this->soundBuffers[action] = NULL;
+}
+
+/**
+ * request an action that should be executed,
+ * @param action the next action to take
+ *
+ * This function must be called instead of the actions (like fire/reload...)
+ * to make all the checks needed to have a usefull WeaponSystem.
+ */
+void Weapon::requestAction(WeaponAction action)
+{
+  if (this->requestedAction != WA_NONE)
+    return;
+  else
+  {
+    printf("next action will be %s in %f seconds\n", actionToChar(action), this->stateDuration);
+    this->requestedAction = action;
+  }
+}
+
+bool Weapon::execute()
+{
+  this->stateDuration = this->times[this->requestedAction] + this->stateDuration;
+
+  PRINTF(4)("trying to execute action %s\n", actionToChar(this->requestedAction));
+  this->debug();
+
+  switch (this->requestedAction)
+  {
+    case WA_SHOOT:
+      //if (likely(this->currentState != WS_INACTIVE))
+      {
+        if (this->minCharge <= this->energyLoaded)
+        {
+          if (this->soundBuffers[WA_SHOOT] != NULL)
+            this->soundSource->play(this->soundBuffers[WA_SHOOT]);
+          this->fire();
+          this->requestedAction = WA_NONE;
+        }
+        else  // reload if we still have the charge
+        {
+          this->requestedAction = WA_NONE;
+          this->requestAction(WA_RELOAD);
+        }
+      }
+      break;
+    case WA_CHARGE:
+      if ( this->currentState != WS_INACTIVE && this->energyLoaded >= this->minCharge)
+      {
+        if (this->soundBuffers[WA_CHARGE] != NULL)
+         this->soundSource->play(this->soundBuffers[WA_CHARGE]);
+        this->charge();
+        this->requestedAction = WA_NONE;
+      }
+      else // deactivate the Weapon if we do not have enough energy
+      {
+        this->requestedAction = WA_NONE;
+        this->requestAction(WA_RELOAD);
+      }
+      break;
+    case WA_RELOAD:
+      //if (this->currentState != WS_INACTIVE && this->energy + this->energyLoaded >= this->minCharge)
+      {
+        if (this->soundBuffers[WA_RELOAD] != NULL)
+          this->soundSource->play(this->soundBuffers[WA_RELOAD]);
+
+        this->reload();
+        this->requestedAction = WA_NONE;
+      }
+      break;
+    case WA_DEACTIVATE:
+      if (this->currentState != WS_INACTIVE)
+      {
+        if (this->soundBuffers[WA_DEACTIVATE] != NULL)
+          this->soundSource->play(this->soundBuffers[WA_DEACTIVATE]);
+
+        this->deactivate();
+        this->requestedAction = WA_NONE;
+      }
+      break;
+    case WA_ACTIVATE:
+      if (this->currentState == WS_INACTIVE)
+      {
+        if (this->soundBuffers[WA_ACTIVATE] != NULL)
+          this->soundSource->play(this->soundBuffers[WA_ACTIVATE]);
+
+        this->activate();
+        this->requestedAction = WA_NONE;
+      }
+      break;
+  }
+}
+
+/**
+ * this activates the weapon
 */
 void Weapon::activate()
-{}
-
-
-/**
- *  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.
+{
+  PRINTF(4)("Activating the Weapon %s\n", this->getName());
+
+  if (this->soundBuffers[WA_ACTIVATE] != NULL)
+    this->soundSource->play(this->soundBuffers[WA_ACTIVATE]);
+}
+
+
+/**
+ * this deactivates the weapon
 */
 void Weapon::deactivate()
-{}
-
-/**
- *  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)
- * @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.
-*/
-void Weapon::hit (WorldEntity* entity, const Vector& position)
-{}
+{
+  PRINTF(4)("Deactivating the Weapon %s\n", this->getName());
+
+  if (this->soundBuffers[WA_DEACTIVATE] != NULL)
+    this->soundSource->play(this->soundBuffers[WA_DEACTIVATE]);
+}
+
+void Weapon::fire()
+{
+  this->energyLoaded -= this->minCharge;
+
+  if (this->soundBuffers[WA_SHOOT] != NULL)
+    this->soundSource->play(this->soundBuffers[WA_SHOOT]);
+}
+
+void Weapon::reload()
+{
+  PRINTF(4)("Reloading Weapon %s\n", this->getName());
+  if (this->energy + this->energyLoaded < this->minCharge)
+  {
+    this->requestAction(WA_DEACTIVATE);
+    return;
+  }
+
+  float chargeSize = this->energyLoadedMax - this->energyLoaded;       //!< The energy to be charged
+
+  if (chargeSize > this->energy)
+  {
+    this->energyLoaded += this->energy;
+    this->energy = 0.0;
+    PRINT(3)("Energy empty");
+  }
+  else
+  {
+    PRINTF(3)("Loaded %f energy into the Guns Buffer\n", chargeSize);
+    this->energyLoaded += chargeSize;
+    this->energy -= chargeSize;
+  }
+  if (this->soundBuffers[WA_RELOAD] != NULL)
+    this->soundSource->play(this->soundBuffers[WA_RELOAD]);
+
+}
+
+void Weapon::charge()
+{
+  if (this->soundBuffers[WA_CHARGE] != NULL)
+    this->soundSource->play(this->soundBuffers[WA_CHARGE]);
+
+}
 
 
 /**
  *  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 ()
@@ -171,16 +276,24 @@
 
 /**
- *  tick signal for time dependent/driven stuff
-*/
-void Weapon::tick (float time)
-{}
-
-
-/**
- *  is called, when there is no fire button pressed
-*/
-void Weapon::weaponIdle()
-{}
-
+ * tick signal for time dependent/driven stuff
+*/
+void Weapon::tick(float dt)
+{
+  // setting up the timing properties
+  this->stateDuration -= dt;
+
+  if (this->isActive())
+  {
+    if (this->stateDuration <= 0.0 && this->requestedAction != WA_NONE)
+    {
+      this->stateDuration = -dt;
+      this->execute();
+    }
+  }
+  else
+    if (this->requestedAction == WA_ACTIVATE)
+      this->activate();
+
+}
 
 /**
@@ -190,2 +303,162 @@
 {}
 
+
+
+
+
+//////////////////////
+// HELPER FUNCTIONS //
+//////////////////////
+// inclass
+/**
+ * checks if the next Action given is valid
+ * @returns if the Action that comes next is valid
+ * @todo more checks
+ */
+bool Weapon::nextActionValid() const
+{
+  if (this->currentState == WS_INACTIVE)
+  {
+    return (this->requestedAction == WA_ACTIVATE || this->requestedAction == WA_NONE);
+  }
+  else
+    return true;
+
+}
+
+
+/**
+ * some nice debugging information about this Weapon
+ */
+void Weapon::debug() const
+{
+  PRINT(3)("Weapon-Debug %s, state: %s, nexAction: %s\n", this->getName(), Weapon::stateToChar(this->currentState), Weapon::actionToChar(requestedAction));
+  PRINT(3)("Energy: max: %f; current: %f;  loadedMax: %f; loadedCurrent: %f; chargeMin: %f, chargeMax %f\n",
+            this->energyMax, this->energy, this->energyLoadedMax, this->energyLoaded, this->minCharge, this->maxCharge);
+}
+
+
+// static
+/**
+ * Converts a String into an Action.
+ * @param action the String input holding the Action.
+ * @return The Action if known, WA_NONE otherwise.
+ */
+WeaponAction Weapon::charToAction(const char* action)
+{
+  if (!strcmp(action, "none"))
+    return WA_NONE;
+  else if (!strcmp(action, "shoot"))
+    return WA_SHOOT;
+  else if (!strcmp(action, "charge"))
+    return WA_CHARGE;
+  else if (!strcmp(action, "reload"))
+    return WA_RELOAD;
+  else if (!strcmp(action, "acitvate"))
+    return WA_ACTIVATE;
+  else if (!strcmp(action, "deactivate"))
+    return WA_DEACTIVATE;
+  else if (!strcmp(action, "special1"))
+    return WA_SPECIAL1;
+  else
+    {
+      PRINTF(2)("action %s could not be identified.\n", action);
+      return WA_NONE;
+    }
+}
+
+/**
+ * converts an action into a String
+ * @param action the action to convert
+ * @return a String matching the name of the action
+ */
+const char* Weapon::actionToChar(WeaponAction action)
+{
+  switch (action)
+  {
+    case WA_SHOOT:
+      return "shoot";
+      break;
+    case WA_CHARGE:
+      return "charge";
+      break;
+    case WA_RELOAD:
+      return "reload";
+      break;
+    case WA_ACTIVATE:
+      return "activate";
+      break;
+    case WA_DEACTIVATE:
+      return "deactivate";
+      break;
+    case WA_SPECIAL1:
+      return "special1";
+      break;
+    default:
+      return "none";
+      break;
+  }
+}
+
+/**
+ * Converts a String into a State.
+ * @param state the String input holding the State.
+ * @return The State if known, WS_NONE otherwise.
+ */
+WeaponState Weapon::charToState(const char* state)
+{
+  if (!strcmp(state, "none"))
+    return WS_NONE;
+  else if (!strcmp(state, "shooting"))
+    return WS_SHOOTING;
+  else if (!strcmp(state, "charging"))
+    return WS_CHARGING;
+  else if (!strcmp(state, "reloading"))
+    return WS_RELOADING;
+  else if (!strcmp(state, "activating"))
+    return WS_ACTIVATING;
+  else if (!strcmp(state, "deactivating"))
+    return WS_DEACTIVATING;
+  else if (!strcmp(state, "inactive"))
+    return WS_INACTIVE;
+  else if (!strcmp(state, "idle"))
+    return WS_IDLE;
+  else
+    {
+      PRINTF(2)("state %s could not be identified.\n", state);
+      return WS_NONE;
+    }
+}
+
+/**
+ * converts a State into a String
+ * @param state the state to convert
+ * @return a String matching the name of the state
+ */
+const char* Weapon::stateToChar(WeaponState state)
+{
+  switch (state)
+  {
+    case WS_SHOOTING:
+      return "shooting";
+      break;
+    case WS_CHARGING:
+      return "charging";
+      break;
+    case WS_RELOADING:
+      return "reloading";
+      break;
+    case WS_ACTIVATING:
+      return "activating";
+      break;
+    case WS_DEACTIVATING:
+      return "deactivating";
+      break;
+    case WS_IDLE:
+      return "idle";
+      break;
+    default:
+      return "none";
+      break;
+  }
+}
Index: /orxonox/trunk/src/world_entities/weapons/weapon.h
===================================================================
--- /orxonox/trunk/src/world_entities/weapons/weapon.h	(revision 4884)
+++ /orxonox/trunk/src/world_entities/weapons/weapon.h	(revision 4885)
@@ -12,5 +12,5 @@
     weapon in this world:
      o sound file/ressource: this is a pointer to the sound-file/ressource. however it may be represented
-     o shooting animation
+     o animations
 */
 
@@ -39,5 +39,5 @@
 
   WA_ACTION_COUNT  =    7     //!< This must match the count of enumerations-members.
-} WeaponActions;
+} WeaponAction;
 
 //! An enumerator defining the States of a Weapon
@@ -45,4 +45,5 @@
   WS_NONE          =    0,    //!< No State at all (if set, there is something wrong, or the weapon is not yet availiable)
   WS_SHOOTING      =    1,    //!< The State of the Shooting
+  WS_CHARGING      =    2,    //!< The state of charging th weapon
   WS_RELOADING     =    3,    //!< The State of the Reloading
   WS_ACTIVATING    =    4,    //!< The State in which the weapon gets activated
@@ -68,67 +69,96 @@
 class Weapon : public WorldEntity
 {
-  friend class World;
+  public:
+    // INITIALISATION //
+    Weapon (PNode* parent, const Vector& coordinate, const Quaternion& direction);
+    Weapon(const TiXmlElement* root);
+    virtual ~Weapon ();
 
- public:
-  Weapon (PNode* parent, const Vector& coordinate, const Quaternion& direction);
-  Weapon(const TiXmlElement* root);
-  virtual ~Weapon ();
+    void init();
+    void loadParams(const TiXmlElement* root);
+    ////////////////////
 
-  void init();
-  void loadParams(const TiXmlElement* root);
+    void requestAction(WeaponAction action);
 
-  void enable();
-  void disable();
-  bool isEnabled();
+    /** @returns true if the Weapon is Active */
+    inline bool isActive() const { return this->active; };
 
-  void setProjectile(Projectile* projectile);
-  Projectile* getProjectile();
+    // FUNCTIONS TO SET THE WEAPONS PROPERTIES.
+    /** @param projectile a projectile for this weapon */
+    void setProjectile(Projectile* projectile) { this->projectile = projectile; };
+    /** @returns The projectile if availiable */
+    Projectile* getProjectile() { return this->projectile; };
 
-  virtual void activate();
-  virtual void deactivate();
-  bool isActive();
+    /** @param state the State to time @param duration the duration of the State */
+    inline void setStateDuration(const char* state, float duration) { setStateDuration(charToState(state), duration); };
+    /** @param state the State to time @param duration the duration of the State */
+    inline void setStateDuration(WeaponState state, float duration) { /*(state < WS_STATE_COUNT)?*/this->times[state] = duration; };
+    /** @param state The state to query @returns the Time the queried State takes to complete */
+    inline float getStateDuration(WeaponState state) const { return (state < WS_STATE_COUNT)?this->times[state]:0.0; };
+    /** @returns true if the time of the currentState is elapsed, false otherwise */
+    inline bool stateTimeElapsed() const { return (this->stateDuration > this->times[currentState])?true:false; };
+    /** @returns the current State of the Weapon */
+    inline WeaponState getCurrentState() const { return this->currentState; };
+    /** @param energyMax the maximum energy the Weapon can have @param energyLoadedMax the maximum energy in the weapon buffers */
+    inline void setMaximumEnergy(float energyMax, float energyLoadedMax = 0.0) { this->energyMax = energyMax; this->energyLoadedMax = energyLoadedMax; };
+
+    void setActionSound(WeaponAction action, const char* soundFile);
+    /** @see void setActionSound(WeaponAction action, const char* soundFile); */
+    void setActionSound(const char* action, const char* soundFile) { this->setActionSound(charToAction(action), soundFile); };
+
+    virtual void destroy();
 
 
-  /** @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; };
+    // FLOW
+    virtual void tick(float dt);
+    virtual void draw();
 
-  /**  fires the weapon */
-  virtual void fire() = 0;
-  virtual void hit (WorldEntity* weapon, const Vector& loc);
-  virtual void destroy();
+    void debug() const;
 
-  virtual void tick(float time);
-  virtual void weaponIdle();
-  virtual void draw();
+  protected:
+    // utility:
+    static WeaponAction  charToAction(const char* action);
+    static const char*   actionToChar(WeaponAction action);
+    static WeaponState   charToState(const char* state);
+    static const char*   stateToChar(WeaponState state);
 
- 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...
+    //! ACTION: these functions are handled by the Weapon itself, and must be called by requestAction(WeaponAction);
+    bool execute();
+    virtual void activate();
+    virtual void deactivate();
+    virtual void fire();
+    virtual void reload();
+    virtual void charge();
 
-  ////////////
-  // PHASES //
-  ////////////
-  WeaponState          currentState;                     //!< The State the weapon is in.
-  float                stateTime;                        //!< how long the state has teken 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.
-  Animation3D*         animation[WS_STATE_COUNT];        //!< Animations for all the States (you can say yourself on what part of the gun this animation acts).
+  private:
+    bool nextActionValid() const;
 
-  SoundBuffer*         fireSound;
-  SoundSource*         weaponSource;
+  protected:
+    SoundSource*         soundSource;
+    // it is all about energy
+    float                energy;
+    float                energyLoaded;
+    float                energyMax;
+    float                energyLoadedMax;
+    float                minCharge;
+    float                maxCharge;
 
-  float                minCharge;
-  float                maxCharge;
+    ////////////
+    // PHASES //
+    ////////////
+  private:
+    WeaponState          currentState;                     //!< The State the weapon is in.
+    WeaponAction         requestedAction;                  //!< An action to try to Engage after the currentState ends.
+    float                stateDuration;                    //!< how long the state has taken until now.
+    float                times[WS_STATE_COUNT];            //!< Times to stay in the different States @see WeaponState.
+    Animation3D*         animation[WS_STATE_COUNT];        //!< Animations for all the States (you can say yourself on what part of the gun this animation acts).
+    SoundBuffer*         soundBuffers[WA_ACTION_COUNT];    //!< SoundBuffers for all actions @see WeaponAction.
 
- private:
-   bool                 enabled;                         //<! states if the weapon is enabled or not
-   Projectile*          projectile;                      //<! the projectile used for this weapon
-  //WeaponSound sound;
-};
+
+    bool                 hideInactive;                    //!< Hides the Weapon if it is inactive
+
+    bool                 active;                          //!< states wheter the weapon is enabled or not
+    Projectile*          projectile;                      //!< the projectile used for this weapon
+  };
 
 #endif /* _WEAPON_H */
Index: /orxonox/trunk/src/world_entities/weapons/weapon_manager.cc
===================================================================
--- /orxonox/trunk/src/world_entities/weapons/weapon_manager.cc	(revision 4884)
+++ /orxonox/trunk/src/world_entities/weapons/weapon_manager.cc	(revision 4885)
@@ -201,10 +201,10 @@
       if( w1 != NULL )
       {
-        w1->deactivate();
+        w1->requestAction(WA_DEACTIVATE);
         printf("deactivating %i,%i\n", j,lastConfID);
       }
       if( w2 != NULL)
       {
-        w2->activate();
+        w2->requestAction(WA_ACTIVATE);
         printf("activating %i,%i\n", j, this->currConfID);
       }
@@ -223,5 +223,5 @@
   {
     firingWeapon = this->configs[this->currConfID].slots[i];
-    if( firingWeapon != NULL) firingWeapon->fire();
+    if( firingWeapon != NULL) firingWeapon->requestAction(WA_SHOOT);
   }
   this->crosshair->setRotationSpeed(500);
Index: /orxonox/trunk/src/world_entities/world_entity.cc
===================================================================
--- /orxonox/trunk/src/world_entities/world_entity.cc	(revision 4884)
+++ /orxonox/trunk/src/world_entities/world_entity.cc	(revision 4885)
@@ -38,5 +38,5 @@
     this->loadParams(root);
 
-  this->bDraw = true;
+  this->setVisibiliy(true);
 }
 
@@ -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,44 +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;
-}
-*/
-
-
-/**
-  *  process draw function
-*/
-void WorldEntity::processDraw ()
-{
-
-}
-
-/**
- *  sets the drawable state of this entity.
- * @param bDraw TRUE if draweable, FALSE otherwise
-*/
-void WorldEntity::setDrawable (bool bDraw)
-{
-  this->bDraw = bDraw;
-}
-
-
 /**
  *  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)
@@ -146,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) {}
@@ -154,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 ()
@@ -165,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 ()
@@ -177,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)
@@ -184,9 +149,9 @@
 }
 
-
 /**
  *  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()
@@ -228,13 +193,2 @@
   glPopMatrix();
 }
-
-/**
- *  this handles incoming command messages
- * @param cmd: a pointer to the incoming Command structure
-
-   Put all code that handles Command messages here, this will mainly be called by the assigned CommandNode but can also be used
-   to send commands from one WorldEntity to another.
-*/
-void WorldEntity::command (Command* cmd)
-{
-}
Index: /orxonox/trunk/src/world_entities/world_entity.h
===================================================================
--- /orxonox/trunk/src/world_entities/world_entity.h	(revision 4884)
+++ /orxonox/trunk/src/world_entities/world_entity.h	(revision 4885)
@@ -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,9 +22,7 @@
 
 
-//! 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
 {
-  friend class World;
-
  public:
   WorldEntity(const TiXmlElement* root = NULL);
@@ -35,9 +32,12 @@
   void loadModel(const char* fileName);
 
-  //void setCollision (CollisionCluster* newhull);
 
   //void addAbility(Ability* ability);
   //void removeAbility(Ability* ability);
-  void setDrawable (bool bDraw);
+
+  /** @param visibility if the Entity should be visible (been draw) */
+  void setVisibiliy (bool visibility) { this->bVisible = visibility; };
+  /** @returns true if the entity is visible, false otherwise */
+  bool isVisible() const { return this->bVisible; };
   void setCharacterAttributes(CharacterAttributes* charAttr);
   CharacterAttributes* getCharacterAttributes();
@@ -48,26 +48,20 @@
   virtual void hit (WorldEntity* weapon, Vector* loc);
   virtual void collideWith (WorldEntity* entity);
-  virtual void command (Command* cmd);
 
   /** @returns the Count of Faces on this WorldEntity */
   virtual unsigned int getFaceCount () const { if (this->model) return this->model->getFaceCount(); else return 0; };
 
-  void processDraw ();
+  virtual void tick (float time);
   virtual void draw ();
   void drawBVTree(int depth, int drawMode);
-  virtual void tick (float time);
 
  protected:
-  Model* model;                       //!< The model that should be loaded for this entity.
-  CharacterAttributes* charAttr;      //!< the character attributes of a world_entity
-  BVTree*             obbTree;       //!< this is the obb tree reference needed for collision detection
+  Model*                  model;            //!< The model that should be loaded for this entity.
+  CharacterAttributes*    charAttr;         //!< the character attributes of a world_entity
+  BVTree*                 obbTree;          //!< this is the obb tree reference needed for collision detection
 
  private:
-  bool bCollide;                      //!< If it should be considered for the collisiontest.
-  bool bDraw;                         //!< If it should be visible.
-
-
-
-  //CollisionCluster* collisioncluster; //!< The collision-Cluster of this entity.
+  bool                    bCollide;         //!< If it should be considered for the collisiontest.
+  bool                    bVisible;         //!< If it should be visible.
 };
 
