Index: /branches/bsp_model/src/world_entities/creatures/md2_creature.cc
===================================================================
--- /branches/bsp_model/src/world_entities/creatures/md2_creature.cc	(revision 8503)
+++ /branches/bsp_model/src/world_entities/creatures/md2_creature.cc	(revision 8504)
@@ -63,5 +63,4 @@
 
   this->loadParams(doc.RootElement());
-  this->toList(OM_GROUP_01);
 }
 
@@ -77,4 +76,17 @@
   if (root != NULL)
     this->loadParams(root);
+}
+
+
+/**
+ * initializes a MD2Creature
+ */
+void MD2Creature::init()
+{
+  PRINTF(4)("MD2CREATURE INIT\n");
+  //  this->setRelDir(Quaternion(M_PI, Vector(1,0,0)));
+  this->setClassID(CL_MD2_CREATURE, "MD2Creature");
+
+  this->toList(OM_GROUP_01);
 
   //weapons:
@@ -87,24 +99,20 @@
   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->addWeapon(wpLeft, 1, 0);
+  this->addWeapon(wpRight,1 ,1);
   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");
-
+
+
+  // pnode camera issue
+  this->cameraConnNode.addNodeFlags(PNODE_PROHIBIT_DELETE_WITH_PARENT);
+  this->cameraConnNode.addNodeFlags(PNODE_PROHIBIT_CHILD_DELETE);
+  this->cameraConnNode.setName("CameraConnectorNode");
+  this->addChild(&this->cameraConnNode);
+  this->cameraConnNode.addChild(State::getCameraTargetNode());
+  this->cameraConnNode.addChild(State::getCameraNode());
+  State::getCameraTargetNode()->setRelCoor(10,0,0);
+
+
+  // control initialisation
   this->mouseDirX *= Quaternion( M_PI * 0.75f, Vector(0,1,0));
 
@@ -116,31 +124,21 @@
   cycle = 0.0;
 
-  this->cameraConnNode.addNodeFlags(PNODE_PROHIBIT_DELETE_WITH_PARENT);
-  this->cameraConnNode.setName("CameraConnectorNode");
-  this->addChild(&this->cameraConnNode);
-  this->cameraConnNode.addChild(State::getCameraTargetNode());
-  this->cameraConnNode.addChild(State::getCameraNode());
-  State::getCameraTargetNode()->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);
+  //add events to the eventlist
+  registerEvent(KeyMapper::PEV_FORWARD);
+  registerEvent(KeyMapper::PEV_BACKWARD);
+  registerEvent(KeyMapper::PEV_LEFT);
+  registerEvent(KeyMapper::PEV_RIGHT);
+  registerEvent(KeyMapper::PEV_UP);
+  registerEvent(KeyMapper::PEV_DOWN);
+  registerEvent(KeyMapper::PEV_FIRE1);
+  registerEvent(KeyMapper::PEV_NEXT_WEAPON);
+  registerEvent(KeyMapper::PEV_PREVIOUS_WEAPON);
+  registerEvent(EV_MOUSE_MOTION);
   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);
 
 
@@ -165,10 +163,10 @@
   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().setSlotPosition(6, Vector(-1, 0.0, 0));
+  this->getWeaponManager().setSlotCapability(6, WTYPE_ALLDIRS | WTYPE_DIRECTIONAL);
+  //
+
+  this->cameraConnNode.addChild(this->getWeaponManager().getFixedTarget());
   dynamic_cast<Element2D*>(this->getWeaponManager().getFixedTarget())->setVisibility( false);
 
@@ -177,18 +175,4 @@
 }
 
-
-void MD2Creature::enter()
-{
-  dynamic_cast<Element2D*>(this->getWeaponManager().getFixedTarget())->setVisibility( true);
-  this->attachCamera();
-
-}
-
-void MD2Creature::leave()
-{
-  dynamic_cast<Element2D*>(this->getWeaponManager().getFixedTarget())->setVisibility( false);
-
-
-}
 
 /**
@@ -202,11 +186,26 @@
 
 
+void MD2Creature::enter()
+{
+  dynamic_cast<Element2D*>(this->getWeaponManager().getFixedTarget())->setVisibility( true);
+
+  State::getCameraNode()->setParentSoft(&this->cameraConnNode);
+  State::getCameraNode()->setRelCoorSoft(-10, 0,0);
+  State::getCameraTargetNode()->setParentSoft(&this->cameraConnNode);
+
+}
+
+void MD2Creature::leave()
+{
+  dynamic_cast<Element2D*>(this->getWeaponManager().getFixedTarget())->setVisibility( false);
+  this->detachCamera();
+}
+
+
 /**
  *  effect that occurs after the MD2Creature is spawned
 */
 void MD2Creature::postSpawn ()
