Index: trunk/src/lib/particles/Makefile.am
===================================================================
--- trunk/src/lib/particles/Makefile.am	(revision 6620)
+++ trunk/src/lib/particles/Makefile.am	(revision 6621)
@@ -4,10 +4,16 @@
 noinst_LIBRARIES = libORXparticles.a
 
-libORXparticles_a_SOURCES = particle_emitter.cc \
-                            particle_system.cc \
-                            quick_animation.cc
+libORXparticles_a_SOURCES = \
+			particle_emitter.cc \
+			\
+			particle_system.cc \
+			sprite_particles.cc \
+			quick_animation.cc
 
 
-noinst_HEADERS= particle_emitter.h \
-                particle_system.h \
-                quick_animation.h
+noinst_HEADERS = \
+			particle_emitter.h \
+			\
+			particle_system.h \
+			sprite_particles.h \
+			quick_animation.h
Index: trunk/src/lib/particles/particle_system.cc
===================================================================
--- trunk/src/lib/particles/particle_system.cc	(revision 6620)
+++ trunk/src/lib/particles/particle_system.cc	(revision 6621)
@@ -32,9 +32,4 @@
 #include <algorithm>
 
-
-CREATE_FACTORY(ParticleSystem, CL_PARTICLE_SYSTEM);
-SHELL_COMMAND(texture, ParticleSystem, setMaterialTexture)
-    ->defaultValues(1, "maps/evil-flower.png");
-
 using namespace std;
 
@@ -44,10 +39,9 @@
  * @param type The Type of the ParticleSystem
 */
-ParticleSystem::ParticleSystem (unsigned int maxCount, PARTICLE_TYPE type)
+ParticleSystem::ParticleSystem (unsigned int maxCount)
 {
   this->init();
 
   this->setMaxCount(maxCount);
-  this->setType(type, 1);
 }
 
@@ -103,5 +97,4 @@
   this->setLifeSpan(1);
   this->glID = NULL;
-  this->setType(PARTICLE_DEFAULT_TYPE, 1);
 
   this->toList(OM_ENVIRON);
@@ -126,7 +119,4 @@
   LoadParam(root, "conserve", this, ParticleSystem, setConserve)
       .describe("sets the Conserve factor of the Particles (1.0: they keep all their energy, 0.0:they keep no energy)");
-
-  LoadParam(root, "type", this, ParticleSystem, setType)
-      .describe("sets the type of the Particles, (dot, spark, sprite or model)");
 
   LoadParam(root, "texture", this, ParticleSystem, setMaterialTexture);
@@ -155,53 +145,4 @@
 {
   this->maxCount = maxCount;
-}
-
-
-/**
- * @param particleType the type of particles in this System
- * @param count how many particles (in PARTICLE_MULTI-mode)
-   @todo this will be different
-*/
-void ParticleSystem::setType(const char* particleType)
-{
-  if (!strcmp(particleType, "dot"))
-    this->setType(PARTICLE_DOT);
-  else if(!strcmp(particleType, "spark"))
-    this->setType(PARTICLE_SPARK);
-  else if(!strcmp(particleType, "model"))
-    this->setType(PARTICLE_MODEL);
-  else // if (strcmp(particleType, "SPRITE"))
-    this->setType(PARTICLE_SPRITE);
-}
-
-/**
- * @param particleType the type of particles in this System
- * @param count how many particles (in PARTICLE_MULTI-mode)
-   @todo this MUST be different
-*/
-void ParticleSystem::setType(PARTICLE_TYPE particleType, int count)
-{
-  this->particleType = particleType;
-  this->dialectCount = count;
-  //  if (glID != NULL)
-  //    delete glID;
-
-  //  glID = new GLuint[count];
-  //  for (int i = 0; i< count; i++)
-  //    glID[i] = 0;
-
-  //  glID[0] = glGenLists(count);
-  if (this->material)
-    delete this->material;
-  this->material = NULL;
-
-  switch (this->particleType)
-    {
-      case PARTICLE_SPRITE:
-        this->material = new Material("transperencyMap");
-        this->material->setDiffuseMap("maps/radialTransparency.png");
-      //  material->setTransparency(.5);
-        break;
-  }
 }
 
@@ -405,14 +346,5 @@
 unsigned int ParticleSystem::getFaceCount() const
 {
-  switch (this->particleType)
-  {
-    case PARTICLE_SPRITE:
-      return this->count;
-      break;
-    case PARTICLE_MODEL:
-      if (this->getModel(0))
-        return this->count * this->getModel()->getTriangleCount();
-      break;
-  }
+  return this->count;
 }
 
