Index: trunk/src/world_entities/creatures/fps_player.cc
===================================================================
--- trunk/src/world_entities/creatures/fps_player.cc	(revision 9110)
+++ trunk/src/world_entities/creatures/fps_player.cc	(revision 9235)
@@ -29,6 +29,8 @@
 #include "weapons/cannon.h"
 #include "weapons/fps_sniper_rifle.h"
+#include "weapons/aiming_system.h"
 
 #include "aabb.h"
+
 
 #include "key_mapper.h"
@@ -57,4 +59,7 @@
 {
   this->setPlayer(NULL);
+
+  if( this->aimingSystem)
+    delete this->aimingSystem;
 }
 
@@ -81,5 +86,4 @@
 {
   this->setClassID(CL_FPS_PLAYER, "FPSPlayer");
-
 
   this->bLeft = false;
@@ -89,4 +93,5 @@
   this->bJump = false;
   this->bPosBut = false;
+  this->bFire = false;
 
   this->xMouse = 0.0f;
@@ -125,9 +130,10 @@
 
 //   this->addWeapon(wpLeft, 1, 0);
-  this->addWeapon(wpRight,1, 0);
+  if( State::isOnline())
+    this->addWeapon(wpRight,1, 0);
   this->getWeaponManager().changeWeaponConfig(1);
 
   this->getWeaponManager().setSlotCount(2);
-//   this->getWeaponManager().setSlotDirection(0, Quaternion(M_PI_2, Vector(0,1,0)));
+  this->getWeaponManager().setSlotDirection(0, Quaternion(M_PI_4*-0.55f, Vector(0,0,1)));
   this->getWeaponManager().setSlotCapability(0, WTYPE_ALLDIRS | WTYPE_DIRECTIONAL);
   this->getWeaponManager().setSlotDirection(1, Quaternion(M_PI_4*.5, Vector(1,0,0)));
@@ -135,4 +141,6 @@
   this->getWeaponManager().setSlotPosition(1, Vector(5.0, 0.0, 0.0));
 
+//   this->getWeaponManager().getFixedTarget()->setRelDir(Quaternion(M_PI_4*-0.6f, Vector(0,0,1)));
+
 
   this->getWeaponManager().setParentNode(&this->cameraNode);
@@ -141,4 +149,9 @@
   this->getWeaponManager().getFixedTarget()->setParent(&this->cameraNode);
   this->getWeaponManager().getFixedTarget()->setRelCoor(1000,0,0);
+
+  this->aimingSystem = new AimingSystem(this);
+  //this->addChild(this->aimingSystem);
+  wpRight->addChild(this->aimingSystem);
+//   this->getWeaponManager().sl
 
 
@@ -148,6 +161,16 @@
   registerVar( new SynchronizeableBool( &bForward, &bForward, "bForward", PERMISSION_OWNER ) );
   registerVar( new SynchronizeableBool( &bBackward, &bBackward, "bBackward", PERMISSION_OWNER ) );
+  registerVar( new SynchronizeableBool( &bJump, &bJump, "bJump", PERMISSION_OWNER ) );
   registerVar( new SynchronizeableFloat( &heading, &heading, "heading", PERMISSION_OWNER ) );
   registerVar( new SynchronizeableFloat( &attitude, &attitude, "attitude", PERMISSION_OWNER ) );
+
+    //subscribe to collision reaction
+  this->subscribeReaction(CREngine::CR_PHYSICS_FULL_WALK, CL_BSP_ENTITY);
+
+  this->initWeapon = false;
+  this->damageTicker = 0.0f;
+
+  if( State::isOnline())
+    toList( OM_PLAYERS );
 }
 
@@ -192,13 +215,7 @@
   this->getWeaponManager().getFixedTarget()->setRelCoor(0,0,0);
 
-
-  AABB* box = this->getModelAABB();
-  if( box != NULL)
-  {
-    State::getCameraNode()->setRelCoor(0, box->halfLength[1] * 2.0f, 0);
-    State::getCameraTargetNode()->setRelCoor(10, box->halfLength[1] * 2.0f, 0);
-
-    this->getWeaponManager().setSlotPosition(0, Vector(1.5, box->halfLength[1] * 2.0f - 0.7, 1.1));
-    this->getWeaponManager().setSlotPosition(1, Vector(5.0, box->halfLength[1] * 2.0f, 0.0));
+  if ( !State::isOnline() )
+  {
+    this->respawn();
   }
 }
