Index: trunk/src/world_entities/Makefile.am
===================================================================
--- trunk/src/world_entities/Makefile.am	(revision 6162)
+++ trunk/src/world_entities/Makefile.am	(revision 6222)
@@ -8,5 +8,5 @@
                   camera.cc \
                   playable.cc \
-		              player.cc \
+		  player.cc \
                   npc.cc \
                   npc2.cc \
@@ -18,5 +18,6 @@
                   character_attributes.cc \
                   test_entity.cc \
-		              space_ships/space_ship.cc \
+                  space_ships/space_ship.cc \
+                  creatures/md2_creature.cc \
                   weapons/weapon_manager.cc \
                   weapons/weapon.cc \
@@ -27,7 +28,7 @@
                   weapons/rocket.cc \
                   weapons/laser.cc \
-		              weapons/ground_turret.cc \
+		  weapons/ground_turret.cc \
                   weapons/crosshair.cc \
-		              weapons/ground_turret.cc \
+		  weapons/ground_turret.cc \
                   power_ups/power_up.cc \
                   power_ups/turret_power_up.cc \
@@ -38,5 +39,5 @@
                  camera.h \
                  playable.h \
-		             player.h \
+		 player.h \
                  npc.h \
                  npc2.h \
@@ -49,4 +50,5 @@
                  test_entity.h \
 		 space_ships/space_ship.h \
+		 creatures/md2_creature.cc \
                  weapons/weapon_manager.h \
                  weapons/weapon.h \
Index: trunk/src/world_entities/camera.cc
===================================================================
--- trunk/src/world_entities/camera.cc	(revision 6162)
+++ trunk/src/world_entities/camera.cc	(revision 6222)
@@ -119,6 +119,6 @@
     case VIEW_NORMAL:
       this->toFovy = 60.0;
-      this->setParentSoft("TrackNode");
-      this->target->setParentSoft("TrackNode");
+/*      this->setParentSoft("TrackNode");
+      this->target->setParentSoft("TrackNode"); */
       this->setRelCoorSoft(-10, 5, 0);
       this->target->setRelCoorSoft(0,0,0);
@@ -129,9 +129,9 @@
   //    this->target->setRelCoorSoft(Vector(10,0,0));
 
-      if (!strcmp(this->target->getParent()->getName(), "Player"))
-        this->target->setParentSoft("TrackNode");
-      else
-        this->target->setParentSoft("Player");
-      this->getParent()->debugNode(0);
+//       if (!strcmp(this->target->getParent()->getName(), "Player"))
+//         this->target->setParentSoft("TrackNode");
+//       else
+//         this->target->setParentSoft("Player");
+//       this->getParent()->debugNode(0);
 
 //      this->setParent("main-Turret");
@@ -142,6 +142,6 @@
     case VIEW_FRONT:
       this->toFovy = 120.0;
-       this->setParentSoft("Player");
-       this->target->setParentSoft("Player");
+/*       this->setParentSoft("Player");
+       this->target->setParentSoft("Player");*/
        this->setRelCoorSoft(4, 0, 0, 5);
        this->target->setRelCoorSoft(Vector(10,0,0), 5);
@@ -150,6 +150,6 @@
     case VIEW_LEFT:
       this->toFovy = 90;
-      this->setParentSoft("TrackNode");
-      this->target->setParentSoft("TrackNode");
+/*      this->setParentSoft("TrackNode");
+      this->target->setParentSoft("TrackNode");*/
       this->setRelCoorSoft(0, 1, -10, .5);
       this->target->setRelCoorSoft(0,0,0);
@@ -157,6 +157,6 @@
     case VIEW_RIGHT:
       this->toFovy = 90;
-      this->setParentSoft("TrackNode");
-      this->target->setParentSoft("TrackNode");
+/*      this->setParentSoft("TrackNode");
+      this->target->setParentSoft("TrackNode");*/
       this->setRelCoorSoft(Vector(0, 1, 10));
       this->target->setRelCoorSoft(0,0,0);
@@ -164,6 +164,6 @@
     case VIEW_TOP:
       this->toFovy= 120;
-      this->setParentSoft("TrackNode");
-      this->target->setParentSoft("TrackNode");
+/*      this->setParentSoft("TrackNode");
+      this->target->setParentSoft("TrackNode");*/
       this->setRelCoorSoft(Vector(30, 50, 0));
       this->target->setRelCoorSoft(35,0,0);