@@ -425,130 +357,75 @@
    This is just the fastest Way to do this, but will most likely be changed in the future.
  */
-void ParticleSystem::draw() const
-{
-  glPushAttrib(GL_ENABLE_BIT);
-
-  Particle* drawPart = particles;
-
-  switch (this->particleType)
-  {
-    default:
-    case PARTICLE_SPRITE:
-      glDisable(GL_LIGHTING);
-      glMatrixMode(GL_MODELVIEW);
-      glDepthMask(GL_FALSE);
-
-      material->select();
-      glBlendFunc(GL_SRC_ALPHA, GL_DST_ALPHA);
-
-      //glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_ENV_MODE, GL_MODULATE);
-
-
-      while (likely(drawPart != NULL))
-      {
-        glColor4fv(drawPart->color);
-          //! @todo implement a faster code for the look-at Camera algorithm.
-
-        const PNode* camera = State::getCamera();  //!< @todo MUST be different
-        Vector cameraPos = camera->getAbsCoor();
-        Vector cameraTargetPos = State::getCameraTarget()->getAbsCoor();
-        Vector view = cameraTargetPos - cameraPos;
-        Vector up = Vector(0, 1, 0);
-        up = camera->getAbsDir().apply(up);
-        Vector h = up.cross(view);
-        Vector v = h.cross(view);
-        h.normalize();
-        v.normalize();
-        v *= .5 * drawPart->radius;
-        h *= .5 * drawPart->radius;
-
-        glBegin(GL_TRIANGLE_STRIP);
-        glTexCoord2i(1, 1);
-        glVertex3f(drawPart->position.x - h.x - v.x,
-                   drawPart->position.y - h.y - v.y,
-                   drawPart->position.z - h.z - v.z);
-        glTexCoord2i(0, 1);
-        glVertex3f(drawPart->position.x - h.x + v.x,
-                   drawPart->position.y - h.y + v.y,
-                   drawPart->position.z - h.z + v.z);
-        glTexCoord2i(1, 0);
-        glVertex3f(drawPart->position.x + h.x - v.x,
-                   drawPart->position.y + h.y - v.y,
-                   drawPart->position.z + h.z - v.z);
-        glTexCoord2i(0, 0);
-        glVertex3f(drawPart->position.x + h.x + v.x,
-                   drawPart->position.y + h.y + v.y,
-                   drawPart->position.z + h.z + v.z);
-
-        glEnd();
-
-        drawPart = drawPart->next;
-      }
-      glDepthMask(GL_TRUE);
-      break;
-
-    case PARTICLE_SPARK:
-      glDisable(GL_LIGHTING);
-      glDepthMask(GL_FALSE);
-      //glEnable(GL_LINE_SMOOTH);
-      glEnable(GL_BLEND);
-
-      glBegin(GL_LINES);
-      while (likely(drawPart != NULL))
-      {
-        glColor4fv(drawPart->color);
-        glVertex3f(drawPart->position.x, drawPart->position.y, drawPart->position.z);
-        glVertex3f(drawPart->position.x - drawPart->velocity.x * drawPart->radius,
-                   drawPart->position.y - drawPart->velocity.y * drawPart->radius,
-                   drawPart->position.z - drawPart->velocity.z * drawPart->radius);
-        drawPart = drawPart->next;
-      }
-      glEnd();
-      break;
-
-    case PARTICLE_MODEL:
-      {
-        GLfloat matrix[4][4];
-
-        if (likely(this->getModel() != NULL))
-          while (likely(drawPart != NULL))
-        {
-          glPushMatrix();
-          glMatrixMode(GL_MODELVIEW);
-          /* move */
-          glTranslatef(drawPart->position.x, drawPart->position.y, drawPart->position.z);
-          /* scale */
-          glScalef(drawPart->radius, drawPart->radius, drawPart->radius);
-          /* rotate */
-          drawPart->orientation.matrix (matrix);
-          glMultMatrixf((float*)matrix);
-
-          this->getModel()->draw();
-
-          glPopMatrix();
-          drawPart = drawPart->next;
-        }
-        else
-          PRINTF(2)("no model loaded onto ParticleSystem-%s\n", this->getName());
-      }
-      break;
-
-    case PARTICLE_DOT:
-      glDisable(GL_LIGHTING);
-      glBegin(GL_POINTS);
-      while (likely(drawPart != NULL))
-      {
-        glColor4fv(drawPart->color);
-
-        glLineWidth(drawPart->radius);
-
-        glVertex3f(drawPart->position.x, drawPart->position.y, drawPart->position.z);
-        drawPart = drawPart->next;
-      }
-      glEnd();
-      break;
-  }
-  glPopAttrib();
-}
+// void ParticleSystem::draw() const
+// {
+//   glPushAttrib(GL_ENABLE_BIT);
+//
+//   Particle* drawPart = particles;
+//
+//   switch (this->particleType)
+//   {
+//     case PARTICLE_SPARK:
+//       glDisable(GL_LIGHTING);
+//       glDepthMask(GL_FALSE);
+//       //glEnable(GL_LINE_SMOOTH);
+//       glEnable(GL_BLEND);
+//
+//       glBegin(GL_LINES);
+//       while (likely(drawPart != NULL))
+//       {
+//         glColor4fv(drawPart->color);
+//         glVertex3f(drawPart->position.x, drawPart->position.y, drawPart->position.z);
+//         glVertex3f(drawPart->position.x - drawPart->velocity.x * drawPart->radius,
+//                    drawPart->position.y - drawPart->velocity.y * drawPart->radius,
+//                    drawPart->position.z - drawPart->velocity.z * drawPart->radius);
+//         drawPart = drawPart->next;
+//       }
+//       glEnd();
+//       break;
+//
+//     case PARTICLE_MODEL:
+//       {
+//         GLfloat matrix[4][4];
+//
+//         if (likely(this->getModel() != NULL))
+//           while (likely(drawPart != NULL))
+//         {
+//           glPushMatrix();
+//           glMatrixMode(GL_MODELVIEW);
+//           /* move */
+//           glTranslatef(drawPart->position.x, drawPart->position.y, drawPart->position.z);
+//           /* scale */
+//           glScalef(drawPart->radius, drawPart->radius, drawPart->radius);
+//           /* rotate */
+//           drawPart->orientation.matrix (matrix);
+//           glMultMatrixf((float*)matrix);
+//
+//           this->getModel()->draw();
+//
+//           glPopMatrix();
+//           drawPart = drawPart->next;
+//         }
+//         else
+//           PRINTF(2)("no model loaded onto ParticleSystem-%s\n", this->getName());
+//       }
+//       break;
+//
+//     case PARTICLE_DOT:
+//       glDisable(GL_LIGHTING);
+//       glBegin(GL_POINTS);
+//       while (likely(drawPart != NULL))
+//       {
+//         glColor4fv(drawPart->color);
+//
+//         glLineWidth(drawPart->radius);
+//
+//         glVertex3f(drawPart->position.x, drawPart->position.y, drawPart->position.z);
+//         drawPart = drawPart->next;
+//       }
+//       glEnd();
+//       break;
+//   }
+//   glPopAttrib();
+// }
 
 /**
@@ -621,18 +498,4 @@
 void ParticleSystem::debug() const
 {
-  PRINT(0)("  ParticleSystem %s, type: ", this->getName());
-  {
-      if (this->particleType == PARTICLE_MODEL)
-        PRINT(0)("model");
-      else if (this->particleType == PARTICLE_SPRITE)
-        PRINT(0)("sprite");
-      else if (this->particleType == PARTICLE_DOT)
-        PRINT(0)("dot");
-      else if (this->particleType == PARTICLE_SPARK)
-        PRINT(0)("spark");
-
-      PRINT(0)("\n");
-  }
-
   PRINT(0)("  ParticleCount: %d, maximumCount: %d :: filled %d%%\n", this->count, this->maxCount, 100*this->count/this->maxCount);
   if (deadList)
Index: trunk/src/lib/particles/particle_system.h
===================================================================
--- trunk/src/lib/particles/particle_system.h	(revision 6620)
+++ trunk/src/lib/particles/particle_system.h	(revision 6621)
@@ -26,17 +26,5 @@
 #define PARTICLE_MULTI_MASK            0x100000     //!< A Mask if they are Multi-partilces
 
-//! An enumerator for the different types of particles.
-typedef enum PARTICLE_TYPE
-{
-  PARTICLE_DOT           =  PARTICLE_DOT_MASK,
-  PARTICLE_SPARK         =  PARTICLE_SPARK_MASK,
-  PARTICLE_SPRITE        =  PARTICLE_SPRITE_MASK,
-  PARTICLE_MULTI_SPRITE  =  PARTICLE_SPRITE_MASK | PARTICLE_MULTI_MASK,
-  PARTICLE_MODEL         =  PARTICLE_MODEL_MASK,
-  PARTICLE_MULTI_MODE    =  PARTICLE_MODEL_MASK | PARTICLE_MULTI_MASK
-};
-
 #define PARTICLE_DEFAULT_MAX_COUNT    200               //!< A default count of particles in the system.
-#define PARTICLE_DEFAULT_TYPE         PARTICLE_SPRITE   //!< A default type of the system.
 
 // FORWARD DECLARATION
@@ -69,6 +57,5 @@
 
  public:
-  ParticleSystem(unsigned int maxCount = PARTICLE_DEFAULT_MAX_COUNT,
-                 PARTICLE_TYPE type = PARTICLE_DEFAULT_TYPE);
+  ParticleSystem(unsigned int maxCount = PARTICLE_DEFAULT_MAX_COUNT);
   ParticleSystem(const TiXmlElement* root);
   virtual ~ParticleSystem();
@@ -77,6 +64,4 @@
   virtual void loadParams(const TiXmlElement* root);
 
-  void setType(const char* particleType);
-  void setType(PARTICLE_TYPE particleType, int count = 0);
   void setMaterial(Material* material);
   void setMaterialTexture(const char* textureFile);
@@ -91,6 +76,4 @@
   void setColor(float lifeCycleTime, float red, float green, float blue, float alpha);
 
-  /** @returns the Type of the particles */
-  inline PARTICLE_TYPE getType() const { return this->particleType; };
   /** @returns the Material that lies on this particles */
   inline const Material* getMaterial() const { return this->material; };
