Index: orxonox/trunk/src/Makefile.am
===================================================================
--- orxonox/trunk/src/Makefile.am	(revision 4961)
+++ orxonox/trunk/src/Makefile.am	(revision 4963)
@@ -64,4 +64,5 @@
                   world_entities/weapons/projectile.cc \
                   world_entities/weapons/test_gun.cc \
+                  world_entities/weapons/turret.cc \
                   world_entities/weapons/test_bullet.cc \
                   world_entities/weapons/crosshair.cc \
@@ -120,4 +121,5 @@
                  world_entities/weapons/projectile.h \
                  world_entities/weapons/test_gun.h \
+                 world_entities/weapons/turret.h \
                  world_entities/weapons/test_bullet.h \
                  world_entities/weapons/crosshair.h \
Index: orxonox/trunk/src/Makefile.in
===================================================================
--- orxonox/trunk/src/Makefile.in	(revision 4961)
+++ orxonox/trunk/src/Makefile.in	(revision 4963)
@@ -72,7 +72,7 @@
 	orxonox-test_entity.$(OBJEXT) orxonox-weapon_manager.$(OBJEXT) \
 	orxonox-weapon.$(OBJEXT) orxonox-projectile.$(OBJEXT) \
-	orxonox-test_gun.$(OBJEXT) orxonox-test_bullet.$(OBJEXT) \
-	orxonox-crosshair.$(OBJEXT) orxonox-p_node.$(OBJEXT) \
-	orxonox-null_parent.$(OBJEXT) \
+	orxonox-test_gun.$(OBJEXT) orxonox-turret.$(OBJEXT) \
+	orxonox-test_bullet.$(OBJEXT) orxonox-crosshair.$(OBJEXT) \
+	orxonox-p_node.$(OBJEXT) orxonox-null_parent.$(OBJEXT) \
 	orxonox-graphics_engine.$(OBJEXT) orxonox-light.$(OBJEXT) \
 	orxonox-text_engine.$(OBJEXT) orxonox-element_2d.$(OBJEXT) \
@@ -131,4 +131,5 @@
 @AMDEP_TRUE@	./$(DEPDIR)/orxonox-track_manager.Po \
 @AMDEP_TRUE@	./$(DEPDIR)/orxonox-track_node.Po \
+@AMDEP_TRUE@	./$(DEPDIR)/orxonox-turret.Po \
 @AMDEP_TRUE@	./$(DEPDIR)/orxonox-vector.Po \
 @AMDEP_TRUE@	./$(DEPDIR)/orxonox-weapon.Po \
@@ -317,4 +318,5 @@
                   world_entities/weapons/projectile.cc \
                   world_entities/weapons/test_gun.cc \
+                  world_entities/weapons/turret.cc \
                   world_entities/weapons/test_bullet.cc \
                   world_entities/weapons/crosshair.cc \
@@ -373,4 +375,5 @@
                  world_entities/weapons/projectile.h \
                  world_entities/weapons/test_gun.h \
+                 world_entities/weapons/turret.h \
                  world_entities/weapons/test_bullet.h \
                  world_entities/weapons/crosshair.h \
