Index: trunk/src/world_entities/weapons/aiming_system.cc
===================================================================
--- trunk/src/world_entities/weapons/aiming_system.cc	(revision 9235)
+++ trunk/src/world_entities/weapons/aiming_system.cc	(revision 9235)
@@ -0,0 +1,156 @@
+  /*
+   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_WEAPON
+
+#include "aiming_system.h"
+
+#include "util/loading/load_param.h"
+
+#include "state.h"
+
+#include "aabb.h"
+#include "obb_tree.h"
+
+#include <vector>
+
+
+using namespace std;
+
+
+/**
+ * standart constructor
+ */
+AimingSystem::AimingSystem (WorldEntity* entity)
+  : WorldEntity()
+{
+  this->owner = entity;
+
+  this->init();
+}
+
+
+/**
+ * destroys a AimingSystem
+*/
+AimingSystem::~AimingSystem ()
+{}
+
+
+/**
+ * initializes the AimingSystem
+ */
+void AimingSystem::init()
+{
+  this->setClassID(CL_AIMING_SYSTEM, "AimingSystem");
+  this->setName("AimingSystem");
+
+  //this->loadModel("models/guns/targeting_system_body2.obj");
+//   this->loadModel("models/ships/fighter.obj");
+
+  // registering default reactions:
+  this->unsubscribeReaction(CREngine::CR_OBJECT_DAMAGE);
+  this->subscribeReaction(CREngine::CR_OBJECT_DAMAGE, CL_WORLD_ENTITY);
+
+  this->range = 1000.0f;
+  this->sideLength = 2.0f;
+
+  // new obb tree
+  this->obbTree = new OBBTree();
+  this->obbTree->createBox(Vector(0.0f, 0.0f, 0.0f), Vector(this->range, this->sideLength, this->sideLength));
+  this->setOBBTree(this->obbTree);
+}
+
+
+
+/**
+ * get back the nearest target
+ * @returns the nerest target
+ */
+WorldEntity* AimingSystem::getNearestTarget()
+{
+  if( this->selectionList.size() == 0)
+    return NULL;
+
+
+  WorldEntity* nearestEntity     = NULL;
+  float        distance          = 0.0f;
+  float        smalestDistance   = this->range * 5.0f;
+
+
+  for( int i = 0; i < this->selectionList.size(); i++)
+  {
+    distance = fabs((this->getAbsCoor() - this->selectionList[i]->getAbsCoor()).len());
+    if( distance < smalestDistance)
+    {
+      nearestEntity = this->selectionList[i];
+      smalestDistance = distance;
+    }
+  }
+
+  PRINTF(0)("entity: %s\n", nearestEntity->getClassName());
+    return nearestEntity;
+}
+
+
+/**
+ * called when an object is "selected"
+ *  @param damage damage to be dealt
+ *  @param killer the entity
+ */
+void AimingSystem::hit(float damage, WorldEntity* killer)
+{
+  if( this->owner != killer)
+  {
+    PRINTF(0)("real hit: %s\n", killer->getClassName());
+    this->selectionList.push_back(killer);
+  }
+}
+
+
+
+/**
+ * ticks the AimingSystem
+ * @param dt the time to ticks
+ */
+void AimingSystem::tick(float dt)
+{
+
+
+}
+
+
+/**
+ * draws the crosshair
+ */
+void AimingSystem::draw() const
+{
+  WorldEntity::draw();
+
+//   glMatrixMode(GL_MODELVIEW);
+//   glPushMatrix();
+//
+//   /* translate */
+//   glTranslatef (this->getAbsCoor ().x,
+//                 this->getAbsCoor ().y,
+//                 this->getAbsCoor ().z);
+//   Vector tmpRot = this->getAbsDir().getSpacialAxis();
+//   glRotatef (this->getAbsDir().getSpacialAxisAngle(), tmpRot.x, tmpRot.y, tmpRot.z );
+//
+//   this->obbTree->drawBV(0, 1);
+//
+//   glPopMatrix();
+
+}
Index: trunk/src/world_entities/weapons/aiming_system.h
===================================================================
--- trunk/src/world_entities/weapons/aiming_system.h	(revision 9235)
+++ trunk/src/world_entities/weapons/aiming_system.h	(revision 9235)
@@ -0,0 +1,53 @@
+/*!
+ * @file aiming_system.h
+ *  Definition of
+ */
+
+#ifndef _AIMING_SYSTEM_H
+#define _AIMING_SYSTEM_H
+
+
+#include "world_entity.h"
+
+
+
+// FORWARD DECLARATION
+class TiXmlElement;
+class BVTree;
+class Model;
+class OBBTree;
+
+
+class AimingSystem : public WorldEntity
+{
+
+ public:
+  AimingSystem(WorldEntity* owner = NULL);
+  virtual ~AimingSystem();
+
+  void init();
+
+  WorldEntity* getNearestTarget();
+  void flushList() { this->selectionList.clear(); }
+
+  void setRange(float range){this->range = range;};
+
+  virtual void hit(float damage, WorldEntity* killer);
+  virtual void destroy(WorldEntity* entity) {}
+
+  virtual void tick(float dt);
+  virtual void draw() const;
+
+
+ private:
+   float                       range;                //!<
+   float                       sideLength;
+   std::vector<WorldEntity*>   selectionList;        //!< the selections
+
+   WorldEntity*                owner;                //!< the owner of the targeting system
+
+   OBBTree*                    obbTree;
+
+};
+
+#endif /* _AIMING_SYSTEM_H */
Index: trunk/src/world_entities/weapons/boomerang_gun.cc
===================================================================
--- trunk/src/world_entities/weapons/boomerang_gun.cc	(revision 9235)
+++ trunk/src/world_entities/weapons/boomerang_gun.cc	(revision 9235)
@@ -0,0 +1,149 @@
+/*
+   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:
+*/
+#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_WEAPON
+
+#include "boomerang_gun.h"
+
+#include "weapon_manager.h"
+#include "world_entities/projectiles/projectile.h"
+
+#include "model.h"
+
+#include "state.h"
+#include "animation3d.h"
+
+#include "util/loading/factory.h"
+
+CREATE_FACTORY(BoomerangGun, CL_BOOMERANG_GUN);
+
+
+/**
+ *  standard constructor
+ *
+ * creates a new BoomerangGun
+ */
+BoomerangGun::BoomerangGun ()
+  : Weapon()
+{
+  this->init();
+}
+
+/**
+ * creates a new BoomerangGun from a TiXmlElement
+ */
+BoomerangGun::BoomerangGun(const TiXmlElement* root)
+{
+  this->init();
+  if (root != NULL)
+    this->loadParams(root);
+}
+
+/**
+ *  standard deconstructor
+*/
+BoomerangGun::~BoomerangGun ()
+{
+  // model will be deleted from WorldEntity-destructor
+}
+
+void BoomerangGun::init()
+{
+  this->setClassID(CL_BOOMERANG_GUN, "BoomerangGun");
+
+
+  Animation3D* animation1 = this->getAnimation(WS_ACTIVATING, this);
+  Animation3D* animation2 = this->getAnimation(WS_DEACTIVATING, this);
+
+  animation1->addKeyFrame(Vector(0, -.5, 0), Quaternion(), 0.3, ANIM_LINEAR, ANIM_CONSTANT);
+  animation1->addKeyFrame(Vector(0, 0, 0), Quaternion(), 0.3, ANIM_LINEAR, ANIM_CONSTANT);
+  animation2->addKeyFrame(Vector(0, 0, 0), Quaternion(), 0.3, ANIM_LINEAR, ANIM_CONSTANT);
+  animation2->addKeyFrame(Vector(0, -.5, 0), Quaternion(), 0.3, ANIM_LINEAR, ANIM_CONSTANT);
+
+  animation1->setInfinity(ANIM_INF_CONSTANT);
+  animation2->setInfinity(ANIM_INF_CONSTANT);
+
+  this->setStateDuration(WS_SHOOTING, .6);
+  this->setStateDuration(WS_RELOADING, 1.0f);
+  this->setStateDuration(WS_ACTIVATING, .4);
+  this->setStateDuration(WS_DEACTIVATING, .4);
+
+  this->setEnergyMax(100);
+  this->increaseEnergy(100);
+  //this->minCharge = 2;
+
+  this->setCapability(WTYPE_ALLDIRS | WTYPE_TURRET);
+  this->setProjectileType(CL_BOOMERANG_PROJECTILE);
+
+  this->loadModel("models/guns/turret1.obj", 5.0);
+
+  this->setEmissionPoint(1.684, 0.472, 0);
+  //this->getProjectileFactory()->prepare(100);
+
+  this->setActionSound(WA_SHOOT, "sound/explosions/explosion_3.wav");
+  this->setActionSound(WA_ACTIVATE, "sound/vocals/missiles.wav");
+  this->setActionSound(WA_RELOAD, "sound/vocals/reload.wav");
+
+}
+
+void BoomerangGun::loadParams(const TiXmlElement* root)
+{
+  Weapon::loadParams(root);
+}
+
+void BoomerangGun::activate()
+{
+}
+
+void BoomerangGun::deactivate()
+{
+}
+
+void BoomerangGun::tick(float dt)
+{
+  if (!Weapon::tickW(dt))
+    return;
+
+  Quaternion quat;
+  Vector direction;
+  if (this->getDefaultTarget() == NULL)
+    direction = this->getAbsCoor();
+  else
+    direction = this->getDefaultTarget()->getAbsCoor() - this->getAbsCoor();
+
+  direction.normalize();
+
+  if (likely (this->getParent() != NULL))
+    quat = Quaternion(direction, this->getParent()->getAbsDir().apply(Vector(0,1,0))) * Quaternion ( -M_PI_2, Vector(0,1,0)) ;
+  else
+    quat = Quaternion(direction, Vector(0,1,0)) * Quaternion ( -M_PI_2, Vector(0,1,0)) ;
+
+  this->setAbsDirSoft(quat, 5);
+}
+
+void BoomerangGun::fire()
+{
+  Projectile* pj = this->getProjectile();
+  if (pj == NULL)
+    return;
+
+  pj->setVelocity(this->getVelocity()+(this->getAbsDir().apply(Vector(1,0,0))*100.0 /*+ VECTOR_RAND(13) */
+            /*target->getAbsCoor() - this->getAbsCoor()*/)*.5);//this->getVelocity());
+
+
+  pj->setParent(PNode::getNullParent());
+  pj->setAbsCoor(this->getEmissionPoint());
+  pj->setAbsDir(this->getAbsDir());
+  pj->activate();
+}
Index: trunk/src/world_entities/weapons/boomerang_gun.h
===================================================================
--- trunk/src/world_entities/weapons/boomerang_gun.h	(revision 9235)
+++ trunk/src/world_entities/weapons/boomerang_gun.h	(revision 9235)
@@ -0,0 +1,31 @@
+/*!
+ * @file turret.h
+*/
+
+
+#ifndef _BOOMERANG_GUN_H
+#define _BOOMERANG_GUN_H
+
+#include "weapon.h"
+
+class BoomerangGun : public Weapon
+  {
+  public:
+    BoomerangGun ();
+    BoomerangGun(const TiXmlElement* root);
+    virtual ~BoomerangGun ();
+
+    void init();
+    virtual void loadParams(const TiXmlElement* root);
+
+    virtual void activate();
+    virtual void deactivate();
+
+    virtual void tick(float dt);
+    virtual void fire();
+
+
+  private:
+  };
+
+#endif /* _BOOMERANG_GUN_H */
Index: trunk/src/world_entities/weapons/fps_sniper_rifle.cc
===================================================================
--- trunk/src/world_entities/weapons/fps_sniper_rifle.cc	(revision 9003)
+++ trunk/src/world_entities/weapons/fps_sniper_rifle.cc	(revision 9235)
@@ -33,4 +33,6 @@
 #include "fps_sniper_rifle.h"
 
