Index: /branches/playability/src/world_entities/projectiles/mbolt.cc
===================================================================
--- /branches/playability/src/world_entities/projectiles/mbolt.cc	(revision 9999)
+++ /branches/playability/src/world_entities/projectiles/mbolt.cc	(revision 9999)
@@ -0,0 +1,151 @@
+/*
+   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 "mbolt.h"
+
+#include "state.h"
+#include "model.h"
+
+#include "particles/dot_emitter.h"
+#include "particles/sprite_particles.h"
+
+#include <cassert>
+#include "debug.h"
+
+
+#include "class_id_DEPRECATED.h"
+CREATE_FAST_FACTORY_STATIC(MBolt);
+
+/**
+ *  standard constructor
+*/
+MBolt::MBolt () : Projectile()
+{
+
+  //this->loadModel("models/projectiles/mbolt.obj");   //!< Model not yet in repo
+  this->loadModel("models/projectiles/laser.obj");
+
+  this->setMinEnergy(10);
+  this->setHealthMax(0);
+  this->lifeSpan = 5.0;
+
+  this->emitter = new DotEmitter(100, 5, M_2_PI);
+  this->emitter->setParent(this);
+  this->emitter->setSpread(M_PI, M_PI);
+  this->emitter->setEmissionRate(300.0);
+  this->emitter->setEmissionVelocity(50.0);
+}
+
+
+/**
+ *  standard deconstructor
+*/
+MBolt::~MBolt ()
+{
+  // delete this->emitter;
+
+  /* this is normaly done by World.cc by deleting the ParticleEngine */
+  if (MBolt::explosionParticles != NULL && MBolt::objectList().size() <= 1)
+  {
+    //if (ClassList::exists(MBolt::explosionParticles, CL_PARTICLE_SYSTEM))
+    //  delete MBolt::explosionParticles;
+    PRINTF(1)("Deleting MBolt Particles\n");
+    MBolt::explosionParticles = NULL;
+  }
+
+}
+
+SpriteParticles* MBolt::explosionParticles = NULL;
+
+void MBolt::activate()
+{
+  if (unlikely(MBolt::explosionParticles == NULL))
+  {
+    MBolt::explosionParticles = new SpriteParticles(1000);
+    MBolt::explosionParticles->setName("MBoltExplosionParticles");
+    MBolt::explosionParticles->setLifeSpan(.5, .3);
+    MBolt::explosionParticles->setRadius(0.0, 10.0);
+    MBolt::explosionParticles->setRadius(.5, 6.0);
+    MBolt::explosionParticles->setRadius(1.0, 3.0);
+    MBolt::explosionParticles->setColor(0.0, 1,1,0,.9);
+    MBolt::explosionParticles->setColor(0.5, .8,.8,0,.5);
+    MBolt::explosionParticles->setColor(1.0, .8,.8,.7,.0);
+  }
+
+  this->setDamage(50);
+  this->setHealth(0);
+}
+
+
+void MBolt::deactivate()
+{
+  assert (MBolt::explosionParticles != NULL);
+  MBolt::explosionParticles->removeEmitter(this->emitter);
+  this->lifeCycle = 0.0;
+
+  this->toList(OM_NULL);
+  this->removeNode();
+  MBolt::fastFactory->kill(this);
+}
+
+
+void MBolt::collidesWith(WorldEntity* entity, const Vector& location)
+{
+  if (this->hitEntity != entity && entity->isA(CL_NPC))
+    this->destroy( entity );
+  this->hitEntity = entity;
+}
+
+/**
+ *  signal tick, time dependent things will be handled here
+ * @param dt time since last tick
+*/
+void MBolt::tick (float dt)
+{
+  //Vector v = *this->flightDirection * ( this->speed * time * 1000 + 0.1);
+  Vector v = this->velocity * dt;
+  this->shiftCoor(v);
+
+  if (this->tickLifeCycle(dt))
+    this->deactivate();
+}
+
+/**
+ *  the function gets called, when the projectile is destroyed
+*/
+void MBolt::destroy (WorldEntity* killer)
+{
+  Projectile::destroy( killer );
+  PRINTF(5)("DESTROY MBolt\n");
+  this->lifeCycle = .95; //!< @todo calculate this usefully.
+
+  this->emitter->setSystem(MBolt::explosionParticles);
+}
+
+
+void MBolt::draw () const
+{
+  glPushAttrib(GL_ENABLE_BIT);
+  glDisable(GL_LIGHTING);
+
+  WorldEntity::draw();
+
+  glPopAttrib();
+}
+
Index: /branches/playability/src/world_entities/projectiles/mbolt.h
===================================================================
--- /branches/playability/src/world_entities/projectiles/mbolt.h	(revision 9999)
+++ /branches/playability/src/world_entities/projectiles/mbolt.h	(revision 9999)
@@ -0,0 +1,47 @@
+/*!
+ * @file mbolt.h
+ * @brief medium blaster bolt
+*/
+
+#ifndef _MBOLT_H
+#define _MBOLT_H
+
+#include "projectile.h"
+
+class Vector;
+class Weapon;
+class SpriteParticles;
+class ParticleEmitter;
+class FastFactory;
+
+class MBolt : public Projectile
+{
+  //ObjectListDeclaration(MBolt);
+  public:
+    MBolt ();
+    virtual ~MBolt ();
+
+
+    virtual void activate();
+    virtual void deactivate();
+
+    virtual void collidesWith(WorldEntity* entity, const Vector& location);
+
+    virtual void destroy (WorldEntity* killer);
+
+    virtual void tick (float dt);
+    virtual void draw () const;
+
+
+  private:
+    static FastFactory*               fastFactory;
+
+    static SpriteParticles*           explosionParticles;
+
+    ParticleEmitter*                  emitter;
+
+
+    WorldEntity* hitEntity; // FIXME TEMPORARY
+};
+
+#endif /* _MBOLT_H */