@@ -525,4 +528,5 @@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/orxonox-track_manager.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/orxonox-track_node.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/orxonox-turret.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/orxonox-vector.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/orxonox-weapon.Po@am__quote@
@@ -1058,4 +1062,20 @@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(orxonox_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o orxonox-test_gun.obj `if test -f 'world_entities/weapons/test_gun.cc'; then $(CYGPATH_W) 'world_entities/weapons/test_gun.cc'; else $(CYGPATH_W) '$(srcdir)/world_entities/weapons/test_gun.cc'; fi`
+
+orxonox-turret.o: world_entities/weapons/turret.cc
+@am__fastdepCXX_TRUE@	if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(orxonox_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT orxonox-turret.o -MD -MP -MF "$(DEPDIR)/orxonox-turret.Tpo" -c -o orxonox-turret.o `test -f 'world_entities/weapons/turret.cc' || echo '$(srcdir)/'`world_entities/weapons/turret.cc; \
+@am__fastdepCXX_TRUE@	then mv -f "$(DEPDIR)/orxonox-turret.Tpo" "$(DEPDIR)/orxonox-turret.Po"; else rm -f "$(DEPDIR)/orxonox-turret.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='world_entities/weapons/turret.cc' object='orxonox-turret.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	depfile='$(DEPDIR)/orxonox-turret.Po' tmpdepfile='$(DEPDIR)/orxonox-turret.TPo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(orxonox_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o orxonox-turret.o `test -f 'world_entities/weapons/turret.cc' || echo '$(srcdir)/'`world_entities/weapons/turret.cc
+
+orxonox-turret.obj: world_entities/weapons/turret.cc
+@am__fastdepCXX_TRUE@	if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(orxonox_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT orxonox-turret.obj -MD -MP -MF "$(DEPDIR)/orxonox-turret.Tpo" -c -o orxonox-turret.obj `if test -f 'world_entities/weapons/turret.cc'; then $(CYGPATH_W) 'world_entities/weapons/turret.cc'; else $(CYGPATH_W) '$(srcdir)/world_entities/weapons/turret.cc'; fi`; \
+@am__fastdepCXX_TRUE@	then mv -f "$(DEPDIR)/orxonox-turret.Tpo" "$(DEPDIR)/orxonox-turret.Po"; else rm -f "$(DEPDIR)/orxonox-turret.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='world_entities/weapons/turret.cc' object='orxonox-turret.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	depfile='$(DEPDIR)/orxonox-turret.Po' tmpdepfile='$(DEPDIR)/orxonox-turret.TPo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(orxonox_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o orxonox-turret.obj `if test -f 'world_entities/weapons/turret.cc'; then $(CYGPATH_W) 'world_entities/weapons/turret.cc'; else $(CYGPATH_W) '$(srcdir)/world_entities/weapons/turret.cc'; fi`
 
 orxonox-test_bullet.o: world_entities/weapons/test_bullet.cc
Index: orxonox/trunk/src/defs/class_id.h
===================================================================
--- orxonox/trunk/src/defs/class_id.h	(revision 4961)
+++ orxonox/trunk/src/defs/class_id.h	(revision 4963)
@@ -128,4 +128,5 @@
   CL_TEST_ENTITY                =    0x00000209,
   CL_TEST_GUN                   =    0x0000020a,
+  CL_TURRET                     =    0x0000020b,
 
 
Index: orxonox/trunk/src/world_entities/player.cc
===================================================================
--- orxonox/trunk/src/world_entities/player.cc	(revision 4961)
+++ orxonox/trunk/src/world_entities/player.cc	(revision 4963)
@@ -24,4 +24,5 @@
 #include "weapon_manager.h"
 #include "test_gun.h"
+#include "turret.h"
 #include "world.h"
 
@@ -85,7 +86,8 @@
   wpLeft->setName("testGun Left");
 
+  Weapon* turret = new Turret(this->weaponMan);
   this->weaponMan->addWeapon(wpLeft, 1, 0);
   this->weaponMan->addWeapon(wpRight,1 ,1);
-  this->weaponMan->addWeapon(wpLeft, 3, 1);
+  this->weaponMan->addWeapon(turret, 3, 1);
 
   this->weaponMan->changeWeaponConfig(0);
Index: orxonox/trunk/src/world_entities/weapons/turret.cc
===================================================================
--- orxonox/trunk/src/world_entities/weapons/turret.cc	(revision 4963)
+++ orxonox/trunk/src/world_entities/weapons/turret.cc	(revision 4963)
@@ -0,0 +1,194 @@
+/*
+   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: Benjamin Grauer
+   co-programmer:
+*/
+
+
+#include "turret.h"
+
+#include "weapon_manager.h"
+#include "test_bullet.h"
+
+#include "state.h"
+#include "vector.h"
+#include "list.h"
+#include "animation3d.h"
+#include "sound_engine.h"
+
+#include "fast_factory.h"
+
+
+using namespace std;
+
+
+/**
+ *  standard constructor
+
+   creates a new weapon
+*/
+Turret::Turret (WeaponManager* weaponManager)
+  : Weapon(weaponManager)
+{
+  this->setClassID(CL_TURRET, "Turret");
+
+  this->model = (Model*)ResourceManager::getInstance()->load("models/turret1.obj", OBJ, RP_CAMPAIGN);
+  this->leftRight = leftRight;
+
+/*  this->objectComponent1 = new PNode();
+  Animation3D* animation1 = this->getAnimation(WS_SHOOTING, this->objectComponent1);
+  Animation3D* animation2 = this->getAnimation(WS_ACTIVATING, this);
+  Animation3D* animation3 = this->getAnimation(WS_DEACTIVATING, this);
+  //parent->addChild(this->objectComponent1, PNODE_ALL);
+  this->addChild(this->objectComponent1, PNODE_ALL);
+
+  animation1->setInfinity(ANIM_INF_CONSTANT);
+  animation2->setInfinity(ANIM_INF_CONSTANT);
+  animation3->setInfinity(ANIM_INF_CONSTANT);
+  if( this->leftRight == W_LEFT)
+    {
+      this->setEmissionPoint(1.0, 0.0, -0.35);
+
+      animation1->addKeyFrame(Vector(0, 0, 0), Quaternion(), 0.1, ANIM_LINEAR, ANIM_CONSTANT);
+      animation1->addKeyFrame(Vector(-0.4, 0, 0), Quaternion(), 0.1, ANIM_LINEAR, ANIM_CONSTANT);
+      animation1->addKeyFrame(Vector(0, 0, 0), Quaternion(), 0.0, ANIM_LINEAR, ANIM_CONSTANT);
+
+      animation2->addKeyFrame(Vector(0.0, 0.0, -1.0), Quaternion(), 0.3, ANIM_LINEAR, ANIM_CONSTANT);
+      animation2->addKeyFrame(Vector(0.0, 0.0, 0.0), Quaternion(), 0.3, ANIM_LINEAR, ANIM_CONSTANT);
+
+      animation3->addKeyFrame(Vector(0.0, 0.0, 0.0), Quaternion(), 0.3, ANIM_LINEAR, ANIM_CONSTANT);
+      animation3->addKeyFrame(Vector(0.0, 0.0, -1.0), Quaternion(), 0.3, ANIM_LINEAR, ANIM_CONSTANT);
+    }
+  else if( this->leftRight == W_RIGHT)
+    {
+      this->setEmissionPoint(1.0, 0.0, 0.5);
+
+      this->objectComponent1->setRelCoor(Vector(0,0,0.35));
+      animation1->addKeyFrame(Vector(0, 0, .5), Quaternion(), 0.1, ANIM_LINEAR, ANIM_CONSTANT);
+      animation1->addKeyFrame(Vector(-0.4, 0, .5), Quaternion(), 0.1, ANIM_LINEAR, ANIM_CONSTANT);
+      animation1->addKeyFrame(Vector(0, 0, .5), Quaternion(), 0.0, ANIM_LINEAR, ANIM_CONSTANT);
+
+      animation2->addKeyFrame(Vector(.0, .0, 1.0), Quaternion(), 0.3, ANIM_LINEAR, ANIM_CONSTANT);
+      animation2->addKeyFrame(Vector(.0, .0, .0), Quaternion(), 0.3, ANIM_LINEAR, ANIM_CONSTANT);
+
+      animation3->addKeyFrame(Vector(.0, .0, 0.0), Quaternion(), 0.3, ANIM_LINEAR, ANIM_CONSTANT);
+      animation3->addKeyFrame(Vector(.0, .0, 1.0), Quaternion(), 0.3, ANIM_LINEAR, ANIM_CONSTANT);
+    }*/
+
+  //  ObjectManager::getInstance()->cache(CL_TEST_BULLET, 100, p);
+  //ObjectManager::getInstance()->debug();
+
+  this->setStateDuration(WS_SHOOTING, .4);
+  this->setStateDuration(WS_RELOADING, 1);
+  this->setStateDuration(WS_ACTIVATING, .4);
+  this->setStateDuration(WS_DEACTIVATING, .4);
+
+  this->setMaximumEnergy(1000, 10);
+  this->increaseEnergy(100);
+  //this->minCharge = 2;
+
+  this->setActionSound(WA_SHOOT, "sound/shot1.wav");
+
+  this->setProjectile(CL_TEST_BULLET);
+  //this->getProjectileFactory()->prepare(100);
+}
+
+
+/**
+ *  standard deconstructor
+*/
+Turret::~Turret ()
+{
+  // model will be deleted from WorldEntity-destructor
+}
+
+
+/**
+ *  this activates the weapon
+
+   This is needed, since there can be more than one weapon on a ship. the
+   activation can be connected with an animation. for example the weapon is
+   been armed out.
+*/
+void Turret::activate()
+{
+}
+
+
+/**
+ *  this deactivates the weapon
+
+   This is needed, since there can be more than one weapon on a ship. the
+   activation can be connected with an animation. for example the weapon is
+   been armed out.
+*/
+void Turret::deactivate()
+{
+}
+
+
+/**
+ *  fires the weapon
+
+   this is called from the player.cc, when fire-button is been pushed
+   @todo: the ObjectManager deliveres Projectiles not TestBullets! this should be diffrent
+*/
+void Turret::fire()
+{
+  Projectile* pj =  dynamic_cast<Projectile*>(this->getProjectileFactory()->resurrect());
+
+  PNode* target = this->getWeaponManager()->getFixedTarget();
+
+  if (target != NULL)
+  {
+    pj->setVelocity(this->getVelocity()+(target->getAbsCoor() - this->getAbsCoor())*.5);//this->getVelocity());
+  }
+  else
+    pj->setVelocity(target->getVelocity());
+
+
+  pj->setAbsCoor(this->getEmissionPoint());
+  pj->setAbsDir(this->getAbsDir());
+  State::getWorldEntityList()->add(pj);
+}
+
+
+/**
+ *  is called, when the weapon is destroyed
+
+   this is in conjunction with the hit function, so when a weapon is able to get
+   hit, it can also be destoryed.
+*/
+void Turret::destroy ()
+{}
+
+/**
+ *  this will draw the weapon
+*/
+void Turret::draw ()
+{
+  this->getWeaponManager()->getFixedTarget()->debugDraw(10);
+
+  /* draw gun body */
+  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->model->draw();
+  glPopMatrix();
+}
+
Index: orxonox/trunk/src/world_entities/weapons/turret.h
===================================================================
--- orxonox/trunk/src/world_entities/weapons/turret.h	(revision 4963)
+++ orxonox/trunk/src/world_entities/weapons/turret.h	(revision 4963)
@@ -0,0 +1,30 @@
+/*!
+ * @file turret.h
+*/
+
+
+#ifndef _TURRET_H
+#define _TURRET_H
+
+#include "weapon.h"
+
+class Turret : public Weapon
+  {
+  public:
+    Turret (WeaponManager* weaponManager);
+    virtual ~Turret ();
+
+    virtual void activate();
+    virtual void deactivate();
+
+    virtual void fire();
+    virtual void destroy();
+
+    virtual void draw();
+
+  private:
+    PNode* objectComponent1;         //<! the gun is made of multiple parts, these PNodes represent their location and orientation
+
+    int leftRight;   // this will become an enum
+  };
+#endif /* _TURRET_H */