Index: trunk/src/world_entities/creatures/md2_creature.cc
===================================================================
--- trunk/src/world_entities/creatures/md2_creature.cc	(revision 6222)
+++ trunk/src/world_entities/creatures/md2_creature.cc	(revision 6222)
@@ -0,0 +1,444 @@
+/*
+   orxonox - the future of 3D-vertical-scrollers
+
+   Copyright (C) 2004 orx
+
+   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 2, or (at your option)
+   any later version.
+
+### File Specific:
+   main-programmer: Patrick Boenzli
+   co-programmer:
+
+*/
+
+#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_WORLD_ENTITY
+
+#include "executor/executor.h"
+#include "md2_creature.h"
+
+#include "objModel.h"
+#include "md2Model.h"
+#include "resource_manager.h"
+#include "state.h"
+
+#include "weapons/weapon_manager.h"
+#include "weapons/test_gun.h"
+#include "weapons/turret.h"
+#include "weapons/cannon.h"
+
+#include "factory.h"
+#include "key_mapper.h"
+#include "event_handler.h"
+
+#include "graphics_engine.h"
+
+using namespace std;
+
+CREATE_FACTORY(MD2Creature, CL_MD2_CREATURE);
+
+/**
+ *  creates the controlable MD2Creature
+ */
+MD2Creature::MD2Creature()
+{
+  this->init();
+}
+
+/**
+ *  destructs the MD2Creature, deletes alocated memory
+ */
+MD2Creature::~MD2Creature ()
+{
+}
+
+/**
+ * loads a MD2Creatures information from a specified file.
+ * @param fileName the name of the File to load the MD2Creature from (absolute path)
+ */
+MD2Creature::MD2Creature(const char* fileName)
+{
+  this->init();
+  TiXmlDocument doc(fileName);
+
+  if(!doc.LoadFile())
+  {
+    PRINTF(2)("Loading file %s failed for md2 creature.\n", fileName);
+    return;
+  }
+
+  this->loadParams(doc.RootElement());
+}
+
+/**
+ *  creates a new MD2Creature from Xml Data
+ * @param root the xml element containing MD2Creature data
+
+   @todo add more parameters to load
+*/
+MD2Creature::MD2Creature(const TiXmlElement* root)
+{
+  this->init();
+  if (root != NULL)
+    this->loadParams(root);
+
+  //weapons:
+  Weapon* wpRight = new TestGun(0);
+  wpRight->setName("testGun Right");
+  Weapon* wpLeft = new TestGun(1);
+  wpLeft->setName("testGun Left");
+  Weapon* cannon = dynamic_cast<Weapon*>(Factory::fabricate(CL_CANNON));
+
+  cannon->setName("BFG");
+
+   this->getWeaponManager()->addWeapon(wpLeft, 1, 0);
+   this->getWeaponManager()->addWeapon(wpRight,1 ,1);
+//   this->getWeaponManager()->addWeapon(cannon, 0, 6);
+
+  //this->getWeaponManager()->addWeapon(turret, 3, 0);
+
+  this->getWeaponManager()->changeWeaponConfig(0);
+}
+
+
+/**
+ * initializes a MD2Creature
+ */
+void MD2Creature::init()
+{
+//  this->setRelDir(Quaternion(M_PI, Vector(1,0,0)));
+  this->setClassID(CL_MD2_CREATURE, "MD2Creature");
+
+  PRINTF(4)("MD2CREATURE INIT\n");
+
+  EventHandler::getInstance()->grabEvents(true);
+
+  this->mouseDirX *= Quaternion( M_PI * 0.75f, Vector(0,1,0));
+
+  bUp = bDown = bLeft = bRight = bAscend = bDescend = bRollL = bRollR = bStrafeL = bStrafeR = bJump = false;
+  bFire = false;
+  xMouse = yMouse = 0;
+  mouseSensitivity = 0.003;
+  airViscosity = 0.0;
+  cycle = 0.0;
+
+  this->cameraConnNode.addNodeFlags(PNODE_PROHIBIT_DELETE_WITH_PARENT);
+  this->cameraConnNode.setName("CameraConnectorNode");
+  this->addChild(&this->cameraConnNode);
+  this->cameraConnNode.addChild(State::getCameraTarget());
+  this->cameraConnNode.addChild(State::getCamera());
+  State::getCameraTarget()->setRelCoor(10,0,0);
+
+  travelSpeed = 15.0;
+  this->velocity = Vector(0.0,0.0,0.0);
+
+//   GLGuiButton* button = new GLGuiPushButton();
+//   button->show();
+//   button->setLabel("orxonox");
+//   button->setBindNode(this);
+
+  //add events to the eventlist
+  this->registerEvent(SDLK_w);
+  this->registerEvent(SDLK_s);
+  this->registerEvent(SDLK_a);
+  this->registerEvent(SDLK_d);
+  this->registerEvent(SDLK_SPACE);
+  this->registerEvent(SDLK_q);
+  this->registerEvent(SDLK_e);
+  this->registerEvent(KeyMapper::PEV_FIRE1);
+  this->registerEvent(KeyMapper::PEV_NEXT_WEAPON);
+  this->registerEvent(KeyMapper::PEV_PREVIOUS_WEAPON);
+  this->registerEvent(EV_MOUSE_MOTION);
+
+
+
+  this->getWeaponManager()->setSlotCount(7);
+
+  this->getWeaponManager()->setSlotPosition(0, Vector(-0.5, .2, -1.9));
+  this->getWeaponManager()->setSlotCapability(0, WTYPE_ALLDIRS | WTYPE_DIRECTIONAL);
+
+  this->getWeaponManager()->setSlotPosition(1, Vector(-0.5, .2, 1.9));
+  this->getWeaponManager()->setSlotCapability(1, WTYPE_ALLDIRS | WTYPE_DIRECTIONAL);
+
+  this->getWeaponManager()->setSlotPosition(2, Vector(-1.5, .5, -.5));
+  this->getWeaponManager()->setSlotDirection(2, Quaternion(-M_PI_4*.5, Vector(1,0,0)));
+
+  this->getWeaponManager()->setSlotPosition(3, Vector(-1.5, .5, .5));
+  this->getWeaponManager()->setSlotDirection(3, Quaternion(M_PI_4*.5, Vector(1,0,0)));
+
+  this->getWeaponManager()->setSlotPosition(4, Vector(-1.5, -.5, .5));
+  this->getWeaponManager()->setSlotDirection(4, Quaternion(-M_PI_4*.5+M_PI, Vector(1,0,0)));
+
+  this->getWeaponManager()->setSlotPosition(5, Vector(-1.5, -.5, -.5));
+  this->getWeaponManager()->setSlotDirection(5, Quaternion(+M_PI_4*.5-M_PI, Vector(1,0,0)));
+//
+   this->getWeaponManager()->setSlotPosition(6, Vector(-1, 0.0, 0));
+   this->getWeaponManager()->setSlotCapability(6, WTYPE_ALLDIRS | WTYPE_DIRECTIONAL);
+   //
+
+   this->cameraConnNode.addChild(this->getWeaponManager()->getFixedTarget());
+  this->getWeaponManager()->getFixedTarget()->setRelCoor(10,0,0);
+
+}
+
+
+void MD2Creature::enter()
+{
+  dynamic_cast<Element2D*>(this->getWeaponManager()->getFixedTarget())->setVisibility( true);
+
+
+}
+
+void MD2Creature::leave()
+{
+  dynamic_cast<Element2D*>(this->getWeaponManager()->getFixedTarget())->setVisibility( false);
+
+
+}
+
+/**
+ * loads the Settings of a MD2Creature from an XML-element.
+ * @param root the XML-element to load the MD2Creature's properties from
+ */
+void MD2Creature::loadParams(const TiXmlElement* root)
+{
+  static_cast<WorldEntity*>(this)->loadParams(root);
+}
+
+
+/**
+ * adds a weapon to the weapon list of the MD2Creature
+ * @param weapon to add
+*/
+void MD2Creature::addWeapon(Weapon* weapon)
+{
+  this->getWeaponManager()->addWeapon(weapon);
+}
+
+
+/**
+ *  removes a weapon from the MD2Creature
+ * @param weapon to remove
+*/
+void MD2Creature::removeWeapon(Weapon* weapon)
+{
+  this->getWeaponManager()->removeWeapon(weapon);
+}
+
+/**
+ *  effect that occurs after the MD2Creature is spawned
+*/
+void MD2Creature::postSpawn ()
+{
+  //setCollision(new CollisionCluster(1.0, Vector(0,0,0)));
+}
+
+/**
+ *  the action occuring if the MD2Creature left the game
+*/
+void MD2Creature::leftWorld ()
+{}
+
+/**
+ *  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
+ */
+void MD2Creature::collidesWith(WorldEntity* entity, const Vector& location)
+{
+  if (entity->isA(CL_TURRET_POWER_UP) )
+  {
+    this->ADDWEAPON();
+    }
+//  PRINTF(3)("collision %s vs %s @ (%f,%f,%f)\n", this->getClassName(), entity->getClassName(), location.x, location.y, location.z);
+}
+
+/**
+ *  draws the MD2Creature after transforming it.
+*/
+void MD2Creature::draw () const
+{
+  this->drawLODsafe();
+
+//  this->cameraConnNode.debugDraw(0);
+}
+
+
+/**
+ *  the function called for each passing timeSnap
+ * @param time The timespan passed since last update
+*/
+void MD2Creature::tick (float time)
+{
+  if( likely(this->getModel(0) != NULL))
+    ((MD2Model*)this->getModel(0))->tick(time);
+
+
+  // MD2Creature controlled movement
+  this->calculateVelocity(time);
+  Vector move = this->velocity * time;
+  this->shiftCoor (move);
+
+  if( this->bJump)
+  {
+    ((MD2Model*)this->getModel(0))->setAnim(JUMP);
+  }
+  else if( this->bFire)
+  {
+    if( ((MD2Model*)this->getModel(0))->getAnim() != ATTACK) ((MD2Model*)this->getModel(0))->setAnim(ATTACK);
+  }
+  else if( fabs(move.len()) > 0.0f)
+  {
+    if( ((MD2Model*)this->getModel(0))->getAnim() != RUN) ((MD2Model*)this->getModel(0))->setAnim(RUN);
+  }
+  else
+  {
+    if( ((MD2Model*)this->getModel(0))->getAnim() != STAND) ((MD2Model*)this->getModel(0))->setAnim(STAND);
+  }
+
+
+  //orient the MD2Creature in direction of the mouse
+  this->setAbsDir(mouseDirX);
+  this->cameraConnNode.setAbsDirSoft(mouseDirX*mouseDirY, 10);
+
+  this->getWeaponManager()->tick(time);
+  // weapon system manipulation
+  this->weaponAction();
+}
+
+
+/**
+ *  calculate the velocity
+ * @param time the timeslice since the last frame
+*/
+void MD2Creature::calculateVelocity (float time)
+{
+  Vector accel(0.0, 0.0, 0.0);
+  /*
+  Vector rot(0.0, 0.0, 0.0); // wird benötigt für Helicopter
+  */
+  //float rotVal = 0.0;
+  /* FIXME: calculating the direction and orthDirection every timeSlice is redundant! save it somewhere */
+  /* calculate the direction in which the craft is heading  */
+
+  if( this->bUp )
+   {
+     accel += (this->getAbsDirX())*2;
+   }
+
+  if( this->bDown )
+   {
+     accel -= (this->getAbsDirX())*2;
+   }
+
+  if( this->bLeft/* > -this->getRelCoor().z*2*/)
+  {
+    this->shiftDir(Quaternion(time, Vector(0,1,0)));
+  }
+  if( this->bRight /* > this->getRelCoor().z*2*/)
+  {
+    this->shiftDir(Quaternion(-time, Vector(0,1,0)));
+  }
+
+
+  if( this->bStrafeL /* > -this->getRelCoor().z*2*/)
+  {
+    accel -= this->getAbsDirZ() * 2.0f;
+  }
+  if( this->bStrafeR /* > this->getRelCoor().z*2*/)
+  {
+    accel += this->getAbsDirZ() * 2.0f;
+  }
+  if (this->bAscend )
+  {
+    this->shiftDir(Quaternion(time, Vector(0,0,1)));
+  }
+  if (this->bDescend )
+  {
+    this->shiftDir(Quaternion(-time, Vector(0,0,1)));
+  }
+
+  velocity = accel * 20.0f;
+  //rot.normalize();
+  //this->setRelDirSoft(Quaternion(rotVal, rot), 5);
+}
+
+
+/**
+ * weapon manipulation by the player
+*/
+void MD2Creature::weaponAction()
+{
+  if( this->bFire)
+    {
+      this->getWeaponManager()->fire();
+    }
+}
+
+/**
+ * @todo switch statement ??
+ */
+void MD2Creature::process(const Event &event)
+{
+  if( event.type == SDLK_a)
+      this->bStrafeL = event.bPressed;
+  else if( event.type == SDLK_d)
+      this->bStrafeR = event.bPressed;
+  else if( event.type == KeyMapper::PEV_FIRE1)
+      this->bFire = event.bPressed;
+  else if( event.type == KeyMapper::PEV_NEXT_WEAPON && event.bPressed)
+    this->getWeaponManager()->nextWeaponConfig();//if( !event.bPressed) this->bWeaponChange = !this->bWeaponChange;
+  else if ( event.type == KeyMapper::PEV_PREVIOUS_WEAPON && event.bPressed)
+    this->getWeaponManager()->previousWeaponConfig();
+  else if( event.type == SDLK_w)
+    this->bUp = event.bPressed; //this->shiftCoor(0,.1,0);
+  else if( event.type == SDLK_s)
+    this->bDown = event.bPressed; //this->shiftCoor(0,-.1,0);
+  else if( event.type == SDLK_SPACE)
+    this->bJump = event.bPressed;
+  else if( event.type == EV_MOUSE_MOTION)
+  {
+    this->xMouse = event.xRel;
+    this->yMouse = event.yRel;
+    this->mouseDirX *= Quaternion(-M_PI/4*this->xMouse*mouseSensitivity, Vector(0,1,0));
+    this->mouseDirY *= Quaternion(-M_PI/4*this->yMouse*mouseSensitivity, Vector(0,0,1));
+//     if( xMouse*xMouse < 0.9)
+//      this->setAbsDir(mouseDir);
+  }
+}
+
+#include "weapons/aiming_turret.h"
+// FIXME THIS MIGHT BE CONSIDERED EITHER A FEATURE, OR A BUG
+void MD2Creature::ADDWEAPON()
+{
+  Weapon* turret = NULL;
+
+  if ((float)rand()/RAND_MAX < .1)
+  {
+    //if (this->getWeaponManager()->hasFreeSlot(2, WTYPE_TURRET))
+    {
+      turret = new Turret();
+      this->getWeaponManager()->addWeapon(turret, 2);
+      this->getWeaponManager()->changeWeaponConfig(2);
+    }
+  }
+  else
+  {
+    //if (this->getWeaponManager()->hasFreeSlot(3))
+    {
+      turret = new AimingTurret();
+      this->getWeaponManager()->addWeapon(turret, 3);
+
+      this->getWeaponManager()->changeWeaponConfig(3);
+    }
+  }
+
+  if(turret != NULL)
+  {
+    turret->setName("Turret");
+    turret->setStateDuration(WS_SHOOTING, (float)rand()/RAND_MAX*.5+.1);
+  }
+}
Index: trunk/src/world_entities/creatures/md2_creature.h
===================================================================
--- trunk/src/world_entities/creatures/md2_creature.h	(revision 6222)
+++ trunk/src/world_entities/creatures/md2_creature.h	(revision 6222)
@@ -0,0 +1,84 @@
+/*!
+ * @file md2_creature.h
+ * Implements the control of a md2 model
+ */
+
+#ifndef _MD2_CREATURE_H
+#define _MD2_CREATURE_H
+
+#include "playable.h"
+
+
+template<class T> class tList;
+class Vector;
+class Event;
+
+class MD2Creature : public Playable
+{
+
+  public:
+
+    MD2Creature();
+    MD2Creature(const char* fileName);
+    MD2Creature(const TiXmlElement* root);
+    virtual ~MD2Creature();
+
+    void init();
+    void loadParams(const TiXmlElement* root);
+
+    virtual void enter();
+    virtual void leave();
+
+    void addWeapon(Weapon* weapon );
+    void removeWeapon(Weapon* weapon);
+
+    virtual void postSpawn();
+    virtual void leftWorld();
+
+    virtual void collidesWith(WorldEntity* entity, const Vector& location);
+    virtual void tick(float time);
+    virtual void draw() const;
+
+    virtual void process(const Event &event);
+
+
+
+  private:
+
+    void calculateVelocity(float time);
+    void weaponAction();
+
+    // !! temporary !!
+    void ADDWEAPON();
+
+    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                  bRollL;             //!< rolling button pressed (left)
+    bool                  bRollR;             //!< rolling button pressed (right)
+    bool                  bStrafeL;           //!< strafe to the left side
+    bool                  bStrafeR;           //!< strafe to the rith side
+    bool                  bJump;              //!< jump
+
+    PNode                 cameraConnNode;     //!< The Node the camera is connected to.
+
+    float                 xMouse;             //!< mouse moved in x-Direction
+    float                 yMouse;             //!< mouse moved in y-Direction
+    float                 mouseSensitivity;   //!< the mouse sensitivity
+    float                 cycle;              //!< hovercycle
+
+    Vector                velocity;           //!< the velocity of the player.
+    Quaternion            mouseDirX;           //!< the direction where the player wants to fly
+    Quaternion            mouseDirY;           //!< the direction where the player wants to fly
+    float                 travelSpeed;        //!< the current speed of the player (to make soft movement)
+    float                 acceleration;       //!< the acceleration of the player.
+
+    float                 airViscosity;
+
+};
+
+#endif /* _MD2_CREATURE_H */
Index: trunk/src/world_entities/npcs/npc.cc
===================================================================
--- trunk/src/world_entities/npcs/npc.cc	(revision 6162)
+++ trunk/src/world_entities/npcs/npc.cc	(revision 6222)
@@ -22,5 +22,4 @@
 
 #include "state.h"