@@ -113,5 +96,5 @@
 
   virtual void applyField(Field* field);
-  /** \brief this is an empty function, because the Physics are implemented in tick @param dt: useless here */
+  /** @brief this is an empty function, because the Physics are implemented in tick @param dt: useless here */
   virtual void tickPhys(float dt) {};
 
@@ -119,9 +102,9 @@
 
   virtual void tick(float dt);
-  virtual void draw() const;
+  virtual void draw() const = 0;
 
   void debug() const;
 
- private:
+ protected:
   float             conserve;            //!< How much energy gets conserved to the next Tick.
   float             lifeSpan;            //!< Initial lifetime of a Particle.
@@ -132,5 +115,4 @@
   int               maxCount;            //!< The maximum count of Particles.
   int               count;               //!< The current count of Particles.
-  PARTICLE_TYPE     particleType;        //!< A type for all the Particles
   Material*         material;            //!< A Material for all the Particles.
   Particle*         particles;           //!< A list of particles of this System.
Index: trunk/src/lib/particles/sprite_particles.cc
===================================================================
--- trunk/src/lib/particles/sprite_particles.cc	(revision 6621)
+++ trunk/src/lib/particles/sprite_particles.cc	(revision 6621)
@@ -0,0 +1,185 @@
+/*
+   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_GRAPHICS
+
+#include "sprite_particles.h"
+
+#include "load_param.h"
+#include "factory.h"
+#include "material.h"
+#include "state.h"
+#include "shell_command.h"
+
+#include "parser/tinyxml/tinyxml.h"
+#include <algorithm>
+
+
+CREATE_FACTORY(SpriteParticles, CL_SPRITE_PARTICLES);
+
+SHELL_COMMAND(texture, SpriteParticles, setMaterialTexture)
+    ->defaultValues(1, "maps/evil-flower.png");
+
+using namespace std;
+
+/**
+ *  standard constructor
+ * @param maxCount the Count of particles in the System
+ * @param type The Type of the SpriteParticles
+*/
+SpriteParticles::SpriteParticles (unsigned int maxCount)
+  : ParticleSystem(maxCount)
+{
+  this->init();
+}
+
+/**
+ * @brief creates a Particle System out of a XML-element
+ * @param root: the XML-element to load from
+ */
+SpriteParticles::SpriteParticles(const TiXmlElement* root)
+{
+  this->init();
+
+  this->loadParams(root);
+}
+
+/**
+ *  standard deconstructor
+*/
+SpriteParticles::~SpriteParticles()
+{
+  // deleting all the living Particles
+  while (this->particles)
+  {
+    Particle* tmpDelPart = this->particles;
+    this->particles = this->particles->next;
+    delete tmpDelPart;
+  }
+
+  // deleting all the dead particles
+  while (this->deadList)
+  {
+    Particle* tmpDelPart = this->deadList;
+    this->deadList = this->deadList->next;
+    delete tmpDelPart;
+  }
+}
+
+/**
+ * @brief initializes the SpriteParticles with default values
+*/
+void SpriteParticles::init()
+{
+  this->setClassID(CL_SPRITE_PARTICLES, "SpriteParticles");
+
+  this->material = NULL;
+}
+
+
+/**
+ * loads Parameters from a TiXmlElement
+ * @param root the XML-element to load from.
+ */
+void SpriteParticles::loadParams(const TiXmlElement* root)
+{
+  SpriteParticles::loadParams(root);
+
+  LoadParam(root, "texture", this, SpriteParticles, setMaterialTexture);
+}
+
+// setting properties
+/**
+ * @brief sets the material to an external material
+ * @param material: the material to set this material to.
+ *
+ * !! important if the extern material gets deleted it MUST be unregistered here or segfault !!
+*/
+void SpriteParticles::setMaterial(Material* material)
+{
+  this->material = *material;
+}
+
+void SpriteParticles::setMaterialTexture(const char* textureFile)
+{
+  this->material.setDiffuseMap(textureFile);
+}
+
+/**
+ * @brief draws all the Particles of this System
+ *
+ * The Cases in this Function all do the same:
+ * Drawing all the particles with the appropriate Type.
+ * This is just the fastest Way to do this, but will most likely be changed in the future.
+ */
+void SpriteParticles::draw() const
+{
+  glPushAttrib(GL_ENABLE_BIT);
+
+  Particle* drawPart = particles;
+
+  glDisable(GL_LIGHTING);
+  glMatrixMode(GL_MODELVIEW);
+  glDepthMask(GL_FALSE);
+
+  material.select();
+  glBlendFunc(GL_SRC_ALPHA, GL_DST_ALPHA);
+
+  //glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_ENV_MODE, GL_MODULATE);
+
+
+  while (likely(drawPart != NULL))
+  {
+    glColor4fv(drawPart->color);
+    //! @todo implement a faster code for the look-at Camera algorithm.
+
+    const PNode* camera = State::getCamera();  //!< @todo MUST be different
+    Vector cameraPos = camera->getAbsCoor();
+    Vector cameraTargetPos = State::getCameraTarget()->getAbsCoor();
+    Vector view = cameraTargetPos - cameraPos;
+    Vector up = Vector(0, 1, 0);
+    up = camera->getAbsDir().apply(up);
+    Vector h = up.cross(view);
+    Vector v = h.cross(view);
+    h.normalize();
+    v.normalize();
+    v *= .5 * drawPart->radius;
+    h *= .5 * drawPart->radius;
+
+    glBegin(GL_TRIANGLE_STRIP);
+    glTexCoord2i(1, 1);
+    glVertex3f(drawPart->position.x - h.x - v.x,
+               drawPart->position.y - h.y - v.y,
+               drawPart->position.z - h.z - v.z);
+    glTexCoord2i(0, 1);
+    glVertex3f(drawPart->position.x - h.x + v.x,
+               drawPart->position.y - h.y + v.y,
+               drawPart->position.z - h.z + v.z);
+    glTexCoord2i(1, 0);
+    glVertex3f(drawPart->position.x + h.x - v.x,
+               drawPart->position.y + h.y - v.y,
+               drawPart->position.z + h.z - v.z);
+    glTexCoord2i(0, 0);
+    glVertex3f(drawPart->position.x + h.x + v.x,
+               drawPart->position.y + h.y + v.y,
+               drawPart->position.z + h.z + v.z);
+
+    glEnd();
+
+    drawPart = drawPart->next;
+  }
+  glDepthMask(GL_TRUE);
+  glPopAttrib();
+}
Index: trunk/src/lib/particles/sprite_particles.h
===================================================================
--- trunk/src/lib/particles/sprite_particles.h	(revision 6621)
+++ trunk/src/lib/particles/sprite_particles.h	(revision 6621)
@@ -0,0 +1,40 @@
+/*!
+ * @file particle_system.h
+
+*/
+
+#ifndef _SPRITE_PARTICLE_SYSTEM_H
+#define _SPRITE_PARTICLE_SYSTEM_H
+
+#include "particle_system.h"
+#include "material.h"
+
+//! A class to handle ParticleSystems
+class SpriteParticles : public ParticleSystem
+{
+
+public:
+  SpriteParticles(unsigned int maxCount = PARTICLE_DEFAULT_MAX_COUNT);
+  SpriteParticles(const TiXmlElement* root);
+  virtual ~SpriteParticles();
+
+  virtual void loadParams(const TiXmlElement* root);
+
+  void setMaterial(Material* material);
+  void setMaterialTexture(const char* textureFile);
+
+  /** @returns the Material that lies on this particles */
+  inline const Material* getMaterial() const { return &this->material; };
+
+  virtual void draw() const;
+
+  void debug() const;
+
+private:
+  void init();
+
+private:
+  Material          material;            //!< A Material for all the Particles.
+};
+
+#endif /* _SPRITE_PARTICLE_SYSTEM_H */
