Index: trunk/src/world_entities/creatures/fps_player.cc
===================================================================
--- trunk/src/world_entities/creatures/fps_player.cc	(revision 10618)
+++ trunk/src/world_entities/creatures/fps_player.cc	(revision 10698)
@@ -19,4 +19,6 @@
 #include "interactive_model.h"
 #include "state.h"
+#include "tools/camera.h"
+#include "player.h"
 
 #include "src/lib/util/loading/factory.h"
@@ -51,4 +53,5 @@
 			    ->addMethod("getAbsCoorY", Executor0ret<PNode, lua_State*, float>(&PNode::getAbsCoorY))
 			    ->addMethod("getAbsCoorZ", Executor0ret<PNode, lua_State*, float>(&PNode::getAbsCoorZ))
+			    ->addMethod("displayHUDText", Executor1<FPSPlayer, lua_State*, const std::string&>(&FPSPlayer::displayHUDText))
                        );
 
@@ -95,4 +98,8 @@
   this->bPosBut = false;
   this->bFire = false;
+  this->bFire2 = false;
+  this->changeZoom = true;
+  this->inZoomMode = false;
+  this->changingZoom = false;
 
   this->xMouse = 0.0f;
@@ -116,5 +123,7 @@
   registerEvent(KeyMapper::PEV_RIGHT);
   registerEvent(KeyMapper::PEV_FIRE1);
+  registerEvent(KeyMapper::PEV_FIRE2);
   registerEvent(KeyMapper::PEV_JUMP);
+  registerEvent(KeyMapper::PEV_CROUCH);
   registerEvent(EV_MOUSE_MOTION);
 
@@ -149,5 +158,6 @@
 
   this->getWeaponManager().getFixedTarget()->setParent(&this->cameraNode);
-  this->getWeaponManager().getFixedTarget()->setRelCoor(1000,0,0);
+  this->getWeaponManager().getFixedTarget()->setParentMode(PNODE_ALL);
+  this->getWeaponManager().getFixedTarget()->setRelCoor(10,0,0);
 
 
@@ -179,5 +189,8 @@
 }
 
-
+/**
+ * was probabably designed for setting direction of FPSPlayer
+ * but hey, this connot work like this, can it?
+ */
 void FPSPlayer::setPlayDirection(const Quaternion& quat, float speed)
 {
@@ -186,5 +199,8 @@
 }
 
-
+/**
+ * Resets FPSPlayer stats and freezes its moving directions
+ *
+ */
 void FPSPlayer::reset()
 {
@@ -195,9 +211,13 @@
   this->xMouse = 0.0f;
   this->yMouse = 0.0f;
+  this->inZoomMode = false;
 
   this->setHealth(80);
 }
 
-
+/**
+ * Defines what happens to camera and other important elements when changing
+ * into FPS-view
+ */
 void FPSPlayer::enter()
 {
@@ -206,7 +226,10 @@
   State::getCameraNode()->setParentSoft(&this->cameraNode);
   State::getCameraTargetNode()->setParentSoft(&this->cameraNode);
-
-  this->getWeaponManager().getFixedTarget()->setParent(State::getCameraTargetNode());
-  this->getWeaponManager().getFixedTarget()->setRelCoor(0,0,0);
+  
+  State::getCamera()->setViewMode(Camera::ViewFPS);
+  
+  this->getWeaponManager().getFixedTarget()->setParent(&this->cameraNode);
+  //this->getWeaponManager().getFixedTarget()->setParentMode(PNODE_ALL);
+  //this->getWeaponManager().getFixedTarget()->setRelCoor(100,0,0);
 
   if ( !State::isOnline() )
@@ -216,4 +239,8 @@
 }
 
