Index: branches/christmas_branche/src/defs/class_id.h
===================================================================
--- branches/christmas_branche/src/defs/class_id.h	(revision 6165)
+++ branches/christmas_branche/src/defs/class_id.h	(revision 6166)
@@ -149,5 +149,6 @@
   CL_SPACE_SHIP                 =    0x0000020a,
   CL_HELICOPTER                 =    0x0000020b,
-  CL_SPAWNING_POINT             =    0x0000020b,
+  CL_SPAWNING_POINT             =    0x0000020c,
+  CL_MD2_CREATURE               =    0x0000020d,
 
   CL_TURRET_POWER_UP            =    0x00000211,
Index: branches/christmas_branche/src/world_entities/Makefile.am
===================================================================
--- branches/christmas_branche/src/world_entities/Makefile.am	(revision 6165)
+++ branches/christmas_branche/src/world_entities/Makefile.am	(revision 6166)
@@ -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.h \
                  weapons/weapon_manager.h \
                  weapons/weapon.h \
Index: branches/christmas_branche/src/world_entities/creatures/md2_creature.cc
===================================================================
--- branches/christmas_branche/src/world_entities/creatures/md2_creature.cc	(revision 6166)
+++ branches/christmas_branche/src/world_entities/creatures/md2_creature.cc	(revision 6166)
@@ -0,0 +1,458 @@
+/*
+   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 "resource_manager.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_SPACE_SHIP);
+
+/**
+ *  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(1);
+}
+
+
+/**
+ * initializes a MD2Creature
+ */
+void MD2Creature::init()
+{
+//  this->setRelDir(Quaternion(M_PI, Vector(1,0,0)));
+  this->setClassID(CL_MD2_CREATURE, "MD2Creature");
+
+  PRINTF(4)("SPACESHIP INIT\n");
+
+  EventHandler::getInstance()->grabEvents(true);
+
+  bUp = bDown = bLeft = bRight = bAscend = bDescend = bRollL = bRollR = false;
+  bFire = false;
+  xMouse = yMouse = 0;
+  mouseSensitivity = 0.001;
+  airViscosity = 1.0;
+  cycle = 0.0;
+
+
+  travelSpeed = 15.0;
+  this->velocity = Vector(0.0,0.0,0.0);
+  this->mouseDir = this->getAbsDir();
+
+//   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_q);
+  this->registerEvent(SDLK_e);
+  this->registerEvent(KeyMapper::PEV_FIRE1);
+  this->registerEvent(KeyMapper::PEV_NEXT_WEAPON);
+  this->registerEvent(KeyMapper::PEV_PREVIOUS_WEAPON);
+  this->registerEvent(SDLK_PAGEUP);
+  this->registerEvent(SDLK_PAGEDOWN);
+  this->registerEvent(EV_MOUSE_MOTION);
+
+
+
+  this->getWeaponManager()->setSlotCount(7);
+
+  this->getWeaponManager()->setSlotPosition(0, Vector(-2.6, .1, -3.0));
+  this->getWeaponManager()->setSlotCapability(0, WTYPE_ALLDIRS | WTYPE_DIRECTIONAL);
+
+  this->getWeaponManager()->setSlotPosition(1, Vector(-2.6, .1, 3.0));
+  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->getWeaponManager()->getFixedTarget()->setParent(this);
+  this->getWeaponManager()->getFixedTarget()->setRelCoor(100000,0,0);
+
+}
+
+/**
+ * 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 ()
+{}
+
+WorldEntity* ref = NULL;
+/**
+ *  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) && entity != ref)
+  {
+    this->ADDWEAPON();
+    ref = entity;
+    }
+//  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->getWeaponManager()->draw();
+
+  //this->debug(0);
+}
+
+/**
+ *  the function called for each passing timeSnap
+ * @param time The timespan passed since last update
+*/
+void MD2Creature::tick (float time)
+{
+
+  // MD2Creature controlled movement
+  this->calculateVelocity(time);
+
+  Vector move = (velocity)*time;
+
+  //orient the velocity in the direction of the MD2Creature.
+  travelSpeed = velocity.len();
+  velocity += ((this->getAbsDirX())*travelSpeed-velocity)*airViscosity;
+  velocity = (velocity.getNormalized())*travelSpeed;
+
+  //orient the MD2Creature in direction of the mouse
+   rotQuat = Quaternion::quatSlerp( this->getAbsDir(),mouseDir,fabsf(time)*3);
+   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;
+
+  //hoover effect
+  cycle += time;
+  this->shiftCoor(Vector(0,1,0)*cos(this->cycle*2.0)*0.02);
+
+  //readjust
+ // if (this->getAbsDirZ().y > 0.1) this->shiftDir(Quaternion(time*0.3, Vector(1,0,0)));
+  //else if (this->getAbsDirZ().y < -0.1) this->shiftDir(Quaternion(-time*0.3, Vector(1,0,0)));
+
+  //SDL_WarpMouse(GraphicsEngine::getInstance()->getResolutionX()/2, GraphicsEngine::getInstance()->getResolutionY()/2);
+
+  this->shiftCoor (move);
+
+  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 )
+   {
+     //this->shiftCoor(this->getAbsDirX());
+      accel += (this->getAbsDirX())*2;
+
+      /* Heli-Steuerung
+         accel += (this->getAbsDirX()*2;
+         if(
+      */
+   }
+
+  if( this->bDown )
+   {
+     //this->shiftCoor((this->getAbsDirX())*-1);
+     accel -= (this->getAbsDirX())*2;
+   }
+
+  if( this->bLeft/* > -this->getRelCoor().z*2*/)
+  {
+    this->shiftDir(Quaternion(time, Vector(0,1,0)));
+//    accel -= rightDirection;
+    //velocityDir.normalize();
+    //rot +=Vector(1,0,0);
+    //rotVal -= .4;
+  }
+  if( this->bRight /* > this->getRelCoor().z*2*/)
+  {
+    this->shiftDir(Quaternion(-time, Vector(0,1,0)));
+
+    //    accel += rightDirection;
+    //velocityDir.normalize();
+    //rot += Vector(1,0,0);
+    //rotVal += .4;
+  }
+
+
+  if( this->bRollL /* > -this->getRelCoor().z*2*/)
+  {
+    mouseDir *= Quaternion(-time, Vector(1,0,0));
+//    accel -= rightDirection;
+    //velocityDir.normalize();
+    //rot +=Vector(1,0,0);
+    //rotVal -= .4;
+  }
+  if( this->bRollR /* > this->getRelCoor().z*2*/)
+  {
+    mouseDir *= Quaternion(time, Vector(1,0,0));
+
+    //    accel += rightDirection;
+    //velocityDir.normalize();
+    //rot += Vector(1,0,0);
+    //rotVal += .4;
+  }
+  if (this->bAscend )
+  {
+    this->shiftDir(Quaternion(time, Vector(0,0,1)));
+
+//    accel += upDirection;
+    //velocityDir.normalize();
+    //rot += Vector(0,0,1);
+    //rotVal += .4;
+  }
+  if (this->bDescend )
+  {
+    this->shiftDir(Quaternion(-time, Vector(0,0,1)));
+
+    //    accel -= upDirection;
+    //velocityDir.normalize();
+    //rot += Vector(0,0,1);
+    //rotVal -= .4;
+  }
+
+  velocity += accel;
+  //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->bRollL = event.bPressed;
+  else if( event.type == SDLK_d)
+      this->bRollR = 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 == EV_MOUSE_MOTION)
+  {
+    this->xMouse = event.xRel;
+    this->yMouse = event.yRel;
+    mouseDir *= (Quaternion(-M_PI/4*xMouse*mouseSensitivity, Vector(0,1,0))*Quaternion(-M_PI/4*yMouse*mouseSensitivity, Vector(0,0,1)));
+    if( xMouse*xMouse + yMouse*yMouse < 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: branches/christmas_branche/src/world_entities/creatures/md2_creature.h
===================================================================
--- branches/christmas_branche/src/world_entities/creatures/md2_creature.h	(revision 6166)
+++ branches/christmas_branche/src/world_entities/creatures/md2_creature.h	(revision 6166)
@@ -0,0 +1,76 @@
+/*!
+ * @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);
+
+    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)
+
+    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            mouseDir;           //!< the direction where the player wants to fly
+    Quaternion rotQuat;
+    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 */