-#include "list.h"
 #include "stdlibincl.h"
 #include "power_ups/turret_power_up.h"
Index: trunk/src/world_entities/npcs/npc_test.cc
===================================================================
--- trunk/src/world_entities/npcs/npc_test.cc	(revision 6162)
+++ trunk/src/world_entities/npcs/npc_test.cc	(revision 6222)
@@ -23,5 +23,4 @@
 #include "shader.h"
 #include "state.h"
-#include "list.h"
 #include "stdlibincl.h"
 #include "debug.h"
Index: trunk/src/world_entities/npcs/npc_test1.cc
===================================================================
--- trunk/src/world_entities/npcs/npc_test1.cc	(revision 6162)
+++ trunk/src/world_entities/npcs/npc_test1.cc	(revision 6222)
@@ -22,6 +22,4 @@
 
 #include "state.h"
-#include "list.h"
-#include "stdlibincl.h"
 #include "power_ups/turret_power_up.h"
 #include "power_ups/laser_power_up.h"
Index: trunk/src/world_entities/playable.h
===================================================================
--- trunk/src/world_entities/playable.h	(revision 6162)
+++ trunk/src/world_entities/playable.h	(revision 6222)
@@ -25,4 +25,6 @@
     virtual ~Playable();
 
+    virtual void enter() {};
+    virtual void leave() {};
 
     virtual void addWeapon(Weapon* weapon )  {}//= 0;