+
+#include "effects/explosion.h"
 
 using namespace std;
@@ -145,9 +147,12 @@
     return;
 
-  pj->setParent(PNode::getNullParent());
+//   Explosion::explode(this, Vector(0.1,0.1,0.1));
 
-  pj->setVelocity(this->getAbsDir().apply(Vector(1,0,0))*250 + VECTOR_RAND(5));
+  pj->setParent(this);
+  pj->setParentMode(PNODE_ROTATE_AND_MOVE);
 
-  pj->setAbsCoor(this->getEmissionPoint());
+  pj->setVelocity(this->getAbsDir().apply(Vector(1,0,0))*550 + VECTOR_RAND(5) );
+
+  pj->setAbsCoor(this->getEmissionPoint() + this->getAbsDirX() * 25.0f);
   pj->setAbsDir(this->getAbsDir());
   pj->activate();
Index: trunk/src/world_entities/weapons/laser_cannon.cc
===================================================================
--- trunk/src/world_entities/weapons/laser_cannon.cc	(revision 9235)
+++ trunk/src/world_entities/weapons/laser_cannon.cc	(revision 9235)
@@ -0,0 +1,130 @@
+/*
+   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:
+
+
+   @todo: direction in which the projectile flights
+   @todo: a target to set/hit
+*/
+#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_WEAPON
+
+#include "laser_cannon.h"
+#include "world_entities/projectiles/projectile.h"
+
+#include "world_entity.h"
+#include "static_model.h"
+#include "weapon_manager.h"
+#include "util/loading/factory.h"
+
+#include "animation3d.h"
+
+#include "fast_factory.h"
+
+CREATE_FACTORY(LaserCannon, CL_LASER_CANNON);
+
+
+LaserCannon::LaserCannon(const TiXmlElement* root)
+{
+  this->init();
+  if (root != NULL)
+    this->loadParams(root);
+}
+
+/**
+ *  standard deconstructor
+*/
+LaserCannon::~LaserCannon ()
+{
+  // model will be deleted from WorldEntity-destructor
+}
+
+
+void LaserCannon::init()
+{
+  this->setClassID(CL_LASER_CANNON, "LaserCannon");
+
+//  this->model = (Model*)ResourceManager::getInstance()->load("models/guns/laser_cannon.obj", OBJ, RP_CAMPAIGN);
+
+  this->loadModel("models/guns/lasercannon.obj", 5.0f);
+
+  this->setStateDuration(WS_SHOOTING, .1);
+  this->setStateDuration(WS_RELOADING, .1);
+  this->setStateDuration(WS_ACTIVATING, .4);
+  this->setStateDuration(WS_DEACTIVATING, .4);
+
+  this->setEnergyMax(10000);
+  this->increaseEnergy(10000);
+  //this->minCharge = 2;
+
+  this->setActionSound(WA_SHOOT, "sound/laser.wav");
+  this->setActionSound(WA_ACTIVATE, "sound/voices/lasers.wav");
+
+
+  this->setCapability(WTYPE_ALLDIRS | WTYPE_DIRECTIONAL);
+  this->setProjectileType(CL_RAIL_PROJECTILE);
+  this->prepareProjectiles(100);
+  this->setEmissionPoint(Vector(2.8,0,0) * 5.0);
+}
+
+
+void LaserCannon::loadParams(const TiXmlElement* root)
+{
+  Weapon::loadParams(root);
+
+}
+
+
+/**
+ *  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 LaserCannon::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 LaserCannon::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 LaserCannon::fire()
+{
+  Projectile* pj =  this->getProjectile();
+  if (pj == NULL)
+    return;
+
+  pj->setParent(PNode::getNullParent());
+
+  pj->setVelocity(this->getAbsDir().apply(Vector(1,0,0))*250 + VECTOR_RAND(5));
+
+  pj->setAbsCoor(this->getEmissionPoint());
+  pj->setAbsDir(this->getAbsDir());
+  pj->activate();
+}
Index: trunk/src/world_entities/weapons/laser_cannon.h
===================================================================
--- trunk/src/world_entities/weapons/laser_cannon.h	(revision 9235)
+++ trunk/src/world_entities/weapons/laser_cannon.h	(revision 9235)
@@ -0,0 +1,47 @@
+/*!
+    @file weapon.h
+  *  a weapon that a player can use
+
+    A Player has a list of weapons, that can be choosen to shoot projectiles
+    (projectiles.{cc,h}) at enemies. These weapons can be shooted sequentially
+    or (if able) combined. Therefore you can choose the weapon mode = choose
+    a weapon.
+
+    A weapon is characterized by:
+     o firing-rate: the initial firing rate of a weapon (1/s = Herz)
+     o slowdown-factor: this is a factor d: exp(-d*x), d is element of all positive R. it determines how fast the firing-rate will slow down. if no slowdown: d=0, the bigger d is, the faster the weapon will slow down!
+     o energy-consumption: this determines the energy that has to be used to produce this projectile = costs per projectile
+
+    Furthermore there are some other attributes, that will help to represent a firing
+    weapon in this world:
+     o sound file/ressource: this is a pointer to the sound-file/ressource. however it may be represented
+     o shooting animation
+
+*/
+
+
+#ifndef _LASER_CANNON_H
+#define _LASER_CANNON_H
+
+#include "weapon.h"
+
+
+class LaserCannon : public Weapon
+  {
+  public:
+    LaserCannon (const TiXmlElement* root = NULL);
+    virtual ~LaserCannon ();
+
+    void init();
+    virtual void loadParams(const TiXmlElement* root);
+
+    virtual void activate();
+    virtual void deactivate();
+
+    virtual void fire();
+
+  private:
+    PNode* objectComponent1;         //<! the gun is made of multiple parts, these PNodes represent their location and orientation
+  };
+
+#endif /* _LASER_CANNON_H */