-{
-  //setCollision(new CollisionCluster(1.0, Vector(0,0,0)));
-}
+{}
 
 /**
@@ -234,5 +233,6 @@
   if (this->getCurrentPlayer() != NULL)
     WorldEntity::draw();
-//  this->cameraConnNode.debugDraw(0);
+
+  this->cameraConnNode.debugDraw(0);
 }
 
@@ -254,4 +254,6 @@
   this->shiftCoor (move);
 
+
+  // handle animations differently
   if( this->bJump && likely(this->getModel(0) != NULL))
   {
@@ -260,19 +262,24 @@
   else if( this->bFire && likely(this->getModel(0) != NULL))
   {
-    if( ((MD2Model*)this->getModel(0))->getAnim() != ATTACK) ((MD2Model*)this->getModel(0))->setAnimation(ATTACK);
+    if( ((MD2Model*)this->getModel(0))->getAnim() != ATTACK)
+      ((MD2Model*)this->getModel(0))->setAnimation(ATTACK);
   }
   else if( fabs(move.len()) > 0.0f && likely(this->getModel(0) != NULL))
   {
-    if( ((MD2Model*)this->getModel(0))->getAnim() != RUN) ((MD2Model*)this->getModel(0))->setAnimation(RUN);
+    if( ((MD2Model*)this->getModel(0))->getAnim() != RUN)
+      ((MD2Model*)this->getModel(0))->setAnimation(RUN);
   }
   else if (likely(this->getModel(0) != NULL))
   {
-    if( ((MD2Model*)this->getModel(0))->getAnim() != STAND) ((MD2Model*)this->getModel(0))->setAnimation(STAND);
+    if( ((MD2Model*)this->getModel(0))->getAnim() != STAND)
+      ((MD2Model*)this->getModel(0))->setAnimation(STAND);
   }
 
 
   //orient the MD2Creature in direction of the mouse
-  this->setAbsDir(mouseDirX);
-  this->cameraConnNode.setRelDir(mouseDirY);
+//   this->setAbsDir(mouseDirX);
+//    this->cameraConnNode.setRelDir(mouseDirY);
+
+  this->setAbsDir(this->mouseDirX);
 }
 
@@ -292,13 +299,21 @@
   /* calculate the direction in which the craft is heading  */
 
+  if( bMouseMotion)
+  {
+    PRINTF(0)("motion\n");
+    this->mouseDirX *= Quaternion(-M_PI / 4.0f * this->xMouse*mouseSensitivity, Vector(0,1,0));
+    this->mouseDirY *= Quaternion(-M_PI / 4.0f * this->yMouse*mouseSensitivity, Vector(0,0,1));
+    this->bMouseMotion = false;
+  }
+
   if( this->bUp )
-   {
-     accel += (this->getAbsDirX())*2;
-   }
+  {
+    accel += (this->getAbsDirX())*2;
+  }
 
   if( this->bDown )
-   {
-     accel -= (this->getAbsDirX())*2;
-   }
+  {
+    accel -= (this->getAbsDirX())*2;
+  }
 
   if( this->bLeft/* > -this->getRelCoor().z*2*/)
@@ -335,5 +350,4 @@
 
 
-
 /**
  * @todo switch statement ??
@@ -342,22 +356,19 @@
 {
   Playable::process(event);
-  if( event.type == SDLK_a)
-      this->bStrafeL = event.bPressed;
-  else if( event.type == SDLK_d)
-      this->bStrafeR = event.bPressed;
-  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);
+  if( event.type == KeyMapper::PEV_LEFT)
+    this->bStrafeL = event.bPressed;
+  else if( event.type == KeyMapper::PEV_RIGHT)
+    this->bStrafeR = event.bPressed;
+  else if( event.type == KeyMapper::PEV_FORWARD)
+    this->bUp = event.bPressed;
+  else if( event.type == KeyMapper::PEV_BACKWARD)
+    this->bDown = event.bPressed;
   else if( event.type == SDLK_SPACE)
     this->bJump = event.bPressed;
   else if( event.type == EV_MOUSE_MOTION)
   {
+    this->bMouseMotion = true;
     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);
-  }
-}
+  }
+}
Index: /branches/bsp_model/src/world_entities/creatures/md2_creature.h
===================================================================
--- /branches/bsp_model/src/world_entities/creatures/md2_creature.h	(revision 8503)
+++ /branches/bsp_model/src/world_entities/creatures/md2_creature.h	(revision 8504)
@@ -57,4 +57,5 @@
     bool                  bStrafeR;           //!< strafe to the rith side
     bool                  bJump;              //!< jump
+    bool                  bMouseMotion;       //!< mouse motion evet
 
     PNode                 cameraConnNode;     //!< The Node the camera is connected to.