+/**
+ * Defines what happens if active player leaves FPSPlayer
+ * (basicly hides crosshair and frees camera)
+ */
 void FPSPlayer::leave()
 {
@@ -230,5 +257,5 @@
 void FPSPlayer::tick (float time)
 {
-
+     // Second init-step
   if ( !this->initWeapon )
   {
@@ -239,5 +266,6 @@
     this->getWeaponManager().getParentNode()->setParentMode(PNODE_ROTATE_AND_MOVE);
     this->getWeaponManager().getFixedTarget()->setParent(&this->cameraNode);
-    this->getWeaponManager().getFixedTarget()->setParentMode(PNODE_ROTATE_AND_MOVE);
+    //this->getWeaponManager().getFixedTarget()->setParentMode(PNODE_ROTATE_AND_MOVE);
+    State::getCamera()->setViewMode(Camera::ViewFPS);
 
 
@@ -251,18 +279,74 @@
     }
 
-
-    AABB* box = this->getModelAABB();
-    if( box != NULL)
-    {
+  }
+  // end of second init-step
+  
+  // This box represents the dimension of the used model
+  AABB* box = this->getModelAABB();
+
+  if( box != NULL)
+  {
       float f = 1.0;
+      if( this->bCrouch )
+          f = 0.3*f;
+      
       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->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));
+  }
+  
+  /*
+  if( this->bFire2 )
+  {
+      
+      // to change Zoom on click
+      if( this->changeZoom )
+      {
+          this->changeZoom = false;
+          if( this->inZoomMode )
+          {
+              State::getCamera()->setViewMode(Camera::ViewFPS);
+              this->inZoomMode = false;
+          }
+          else
+          {
+              State::getCamera()->setViewMode(Camera::ViewFPSZoom);
+              this->inZoomMode = true;
+          }
+          
+      }
+      
+  }
+  else
+  {
+      this->changeZoom = true;
+  }*/
+  if( this->bFire2 )
+  {
+      if( this->changeZoom )
+      {
+          if( !this->inZoomMode || this->changingZoom )
+          {
+              this->inZoomMode = true;
+              this->changingZoom = true;
+              float fovy = State::getCamera()->getFovy();
+              if( fovy > 30 )
+                  State::getCamera()->setFovy( fovy - 10*time );
+          }
+          else
+          {
+                State::getCamera()->setViewMode(Camera::ViewFPS);
+                this->inZoomMode = false;
+                this->changeZoom = false;
+          }
+      }
+  }
+  else
+  {
+      this->changeZoom = true;
+      this->changingZoom = false;
+  }
 
   this->getWeaponManager().tick(time);
@@ -301,7 +385,14 @@
     xMouse *= time ;
     yMouse *= time ;
-
-    heading -= xMouse/5.;
-    attitude-= yMouse/5.;
+    
+    float amount;
+    
+    if( this->inZoomMode )
+        amount = 2.;
+    else
+        amount = 5.;
+
+    heading -= xMouse/amount;
+    attitude-= yMouse/amount;
 
 
@@ -346,28 +437,64 @@
     }*/
 
-  velocity *= 100;
+  int speed;
+  if( this->bCrouch )
+      speed = 50;
+  else
+      speed = 100;
+  velocity *= speed;
 
   if( this->getModel( 0) != NULL && this->getModel(0)->isA(InteractiveModel::staticClassID()))
   {
-    if( this->bJump)
-    {
-      if( this->jumpAcceleration < 1.0f)
+      if( this->bJump)
       {
-        this->jumpAcceleration = 300.0f;
-
-        if( ((InteractiveModel*)this->getModel(0))->getAnimation() != JUMP)
-          ((InteractiveModel*)this->getModel(0))->setAnimation(JUMP);
-      }
-    }
-    else if(velocity.len() != 0.0f)
-    {
-      if( ((InteractiveModel*)this->getModel(0))->getAnimation() != RUN)
-        ((InteractiveModel*)this->getModel(0))->setAnimation(RUN);
-    }
-    else
-    {
-      if( ((InteractiveModel*)this->getModel(0))->getAnimation() != STAND)
-        ((InteractiveModel*)this->getModel(0))->setAnimation(STAND);
-    }
+          if( this->jumpAcceleration < 1.0f)
+          {
+              this->jumpAcceleration = 300.0f;
+
+              if( ((InteractiveModel*)this->getModel(0))->getAnimation() != JUMP)
+                  ((InteractiveModel*)this->getModel(0))->setAnimation(JUMP);
+          }
+       }
+       else if(velocity.len() != 0.0f)
+       {
+            if( this->bCrouch )
+            {
+                if( ((InteractiveModel*)this->getModel(0))->getAnimation() != CROUCH_WALK)
+                    ((InteractiveModel*)this->getModel(0))->setAnimation(CROUCH_WALK);
+            }
+            else
+            {
+                if( ((InteractiveModel*)this->getModel(0))->getAnimation() != RUN)
+                    ((InteractiveModel*)this->getModel(0))->setAnimation(RUN); 
+            }
+                 
+       }
+       else
+       {
+           if( this->bCrouch )
+           {
+               if( ((InteractiveModel*)this->getModel(0))->getAnimation() != CROUCH_STAND)
+                   ((InteractiveModel*)this->getModel(0))->setAnimation(CROUCH_STAND);
+           }
+           else
+           {
+               if( ((InteractiveModel*)this->getModel(0))->getAnimation() != STAND)
+                   ((InteractiveModel*)this->getModel(0))->setAnimation(STAND);
+           }
+       }
+       
+       if( this->bFire )
+       {
+           if( this->bCrouch )
+           {
+               if( ((InteractiveModel*)this->getModel(0))->getAnimation() != CROUCH_ATTACK)
+                   ((InteractiveModel*)this->getModel(0))->setAnimation(CROUCH_ATTACK);
+           }
+           else
+           {
+               if( ((InteractiveModel*)this->getModel(0))->getAnimation() != ATTACK)
+                   ((InteractiveModel*)this->getModel(0))->setAnimation(ATTACK);
+           }
+       }
   }
 