@@ -219,11 +236,77 @@
 {
 
-  if( this->bPosBut)
-  {
-    this->bPosBut = false;
-    printf("mechanic2:walkTo( %f, mtheight, %f)\n",this->getAbsCoorX(),this->getAbsCoorZ());
-  }
-
-  Playable::tick( time );
+  if ( !this->initWeapon )
+  {
+    this->initWeapon = true;
+
+    this->cameraNode.setParentMode(PNODE_ROTATE_AND_MOVE);
+
+    this->getWeaponManager().getParentNode()->setParentMode(PNODE_ROTATE_AND_MOVE);
+    this->getWeaponManager().getFixedTarget()->setParent(&this->cameraNode);
+    this->getWeaponManager().getFixedTarget()->setParentMode(PNODE_ROTATE_AND_MOVE);
+
+
+    this->aimingSystem->toList(OM_GROUP_01);
+    this->aimingSystem->setParent(&this->cameraNode);
+//     this->aimingSystem->setParentMode(PNODE_ROTATE_AND_MOVE);
+    this->aimingSystem->setRelDir(Quaternion(M_PI_4*-0.58f, Vector(0,0,1)));
+    this->aimingSystem->setRelCoor(0, -1, -1);
+
+
+    AABB* box = this->getModelAABB();
+    if( box != NULL)
+    {
+      float f = 1.0;
+      this->cameraNode.setRelCoor(0, box->halfLength[1] * f, 0);
+//       this->cameraNode.setRelCoor(10, box->halfLength[1] * f, 0);
+
+      float v = 0.1f;
+      this->getWeaponManager().setSlotPosition(0, Vector(-8.0, box->halfLength[1] * v, 1.1));
+      this->getWeaponManager().setSlotPosition(1, Vector(5.0, box->halfLength[1] * v, 0.0));
+    }
+  }
+
+
+  this->getWeaponManager().tick(time);
+  if( this->bFire)
+  {
+    this->getWeaponManager().fire();
+
+//     WorldEntity* target = this->aimingSystem->getNearestTarget();
+//     if( target != NULL)
+//     {
+//       PRINTF(0)("hit hit hit, got: %s\n", target->getClassName());
+//     }
+//     else
+//     {
+//       PRINTF(0)("nothing hit\n");
+//     }
+  }
+
+
+  //dealing damage
+
+  if ( State::isOnline() && SharedNetworkData::getInstance()->isGameServer() )
+  {
+    this->damageTicker -= time;
+
+    if ( this->damageTicker <= 0.0f && this->beFire() )
+    {
+      this->damageTicker = 0.25;
+
+      WorldEntity * victim = aimingSystem->getNearestTarget();
+
+      if ( victim )
+      {
+        PRINTF(0)("FIRE: hit %s\n", victim->getClassName());
+        victim->hit( 20, this );
+      }
+      else
+      {
+        PRINTF(0)("FIRE: nothing hit\n");
+      }
+    }
+  }
+
 
   if( ( xMouse != 0 || yMouse != 0 ) && (this->getOwner() == SharedNetworkData::getInstance()->getHostID() || !State::isOnline() ) )
@@ -235,9 +318,9 @@
     attitude-= yMouse;
 
-    if ( attitude > 2.05 )
-      attitude = 2.05;
-
-    else if ( attitude < -1.15 )
-      attitude = -1.15;
+
+    if ( attitude > 1.95 )
+      attitude = 1.95;
+    else if ( attitude < -1.07 )
+      attitude = -1.07;
 
     xMouse = yMouse = 0;
@@ -304,4 +387,6 @@
     this->fallVelocity += 300.0f * time;
     velocity -= Vector(0.0, 1.0, 0.0) * this->fallVelocity;
+
+//     PRINTF(0)("vel %f\n", this->fallVelocity);
   }
   else
@@ -309,5 +394,4 @@
     this->fallVelocity = 0.0f;
   }
-
 
   this->shiftCoor( velocity*time );
@@ -346,4 +430,6 @@
   }
 
+  this->setOnGround(false);
+  this->aimingSystem->flushList();
 }
 
@@ -383,9 +469,30 @@
   }
   else if( event.type == KeyMapper::PEV_JUMP)
+  {
     this->bJump = event.bPressed;
-    this->bPosBut = event.bPressed;
-}
-
-
-
-
+  }
+  else if( event.type == KeyMapper::PEV_FIRE1)
+  {
+    this->bFire = event.bPressed;
+  }
+}
+
+
+void FPSPlayer::respawn( )
+{
+  if( State::isOnline())
+    toList( OM_PLAYERS );
+
+  this->damageTicker = 0.0f;
+
+  Playable::respawn();
+}
+
+
+void FPSPlayer::destroy( WorldEntity* killer )
+{
+  Playable::destroy( killer );
+
+  toList( OM_DEAD );
+}
+
Index: trunk/src/world_entities/creatures/fps_player.h
===================================================================
--- trunk/src/world_entities/creatures/fps_player.h	(revision 9110)
+++ trunk/src/world_entities/creatures/fps_player.h	(revision 9235)
@@ -9,4 +9,7 @@
 
 #include "playable.h"
+
+
+class AimingSystem;
 
 
@@ -27,4 +30,6 @@
     virtual void reset();
 
+    virtual void destroy(WorldEntity* killer);
+    virtual void respawn();
 
     virtual void tick(float time);
@@ -43,4 +48,5 @@
     bool                  bJump;              //!< jumping
     bool                  bPosBut;             //!< position button
+    bool                  bFire;              //!< fire button
 
     float                 xMouse;             //!< mouse moved in x-Direction
@@ -55,4 +61,10 @@
     float                 fallVelocity;        //!< velocity for falling down
     float                 jumpForce;           //!< the jump force
+
+    bool                  initWeapon;
+
+    AimingSystem*         aimingSystem;        //!< aiming system of the player
+
+    float                 damageTicker;        //!< ticker for dealing damage
 };
 