@@ -34,5 +36,5 @@
 
     virtual void process(const Event &event) = 0;
-    
+
 
 
Index: trunk/src/world_entities/player.cc
===================================================================
--- trunk/src/world_entities/player.cc	(revision 6162)
+++ trunk/src/world_entities/player.cc	(revision 6222)
@@ -19,4 +19,8 @@
 #include "event_handler.h"
 
+
+#include "class_list.h"
+#include "state.h"
+
 using namespace std;
 
@@ -28,4 +32,6 @@
 {
   this->init();
+
+  EventHandler::getInstance()->subscribe(this, ES_GAME, SDLK_l);
 }
 
@@ -79,4 +85,26 @@
  void Player::process(const Event &event)
  {
+   if (event.type == SDLK_l && event.bPressed)
+   {
+     /// FIXME this should be in the ObjectManager
+     const std::list<BaseObject*>* objectList = ClassList::getList(CL_PLAYABLE);
+     if (objectList != NULL)
+     {
+       list<BaseObject*>::const_iterator node;
+       for (node = objectList->begin(); node != objectList->end(); node++)
+         if (this->controllable != (*node) && (dynamic_cast<PNode*>(*node)->getAbsCoor() - this->controllable->getAbsCoor()).len() < 10.0)
+       {
+         this->controllable->leave();
+         this->disconnectControllable();
+         this->setControllable(dynamic_cast<Playable*>(*node));
+         this->controllable->enter();
+         State::getCamera()->setParentSoft(this->controllable);
+         State::getCameraTarget()->setParentSoft(this->controllable);
+
+         break;
+       }
+     }
+   }
+
    if (likely(this->controllable != NULL))
      this->controllable->process(event);
Index: trunk/src/world_entities/power_ups/laser_power_up.cc
===================================================================
--- trunk/src/world_entities/power_ups/laser_power_up.cc	(revision 6162)
+++ trunk/src/world_entities/power_ups/laser_power_up.cc	(revision 6222)
@@ -19,5 +19,4 @@
 #include "factory.h"
 #include "state.h"
-#include "list.h"
 
 #include "primitive_model.h"
Index: trunk/src/world_entities/power_ups/param_power_up.cc
===================================================================
--- trunk/src/world_entities/power_ups/param_power_up.cc	(revision 6162)
+++ trunk/src/world_entities/power_ups/param_power_up.cc	(revision 6222)
@@ -19,5 +19,4 @@
 #include "factory.h"
 #include "state.h"
-#include "list.h"
 
 #include "primitive_model.h"
Index: trunk/src/world_entities/power_ups/turret_power_up.cc
===================================================================
--- trunk/src/world_entities/power_ups/turret_power_up.cc	(revision 6162)
+++ trunk/src/world_entities/power_ups/turret_power_up.cc	(revision 6222)
@@ -19,5 +19,4 @@
 #include "factory.h"
 #include "state.h"
-#include "list.h"
 
 #include "primitive_model.h"
Index: trunk/src/world_entities/power_ups/weapon_power_up.cc
===================================================================
--- trunk/src/world_entities/power_ups/weapon_power_up.cc	(revision 6162)
+++ trunk/src/world_entities/power_ups/weapon_power_up.cc	(revision 6222)
@@ -19,5 +19,4 @@
 #include "factory.h"
 #include "state.h"
-#include "list.h"
 
 #include "primitive_model.h"
Index: trunk/src/world_entities/satellite.cc
===================================================================
--- trunk/src/world_entities/satellite.cc	(revision 6162)
+++ trunk/src/world_entities/satellite.cc	(revision 6222)
@@ -21,5 +21,4 @@
 
 #include "objModel.h"
-#include "list.h"
 #include "vector.h"
 
Index: trunk/src/world_entities/space_ships/helicopter.cc
===================================================================
--- trunk/src/world_entities/space_ships/helicopter.cc	(revision 6162)
+++ trunk/src/world_entities/space_ships/helicopter.cc	(revision 6222)
@@ -95,4 +95,5 @@
 
   this->getWeaponManager()->changeWeaponConfig(1);
+  dynamic_cast<Element2D*>(this->getWeaponManager()->getFixedTarget())->setVisibility( false);
 }
 
