Index: trunk/src/world_entities/weapons/laser.cc
===================================================================
--- trunk/src/world_entities/weapons/laser.cc	(revision 5456)
+++ trunk/src/world_entities/weapons/laser.cc	(revision 5456)
@@ -0,0 +1,160 @@
+/*
+   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: Benjamin Grauer
+
+*/
+#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_WEAPON
+
+#include "laser.h"
+
+#include "fast_factory.h"
+
+#include "state.h"
+#include "list.h"
+#include "class_list.h"
+
+#include "particle_engine.h"
+#include "particle_emitter.h"
+#include "particle_system.h"
+
+
+using namespace std;
+
+CREATE_FAST_FACTORY_STATIC(Laser, CL_LASER);
+
+/**
+ *  standard constructor
+*/
+Laser::Laser () : Projectile()
+{
+  this->setClassID(CL_TEST_BULLET, "Laser");
+
+  float modelSize = .3;
+  this->loadModelWithScale("models/projectiles/lasers.obj", .3);
+
+  this->energyMin = 1;
+  this->energyMax = 10;
+  this->remove();
+  this->lifeSpan = 2;
+
+  this->emitter = new ParticleEmitter(Vector(0,1,0), M_2_PI, 100, 5);
+  this->emitter->setParent(this);
+  this->emitter->setSpread(M_PI, M_PI);
+  this->emitter->setEmissionRate(30.0);
+  this->emitter->setEmissionVelocity(50.0);
+}
+
+
+/**
+ *  standard deconstructor
+*/
+Laser::~Laser ()
+{
+  // delete this->emitter;
+
+  /* this is normaly done by World.cc by deleting the ParticleEngine */
+  if (Laser::explosionParticles != NULL && ClassList::getList(CL_TEST_BULLET)->getSize() <= 1)
+  {
+    if (ClassList::exists(Laser::explosionParticles, CL_PARTICLE_SYSTEM))
+      delete Laser::explosionParticles;
+    Laser::explosionParticles = NULL;
+  }
+
+}
+
+ParticleSystem* Laser::explosionParticles = NULL;
+
+void Laser::activate()
+{
+  State::getWorldEntityList()->add(this);
+  if (unlikely(Laser::explosionParticles == NULL))
+  {
+    Laser::explosionParticles = new ParticleSystem(1000, PARTICLE_SPRITE);
+    Laser::explosionParticles->setName("LaserExplosionParticles");
+    Laser::explosionParticles->setLifeSpan(.5, .3);
+    Laser::explosionParticles->setRadius(0.0, 10);
+    Laser::explosionParticles->setRadius(.5, 20.0);
+    Laser::explosionParticles->setRadius(1.0, 3.0);
+    Laser::explosionParticles->setColor(0.0, 0,1,0,.9);
+    Laser::explosionParticles->setColor(0.5, .8,.8,0,.5);
+    Laser::explosionParticles->setColor(1.0, 1,1,1,.0);
+  }
+}
+
+
+void Laser::deactivate()
+{
+  ParticleEngine::getInstance()->breakConnections(this->emitter);
+  this->lifeCycle = 0.0;
+
+//  GarbageCollector::getInstance()->collect(this);
+  State::getWorldEntityList()->remove(this);
+  Laser::fastFactory->kill(this);
+}
+
+
+void Laser::collidesWith(WorldEntity* entity, const Vector& location)
+{
+  if (this->hitEntity != entity && entity->isA(CL_NPC))
+    this->destroy();
+  this->hitEntity = entity;
+}
+
+/**
+ *  signal tick, time dependent things will be handled here
+ * @param time since last tick
+*/
+void Laser::tick (float time)
+{
+  //Vector v = *this->flightDirection * ( this->speed * time * 1000 + 0.1);
+  Vector v = this->velocity * (time);
+  this->shiftCoor(v);
+
+  this->lifeCycle += time/this->lifeSpan;
+  if( this->lifeCycle >= 1.0)
+    {
+      PRINTF(5)("FINALIZE==========================\n");
+      PRINTF(5)("current life cycle is: %f\n", this->lifeCycle);
+      PRINTF(5)("FINALIZE===========================\n");
+
+      this->deactivate();
+    }
+}
+
+/**
+ *  the function gets called, when the projectile is destroyed
+*/
+void Laser::destroy ()
+{
+  PRINTF(5)("DESTROY Laser\n");
+  this->lifeCycle = .95; //!< @todo calculate this usefully.
+  ParticleEngine::getInstance()->addConnection(this->emitter, Laser::explosionParticles);
+
+}
+
+
+void Laser::draw ()
+{
+  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);
+  glScalef(2.0, 2.0, 2.0);
+  this->model->draw();
+
+  glPopMatrix();
+}
+
Index: trunk/src/world_entities/weapons/laser.h
===================================================================
--- trunk/src/world_entities/weapons/laser.h	(revision 5456)
+++ trunk/src/world_entities/weapons/laser.h	(revision 5456)
@@ -0,0 +1,47 @@
+/*!
+ * @file laser.h
+ * @brief a projectile, that is been shooted by a weapon
+*/
+
+#ifndef _LASER_H
+#define _LASER_H
+
+#include "projectile.h"
+
+class Vector;
+class Weapon;
+class ParticleSystem;
+class ParticleEmitter;
+class FastFactory;
+
+class Laser : public Projectile
+{
+  public:
+    Laser ();
+    virtual ~Laser ();
+
+
+    virtual void activate();
+    virtual void deactivate();
+
+    virtual void collidesWith(WorldEntity* entity, const Vector& location);
+
+    virtual void destroy ();
+
+    virtual void tick (float time);
+    virtual void draw ();
+
+
+  private:
+    static FastFactory*               fastFactory;
+
+    static ParticleSystem*            explosionParticles;
+
+    ParticleEmitter*                  emitter;
+
+
+    WorldEntity* hitEntity; // FIXME TEMPORARY
+
+};
+
+#endif /* _LASER_H */
Index: trunk/src/world_entities/weapons/rocket.cc
===================================================================
--- trunk/src/world_entities/weapons/rocket.cc	(revision 5456)
+++ trunk/src/world_entities/weapons/rocket.cc	(revision 5456)
@@ -0,0 +1,187 @@
+/*
+   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: Benjamin Grauer
+
+*/
+#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_WEAPON
+
+#include "rocket.h"
+
+#include "fast_factory.h"
+
+#include "state.h"
+#include "list.h"
+#include "class_list.h"
+
+#include "particle_engine.h"
+#include "particle_emitter.h"
+#include "particle_system.h"
+
+
+using namespace std;
+
+CREATE_FAST_FACTORY_STATIC(Rocket, CL_ROCKET);
+
+/**
+ *  standard constructor
+*/
+Rocket::Rocket () : Projectile()
+{
+  this->setClassID(CL_TEST_BULLET, "Rocket");
+
+  float modelSize = .3;
+  this->loadModelWithScale("models/projectiles/orx-rocket.obj", .3);
+
+  this->energyMin = 1;
+  this->energyMax = 10;
+  this->remove();
+  this->lifeSpan = 2;
+
+  this->emitter = new ParticleEmitter(Vector(0,1,0), M_2_PI, 100, 5);
+  this->emitter->setParent(this);
+  this->emitter->setSpread(M_PI, M_PI);
+}
+
+
+/**
+ *  standard deconstructor
+*/
+Rocket::~Rocket ()
+{
+  // delete this->emitter;
+
+  /* this is normaly done by World.cc by deleting the ParticleEngine */
+  if (Rocket::trailParticles != NULL && ClassList::getList(CL_TEST_BULLET)->getSize() <= 1)
+  {
+    if (ClassList::exists(Rocket::trailParticles, CL_PARTICLE_SYSTEM))
+      delete Rocket::trailParticles;
+    Rocket::trailParticles = NULL;
+  }
+  if (Rocket::explosionParticles != NULL && ClassList::getList(CL_TEST_BULLET)->getSize() <= 1)
+  {
+    if (ClassList::exists(Rocket::explosionParticles, CL_PARTICLE_SYSTEM))
+      delete Rocket::explosionParticles;
+    Rocket::explosionParticles = NULL;
+  }
+
+}
+
+ParticleSystem* Rocket::trailParticles = NULL;
+ParticleSystem* Rocket::explosionParticles = NULL;
+
+void Rocket::activate()
+{
+  State::getWorldEntityList()->add(this);
+  if (unlikely(Rocket::trailParticles == NULL))
+  {
+    Rocket::trailParticles = new ParticleSystem(1000, PARTICLE_SPRITE);
+    Rocket::trailParticles->setName("RocketTrailParticles");
+    Rocket::trailParticles->setLifeSpan(.5, .3);
+    Rocket::trailParticles->setRadius(0.0, .5);
+    Rocket::trailParticles->setRadius(0.5, 2.0);
+    Rocket::trailParticles->setRadius(1.0, 5.0);
+    Rocket::trailParticles->setColor(0.0, 1,0,0,.7);
+    Rocket::trailParticles->setColor(0.5, .8,.8,0,.5);
+    Rocket::trailParticles->setColor(1.0, .7,.7,.7,.0);
+  }
+  if (unlikely(Rocket::explosionParticles == NULL))
+  {
+    Rocket::explosionParticles = new ParticleSystem(1000, PARTICLE_SPRITE);
+    Rocket::explosionParticles->setName("RocketExplosionParticles");
+    Rocket::explosionParticles->setLifeSpan(.5, .3);
+    Rocket::explosionParticles->setRadius(0.0, 10);
+    Rocket::explosionParticles->setRadius(.5, 20.0);
+    Rocket::explosionParticles->setRadius(1.0, 3.0);
+    Rocket::explosionParticles->setColor(0.0, 0,1,0,.9);
+    Rocket::explosionParticles->setColor(0.5, .8,.8,0,.5);
+    Rocket::explosionParticles->setColor(1.0, 1,1,1,.0);
+  }
+
+  ParticleEngine::getInstance()->addConnection(this->emitter, Rocket::trailParticles);
+
+  this->emitter->setEmissionRate(20.0);
+  this->emitter->setEmissionVelocity(3.0);
+}
+
+
+void Rocket::deactivate()
+{
+  ParticleEngine::getInstance()->breakConnections(this->emitter);
+  this->lifeCycle = 0.0;
+
+//  GarbageCollector::getInstance()->collect(this);
+  State::getWorldEntityList()->remove(this);
+  Rocket::fastFactory->kill(this);
+}
+
+
+void Rocket::collidesWith(WorldEntity* entity, const Vector& location)
+{
+  if (this->hitEntity != entity && entity->isA(CL_NPC))
+    this->destroy();
+  this->hitEntity = entity;
+}
+
+/**
+ *  signal tick, time dependent things will be handled here
+ * @param time since last tick
+*/
+void Rocket::tick (float time)
+{
+  //Vector v = *this->flightDirection * ( this->speed * time * 1000 + 0.1);
+  Vector v = this->velocity * (time);
+  this->shiftCoor(v);
+
+  this->lifeCycle += time/this->lifeSpan;
+  if( this->lifeCycle >= 1.0)
+    {
+      PRINTF(5)("FINALIZE==========================\n");
+      PRINTF(5)("current life cycle is: %f\n", this->lifeCycle);
+      PRINTF(5)("FINALIZE===========================\n");
+
+      this->deactivate();
+    }
+}
+
+/**
+ *  the function gets called, when the projectile is destroyed
+*/
+void Rocket::destroy ()
+{
+  PRINTF(5)("DESTROY Rocket\n");
+  this->lifeCycle = .95; //!< @todo calculate this usefully.
+  ParticleEngine::getInstance()->breakConnection(this->emitter, Rocket::trailParticles);
+  ParticleEngine::getInstance()->addConnection(this->emitter, Rocket::explosionParticles);
+
+  this->emitter->setEmissionRate(30.0);
+  this->emitter->setEmissionVelocity(50.0);
+//  this->deactivate();
+
+}
+
+
+void Rocket::draw ()
+{
+  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);
+  glScalef(2.0, 2.0, 2.0);
+  this->model->draw();
+
+  glPopMatrix();
+}
+
Index: trunk/src/world_entities/weapons/rocket.h
===================================================================
--- trunk/src/world_entities/weapons/rocket.h	(revision 5456)
+++ trunk/src/world_entities/weapons/rocket.h	(revision 5456)
@@ -0,0 +1,47 @@
+/*!
+ * @file rocket.h
+ * @brief a Rocket Projectile
+*/
+
+#ifndef _ROCKET_H
+#define _ROCKET_H
+
+#include "projectile.h"
+
+class Vector;
+class Weapon;
+class ParticleSystem;
+class ParticleEmitter;
+class FastFactory;
+
+class Rocket : public Projectile
+{
+  public:
+    Rocket ();
+    virtual ~Rocket ();
+
+
+    virtual void activate();
+    virtual void deactivate();
+
+    virtual void collidesWith(WorldEntity* entity, const Vector& location);
+
+    virtual void destroy ();
+
+    virtual void tick (float time);
+    virtual void draw ();
+
+
+  private:
+    static FastFactory*               fastFactory;
+    static ParticleSystem*            trailParticles;
+    static ParticleSystem*            explosionParticles;
+
+    ParticleEmitter*                  emitter;
+
+
+    WorldEntity* hitEntity; // FIXME TEMPORARY
+
+};
+
+#endif /* _ROCKET_H */
Index: trunk/src/world_entities/weapons/test_gun.cc
===================================================================
--- trunk/src/world_entities/weapons/test_gun.cc	(revision 5453)
+++ trunk/src/world_entities/weapons/test_gun.cc	(revision 5456)
@@ -134,5 +134,5 @@
 
   this->setCapability(WTYPE_ALLDIRS | WTYPE_DIRECTIONAL);
-  this->setProjectileType(CL_TEST_BULLET);
+  this->setProjectileType(CL_LASER);
   this->prepareProjectiles(20);
 }
Index: trunk/src/world_entities/weapons/turret.cc
===================================================================
--- trunk/src/world_entities/weapons/turret.cc	(revision 5453)
+++ trunk/src/world_entities/weapons/turret.cc	(revision 5456)
@@ -92,5 +92,5 @@
 
   this->setCapability(WTYPE_ALLDIRS | WTYPE_TURRET);
-  this->setProjectileType(CL_TEST_BULLET);
+  this->setProjectileType(CL_ROCKET);
 
 