@@ -390,12 +517,11 @@
     this->fallVelocity = 0.0f;
   }
-  if((velocity *time).len() < 10.0f) this->shiftCoor( velocity*time );
-  else{	 
+  if((velocity * time).len() < 10.0f) this->shiftCoor( velocity*time );
+  else
+  {	 
 	 velocity.normalize();
 	 velocity *= 10.0f;
 	 this->shiftCoor( velocity );
-       }
-
-
+  }
 
 
@@ -409,4 +535,5 @@
   if( this->aimingSystem != NULL)
     this->aimingSystem->flushList();
+    
 }
 
@@ -426,5 +553,5 @@
 
 /**
- * process
+ * checks events
  */
 void FPSPlayer::process(const Event &event)
@@ -440,4 +567,12 @@
   else if( event.type == KeyMapper::PEV_BACKWARD)
     this->bBackward = event.bPressed; //this->shiftCoor(0,-.1,0);
+  else if( event.type == KeyMapper::PEV_JUMP)
+    this->bJump = event.bPressed;
+  else if( event.type == KeyMapper::PEV_FIRE1)
+    this->bFire = event.bPressed;
+  else if( event.type == KeyMapper::PEV_FIRE2)
+    this->bFire2 = event.bPressed;
+  else if( event.type == KeyMapper::PEV_CROUCH)
+    this->bCrouch = event.bPressed;
   else if( event.type == EV_MOUSE_MOTION)
   {
@@ -445,15 +580,9 @@
     this->yMouse += event.yRel;
   }
-  else if( event.type == KeyMapper::PEV_JUMP)
-  {
-    this->bJump = event.bPressed;
-  }
-  else if( event.type == KeyMapper::PEV_FIRE1)
-  {
-    this->bFire = event.bPressed;
-  }
-}
-
-
+}
+
+/**
+ * respawns FPSplayer
+ */
 void FPSPlayer::respawn( )
 {
@@ -466,5 +595,7 @@
 }
 
-
+/**
+ * Kills the FPSplayer defining its killer
+ */
 void FPSPlayer::destroy( WorldEntity* killer )
 {
@@ -474,2 +605,6 @@
 }
 
+void FPSPlayer::displayHUDText( const std::string& message )
+{
+	State::getPlayer()->hud().notifyUser(message);
+}
Index: trunk/src/world_entities/creatures/fps_player.h
===================================================================
--- trunk/src/world_entities/creatures/fps_player.h	(revision 10618)
+++ trunk/src/world_entities/creatures/fps_player.h	(revision 10698)
@@ -36,4 +36,6 @@
     virtual void tick(float time);
     virtual void draw() const;
+    
+    void displayHUDText( const std::string& message );
 
 
@@ -43,29 +45,35 @@
     void init();
 
-    bool                  bLeft;
-    bool                  bRight;
-    bool                  bForward;
-    bool                  bBackward;
-    bool                  bJump;              //!< jumping
-    bool                  bPosBut;             //!< position button
-    bool                  bFire;              //!< fire button
+    bool                  bLeft;             //!< strafe left
+    bool                  bRight;            //!< strafe right
+    bool                  bForward;          //!< walk forward
+    bool                  bBackward;         //!< walk backward
+    bool                  bJump;             //!< jumping
+    bool                  bPosBut;           //!< position button
+    bool                  bFire;             //!< fire button
+    bool                  bFire2;            //!< alternate fire button
+    bool                  bCrouch;           //!< crouch button
 
-    float                 xMouse;             //!< mouse moved in x-Direction
-    float                 yMouse;             //!< mouse moved in y-Direction
+    float                 xMouse;            //!< mouse moved in x-Direction
+    float                 yMouse;            //!< mouse moved in y-Direction
 
 
-    float                 heading;
-    float                 attitude;
+    float                 heading;           //!< the direction where the player heads to
+    float                 attitude;          //!< defines the camera angle to the x-z-plane
 
-    PNode                 cameraNode;
+    PNode                 cameraNode;        //!< the "eyes" of the player (or call it head if you want)
 
-    float                 fallVelocity;        //!< velocity for falling down
-    float                 jumpAcceleration;    //!< the jump acceleration 
+    float                 fallVelocity;      //!< velocity for falling down
+    float                 jumpAcceleration;  //!< the jump acceleration 
 
     bool                  initWeapon;
+    bool                  changeZoom;        //!< zoom sight of player
+    bool                  inZoomMode;        //!< zoomsight
+    bool                  changingZoom;
 
-    AimingSystem*         aimingSystem;        //!< aiming system of the player
+    AimingSystem*         aimingSystem;      //!< aiming system of the player
 
-    float                 damageTicker;        //!< ticker for dealing damage
+    float                 damageTicker;      //!< ticker for dealing damage
+    
 };
 