@@ -184,4 +185,21 @@
 
 
+
+
+void Helicopter::enter()
+{
+  dynamic_cast<Element2D*>(this->getWeaponManager()->getFixedTarget())->setVisibility( true);
+
+
+}
+
+void Helicopter::leave()
+{
+  dynamic_cast<Element2D*>(this->getWeaponManager()->getFixedTarget())->setVisibility( false);
+
+
+}
+
+
 /**
  * adds a weapon to the weapon list of the spaceship
@@ -324,5 +342,5 @@
          if(this->getAbsDirZ().y > 0.02) this->shiftDir(Quaternion(time/5, Vector(1,0,0)));
    }
-   
+
   if( this->bRight /* > this->getRelCoor().z*2*/)
   {
Index: trunk/src/world_entities/space_ships/helicopter.h
===================================================================
--- trunk/src/world_entities/space_ships/helicopter.h	(revision 6162)
+++ trunk/src/world_entities/space_ships/helicopter.h	(revision 6222)
@@ -24,4 +24,7 @@
     void loadParams(const TiXmlElement* root);
 
+    virtual void enter();
+    virtual void leave();
+
     void addWeapon(Weapon* weapon );
     void removeWeapon(Weapon* weapon);
@@ -39,5 +42,4 @@
 
   private:
-
     void calculateVelocity(float time);
     void weaponAction();
@@ -65,5 +67,5 @@
     float                 travelSpeed;        //!< the current speed of the player (to make soft movement)
     float                 acceleration;       //!< the acceleration of the player.
-    
+
     float                 airViscosity;
 
Index: trunk/src/world_entities/space_ships/space_ship.cc
===================================================================
--- trunk/src/world_entities/space_ships/space_ship.cc	(revision 6162)
+++ trunk/src/world_entities/space_ships/space_ship.cc	(revision 6222)
@@ -112,5 +112,5 @@
   PRINTF(4)("SPACESHIP INIT\n");
 
-  EventHandler::getInstance()->grabEvents(true);
+//   EventHandler::getInstance()->grabEvents(true);
 
   bUp = bDown = bLeft = bRight = bAscend = bDescend = bRollL = bRollR = false;
@@ -177,4 +177,5 @@
   this->getWeaponManager()->getFixedTarget()->setRelCoor(100000,0,0);
 
+  dynamic_cast<Element2D*>(this->getWeaponManager()->getFixedTarget())->setVisibility( false);
 }
 
@@ -188,4 +189,18 @@
 }
 
+
+void SpaceShip::enter()
+{
+  dynamic_cast<Element2D*>(this->getWeaponManager()->getFixedTarget())->setVisibility( true);
+
+
+}
+
+void SpaceShip::leave()
+{
+  dynamic_cast<Element2D*>(this->getWeaponManager()->getFixedTarget())->setVisibility( false);
+
+
+}
 
 /**
@@ -267,11 +282,11 @@
   velocity += ((this->getAbsDirX())*travelSpeed-velocity)*airViscosity;
   velocity = (velocity.getNormalized())*travelSpeed;
-  
+
   //orient the spaceship in direction of the mouse
    rotQuat = Quaternion::quatSlerp( this->getAbsDir(),mouseDir,fabsf(time)*3);
-   if (this->getAbsDir().distance(rotQuat) > 0.001)  
+   if (this->getAbsDir().distance(rotQuat) > 0.001)
     this->setAbsDir( rotQuat);
    //this->setAbsDirSoft(mouseDir,5);
-   
+
   // this is the air friction (necessary for a smooth control)
   if(velocity.len() != 0) velocity -= velocity*0.01;
@@ -308,9 +323,11 @@
   /* calculate the direction in which the craft is heading  */
 
+  Plane plane(Vector(0,1,0), Vector(0,0,0));
+
   if( this->bUp )
    {
      //this->shiftCoor(this->getAbsDirX());
       accel += (this->getAbsDirX())*2;
-      
+
       /* Heli-Steuerung
          accel += (this->getAbsDirX()*2;
Index: trunk/src/world_entities/space_ships/space_ship.h
===================================================================
--- trunk/src/world_entities/space_ships/space_ship.h	(revision 6162)
+++ trunk/src/world_entities/space_ships/space_ship.h	(revision 6222)
@@ -26,4 +26,7 @@
     void init();
     void loadParams(const TiXmlElement* root);
+
+    virtual void enter();
+    virtual void leave();
 
     void addWeapon(Weapon* weapon );
Index: trunk/src/world_entities/test_entity.cc
===================================================================
--- trunk/src/world_entities/test_entity.cc	(revision 6162)
+++ trunk/src/world_entities/test_entity.cc	(revision 6222)
@@ -18,4 +18,8 @@
 
 
+#include "executor/executor.h"
+#include "factory.h"
+#include "load_param.h"
+
 #include "test_entity.h"
 #include "stdincl.h"
@@ -24,30 +28,51 @@
 #include "obb_tree.h"
 #include "state.h"
-#include "list.h"
 
 using namespace std;
 
 
+CREATE_FACTORY(TestEntity, CL_TEST_ENTITY);
+
 
 TestEntity::TestEntity ()
 {
-  this->setClassID(CL_TEST_ENTITY, "TestEntity");
-  // TO SOME LIST!!
+  this->init();
+}
 
-  this->md2Model = new MD2Model("models/droidika.md2", "models/droideka.pcx");
-//   this->md2Model = new MD2Model("models/tris.md2", "models/tris.pcx");
-// this->md2Model = new MD2Model("models/goblin.md2", "maps/goblin.bmp");
 
-/// FIXME
-//  this->obbTree = new OBBTree(4, (sVec3D*)this->md2Model->data->pVertices, this->md2Model->data->numVertices);
 
-  this->md2Model->setAnim(RUN);
-  this->md2Model->debug();
+TestEntity::TestEntity(const TiXmlElement* root)
+{
+  this->init();
+  if (root != NULL)
+    this->loadParams(root);
+
+  this->init();
 }
 
 
 TestEntity::~TestEntity ()
+{}
+
+
+
+void TestEntity::init()
 {
-  delete this->md2Model;
+  this->setClassID(CL_TEST_ENTITY, "TestEntity");
+  this->toList(OM_COMMON);
+}
+
+/**
+ * loads the Settings of a MD2Creature from an XML-element.
+ * @param root the XML-element to load the MD2Creature's properties from
+ */
+void TestEntity::loadParams(const TiXmlElement* root)
+{
+  static_cast<WorldEntity*>(this)->loadParams(root);
+
+  LoadParam(root, "md2animation", this, TestEntity, setAnim)
+      .describe("sets the animation of the md2 model")
+      .defaultValues(1, 1);
+
 }
 
@@ -55,5 +80,6 @@
 void  TestEntity::setAnim(int animationIndex)
 {
-  this->md2Model->setAnim(animationIndex);
+  if( likely(this->getModel(0) != NULL))
+    ((MD2Model*)this->getModel(0))->setAnim(animationIndex);
 }
 
@@ -61,20 +87,12 @@
 void TestEntity::tick (float time)
 {
-  this->md2Model->tick(time);
+  if( likely(this->getModel(0) != NULL))
+    ((MD2Model*)this->getModel(0))->tick(time);
+
 }
 
 
 void TestEntity::collidesWith(WorldEntity* entity, const Vector& location)
-{
-  if (entity->isA(CL_PROJECTILE))
-  {
-    PRINTF(3)("collision %s vs %s @ (%f,%f,%f)\n", this->getName(), entity->getName(), location.x, location.y, location.z);
-  this->setVisibiliy(false);
-  this->toList(OM_DEAD);
-  }
-}
-
-void TestEntity::destroy () {}
-
+{}
 
 
@@ -82,16 +100,5 @@
 void TestEntity::draw () const
 {
-  glMatrixMode(GL_MODELVIEW);
-  glPushMatrix();
-  float matrix[4][4];
-
-
-  glTranslatef (this->getAbsCoor ().x, this->getAbsCoor ().y, this->getAbsCoor ().z);
-  this->getAbsDir().matrix (matrix);
-  glMultMatrixf((float*)matrix);
-  this->md2Model->draw();
-
-
-  glPopMatrix();
+  this->drawLODsafe();
 }
 
Index: trunk/src/world_entities/test_entity.h
===================================================================
--- trunk/src/world_entities/test_entity.h	(revision 6162)
+++ trunk/src/world_entities/test_entity.h	(revision 6222)
@@ -10,4 +10,5 @@
 struct t3DModel;
 class Material;
+class TiXmlElement;
 
 class TestEntity : public WorldEntity, PhysicsInterface
@@ -17,10 +18,13 @@
  public:
   TestEntity ();
+  TestEntity(const TiXmlElement* root);
   virtual ~TestEntity ();
+
+  void init();
+  void loadParams(const TiXmlElement* root);
 
   void setAnim(int animationIndex);
 
   virtual void tick (float time);
-  virtual void destroy ();
   virtual void collidesWith(WorldEntity* entity, const Vector& location);
   virtual void draw () const;
Index: trunk/src/world_entities/weapons/aim.cc
===================================================================
--- trunk/src/world_entities/weapons/aim.cc	(revision 6162)
+++ trunk/src/world_entities/weapons/aim.cc	(revision 6222)
@@ -21,5 +21,4 @@
 #include "graphics_engine.h"
 #include "state.h"
-#include "list.h"
 #include "material.h"
 #include "t_animation.h"
@@ -104,23 +103,20 @@
 void Aim::searchTarget(float range)
 {
-  //FIXME//
-/*  tIterator<WorldEntity>* iterator = State::getWorldEntityList()->getIterator();
-  WorldEntity* entity = iterator->firstElement();
-  while (likely(entity != NULL))
+  std::list<WorldEntity*>::iterator entity;
+
+  for (entity = State::getObjectManager()->getObjectList(OM_GROUP_00).begin();
+       entity != State::getObjectManager()->getObjectList(OM_GROUP_00).end();
+       entity ++)
   {
-    if (entity->isA(CL_NPC) && this->source->getAbsCoor().x < entity->getAbsCoor().x && (this->source->getAbsCoor() - entity->getAbsCoor()).len() < range)
+    if (this->source->getAbsCoor().x < (*entity)->getAbsCoor().x && (this->source->getAbsCoor() - (*entity)->getAbsCoor()).len() < range)
     {
-      if (this->getParent() != entity)
+      if (this->getParent() != (*entity))
       {
         this->anim->replay();
-        this->setParentSoft(entity, 5);
+        this->setParentSoft(*entity, 5);
+        return;
       }
-      delete iterator;
-      return;
     }
-    entity = iterator->nextElement();
   }
-
-  delete iterator;*/
 }
 
Index: trunk/src/world_entities/weapons/bomb.cc
===================================================================
--- trunk/src/world_entities/weapons/bomb.cc	(revision 6162)
+++ trunk/src/world_entities/weapons/bomb.cc	(revision 6222)
@@ -21,5 +21,5 @@
 
 #include "fast_factory.h"
-#include "list.h"
+
 
 #include "object_manager.h"
Index: trunk/src/world_entities/weapons/guided_missile.cc
===================================================================
--- trunk/src/world_entities/weapons/guided_missile.cc	(revision 6162)
+++ trunk/src/world_entities/weapons/guided_missile.cc	(revision 6222)
@@ -20,7 +20,5 @@
 #include "fast_factory.h"
 
-#include "model.h"
 #include "state.h"
-#include "list.h"
 #include "class_list.h"
 
Index: trunk/src/world_entities/weapons/laser.cc
===================================================================
--- trunk/src/world_entities/weapons/laser.cc	(revision 6162)
+++ trunk/src/world_entities/weapons/laser.cc	(revision 6222)
@@ -21,5 +21,4 @@
 
 #include "state.h"
-#include "list.h"
 #include "class_list.h"
 #include "model.h"
Index: trunk/src/world_entities/weapons/rocket.cc
===================================================================
--- trunk/src/world_entities/weapons/rocket.cc	(revision 6162)
+++ trunk/src/world_entities/weapons/rocket.cc	(revision 6222)
@@ -20,7 +20,5 @@
 #include "fast_factory.h"
 
-#include "model.h"
 #include "state.h"
-#include "list.h"
 #include "class_list.h"
 
Index: trunk/src/world_entities/weapons/test_bullet.cc
===================================================================
--- trunk/src/world_entities/weapons/test_bullet.cc	(revision 6162)
+++ trunk/src/world_entities/weapons/test_bullet.cc	(revision 6222)
@@ -20,7 +20,5 @@
 #include "fast_factory.h"
 
-#include "model.h"
 #include "state.h"
-#include "list.h"
 #include "class_list.h"
 
Index: trunk/src/world_entities/weapons/test_gun.cc
===================================================================
--- trunk/src/world_entities/weapons/test_gun.cc	(revision 6162)
+++ trunk/src/world_entities/weapons/test_gun.cc	(revision 6222)
@@ -29,6 +29,4 @@
 #include "factory.h"
 
-#include "vector.h"
-#include "list.h"
 #include "animation3d.h"
 
Index: trunk/src/world_entities/weapons/turret.cc
===================================================================
--- trunk/src/world_entities/weapons/turret.cc	(revision 6162)
+++ trunk/src/world_entities/weapons/turret.cc	(revision 6222)
@@ -23,5 +23,4 @@
 
 #include "state.h"
-#include "list.h"
 #include "animation3d.h"
 
Index: trunk/src/world_entities/world_entity.cc
===================================================================
--- trunk/src/world_entities/world_entity.cc	(revision 6162)
+++ trunk/src/world_entities/world_entity.cc	(revision 6222)
@@ -21,7 +21,7 @@
 
 #include "model.h"
+#include "md2Model.h"
 #include "resource_manager.h"
 #include "load_param.h"
-#include "list.h"
 #include "vector.h"
 #include "obb_tree.h"
@@ -84,4 +84,8 @@
   // Do the PNode loading stuff
   static_cast<PNode*>(this)->loadParams(root);
+
+  LoadParam(root, "md2texture", this, WorldEntity, loadMD2Texture)
+      .describe("the fileName of the texture, that should be loaded onto this world-entity. (must be relative to the data-dir)")
+      .defaultValues(1, NULL);
 
   // Model Loading
@@ -89,6 +93,6 @@
       .describe("the fileName of the model, that should be loaded onto this world-entity. (must be relative to the data-dir)")
       .defaultValues(3, NULL, 1.0f, 0);
-
-}
+}
+
 
 /**
@@ -103,28 +107,39 @@
   if (fileName != NULL)
   {
-    // search for the special character # in the LoadParam
+   // search for the special character # in the LoadParam
     if (strchr(fileName, '#') != NULL)
+    {
+      PRINTF(4)("Found # in %s... searching for LOD's\n", fileName);
+      char* lodFile = new char[strlen(fileName)+1];
+      strcpy(lodFile, fileName);
+      char* depth = strchr(lodFile, '#');
+      for (unsigned int i = 0; i < 5; i++)
       {
-        PRINTF(4)("Found # in %s... searching for LOD's\n", fileName);
-        char* lodFile = new char[strlen(fileName)+1];
-        strcpy(lodFile, fileName);
-        char* depth = strchr(lodFile, '#');
-        for (unsigned int i = 0; i < 5; i++)
-          {
-            *depth = 48+(int)i;
-            printf("-------%s\n", lodFile);
-            if (ResourceManager::isInDataDir(lodFile))
-              this->loadModel(lodFile, scaling, i);
-          }
-        return;
+        *depth = 48+(int)i;
+        printf("-------%s\n", lodFile);
+        if (ResourceManager::isInDataDir(lodFile))
+          this->loadModel(lodFile, scaling, i);
       }
-
-    PRINTF(4)("fetching %s\n", fileName);
-    if (scaling == 1.0)
-      this->setModel((Model*)ResourceManager::getInstance()->load(fileName, OBJ, RP_CAMPAIGN), modelNumber);
-    else
-      this->setModel((Model*)ResourceManager::getInstance()->load(fileName, OBJ, RP_CAMPAIGN, &scaling), modelNumber);
-    if (modelNumber == 0)
-    this->buildObbTree(4);
+      return;
+    }
+
+    if(strstr(fileName, ".obj"))
+    {
+      PRINTF(4)("fetching OBJ file: %s\n", fileName);
+      if (scaling == 1.0)
+        this->setModel((Model*)ResourceManager::getInstance()->load(fileName, OBJ, RP_CAMPAIGN), modelNumber);
+      else
+        this->setModel((Model*)ResourceManager::getInstance()->load(fileName, OBJ, RP_CAMPAIGN, &scaling), modelNumber);
+
+      if( modelNumber == 0)
+        this->buildObbTree(4);
+    }
+    else if(strstr(fileName, ".md2"))
+    {
+      PRINTF(4)("fetching MD2 file: %s\n", fileName);
+      Model* m = new MD2Model(fileName, this->md2TextureFileName);
+        //this->setModel((Model*)ResourceManager::getInstance()->load(fileName, MD2, RP_CAMPAIGN), 0);
+      this->setModel(m, 0);
+    }
   }
   else
@@ -145,10 +160,12 @@
   {
     Resource* resource = ResourceManager::getInstance()->locateResourceByPointer(this->models[modelNumber]);
-    if (resource != NULL)
-      ResourceManager::getInstance()->unload(resource, RP_LEVEL);
-    else
-      delete this->models[modelNumber];
-  }
+//     if (resource != NULL)
+    ResourceManager::getInstance()->unload(resource, RP_LEVEL);
+  }
+  else
+    delete this->models[modelNumber];
+
   this->models[modelNumber] = model;
+
 
 //   if (this->model != NULL)
@@ -272,7 +289,11 @@
 }
 
+
+/**
+ *  this functions draws the model automaticaly in multiple LOD
+ */
 void WorldEntity::drawLODsafe() const
 {
-  if (!this->models.empty())
+  if (!unlikely(this->models.empty()))
   {
     glMatrixMode(GL_MODELVIEW);
@@ -291,5 +312,5 @@
     if (cameraDistance > 30 && this->models.size() >= 3 && this->models[2] != NULL)
     {
-       this->models[2]->draw();
+      this->models[2]->draw();
     }
     else if (cameraDistance > 10 && this->models.size() >= 2 && this->models[1] != NULL)
Index: trunk/src/world_entities/world_entity.h
===================================================================
--- trunk/src/world_entities/world_entity.h	(revision 6162)
+++ trunk/src/world_entities/world_entity.h	(revision 6222)
@@ -37,4 +37,6 @@
   Model* getModel(unsigned int modelNumber = 0) const { return (this->models.size() > modelNumber)? this->models[modelNumber] : NULL; };
 
+  inline void loadMD2Texture(const char* fileName) { this->md2TextureFileName = fileName; }
+
   bool buildObbTree(unsigned int depth);
   /** @returns a reference to the obb tree of this worldentity */
@@ -72,4 +74,6 @@
   /** @returns a Reference to the Iterator */
   std::list<WorldEntity*>::iterator& getEntityIterator() { return this->objectListIterator; }
+
+
  protected:
   //  CharacterAttributes*    charAttr;         //!< the character attributes of a world_entity
@@ -77,4 +81,5 @@
  private:
   std::vector<Model*>     models;             //!< The model that should be loaded for this entity.
+  const char*             md2TextureFileName; //!< the file name of the md2 model texture, only if this
   BVTree*                 obbTree;            //!< this is the obb tree reference needed for collision detection
 
