Index: trunk/src/world_entities/Makefile.am
===================================================================
--- trunk/src/world_entities/Makefile.am	(revision 9656)
+++ trunk/src/world_entities/Makefile.am	(revision 9869)
@@ -21,4 +21,5 @@
 		projectiles/projectile.cc \
 		\
+		extendable.cc \
 		power_ups/power_up.cc \
 		power_ups/param_power_up.cc \
Index: trunk/src/world_entities/WorldEntities.am
===================================================================
--- trunk/src/world_entities/WorldEntities.am	(revision 9656)
+++ trunk/src/world_entities/WorldEntities.am	(revision 9869)
@@ -72,5 +72,35 @@
                 world_entities/effects/lightning_bolt.cc \
                 \
-                world_entities/script_trigger.cc
+                world_entities/script_trigger.cc \
+                \
+                \
+                world_entities/particles/particle_emitter.cc \
+		world_entities/particles/dot_emitter.cc \
+		world_entities/particles/box_emitter.cc \
+		world_entities/particles/plane_emitter.cc \
+		\
+		world_entities/particles/particle_system.cc \
+		world_entities/particles/sprite_particles.cc \
+		world_entities/particles/spark_particles.cc \
+		world_entities/particles/model_particles.cc \
+		world_entities/particles/dot_particles.cc \
+		\
+		world_entities/particles/quick_animation.cc \
+		\
+		\
+		world_entities/weather_effects/atmospheric_engine.cc \
+		world_entities/weather_effects/weather_effect.cc \
+		world_entities/weather_effects/cloud_effect.cc \
+		world_entities/weather_effects/sun_effect.cc \
+		world_entities/weather_effects/fog_effect.cc \
+		world_entities/weather_effects/volfog_effect.cc \
+		world_entities/weather_effects/rain_effect.cc \
+		world_entities/weather_effects/snow_effect.cc \
+		world_entities/weather_effects/lightning_effect.cc \
+		world_entities/weather_effects/lense_flare.cc
+
+
+
+
 
 
@@ -144,3 +174,30 @@
                 effects/lightning_bolt.h \
                 \
-                script_trigger.h
+                script_trigger.h \
+                \
+                \
+		particles/particle_emitter.h \
+		particles/dot_emitter.h \
+		particles/box_emitter.h \
+		particles/plane_emitter.h \
+		\
+		particles/particle_system.h \
+		particles/sprite_particles.h \
+		particles/spark_particles.h \
+		particles/model_particles.h \
+		particles/dot_particles.h \
+		\
+		particles/quick_animation.h \
+		\
+		\
+		weather_effects/atmospheric_engine.h \
+		weather_effects/weather_effect.h \
+		weather_effects/sun_effect.h \
+		weather_effects/fog_effect.h \
+		weather_effects/volfog_effect.h \
+		weather_effects/rain_effect.h \
+		weather_effects/snow_effect.h \
+		weather_effects/cloud_effect.h \
+		weather_effects/lightning_effect.h \
+		weather_effects/lense_flare.h
+
Index: trunk/src/world_entities/bsp_entity.cc
===================================================================
--- trunk/src/world_entities/bsp_entity.cc	(revision 9656)
+++ trunk/src/world_entities/bsp_entity.cc	(revision 9869)
@@ -15,8 +15,11 @@
 
 #include "bsp_entity.h"
-#include "util/loading/resource_manager.h"
-#include "util/loading/resource_manager.h"
 
-CREATE_FACTORY(BspEntity, CL_BSP_ENTITY);
+#include "debug.h"
+#include "loading/resource_manager.h"
+
+#include "class_id_DEPRECATED.h"
+ObjectListDefinitionID(BspEntity, CL_BSP_ENTITY);
+CREATE_FACTORY(BspEntity);
 
 
@@ -51,4 +54,5 @@
 void BspEntity::init()
 {
+  this->registerObject(this, BspEntity::_objectList);
 
   this->bspManager = NULL;
@@ -67,7 +71,6 @@
 
   // Check wether file exists....
-  if ( File(ResourceManager::getFullName(name)).exists()  ) {
+  if ( File(Resources::ResourceManager::getInstance()->prependAbsoluteMainPath(name)).exists()  ) {
 
-    this->setClassID(CL_BSP_ENTITY, "BspEntity");
     this->bspManager = new BspManager(this);
 
Index: trunk/src/world_entities/bsp_entity.h
===================================================================
--- trunk/src/world_entities/bsp_entity.h	(revision 9656)
+++ trunk/src/world_entities/bsp_entity.h	(revision 9869)
@@ -18,5 +18,5 @@
 class BspEntity : public WorldEntity
 {
-
+  ObjectListDeclaration(BspEntity);
  public:
   BspEntity(const TiXmlElement* root = NULL);
@@ -28,5 +28,5 @@
 
   void init();
-  
+
   virtual void varChangeHandler( std::list<int> & id );
 
@@ -40,5 +40,5 @@
  private:
    BspManager* bspManager;
-   
+
    std::string name;                   //!< store name
    std::string name_write;             //!< temp variable to store name
Index: trunk/src/world_entities/camera.cc
===================================================================
--- trunk/src/world_entities/camera.cc	(revision 9656)
+++ trunk/src/world_entities/camera.cc	(revision 9869)
@@ -19,4 +19,6 @@
 #include "glincl.h"
 
+ObjectListDefinition(Camera);
+
 /**
  *  creates a Camera
@@ -24,5 +26,5 @@
 Camera::Camera()
 {
-  this->setClassID(CL_CAMERA, "Camera");
+  this->registerObject(this, Camera::_objectList);
   this->setName("camera");
   this->target = new CameraTarget();
@@ -221,8 +223,8 @@
 ///////////////////
 
-
+ObjectListDefinition(CameraTarget);
 CameraTarget::CameraTarget()
 {
-  this->setClassID(CL_CAMERA_TARGET, "CameraTarget");
+  this->registerObject(this, CameraTarget::_objectList);
   //  this->setParentMode(PNODE_MOVEMENT);
 }
Index: trunk/src/world_entities/camera.h
===================================================================
--- trunk/src/world_entities/camera.h	(revision 9656)
+++ trunk/src/world_entities/camera.h	(revision 9869)
@@ -22,4 +22,5 @@
 class Camera : public PNode, public EventListener
 {
+  ObjectListDeclaration(Camera);
 public:
   //! an enumerator for different types of view
@@ -84,4 +85,5 @@
 {
   friend class Camera;             //! The CameraTarget is a friend of Camera. noone else needs a CameraTarget, so noone else can create it.
+  ObjectListDeclaration(CameraTarget);
 
 private:
Index: trunk/src/world_entities/character_attributes.cc
===================================================================
--- trunk/src/world_entities/character_attributes.cc	(revision 9656)
+++ trunk/src/world_entities/character_attributes.cc	(revision 9869)
@@ -1,5 +1,5 @@
 
 
-/* 
+/*
    orxonox - the future of 3D-vertical-scrollers
 
@@ -18,7 +18,7 @@
 
 #include "character_attributes.h"
-#include "stdincl.h" 
-
-
+
+
+ObjectListDefinition(CharacterAttributes);
 
 
@@ -27,7 +27,7 @@
    @todo this constructor is not jet implemented - do it
 */
-CharacterAttributes::CharacterAttributes () 
-{
-   this->setClassID(CL_CHARACTER_ATTRIBUTES, "CharacterAttributes");
+CharacterAttributes::CharacterAttributes ()
+{
+  this->registerObject(this, CharacterAttributes::_objectList);
 }
 
@@ -37,5 +37,5 @@
 
 */
-CharacterAttributes::~CharacterAttributes () 
+CharacterAttributes::~CharacterAttributes ()
 {
 }
@@ -97,5 +97,5 @@
 
 /**
- *  sets maximum health 
+ *  sets maximum health
  * @param health
 
@@ -130,5 +130,5 @@
  *  adds shield strength
  * @param strength
-   
+
    there is currently no limit to shieldstrength
  */
@@ -290,5 +290,5 @@
 /*=====================energy=====================*/
 /**
- *  sets the amount of energy 
+ *  sets the amount of energy
  * @param energy
  */
@@ -332,5 +332,5 @@
 
 /**
- *  gets the amount of energy 
+ *  gets the amount of energy
  * @returns energy
  */
@@ -358,5 +358,5 @@
   return this->energyConsumption;
 }
-  
+
 
 /**
Index: trunk/src/world_entities/character_attributes.h
===================================================================
--- trunk/src/world_entities/character_attributes.h	(revision 9656)
+++ trunk/src/world_entities/character_attributes.h	(revision 9869)
@@ -15,4 +15,5 @@
 */
 class CharacterAttributes : public BaseObject {
+    ObjectListDeclaration(CharacterAttributes);
 
  public:
Index: trunk/src/world_entities/creatures/fps_player.cc
===================================================================
--- trunk/src/world_entities/creatures/fps_player.cc	(revision 9656)
+++ trunk/src/world_entities/creatures/fps_player.cc	(revision 9869)
@@ -32,5 +32,5 @@
 
 #include "aabb.h"
-
+#include "bsp_entity.h"
 
 #include "key_mapper.h"
@@ -41,13 +41,14 @@
 
 
-
-CREATE_FACTORY(FPSPlayer, CL_FPS_PLAYER);
+#include "class_id_DEPRECATED.h"
+ObjectListDefinitionID(FPSPlayer, CL_FPS_PLAYER);
+CREATE_FACTORY(FPSPlayer);
 
 #include "script_class.h"
-CREATE_SCRIPTABLE_CLASS(FPSPlayer, CL_FPS_PLAYER,
-                        addMethod("setAbsCoor", ExecutorLua3<PNode,float,float,float>(&PNode::setAbsCoor))
-                            ->addMethod("getAbsCoorX", ExecutorLua0ret<PNode, float>(&PNode::getAbsCoorX))
-                            ->addMethod("getAbsCoorY", ExecutorLua0ret<PNode, float>(&PNode::getAbsCoorY))
-                            ->addMethod("getAbsCoorZ", ExecutorLua0ret<PNode, float>(&PNode::getAbsCoorZ))
+CREATE_SCRIPTABLE_CLASS(FPSPlayer,
+			addMethod("setAbsCoor", Executor3<PNode, lua_State*,float,float,float>(&PNode::setAbsCoor))
+			    ->addMethod("getAbsCoorX", Executor0ret<PNode, lua_State*, float>(&PNode::getAbsCoorX))
+			    ->addMethod("getAbsCoorY", Executor0ret<PNode, lua_State*, float>(&PNode::getAbsCoorY))
+			    ->addMethod("getAbsCoorZ", Executor0ret<PNode, lua_State*, float>(&PNode::getAbsCoorZ))
                        );
 
@@ -85,5 +86,5 @@
 void FPSPlayer::init()
 {
-  this->setClassID(CL_FPS_PLAYER, "FPSPlayer");
+  this->registerObject(this, FPSPlayer::_objectList);
 
   this->bLeft = false;
@@ -166,5 +167,5 @@
 
     //subscribe to collision reaction
-  this->subscribeReaction(CREngine::CR_PHYSICS_FULL_WALK, CL_BSP_ENTITY);
+  this->subscribeReaction(CREngine::CR_PHYSICS_FULL_WALK, BspEntity::staticClassID());
 
   this->initWeapon = false;
Index: trunk/src/world_entities/creatures/fps_player.h
===================================================================
--- trunk/src/world_entities/creatures/fps_player.h	(revision 9656)
+++ trunk/src/world_entities/creatures/fps_player.h	(revision 9869)
@@ -16,4 +16,5 @@
 class FPSPlayer : public Playable
 {
+  ObjectListDeclaration(FPSPlayer);
 
   public:
Index: trunk/src/world_entities/creatures/md2_creature.cc
===================================================================
--- trunk/src/world_entities/creatures/md2_creature.cc	(revision 9656)
+++ trunk/src/world_entities/creatures/md2_creature.cc	(revision 9869)
@@ -22,5 +22,4 @@
 #include "objModel.h"
 #include "md2/md2Model.h"
-#include "util/loading/resource_manager.h"
 #include "state.h"
 
@@ -37,5 +36,7 @@
 #include "debug.h"
 
-CREATE_FACTORY(MD2Creature, CL_MD2_CREATURE);
+#include "class_id_DEPRECATED.h"
+ObjectListDefinitionID(MD2Creature, CL_MD2_CREATURE);
+CREATE_FACTORY(MD2Creature);
 
 /**
@@ -86,5 +87,5 @@
   PRINTF(4)("MD2CREATURE INIT\n");
   //  this->setRelDir(Quaternion(M_PI, Vector(1,0,0)));
-  this->setClassID(CL_MD2_CREATURE, "MD2Creature");
+  this->registerObject(this, MD2Creature::_objectList);
 
   this->toList(OM_GROUP_01);
@@ -95,5 +96,5 @@
   Weapon* wpLeft = new TestGun(1);
   wpLeft->setName("testGun Left");
-  Weapon* cannon = dynamic_cast<Weapon*>(Factory::fabricate(CL_CANNON));
+  Weapon* cannon = dynamic_cast<Weapon*>(Factory::fabricate("Cannon"));
 
   cannon->setName("BFG");
@@ -112,5 +113,5 @@
   this->cameraConnNode.addChild(State::getCameraNode());
   State::getCameraTargetNode()->setRelCoor(10,0,0);
- 
+
 
 
Index: trunk/src/world_entities/creatures/md2_creature.h
===================================================================
--- trunk/src/world_entities/creatures/md2_creature.h	(revision 9656)
+++ trunk/src/world_entities/creatures/md2_creature.h	(revision 9869)
@@ -16,4 +16,5 @@
 class MD2Creature : public Playable
 {
+  ObjectListDeclaration(MD2Creature);
 
   public:
Index: trunk/src/world_entities/effects/billboard.cc
===================================================================
--- trunk/src/world_entities/effects/billboard.cc	(revision 9656)
+++ trunk/src/world_entities/effects/billboard.cc	(revision 9869)
@@ -26,7 +26,7 @@
 
 
-
-CREATE_FACTORY(Billboard, CL_BILLBOARD);
-
+#include "class_id_DEPRECATED.h"
+ObjectListDefinitionID(Billboard, CL_BILLBOARD);
+CREATE_FACTORY(Billboard);
 
 /**
@@ -57,5 +57,5 @@
 void Billboard::init()
 {
-  this->setClassID(CL_BILLBOARD, "Billboard");
+  this->registerObject(this, Billboard::_objectList);
   this->setName("Billboard");
 
@@ -124,5 +124,5 @@
   glDisable(GL_LIGHTING);
   glDisable(GL_FOG);
-  
+
   glPushMatrix();
 
@@ -130,5 +130,5 @@
   //glTranslatef(0,0,0);
   this->material->select();
-  
+
   const PNode* camera = State::getCameraNode();  //!< @todo MUST be different
   Vector cameraPos = camera->getAbsCoor();
@@ -141,5 +141,5 @@
   h.normalize();
   v.normalize();
-  
+
   v *= sizeX;
   h *= sizeY;
@@ -165,8 +165,8 @@
              this->getAbsCoor().z - h.z + v.z);
   glEnd();
-  
-  
+
+
   glPopMatrix();
-  
+
   glPopAttrib();
 }
Index: trunk/src/world_entities/effects/billboard.h
===================================================================
--- trunk/src/world_entities/effects/billboard.h	(revision 9656)
+++ trunk/src/world_entities/effects/billboard.h	(revision 9869)
@@ -13,4 +13,5 @@
 class Billboard : public WorldEntity
 {
+  ObjectListDeclaration(Billboard);
   public:
     Billboard(const TiXmlElement* root = NULL);
Index: trunk/src/world_entities/effects/explosion.cc
===================================================================
--- trunk/src/world_entities/effects/explosion.cc	(revision 9656)
+++ trunk/src/world_entities/effects/explosion.cc	(revision 9869)
@@ -18,17 +18,16 @@
 #include "explosion.h"
 
-#include "fast_factory.h"
+#include "loading/fast_factory.h"
 
 #include "state.h"
-#include "class_list.h"
 
-#include "box_emitter.h"
-#include "sprite_particles.h"
+#include "particles/box_emitter.h"
+#include "particles/sprite_particles.h"
 
 
 
-
-CREATE_FAST_FACTORY_STATIC(Explosion, CL_EXPLOSION);
-
+#include "class_id_DEPRECATED.h"
+ObjectListDefinitionID(Explosion, CL_EXPLOSION);
+CREATE_FAST_FACTORY_STATIC(Explosion);
 
 /**
@@ -37,5 +36,5 @@
 Explosion::Explosion ()
 {
-  this->setClassID(CL_EXPLOSION, "Explosion");
+  this->registerObject(this, Explosion::_objectList);
   this->toList(OM_DEAD_TICK);
 
@@ -59,5 +58,5 @@
 
   /* this is normaly done by World.cc by deleting the ParticleEngine */
-  if (Explosion::explosionParticles != NULL && ClassList::getList(CL_EXPLOSION)->size() <= 1)
+  if (Explosion::explosionParticles != NULL && Explosion::objectList().size() <= 1)
      Explosion::explosionParticles = NULL;
 }
Index: trunk/src/world_entities/effects/explosion.h
===================================================================
--- trunk/src/world_entities/effects/explosion.h	(revision 9656)
+++ trunk/src/world_entities/effects/explosion.h	(revision 9869)
@@ -15,4 +15,5 @@
 class Explosion : public WorldEntity
 {
+  ObjectListDeclaration(Explosion);
   public:
     static void explode (PNode* position, const Vector& size);
Index: trunk/src/world_entities/effects/lightning_bolt.cc
===================================================================
--- trunk/src/world_entities/effects/lightning_bolt.cc	(revision 9656)
+++ trunk/src/world_entities/effects/lightning_bolt.cc	(revision 9869)
@@ -20,12 +20,12 @@
 #include "material.h"
 
-#include "util/loading/resource_manager.h"
+#include "sound/resource_sound_buffer.h"
 
 
 
 
-
-CREATE_FACTORY(LightningBolt, CL_LIGHTNING_BOLT);
-
+#include "class_id_DEPRECATED.h"
+ObjectListDefinitionID(LightningBolt, CL_LIGHTNING_BOLT);
+CREATE_FACTORY(LightningBolt);
 
 /**
@@ -34,5 +34,5 @@
 LightningBolt::LightningBolt (const TiXmlElement* root)
 {
-  this->setClassID(CL_LIGHTNING_BOLT, "LightningBolt");
+  this->registerObject(this, LightningBolt::_objectList);
 
   this->toList(OM_COMMON);
@@ -56,13 +56,7 @@
   this->seedTime = 4.0f;
 
-  this->soundSource = NULL;
-  this->thunderBuffer = NULL;
-
   this->soundSource.setSourceNode(this);
 
-  //load sound
-  if (this->thunderBuffer != NULL)
-    ResourceManager::getInstance()->unload(this->thunderBuffer);
-  this->thunderBuffer = (OrxSound::SoundBuffer*)ResourceManager::getInstance()->load("sound/atmosphere/thunder.wav", WAV);
+  this->thunderBuffer = OrxSound::ResourceSoundBuffer("sound/atmosphere/thunder.wav");
 }
 
Index: trunk/src/world_entities/effects/lightning_bolt.h
===================================================================
--- trunk/src/world_entities/effects/lightning_bolt.h	(revision 9656)
+++ trunk/src/world_entities/effects/lightning_bolt.h	(revision 9869)
@@ -2,8 +2,8 @@
  * @file lightning_bolt.h
  * @brief a LightningBolt Projectile
- *  Der Effekt soll folgendermaßen funktionieren:
+ *  Der Effekt soll folgenderma�n funktionieren:
  * -> Ein Partikel mit einer Blitz-Textur soll sehr schnell erscheinen,
- * -> während er an Intensität zunimmt soll die Beleuchtung der gerenderten Szene entsprechend zunehmen.
- * -> Je mehr Blitze zum gleichen Zeitpunkt sichtbar sind, desto heller soll die Beleuchtung werden, das heißt die Helligkeitszunahme pro Blitz soll Additiv sein.
+ * -> w�rend er an Intensit� zunimmt soll die Beleuchtung der gerenderten Szene entsprechend zunehmen.
+ * -> Je mehr Blitze zum gleichen Zeitpunkt sichtbar sind, desto heller soll die Beleuchtung werden, das hei� die Helligkeitszunahme pro Blitz soll Additiv sein.
  * -> Ein Partikel soll ebenfalls sehr schnell wieder verblassen, dabei soll die Beleuchtung entsprechend der vorhergehenden Zunahme wieder abnehmen (Additiv)
  */
@@ -21,4 +21,5 @@
 class LightningBolt : public WorldEntity
 {
+  ObjectListDeclaration(LightningBolt);
   public:
     LightningBolt(const TiXmlElement* root = NULL);
@@ -51,5 +52,5 @@
 
     OrxSound::SoundSource    soundSource;
-    OrxSound::SoundBuffer*   thunderBuffer;
+    OrxSound::SoundBuffer    thunderBuffer;
 };
 
Index: trunk/src/world_entities/elements/image_entity.cc
===================================================================
--- trunk/src/world_entities/elements/image_entity.cc	(revision 9656)
+++ trunk/src/world_entities/elements/image_entity.cc	(revision 9869)
@@ -30,5 +30,7 @@
 
 
-CREATE_FACTORY(ImageEntity, CL_IMAGE_ENTITY);
+#include "class_id_DEPRECATED.h"
+ObjectListDefinitionID(ImageEntity, CL_IMAGE_ENTITY);
+CREATE_FACTORY(ImageEntity);
 
 
@@ -59,5 +61,5 @@
 void ImageEntity::init()
 {
-  this->setClassID(CL_IMAGE_ENTITY, "ImageEntity");
+  this->registerObject(this, ImageEntity::_objectList);
   this->setName("ImageEntity");
 
Index: trunk/src/world_entities/elements/image_entity.h
===================================================================
--- trunk/src/world_entities/elements/image_entity.h	(revision 9656)
+++ trunk/src/world_entities/elements/image_entity.h	(revision 9869)
@@ -21,4 +21,5 @@
 //! A class that enables the
 class ImageEntity : public PNode, public Element2D {
+  ObjectListDeclaration(ImageEntity);
 
  public:
Index: trunk/src/world_entities/elements/text_element.cc
===================================================================
--- trunk/src/world_entities/elements/text_element.cc	(revision 9656)
+++ trunk/src/world_entities/elements/text_element.cc	(revision 9869)
@@ -27,6 +27,7 @@
 
 
-
-CREATE_FACTORY(TextElement, CL_TEXT_ELEMENT);
+#include "class_id_DEPRECATED.h"
+ObjectListDefinitionID(TextElement, CL_TEXT_ELEMENT);
+CREATE_FACTORY(TextElement);
 
 
@@ -36,5 +37,5 @@
 TextElement::TextElement (const TiXmlElement* root)
 {
-  this->setClassID(CL_TEXT_ELEMENT, "TextElement");
+  this->registerObject(this, TextElement::_objectList);
   this->setName("TextElement");
 
Index: trunk/src/world_entities/elements/text_element.h
===================================================================
--- trunk/src/world_entities/elements/text_element.h	(revision 9656)
+++ trunk/src/world_entities/elements/text_element.h	(revision 9869)
@@ -21,4 +21,5 @@
 //! A class that enables the
 class TextElement : public Text {
+  ObjectListDeclaration(TextElement);
 
  public:
Index: trunk/src/world_entities/environment.cc
===================================================================
--- trunk/src/world_entities/environment.cc	(revision 9656)
+++ trunk/src/world_entities/environment.cc	(revision 9869)
@@ -20,13 +20,11 @@
 #include "environment.h"
 
-#include "util/loading/resource_manager.h"
-
-#include "vector.h"
 #include "objModel.h"
 #include "obb_tree.h"
 #include "util/loading/factory.h"
 
-
-CREATE_FACTORY(Environment, CL_ENVIRONMENT);
+#include "class_id_DEPRECATED.h"
+ObjectListDefinitionID(Environment, CL_ENVIRONMENT);
+CREATE_FACTORY(Environment);
 
 /**
@@ -63,5 +61,5 @@
 void Environment::init()
 {
-  this->setClassID(CL_ENVIRONMENT, "Environment");
+  this->registerObject(this, Environment::_objectList);
   this->toList(OM_ENVIRON);
 }
Index: trunk/src/world_entities/environment.h
===================================================================
--- trunk/src/world_entities/environment.h	(revision 9656)
+++ trunk/src/world_entities/environment.h	(revision 9869)
@@ -16,5 +16,5 @@
 class Environment : public WorldEntity
 {
-  friend class World;
+  ObjectListDeclaration(Environment);
 
  public:
Index: trunk/src/world_entities/environments/building.cc
===================================================================
--- trunk/src/world_entities/environments/building.cc	(revision 9656)
+++ trunk/src/world_entities/environments/building.cc	(revision 9869)
@@ -23,6 +23,7 @@
 
 
-
-CREATE_FACTORY(Building, CL_BUILDING);
+#include "class_id_DEPRECATED.h"
+ObjectListDefinitionID(Building, CL_BUILDING);
+CREATE_FACTORY(Building);
 
 /**
@@ -31,5 +32,5 @@
 Building::Building(const TiXmlElement* root)
 {
-  this->setClassID(CL_BUILDING, "Building");
+  this->registerObject(this, Building::_objectList);
   this->toList(OM_ENVIRON_NOTICK);
 
Index: trunk/src/world_entities/environments/building.h
===================================================================
--- trunk/src/world_entities/environments/building.h	(revision 9656)
+++ trunk/src/world_entities/environments/building.h	(revision 9869)
@@ -15,5 +15,6 @@
 class Building : public WorldEntity
 {
- public:
+  ObjectListDeclaration(Building);
+  public:
   Building(const TiXmlElement* root);
 
Index: trunk/src/world_entities/environments/mapped_water.cc
===================================================================
--- trunk/src/world_entities/environments/mapped_water.cc	(revision 9656)
+++ trunk/src/world_entities/environments/mapped_water.cc	(revision 9869)
@@ -17,5 +17,4 @@
 #include "util/loading/load_param.h"
 #include "util/loading/factory.h"
-#include "util/loading/resource_manager.h"
 #include "state.h"
 #include "t_animation.h"
@@ -25,18 +24,22 @@
 #include "script_class.h"
 
-CREATE_FACTORY(MappedWater, CL_MAPPED_WATER);
+#include "resource_shader.h"
+
+#include "class_id_DEPRECATED.h"
+ObjectListDefinitionID(MappedWater, CL_MAPPED_WATER);
+CREATE_FACTORY(MappedWater);
 
 SHELL_COMMAND(gui, MappedWater, toggleGui);
 SHELL_COMMAND(output, MappedWater, saveParams);
 
-CREATE_SCRIPTABLE_CLASS(MappedWater, CL_MAPPED_WATER,
-                        addMethod("waterUV", ExecutorLua2<MappedWater, float, float>(&MappedWater::fadeWaterUV))
-                      ->addMethod("waterFlow", ExecutorLua2<MappedWater, float, float>(&MappedWater::fadeWaterFlow))
-                      ->addMethod("shineSize", ExecutorLua2<MappedWater, float, float>(&MappedWater::fadeShineSize))
-                      ->addMethod("shineStrength", ExecutorLua2<MappedWater, float, float>(&MappedWater::fadeShineStrength))
-                      ->addMethod("reflStrength", ExecutorLua2<MappedWater, float, float>(&MappedWater::fadeReflStrength))
-                      ->addMethod("refraction", ExecutorLua2<MappedWater, float, float>(&MappedWater::fadeRefraction))
-                      ->addMethod("waterHeight", ExecutorLua2<MappedWater, float, float>(&MappedWater::fadeWaterHeight))
-                      ->addMethod("waterColor", ExecutorLua4<MappedWater, float, float, float, float>(&MappedWater::fadeWaterColor)));
+CREATE_SCRIPTABLE_CLASS(MappedWater,
+                        addMethod("waterUV", Executor2<MappedWater, lua_State*, float, float>(&MappedWater::fadeWaterUV))
+                        ->addMethod("waterFlow", Executor2<MappedWater, lua_State*, float, float>(&MappedWater::fadeWaterFlow))
+                        ->addMethod("shineSize", Executor2<MappedWater, lua_State*, float, float>(&MappedWater::fadeShineSize))
+                        ->addMethod("shineStrength", Executor2<MappedWater, lua_State*, float, float>(&MappedWater::fadeShineStrength))
+                        ->addMethod("reflStrength", Executor2<MappedWater, lua_State*, float, float>(&MappedWater::fadeReflStrength))
+                        ->addMethod("refraction", Executor2<MappedWater, lua_State*, float, float>(&MappedWater::fadeRefraction))
+                        ->addMethod("waterHeight", Executor2<MappedWater, lua_State*, float, float>(&MappedWater::fadeWaterHeight))
+                        ->addMethod("waterColor", Executor4<MappedWater, lua_State*, float, float, float, float>(&MappedWater::fadeWaterColor)));
 
 
@@ -47,5 +50,5 @@
 MappedWater::MappedWater(const TiXmlElement* root)
 {
-  this->setClassID(CL_MAPPED_WATER, "MappedWater");
+  this->registerObject(this, MappedWater::_objectList);
   this->toList(OM_ENVIRON);
 
@@ -75,5 +78,4 @@
 MappedWater::~MappedWater()
 {
-  delete shader;
   delete cam_uni;
   delete color_uni;
@@ -163,7 +165,7 @@
 {
   // load shader files
-  shader = new Shader( ResourceManager::getInstance()->getDataDir() + "/shaders/mapped_water.vert", ResourceManager::getInstance()->getDataDir() +"/shaders/mapped_water.frag");
-
-  this->shader->activateShader();
+  shader = ResourceShader( "/shaders/mapped_water.vert", "/shaders/mapped_water.frag");
+
+  this->shader.activateShader();
   // Set the variable "reflection" to correspond to the first texture unit
   Shader::Uniform(shader, "reflection").set(0);
@@ -197,5 +199,5 @@
   cam_uni = new Shader::Uniform(shader, "cameraPos");
 
-  this->shader->deactivateShader();
+  this->shader.deactivateShader();
 }
 
@@ -223,5 +225,5 @@
 void MappedWater::resetWaterColor(float r, float g, float b)
 {
-  this->shader->activateShader();
+  this->shader.activateShader();
   this->waterColor = Vector(r, g, b);
 
@@ -229,5 +231,5 @@
   color_uni->set(waterColor.x, waterColor.y, waterColor.z, 1.0f);
 
-  this->shader->deactivateShader();
+  this->shader.deactivateShader();
 }
 
@@ -238,5 +240,5 @@
 void MappedWater::resetShineSize(float shine)
 {
-  this->shader->activateShader();
+  this->shader.activateShader();
   this->shineSize = shine;
 
@@ -244,5 +246,5 @@
   shineSize_uni->set(this->shineSize);
 
-  this->shader->deactivateShader();
+  this->shader.deactivateShader();
 }
 
@@ -253,5 +255,5 @@
 void MappedWater::resetShineStrength(float strength)
 {
-  this->shader->activateShader();
+  this->shader.activateShader();
   this->shineStrength = strength;
 
@@ -259,5 +261,5 @@
   shineStrength_uni->set(this->shineStrength);
 
-  this->shader->deactivateShader();
+  this->shader.deactivateShader();
 }
 
@@ -268,5 +270,5 @@
 void MappedWater::resetReflStrength(float strength)
 {
-  this->shader->activateShader();
+  this->shader.activateShader();
   this->reflStrength = strength;
 
@@ -274,5 +276,5 @@
   reflStrength_uni->set(this->reflStrength);
 
-  this->shader->deactivateShader();
+  this->shader.deactivateShader();
 }
 
@@ -283,5 +285,5 @@
 void MappedWater::resetRefraction(float refraction)
 {
-  this->shader->activateShader();
+  this->shader.activateShader();
   this->refraction = refraction;
 
@@ -289,5 +291,5 @@
   refr_uni->set(this->refraction);
 
-  this->shader->deactivateShader();
+  this->shader.deactivateShader();
 }
 
@@ -300,5 +302,5 @@
 void MappedWater::resetLightPos(float x, float y, float z)
 {
-  this->shader->activateShader();
+  this->shader.activateShader();
   this->lightPos = Vector(x, y, z);
 
@@ -306,5 +308,5 @@
   light_uni->set(lightPos.x, lightPos.y, lightPos.z, 1.0f);
 
-  this->shader->deactivateShader();
+  this->shader.deactivateShader();
 }
 
@@ -554,5 +556,5 @@
   mat.select();
 
-  this->shader->activateShader();
+  this->shader.activateShader();
 
   // reset the camera uniform to the current cam position
@@ -593,5 +595,5 @@
   glEnd();
 
-  this->shader->deactivateShader();
+  this->shader.deactivateShader();
 
   mat.unselect();
Index: trunk/src/world_entities/environments/mapped_water.h
===================================================================
--- trunk/src/world_entities/environments/mapped_water.h	(revision 9656)
+++ trunk/src/world_entities/environments/mapped_water.h	(revision 9869)
@@ -35,4 +35,5 @@
 class MappedWater : public WorldEntity
 {
+  ObjectListDeclaration(MappedWater);
 public:
   MappedWater(const TiXmlElement* root = NULL);
@@ -106,5 +107,5 @@
 private:
   Material                  mat;
-  Shader*                   shader;
+  Shader                    shader;
   OrxGui::GLGuiBox*         box;
 
Index: trunk/src/world_entities/environments/model_entity.cc
===================================================================
--- trunk/src/world_entities/environments/model_entity.cc	(revision 9656)
+++ trunk/src/world_entities/environments/model_entity.cc	(revision 9869)
@@ -23,6 +23,7 @@
 
 
-
-CREATE_FACTORY(ModelEntity, CL_MODEL_ENTITY);
+#include "class_id_DEPRECATED.h"
+ObjectListDefinitionID(ModelEntity, CL_MODEL_ENTITY);
+CREATE_FACTORY(ModelEntity);
 
 /**
@@ -31,5 +32,5 @@
 ModelEntity::ModelEntity(const TiXmlElement* root)
 {
-  this->setClassID(CL_MODEL_ENTITY, "ModelEntity");
+  this->registerObject(this, ModelEntity::_objectList);
   this->toList(OM_ENVIRON);
 
Index: trunk/src/world_entities/environments/model_entity.h
===================================================================
--- trunk/src/world_entities/environments/model_entity.h	(revision 9656)
+++ trunk/src/world_entities/environments/model_entity.h	(revision 9869)
@@ -15,4 +15,5 @@
 class ModelEntity : public WorldEntity
 {
+  ObjectListDeclaration(ModelEntity);
  public:
   ModelEntity(const TiXmlElement* root);
Index: trunk/src/world_entities/environments/water.cc
===================================================================
--- trunk/src/world_entities/environments/water.cc	(revision 9656)
+++ trunk/src/world_entities/environments/water.cc	(revision 9869)
@@ -23,6 +23,5 @@
 #include "material.h"
 
-#include "util/loading/resource_manager.h"
-#include "shader.h"
+#include "resource_shader.h"
 
 #include "skybox.h"
@@ -33,11 +32,12 @@
 
 
-
-CREATE_FACTORY(Water, CL_WATER);
+#include "class_id_DEPRECATED.h"
+ObjectListDefinitionID(Water, CL_WATER);
+CREATE_FACTORY(Water);
 
 
 Water::Water(const TiXmlElement* root)
 {
-  this->setClassID(CL_WATER, "Water");
+  this->registerObject(this, Water::_objectList);
   this->toList(OM_ENVIRON);
 
@@ -55,5 +55,5 @@
 
   this->rebuildGrid();
-  this->waterShader = (Shader*)ResourceManager::getInstance()->load("shaders/water.vert", SHADER, RP_GAME, "shaders/water.frag");
+  this->waterShader = ResourceShader("shaders/water.vert", "shaders/water.frag");
 
   // To test the Wave equation
@@ -217,5 +217,5 @@
 void Water::tick(float dt)
 {
-  ObjectManager::EntityList entityList = State::getObjectManager()->getObjectList(OM_GROUP_01_PROJ);
+  ObjectManager::EntityList entityList = State::getObjectManager()->getEntityList(OM_GROUP_01_PROJ);
   ObjectManager::EntityList::iterator entity = entityList.begin();
   while (entity != entityList.end())
Index: trunk/src/world_entities/environments/water.h
===================================================================
--- trunk/src/world_entities/environments/water.h	(revision 9656)
+++ trunk/src/world_entities/environments/water.h	(revision 9869)
@@ -13,14 +13,14 @@
 #include "world_entity.h"
 #include "material.h"
-
+#include "shader.h"
 
 /* FORWARD DECLARATION */
 class Grid;
-class Shader;
 
 //! A Class to handle a WaterEffects
 class Water : public WorldEntity
 {
- public:
+  ObjectListDeclaration(Water);
+  public:
    Water(const TiXmlElement* root = NULL);
    virtual ~Water();
@@ -38,5 +38,5 @@
    void draw() const;
    void tick(float dt);
-   
+
    virtual void varChangeHandler( std::list<int> & id );
 
@@ -51,6 +51,6 @@
 
     Material        waterMaterial;
-    Shader*         waterShader;
-    
+    Shader          waterShader;
+
     float           height;          //!< The hight of the Water
     int             height_handle;   //!< Handle to notify about changes of height
Index: trunk/src/world_entities/extendable.cc
===================================================================
--- trunk/src/world_entities/extendable.cc	(revision 9869)
+++ trunk/src/world_entities/extendable.cc	(revision 9869)
@@ -0,0 +1,3 @@
+#include "extendable.h"
+
+ObjectListDefinition(Extendable);
Index: trunk/src/world_entities/extendable.h
===================================================================
--- trunk/src/world_entities/extendable.h	(revision 9656)
+++ trunk/src/world_entities/extendable.h	(revision 9869)
@@ -1,5 +1,5 @@
 /*!
- * @file proto_class.h
- * @brief Interface for Worldentities that can picku up powerups.
+ * @file extendable.h
+ * @brief Interface for Worldentities that can pick up powerups.
 */
 
@@ -12,18 +12,15 @@
 class PowerUp;
 
+
 #include "power_ups/power_up.h"
-
-//! A class for ...
+//! A class for Extendable Entities
 class Extendable : virtual public BaseObject {
+  ObjectListDeclaration(Extendable);
 
   public:
-   //   virtual ~Extendable();
    virtual bool pickup(PowerUp* powerUp) { return false; };
 
   protected:
-    Extendable() { this->setClassID(CL_EXTENDABLE, "Extendable"); };
-
-  private:
-
+    Extendable() { this->registerObject(this, Extendable::_objectList); };
 };
 
Index: trunk/src/world_entities/movie_entity.cc
===================================================================
--- trunk/src/world_entities/movie_entity.cc	(revision 9656)
+++ trunk/src/world_entities/movie_entity.cc	(revision 9869)
@@ -21,6 +21,7 @@
 
 
-
-CREATE_FACTORY(MovieEntity, CL_MOVIE_ENTITY);
+#include "class_id_DEPRECATED.h"
+ObjectListDefinitionID(MovieEntity, CL_MOVIE_ENTITY);
+CREATE_FACTORY(MovieEntity);
 
 /**
@@ -29,5 +30,5 @@
 MovieEntity::MovieEntity (const TiXmlElement* root)
 {
-  this->setClassID(CL_MOVIE_ENTITY, "MovieEntity");
+  this->registerObject(this, MovieEntity::_objectList);
 
   media_container = new MediaContainer();
Index: trunk/src/world_entities/movie_entity.h
===================================================================
--- trunk/src/world_entities/movie_entity.h	(revision 9656)
+++ trunk/src/world_entities/movie_entity.h	(revision 9869)
@@ -14,4 +14,5 @@
 class MovieEntity : public WorldEntity
 {
+  ObjectListDeclaration(MovieEntity);
   private:
     MediaContainer* media_container;
Index: trunk/src/world_entities/npcs/attractor_mine.cc
===================================================================
--- trunk/src/world_entities/npcs/attractor_mine.cc	(revision 9656)
+++ trunk/src/world_entities/npcs/attractor_mine.cc	(revision 9869)
@@ -33,13 +33,15 @@
 #include "effects/explosion.h"
 
-CREATE_FACTORY(AttractorMine, CL_ATTRACTOR_MINE);
+#include "class_id_DEPRECATED.h"
+ObjectListDefinitionID(AttractorMine, CL_ATTRACTOR_MINE);
+CREATE_FACTORY(AttractorMine);
 #include "script_class.h"
-CREATE_SCRIPTABLE_CLASS(AttractorMine, CL_ATTRACTOR_MINE,
-                        addMethod("setName", ExecutorLua1<BaseObject,const std::string&>(&BaseObject::setName))
-                       //Coordinates
-                        ->addMethod("setAbsCoor", ExecutorLua3<PNode,float,float,float>(&PNode::setAbsCoor))
-                        ->addMethod("getAbsCoorX", ExecutorLua0ret<PNode, float>(&PNode::getAbsCoorX))
-                        ->addMethod("getAbsCoorY", ExecutorLua0ret<PNode, float>(&PNode::getAbsCoorY))
-                        ->addMethod("getAbsCoorZ", ExecutorLua0ret<PNode, float>(&PNode::getAbsCoorZ))
+CREATE_SCRIPTABLE_CLASS(AttractorMine,
+                        addMethod("setName", Executor1<BaseObject, lua_State*,const std::string&>(&BaseObject::setName))
+                        //Coordinates
+                        ->addMethod("setAbsCoor", Executor3<PNode, lua_State*,float,float,float>(&PNode::setAbsCoor))
+                        ->addMethod("getAbsCoorX", Executor0ret<PNode, lua_State*, float>(&PNode::getAbsCoorX))
+                        ->addMethod("getAbsCoorY", Executor0ret<PNode, lua_State*, float>(&PNode::getAbsCoorY))
+                        ->addMethod("getAbsCoorZ", Executor0ret<PNode, lua_State*, float>(&PNode::getAbsCoorZ))
                        );
 
@@ -50,5 +52,5 @@
     : NPC(NULL)
 {
-  this->setClassID(CL_ATTRACTOR_MINE, "AttractorMine");
+  this->registerObject(this, AttractorMine::_objectList);
 
   this->toList(OM_GROUP_02);
@@ -64,6 +66,6 @@
 
   this->shader = NULL;
-  if (likely(Shader::checkShaderAbility()))
-    this->shader = Shader::getShader("shaders/toon.vert", "shaders/toon.frag");
+  //if (likely(Shader::checkShaderAbility()))
+//    this->shader = Shader::getShader("shaders/toon.vert", "shaders/toon.frag");
 
   this->randomRotAxis = VECTOR_RAND(1);
@@ -76,8 +78,5 @@
 AttractorMine::~AttractorMine ()
 {
-  if (this->shader)
-    Shader::unload(this->shader);
 }
-
 
 void AttractorMine::loadParams(const TiXmlElement* root)
Index: trunk/src/world_entities/npcs/attractor_mine.h
===================================================================
--- trunk/src/world_entities/npcs/attractor_mine.h	(revision 9656)
+++ trunk/src/world_entities/npcs/attractor_mine.h	(revision 9869)
@@ -9,4 +9,5 @@
 
 class AttractorMine : public NPC {
+  ObjectListDeclaration(AttractorMine);
 
  public:
Index: trunk/src/world_entities/npcs/door.cc
===================================================================
--- trunk/src/world_entities/npcs/door.cc	(revision 9656)
+++ trunk/src/world_entities/npcs/door.cc	(revision 9869)
@@ -25,11 +25,8 @@
 
 #include "door.h"
-#include "class_list.h"
 
-
-
-
-
-CREATE_FACTORY(Door, CL_DOOR);
+#include "class_id_DEPRECATED.h"
+ObjectListDefinitionID(Door, CL_DOOR);
+CREATE_FACTORY(Door);
 
 
@@ -47,6 +44,5 @@
 Door::Door(const TiXmlElement* root)
 {
-
-  this->setClassID(CL_DOOR, "Door");
+  this->registerObject(this, Door::_objectList);
   this->scale = 1.0f;
   this->actionRadius = 1.0;
@@ -152,5 +148,6 @@
 
 
-
+#include "playable.h"
+#include "generic_npc.h"
 /**
  * checks if the door is open
@@ -159,16 +156,13 @@
 {
 
-  std::list<BaseObject*>::const_iterator it;
-  const std::list<BaseObject*>* list = ClassList::getList(CL_PLAYABLE);
   WorldEntity* entity;
   float distance;
 
-  if( list == NULL)
-    return false;
-
+  for (ObjectList<Playable>::const_iterator it = Playable::objectList().begin();
+       it != Playable::objectList().end();
+       ++it)
   // for all players
-  for( it = list->begin(); it != list->end(); it++)
   {
-    entity = dynamic_cast<WorldEntity*>(*it);
+    entity = (*it);
 
     distance = fabs((this->getAbsCoor() - entity->getAbsCoor()).len());
@@ -178,10 +172,10 @@
 
 
-  list = ClassList::getList(CL_GENERIC_NPC);
-  if( list == NULL)
-    return false;
-  for( it = list->begin(); it != list->end(); it++)
+
+  for (ObjectList<GenericNPC>::const_iterator it = GenericNPC::objectList().begin();
+       it != GenericNPC::objectList().end();
+       ++it)
   {
-    entity = dynamic_cast<WorldEntity*>(*it);
+    entity = (*it);
 
     distance = fabs((this->getAbsCoor() - entity->getAbsCoor()).len());
Index: trunk/src/world_entities/npcs/door.h
===================================================================
--- trunk/src/world_entities/npcs/door.h	(revision 9656)
+++ trunk/src/world_entities/npcs/door.h	(revision 9869)
@@ -21,4 +21,6 @@
 class Door : public WorldEntity
 {
+  ObjectListDeclaration(Door);
+
   public:
     Door(const TiXmlElement* root = NULL);
Index: trunk/src/world_entities/npcs/gate.cc
===================================================================
--- trunk/src/world_entities/npcs/gate.cc	(revision 9656)
+++ trunk/src/world_entities/npcs/gate.cc	(revision 9869)
@@ -25,6 +25,4 @@
 
 #include "gate.h"
-#include "class_list.h"
-
 #include "effects/explosion.h"
 
@@ -33,18 +31,20 @@
 
 
-
-CREATE_FACTORY(Gate, CL_GATE);
+#include "class_id_DEPRECATED.h"
+ObjectListDefinitionID(Gate, CL_GATE);
+CREATE_FACTORY(Gate);
 
 
 #include "script_class.h"
-CREATE_SCRIPTABLE_CLASS(Gate, CL_GATE,
-                            addMethod("hide", ExecutorLua0<WorldEntity>(&WorldEntity::hide))
-                            ->addMethod("unhide", ExecutorLua0<WorldEntity>(&WorldEntity::unhide))
-                            ->addMethod("destroy", ExecutorLua0<Gate>(&Gate::destroy))    
-                            ->addMethod("setAbsCoor", ExecutorLua3<PNode,float,float,float>(&PNode::setAbsCoor))
-                            ->addMethod("getAbsCoorX", ExecutorLua0ret<PNode, float>(&PNode::getAbsCoorX))
-                            ->addMethod("getAbsCoorY", ExecutorLua0ret<PNode, float>(&PNode::getAbsCoorY))
-                            ->addMethod("getAbsCoorZ", ExecutorLua0ret<PNode, float>(&PNode::getAbsCoorZ))
+CREATE_SCRIPTABLE_CLASS(Gate,
+			addMethod("hide", Executor0<WorldEntity, lua_State*>(&WorldEntity::hide))
+			    ->addMethod("unhide", Executor0<WorldEntity, lua_State*>(&WorldEntity::unhide))
+			    ->addMethod("destroy", Executor0<Gate, lua_State*>(&Gate::destroy))
+			    ->addMethod("setAbsCoor", Executor3<PNode, lua_State*,float,float,float>(&PNode::setAbsCoor))
+			    ->addMethod("getAbsCoorX", Executor0ret<PNode, lua_State*, float>(&PNode::getAbsCoorX))
+			    ->addMethod("getAbsCoorY", Executor0ret<PNode, lua_State*, float>(&PNode::getAbsCoorY))
+			    ->addMethod("getAbsCoorZ", Executor0ret<PNode, lua_State*, float>(&PNode::getAbsCoorZ))
                        );
+
 
 
@@ -62,6 +62,5 @@
 Gate::Gate(const TiXmlElement* root)
 {
-
-  this->setClassID(CL_GATE, "Gate");
+  this->registerObject(this, Gate::_objectList);
   this->scale = 1.0f;
   this->actionRadius = 1.0;
@@ -165,8 +164,8 @@
 void Gate::close()
 {
-  
+
   if( this->destroyed)
     return;
-  
+
   this->setAnimation(GATE_CLOSE, MD2_ANIM_ONCE);
   this->bOpen = false;
@@ -178,13 +177,15 @@
   if( this->destroyed)
     return;
-  
+
   this->setAnimation(GATE_DIE, MD2_ANIM_ONCE);
 
   Explosion::explode(this, Vector(this->getScaling()/160,this->getScaling()/160,this->getScaling()/160));
-  
-  
+
+
   this->destroyed = true;
 }
 
+#include "playable.h"
+#include "generic_npc.h"
 
 /**
@@ -195,15 +196,13 @@
 
   std::list<BaseObject*>::const_iterator it;
-  const std::list<BaseObject*>* list = ClassList::getList(CL_PLAYABLE);
   WorldEntity* entity;
   float distance;
 
-  if( list == NULL)
-    return false;
-
   // for all players
-  for( it = list->begin(); it != list->end(); it++)
-  {
-    entity = dynamic_cast<WorldEntity*>(*it);
+  for (ObjectList<Playable>::const_iterator it = Playable::objectList().begin();
+       it != Playable::objectList().end();
+       ++it)
+  {
+    entity = (*it);
 
     distance = fabs((this->getAbsCoor() - entity->getAbsCoor()).len());
@@ -213,10 +212,9 @@
 
 
-  list = ClassList::getList(CL_GENERIC_NPC);
-  if( list == NULL)
-    return false;
-  for( it = list->begin(); it != list->end(); it++)
-  {
-    entity = dynamic_cast<WorldEntity*>(*it);
+  for (ObjectList<GenericNPC>::const_iterator it = GenericNPC::objectList().begin();
+       it != GenericNPC::objectList().end();
+       ++it)
+  {
+    entity = (*it);
 
     distance = fabs((this->getAbsCoor() - entity->getAbsCoor()).len());
Index: trunk/src/world_entities/npcs/gate.h
===================================================================
--- trunk/src/world_entities/npcs/gate.h	(revision 9656)
+++ trunk/src/world_entities/npcs/gate.h	(revision 9869)
@@ -22,4 +22,6 @@
 class Gate : public WorldEntity
 {
+  ObjectListDeclaration(Gate);
+
   public:
     Gate(const TiXmlElement* root = NULL);
Index: trunk/src/world_entities/npcs/generic_npc.cc
===================================================================
--- trunk/src/world_entities/npcs/generic_npc.cc	(revision 9656)
+++ trunk/src/world_entities/npcs/generic_npc.cc	(revision 9869)
@@ -27,29 +27,33 @@
 
 #include "sound_buffer.h"
-
-#include "loading/resource_manager.h"
-
-
-CREATE_FACTORY(GenericNPC, CL_GENERIC_NPC);
+#include "resource_sound_buffer.h"
+
+#include "sound/resource_sound_buffer.h"
+
+#include "bsp_entity.h"
+
+#include "class_id_DEPRECATED.h"
+ObjectListDefinitionID(GenericNPC, CL_GENERIC_NPC);
+CREATE_FACTORY(GenericNPC);
 
 #include "script_class.h"
-CREATE_SCRIPTABLE_CLASS(GenericNPC, CL_GENERIC_NPC,
+CREATE_SCRIPTABLE_CLASS(GenericNPC,
                         // Move
-                        addMethod("walkTo", ExecutorLua3<GenericNPC,float,float,float>(&GenericNPC::walkTo))
-                        ->addMethod("runTo", ExecutorLua3<GenericNPC,float,float,float>(&GenericNPC::runTo))
-                        ->addMethod("turnTo", ExecutorLua1<GenericNPC,float>(&GenericNPC::turnTo))
-                        ->addMethod("finalGoalReached", ExecutorLua0ret<GenericNPC,bool>(&GenericNPC::finalGoalReached))
-                        ->addMethod("stop", ExecutorLua0<GenericNPC>(&GenericNPC::stop))
-                        ->addMethod("resume", ExecutorLua0<GenericNPC>(&GenericNPC::resume))
-                        ->addMethod("playAnimation", ExecutorLua2<GenericNPC,int,int>(&GenericNPC::playAnimation))
+                        addMethod("walkTo", Executor3<GenericNPC, lua_State*,float,float,float>(&GenericNPC::walkTo))
+                        ->addMethod("runTo", Executor3<GenericNPC, lua_State*,float,float,float>(&GenericNPC::runTo))
+                        ->addMethod("turnTo", Executor1<GenericNPC, lua_State*,float>(&GenericNPC::turnTo))
+                        ->addMethod("finalGoalReached", Executor0ret<GenericNPC, lua_State*,bool>(&GenericNPC::finalGoalReached))
+                        ->addMethod("stop", Executor0<GenericNPC, lua_State*>(&GenericNPC::stop))
+                        ->addMethod("resume", Executor0<GenericNPC, lua_State*>(&GenericNPC::resume))
+                        ->addMethod("playAnimation", Executor2<GenericNPC, lua_State*,int,int>(&GenericNPC::playAnimation))
                         // Display
-                        ->addMethod("hide", ExecutorLua0<WorldEntity>(&WorldEntity::hide))
-                        ->addMethod("unhide", ExecutorLua0<WorldEntity>(&WorldEntity::unhide))
+                        ->addMethod("hide", Executor0<WorldEntity, lua_State*>(&WorldEntity::hide))
+                        ->addMethod("unhide", Executor0<WorldEntity, lua_State*>(&WorldEntity::unhide))
                         // Coordinates
-                        ->addMethod("getAbsCoorX", ExecutorLua0ret<PNode, float>(&PNode::getAbsCoorX))
-                        ->addMethod("getAbsCoorY", ExecutorLua0ret<PNode, float>(&PNode::getAbsCoorY))
-                        ->addMethod("getAbsCoorZ", ExecutorLua0ret<PNode, float>(&PNode::getAbsCoorZ))
-                        ->addMethod("setAbsCoor", ExecutorLua3<PNode,float,float,float>(&PNode::setAbsCoor))
-                        ->addMethod("setAbsDir", ExecutorLua4<PNode,float,float,float,float>(&PNode::setAbsDir))
+                        ->addMethod("getAbsCoorX", Executor0ret<PNode, lua_State*, float>(&PNode::getAbsCoorX))
+                        ->addMethod("getAbsCoorY", Executor0ret<PNode, lua_State*, float>(&PNode::getAbsCoorY))
+                        ->addMethod("getAbsCoorZ", Executor0ret<PNode, lua_State*, float>(&PNode::getAbsCoorZ))
+                        ->addMethod("setAbsCoor", Executor3<PNode, lua_State*,float,float,float>(&PNode::setAbsCoor))
+                        ->addMethod("setAbsDir", Executor4<PNode, lua_State*,float,float,float,float>(&PNode::setAbsDir))
                        );
 
@@ -81,9 +85,9 @@
 void GenericNPC::init()
 {
-  this->setClassID(CL_GENERIC_NPC, "GenericNPC");
+  this->registerObject(this, GenericNPC::_objectList);
 
   this->toList(OM_GROUP_00);
 
-  this->soundBuffer = (OrxSound::SoundBuffer*)ResourceManager::getInstance()->load("sound/rain.wav", WAV);
+  this->soundBuffer = OrxSound::ResourceSoundBuffer("sound/rain.wav");
 
   time = 30.0f;
@@ -92,5 +96,5 @@
 
   // collision reaction registration
-   this->subscribeReaction(CREngine::CR_PHYSICS_GROUND_WALK, CL_BSP_ENTITY);
+  this->subscribeReaction(CREngine::CR_PHYSICS_GROUND_WALK, BspEntity::staticClassID());
 }
 
@@ -231,5 +235,5 @@
         this->setAnimationSpeed(0.5f);
       }
-        break;
+      break;
       case Run:
       {
@@ -244,5 +248,5 @@
         this->setAnimationSpeed(1.0f);
       }
-        break;
+      break;
       case Crouch:
       {
@@ -257,18 +261,18 @@
         this->setAnimationSpeed(1.0f);
       }
-        break;
+      break;
       case LookAt:
-        if( this->getAnimation() != STAND)
-          this->setAnimation(STAND, MD2_ANIM_LOOP);
-        break;
+      if( this->getAnimation() != STAND)
+        this->setAnimation(STAND, MD2_ANIM_LOOP);
+      break;
       case Shoot:
-        if( this->getAnimation() != STAND)
-          this->setAnimation(STAND, MD2_ANIM_LOOP);
-        break;
+      if( this->getAnimation() != STAND)
+        this->setAnimation(STAND, MD2_ANIM_LOOP);
+      break;
 
       default:
-        if( this->getAnimation() != STAND)
-          this->setAnimation(STAND, MD2_ANIM_LOOP);
-        break;
+      if( this->getAnimation() != STAND)
+        this->setAnimation(STAND, MD2_ANIM_LOOP);
+      break;
 
     }
@@ -304,5 +308,5 @@
         this->setAnimationSpeed(0.5f);
       }
-        break;
+      break;
       case Run:
       {
@@ -317,5 +321,5 @@
         this->setAnimationSpeed(1.0f);
       }
-        break;
+      break;
       case Crouch:
       {
@@ -330,5 +334,5 @@
         this->setAnimationSpeed(1.0f);
       }
-        break;
+      break;
       case LookAt:
       {
@@ -336,14 +340,14 @@
           this->setAnimation(STAND, MD2_ANIM_LOOP);
       }
-        break;
+      break;
       case Shoot:
-        if( this->getAnimation() != STAND)
+      if( this->getAnimation() != STAND)
         this->setAnimation(STAND, MD2_ANIM_LOOP);
-        break;
+      break;
 
       default:
-        if( this->getAnimation() != STAND)
+      if( this->getAnimation() != STAND)
         this->setAnimation(STAND, MD2_ANIM_LOOP);
-        break;
+      break;
 
     }
@@ -507,18 +511,18 @@
     {
       case Walk:
+      {
+        Vector dest = currentAnimation.v - this->getAbsCoor();
+        dest.y = 0.0f;
+        if (dest.len() < .5)
         {
-          Vector dest = currentAnimation.v - this->getAbsCoor();
-          dest.y = 0.0f;
-          if (dest.len() < .5)
-          {
-            this->nextStep();
-          }
-          else
-          {
-            Vector move = dest.getNormalized() * currentAnimation.speed * dt;
-            this->shiftCoor(move);
-          }
+          this->nextStep();
         }
-        break;
+        else
+        {
+          Vector move = dest.getNormalized() * currentAnimation.speed * dt;
+          this->shiftCoor(move);
+        }
+      }
+      break;
 
       case Run:
@@ -549,15 +553,15 @@
 
       case TurnTo:
-        //Quaternion direction = this->
-        break;
+      //Quaternion direction = this->
+      break;
 
       case LookAt:
-        break;
+      break;
 
       case Shoot:
-        break;
+      break;
 
       default:
-        break;
+      break;
 
     }
@@ -569,5 +573,5 @@
     this->fallVelocity += 300.0f * dt;
     //velocity -= Vector(0.0, 1.0, 0.0) * this->fallVelocity;
-   // PRINTF(0)("%s is not on ground\n", this->getName());
+    // PRINTF(0)("%s is not on ground\n", this->getName());
     this->shiftCoor(Vector(0, -this->fallVelocity * dt,0));
 
Index: trunk/src/world_entities/npcs/generic_npc.h
===================================================================
--- trunk/src/world_entities/npcs/generic_npc.h	(revision 9656)
+++ trunk/src/world_entities/npcs/generic_npc.h	(revision 9869)
@@ -25,4 +25,5 @@
 class GenericNPC : public NPC
 {
+  ObjectListDeclaration(GenericNPC);
 
 
@@ -123,5 +124,5 @@
 
    OrxSound::SoundSource                   soundSource;
-   OrxSound::SoundBuffer*                  soundBuffer;
+   OrxSound::SoundBuffer                   soundBuffer;
    float                                   soundVolume;
 
Index: trunk/src/world_entities/npcs/ground_turret.cc
===================================================================
--- trunk/src/world_entities/npcs/ground_turret.cc	(revision 9656)
+++ trunk/src/world_entities/npcs/ground_turret.cc	(revision 9869)
@@ -29,7 +29,8 @@
 #include "effects/explosion.h"
 
-CREATE_FACTORY(GroundTurret, CL_GROUND_TURRET);
+#include "class_id_DEPRECATED.h"
 
-
+ObjectListDefinitionID(GroundTurret, CL_GROUND_TURRET);
+CREATE_FACTORY(GroundTurret);
 
 
@@ -61,5 +62,5 @@
 void GroundTurret::init()
 {
-  this->setClassID(CL_GROUND_TURRET, "GroundTurret");
+  this->registerObject(this, GroundTurret::_objectList);
   this->loadModel("models/ground_turret_#.obj", 5);
   this->left = NULL;
Index: trunk/src/world_entities/npcs/ground_turret.h
===================================================================
--- trunk/src/world_entities/npcs/ground_turret.h	(revision 9656)
+++ trunk/src/world_entities/npcs/ground_turret.h	(revision 9869)
@@ -14,4 +14,5 @@
 class GroundTurret : public NPC
 {
+  ObjectListDeclaration(GroundTurret);
 
 public:
Index: trunk/src/world_entities/npcs/network_turret.cc
===================================================================
--- trunk/src/world_entities/npcs/network_turret.cc	(revision 9656)
+++ trunk/src/world_entities/npcs/network_turret.cc	(revision 9869)
@@ -30,8 +30,9 @@
 
 #include "weapons/aiming_turret.h"
+#include "debug.h"
 
-CREATE_FACTORY(NetworkTurret, CL_NETWORK_TURRET);
-
-
+#include "class_id_DEPRECATED.h"
+ObjectListDefinitionID(NetworkTurret, CL_NETWORK_TURRET);
+CREATE_FACTORY(NetworkTurret);
 
 
@@ -62,5 +63,5 @@
 void NetworkTurret::init()
 {
-  this->setClassID(CL_NETWORK_TURRET, "NetworkTurret");
+  this->registerObject(this, NetworkTurret::_objectList);
   this->loadModel("models/ground_turret_#.obj", 5);
 
@@ -111,6 +112,6 @@
   ObjectManager::EntityList::iterator entity;
   Vector diffVec;
-  for (entity = State::getObjectManager()->getObjectList((OM_LIST)this->targetGroup).begin();
-       entity != State::getObjectManager()->getObjectList((OM_LIST)this->targetGroup).end();
+  for (entity = State::getObjectManager()->getEntityList((OM_LIST)this->targetGroup).begin();
+       entity != State::getObjectManager()->getEntityList((OM_LIST)this->targetGroup).end();
        entity ++)
   {
Index: trunk/src/world_entities/npcs/network_turret.h
===================================================================
--- trunk/src/world_entities/npcs/network_turret.h	(revision 9656)
+++ trunk/src/world_entities/npcs/network_turret.h	(revision 9869)
@@ -14,5 +14,5 @@
 class NetworkTurret : public NPC
 {
-
+  ObjectListDeclaration(NetworkTurret);
 public:
   NetworkTurret(const TiXmlElement* root = NULL);
Index: trunk/src/world_entities/npcs/npc.cc
===================================================================
--- trunk/src/world_entities/npcs/npc.cc	(revision 9656)
+++ trunk/src/world_entities/npcs/npc.cc	(revision 9869)
@@ -20,8 +20,9 @@
 #include "npc.h"
 
+ObjectListDefinition(NPC);
 
 NPC::NPC(const TiXmlElement* root)
 {
-  this->setClassID(CL_NPC, "NPC");
+  this->registerObject(this, NPC::_objectList);
 
   this->toList(OM_GROUP_00);
Index: trunk/src/world_entities/npcs/npc.h
===================================================================
--- trunk/src/world_entities/npcs/npc.h	(revision 9656)
+++ trunk/src/world_entities/npcs/npc.h	(revision 9869)
@@ -8,5 +8,5 @@
 
 class NPC : public WorldEntity {
-
+  ObjectListDeclaration(NPC);
  public:
    NPC (const TiXmlElement* root);
Index: trunk/src/world_entities/npcs/npc_test.cc
===================================================================
--- trunk/src/world_entities/npcs/npc_test.cc	(revision 9656)
+++ trunk/src/world_entities/npcs/npc_test.cc	(revision 9869)
@@ -30,11 +30,12 @@
 #include "effects/explosion.h"
 
-CREATE_FACTORY(NPC2, CL_NPC_TEST2);
-
+#include "class_id_DEPRECATED.h"
+ObjectListDefinitionID(NPC2, CL_NPC_TEST2);
+CREATE_FACTORY(NPC2);
 
 NPC2::NPC2(const TiXmlElement* root)
   : NPC(NULL)
 {
-  this->setClassID(CL_NPC_TEST2, "NPC2");
+  this->registerObject(this, NPC2::_objectList);
 
   if ((float)rand()/RAND_MAX > .5f)
@@ -47,6 +48,6 @@
 
   this->shader = NULL;
-  if (likely(Shader::checkShaderAbility()))
-    this->shader = Shader::getShader("shaders/toon.vert", "shaders/toon.frag");
+//  if (likely(Shader::checkShaderAbility()))
+    //this->shader = Shader::getShader("shaders/toon.vert", "shaders/toon.frag");
 
   this->randomRotAxis = VECTOR_RAND(1);
@@ -58,8 +59,5 @@
 
 NPC2::~NPC2 ()
-{
-  if (this->shader)
-    Shader::unload(this->shader);
-}
+{}
 
 
Index: trunk/src/world_entities/npcs/npc_test.h
===================================================================
--- trunk/src/world_entities/npcs/npc_test.h	(revision 9656)
+++ trunk/src/world_entities/npcs/npc_test.h	(revision 9869)
@@ -9,4 +9,5 @@
 
 class NPC2 : public NPC {
+  ObjectListDeclaration(NPC2);
 
  public:
Index: trunk/src/world_entities/npcs/npc_test1.cc
===================================================================
--- trunk/src/world_entities/npcs/npc_test1.cc	(revision 9656)
+++ trunk/src/world_entities/npcs/npc_test1.cc	(revision 9869)
@@ -25,9 +25,10 @@
 #include "power_ups/laser_power_up.h"
 
+ObjectListDefinition(NPCTest1);
 
 NPCTest1::NPCTest1()
   : NPC(NULL)
 {
-  this->setClassID(CL_NPC_TEST1, "NPCTest1");
+  this->registerObject(this, NPCTest1::_objectList);
 
   if ((float)rand()/RAND_MAX > .5f)
Index: trunk/src/world_entities/npcs/npc_test1.h
===================================================================
--- trunk/src/world_entities/npcs/npc_test1.h	(revision 9656)
+++ trunk/src/world_entities/npcs/npc_test1.h	(revision 9869)
@@ -8,5 +8,5 @@
 
 class NPCTest1 : public NPC {
-
+  ObjectListDeclaration(NPCTest1);
  public:
   NPCTest1 ();
Index: trunk/src/world_entities/npcs/repair_station.cc
===================================================================
--- trunk/src/world_entities/npcs/repair_station.cc	(revision 9656)
+++ trunk/src/world_entities/npcs/repair_station.cc	(revision 9869)
@@ -25,11 +25,8 @@
 
 #include "repair_station.h"
-#include "class_list.h"
 
-
-
-
-
-CREATE_FACTORY(RepairStation, CL_DOOR);
+#include "class_id_DEPRECATED.h"
+ObjectListDefinitionID(RepairStation, CL_DOOR +1 );
+CREATE_FACTORY(RepairStation);
 
 
@@ -67,6 +64,5 @@
 RepairStation::RepairStation(const TiXmlElement* root)
 {
-
-  this->setClassID(CL_DOOR, "RepairStation");
+  this->registerObject(this, RepairStation::_objectList);
   this->scale = 1.0f;
 
Index: trunk/src/world_entities/npcs/repair_station.h
===================================================================
--- trunk/src/world_entities/npcs/repair_station.h	(revision 9656)
+++ trunk/src/world_entities/npcs/repair_station.h	(revision 9869)
@@ -27,4 +27,5 @@
 class RepairStation : public WorldEntity
 {
+  ObjectListDeclaration(RepairStation);
   public:
     RepairStation ();
Index: trunk/src/world_entities/npcs/space_turret.cc
===================================================================
--- trunk/src/world_entities/npcs/space_turret.cc	(revision 9656)
+++ trunk/src/world_entities/npcs/space_turret.cc	(revision 9869)
@@ -29,5 +29,7 @@
 #include "effects/explosion.h"
 
-CREATE_FACTORY(SpaceTurret, CL_SPACE_TURRET);
+#include "class_id_DEPRECATED.h"
+ObjectListDefinitionID(SpaceTurret, CL_SPACE_TURRET);
+CREATE_FACTORY(SpaceTurret);
 
 /**
@@ -36,5 +38,5 @@
  */
 SpaceTurret::SpaceTurret(const TiXmlElement* root)
-  : NPC(root)
+    : NPC(root)
 {
   this->init();
@@ -48,7 +50,5 @@
  */
 SpaceTurret::~SpaceTurret ()
-{
-
-}
+{}
 
 
@@ -59,5 +59,5 @@
 void SpaceTurret::init()
 {
-  this->setClassID(CL_SPACE_TURRET, "SpaceTurret");
+  this->registerObject(this, SpaceTurret::_objectList);
   this->loadModel("models/ground_turret_#.obj", 7.5);
   this->loadModel("models/comet.obj", 1.0f, 3);
@@ -98,6 +98,8 @@
 
   element = root->FirstChildElement("weapon-left");
-  if (element != NULL) element = element->FirstChildElement();
-  this->left = dynamic_cast<Weapon*>( Factory::fabricate( element) );
+  if (element != NULL)
+    element = element->FirstChildElement();
+  if (element != NULL)
+    this->left = dynamic_cast<Weapon*>( Factory::fabricate( element) );
   if (this->left)
   {
@@ -112,6 +114,8 @@
 
   element = root->FirstChildElement("weapon-right");
-  if (element != NULL)  if (element != NULL) element = element->FirstChildElement();
-  this->right = dynamic_cast<Weapon*>( Factory::fabricate( element) );
+  if (element != NULL)
+    element = element->FirstChildElement();
+  if (element != NULL)
+    this->right = dynamic_cast<Weapon*>( Factory::fabricate( element) );
   if (this->right)
   {
@@ -132,7 +136,5 @@
  */
 void SpaceTurret::setWeaponLeft(const std::string& wLeft)
-{
-
-}
+{}
 
 /**
@@ -150,17 +152,17 @@
 {
   if(this->getHealth() > 0.0f && State::getPlayer() &&
-     State::getPlayer()->getPlayable() &&
-     State::getPlayer()->getPlayable()->distance(this) < 300) // HACK
-  {
-  if (likely(this->left != NULL))
-  {
-//    this->left->tickW(dt);
-    this->left->requestAction(WA_SHOOT);
-  }
-  if (likely(this->right != NULL))
-  {
-//    this->right->tickW(dt);
-    this->right->requestAction(WA_SHOOT);
-  }
+      State::getPlayer()->getPlayable() &&
+      State::getPlayer()->getPlayable()->distance(this) < 300) // HACK
+  {
+    if (likely(this->left != NULL))
+    {
+      //    this->left->tickW(dt);
+      this->left->requestAction(WA_SHOOT);
+    }
+    if (likely(this->right != NULL))
+    {
+      //    this->right->tickW(dt);
+      this->right->requestAction(WA_SHOOT);
+    }
   }
 }
@@ -183,9 +185,9 @@
     this->getModel(3)->draw();
   glPopMatrix();
-/*
-  if (this->left != NULL)
-    this->left->draw();
-  if (this->right != NULL)
-    this->right->draw();*/
+  /*
+    if (this->left != NULL)
+      this->left->draw();
+    if (this->right != NULL)
+      this->right->draw();*/
 }
 
@@ -197,7 +199,5 @@
  */
 void SpaceTurret::postSpawn ()
-{
-
-}
+{}
 
 /**
@@ -206,7 +206,5 @@
  */
 void SpaceTurret::leftWorld ()
-{
-
-}
+{}
 
 void SpaceTurret::destroy(WorldEntity* killer)
Index: trunk/src/world_entities/npcs/space_turret.h
===================================================================
--- trunk/src/world_entities/npcs/space_turret.h	(revision 9656)
+++ trunk/src/world_entities/npcs/space_turret.h	(revision 9869)
@@ -18,4 +18,5 @@
 class SpaceTurret : public NPC
 {
+  ObjectListDeclaration(SpaceTurret);
 
 public:
Index: trunk/src/world_entities/particles/box_emitter.cc
===================================================================
--- trunk/src/world_entities/particles/box_emitter.cc	(revision 9869)
+++ trunk/src/world_entities/particles/box_emitter.cc	(revision 9869)
@@ -0,0 +1,117 @@
+/*
+   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: Patrick Boenzli
+*/
+
+#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_GRAPHICS
+
+#include "box_emitter.h"
+
+#include "particle_system.h"
+
+#include "util/loading/load_param.h"
+#include "util/loading/factory.h"
+#include "debug.h"
+
+#include "class_id_DEPRECATED.h"
+
+ObjectListDefinitionID(BoxEmitter, CL_BOX_EMITTER);
+CREATE_FACTORY(BoxEmitter);
+
+/**
+ *  standard constructor
+*/
+BoxEmitter::BoxEmitter(const Vector& size, float emissionRate, float velocity, float angle)
+    :  ParticleEmitter(emissionRate, velocity, angle)
+{
+  this->init();
+  this->setSize(size);
+}
+
+/**
+ *  constructs and loads a BoxEmitter from a XML-element
+ * @param root the XML-element to load from
+*/
+BoxEmitter::BoxEmitter(const TiXmlElement* root)
+    : ParticleEmitter()
+{
+  this->init();
+
+  if (root != NULL)
+    this->loadParams(root);
+}
+
+/**
+ *  standard destructor
+
+   removes the EmitterSystem from the ParticleEngine
+*/
+BoxEmitter::~BoxEmitter ()
+{
+  this->setSystem(NULL);
+}
+
+/**
+  @brief initializes default values of a ParitcleEmitter
+*/
+void BoxEmitter::init()
+{
+  this->registerObject(this, BoxEmitter::_objectList);
+  this->setSize(1.0f,1.0f,1.0f);
+}
+
+void BoxEmitter::loadParams(const TiXmlElement* root)
+{
+  ParticleEmitter::loadParams(root);
+
+  LoadParam(root, "size", this, BoxEmitter, setSize)
+  .describe("The Size of the BoxEmitter: x, y, z")
+  .defaultValues(1.0f,1.0f,1.0f);
+}
+
+void BoxEmitter::setSize(float x, float y, float z)
+{
+  this->size = Vector (x,y,z);
+}
+
+
+void BoxEmitter::emitParticles(unsigned int count) const
+{
+  Vector inheritVelocity = this->getVelocity() * this->inheritSpeed;
+
+  Vector xDir = this->getAbsDirX() * this->size.x;
+  Vector yDir = this->getAbsDirY() * this->size.y;
+  Vector zDir = this->getAbsDirZ() * this->size.z;
+
+  for (unsigned int i = 0; i < count; i++)
+  {
+    Vector randDir = Vector(rand()-RAND_MAX/2, rand()-RAND_MAX/2, rand()-RAND_MAX/2);
+    randDir.normalize();
+    randDir = (Quaternion(angle + randomAngle *((float)rand()/RAND_MAX -.5), randDir)).apply(this->getAbsDirX());
+    Vector velocityV = randDir.getNormalized()*this->velocity + inheritVelocity;
+
+    Vector box = this->getAbsCoor() +
+                 xDir * ((float)rand()/RAND_MAX -.5) +
+                 yDir * ((float)rand()/RAND_MAX -.5) +
+                 zDir * ((float)rand()/RAND_MAX -.5);
+
+    // ROTATIONAL CALCULATION (this must not be done for all types of particles.)
+    randDir = Vector(rand()-RAND_MAX/2, rand()-RAND_MAX/2, rand()-RAND_MAX/2);
+    randDir.normalize();
+    Quaternion orient = Quaternion(M_PI, randDir);
+    Quaternion moment = Quaternion(this->momentum + this->momentumRandom, randDir);
+
+    this->getSystem()->addParticle(box, velocityV, orient, moment);
+
+  }
+}
Index: trunk/src/world_entities/particles/box_emitter.h
===================================================================
--- trunk/src/world_entities/particles/box_emitter.h	(revision 9869)
+++ trunk/src/world_entities/particles/box_emitter.h	(revision 9869)
@@ -0,0 +1,46 @@
+/*!
+ * @file box_emitter.h
+ *  Definition of a BoxEmitter
+ */
+
+#ifndef _BOX_EMITTER_H
+#define _BOX_EMITTER_H
+
+#include "particle_emitter.h"
+
+#define BOX_EMITTER_DEFAULT_SIZE Vector(1.0f, 1.0f, 1.0f)
+
+//! A class to handle a Box Emitter.
+/**
+ * A Box Emitter is a special kind of emitter, that has the (underlying) PNode
+ * at its center, and from there on is a Box in the Direction of the PNode
+ * out around size in the corresponding directions
+ */
+class BoxEmitter : public ParticleEmitter
+{
+  ObjectListDeclaration(BoxEmitter);
+  friend class ParticleSystem;
+public:
+  BoxEmitter(const Vector& size = BOX_EMITTER_DEFAULT_SIZE,
+             float emissionRate = PARTICLE_EMITTER_DEFAULT_EMISSION_RATE,
+             float velocity = PARTICLE_EMITTER_DEFAULT_VELOCITY,
+             float angle = PARTICLE_EMITTER_DEFAULT_SPREAD);
+  BoxEmitter(const TiXmlElement* root);
+  virtual ~BoxEmitter();
+
+  virtual void loadParams(const TiXmlElement* root);
+
+  void setSize(float x, float y, float z);
+  void setSize(const Vector& size) { this->setSize(size.x, size.y, size.z); };
+
+protected:
+  virtual void emitParticles(unsigned int count) const;
+
+private:
+  void init();
+
+private:
+  Vector      size;
+};
+
+#endif /* _BOX_EMITTER_H */
Index: trunk/src/world_entities/particles/dot_emitter.cc
===================================================================
--- trunk/src/world_entities/particles/dot_emitter.cc	(revision 9869)
+++ trunk/src/world_entities/particles/dot_emitter.cc	(revision 9869)
@@ -0,0 +1,93 @@
+/*
+   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: Patrick Boenzli
+*/
+
+#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_GRAPHICS
+
+#include "dot_emitter.h"
+
+#include "particle_system.h"
+
+#include "util/loading/load_param.h"
+#include "util/loading/factory.h"
+#include "debug.h"
+
+
+
+#include "class_id_DEPRECATED.h"
+ObjectListDefinitionID(DotEmitter, CL_DOT_EMITTER);
+CREATE_FACTORY(DotEmitter);
+
+/**
+ *  standard constructor
+*/
+DotEmitter::DotEmitter(float emissionRate, float velocity, float angle)
+    : ParticleEmitter( emissionRate, velocity, angle)
+{
+  this->init();
+}
+
+/**
+ *  constructs and loads a DotEmitter from a XML-element
+ * @param root the XML-element to load from
+*/
+DotEmitter::DotEmitter(const TiXmlElement* root)
+    : ParticleEmitter()
+{
+  this->init();
+
+  if (root != NULL)
+    this->loadParams(root);
+}
+
+/**
+ *  standard destructor
+
+   removes the EmitterSystem from the ParticleEngine
+*/
+DotEmitter::~DotEmitter ()
+{
+  this->setSystem(NULL);
+}
+
+/**
+  @brief initializes default values of a ParitcleEmitter
+*/
+void DotEmitter::init()
+{
+  this->registerObject(this, DotEmitter::_objectList);
+}
+
+void DotEmitter::emitParticles(unsigned int count) const
+{
+  Vector inheritVelocity = this->getVelocity() * this->inheritSpeed;
+
+  for (unsigned int i = 0; i < count; i++)
+  {
+    Vector randDir = Vector(rand()-RAND_MAX/2, rand()-RAND_MAX/2, rand()-RAND_MAX/2);
+    randDir.normalize();
+    randDir = (Quaternion(angle + randomAngle *((float)rand()/RAND_MAX -.5), randDir)).apply(this->getAbsDirX());
+    Vector velocityV = randDir.getNormalized()*this->velocity + inheritVelocity;
+
+    // ROTATIONAL CALCULATION (this must not be done for all types of particles.)
+    randDir = Vector(rand()-RAND_MAX/2, rand()-RAND_MAX/2, rand()-RAND_MAX/2);
+    randDir.normalize();
+    Quaternion orient = Quaternion(M_PI, randDir);
+    Quaternion moment = Quaternion(this->momentum + this->momentumRandom, randDir);
+
+    this->getSystem()->addParticle(this->getAbsCoor() + this->getVelocity()*.1*rand()/RAND_MAX,
+                                   velocityV, orient, moment);
+
+  }
+}
Index: trunk/src/world_entities/particles/dot_emitter.h
===================================================================
--- trunk/src/world_entities/particles/dot_emitter.h	(revision 9869)
+++ trunk/src/world_entities/particles/dot_emitter.h	(revision 9869)
@@ -0,0 +1,29 @@
+/*!
+ * @file dot_emitter.h
+ *  Definition of a DotEmitter
+ */
+
+#ifndef _DOT_EMITTER_H
+#define _DOT_EMITTER_H
+
+#include "particle_emitter.h"
+
+//! A class to handle an Emitter.
+class DotEmitter : public ParticleEmitter
+{
+  ObjectListDeclaration(DotEmitter);
+
+  friend class ParticleSystem;
+public:
+  DotEmitter(float emissionRate = 1.0, float velocity = 1.0, float angle = .5);
+  DotEmitter(const TiXmlElement* root);
+  virtual ~DotEmitter();
+
+protected:
+  virtual void emitParticles(unsigned int count) const;
+
+private:
+  void init();
+};
+
+#endif /* _DOT_EMITTER_H */
Index: trunk/src/world_entities/particles/dot_particles.cc
===================================================================
--- trunk/src/world_entities/particles/dot_particles.cc	(revision 9869)
+++ trunk/src/world_entities/particles/dot_particles.cc	(revision 9869)
@@ -0,0 +1,111 @@
+/*
+   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 "dot_particles.h"
+
+#include "util/loading/load_param.h"
+#include "util/loading/factory.h"
+#include "material.h"
+#include "state.h"
+
+#include "class_id_DEPRECATED.h"
+
+ObjectListDefinitionID(DotParticles, CL_DOT_PARTICLES);
+CREATE_FACTORY(DotParticles);
+
+
+/**
+ *  standard constructor
+ * @param maxCount the Count of particles in the System
+ * @param type The Type of the DotParticles
+*/
+DotParticles::DotParticles (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
+ */
+DotParticles::DotParticles(const TiXmlElement* root)
+{
+  this->init();
+  if (root != NULL)
+    this->loadParams(root);
+}
+
+/**
+ *  standard deconstructor
+*/
+DotParticles::~DotParticles()
+{ }
+
+/**
+ * @brief initializes the DotParticles with default values
+*/
+void DotParticles::init()
+{
+  this->registerObject(this, DotParticles::_objectList);
+
+  this->material.setDiffuseMap("maps/radial-trans-noise.png");
+}
+
+
+/**
+ * loads Parameters from a TiXmlElement
+ * @param root the XML-element to load from.
+ */
+void DotParticles::loadParams(const TiXmlElement* root)
+{
+  ParticleSystem::loadParams(root);
+}
+
+/**
+ * @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 DotParticles::draw() const
+{
+  glPushAttrib(GL_ENABLE_BIT);
+
+  GLboolean checkLight = false;
+  glGetBooleanv(GL_LIGHTING, &checkLight);
+  if (checkLight == GL_TRUE)
+    glDisable(GL_LIGHTING);
+
+  glMatrixMode(GL_MODELVIEW);
+  glBlendFunc(GL_SRC_ALPHA, GL_DST_ALPHA);
+
+  Particle* drawPart = particles;
+  //glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_ENV_MODE, GL_MODULATE);
+
+  glBegin(GL_POINTS);
+  while (likely(drawPart != NULL))
+  {
+    glColor4fv(drawPart->color);
+    glVertex3f(drawPart->position.x, drawPart->position.y, drawPart->position.z);
+
+    drawPart = drawPart->next;
+  }
+  glEnd();
+  glPopAttrib();
+}
Index: trunk/src/world_entities/particles/dot_particles.h
===================================================================
--- trunk/src/world_entities/particles/dot_particles.h	(revision 9869)
+++ trunk/src/world_entities/particles/dot_particles.h	(revision 9869)
@@ -0,0 +1,36 @@
+/*!
+ * @file dot_particles.h
+
+*/
+
+#ifndef _DOT_PARTICLE_SYSTEM_H
+#define _DOT_PARTICLE_SYSTEM_H
+
+#include "particle_system.h"
+#include "material.h"
+
+//! A class to handle ParticleSystems
+class DotParticles : public ParticleSystem
+{
+  ObjectListDeclaration(DotParticles);
+
+public:
+  DotParticles(unsigned int maxCount = PARTICLE_DEFAULT_MAX_COUNT);
+  DotParticles(const TiXmlElement* root);
+  virtual ~DotParticles();
+
+  virtual void loadParams(const TiXmlElement* root);
+
+  /** @returns the Material that lies on this particles */
+  inline const Material* getMaterial() const { return &this->material; };
+
+  virtual void draw() const;
+
+private:
+  void init();
+
+private:
+  Material          material;            //!< A Material for all the Particles.
+};
+
+#endif /* _DOT_PARTICLE_SYSTEM_H */
Index: trunk/src/world_entities/particles/engine/particle_engine.cc
===================================================================
--- trunk/src/world_entities/particles/engine/particle_engine.cc	(revision 9869)
+++ trunk/src/world_entities/particles/engine/particle_engine.cc	(revision 9869)
@@ -0,0 +1,454 @@
+/*
+   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: ...
+   co-programmer: ...
+*/
+
+#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_GRAPHICS
+
+#include "particle_engine.h"
+
+#include "class_list.h"
+
+#include "debug.h"
+#include "stdlibincl.h"
+#include "util/loading/load_param.h"
+
+
+
+/**
+ *  standard constructor
+*/
+ParticleEngine::ParticleEngine ()
+{
+   this->setClassID(CL_PARTICLE_ENGINE, "ParticleEngine");
+   this->setName("ParticleEngine");
+
+   this->systemList = new tList<ParticleSystem>;
+   this->emitterList = new tList<ParticleEmitter>;
+   this->connectionList = new tList<ParticleConnection>;
+}
+
+/**
+ *  the singleton reference to this class
+*/
+ParticleEngine* ParticleEngine::singletonRef = NULL;
+
+/**
+ *  deletes all the system, emitters, connections and Lists
+*/
+ParticleEngine::~ParticleEngine ()
+{
+  /// @todo we must not do this, because PNoe does it for us
+  /// or we do this with help from ClassList, which essentially makes much more sense
+
+  // delete all remaining systems
+//   tIterator<ParticleSystem>* sysIt = this->systemList->getIterator();
+//   ParticleSystem* tmpSys = sysIt->firstElement();
+//   while(tmpSys)
+//     {
+//       delete tmpSys;
+//       tmpSys = sysIt->nextElement();
+//     }
+//   delete sysIt;
+   delete this->systemList;
+//
+   // delete all remaining emitters
+   tIterator<ParticleEmitter>* emitIt = this->emitterList->getIterator();
+   ParticleEmitter* tmpEmit = emitIt->firstElement();
+   while(tmpEmit)
+     {
+       delete tmpEmit;
+       tmpEmit = emitIt->nextElement();
+     }
+   delete emitIt;
+   delete this->emitterList;
+
+  // there should be no more Connections
+  if (this->connectionList->getSize() == 0)
+    delete this->connectionList;
+  else
+    PRINTF(2)("The Connection List is not empty. This should not happen.\n");
+
+  ParticleEngine::singletonRef = NULL;
+}
+
+/**
+  \brief loads the ParticleEngines settings and connections between particles and emitters
+* @param root the XML-element to load this from.
+ */
+void ParticleEngine::loadParams(const TiXmlElement* root)
+{
+  LOAD_PARAM_START_CYCLE(root, element);
+  {
+    LoadParam_CYCLE(element, "connect", this, ParticleEngine, addConnection)
+        .describe("connects an Emitter to a System (emitterName, systemName)");
+  }
+  LOAD_PARAM_END_CYCLE(element);
+}
+
+/**
+ *  Adds a System to the System list.
+
+   this is done automatically when creating a ParticleSystem
+*/
+void ParticleEngine::addSystem(ParticleSystem* system)
+{
+  this->systemList->add(system);
+}
+
+/**
+ *  Adds an emitter to the emitterList
+
+   this is done automatically when creating a ParticleEmitter
+*/
+void ParticleEngine::addEmitter(ParticleEmitter* emitter)
+{
+  this->emitterList->add(emitter);
+}
+
+/**
+* @brief Connects a ParticleSystem to a ParticleSystem thus emitting Particles.
+* @param emitter the Emitter to connect to the System
+* @param system the System to connect to the Emitter
+*/
+void ParticleEngine::addConnection(const std::string& emitter, const std::string& system)
+{
+  ParticleEmitter* tmpEmit = dynamic_cast<ParticleEmitter*>(ClassList::getObject(emitter, CL_PARTICLE_EMITTER));//this->getEmitterByName(emitter);
+  ParticleSystem* tmpSys = dynamic_cast<ParticleSystem*>(ClassList::getObject(system, CL_PARTICLE_SYSTEM));//this->getSystemByName(system);
+
+  if (tmpEmit != NULL && tmpSys != NULL)
+    this->addConnection(tmpEmit, tmpSys);
+  else
+  {
+    if (tmpEmit == NULL)
+      PRINTF(2)("Emitter %s not found in the List of emitters, not connecting to %s\n", emitter.c_str(), system.c_str());
+    if (tmpEmit == NULL)
+      PRINTF(2)("System %s not found in the List of emitters, not connecting to %s\n", system.c_str(), emitter.c_str());
+  }
+}
+
+/**
+ *  Connects a ParticleSystem to a ParticleSystem thus emitting Particles.
+ * @param emitter the Emitter to connect to the System
+ * @param system the System to connect to the Emitter
+*/
+void ParticleEngine::addConnection(ParticleEmitter* emitter, ParticleSystem* system)
+{
+  // look, if we have already added this connection
+  tIterator<ParticleConnection>* tmpConIt = connectionList->getIterator();
+  ParticleConnection* tmpConnection = tmpConIt->firstElement();
+  while(tmpConnection)
+    {
+      if (tmpConnection->emitter == emitter && tmpConnection->system == system)
+        {
+          PRINTF(2)("Connection between Emitter and System already exists.\n");
+          delete tmpConIt;
+          return;
+        }
+
+      tmpConnection = tmpConIt->nextElement();
+    }
+  delete tmpConIt;
+
+
+
+  ParticleConnection* tmpCon = new ParticleConnection;
+  tmpCon->emitter = emitter;
+  tmpCon->system = system;
+
+  this->connectionList->add(tmpCon);
+}
+
+/**
+ *  Removes a system from the systemList and also removes all Connections to the System
+ * @param system The ParticleSystem to delete
+*/
+bool ParticleEngine::removeSystem(ParticleSystem* system)
+{
+  // remove any connections, that have this system within
+  tIterator<ParticleConnection>* tmpConIt = connectionList->getIterator();
+  ParticleConnection* tmpConnection = tmpConIt->firstElement();
+  while(tmpConnection != NULL)
+    {
+      if (tmpConnection->system == system)
+        this->breakConnection(tmpConnection);
+      tmpConnection = tmpConIt->nextElement();
+    }
+  delete tmpConIt;
+
+  // remove the System from the systemList.
+  this->systemList->remove(system);
+}
+
+/**
+ *  removes an emitter from the emitterList and also from all Connections it is attached to.
+ * @param emitter the ParticleEmitter to remove.
+*/
+bool ParticleEngine::removeEmitter(ParticleEmitter* emitter)
+{
+  // remove any connections, that have this emitter within
+  tIterator<ParticleConnection>* tmpConIt = connectionList->getIterator();
+  ParticleConnection* tmpConnection = tmpConIt->firstElement();
+  while(tmpConnection != NULL)
+    {
+      if (tmpConnection->emitter == emitter)
+        this->breakConnection(tmpConnection);
+      tmpConnection = tmpConIt->nextElement();
+    }
+  delete tmpConIt;
+
+  // remove the emitter from the emitterList
+  this->emitterList->remove(emitter);
+}
+
+
+/**
+ *  removes a Connection between an Emitter and a System
+ * @param connection the connection to remove
+ *
+ * \see bool ParticleEngine::breakConnection(ParticleEmitter* emitter, ParticleSystem* system)
+ */
+bool ParticleEngine::breakConnection(ParticleConnection* connection)
+{
+  this->connectionList->remove(connection);
+  return true;
+}
+
+/**
+ *  removes a Connection between an Emitter and a System
+ * @param emitter The emitter of the connection to remove
+ * @param system The system of the connection to remove
+ * @returns true, if the connection was broken, false if the conntection was not found
+ *
+ * only if both system and emitter are in the connection the Connection will be broken
+*/
+bool ParticleEngine::breakConnection(ParticleEmitter* emitter, ParticleSystem* system)
+{
+  // look, if we have already added this connection
+  tIterator<ParticleConnection>* tmpConIt = connectionList->getIterator();
+  ParticleConnection* tmpConnection = tmpConIt->firstElement();
+  while(tmpConnection)
+    {
+    if (tmpConnection->emitter == emitter && tmpConnection->system == system)
+      {
+        this->breakConnection(tmpConnection);
+        delete tmpConIt;
+        return true;
+      }
+    tmpConnection = tmpConIt->nextElement();
+    }
+  delete tmpConIt;
+  return false;
+}
+
+/**
+ *  removes a Connection between an Emitter and a System
+ * @param emitter The emitter of the connections to remove
+ * @returns the count of connections that were broken, 0 if no conntection was not found
+ */
+unsigned int ParticleEngine::breakConnections(ParticleEmitter* emitter)
+{
+  unsigned int retVal = 0;
+  // look, if we have already added this connection
+  tIterator<ParticleConnection>* tmpConIt = connectionList->getIterator();
+  ParticleConnection* tmpConnection = tmpConIt->firstElement();
+  while(tmpConnection)
+  {
+    if (tmpConnection->emitter == emitter)
+    {
+      this->breakConnection(tmpConnection);
+      retVal++;
+    }
+    tmpConnection = tmpConIt->nextElement();
+  }
+  delete tmpConIt;
+  return retVal;
+}
+
+
+/**
+ *  removes a Connection between an Emitter and a System
+ * @param system The system of the connections to remove
+ * @returns the count of connections that were broken, 0 if no conntection was not found
+ */
+unsigned int ParticleEngine::breakConnections(ParticleSystem* system)
+{
+  unsigned int retVal = 0;
+  // look, if we have already added this connection
+  tIterator<ParticleConnection>* tmpConIt = connectionList->getIterator();
+  ParticleConnection* tmpConnection = tmpConIt->firstElement();
+  while(tmpConnection)
+  {
+    if (tmpConnection->system == system)
+    {
+      this->breakConnection(tmpConnection);
+      retVal++;
+    }
+    tmpConnection = tmpConIt->nextElement();
+  }
+  delete tmpConIt;
+  return retVal;
+}
+
+/**
+ *  this function ticks all the ParticleSystems, so an animation will flow
+ * @param dt passed since last tick
+*/
+void ParticleEngine::tick(float dt)
+{
+  // ticks all the ParticleSystems
+//   tIterator<ParticleSystem>* tmpIt = systemList->getIterator();
+//   ParticleSystem* tmpSys = tmpIt->firstElement();
+//   while(tmpSys)
+//     {
+//       tmpSys->tick(dt);
+//       tmpSys = tmpIt->nextElement();
+//     }
+//   delete tmpIt;
+
+  // add new Particles to each System connected to an Emitter.
+  tIterator<ParticleConnection>* tmpConIt = connectionList->getIterator();
+  ParticleConnection* tmpConnection = tmpConIt->firstElement();
+  while(tmpConnection)
+    {
+      tmpConnection->emitter->tick(dt, tmpConnection->system);
+      tmpConnection = tmpConIt->nextElement();
+    }
+  delete tmpConIt;
+}
+
+/**
+ *  draws all the systems and their Particles.
+*/
+void ParticleEngine::draw() const
+{
+  /*
+  tIterator<ParticleSystem>* tmpIt = systemList->getIterator();
+  ParticleSystem* tmpSys = tmpIt->firstElement();
+  while(tmpSys)
+    {
+      tmpSys->draw();
+      tmpSys = tmpIt->nextElement();
+    }
+  delete tmpIt;*/
+
+}
+
+/**
+ * @param number the n-th system to return
+ * @returns the system called by number or NULL if not found
+*/
+ParticleSystem* ParticleEngine::getSystemByNumber(unsigned int number) const
+{
+  int count = 0;
+  tIterator<ParticleSystem>* tmpIt = systemList->getIterator();
+  ParticleSystem* tmpSys = tmpIt->firstElement();
+  while(tmpSys)
+    {
+      count++;
+      if ( count == number)
+        {
+          delete tmpIt;
+          return tmpSys;
+        }
+      tmpSys = tmpIt->nextElement();
+    }
+  delete tmpIt;
+  return NULL;
+}
+
+/**
+ * @param number the n-th emitter to return
+ * @returns the emitter called by number or NULL if not found
+*/
+ParticleEmitter* ParticleEngine::getEmitterByNumber(unsigned int number) const
+{
+  int count = 0;
+  tIterator<ParticleEmitter>* tmpIt = emitterList->getIterator();
+  ParticleEmitter* tmpEmit = tmpIt->firstElement();
+  while(tmpEmit)
+    {
+      count++;
+      if ( count == number)
+        {
+          delete tmpIt;
+          return tmpEmit;
+        }
+      tmpEmit = tmpIt->nextElement();
+    }
+  delete tmpIt;
+  return NULL;
+}
+
+/**
+ *  outputs some nice debug information
+*/
+void ParticleEngine::debug()
+{
+  PRINT(0)("+-----------------------------------+\n");
+  PRINT(0)("+ PARTICLE-ENGINE DEBUG INFORMATION +\n");
+  PRINT(0)("+-----------------------------------+\n");
+  PRINT(0)(" Reference: %p\n", ParticleEngine::singletonRef);
+  PRINT(0)(" Count: Emitters: %d; Systems: %d, Connections: %d\n",
+  this->emitterList->getSize(), this->systemList->getSize(), this->connectionList->getSize());
+
+  if (this->connectionList->getSize() > 0)
+  {
+    PRINT(0)(" Connections:\n");
+    PRINT(0)(" -----------------------------------\n");
+
+    tIterator<ParticleConnection>* tmpConIt = connectionList->getIterator();
+    ParticleConnection* tmpConnection = tmpConIt->firstElement();
+    while(tmpConnection)
+    {
+      PRINT(0)(" Emitter '%s' emitts into System '%s'\n", tmpConnection->emitter->getName(), tmpConnection->system->getName());
+      tmpConnection = tmpConIt->nextElement();
+    }
+    delete tmpConIt;
+  }
+
+  if (this->systemList->getSize() > 0)
+  {
+    tIterator<ParticleSystem>* tmpIt = systemList->getIterator();
+    ParticleSystem* tmpSys = tmpIt->firstElement();
+    while(tmpSys)
+    {
+      tmpSys->debug();
+      tmpSys = tmpIt->nextElement();
+    }
+    delete tmpIt;
+  }
+  else
+  {
+    PRINT(0)("NO SYSTEMS\n");
+  }
+  if (this->emitterList->getSize() > 0)
+  {
+    tIterator<ParticleEmitter>* tmpIt = emitterList->getIterator();
+    ParticleEmitter* tmpEmit = tmpIt->firstElement();
+    while(tmpEmit)
+    {
+      tmpEmit->debug();
+      tmpEmit = tmpIt->nextElement();
+    }
+    delete tmpIt;
+  }
+  else
+  {
+    PRINTF(0)("NO EMITTERS\n");
+  }
+
+  PRINT(0)("+--------------------------------PE-+\n");
+
+}
+
Index: trunk/src/world_entities/particles/engine/particle_engine.h
===================================================================
--- trunk/src/world_entities/particles/engine/particle_engine.h	(revision 9869)
+++ trunk/src/world_entities/particles/engine/particle_engine.h	(revision 9869)
@@ -0,0 +1,72 @@
+/*!
+ * @file particle_engine.h
+  *  Definition of the ParticleEngine
+*/
+
+#ifndef _PARTICLE_ENGINE_H
+#define _PARTICLE_ENGINE_H
+
+#include "base_object.h"
+
+#include "particle_system.h"
+#include "particle_emitter.h"
+#include <list>
+
+#include "parser/tinyxml/tinyxml.h"
+
+// FORWARD DECLARATION
+
+//! A ParticleConnection enables us to emitt from any emitter into any other particleSystem
+typedef struct ParticleConnection
+{
+  ParticleEmitter*    emitter;     //!< The emitter to emit system from.
+  ParticleSystem*     system;      //!< The Particles emitted from emitter.
+};
+
+//! The physicsEngine handles and stores Systems and Emitters.
+/**
+   It is responsible for driving on the Particles (tick)
+   It draw particles (draw)
+   and it emitts particles into the system
+*/
+class ParticleEngine : public BaseObject {
+
+ public:
+  virtual ~ParticleEngine();
+  /** @returns a Pointer to the only object of this Class */
+  inline static ParticleEngine* getInstance() { if (!singletonRef) singletonRef = new ParticleEngine();  return singletonRef; };
+
+  virtual void loadParams(const TiXmlElement* root);
+
+  void tick(float dt);
+  void draw() const;
+
+  void addSystem(ParticleSystem* system);
+  void addEmitter(ParticleEmitter* emitter);
+  void addConnection(ParticleEmitter* emitter, ParticleSystem* system);
+  void addConnection(const std::string& emitter, const std::string& system);
+
+
+  bool removeSystem(ParticleSystem* system);
+  bool removeEmitter(ParticleEmitter* emitter);
+  bool breakConnection(ParticleConnection* connection);
+  bool breakConnection(ParticleEmitter* emitter, ParticleSystem* system);
+  unsigned int breakConnections(ParticleEmitter* emitter);
+  unsigned int breakConnections(ParticleSystem* system);
+
+   ParticleSystem* getSystemByNumber(unsigned int number) const;
+   ParticleEmitter* getEmitterByNumber(unsigned int number) const;
+
+  void debug();
+
+ private:
+  ParticleEngine();
+  static ParticleEngine* singletonRef;        //!< The reference to the engine.
+
+  std::list<ParticleSystem> systemList;          //!< A list of Systems handled by the ParticleEngine.
+  std::list<ParticleEmitter> emitterList;        //!< A list of Emitters handled by the ParticleEngine.
+
+  tList<ParticleConnection>* connectionList;  //!< A list of Connections between Systems and Emitters.
+};
+
+#endif /* _PARTICLE_ENGINE_H */
Index: trunk/src/world_entities/particles/model_particles.cc
===================================================================
--- trunk/src/world_entities/particles/model_particles.cc	(revision 9869)
+++ trunk/src/world_entities/particles/model_particles.cc	(revision 9869)
@@ -0,0 +1,140 @@
+/*
+   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 "model_particles.h"
+
+#include "util/loading/load_param.h"
+#include "util/loading/factory.h"
+#include "material.h"
+#include "state.h"
+#include "shell_command.h"
+#include "debug.h"
+
+#include "class_id_DEPRECATED.h"
+
+ObjectListDefinitionID(ModelParticles, CL_MODEL_PARTICLES);
+CREATE_FACTORY(ModelParticles);
+
+SHELL_COMMAND(texture, ModelParticles, setMaterialTexture)
+->defaultValues("maps/evil-flower.png");
+
+
+
+/**
+ *  standard constructor
+ * @param maxCount the Count of particles in the System
+ * @param type The Type of the ModelParticles
+*/
+ModelParticles::ModelParticles (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
+ */
+ModelParticles::ModelParticles(const TiXmlElement* root)
+{
+  this->init();
+  if (root != NULL)
+    this->loadParams(root);
+}
+
+/**
+ *  standard deconstructor
+*/
+ModelParticles::~ModelParticles()
+{ }
+
+/**
+ * @brief initializes the ModelParticles with default values
+*/
+void ModelParticles::init()
+{
+  this->registerObject(this, ModelParticles::_objectList);
+
+  this->material.setDiffuseMap("maps/radial-trans-noise.png");
+}
+
+
+/**
+ * loads Parameters from a TiXmlElement
+ * @param root the XML-element to load from.
+ */
+void ModelParticles::loadParams(const TiXmlElement* root)
+{
+  ParticleSystem::loadParams(root);
+
+  LoadParam(root, "texture", this, ModelParticles, setMaterialTexture);
+}
+
+/**
+ * @brief sets the Texutre that is placed onto the particles
+ * @param textureFile the Texture to load onto these ModelParticles
+ */
+void ModelParticles::setMaterialTexture(const std::string& 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 ModelParticles::draw() const
+{
+  glPushAttrib(GL_ENABLE_BIT);
+  Particle* drawPart = particles;
+
+  GLboolean checkLight = false;
+  glGetBooleanv(GL_LIGHTING, &checkLight);
+  if (checkLight == GL_TRUE)
+    glDisable(GL_LIGHTING);
+  glMatrixMode(GL_MODELVIEW);
+
+  this->material.select();
+  glBlendFunc(GL_SRC_ALPHA, GL_DST_ALPHA);
+
+  glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_ENV_MODE, GL_MODULATE);
+
+  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 */
+      Vector tmpRot = drawPart->orientation.getSpacialAxis();
+      glRotatef (drawPart->orientation.getSpacialAxisAngle(), tmpRot.x, tmpRot.y, tmpRot.z );
+
+      this->getModel()->draw();
+
+      glPopMatrix();
+      drawPart = drawPart->next;
+    }
+  else
+    PRINTF(2)("no model loaded onto ParticleSystem-%s\n", this->getCName());
+  glPopAttrib();
+}
Index: trunk/src/world_entities/particles/model_particles.h
===================================================================
--- trunk/src/world_entities/particles/model_particles.h	(revision 9869)
+++ trunk/src/world_entities/particles/model_particles.h	(revision 9869)
@@ -0,0 +1,38 @@
+/*!
+ * @file model_particles.h
+
+*/
+
+#ifndef _MODEL_PARTICLE_SYSTEM_H
+#define _MODEL_PARTICLE_SYSTEM_H
+
+#include "particle_system.h"
+#include "material.h"
+
+//! A class to handle ParticleSystems
+class ModelParticles : public ParticleSystem
+{
+  ObjectListDeclaration(ModelParticles);
+
+public:
+  ModelParticles(unsigned int maxCount = PARTICLE_DEFAULT_MAX_COUNT);
+  ModelParticles(const TiXmlElement* root);
+  virtual ~ModelParticles();
+
+  virtual void loadParams(const TiXmlElement* root);
+
+  void setMaterialTexture(const std::string& textureFile);
+
+  /** @returns the Material that lies on this particles */
+  inline const Material* getMaterial() const { return &this->material; };
+
+  virtual void draw() const;
+
+private:
+  void init();
+
+private:
+  Material          material;            //!< A Material for all the Particles.
+};
+
+#endif /* _MODEL_PARTICLE_SYSTEM_H */
Index: trunk/src/world_entities/particles/particle_emitter.cc
===================================================================
--- trunk/src/world_entities/particles/particle_emitter.cc	(revision 9869)
+++ trunk/src/world_entities/particles/particle_emitter.cc	(revision 9869)
@@ -0,0 +1,201 @@
+/*
+   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: Patrick Boenzli
+*/
+
+#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_GRAPHICS
+
+#include "particle_emitter.h"
+
+#include "particle_system.h"
+
+#include "util/loading/load_param.h"
+#include "debug.h"
+
+ObjectListDefinition(ParticleEmitter);
+
+/**
+ *  standard constructor
+*/
+ParticleEmitter::ParticleEmitter(float emissionRate, float velocity, float angle)
+{
+  this->registerObject(this, ParticleEmitter::_objectList);
+
+  this->system = NULL;
+
+  this->setInheritSpeed(PARTICLE_EMITTER_DEFAULT_INHERIT_SPEED);
+  this->setEmissionMomentum(0);
+  this->setSpread(angle);
+  this->setEmissionRate(emissionRate);
+  this->setEmissionVelocity(velocity);
+
+  this->saveTime = 0.0;
+}
+
+/**
+ *  standard destructor
+
+   removes the EmitterSystem from the ParticleEngine
+*/
+ParticleEmitter::~ParticleEmitter ()
+{
+  this->setSystem(NULL);
+}
+
+/**
+ *  loads a ParticleEmitter from a XML-element
+ * @param root the XML-element to load from
+*/
+void ParticleEmitter::loadParams(const TiXmlElement* root)
+{
+  PNode::loadParams(root);
+
+  LoadParam(root, "rate", this, ParticleEmitter, setEmissionRate)
+    .describe("How many particles should be emittet from this emitter");
+
+  LoadParam(root, "inherit-speed", this, ParticleEmitter, setInheritSpeed)
+    .describe("the extent, the speed of the emitter has on the particles");
+
+  LoadParam(root, "emission-velocity", this, ParticleEmitter, setEmissionVelocity)
+    .describe("How fast the particles are emittet (their initial speed)");
+
+  LoadParam(root, "emission-momentum", this, ParticleEmitter, setEmissionMomentum)
+      .describe("How fast the particles rotation is at emissiontime (their initial momentum)");
+
+  LoadParam(root, "spread", this, ParticleEmitter, setSpread)
+    .describe("The angle the particles are emitted from (angle, deviation)");
+}
+
+void ParticleEmitter::setSystem(ParticleSystem* system)
+{
+  if (system != NULL)
+    system->addEmitter(this);
+  else if (this->system != NULL)
+    this->system->removeEmitter(this);
+}
+
+/**
+ *  this start the emitter
+*/
+void ParticleEmitter::start() {}
+
+
+/**
+ *  this stops the emitter
+*/
+void ParticleEmitter::stop() {}
+
+
+/**
+ *  set the emission rate
+ * @param emissionRate: sets the number of particles emitted per second
+
+   if you want to change the value of this variable during emission time (to make it more dynamic)
+   you may want to use the animation class
+*/
+void ParticleEmitter::setEmissionRate(float emissionRate)
+{
+  if (emissionRate > 0.0)
+    this->emissionRate = emissionRate;
+  else
+    this->emissionRate = 0.0;
+}
+
+/**
+ *  how much of the speed from the ParticleEmitter should flow onto the ParticleSystem
+ * @param value a Value between zero and one
+
+   if you want to change the value of this variable during emission time (to make it more dynamic)
+   you may want to use the animation class
+*/
+void ParticleEmitter::setInheritSpeed(float value)
+{
+  if (unlikely(value > 1.0))
+    this->inheritSpeed = 1;
+  else if (unlikely(value < 0.0))
+    this->inheritSpeed = 0;
+  else
+    this->inheritSpeed = value;
+}
+
+/**
+ *  set the angle of the emitter
+ * @param angle around the direction in which there are particles to be emitted
+ * @param randomAngle A random spread-angle, the +- randomness of this option
+
+   if you want to change the value of this variable during emission time (to make it more dynamic)
+   you may want to use the animation class
+*/
+void ParticleEmitter::setSpread(float angle, float randomAngle)
+{
+  this->angle = angle;
+  this->randomAngle = randomAngle;
+}
+
+/**
+ *  sets the initial velocity of all particles emitted
+ * @param velocity The starting velocity of the emitted particles
+ * @param randomVelocity A random starting velocity, the +- randomness of this option
+
+   if you want to change the value of this variable during emission time (to make it more dynamic)
+   you may want to use the animation class
+*/
+void ParticleEmitter::setEmissionVelocity(float velocity, float randomVelocity)
+{
+  this->velocity = velocity;
+  this->randomVelocity = randomVelocity;
+}
+
+/**
+ *  sets the initial Momentum of all particles emitted
+ * @param momentum the new Momentum (just a float for being not too complicated).
+ * @param randomMomentum variation from the given value.
+ */
+void ParticleEmitter::setEmissionMomentum(float momentum, float randomMomentum)
+{
+  this->momentum = momentum;
+  this->momentumRandom = randomMomentum;
+}
+
+/**
+ *  this set the time to life of a particle, after which it will die
+ * @param dt: the time to live in seconds
+ * @param system: the system into which to emitt
+
+   if you want to change the value of this variable during emission time (to make it more dynamic)
+   you may want to use the animation class
+*/
+void ParticleEmitter::tick(float dt)
+{
+  assert (this->system != NULL);
+  if (likely(dt > 0.0 && this->emissionRate > 0.0))
+  {
+    // saving the time (particles only partly emitted in this timestep)
+    float count = (dt+this->saveTime) * this->emissionRate;
+    this->saveTime = modff(count, &count) / this->emissionRate;
+    PRINTF(5)("emitting %f particles, saving %f seconds for the next timestep\n", count, this->saveTime);
+    if (count + this->system->getCount() > this->system->getMaxCount())
+      count = this->system->getMaxCount() - this->system->getCount();
+    if (likely(count > 0.0f))
+      this->emitParticles((unsigned int)count);
+  }
+}
+
+/**
+ *  outputs some nice debug information
+*/
+void ParticleEmitter::debug() const
+{
+  PRINT(0)(" ParticleEmitter %s::%s\n", this->getClassCName(), this->getCName());
+  PRINT(0)("  EmissionRate: %f, Speed: %f, SpreadAngle: %f\n", this->getEmissionRate(), this->getEmissionVelocity(), this->getSpread());
+}
Index: trunk/src/world_entities/particles/particle_emitter.h
===================================================================
--- trunk/src/world_entities/particles/particle_emitter.h	(revision 9869)
+++ trunk/src/world_entities/particles/particle_emitter.h	(revision 9869)
@@ -0,0 +1,82 @@
+/*!
+ * @file particle_emitter.h
+  *  Definition of a ParticleEmitter
+*/
+
+#ifndef _PARTICLE_EMITTER_H
+#define _PARTICLE_EMITTER_H
+
+#include "p_node.h"
+
+// FORWARD DECLARATION
+class ParticleSystem;
+class TiXmlElement;
+
+// Default values
+#define PARTICLE_EMITTER_DEFAULT_SIZE              1.0
+#define PARTICLE_EMITTER_DEFAULT_EMISSION_RATE     50
+#define PARTICLE_EMITTER_DEFAULT_INHERIT_SPEED     0.0
+#define PARTICLE_EMITTER_DEFAULT_SPREAD            M_PI
+#define PARTICLE_EMITTER_DEFAULT_VELOCITY          1.0
+
+//! A class to handle an Emitter.
+class ParticleEmitter : public PNode
+{
+  ObjectListDeclaration(ParticleEmitter);
+  friend class ParticleSystem;
+public:
+  ParticleEmitter(float emissionRate = PARTICLE_EMITTER_DEFAULT_EMISSION_RATE,
+                  float velocity = PARTICLE_EMITTER_DEFAULT_VELOCITY,
+                  float angle = PARTICLE_EMITTER_DEFAULT_SPREAD);
+  virtual ~ParticleEmitter();
+
+  virtual void loadParams(const TiXmlElement* root = NULL);
+
+  /* controlling the emitter: interface */
+  void start();
+  void stop();
+  void tick(float dt);
+
+  void setSystem(ParticleSystem* system);
+  ParticleSystem* getSystem() const { return this->system; };
+
+  /* controlling the behavour: these can be used as Animation interfaces */
+  void setEmissionRate(float emissionRate);
+  void setInheritSpeed(float value);
+  void setSpread(float angle, float randomAngle = 0.0);
+  void setEmissionVelocity(float velocity, float randomVelocity = 0.0);
+  void setEmissionMomentum(float momentum, float randomMomentum = 0.0);
+
+  /** @returns the emissionRate */
+  inline float getEmissionRate() const { return this->emissionRate; };
+  /** @returns the inherit-speed-factor */
+  inline float getInheritSpeed() const { return this->inheritSpeed; };
+  /** @returns the SpreadAngle of the emitter */
+  inline float getSpread() const { return this->angle; };
+  /** @returns the EmissionVelocity of the emitter */
+  inline float getEmissionVelocity() const { return this->velocity; };
+  /** @returns the EmissionMomentum of this emitter */
+  inline float getEmissionMomentum() const { return this->momentum; };
+
+
+  void debug() const;
+
+protected:
+  virtual void emitParticles(unsigned int count) const = 0;
+
+protected:
+  float           inheritSpeed;      //!< How much speed the particle inherits from the Emitters speed.
+  float           angle;             //!< max angle from the direction of the emitter
+  float           randomAngle;       //!< random emission angle (angle +- angleRandom is the emitted angle.
+  float           velocity;          //!< the initial speed of a Particles.
+  float           randomVelocity;    //!< the random variation from the initial Speed.
+  float           momentum;          //!< The Initial spped of the Rotation.
+  float           momentumRandom;    //!< The random variation of the Momentum.
+
+private:
+  ParticleSystem* system;            //!< The ParticleSystem this Emitter Emits into.
+  float           saveTime;          //!< The time that was missing by the last Tick (otherwise there would be no emission when framefate is too big).
+  float           emissionRate;      //!< amount of particles per seconds emitted by emitter.
+};
+
+#endif /* _PARTICLE_EMITTER_H */
Index: trunk/src/world_entities/particles/particle_system.cc
===================================================================
--- trunk/src/world_entities/particles/particle_system.cc	(revision 9869)
+++ trunk/src/world_entities/particles/particle_system.cc	(revision 9869)
@@ -0,0 +1,483 @@
+/*
+   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 "particle_system.h"
+
+#include "particle_emitter.h"
+
+#include "physics/fields/field.h"
+#include "model.h"
+
+#include "util/loading/load_param_xml.h"
+#include "util/loading/factory.h"
+#include "material.h"
+#include "state.h"
+#include "shell_command.h"
+
+#include <algorithm>
+
+ObjectListDefinition(ParticleSystem);
+
+/**
+ *  standard constructor
+ * @param maxCount the Count of particles in the System
+ * @param type The Type of the ParticleSystem
+*/
+ParticleSystem::ParticleSystem (unsigned int maxCount)
+{
+  this->registerObject(this, ParticleSystem::_objectList);
+
+  this->setMaxCount(PARTICLE_DEFAULT_MAX_COUNT);
+  this->count = 0;
+  this->particles = NULL;
+  this->deadList = NULL;
+  this->conserve = 1.0;
+  this->lifeSpan = 1.0; this->randomLifeSpan = 0.0;
+
+  this->toList(OM_ENVIRON);
+
+  this->maxCount = maxCount;
+}
+
+/**
+ * @brief standard deconstructor
+ */
+ParticleSystem::~ParticleSystem()
+{
+  // 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;
+  }
+
+  while(!this->emitters.empty())
+  {
+    this->removeEmitter(this->emitters.front());
+  }
+
+}
+
+
+/**
+ * @brief loads Parameters from a TiXmlElement
+ * @param root the XML-element to load from.
+ */
+void ParticleSystem::loadParams(const TiXmlElement* root)
+{
+  WorldEntity::loadParams(root);
+  PhysicsInterface::loadParams(root);
+
+  LoadParam(root, "max-count", this, ParticleSystem, setMaxCount)
+  .describe("the maximal count of Particles, that can be emitted into this system");
+
+  LoadParam(root, "life-span", this, ParticleSystem, setLifeSpan)
+  .describe("sets the life-span of the Particles.");
+
+  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)");
+
+  LoadParamXML(root, "emitters", this, ParticleSystem, loadEmitters);
+
+  LOAD_PARAM_START_CYCLE(root, element);
+  {
+    element->ToText();
+    // PER-PARTICLE-ATTRIBUTES:
+    LoadParam_CYCLE(element, "radius", this, ParticleSystem, setRadius)
+    .describe("The Radius of each particle over time (TimeIndex [0-1], radius at TimeIndex, randomRadius at TimeIndex)");
+
+    LoadParam_CYCLE(element, "mass", this, ParticleSystem, setMass)
+    .describe("The Mass of each particle over time (TimeIndex: [0-1], mass at TimeIndex, randomMass at TimeIndex)");
+
+    LoadParam_CYCLE(element, "color", this, ParticleSystem, setColor)
+    .describe("The Color of each particle over time (TimeIndex: [0-1], red: [0-1], green: [0-1], blue: [0-1], alpha: [0-1])");
+  }
+  LOAD_PARAM_END_CYCLE(element);
+
+  LoadParam(root, "precache", this, ParticleSystem, precache)
+  .describe("Precaches the ParticleSystem for %1 seconds, %2 times per Second")
+  .defaultValues(1.0, 25.0);
+}
+
+/**
+ * @brief loads the Emitters from An XML-Root
+ * @param root the XML-Element to load all emitters from
+ */
+void ParticleSystem::loadEmitters(const TiXmlElement* root)
+{
+  LOAD_PARAM_START_CYCLE(root, element);
+  {
+    BaseObject* emitter = Factory::fabricate(element);
+    if (emitter != NULL)
+    {
+      if (emitter->isA(ParticleEmitter::staticClassID()))
+        this->addEmitter(dynamic_cast<ParticleEmitter*>(emitter));
+      else
+      {
+        PRINTF(2)("Tried to load an Element of type '%s' that should be a ParticleEmitter onto '%s::%s'.\n",
+                  emitter->getClassCName(), this->getClassCName(), this->getCName());
+        delete emitter;
+      }
+    }
+    else
+    {
+      PRINTF(2)("Could not Generate Emitter for system %s::%s (wrong type in XML-format)\n", this->getClassCName(), getCName());
+    }
+  }
+  LOAD_PARAM_END_CYCLE(element);
+}
+
+/**
+ * @param maxCount the maximum count of particles that can be emitted
+ */
+void ParticleSystem::setMaxCount(unsigned int maxCount)
+{
+  this->maxCount = maxCount;
+  PRINTF(4)("MAXCOUNT of %s::%s is %d\n", this->getClassCName(), this->getCName(), maxCount);
+}
+
+// setting properties
+/**
+ * @brief Sets the lifespan of newly created particles
+ * @param lifeSpan the LifeSpan of each particle in the System
+ * @param randomLifeSpan the Deviation from lifeSpan (random Value).
+*/
+void ParticleSystem::setLifeSpan(float lifeSpan, float randomLifeSpan)
+{
+  this->lifeSpan = lifeSpan;
+  this->randomLifeSpan = randomLifeSpan;
+  PRINTF(4)("LifeTime of %s::%s is %f\n", this->getClassCName(), this->getCName(), lifeSpan);
+}
+
+/**
+ * @brief sets the conserve Factor of newly created particles
+ * @param conserve sets the conserve factor of each particle.
+ * Conserve is the ammount of energy a particle takes from the last Frame into the next.
+ * A Value of 1 means, that all energy is conserved, a Value of 0 means infinit friction.
+ */
+void ParticleSystem::setConserve(float conserve)
+{
+  if (conserve > 1.0)
+    this->conserve = 1.0;
+  else if (conserve < 0.0)
+    this->conserve = 0.0;
+  else
+    this->conserve = conserve;
+
+  PRINTF(4)("Conserve of %s::%s is %f\n", this->getClassCName(), this->getCName(), conserve);
+}
+
+/////////////////////////////
+/* Per-Particle Attributes */
+/////////////////////////////
+/**
+ * @brief sets a key in the radius-animation on a per-particle basis
+ * @param lifeCycleTime the time (partilceLifeTime/particleAge) [0-1]
+ * @param radius the radius at this position
+ * @param randRadius the randRadius at this position
+*/
+void ParticleSystem::setRadius(float lifeCycleTime, float radius, float randRadius)
+{
+  this->radiusAnim.changeValue(lifeCycleTime, radius);
+  this->randRadiusAnim.changeValue(lifeCycleTime, randRadius);
+
+  PRINTF(4)("Radius of %s::%s at timeSlice %f is %f with a Random of %f\n",
+    this->getClassCName(), this->getCName(), lifeCycleTime, radius, randRadius);
+}
+
+/**
+ * @brief sets a key in the mass-animation on a per-particle basis
+ * @param lifeCycleTime the time (partilceLifeTime/particleAge) [0-1]
+ * @param mass the mass at this position
+ * @param randMass the randomMass at this position
+*/
+void ParticleSystem::setMass(float lifeCycleTime, float mass, float randMass)
+{
+  this->massAnim.changeValue(lifeCycleTime, mass);
+  this->randMassAnim.changeValue(lifeCycleTime, randMass);
+}
+
+/**
+ * @brief sets a key in the color-animation on a per-particle basis
+ * @param lifeCycleTime: the time (partilceLifeTime/particleAge) [0-1]
+ * @param red: red
+ * @param green: green
+ * @param blue: blue
+ * @param alpha: alpha
+*/
+void ParticleSystem::setColor(float lifeCycleTime, float red, float green, float blue, float alpha)
+{
+  this->colorAnim[0].changeValue(lifeCycleTime, red);
+  this->colorAnim[1].changeValue(lifeCycleTime, green);
+  this->colorAnim[2].changeValue(lifeCycleTime, blue);
+  this->colorAnim[3].changeValue(lifeCycleTime, alpha);
+
+  PRINTF(4)("Color of %s::%s on timeslice %f is r:%f g:%f b:%f a:%f\n",
+    this->getClassCName(), this->getCName(), lifeCycleTime, red, green, blue, alpha);
+}
+
+/**
+ * @brief sets a key in the color-animation on a per-particle basis
+ * @param lifeCycleTime: the time (partilceLifeTime/particleAge) [0-1]
+ * @param color the Color.
+ */
+void ParticleSystem::setColor(float lifeCycleTime, const Color& color)
+{
+  this->setColor(lifeCycleTime, color.r(), color.g(), color.b(), color.a());
+}
+
+
+/**
+ * @brief adds an Emitter to this System.
+ * @param emitter the Emitter to add.
+ */
+void ParticleSystem::addEmitter(ParticleEmitter* emitter)
+{
+  assert (emitter != NULL);
+  if (emitter->getSystem() != NULL)
+    emitter->getSystem()->removeEmitter(emitter);
+  emitter->system = this;
+  this->emitters.push_back(emitter);
+}
+
+/**
+ * @brief removes a ParticleEmitter from this System
+ * @param emitter the Emitter to remove
+ */
+void ParticleSystem::removeEmitter(ParticleEmitter* emitter)
+{
+  assert (emitter != NULL);
+  emitter->system = NULL;
+  this->emitters.remove(emitter);
+  /*  std::list<ParticleEmitter*>::iterator it = std::find(this->emitters.begin(), this->emitters.end(), emitter);
+  if (it != this->emitters.end())
+    this->emitters.erase(it);*/
+}
+
+/**
+ * @brief does a Precaching, meaning, that the ParticleSystem(and its emitters) will be ticked force
+ * @param seconds: seconds
+ * @param ticksPerSeconds times per Second.
+ */
+void ParticleSystem::precache(unsigned int seconds, unsigned int ticksPerSecond)
+{
+  std::list<ParticleEmitter*>::iterator emitter;
+  for (emitter = this->emitters.begin(); emitter != this->emitters.end(); emitter++)
+    (*emitter)->updateNode(.1), (*emitter)->updateNode(.1);
+
+  PRINTF(4)("Precaching %s::%s %d seconds %d timesPerSecond\n", this->getClassCName(), this->getCName(), seconds, ticksPerSecond);
+  for (unsigned int i = 0; i < seconds*ticksPerSecond; i++)
+    this->tick(1.0/(float)ticksPerSecond);
+}
+
+
+/**
+ * @brief ticks the system.
+ * @param dt the time to tick all the Particles of the System
+
+   this is used to get all the particles some motion
+*/
+void ParticleSystem::tick(float dt)
+{
+  Particle* tickPart = particles;  // the particle to Tick
+  Particle* prevPart = NULL;
+  while (likely(tickPart != NULL))
+  {
+    // applying force to the System.
+    if (likely (tickPart->mass > 0.0))
+      tickPart->velocity += tickPart->extForce / tickPart->mass * dt;
+
+    tickPart->radius = radiusAnim.getValue(tickPart->lifeCycle)
+                       + randRadiusAnim.getValue(tickPart->lifeCycle) * tickPart->radiusRand;
+
+    tickPart->mass = massAnim.getValue(tickPart->lifeCycle)
+                     + randMassAnim.getValue(tickPart->lifeCycle) * tickPart->massRand;
+
+    tickPart->extForce = Vector(0,0,0);
+
+    // applying Color
+    this->colorAnim[0].getValue(tickPart->color[0], tickPart->lifeCycle);
+    this->colorAnim[1].getValue(tickPart->color[1], tickPart->lifeCycle);
+    this->colorAnim[2].getValue(tickPart->color[2], tickPart->lifeCycle);
+    this->colorAnim[3].getValue(tickPart->color[3], tickPart->lifeCycle);
+
+    // rendering new position.
+    tickPart->position += tickPart->velocity * dt;
+    tickPart->orientation *= tickPart->momentum *dt;
+
+    // many more to come
+
+    if (this->conserve < 1.0)
+    {
+      tickPart->velocity *= this->conserve;
+      tickPart->momentum *= this->conserve;
+    }
+    // find out if we have to delete tickPart
+    if (unlikely((tickPart->lifeCycle += dt/tickPart->lifeTime) >= 1.0))
+    {
+      // remove the particle from the list
+      if (likely(prevPart != NULL))
+      {
+        prevPart->next = tickPart->next;
+        tickPart->next = this->deadList;
+        this->deadList = tickPart;
+        tickPart = prevPart->next;
+      }
+      else
+      {
+        prevPart = NULL;
+        this->particles = tickPart->next;
+        tickPart->next = this->deadList;
+        this->deadList = tickPart;
+        tickPart = this->particles;
+      }
+      --this->count;
+    }
+    else
+    {
+      prevPart = tickPart;
+      tickPart = tickPart->next;
+    }
+  }
+
+  std::list<ParticleEmitter*>::iterator emitter;
+  for (emitter = this->emitters.begin(); emitter != this->emitters.end(); emitter++)
+    (*emitter)->tick(dt);
+}
+
+/**
+  *  applies some force to a Particle.
+  * @param field the Field to apply.
+ */
+void ParticleSystem::applyField(const Field* field)
+{
+  Particle* tickPart = particles;
+  while (tickPart)
+  {
+    tickPart->extForce += field->calcForce(tickPart->position);
+    tickPart = tickPart->next;
+  }
+}
+
+
+/**
+ * @returns the count of Faces of this ParticleSystem
+ */
+unsigned int ParticleSystem::getFaceCount() const
+{
+  return this->count;
+}
+
+/**
+ * @brief adds a new Particle to the System
+ * @param position the initial position, where the particle gets emitted.
+ * @param velocity the initial velocity of the particle.
+ * @param orientation the initial orientation of the Paritcle.
+ * @param momentum the initial momentum of the Particle (the speed of its rotation).
+ * @param data some more data given by the emitter
+*/
+void ParticleSystem::addParticle(const Vector& position, const Vector& velocity, const Quaternion& orientation, const Quaternion& momentum, unsigned int data)
+{
+  if (this->count <= this->maxCount)
+  {
+    // if it is the first Particle
+    if (unlikely(particles == NULL))
+    {
+      if (likely(deadList != NULL))
+      {
+        this->particles = this->deadList;
+        deadList = deadList->next;
+      }
+      else
+      {
+        PRINTF(5)("Generating new Particle\n");
+        this->particles = new Particle;
+      }
+      this->particles->next = NULL;
+    }
+    // filling the List from the beginning
+    else
+    {
+      Particle* tmpPart;
+      if (likely(deadList != NULL))
+      {
+        tmpPart = this->deadList;
+        deadList = deadList->next;
+      }
+      else
+      {
+        PRINTF(5)("Generating new Particle\n");
+        tmpPart = new Particle;
+      }
+      tmpPart->next = this->particles;
+      this->particles = tmpPart;
+    }
+    particles->lifeTime = this->lifeSpan + (float)(rand()/RAND_MAX)* this->randomLifeSpan;
+    particles->lifeCycle = 0.0;
+    particles->position = position;
+    particles->velocity = velocity;
+
+    particles->orientation = orientation;
+    particles->momentum = momentum;
+
+    //  particle->rotation = ; //! @todo rotation is once again something to be done.
+    particles->massRand = 2*(float)rand()/RAND_MAX -1;
+    particles->radiusRand = 2* (float)rand()/RAND_MAX -1;
+    particles->mass = this->massAnim.getValue(0.0) + this->randMassAnim.getValue(0.0)*particles->massRand;
+    particles->radius = this->radiusAnim.getValue(0.0) + this->randRadiusAnim.getValue(0.0)*particles->radiusRand;
+
+    ++this->count;
+  }
+  else
+    PRINTF(4)("maximum count of particles reached not adding any more\n");
+}
+
+/**
+ *  outputs some nice debug information
+*/
+void ParticleSystem::debug() const
+{
+  PRINT(0)("  ParticleCount: %d emitters: %d, maximumCount: %d :: filled %d%%\n",
+           this->count,
+           this->emitters.size(),
+           this->maxCount,
+           ((this->maxCount!=0)?100*this->count/this->maxCount:0));
+
+
+  PRINT(0)("  Coloring sceme: r:"), this->colorAnim[0].debug();
+  PRINT(0)("  Coloring sceme: g:"), this->colorAnim[1].debug();
+  PRINT(0)("  Coloring sceme: b:"), this->colorAnim[2].debug();
+  PRINT(0)("  Coloring sceme: a:"), this->colorAnim[3].debug();
+
+  if (likely(this->deadList != NULL))
+  {
+    PRINT(0)("  - ParticleDeadList is used: ");
+    int i = 1;
+    Particle* tmpPart = this->deadList;
+    while ((tmpPart = tmpPart->next) != NULL) { ++i; }
+    PRINT(0)("count: %d\n", i);
+  }
+}
Index: trunk/src/world_entities/particles/particle_system.h
===================================================================
--- trunk/src/world_entities/particles/particle_system.h	(revision 9869)
+++ trunk/src/world_entities/particles/particle_system.h	(revision 9869)
@@ -0,0 +1,133 @@
+/*!
+ * @file particle_system.h
+
+*/
+
+#ifndef _PARTICLE_SYSTEM_H
+#define _PARTICLE_SYSTEM_H
+
+#include "world_entity.h"
+#include "physics_interface.h"
+
+#include "glincl.h"
+#include "vector.h"
+#include <list>
+#include "color.h"
+
+#include "quick_animation.h"
+
+// Forward Declaration
+class TiXmlElement;
+
+#define PARTICLE_DOT_MASK              0x000001     //!< A Mask if the Particles should be displayed as DOTs
+#define PARTICLE_SPARK_MASK            0x000010     //!< A Mask if the Particles should be displayed as SPARKs
+#define PARTICLE_SPRITE_MASK           0x000100     //!< A Mask if the Particles should be displayed as SPRITESs
+#define PARTICLE_MODEL_MASK            0x001000     //!< A Mask if the Particles should be displayed as MODELSs
+#define PARTICLE_WORDL_ENTITY_MASK     0x010000     //!< A Mask if the Particles should be displayed as WORLD_ENTITIEs
+#define PARTICLE_MULTI_MASK            0x100000     //!< A Mask if they are Multi-partilces
+
+#define PARTICLE_DEFAULT_MAX_COUNT    200               //!< A default count of particles in the system.
+
+// FORWARD DECLARATION
+class Material;
+class ParticleEmitter;
+class Field;
+
+//! A struct for one Particle
+typedef struct Particle
+{
+  float         lifeTime;            //!< The time this particle has to live.
+  float         lifeCycle;           //!< The fraction of time passed. (in percentage of its lifeTime)
+
+  Vector        position;            //!< The current position of this particle.
+  Vector        velocity;            //!< The current velocity of this Particle.
+  Vector        extForce;            //!< The external Force that influences this Particle.
+  Quaternion    orientation;         //!< The current orientation of this Particle.
+  Quaternion    momentum;            //!< The current angular momentum (spin) of this Particle.
+  float         mass;                //!< The mass of this Particle.
+  float         massRand;            //!< A random mass
+  float         radius;              //!< The current size of this Particle.
+  float         radiusRand;          //!< a random Radius
+  GLfloat       color [4];           //!< A Color for the particles.
+
+  Particle*     next;                //!< pointer to the next particle in the List. (NULL if no preceding one)
+};
+
+//! A class to handle ParticleSystems
+class ParticleSystem : public WorldEntity, public PhysicsInterface {
+  ObjectListDeclaration(ParticleSystem);
+
+ public:
+  ParticleSystem(unsigned int maxCount = PARTICLE_DEFAULT_MAX_COUNT);
+  virtual ~ParticleSystem();
+
+  virtual void loadParams(const TiXmlElement* root);
+  void loadEmitters(const TiXmlElement* root);
+
+  void setLifeSpan(float lifeSpan, float randomLifeSpan = 0.0);
+  void setConserve(float conserve);
+  void setMaxCount(unsigned int maxCount);
+
+  /* Per-Particle-Attributes */
+  void setRadius(float lifeCycleTime, float radius, float randRadius = 0.0);
+  void setMass(float lifeCycleTime, float mass, float randMass = 0.0);
+  void setColor(float lifeCycleTime, float red, float green, float blue, float alpha);
+  void setColor(float lifeCycleTime, const Color& color);
+
+  /** @returns the lifespan of the particles */
+  inline float getLifeSpan() const { return this->lifeSpan; };
+  /** @returns the starting-radius of the particles */
+  inline float getStartRadius() { return this->radiusAnim.getValue(0.0); };
+  /** @returns the end-radius of the particles */
+  inline float getEndRadius() { return this->radiusAnim.getValue(1.0); };
+  /** @returns the conserve-factor of the particles */
+  inline float getConserve() const { return this->conserve; };
+  /** @returns the initial mass of the particles */
+  inline float getMass() const { return this->initialMass; };
+
+  /** @returns the count of particles in this System */
+  inline unsigned int getCount() const { return this->count; };
+  /** @returns the maximum count of particles that can be contained by this System */
+  inline unsigned int getMaxCount() const { return this->maxCount; };
+
+  virtual unsigned int getFaceCount() const;
+
+  void addEmitter(ParticleEmitter* emitter);
+  void removeEmitter(ParticleEmitter* emitter);
+
+  virtual void applyField(const Field* field);
+  /** @brief this is an empty function, because the Physics are implemented in tick @param dt: useless here */
+  virtual void tickPhys(float dt) {};
+
+  void addParticle(const Vector& position, const Vector& velocity, const Quaternion& orientation, const Quaternion& momentum, unsigned int data = 0);
+
+  void precache(unsigned int seconds, unsigned int ticksPerSecond = 25);
+
+  virtual void tick(float dt);
+  virtual void draw() const = 0;
+
+  void debug() const;
+
+ protected:
+  float             conserve;            //!< How much energy gets conserved to the next Tick.
+  float             lifeSpan;            //!< Initial lifetime of a Particle.
+  float             randomLifeSpan;      //!< A random value for the Lifespan (around the initial lifetime)
+  float             initialMass;         //!< The initial Mass of the Particle
+  float             randomInitialMass;   //!< The random initial Mass of the Particle
+
+  unsigned int      maxCount;            //!< The maximum count of Particles.
+  unsigned int      count;               //!< The current count of Particles.
+  Particle*         particles;           //!< A list of particles of this System.
+  Particle*         deadList;            //!< A list of dead Particles in the System.
+
+  std::list<ParticleEmitter*> emitters;  //!< The Emitters that do emit into this System.
+
+  // per particle attributes
+  QuickAnimation    radiusAnim;          //!< Animation of the radius
+  QuickAnimation    randRadiusAnim;      //!< Animation of the random Value of the radius
+  QuickAnimation    massAnim;            //!< Animation of the mass
+  QuickAnimation    randMassAnim;        //!< Animation of the random Mass
+  QuickAnimation    colorAnim[4];        //!< Animation of the 4 colors (r,g,b,a)
+};
+
+#endif /* _PARTICLE_SYSTEM_H */
Index: trunk/src/world_entities/particles/plane_emitter.cc
===================================================================
--- trunk/src/world_entities/particles/plane_emitter.cc	(revision 9869)
+++ trunk/src/world_entities/particles/plane_emitter.cc	(revision 9869)
@@ -0,0 +1,116 @@
+/*
+   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: Patrick Boenzli
+*/
+
+#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_GRAPHICS
+
+#include "plane_emitter.h"
+
+#include "particle_system.h"
+
+#include "util/loading/load_param.h"
+#include "util/loading/factory.h"
+#include "debug.h"
+
+#include "class_id_DEPRECATED.h"
+
+ObjectListDefinitionID(PlaneEmitter, CL_PLANE_EMITTER);
+CREATE_FACTORY(PlaneEmitter);
+
+/**
+ *  standard constructor
+*/
+PlaneEmitter::PlaneEmitter(const Vector2D& size, float emissionRate, float velocity, float angle)
+    :  ParticleEmitter(emissionRate, velocity, angle)
+{
+  this->init();
+  this->setSize(size);
+}
+
+/**
+ *  constructs and loads a PlaneEmitter from a XML-element
+ * @param root the XML-element to load from
+*/
+PlaneEmitter::PlaneEmitter(const TiXmlElement* root)
+    : ParticleEmitter()
+{
+  this->init();
+
+  if (root != NULL)
+    this->loadParams(root);
+}
+
+/**
+ *  standard destructor
+
+   removes the EmitterSystem from the ParticleEngine
+*/
+PlaneEmitter::~PlaneEmitter ()
+{
+  this->setSystem(NULL);
+}
+
+/**
+  @brief initializes default values of a ParitcleEmitter
+*/
+void PlaneEmitter::init()
+{
+  this->registerObject(this, PlaneEmitter::_objectList);
+  this->setSize(1.0f, 1.0f);
+}
+
+void PlaneEmitter::loadParams(const TiXmlElement* root)
+{
+  ParticleEmitter::loadParams(root);
+
+  LoadParam(root, "size", this, PlaneEmitter, setSize)
+  .describe("The Size of the PlaneEmitter: x, y")
+  .defaultValues(1.0f,1.0f);
+}
+
+void PlaneEmitter::setSize(float x, float y)
+{
+  this->size = Vector2D(x, y);
+}
+
+
+void PlaneEmitter::emitParticles(unsigned int count) const
+{
+  Vector inheritVelocity = this->getVelocity() * this->inheritSpeed;
+
+  Vector xDir = this->getAbsDirX() * this->size.x;
+  Vector yDir = this->getAbsDirZ() * this->size.y;
+  Vector zDir = this->getAbsDirY();
+
+  for (unsigned int i = 0; i < count; i++)
+  {
+    Vector randDir = Vector(rand()-RAND_MAX/2, rand()-RAND_MAX/2, rand()-RAND_MAX/2);
+    randDir.normalize();
+    randDir = (Quaternion(angle + randomAngle *((float)rand()/RAND_MAX -.5), randDir)).apply(zDir);
+    Vector velocityV = randDir.getNormalized()*this->velocity + inheritVelocity;
+
+    Vector plane = this->getAbsCoor() +
+        xDir * ((float)rand()/RAND_MAX -.5) +
+        yDir * ((float)rand()/RAND_MAX -.5);
+
+    // ROTATIONAL CALCULATION (this must not be done for all types of particles.)
+    randDir = Vector(rand()-RAND_MAX/2, rand()-RAND_MAX/2, rand()-RAND_MAX/2);
+    randDir.normalize();
+    Quaternion orient = Quaternion(M_PI, randDir);
+    Quaternion moment = Quaternion(this->momentum + this->momentumRandom, randDir);
+
+    this->getSystem()->addParticle(plane, velocityV, orient, moment);
+
+  }
+}
Index: trunk/src/world_entities/particles/plane_emitter.h
===================================================================
--- trunk/src/world_entities/particles/plane_emitter.h	(revision 9869)
+++ trunk/src/world_entities/particles/plane_emitter.h	(revision 9869)
@@ -0,0 +1,49 @@
+/*!
+ * @file plane_emitter.h
+ * Definition of a PlaneEmitter
+ */
+
+#ifndef _PLANE_EMITTER_H
+#define _PLANE_EMITTER_H
+
+#include "particle_emitter.h"
+
+#include "vector2D.h"
+
+#define PLANE_EMITTER_DEFAULT_SIZE Vector2D(1.0f, 1.0f)
+
+//! A class to handle a Plane Emitter.
+/**
+ * A Plane Emitter is a special kind of emitter, that has the (underlying) PNode
+ * at its center, and from there on is a Plane in the Direction of the PNode
+ * out around size in the corresponding directions in x and z
+ */
+class PlaneEmitter : public ParticleEmitter
+{
+  ObjectListDeclaration(PlaneEmitter);
+
+  friend class ParticleSystem;
+public:
+  PlaneEmitter(const Vector2D& size = PLANE_EMITTER_DEFAULT_SIZE,
+               float emissionRate = PARTICLE_EMITTER_DEFAULT_EMISSION_RATE,
+               float velocity = PARTICLE_EMITTER_DEFAULT_VELOCITY,
+               float angle = PARTICLE_EMITTER_DEFAULT_SPREAD);
+  PlaneEmitter(const TiXmlElement* root);
+  virtual ~PlaneEmitter();
+
+  virtual void loadParams(const TiXmlElement* root);
+
+  void setSize(float x, float y);
+  void setSize(const Vector2D& size) { this->setSize(size.x, size.y); };
+
+protected:
+  virtual void emitParticles(unsigned int count) const;
+
+private:
+  void init();
+
+private:
+  Vector2D      size;
+};
+
+#endif /* _PLANE_EMITTER_H */
Index: trunk/src/world_entities/particles/quick_animation.cc
===================================================================
--- trunk/src/world_entities/particles/quick_animation.cc	(revision 9869)
+++ trunk/src/world_entities/particles/quick_animation.cc	(revision 9869)
@@ -0,0 +1,316 @@
+/*
+   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: ...
+   co-programmer: ...
+*/
+
+//#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_
+
+#include "quick_animation.h"
+
+#include <algorithm>
+
+
+
+/**
+ * @brief standard constructor
+ * @param resolution the Resolution of the LookupTable
+ */
+QuickAnimation::QuickAnimation (unsigned int resolution)
+{
+  this->lookupValues.resize(resolution, 0.0f);
+}
+
+/**
+ * @brief deletes all the deconstructor stuff
+ */
+QuickAnimation::~QuickAnimation ()
+{ }
+
+/**
+ * @brief adds a new entry to the list of keyframes
+ * @param position the position to add the key to
+ * @param value the Value to set for the position
+ * @returns false if the key existed already for a given position
+ */
+bool QuickAnimation::addKey(float position, float value)
+{
+  if (position > 1.0f || position < 0.0f)
+  {
+    printf("QuickAnimation::Position MUST BE between 0.0f and 1.0f\n");
+    return false;
+  }
+  if(std::find(this->keyFrames.begin(), this->keyFrames.end(), position) != this->keyFrames.end())
+  {
+    printf("QuickAnimation:: key at position %f already added. Use changeValue instead\n", position);
+    return false;
+  }
+  this->keyFrames.push_back(QuickKeyFrame(position, value));
+
+  this->rebuild();
+  return true;
+}
+
+
+/**
+ * @brief changes an entry in the region of position
+ * @param position the Position of an existing keyframe
+ * @param region a deviation of the existing keyframe (like a delta in witch to search for)
+ * @param value the new Value
+ */
+bool QuickAnimation::changeValueKey(unsigned int keyFrameNumber, float newValue)
+{
+  if (keyFrameNumber < this->keyFrames.size())
+  {
+    this->keyFrames[keyFrameNumber].value = newValue;
+    this->rebuild();
+    return true;
+  }
+  else
+    return false;
+}
+
+/**
+ * @brief changes an entry in the region of position
+ * @param position the Position of an existing keyframe
+ * @param region a deviation of the existing keyframe (like a delta in witch to search for)
+ * @param value the new Value
+ *
+ * This Function adds a new KeyFrame at position with newValue, if none was found in region of position.
+ */
+bool QuickAnimation::changeValue(float position, float newValue, float region)
+{
+  int keyFrame = this->getKeyAt(position, region);
+  if (keyFrame == -1)
+    return this->addKey(position, newValue);
+  else
+    return this->changeValueKey(keyFrame, newValue);
+}
+
+
+/**
+ * @brief removes the keyFrameNumber'th entry.
+ * @param keyFrameNumber the n'th Keyframe to remove.
+ * @returns true on success, false if keyFrameNumber did not exist.
+ */
+bool QuickAnimation::removeKey(unsigned int keyFrameNumber)
+{
+  if (keyFrameNumber < this->keyFrames.size())
+  {
+    this->keyFrames.erase(this->keyFrames.begin() + keyFrameNumber);
+    this->rebuild();
+    return true;
+  }
+  else
+    return false;
+}
+
+
+/**
+ * @brief removes a KeyFrame from the List.
+ * @param position the Keyframe at position position will be erased.
+ * @param region a deviation of the existing keyframe (like a delta in witch to search for)
+ * @returns true on success, false if no KeyFrame was found.
+ */
+bool QuickAnimation::remove(float position, float region)
+{
+  int keyFrame = this->getKeyAt(position, region);
+  if (keyFrame == -1)
+    return false;
+  else
+    return this->removeKey(keyFrame);
+}
+
+/**
+ * @brief moves the keyFrame keyFrameNumber to newPosition/newValue.
+ * @param keyFrameNumber the n'th KeyFrame to move.
+ * @param newPosition the new Position for the KeyFrame.
+ * @param newValue the new Value for the KeyFrame.
+ * @returns true on success, false if the KeyFrame did not exist.
+ */
+bool QuickAnimation::moveKey(unsigned int keyFrameNumber, float newPosition, float newValue)
+{
+  if (keyFrameNumber < this->keyFrames.size())
+  {
+    this->keyFrames[keyFrameNumber].position = newPosition;
+    this->keyFrames[keyFrameNumber].value = newValue;
+    this->rebuild();
+    return true;
+  }
+  else
+    return false;
+}
+
+/**
+ * @brief moves the keyFrame keyFrameNumber to newPosition/value.
+ * @param keyFrameNumber the n'th KeyFrame to move.
+ * @param newPosition the new Position for the KeyFrame.
+ * @returns true on success, false if the KeyFrame did not exist.
+ */
+bool QuickAnimation::moveKey(unsigned int keyFrameNumber, float newPosition)
+{
+  if (keyFrameNumber < this->keyFrames.size())
+  {
+    this->keyFrames[keyFrameNumber].position = newPosition;
+    this->rebuild();
+    return true;
+  }
+  else
+    return false;
+}
+
+/**
+ * @brief moves the keyFrame in the region of oldPosition to newPosition/newValue.
+ * @param oldPosition the old Position for the KeyFrame.
+ * @param newPosition the new Position for the KeyFrame.
+ * @param newValue the new Value for the KeyFrame.
+ * @param region the region around oldPosition to search for the KeyFrame.
+ * @returns true on success, false if the KeyFrame was not found within the region of oldPosition.
+ */
+bool QuickAnimation::move(float oldPosition, float newPosition, float newValue, float region)
+{
+  int keyFrame = this->getKeyAt(oldPosition, region);
+  if (keyFrame == -1)
+    return false;
+  else
+    return this->moveKey(keyFrame, newPosition, newValue);
+}
+
+/**
+ * @brief moves the keyFrame in the region of oldPosition to newPosition/Value.
+ * @param oldPosition the old Position for the KeyFrame.
+ * @param newPosition the new Position for the KeyFrame.
+ * @param region the region around oldPosition to search for the KeyFrame.
+ * @returns true on success, false if the KeyFrame was not found within the region of oldPosition.
+ */
+bool QuickAnimation::move(float oldPosition, float newPosition, float region)
+{
+  int keyFrame = this->getKeyAt(oldPosition, region);
+  if (keyFrame == -1)
+    return false;
+  else
+    return this->moveKey(keyFrame, newPosition);
+}
+
+
+/**
+ * @brief searches for a Keyframe in the region of position
+ * @param position the Keyframe at position position will searched for.
+ * @param region a deviation of the existing keyframe (like a delta in witch to search for)
+ * @returns the keyFrame on success, -1 on fault.
+ */
+int QuickAnimation::getKeyAt(float position, float region)
+{
+  for (unsigned int i = 0; i < this->keyFrames.size(); i++)
+  {
+    if (this->keyFrames[i].position + region/2.0 > position && this->keyFrames[i].position - region/2.0 < position)
+      return i;
+  }
+  return -1;
+}
+
+
+/**
+ * @brief rebuilds the QuickAnimation.
+ */
+void QuickAnimation::rebuild()
+{
+  // if we do not have any KeyFrames
+  if (this->keyFrames.empty())
+  {
+    for (unsigned int i = 0; i < this->lookupValues.size(); i++)
+      this->lookupValues[i] = 0.0f;
+    return;
+  }
+
+  // Sort the List.
+  std::sort(this->keyFrames.begin(), this->keyFrames.end(), QuickKeyFrame::sortPositionPredicate);
+
+  // rebuild the lookup-table
+  float sliceSize = 1.0f / this->lookupValues.size();
+  unsigned int key = 0;
+  float preVal = this->keyFrames[0].value;
+  float prePos = this->keyFrames[0].position;
+
+  float postVal = preVal;
+  float postPos = 1.0;
+
+  if (this->keyFrames.size() > 1)
+  {
+    postVal = this->keyFrames[1].value;
+    postPos = this->keyFrames[1].position;
+  }
+
+
+  for (unsigned int i = 0; i < this->lookupValues.size(); i++)
+  {
+    float position = (float)i * sliceSize;
+
+    // if we reach the Next KeyFrame
+    if (position > postPos)
+    {
+      // if we have more KeyFrames.
+      if (this->keyFrames.size() > ++key + 1)
+      {
+        preVal = this->keyFrames[key].value;
+        prePos = this->keyFrames[key].position;
+        postVal = this->keyFrames[key+1].value;
+        postPos = this->keyFrames[key+1].position;
+      }
+      // otherwise we reached the last KeyFrame
+      else
+      {
+        preVal = postVal;
+        prePos = postPos;
+        postPos = 1.0;
+      }
+    }
+    this->lookupValues[i] = preVal + ( postVal - preVal) / (postPos - prePos) * (position - prePos);
+  }
+}
+
+/**
+ * @brief outputs some nice information about this class
+ */
+void QuickAnimation::debug() const
+{
+  printf("QuickAnim(KeyFrames:%d, Resolution:%d)::(position, value) ", this->keyFrames.size(), this->lookupValues.size());
+
+  for (unsigned int i = 0; i < this->keyFrames.size(); i++)
+    printf("(%0.2f, %0.2f)->", this->keyFrames[i].position, this->keyFrames[i].value);
+  printf("\n");
+}
+
+
+
+/**
+ * @brief compares two QuickKeyFrames with their positions.
+ * @param key1 the first keyframe
+ * @param key2 the second keyframe
+ * @returns true, if the key1.position < key2.position.
+ */
+bool QuickAnimation::QuickKeyFrame::sortPositionPredicate(const QuickKeyFrame& key1, const QuickKeyFrame& key2)
+{
+  return (key1.position < key2.position);
+}
+
+/**
+ * @brief compares two QuickKeyFrames with their values.
+ * @param key1 the first keyframe
+ * @param key2 the second keyframe
+ * @returns true, if the key1.value < key2.value.
+ */
+bool QuickAnimation::QuickKeyFrame::sortValuePredicate(const QuickKeyFrame& key1, const QuickKeyFrame& key2)
+{
+  return (key1.value < key2.value);
+}
+
Index: trunk/src/world_entities/particles/quick_animation.h
===================================================================
--- trunk/src/world_entities/particles/quick_animation.h	(revision 9869)
+++ trunk/src/world_entities/particles/quick_animation.h	(revision 9869)
@@ -0,0 +1,83 @@
+/*!
+ * @file quick_animation.h
+ * Definition of the QuickAnimation-class
+*/
+
+#ifndef _QUICK_ANIMATION_H
+#define _QUICK_ANIMATION_H
+
+#include <vector>
+// FORWARD DECLARATION
+
+//! A class for that linearely interpolates between multiple values.
+/**
+ * QuickAnimation is a Class that creates a LookupTable with
+ * position between [0.0f - 1.0f] so that one can resolve the
+ * given Value.
+ */
+class QuickAnimation
+{
+public:
+  QuickAnimation(unsigned int resolution = 100);
+  virtual ~QuickAnimation();
+
+  bool addKey(float position, float value);
+
+  bool changeValueKey(unsigned int keyFrameNumber, float newValue);
+  bool changeValue(float position, float newValue, float region = 0.04f);
+
+  bool removeKey(unsigned int keyFrameNumber);
+  bool remove(float position, float region = 0.04f);
+
+  bool moveKey(unsigned int keyFrameNumber, float newPosition, float newValue);
+  bool moveKey(unsigned int keyFrameNumber, float newPosition);
+  bool move(float oldPosition, float newPosition, float newValue, float region = 0.04f);
+  bool move(float oldPosition, float newPosition, float region = 0.04f);
+
+  int getKeyAt(float position, float region = 0.04f);
+
+  /**
+   * @brief returns the value of the animation at a certain position
+   * @param value returns the calculated value.
+   * @param position The position to get the Value from.
+   */
+  void getValue(float& value, float position) const
+  {
+    value = this->lookupValues[int(position*this->lookupValues.size())];
+  }
+
+  /**
+   * @brief returns the value of the animation at a certain position
+   * @param position the position to get the value from :)
+   * @returns the calculated Value.
+   */
+  float getValue(float position) const
+  {
+    return this->lookupValues[int(position*this->lookupValues.size())];
+  }
+
+  void debug() const;
+
+private:
+  void rebuild();
+
+private:
+  //! a simple struct that stores keyframes for the QuickAnimation-Class.
+  struct QuickKeyFrame
+  {
+    //! Creates a new QuickKeyFrame with @param position position @param value value */
+    QuickKeyFrame(float position, float value) :  position(position), value(value) {};
+    //! compares this->position with position @param position pos to compare, @returns true on match.
+    bool operator==(float position) { return this->position == position; };
+    float            position;          //!< The position of thies KeyFrame
+    float            value;             //!< The value of this KeyFrame
+
+    static bool sortPositionPredicate(const QuickKeyFrame& key1, const QuickKeyFrame& key2);
+    static bool sortValuePredicate(const QuickKeyFrame& key1, const QuickKeyFrame& key2);
+  };
+
+  std::vector<QuickKeyFrame>    keyFrames;              //!< An Array of KeyFrames.
+  std::vector<float>            lookupValues;           //!< The lookup-table where the values are stored.
+};
+
+#endif /* _QUICK_ANIMATION_H */
Index: trunk/src/world_entities/particles/spark_particles.cc
===================================================================
--- trunk/src/world_entities/particles/spark_particles.cc	(revision 9869)
+++ trunk/src/world_entities/particles/spark_particles.cc	(revision 9869)
@@ -0,0 +1,116 @@
+/*
+   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 "spark_particles.h"
+
+#include "util/loading/load_param.h"
+#include "util/loading/factory.h"
+#include "material.h"
+#include "state.h"
+#include "shell_command.h"
+
+#include "class_id_DEPRECATED.h"
+
+ObjectListDefinitionID(SparkParticles, CL_SPARK_PARTICLES);
+CREATE_FACTORY(SparkParticles);
+
+/**
+ *  standard constructor
+ * @param maxCount the Count of particles in the System
+ * @param type The Type of the SparkParticles
+*/
+SparkParticles::SparkParticles (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
+ */
+SparkParticles::SparkParticles(const TiXmlElement* root)
+{
+  this->init();
+
+  if (root != NULL)
+    this->loadParams(root);
+}
+
+/**
+ *  standard deconstructor
+*/
+SparkParticles::~SparkParticles()
+{ }
+
+/**
+ * @brief initializes the SparkParticles with default values
+*/
+void SparkParticles::init()
+{
+  this->registerObject(this, SparkParticles::_objectList);
+}
+
+
+/**
+ * loads Parameters from a TiXmlElement
+ * @param root the XML-element to load from.
+ */
+void SparkParticles::loadParams(const TiXmlElement* root)
+{
+  ParticleSystem::loadParams(root);
+}
+
+/**
+ * @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 SparkParticles::draw() const
+{
+
+  Particle* drawPart = particles;
+
+  glDepthMask(GL_FALSE);
+  glPushAttrib(GL_ENABLE_BIT);
+
+  glDisable(GL_LIGHTING);
+  glDisable(GL_TEXTURE_2D);
+
+  glEnable(GL_LINE_SMOOTH);
+  glEnable(GL_BLEND);
+  glBlendFunc(GL_SRC_ALPHA, GL_DST_ALPHA);
+
+  glLineWidth(2.0);
+  glBegin(GL_LINES);
+  while (likely(drawPart != NULL))
+  {
+  //    printf("%f %f %f %f\n", drawPart->color[0], drawPart->color[1], drawPart->color[2], drawPart->color[3]);
+    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();
+
+  glDepthMask(GL_TRUE);
+  glPopAttrib();
+}
Index: trunk/src/world_entities/particles/spark_particles.h
===================================================================
--- trunk/src/world_entities/particles/spark_particles.h	(revision 9869)
+++ trunk/src/world_entities/particles/spark_particles.h	(revision 9869)
@@ -0,0 +1,33 @@
+/*!
+ * @file spark_particles.h
+
+*/
+
+#ifndef _SPARK_PARTICLE_SYSTEM_H
+#define _SPARK_PARTICLE_SYSTEM_H
+
+#include "particle_system.h"
+#include "material.h"
+
+//! A class to handle ParticleSystems
+class SparkParticles : public ParticleSystem
+{
+  ObjectListDeclaration(SparkParticles);
+
+public:
+  SparkParticles(unsigned int maxCount = PARTICLE_DEFAULT_MAX_COUNT);
+  SparkParticles(const TiXmlElement* root);
+  virtual ~SparkParticles();
+
+  virtual void loadParams(const TiXmlElement* root);
+
+  virtual void draw() const;
+
+private:
+  void init();
+
+private:
+  Material          material;            //!< A Material for all the Particles.
+};
+
+#endif /* _SPARK_PARTICLE_SYSTEM_H */
Index: trunk/src/world_entities/particles/sprite_particles.cc
===================================================================
--- trunk/src/world_entities/particles/sprite_particles.cc	(revision 9869)
+++ trunk/src/world_entities/particles/sprite_particles.cc	(revision 9869)
@@ -0,0 +1,173 @@
+/*
+   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 "util/loading/load_param.h"
+#include "util/loading/factory.h"
+#include "material.h"
+#include "state.h"
+#include "shell_command.h"
+
+#include "class_id_DEPRECATED.h"
+
+ObjectListDefinitionID(SpriteParticles, CL_SPRITE_PARTICLES);
+CREATE_FACTORY(SpriteParticles);
+
+SHELL_COMMAND(texture, SpriteParticles, setMaterialTexture)
+    ->defaultValues("maps/evil-flower.png");
+
+
+
+/**
+ *  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();
+  if (root != NULL)
+    this->loadParams(root);
+}
+
+/**
+ *  standard deconstructor
+*/
+SpriteParticles::~SpriteParticles()
+{ }
+
+/**
+ * @brief initializes the SpriteParticles with default values
+*/
+void SpriteParticles::init()
+{
+  this->registerObject(this, SpriteParticles::_objectList);
+
+  this->material.setDiffuseMap("maps/radial-trans-noise.png");
+}
+
+
+/**
+ * loads Parameters from a TiXmlElement
+ * @param root the XML-element to load from.
+ */
+void SpriteParticles::loadParams(const TiXmlElement* root)
+{
+  ParticleSystem::loadParams(root);
+
+  LoadParam(root, "texture", this, SpriteParticles, setMaterialTexture);
+}
+
+/**
+ * @brief sets the Texutre that is placed onto the particles
+ * @param textureFile the Texture to load onto these SpriteParticles
+ */
+void SpriteParticles::setMaterialTexture(const std::string& 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
+{
+
+  Particle* drawPart = particles;
+  this->material.select();
+
+  GLboolean checkLight = false;
+  glGetBooleanv(GL_LIGHTING, &checkLight);
+  glPushAttrib(GL_LIGHTING_BIT);
+  if (checkLight == GL_TRUE)
+    glDisable(GL_LIGHTING);
+
+  glDepthMask(GL_FALSE);
+  /*
+  glClearDepth(1.0);
+  glDepthFunc(GL_LEQUAL);
+  glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+  glEnable(GL_BLEND);
+  glAlphaFunc(GL_GREATER,0.1);
+  glEnable(GL_ALPHA_TEST);
+  glEnable(GL_TEXTURE_2D);
+  glEnable(GL_CULL_FACE);
+  */
+  //glDepthMask(GL_FALSE);
+//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::getCameraNode();  //!< @todo MUST be different
+    Vector cameraPos = camera->getAbsCoor();
+    Vector cameraTargetPos = State::getCameraTargetNode()->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/world_entities/particles/sprite_particles.h
===================================================================
--- trunk/src/world_entities/particles/sprite_particles.h	(revision 9869)
+++ trunk/src/world_entities/particles/sprite_particles.h	(revision 9869)
@@ -0,0 +1,38 @@
+/*!
+ * @file sprite_particles.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
+{
+  ObjectListDeclaration(SpriteParticles);
+
+public:
+  SpriteParticles(unsigned int maxCount = PARTICLE_DEFAULT_MAX_COUNT);
+  SpriteParticles(const TiXmlElement* root);
+  virtual ~SpriteParticles();
+
+  virtual void loadParams(const TiXmlElement* root);
+
+  void setMaterialTexture(const std::string& textureFile);
+
+  /** @returns the Material that lies on this particles */
+  inline const Material* getMaterial() const { return &this->material; };
+
+  virtual void draw() const;
+
+private:
+  void init();
+
+private:
+  Material          material;            //!< A Material for all the Particles.
+};
+
+#endif /* _SPRITE_PARTICLE_SYSTEM_H */
Index: trunk/src/world_entities/planet.cc
===================================================================
--- trunk/src/world_entities/planet.cc	(revision 9656)
+++ trunk/src/world_entities/planet.cc	(revision 9869)
@@ -30,9 +30,9 @@
 #include "primitive_model.h"
 
+#include "debug.h"
 
-
-
-CREATE_FACTORY(Planet, CL_PLANET);
-
+#include "class_id_DEPRECATED.h"
+ObjectListDefinitionID(Planet, CL_PLANET);
+CREATE_FACTORY(Planet);
 
 
@@ -42,5 +42,5 @@
 Planet::Planet(const TiXmlElement* root)
 {
-  this->setClassID(CL_PLANET, "Planet");
+  this->registerObject(this, Planet::_objectList);
   this->toList(OM_GROUP_01);
 
Index: trunk/src/world_entities/planet.h
===================================================================
--- trunk/src/world_entities/planet.h	(revision 9656)
+++ trunk/src/world_entities/planet.h	(revision 9869)
@@ -16,4 +16,6 @@
 class Planet : public WorldEntity
 {
+  ObjectListDeclaration(Planet);
+
  public:
   Planet(const TiXmlElement* root);
Index: trunk/src/world_entities/playable.cc
===================================================================
--- trunk/src/world_entities/playable.cc	(revision 9656)
+++ trunk/src/world_entities/playable.cc	(revision 9869)
@@ -30,6 +30,6 @@
 #include "game_rules.h"
 
-#include "dot_emitter.h"
-#include "sprite_particles.h"
+#include "particles/dot_emitter.h"
+#include "particles/sprite_particles.h"
 
 #include "shared_network_data.h"
@@ -41,5 +41,5 @@
 SHELL_COMMAND_STATIC(orxoWeapon, Playable, Playable::addSomeWeapons_CHEAT)
   ->setAlias("orxoWeapon");
-
+ObjectListDefinition(Playable);
 
 Playable::Playable()
@@ -48,5 +48,5 @@
     playmode(Playable::Full3D)
 {
-  this->setClassID(CL_PLAYABLE, "Playable");
+  this->registerObject(this, Playable::_objectList);
   PRINTF(4)("PLAYABLE INIT\n");
 
@@ -109,11 +109,12 @@
 bool Playable::pickup(PowerUp* powerUp)
 {
-  if(powerUp->isA(CL_WEAPON_POWER_UP))
-  {
-    return dynamic_cast<WeaponPowerUp*>(powerUp)->process(&this->getWeaponManager());
-  }
-  else if(powerUp->isA(CL_PARAM_POWER_UP))
-  {
-    ParamPowerUp* ppu = dynamic_cast<ParamPowerUp*>(powerUp);
+  /// FIXME TOTALLY
+  if(powerUp->isA(WeaponPowerUp::staticClassID()))
+  {
+    return static_cast<WeaponPowerUp*>(powerUp)->process(&this->getWeaponManager());
+  }
+  else if(powerUp->isA(ParamPowerUp::staticClassID()))
+  {
+    ParamPowerUp* ppu = static_cast<ParamPowerUp*>(powerUp);
     switch(ppu->getType())
     {
@@ -213,9 +214,9 @@
     {
       PRINTF(2)("ADDING WEAPONS - you cheater\n");
-      playable->addWeapon(Weapon::createWeapon(CL_HYPERBLASTER));
-      playable->addWeapon(Weapon::createWeapon(CL_TURRET));
-      playable->addWeapon(Weapon::createWeapon(CL_AIMING_TURRET));
-      playable->addWeapon(Weapon::createWeapon(CL_CANNON));
-      playable->addWeapon(Weapon::createWeapon(CL_TARGETING_TURRET));
+      playable->addWeapon(Weapon::createWeapon("Hyperblaster"));
+      playable->addWeapon(Weapon::createWeapon("Turret"));
+      playable->addWeapon(Weapon::createWeapon("AimingTurret"));
+      playable->addWeapon(Weapon::createWeapon("Cannon"));
+      playable->addWeapon(Weapon::createWeapon("TargetingTurret"));
       PRINTF(2)("ADDING WEAPONS FINISHED\n");
     }
Index: trunk/src/world_entities/playable.h
===================================================================
--- trunk/src/world_entities/playable.h	(revision 9656)
+++ trunk/src/world_entities/playable.h	(revision 9869)
@@ -27,4 +27,5 @@
 class Playable : public WorldEntity, public Extendable
 {
+  ObjectListDeclaration(Playable);
 public:
   //! Defines the Playmode of an Entity.
Index: trunk/src/world_entities/player.cc
===================================================================
--- trunk/src/world_entities/player.cc	(revision 9656)
+++ trunk/src/world_entities/player.cc	(revision 9869)
@@ -19,6 +19,4 @@
 #include "event_handler.h"
 
-
-#include "class_list.h"
 #include "state.h"
 #include "util/hud.h"
@@ -26,5 +24,5 @@
 #include "debug.h"
 
-
+ObjectListDefinition(Player);
 /**
  * creates a new Player
@@ -33,5 +31,5 @@
 {
   //  this->setRelDir(Quaternion(M_PI, Vector(1,0,0)));
-  this->setClassID(CL_PLAYER, "Player");
+  this->registerObject(this, Player::_objectList);
 
   PRINTF(4)("PLAYER INIT\n");
@@ -94,8 +92,8 @@
 
 
- void Player::weaponConfigChanged()
- {
-   this->_hud.updateWeaponManager();
- }
+void Player::weaponConfigChanged()
+{
+  this->_hud.updateWeaponManager();
+}
 
 
@@ -103,17 +101,16 @@
 {
   /// FIXME this should be in the ObjectManager
-  const std::list<BaseObject*>* objectList = ClassList::getList(CL_PLAYABLE);
-  if (objectList != NULL)
+  for (ObjectList<Playable>::const_iterator node = Playable::objectList().begin();
+       node != Playable::objectList().end();
+       ++node)
   {
-    std::list<BaseObject*>::const_iterator node;
-    for (node = objectList->begin(); node != objectList->end(); node++)
-      if (this->playable != (*node) &&
-          (dynamic_cast<PNode*>(*node)->getAbsCoor() - this->playable->getAbsCoor()).len() < (dynamic_cast<Playable*>(*node)->getEnterRadius()))
-      {
+    if (this->playable != (*node) &&
+        ((*node)->getAbsCoor() - this->playable->getAbsCoor()).len() < ((*node)->getEnterRadius()))
+    {
 
-        this->setPlayable(dynamic_cast<Playable*>(*node));
+      this->setPlayable(*(node));
 
-        break;
-      }
+      break;
+    }
   }
 }
Index: trunk/src/world_entities/player.h
===================================================================
--- trunk/src/world_entities/player.h	(revision 9656)
+++ trunk/src/world_entities/player.h	(revision 9869)
@@ -23,4 +23,5 @@
 class Player : public EventListener
 {
+  ObjectListDeclaration(Player);
 
   public:
@@ -31,5 +32,5 @@
     bool              eject();
     inline Playable*  getPlayable() const  { return this->playable; };
-    
+
 
      inline Hud& hud() { return this->_hud; };
Index: trunk/src/world_entities/power_ups/laser_power_up.cc
===================================================================
--- trunk/src/world_entities/power_ups/laser_power_up.cc	(revision 9656)
+++ trunk/src/world_entities/power_ups/laser_power_up.cc	(revision 9869)
@@ -24,6 +24,7 @@
 
 
-
-CREATE_FACTORY(LaserPowerUp, CL_LASER_POWER_UP);
+#include "class_id_DEPRECATED.h"
+ObjectListDefinitionID(LaserPowerUp, CL_LASER_POWER_UP);
+CREATE_FACTORY(LaserPowerUp);
 
 LaserPowerUp::LaserPowerUp () : PowerUp(0.0, 1.0, 0.0)
@@ -49,5 +50,5 @@
 void LaserPowerUp::init()
 {
-  this->setClassID(CL_LASER_POWER_UP, "LaserPowerUp");
+  this->registerObject(this, LaserPowerUp::_objectList);
   this->loadModel("models/guns/test_gun.obj", 2.0);
 
Index: trunk/src/world_entities/power_ups/laser_power_up.h
===================================================================
--- trunk/src/world_entities/power_ups/laser_power_up.h	(revision 9656)
+++ trunk/src/world_entities/power_ups/laser_power_up.h	(revision 9869)
@@ -13,4 +13,5 @@
 
 class LaserPowerUp : public PowerUp {
+  ObjectListDeclaration(LaserPowerUp);
 
  public:
@@ -22,5 +23,5 @@
 
 
-  virtual void LaserPowerUp::collidesWith(WorldEntity* entity, const Vector& location);
+  virtual void collidesWith(WorldEntity* entity, const Vector& location);
   virtual void tick(float dt);
   virtual void draw() const;
Index: trunk/src/world_entities/power_ups/param_power_up.cc
===================================================================
--- trunk/src/world_entities/power_ups/param_power_up.cc	(revision 9656)
+++ trunk/src/world_entities/power_ups/param_power_up.cc	(revision 9869)
@@ -27,6 +27,7 @@
 
 
-
-CREATE_FACTORY(ParamPowerUp, CL_PARAM_POWER_UP);
+#include "class_id_DEPRECATED.h"
+ObjectListDefinitionID(ParamPowerUp, CL_PARAM_POWER_UP);
+CREATE_FACTORY(ParamPowerUp);
 
 const char* ParamPowerUp::paramTypes[] = {
@@ -58,5 +59,5 @@
 void ParamPowerUp::init()
 {
-  this->setClassID(CL_PARAM_POWER_UP, "ParamPowerUp");
+  this->registerObject(this, ParamPowerUp::_objectList);
   this->value = 0;
   this->max_value = 0;
Index: trunk/src/world_entities/power_ups/param_power_up.h
===================================================================
--- trunk/src/world_entities/power_ups/param_power_up.h	(revision 9656)
+++ trunk/src/world_entities/power_ups/param_power_up.h	(revision 9869)
@@ -20,4 +20,5 @@
 
 class ParamPowerUp : public PowerUp {
+  ObjectListDeclaration(ParamPowerUp);
 
 public:
Index: trunk/src/world_entities/power_ups/power_up.cc
===================================================================
--- trunk/src/world_entities/power_ups/power_up.cc	(revision 9656)
+++ trunk/src/world_entities/power_ups/power_up.cc	(revision 9869)
@@ -21,12 +21,14 @@
 #include "primitive_model.h"
 
-#include "util/loading/resource_manager.h"
+#include "sound/resource_sound_buffer.h"
 #include "util/loading/load_param.h"
 
+#include "debug.h"
 
+ObjectListDefinition(PowerUp);
 
 PowerUp::PowerUp(float r, float g, float b)
 {
-  this->setClassID(CL_POWER_UP, "PowerUp");
+  this->registerObject(this, PowerUp::_objectList);
 
   this->respawnType = RESPAWN_TIME;
@@ -45,6 +47,4 @@
 
   this->soundSource.setSourceNode(this);
-  this->pickupBuffer = NULL;
-  this->respawnBuffer = NULL;
 
   this->collider = NULL;
@@ -54,8 +54,4 @@
 {
   delete this->sphereMaterial;
-  if (this->pickupBuffer != NULL)
-    ResourceManager::getInstance()->unload(this->pickupBuffer);
-  if (this->respawnBuffer != NULL)
-    ResourceManager::getInstance()->unload(this->respawnBuffer);
 }
 
@@ -77,42 +73,16 @@
 void PowerUp::loadPickupSound(const std::string& pickupSound)
 {
-  if (this->pickupBuffer != NULL)
-    ResourceManager::getInstance()->unload(this->pickupBuffer);
-
-  else if (!pickupSound.empty())
-  {
-    this->pickupBuffer = (OrxSound::SoundBuffer*)ResourceManager::getInstance()->load(pickupSound, WAV);
-    if (this->pickupBuffer != NULL)
-    {
-      PRINTF(4)("Loaded sound %s to Pickup: %s.\n", pickupSound.c_str(), this->getCName());
-    }
-    else
-    {
-      PRINTF(2)("Failed to load sound %s to pickup %s.\n.", pickupSound.c_str(), this->getCName());
-    }
-  }
+  if (!pickupSound.empty())
+    this->pickupBuffer = OrxSound::ResourceSoundBuffer(pickupSound);
   else
-    this->pickupBuffer = NULL;
+    this->pickupBuffer = OrxSound::SoundBuffer();
 }
 
 void PowerUp::loadRespawnSound(const std::string& respawnSound)
 {
-  if (this->respawnBuffer != NULL)
-    ResourceManager::getInstance()->unload(this->respawnBuffer);
-
-  else if (!respawnSound.empty())
-  {
-    this->respawnBuffer = (OrxSound::SoundBuffer*)ResourceManager::getInstance()->load(respawnSound, WAV);
-    if (this->respawnBuffer != NULL)
-    {
-      PRINTF(4)("Loaded sound %s to Pickup: %s.\n", respawnSound.c_str(), this->getCName());
-    }
-    else
-    {
-      PRINTF(2)("Failed to load sound %s to respawn %s.\n.", respawnSound.c_str(), this->getCName());
-    }
-  }
+  if (!respawnSound.empty())
+    this->respawnBuffer = OrxSound::ResourceSoundBuffer(respawnSound);
   else
-    this->respawnBuffer = NULL;
+    this->respawnBuffer = OrxSound::SoundBuffer();
 }
 
@@ -120,10 +90,10 @@
 void PowerUp::collidesWith (WorldEntity* entity, const Vector& location)
 {
-  if(this->collider != entity && entity->isA(CL_EXTENDABLE))
+  if(this->collider != entity && entity->isA(Extendable::staticClassID()))
   {
     this->collider = entity;
     if(dynamic_cast<Extendable*>(entity)->pickup(this))
     {
-      if(pickupBuffer != NULL)
+      if(pickupBuffer.loaded())
         this->soundSource.play(this->pickupBuffer);
 
@@ -154,5 +124,5 @@
       this->toList(OM_COMMON);
       this->collider = NULL;
-      if (likely(this->respawnBuffer != NULL))
+      if (likely(this->respawnBuffer.loaded()))
         this->soundSource.play(this->respawnBuffer);
 
Index: trunk/src/world_entities/power_ups/power_up.h
===================================================================
--- trunk/src/world_entities/power_ups/power_up.h	(revision 9656)
+++ trunk/src/world_entities/power_ups/power_up.h	(revision 9869)
@@ -21,4 +21,5 @@
 
 class PowerUp : public WorldEntity {
+  ObjectListDeclaration(PowerUp);
 
 public:
@@ -43,6 +44,6 @@
 private:
   OrxSound::SoundSource  soundSource;
-  OrxSound::SoundBuffer* pickupBuffer;
-  OrxSound::SoundBuffer* respawnBuffer;
+  OrxSound::SoundBuffer  pickupBuffer;
+  OrxSound::SoundBuffer  respawnBuffer;
   Material*              sphereMaterial;
   PowerUpRespawn         respawnType;
Index: trunk/src/world_entities/power_ups/turret_power_up.cc
===================================================================
--- trunk/src/world_entities/power_ups/turret_power_up.cc	(revision 9656)
+++ trunk/src/world_entities/power_ups/turret_power_up.cc	(revision 9869)
@@ -24,6 +24,7 @@
 
 
-
-CREATE_FACTORY(TurretPowerUp, CL_TURRET_POWER_UP);
+#include "class_id_DEPRECATED.h"
+ObjectListDefinitionID(TurretPowerUp, CL_TURRET_POWER_UP);
+CREATE_FACTORY(TurretPowerUp);
 
 TurretPowerUp::TurretPowerUp(const TiXmlElement* root) : PowerUp(0.0, 1.0, 0.0)
@@ -45,5 +46,5 @@
 void TurretPowerUp::init()
 {
-  this->setClassID(CL_TURRET_POWER_UP, "TurretPowerUp");
+  this->registerObject(this, TurretPowerUp::_objectList);
   this->loadModel("models/guns/turret1.obj", 2.0);
 
Index: trunk/src/world_entities/power_ups/turret_power_up.h
===================================================================
--- trunk/src/world_entities/power_ups/turret_power_up.h	(revision 9656)
+++ trunk/src/world_entities/power_ups/turret_power_up.h	(revision 9869)
@@ -13,4 +13,5 @@
 
 class TurretPowerUp : public PowerUp {
+  ObjectListDeclaration(TurretPowerUp);
 
  public:
@@ -20,5 +21,5 @@
   virtual void loadParams(const TiXmlElement* root);
 
-  virtual void TurretPowerUp::collidesWith(WorldEntity* entity, const Vector& location);
+  virtual void collidesWith(WorldEntity* entity, const Vector& location);
   virtual void tick(float dt);
   virtual void draw() const;
Index: trunk/src/world_entities/power_ups/weapon_power_up.cc
===================================================================
--- trunk/src/world_entities/power_ups/weapon_power_up.cc	(revision 9656)
+++ trunk/src/world_entities/power_ups/weapon_power_up.cc	(revision 9869)
@@ -25,8 +25,9 @@
 #include "util/loading/factory.h"
 #include "util/loading/load_param.h"
+#include "debug.h"
 
-
-
-CREATE_FACTORY(WeaponPowerUp, CL_WEAPON_POWER_UP);
+#include "class_id_DEPRECATED.h"
+ObjectListDefinitionID(WeaponPowerUp, CL_WEAPON_POWER_UP);
+CREATE_FACTORY(WeaponPowerUp);
 
 WeaponPowerUp::WeaponPowerUp(const TiXmlElement* root) : PowerUp(1.0, 1.0, 0.0)
@@ -45,5 +46,5 @@
 void WeaponPowerUp::init()
 {
-  this->setClassID(CL_WEAPON_POWER_UP, "WeaponPowerUp");
+  this->registerObject(this, WeaponPowerUp::_objectList);
   this->loadPickupSound("sound/powerups/whats this2.wav");
 
@@ -87,5 +88,5 @@
 {
   this->weapon = dynamic_cast<Weapon*>((weaponXML == NULL)
-      ? Factory::fabricate(static_cast<ClassID>(this->weapon->getLeafClassID()))
+      ? Factory::fabricate((this->weapon->getClassID()))
       : Factory::fabricate((const TiXmlElement*)this->getXmlElem()->FirstChildElement("weapon")));
   this->model = this->weapon->getModel(0);
Index: trunk/src/world_entities/power_ups/weapon_power_up.h
===================================================================
--- trunk/src/world_entities/power_ups/weapon_power_up.h	(revision 9656)
+++ trunk/src/world_entities/power_ups/weapon_power_up.h	(revision 9869)
@@ -14,5 +14,5 @@
 
 class WeaponPowerUp : public PowerUp {
-
+ObjectListDeclaration(WeaponPowerUp);
 public:
   WeaponPowerUp(const TiXmlElement* root = NULL);
Index: trunk/src/world_entities/projectiles/bomb.cc
===================================================================
--- trunk/src/world_entities/projectiles/bomb.cc	(revision 9656)
+++ trunk/src/world_entities/projectiles/bomb.cc	(revision 9869)
@@ -20,10 +20,12 @@
 #include "primitive_model.h"
 
-#include "dot_emitter.h"
-#include "particle_system.h"
+#include "particles/dot_emitter.h"
+#include "particles/particle_system.h"
 
 #include "debug.h"
 
-CREATE_FAST_FACTORY_STATIC(Bomb, CL_BOMB);
+#include "class_id_DEPRECATED.h"
+ObjectListDefinitionID(Bomb, CL_BOMB);
+CREATE_FAST_FACTORY_STATIC(Bomb);
 
 /**
@@ -67,5 +69,5 @@
 void Bomb::init()
 {
-  this->setClassID(CL_BOMB, "Bomb");
+  this->registerObject(this, Bomb::_objectList);
 
 
@@ -173,4 +175,5 @@
 }
 
+
 void Bomb::deactivate()
 {
@@ -182,10 +185,11 @@
 void Bomb::detonate(float size)
 {
-  ObjectManager::EntityList detonationList;
-  ObjectManager::distanceFromObject(detonationList, *this, size, CL_NPC);
+  /// FIXME
+/*  ObjectManager::EntityList detonationList;
+  ObjectManager::distanceFromObject(detonationList, *this, size, NPC::objectList());
     while( !detonationList.empty() )
     {
       detonationList.front()->collidesWith(this, Vector(0,0,0));
       detonationList.pop_front();
-    }
+    }*/
 }
Index: trunk/src/world_entities/projectiles/bomb.h
===================================================================
--- trunk/src/world_entities/projectiles/bomb.h	(revision 9656)
+++ trunk/src/world_entities/projectiles/bomb.h	(revision 9869)
@@ -17,5 +17,5 @@
 class Bomb : public Projectile
 {
-
+  ObjectListDeclaration(Bomb);
  public:
   Bomb(const TiXmlElement* root = NULL);
Index: trunk/src/world_entities/projectiles/boomerang_projectile.cc
===================================================================
--- trunk/src/world_entities/projectiles/boomerang_projectile.cc	(revision 9656)
+++ trunk/src/world_entities/projectiles/boomerang_projectile.cc	(revision 9869)
@@ -20,12 +20,13 @@
 
 #include "state.h"
-#include "class_list.h"
-
-#include "dot_emitter.h"
-#include "sprite_particles.h"
+
+#include "particles/dot_emitter.h"
+#include "particles/sprite_particles.h"
 
 #include "debug.h"
 
-CREATE_FAST_FACTORY_STATIC(BoomerangProjectile, CL_BOOMERANG_PROJECTILE);
+#include "class_id_DEPRECATED.h"
+ObjectListDefinitionID(BoomerangProjectile, CL_BOOMERANG_PROJECTILE);
+CREATE_FAST_FACTORY_STATIC(BoomerangProjectile);
 
 /**
@@ -34,5 +35,5 @@
 BoomerangProjectile::BoomerangProjectile () : Projectile()
 {
-  this->setClassID(CL_BOOMERANG_PROJECTILE, "BoomerangProjectile");
+  this->registerObject(this, BoomerangProjectile::_objectList);
 
   this->loadModel("models/projectiles/orx-rocket.obj", 2.0);
@@ -60,13 +61,13 @@
 
   /* this is normaly done by World.cc by deleting the ParticleEngine */
-  if (BoomerangProjectile::trailParticles != NULL && ClassList::getList(CL_BOOMERANG_PROJECTILE)->size() <= 1)
-  {
-    if (ClassList::exists(BoomerangProjectile::trailParticles, CL_PARTICLE_SYSTEM))
+  if (BoomerangProjectile::trailParticles != NULL && BoomerangProjectile::objectList().size() <= 1)
+  {
+    if (ParticleSystem::objectList().exists(BoomerangProjectile::trailParticles))
       delete BoomerangProjectile::trailParticles;
     BoomerangProjectile::trailParticles = NULL;
   }
-  if (BoomerangProjectile::explosionParticles != NULL && ClassList::getList(CL_BOOMERANG_PROJECTILE)->size() <= 1)
-  {
-    if (ClassList::exists(BoomerangProjectile::explosionParticles, CL_PARTICLE_SYSTEM))
+  if (BoomerangProjectile::explosionParticles != NULL && BoomerangProjectile::objectList().size() <= 1)
+  {
+    if (ParticleSystem::objectList().exists(BoomerangProjectile::explosionParticles))
       delete BoomerangProjectile::explosionParticles;
     BoomerangProjectile::explosionParticles = NULL;
Index: trunk/src/world_entities/projectiles/boomerang_projectile.h
===================================================================
--- trunk/src/world_entities/projectiles/boomerang_projectile.h	(revision 9656)
+++ trunk/src/world_entities/projectiles/boomerang_projectile.h	(revision 9869)
@@ -17,4 +17,5 @@
 class BoomerangProjectile : public Projectile
 {
+  ObjectListDeclaration(BoomerangProjectile);
   public:
     BoomerangProjectile ();
Index: trunk/src/world_entities/projectiles/guided_missile.cc
===================================================================
--- trunk/src/world_entities/projectiles/guided_missile.cc	(revision 9656)
+++ trunk/src/world_entities/projectiles/guided_missile.cc	(revision 9869)
@@ -19,12 +19,13 @@
 
 #include "state.h"
-#include "class_list.h"
-
-#include "dot_emitter.h"
-#include "sprite_particles.h"
+
+#include "particles/dot_emitter.h"
+#include "particles/sprite_particles.h"
 
 #include "debug.h"
 
-CREATE_FAST_FACTORY_STATIC(GuidedMissile, CL_GUIDED_MISSILE);
+#include "class_id_DEPRECATED.h"
+ObjectListDefinitionID(GuidedMissile, CL_GUIDED_MISSILE);
+CREATE_FAST_FACTORY_STATIC(GuidedMissile);
 
 /**
@@ -33,5 +34,5 @@
 GuidedMissile::GuidedMissile () : Projectile()
 {
-  this->setClassID(CL_GUIDED_MISSILE, "GuidedMissile");
+  this->registerObject(this, GuidedMissile::_objectList);
 
   this->loadModel("models/projectiles/orx-rocket.obj", 2.0);
@@ -59,13 +60,13 @@
 
   /* this is normaly done by World.cc by deleting the ParticleEngine */
-  if (GuidedMissile::trailParticles != NULL && ClassList::getList(CL_GUIDED_MISSILE)->size() <= 1)
-  {
-    if (ClassList::exists(GuidedMissile::trailParticles, CL_PARTICLE_SYSTEM))
+  if (GuidedMissile::trailParticles != NULL && GuidedMissile::objectList().size() <= 1)
+  {
+    if (ParticleSystem::objectList().exists(GuidedMissile::trailParticles))
       delete GuidedMissile::trailParticles;
     GuidedMissile::trailParticles = NULL;
   }
-  if (GuidedMissile::explosionParticles != NULL && ClassList::getList(CL_GUIDED_MISSILE)->size() <= 1)
-  {
-    if (ClassList::exists(GuidedMissile::explosionParticles, CL_PARTICLE_SYSTEM))
+  if (GuidedMissile::explosionParticles != NULL && GuidedMissile::objectList().size() <= 1)
+  {
+    if (ParticleSystem::objectList().exists(GuidedMissile::explosionParticles))
       delete GuidedMissile::explosionParticles;
     GuidedMissile::explosionParticles = NULL;
Index: trunk/src/world_entities/projectiles/guided_missile.h
===================================================================
--- trunk/src/world_entities/projectiles/guided_missile.h	(revision 9656)
+++ trunk/src/world_entities/projectiles/guided_missile.h	(revision 9869)
@@ -16,4 +16,5 @@
 class GuidedMissile : public Projectile
 {
+  ObjectListDeclaration(GuidedMissile);
   public:
     GuidedMissile ();
Index: trunk/src/world_entities/projectiles/hyperblast.cc
===================================================================
--- trunk/src/world_entities/projectiles/hyperblast.cc	(revision 9656)
+++ trunk/src/world_entities/projectiles/hyperblast.cc	(revision 9869)
@@ -19,12 +19,14 @@
 
 #include "state.h"
-#include "class_list.h"
 
-#include "box_emitter.h"
-#include "spark_particles.h"
+#include "particles/box_emitter.h"
+#include "particles/spark_particles.h"
 
 #include "debug.h"
 
-CREATE_FAST_FACTORY_STATIC(Hyperblast, CL_HYPERBLAST);
+#include "class_id_DEPRECATED.h"
+ObjectListDefinitionID(Hyperblast, CL_HYPERBLAST);
+CREATE_FAST_FACTORY_STATIC(Hyperblast);
+
 
 /**
@@ -33,5 +35,5 @@
 Hyperblast::Hyperblast () : Projectile()
 {
-  this->setClassID(CL_HYPERBLAST, "Hyperblast");
+  this->registerObject(this, Hyperblast::_objectList);
 
   this->loadModel("models/projectiles/hyperblast.obj", 5);
@@ -55,5 +57,5 @@
 {
   /* this is normaly done by World.cc by deleting the ParticleEngine */
-  if (Hyperblast::explosionParticles != NULL && ClassList::getList(CL_HYPERBLAST)->size() <= 1)
+  if (Hyperblast::explosionParticles != NULL && Hyperblast::objectList().size() <= 1)
   {
     Hyperblast::explosionParticles = NULL;
Index: trunk/src/world_entities/projectiles/hyperblast.h
===================================================================
--- trunk/src/world_entities/projectiles/hyperblast.h	(revision 9656)
+++ trunk/src/world_entities/projectiles/hyperblast.h	(revision 9869)
@@ -17,4 +17,5 @@
 class Hyperblast : public Projectile
 {
+  ObjectListDeclaration(Hyperblast);
   public:
     Hyperblast ();
Index: trunk/src/world_entities/projectiles/laser.cc
===================================================================
--- trunk/src/world_entities/projectiles/laser.cc	(revision 9656)
+++ trunk/src/world_entities/projectiles/laser.cc	(revision 9869)
@@ -19,9 +19,8 @@
 
 #include "state.h"
-#include "class_list.h"
 #include "model.h"
 
-#include "dot_emitter.h"
-#include "sprite_particles.h"
+#include "particles/dot_emitter.h"
+#include "particles/sprite_particles.h"
 
 #include <cassert>
@@ -29,6 +28,7 @@
 
 
-
-CREATE_FAST_FACTORY_STATIC(Laser, CL_LASER);
+#include "class_id_DEPRECATED.h"
+ObjectListDefinition(Laser);
+CREATE_FAST_FACTORY_STATIC(Laser);
 
 /**
@@ -37,5 +37,5 @@
 Laser::Laser () : Projectile()
 {
-  this->setClassID(CL_LASER, "Laser");
+  this->registerObject(this, Laser::_objectList);
 
   this->loadModel("models/projectiles/laser.obj");
@@ -61,5 +61,5 @@
 
   /* this is normaly done by World.cc by deleting the ParticleEngine */
-  if (Laser::explosionParticles != NULL && ClassList::getList(CL_LASER)->size() <= 1)
+  if (Laser::explosionParticles != NULL && Laser::objectList().size() <= 1)
   {
     //if (ClassList::exists(Laser::explosionParticles, CL_PARTICLE_SYSTEM))
Index: trunk/src/world_entities/projectiles/laser.h
===================================================================
--- trunk/src/world_entities/projectiles/laser.h	(revision 9656)
+++ trunk/src/world_entities/projectiles/laser.h	(revision 9869)
@@ -17,4 +17,5 @@
 class Laser : public Projectile
 {
+  ObjectListDeclaration(Laser);
   public:
     Laser ();
Index: trunk/src/world_entities/projectiles/projectile.cc
===================================================================
--- trunk/src/world_entities/projectiles/projectile.cc	(revision 9656)
+++ trunk/src/world_entities/projectiles/projectile.cc	(revision 9869)
@@ -22,8 +22,9 @@
 #include "world_entities/weapons/weapon.h"
 #include "model.h"
-#include "util/loading/resource_manager.h"
+#include "sound/resource_sound_buffer.h"
 
 #include "debug.h"
 
+ObjectListDefinition(Projectile);
 
 /**
@@ -32,5 +33,5 @@
 Projectile::Projectile () : WorldEntity()
 {
-  this->setClassID(CL_PROJECTILE, "Projectile");
+  this->registerObject(this, Projectile::_objectList);
 
   this->lifeCycle = 0.0;
@@ -43,7 +44,4 @@
   this->setDamage(1.0f); // default damage of a projectile set to 100.0 damage points
 
-  this->explosionBuffer = NULL;
-  this->engineBuffer = NULL;
-
   //this->addNodeFlags(PNODE_PROHIBIT_DELETE_WITH_PARENT);
 }
@@ -55,8 +53,4 @@
 Projectile::~Projectile ()
 {
-  if (this->explosionBuffer != NULL)
-    ResourceManager::getInstance()->unload(this->explosionBuffer);
-  if (this->engineBuffer != NULL)
-    ResourceManager::getInstance()->unload(this->engineBuffer);
   /*
      do not delete the test projectModel, since it is pnode
@@ -69,21 +63,8 @@
 void Projectile::loadExplosionSound(const std::string& explosionSound)
 {
-  if (this->explosionBuffer != NULL)
-    ResourceManager::getInstance()->unload(this->explosionBuffer);
-
-  else if (!explosionSound.empty())
-  {
-    this->explosionBuffer = (OrxSound::SoundBuffer*)ResourceManager::getInstance()->load(explosionSound, WAV);
-    if (this->explosionBuffer != NULL)
-    {
-      PRINTF(4)("Loaded sound %s to Pickup: %s.\n", explosionSound.c_str(), this->getCName());
-    }
-    else
-    {
-      PRINTF(2)("Failed to load sound %s to explosion %s.\n.", explosionSound.c_str(), this->getCName());
-    }
-  }
+  if (!explosionSound.empty())
+    this->explosionBuffer = OrxSound::ResourceSoundBuffer(explosionSound);
   else
-    this->explosionBuffer = NULL;
+    this->explosionBuffer = OrxSound::SoundBuffer();
 }
 
@@ -91,21 +72,8 @@
 void Projectile::loadEngineSound(const std::string& engineSound)
 {
-  if (this->engineBuffer != NULL)
-    ResourceManager::getInstance()->unload(this->engineBuffer);
-
-  else if (!engineSound.empty())
-  {
-    this->engineBuffer = (OrxSound::SoundBuffer*)ResourceManager::getInstance()->load(engineSound, WAV);
-    if (this->engineBuffer != NULL)
-    {
-      PRINTF(4)("Loaded sound %s to Pickup: %s.\n", engineSound.c_str(), this->getCName());
-    }
-    else
-    {
-      PRINTF(2)("Failed to load sound %s to engine %s.\n.", engineSound.c_str(), this->getCName());
-    }
-  }
+  if (!engineSound.empty())
+    this->engineBuffer = OrxSound::ResourceSoundBuffer(engineSound);
   else
-    this->engineBuffer = NULL;
+    this->engineBuffer = OrxSound::SoundBuffer();
 }
 
@@ -139,5 +107,5 @@
   //Vector offsetVel =
   this->velocity = velocity;
- // offsetVel.normalize();
+  // offsetVel.normalize();
   //this->velocity += (offsetVel * 50.0);
 }
@@ -148,5 +116,5 @@
 {
   if (this->target == NULL)
-    this->target = new PNode(target, PNODE_PARENT_MODE_DEFAULT | PNODE_REPARENT_ON_PARENTS_REMOVE);
+    this->target = new PNode(target, PNODE_REPARENT_ON_PARENTS_REMOVE | PNODE_REPARENT_TO_NULL | PNODE_PROHIBIT_DELETE_WITH_PARENT);
   else
     this->target->setParent(target);
@@ -173,5 +141,5 @@
 void Projectile::destroy (WorldEntity* killer)
 {
-  if (this->explosionBuffer != NULL)
+  if (this->explosionBuffer.loaded())
     this->soundSource.play(this->explosionBuffer);
 }
Index: trunk/src/world_entities/projectiles/projectile.h
===================================================================
--- trunk/src/world_entities/projectiles/projectile.h	(revision 9656)
+++ trunk/src/world_entities/projectiles/projectile.h	(revision 9869)
@@ -11,5 +11,5 @@
 
 #include "world_entity.h"
-#include "fast_factory.h"
+#include "loading/fast_factory.h"
 
 #include "sound_source.h"
@@ -18,4 +18,5 @@
 class Projectile : public WorldEntity
 {
+  ObjectListDeclaration(Projectile);
   public:
     Projectile ();
@@ -66,6 +67,6 @@
     OrxSound::SoundSource  soundSource;
   private:
-    OrxSound::SoundBuffer* explosionBuffer;
-    OrxSound::SoundBuffer* engineBuffer;
+    OrxSound::SoundBuffer  explosionBuffer;
+    OrxSound::SoundBuffer  engineBuffer;
 };
 
Index: trunk/src/world_entities/projectiles/rail_projectile.cc
===================================================================
--- trunk/src/world_entities/projectiles/rail_projectile.cc	(revision 9656)
+++ trunk/src/world_entities/projectiles/rail_projectile.cc	(revision 9869)
@@ -19,9 +19,8 @@
 
 #include "state.h"
-#include "class_list.h"
 #include "model.h"
 
-#include "dot_emitter.h"
-#include "sprite_particles.h"
+#include "particles/dot_emitter.h"
+#include "particles/sprite_particles.h"
 
 #include <cassert>
@@ -29,6 +28,7 @@
 
 
-
-CREATE_FAST_FACTORY_STATIC(RailProjectile, CL_RAIL_PROJECTILE);
+#include "class_id_DEPRECATED.h"
+ObjectListDefinitionID(RailProjectile, CL_RAIL_PROJECTILE);
+CREATE_FAST_FACTORY_STATIC(RailProjectile);
 
 /**
@@ -37,7 +37,7 @@
 RailProjectile::RailProjectile () : Projectile()
 {
-  this->setClassID(CL_RAIL_PROJECTILE, "RailProjectile");
+  this->registerObject(this, RailProjectile::_objectList);
 
-  this->loadModel("models/projectiles/laser_projectile.obj", 100);
+  this->loadModel("models/projectiles/laser.obj", 1);
 
   this->setMinEnergy(10);
@@ -61,5 +61,5 @@
 
   /* this is normaly done by World.cc by deleting the ParticleEngine */
-  if (RailProjectile::explosionParticles != NULL && ClassList::getList(CL_RAIL_PROJECTILE)->size() <= 1)
+  if (RailProjectile::explosionParticles != NULL && RailProjectile::objectList().size() <= 1)
   {
     //if (ClassList::exists(RailProjectile::explosionParticles, CL_PARTICLE_SYSTEM))
Index: trunk/src/world_entities/projectiles/rail_projectile.h
===================================================================
--- trunk/src/world_entities/projectiles/rail_projectile.h	(revision 9656)
+++ trunk/src/world_entities/projectiles/rail_projectile.h	(revision 9869)
@@ -17,4 +17,5 @@
 class RailProjectile : public Projectile
 {
+  ObjectListDeclaration(RailProjectile);
   public:
     RailProjectile ();
Index: trunk/src/world_entities/projectiles/rocket.cc
===================================================================
--- trunk/src/world_entities/projectiles/rocket.cc	(revision 9656)
+++ trunk/src/world_entities/projectiles/rocket.cc	(revision 9869)
@@ -19,12 +19,13 @@
 
 #include "state.h"
-#include "class_list.h"
 
-#include "dot_emitter.h"
-#include "sprite_particles.h"
+#include "particles/dot_emitter.h"
+#include "particles/sprite_particles.h"
 
 #include "debug.h"
 
-CREATE_FAST_FACTORY_STATIC(Rocket, CL_ROCKET);
+#include "class_id_DEPRECATED.h"
+ObjectListDefinitionID(Rocket, CL_ROCKET);
+CREATE_FAST_FACTORY_STATIC(Rocket);
 
 /**
@@ -33,5 +34,5 @@
 Rocket::Rocket () : Projectile()
 {
-  this->setClassID(CL_ROCKET, "Rocket");
+  this->registerObject(this, Rocket::_objectList);
 
   this->loadModel("models/projectiles/orx-rocket.obj", .3);
@@ -55,5 +56,5 @@
 
   /* this is normaly done by World.cc by deleting the ParticleEngine */
-  if (Rocket::trailParticles != NULL && ClassList::getList(CL_ROCKET)->size() <= 1)
+  if (Rocket::trailParticles != NULL && Rocket::objectList().size() <= 1)
   {
 /*    if (ClassList::exists(Rocket::trailParticles, CL_PARTICLE_SYSTEM))
@@ -61,5 +62,5 @@
     Rocket::trailParticles = NULL;
   }
-  if (Rocket::explosionParticles != NULL && ClassList::getList(CL_ROCKET)->size() <= 1)
+  if (Rocket::explosionParticles != NULL && Rocket::objectList().size() <= 1)
   {
 /*    if (ClassList::exists(Rocket::explosionParticles, CL_PARTICLE_SYSTEM))
Index: trunk/src/world_entities/projectiles/rocket.h
===================================================================
--- trunk/src/world_entities/projectiles/rocket.h	(revision 9656)
+++ trunk/src/world_entities/projectiles/rocket.h	(revision 9869)
@@ -9,6 +9,4 @@
 #include "projectile.h"
 
-class Vector;
-class Weapon;
 class SpriteParticles;
 class ParticleEmitter;
@@ -17,29 +15,31 @@
 class Rocket : public Projectile
 {
-  public:
-    Rocket ();
-    virtual ~Rocket ();
+  ObjectListDeclaration(Rocket);
+
+public:
+  Rocket ();
+  virtual ~Rocket ();
 
 
-    virtual void activate();
-    virtual void deactivate();
+  virtual void activate();
+  virtual void deactivate();
 
-    virtual void collidesWith(WorldEntity* entity, const Vector& location);
+  virtual void collidesWith(WorldEntity* entity, const Vector& location);
 
-    virtual void destroy (WorldEntity* killer);
+  virtual void destroy (WorldEntity* killer);
 
-    virtual void tick (float time);
-    virtual void draw () const;
+  virtual void tick (float time);
+  virtual void draw () const;
 
 
-  private:
-    static FastFactory*               fastFactory;
-    static SpriteParticles*           trailParticles;
-    static SpriteParticles*           explosionParticles;
+private:
+  static FastFactory*               fastFactory;
+  static SpriteParticles*           trailParticles;
+  static SpriteParticles*           explosionParticles;
 
-    ParticleEmitter*                  emitter;
+  ParticleEmitter*                  emitter;
 
 
-    WorldEntity* hitEntity; // FIXME TEMPORARY
+  WorldEntity* hitEntity; // FIXME TEMPORARY
 
 };
Index: trunk/src/world_entities/projectiles/test_bullet.cc
===================================================================
--- trunk/src/world_entities/projectiles/test_bullet.cc	(revision 9656)
+++ trunk/src/world_entities/projectiles/test_bullet.cc	(revision 9869)
@@ -19,11 +19,12 @@
 
 #include "state.h"
-#include "class_list.h"
 
-#include "dot_emitter.h"
-#include "sprite_particles.h"
+#include "particles/dot_emitter.h"
+#include "particles/sprite_particles.h"
 #include "debug.h"
 
-CREATE_FAST_FACTORY_STATIC(TestBullet, CL_TEST_BULLET);
+#include "class_id_DEPRECATED.h"
+ObjectListDefinitionID(TestBullet, CL_TEST_BULLET);
+CREATE_FAST_FACTORY_STATIC(TestBullet);
 
 /**
@@ -32,5 +33,5 @@
 TestBullet::TestBullet () : Projectile()
 {
-  this->setClassID(CL_TEST_BULLET, "TestBullet");
+  this->registerObject(this, TestBullet::_objectList);
 
   this->loadModel("models/projectiles/orx-rocket.obj", .3);
@@ -54,13 +55,13 @@
 
   /* this is normaly done by World.cc by deleting the ParticleEngine */
-  if (TestBullet::trailParticles != NULL && ClassList::getList(CL_TEST_BULLET)->size() <= 1)
+  if (TestBullet::trailParticles != NULL && TestBullet::objectList().size() <= 1)
   {
-    if (ClassList::exists(TestBullet::trailParticles, CL_PARTICLE_SYSTEM))
+    if (ParticleSystem::objectList().exists(TestBullet::trailParticles))
       delete TestBullet::trailParticles;
     TestBullet::trailParticles = NULL;
   }
-  if (TestBullet::explosionParticles != NULL && ClassList::getList(CL_TEST_BULLET)->size() <= 1)
+  if (TestBullet::explosionParticles != NULL && TestBullet::objectList().size() <= 1)
   {
-    if (ClassList::exists(TestBullet::explosionParticles, CL_PARTICLE_SYSTEM))
+    if (ParticleSystem::objectList().exists(TestBullet::explosionParticles))
       delete TestBullet::explosionParticles;
     TestBullet::explosionParticles = NULL;
Index: trunk/src/world_entities/projectiles/test_bullet.h
===================================================================
--- trunk/src/world_entities/projectiles/test_bullet.h	(revision 9656)
+++ trunk/src/world_entities/projectiles/test_bullet.h	(revision 9869)
@@ -17,4 +17,6 @@
 class TestBullet : public Projectile
 {
+  ObjectListDeclaration(TestBullet);
+
   public:
     TestBullet ();
Index: trunk/src/world_entities/recorder.cc
===================================================================
--- trunk/src/world_entities/recorder.cc	(revision 9656)
+++ trunk/src/world_entities/recorder.cc	(revision 9869)
@@ -18,15 +18,15 @@
 #include "util/loading/load_param.h"
 #include "util/loading/factory.h"
-#include "util/loading/resource_manager.h"
 #include "state.h"
-
-
-
-CREATE_FACTORY(Recorder, CL_RECORDER);
+#include "debug.h"
+
+#include "class_id_DEPRECATED.h"
+ObjectListDefinitionID(Recorder, CL_RECORDER);
+CREATE_FACTORY(Recorder);
 
 
 Recorder::Recorder (const TiXmlElement* root)
 {
-  this->setClassID(CL_RECORDER, "Recorder");
+  this->registerObject(this, Recorder::_objectList);
 
   // initialize libavcodec, and register all codecs and formats
Index: trunk/src/world_entities/recorder.h
===================================================================
--- trunk/src/world_entities/recorder.h	(revision 9656)
+++ trunk/src/world_entities/recorder.h	(revision 9869)
@@ -20,4 +20,5 @@
 class Recorder : public WorldEntity
 {
+  ObjectListDeclaration(Recorder);
   public:
     Recorder (const TiXmlElement* root = NULL);
Index: trunk/src/world_entities/satellite.cc
===================================================================
--- trunk/src/world_entities/satellite.cc	(revision 9656)
+++ trunk/src/world_entities/satellite.cc	(revision 9869)
@@ -21,8 +21,9 @@
 
 #include "objModel.h"
-#include "vector.h"
 
 
 
+
+ObjectListDefinition(Satellite);
 
 /**
@@ -31,5 +32,5 @@
 Satellite::Satellite (Vector axis, float speed)
 {
-  this->setClassID(CL_SATELLITE, "Satellite");
+  this->registerObject(this, Satellite::_objectList);
 
   this->loadModel("cube");
Index: trunk/src/world_entities/satellite.h
===================================================================
--- trunk/src/world_entities/satellite.h	(revision 9656)
+++ trunk/src/world_entities/satellite.h	(revision 9869)
@@ -9,6 +9,4 @@
 #include "world_entity.h"
 #include "comincl.h"
-#include "util/loading/resource_manager.h"
-
 
 class CharacterAttributes;
@@ -19,5 +17,5 @@
 class Satellite : public WorldEntity
 {
-  friend class World;
+  ObjectListDeclaration(Satellite);
 
  public:
Index: trunk/src/world_entities/script_trigger.cc
===================================================================
--- trunk/src/world_entities/script_trigger.cc	(revision 9656)
+++ trunk/src/world_entities/script_trigger.cc	(revision 9869)
@@ -16,28 +16,28 @@
 
 #include "script_trigger.h"
-#include "class_list.h"
 #include "script.h"
 
 #include "state.h"
-
-
-CREATE_SCRIPTABLE_CLASS(ScriptTrigger, CL_SCRIPT_TRIGGER,
+#include "debug.h"
+ObjectListDefinition(ScriptTrigger);
+
+CREATE_SCRIPTABLE_CLASS(ScriptTrigger,
             // Coordinates
-             addMethod("setAbsCoor", ExecutorLua3<PNode,float,float,float>(&PNode::setAbsCoor))
-             ->addMethod("getAbsCoorX", ExecutorLua0ret<PNode, float>(&PNode::getAbsCoorX))
-             ->addMethod("getAbsCoorY", ExecutorLua0ret<PNode, float>(&PNode::getAbsCoorY))
-             ->addMethod("getAbsCoorZ", ExecutorLua0ret<PNode, float>(&PNode::getAbsCoorZ))
+			addMethod("setAbsCoor", Executor3<PNode, lua_State*,float,float,float>(&PNode::setAbsCoor))
+			    ->addMethod("getAbsCoorX", Executor0ret<PNode, lua_State*, float>(&PNode::getAbsCoorX))
+			    ->addMethod("getAbsCoorY", Executor0ret<PNode, lua_State*, float>(&PNode::getAbsCoorY))
+			    ->addMethod("getAbsCoorZ", Executor0ret<PNode, lua_State*, float>(&PNode::getAbsCoorZ))
             //Properties
-             ->addMethod("setName", ExecutorLua1<BaseObject, const std::string&>(&BaseObject::setName))
-             ->addMethod("setTarget", ExecutorLua1<ScriptTrigger, const std::string&>(&ScriptTrigger::setTarget))
-             ->addMethod("setTriggerParent", ExecutorLua1<ScriptTrigger, const std::string&>(&ScriptTrigger::setTriggerParent))
-             ->addMethod("setTriggerRemains", ExecutorLua1<ScriptTrigger, bool>(&ScriptTrigger::setTriggerRemains))
-             ->addMethod("setActiveOnCreation", ExecutorLua1<ScriptTrigger, bool>(&ScriptTrigger::setActiveOnCreation))
-             ->addMethod("setInvert", ExecutorLua1<ScriptTrigger, bool>(&ScriptTrigger::setInvert))
-             ->addMethod("setRadius", ExecutorLua1<ScriptTrigger, float>(&ScriptTrigger::setRadius))
-             ->addMethod("setScript", ExecutorLua1<ScriptTrigger, const std::string&>(&ScriptTrigger::setScript))
-             ->addMethod("setFunction", ExecutorLua1<ScriptTrigger, const std::string&>(&ScriptTrigger::setFunction))
-             ->addMethod("setDebugDraw", ExecutorLua1<ScriptTrigger, bool>(&ScriptTrigger::setDebugDraw))
-             ->addMethod("setAddToScript", ExecutorLua1<ScriptTrigger, bool>(&ScriptTrigger::setAddToScript))
+			    ->addMethod("setName", Executor1<BaseObject, lua_State*, const std::string&>(&BaseObject::setName))
+			    ->addMethod("setTarget", Executor1<ScriptTrigger, lua_State*, const std::string&>(&ScriptTrigger::setTarget))
+			    ->addMethod("setTriggerParent", Executor1<ScriptTrigger, lua_State*, const std::string&>(&ScriptTrigger::setTriggerParent))
+			    ->addMethod("setTriggerRemains", Executor1<ScriptTrigger, lua_State*, bool>(&ScriptTrigger::setTriggerRemains))
+			    ->addMethod("setActiveOnCreation", Executor1<ScriptTrigger, lua_State*, bool>(&ScriptTrigger::setActiveOnCreation))
+			    ->addMethod("setInvert", Executor1<ScriptTrigger, lua_State*, bool>(&ScriptTrigger::setInvert))
+			    ->addMethod("setRadius", Executor1<ScriptTrigger, lua_State*, float>(&ScriptTrigger::setRadius))
+			    ->addMethod("setScript", Executor1<ScriptTrigger, lua_State*, const std::string&>(&ScriptTrigger::setScript))
+			    ->addMethod("setFunction", Executor1<ScriptTrigger, lua_State*, const std::string&>(&ScriptTrigger::setFunction))
+			    ->addMethod("setDebugDraw", Executor1<ScriptTrigger, lua_State*, bool>(&ScriptTrigger::setDebugDraw))
+			    ->addMethod("setAddToScript", Executor1<ScriptTrigger, lua_State*, bool>(&ScriptTrigger::setAddToScript))
              );
 
@@ -49,6 +49,6 @@
  */
 ScriptTrigger::ScriptTrigger(const TiXmlElement* root)
-{ 
-  this->setClassID(CL_SCRIPT_TRIGGER, "ScriptTrigger");
+{
+  this->registerObject(this, ScriptTrigger::_objectList);
   this->toList(OM_COMMON);
 
@@ -139,9 +139,9 @@
 void ScriptTrigger::setTarget(const std::string& target)
 {
-  BaseObject* targetEntity = ClassList::getObject(target, CL_WORLD_ENTITY);
-
+
+  WorldEntity* targetEntity = WorldEntity::objectList().getObject(target);
   if (targetEntity != NULL)
   {
-    this->setTarget(dynamic_cast<WorldEntity*>(targetEntity));
+    this->setTarget(targetEntity);
   }
   else
@@ -157,9 +157,9 @@
 void ScriptTrigger::setTriggerParent(const std::string& parent)
 {
-  BaseObject* parentEntity = ClassList::getObject(parent, CL_WORLD_ENTITY);
+  WorldEntity* parentEntity = WorldEntity::objectList().getObject(parent);
 
   if (parentEntity != NULL)
   {
-    this->setParent(dynamic_cast<WorldEntity*>(parentEntity));
+    this->setParent(parentEntity);
     this->setParentMode(PNODE_MOVEMENT);
   }
Index: trunk/src/world_entities/script_trigger.h
===================================================================
--- trunk/src/world_entities/script_trigger.h	(revision 9656)
+++ trunk/src/world_entities/script_trigger.h	(revision 9869)
@@ -18,4 +18,5 @@
 class ScriptTrigger : public WorldEntity
 {
+  ObjectListDeclaration(ScriptTrigger);
   public:
     ScriptTrigger(const TiXmlElement* root = NULL);
Index: trunk/src/world_entities/skybox.cc
===================================================================
--- trunk/src/world_entities/skybox.cc	(revision 9656)
+++ trunk/src/world_entities/skybox.cc	(revision 9869)
@@ -27,10 +27,11 @@
 #include "network_game_manager.h"
 #include "converter.h"
-#include "util/loading/resource_manager.h"
-
-
-
-
-CREATE_FACTORY(SkyBox, CL_SKYBOX);
+#include "resource_texture.h"
+
+#include "debug.h"
+
+#include "class_id_DEPRECATED.h"
+ObjectListDefinitionID(SkyBox, CL_SKYBOX);
+CREATE_FACTORY(SkyBox);
 
 /**
@@ -72,5 +73,5 @@
 void SkyBox::preInit()
 {
-  this->setClassID(CL_SKYBOX, "SkyBox");
+  this->registerObject(this, SkyBox::_objectList);
   this->toList(OM_BACKGROUND);
   this->toReflectionList();
@@ -112,6 +113,4 @@
     if (this->material[i])
       delete this->material[i];
-    if (this->cubeTexture[i])
-      ResourceManager::getInstance()->unload(this->cubeTexture[i]);
   }
 }
@@ -174,12 +173,12 @@
                                   const std::string& posZ, const std::string& posX, const std::string& negX)
 {
-  this->cubeTexture[0] = (Texture*)ResourceManager::getInstance()->load(negX, RP_LEVEL, IMAGE, GL_TEXTURE_CUBE_MAP_NEGATIVE_X_EXT);
-  this->cubeTexture[1] = (Texture*)ResourceManager::getInstance()->load(posX, RP_LEVEL, IMAGE, GL_TEXTURE_CUBE_MAP_POSITIVE_X_EXT);
-
-  this->cubeTexture[2] = (Texture*)ResourceManager::getInstance()->load(negY, RP_LEVEL, IMAGE, GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_EXT);
-  this->cubeTexture[3] = (Texture*)ResourceManager::getInstance()->load(posY, RP_LEVEL, IMAGE, GL_TEXTURE_CUBE_MAP_POSITIVE_Y_EXT);
-
-  this->cubeTexture[4] = (Texture*)ResourceManager::getInstance()->load(negZ, RP_LEVEL, IMAGE, GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_EXT);
-  this->cubeTexture[5] = (Texture*)ResourceManager::getInstance()->load(posZ, RP_LEVEL, IMAGE, GL_TEXTURE_CUBE_MAP_POSITIVE_Z_EXT);
+  this->cubeTexture[0] = ResourceTexture(negX, GL_TEXTURE_CUBE_MAP_NEGATIVE_X_EXT);
+  this->cubeTexture[1] = ResourceTexture(posX, GL_TEXTURE_CUBE_MAP_POSITIVE_X_EXT);
+
+  this->cubeTexture[2] = ResourceTexture(negY, GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_EXT);
+  this->cubeTexture[3] = ResourceTexture(posY, GL_TEXTURE_CUBE_MAP_POSITIVE_Y_EXT);
+
+  this->cubeTexture[4] = ResourceTexture(negZ, GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_EXT);
+  this->cubeTexture[5] = ResourceTexture(posZ, GL_TEXTURE_CUBE_MAP_POSITIVE_Z_EXT);
 }
 
Index: trunk/src/world_entities/skybox.h
===================================================================
--- trunk/src/world_entities/skybox.h	(revision 9656)
+++ trunk/src/world_entities/skybox.h	(revision 9869)
@@ -27,5 +27,6 @@
 class SkyBox : public WorldEntity
 {
- public:
+  ObjectListDeclaration(SkyBox);
+public:
   SkyBox(const std::string& fileName = "");
   SkyBox(const TiXmlElement* root);
@@ -64,5 +65,5 @@
 
   Material*       material[6];     //!< Materials for the SkyBox. sorted by number (0-5) top, bottom, left, right, front, back
-  Texture*        cubeTexture[6];  //!< Textures for the CubeMap.
+  Texture         cubeTexture[6];  //!< Textures for the CubeMap.
 
   float           size;            //!< Size of the SkyBox. This should match the frustum maximum range.
Index: trunk/src/world_entities/skydome.cc
===================================================================
--- trunk/src/world_entities/skydome.cc	(revision 9656)
+++ trunk/src/world_entities/skydome.cc	(revision 9869)
@@ -23,5 +23,6 @@
 #include "network_game_manager.h"
 #include "converter.h"
-#include "util/loading/resource_manager.h"
+
+#include "debug.h"
 
 #define DTOR (PI/180.0f)
@@ -30,4 +31,5 @@
 
 
+ObjectListDefinition(Skydome);
 
 /**
@@ -42,7 +44,7 @@
 void Skydome::init()
 {
-  PRINTF(0)("Skydome init\n");
-
-  this->setClassID(CL_SKYDOME, "Skydome");
+  PRINTF(4)("Skydome init\n");
+
+  this->registerObject(this, Skydome::_objectList);
   this->toList(OM_BACKGROUND);
   this->toReflectionList();
@@ -61,5 +63,5 @@
 Skydome::~Skydome()
 {
-  PRINTF(0)("Deleting Skydome\n");
+  PRINTF(4)("Deleting Skydome\n");
 
   if (glIsTexture(texture))
@@ -119,5 +121,5 @@
   glEnd();
 
-  WorldEntity::draw(); 
+  WorldEntity::draw();
 
   glPopMatrix();
Index: trunk/src/world_entities/skydome.h
===================================================================
--- trunk/src/world_entities/skydome.h	(revision 9656)
+++ trunk/src/world_entities/skydome.h	(revision 9869)
@@ -21,4 +21,5 @@
 class Skydome : public WorldEntity
 {
+  ObjectListDeclaration(Skydome);
 public:
   Skydome();
@@ -31,13 +32,13 @@
   void generateSkyPlane(int divisions, float planetRadius, float atmosphereRadius,
                         float hTile, float vTile);
-  
+
   void setShader(Shader* shader);
   void setTexture(GLuint texture);
-  
+
   void activate();
   void deactivate();
 
 private:
-  
+
   typedef struct VertexInfo
   {
@@ -48,5 +49,5 @@
 
   bool activateDome;
-  
+
   VertexInfo *planeVertices;
   int numPlaneVertices;
@@ -59,5 +60,5 @@
   VertexInfo *vertices;
   int numVertices;
-  
+
   GLuint texture;
   Shader* shader;
Index: trunk/src/world_entities/skysphere.cc
===================================================================
--- trunk/src/world_entities/skysphere.cc	(revision 9656)
+++ trunk/src/world_entities/skysphere.cc	(revision 9869)
@@ -27,5 +27,4 @@
 
 #include "skysphere.h"
-#include "stdincl.h"
 
 #include "material.h"
@@ -33,5 +32,5 @@
 
 
-
+ObjectListDefinition(Skysphere);
 
 /**
@@ -41,5 +40,5 @@
 Skysphere::Skysphere(char* fileName)
 {
-  this->setClassID(CL_SKYSPHERE, "SkySphere");
+  this->registerObject(this, Skysphere::_objectList);
   this->toList(OM_BACKGROUND);
   if (fileName == NULL)
Index: trunk/src/world_entities/skysphere.h
===================================================================
--- trunk/src/world_entities/skysphere.h	(revision 9656)
+++ trunk/src/world_entities/skysphere.h	(revision 9869)
@@ -24,4 +24,5 @@
 class Skysphere : public WorldEntity
 {
+  ObjectListDeclaration(Skysphere);
 
  public:
Index: trunk/src/world_entities/space_ships/collision_probe.cc
===================================================================
--- trunk/src/world_entities/space_ships/collision_probe.cc	(revision 9656)
+++ trunk/src/world_entities/space_ships/collision_probe.cc	(revision 9869)
@@ -24,7 +24,8 @@
 
 
+#include "class_id_DEPRECATED.h"
+ObjectListDefinitionID(CollisionProbe, CL_COLLISION_PROBE);
 
-
-CREATE_FACTORY(CollisionProbe, CL_COLLISION_PROBE);
+CREATE_FACTORY(CollisionProbe);
 
 
@@ -56,5 +57,5 @@
 void CollisionProbe::init()
 {
-  this->setClassID(CL_COLLISION_PROBE, "CollisionProbe");
+  this->registerObject(this, CollisionProbe::_objectList);
 
   bUp = bDown = bLeft = bRight = bAscend = bDescend = bRollL = bRollR = false;
Index: trunk/src/world_entities/space_ships/collision_probe.h
===================================================================
--- trunk/src/world_entities/space_ships/collision_probe.h	(revision 9656)
+++ trunk/src/world_entities/space_ships/collision_probe.h	(revision 9869)
@@ -13,4 +13,5 @@
 class CollisionProbe : public Playable
 {
+  ObjectListDeclaration(CollisionProbe);
 
   public:
Index: trunk/src/world_entities/space_ships/cruizer.cc
===================================================================
--- trunk/src/world_entities/space_ships/cruizer.cc	(revision 9656)
+++ trunk/src/world_entities/space_ships/cruizer.cc	(revision 9869)
@@ -29,10 +29,12 @@
 
 #include "graphics_engine.h"
-#include "dot_emitter.h"
-#include "sprite_particles.h"
+#include "particles/dot_emitter.h"
+#include "particles/sprite_particles.h"
 
 #include "debug.h"
 
-CREATE_FACTORY(Cruizer, CL_CRUIZER);
+#include "class_id_DEPRECATED.h"
+ObjectListDefinitionID(Cruizer, CL_CRUIZER);
+CREATE_FACTORY(Cruizer);
 
 /**
@@ -89,5 +91,5 @@
 {
   //  this->setRelDir(Quaternion(M_PI, Vector(1,0,0)));
-  this->setClassID(CL_CRUIZER, "Cruizer");
+  this->registerObject(this, Cruizer::_objectList);
 
   this->setSupportedPlaymodes(Playable::Full3D);
Index: trunk/src/world_entities/space_ships/cruizer.h
===================================================================
--- trunk/src/world_entities/space_ships/cruizer.h	(revision 9656)
+++ trunk/src/world_entities/space_ships/cruizer.h	(revision 9869)
@@ -16,4 +16,5 @@
 class Cruizer : public Playable
 {
+  ObjectListDeclaration(Cruizer);
   public:
     Cruizer(const std::string& fileName);
Index: trunk/src/world_entities/space_ships/helicopter.cc
===================================================================
--- trunk/src/world_entities/space_ships/helicopter.cc	(revision 9656)
+++ trunk/src/world_entities/space_ships/helicopter.cc	(revision 9869)
@@ -25,5 +25,5 @@
 
 #include "util/loading/factory.h"
-#include "util/loading/resource_manager.h"
+#include "sound/resource_sound_buffer.h"
 
 #include "key_mapper.h"
@@ -34,16 +34,19 @@
 #include "debug.h"
 
-CREATE_FACTORY(Helicopter, CL_HELICOPTER);
+#include "class_id_DEPRECATED.h"
+ObjectListDefinitionID(Helicopter, CL_HELICOPTER);
+CREATE_FACTORY(Helicopter);
 #include "script_class.h"
-CREATE_SCRIPTABLE_CLASS(Helicopter, CL_HELICOPTER,
-                        addMethod("moveUp", ExecutorLua1<Helicopter,bool>(&Helicopter::moveUp))
-                            ->addMethod("moveDown", ExecutorLua1<Helicopter,bool>(&Helicopter::moveDown))
-                            ->addMethod("setAbsCoor", ExecutorLua3<PNode,float,float,float>(&PNode::setAbsCoor))
-                            ->addMethod("getAbsCoorX", ExecutorLua0ret<PNode, float>(&PNode::getAbsCoorX))
-                            ->addMethod("getAbsCoorY", ExecutorLua0ret<PNode, float>(&PNode::getAbsCoorY))
-                            ->addMethod("getAbsCoorZ", ExecutorLua0ret<PNode, float>(&PNode::getAbsCoorZ))
+CREATE_SCRIPTABLE_CLASS(Helicopter,
+			addMethod("moveUp", Executor1<Helicopter, lua_State*,bool>(&Helicopter::moveUp))
+			    ->addMethod("moveDown", Executor1<Helicopter, lua_State*,bool>(&Helicopter::moveDown))
+			    ->addMethod("setAbsCoor", Executor3<PNode, lua_State*,float,float,float>(&PNode::setAbsCoor))
+			    ->addMethod("getAbsCoorX", Executor0ret<PNode, lua_State*, float>(&PNode::getAbsCoorX))
+			    ->addMethod("getAbsCoorY", Executor0ret<PNode, lua_State*, float>(&PNode::getAbsCoorY))
+			    ->addMethod("getAbsCoorZ", Executor0ret<PNode, lua_State*, float>(&PNode::getAbsCoorZ))
 
                        );
 
+
 /**
  *  creates the controlable Helicopter
@@ -60,7 +63,4 @@
 {
   this->setPlayer(NULL);
-
-  if (this->chopperBuffer != NULL)
-    ResourceManager::getInstance()->unload(this->chopperBuffer);
 }
 
@@ -100,5 +100,5 @@
   Weapon* wpLeft = new TestGun(1);
   wpLeft->setName("testGun Left");
-  Weapon* cannon = dynamic_cast<Weapon*>(Factory::fabricate(CL_CANNON));
+  Weapon* cannon = dynamic_cast<Weapon*>(Factory::fabricate("Cannon"));
 
   cannon->setName("BFG");
@@ -112,7 +112,5 @@
 
   //load sound
-  if (this->chopperBuffer != NULL)
-    ResourceManager::getInstance()->unload(this->chopperBuffer);
-  this->chopperBuffer = (OrxSound::SoundBuffer*)ResourceManager::getInstance()->load("sound/engine/chopper.wav", WAV);
+  this->chopperBuffer = OrxSound::ResourceSoundBuffer("sound/engine/chopper.wav");
 
 }
@@ -124,7 +122,5 @@
 void Helicopter::init()
 {
-  this->chopperBuffer = NULL;
-
-  this->setClassID(CL_HELICOPTER, "Helicopter");
+  this->registerObject(this, Helicopter::_objectList);
   PRINTF(4)("HELICOPTER INIT\n");
 
Index: trunk/src/world_entities/space_ships/helicopter.h
===================================================================
--- trunk/src/world_entities/space_ships/helicopter.h	(revision 9656)
+++ trunk/src/world_entities/space_ships/helicopter.h	(revision 9869)
@@ -17,4 +17,5 @@
 class Helicopter : public Playable
 {
+  ObjectListDeclaration(Helicopter);
 
   public:
@@ -79,5 +80,5 @@
 
     OrxSound::SoundSource  soundSource;
-    OrxSound::SoundBuffer* chopperBuffer;
+    OrxSound::SoundBuffer  chopperBuffer;
 
 };
Index: trunk/src/world_entities/space_ships/hover.cc
===================================================================
--- trunk/src/world_entities/space_ships/hover.cc	(revision 9656)
+++ trunk/src/world_entities/space_ships/hover.cc	(revision 9869)
@@ -34,14 +34,16 @@
 #include "debug.h"
 
-CREATE_FACTORY(Hover, CL_HOVER);
+#include "class_id_DEPRECATED.h"
+ObjectListDefinitionID(Hover, CL_HOVER);
+CREATE_FACTORY(Hover);
 
 #include "script_class.h"
-CREATE_SCRIPTABLE_CLASS(Hover, CL_HOVER,
-                        addMethod("hasPlayer", ExecutorLua0ret<Playable,bool>(&Playable::hasPlayer))
+CREATE_SCRIPTABLE_CLASS(Hover,
+			addMethod("hasPlayer", Executor0ret<Playable, lua_State*,bool>(&Playable::hasPlayer))
                         //Coordinates
-                        ->addMethod("setAbsCoor", ExecutorLua3<PNode,float,float,float>(&PNode::setAbsCoor))
-                        ->addMethod("getAbsCoorX", ExecutorLua0ret<PNode, float>(&PNode::getAbsCoorX))
-                        ->addMethod("getAbsCoorY", ExecutorLua0ret<PNode, float>(&PNode::getAbsCoorY))
-                        ->addMethod("getAbsCoorZ", ExecutorLua0ret<PNode, float>(&PNode::getAbsCoorZ))
+			    ->addMethod("setAbsCoor", Executor3<PNode, lua_State*,float,float,float>(&PNode::setAbsCoor))
+			    ->addMethod("getAbsCoorX", Executor0ret<PNode, lua_State*, float>(&PNode::getAbsCoorX))
+			    ->addMethod("getAbsCoorY", Executor0ret<PNode, lua_State*, float>(&PNode::getAbsCoorY))
+			    ->addMethod("getAbsCoorZ", Executor0ret<PNode, lua_State*, float>(&PNode::getAbsCoorZ))
                        );
 
@@ -98,5 +100,5 @@
   Weapon* wpLeft = new TestGun(1);
   wpLeft->setName("testGun Left");
-  Weapon* cannon = dynamic_cast<Weapon*>(Factory::fabricate(CL_HYPERBLASTER));
+  Weapon* cannon = dynamic_cast<Weapon*>(Factory::fabricate("Hyperblaster"));
 
   cannon->setName("BFG");
@@ -123,5 +125,5 @@
 
   //  this->setRelDir(Quaternion(M_PI, Vector(1,0,0)));
-  this->setClassID(CL_HOVER, "Hover");
+  this->registerObject(this, Hover::_objectList);
   this->toReflectionList();
 
Index: trunk/src/world_entities/space_ships/hover.h
===================================================================
--- trunk/src/world_entities/space_ships/hover.h	(revision 9656)
+++ trunk/src/world_entities/space_ships/hover.h	(revision 9869)
@@ -15,4 +15,5 @@
 class Hover : public Playable
 {
+  ObjectListDeclaration(Hover);
   public:
 
Index: trunk/src/world_entities/space_ships/space_ship.cc
===================================================================
--- trunk/src/world_entities/space_ships/space_ship.cc	(revision 9656)
+++ trunk/src/world_entities/space_ships/space_ship.cc	(revision 9869)
@@ -26,6 +26,6 @@
 #include "weapons/cannon.h"
 
-#include "dot_emitter.h"
-#include "sprite_particles.h"
+#include "particles/dot_emitter.h"
+#include "particles/sprite_particles.h"
 
 #include "util/loading/factory.h"
@@ -53,19 +53,21 @@
 
 
-
-CREATE_FACTORY(SpaceShip, CL_SPACE_SHIP);
+#include "class_id_DEPRECATED.h"
+ObjectListDefinitionID(SpaceShip, CL_SPACE_SHIP);
+CREATE_FACTORY(SpaceShip);
+
 #include "script_class.h"
-CREATE_SCRIPTABLE_CLASS(SpaceShip, CL_SPACE_SHIP,
-                        addMethod("hasPlayer", ExecutorLua0ret<Playable,bool>(&Playable::hasPlayer))
-                        ->addMethod("fire", ExecutorLua1<Playable, bool>(&Playable::fire))
-                        ->addMethod("loadModel", ExecutorLua2<WorldEntity,const std::string& ,float>(&WorldEntity::loadModel2))
-                        ->addMethod("setName", ExecutorLua1<BaseObject,const std::string&>(&BaseObject::setName))
-                        ->addMethod("hide", ExecutorLua0<WorldEntity>(&WorldEntity::hide))
-                        ->addMethod("unhide", ExecutorLua0<WorldEntity>(&WorldEntity::unhide))
-                       //Coordinates
-                        ->addMethod("setAbsCoor", ExecutorLua3<PNode,float,float,float>(&PNode::setAbsCoor))
-                        ->addMethod("getAbsCoorX", ExecutorLua0ret<PNode, float>(&PNode::getAbsCoorX))
-                        ->addMethod("getAbsCoorY", ExecutorLua0ret<PNode, float>(&PNode::getAbsCoorY))
-                        ->addMethod("getAbsCoorZ", ExecutorLua0ret<PNode, float>(&PNode::getAbsCoorZ))
+CREATE_SCRIPTABLE_CLASS(SpaceShip,
+                        addMethod("hasPlayer", Executor0ret<Playable, lua_State*,bool>(&Playable::hasPlayer))
+                        ->addMethod("fire", Executor1<Playable, lua_State*, bool>(&Playable::fire))
+                        ->addMethod("loadModel", Executor2<WorldEntity, lua_State*,const std::string& ,float>(&WorldEntity::loadModel2))
+                        ->addMethod("setName", Executor1<BaseObject, lua_State*,const std::string&>(&BaseObject::setName))
+                        ->addMethod("hide", Executor0<WorldEntity, lua_State*>(&WorldEntity::hide))
+                        ->addMethod("unhide", Executor0<WorldEntity, lua_State*>(&WorldEntity::unhide))
+                        //Coordinates
+                        ->addMethod("setAbsCoor", Executor3<PNode, lua_State*,float,float,float>(&PNode::setAbsCoor))
+                        ->addMethod("getAbsCoorX", Executor0ret<PNode, lua_State*, float>(&PNode::getAbsCoorX))
+                        ->addMethod("getAbsCoorY", Executor0ret<PNode, lua_State*, float>(&PNode::getAbsCoorY))
+                        ->addMethod("getAbsCoorZ", Executor0ret<PNode, lua_State*, float>(&PNode::getAbsCoorZ))
                        );
 
@@ -116,6 +118,6 @@
 void SpaceShip::init()
 {
-//  this->setRelDir(Quaternion(M_PI, Vector(1,0,0)));
-  this->setClassID(CL_SPACE_SHIP, "SpaceShip");
+  //  this->setRelDir(Quaternion(M_PI, Vector(1,0,0)));
+  this->registerObject(this, SpaceShip::_objectList);
 
   PRINTF(4)("SPACESHIP INIT\n");
@@ -145,5 +147,5 @@
   controlVelocityY = 150;
   shipInertia = 1.5;
-//  cycle = 0.0;
+  //  cycle = 0.0;
 
   this->setHealthMax(100);
@@ -156,14 +158,14 @@
   this->pitchDir = this->getAbsDir();
 
-//   GLGuiButton* button = new GLGuiPushButton();
-//    button->show();
-//    button->setLabel("orxonox");
-//    button->setBindNode(this);
-//     GLGuiBar* bar = new GLGuiBar();
-//     bar->show();
-//     bar->setValue(7.0);
-//     bar->setMaximum(10);
-//     bar->setSize2D( 20, 100);
-//     bar->setAbsCoor2D( 10, 200);
+  //   GLGuiButton* button = new GLGuiPushButton();
+  //    button->show();
+  //    button->setLabel("orxonox");
+  //    button->setBindNode(this);
+  //     GLGuiBar* bar = new GLGuiBar();
+  //     bar->show();
+  //     bar->setValue(7.0);
+  //     bar->setMaximum(10);
+  //     bar->setSize2D( 20, 100);
+  //     bar->setAbsCoor2D( 10, 200);
 
   //add events to the eventlist
@@ -200,13 +202,13 @@
   this->getWeaponManager().setSlotPosition(5, Vector(-1.5, -.5, -.5));
   this->getWeaponManager().setSlotDirection(5, Quaternion(+M_PI_4*.5-M_PI, Vector(1,0,0)));
-//
-   this->getWeaponManager().setSlotPosition(6, Vector(-1, 0.0, 0));
-   this->getWeaponManager().setSlotCapability(6, WTYPE_ALLDIRS | WTYPE_DIRECTIONAL);
-   //
-//   this->getWeaponManager().setSlotPosition(8, Vector(-2.5, -0.3, -2.0));
-//   this->getWeaponManager().setSlotDirection(8, Quaternion(-M_PI, Vector(1,0,0)));
-//
-//   this->getWeaponManager().setSlotPosition(9, Vector(-2.5, -0.3, 2.0));
-//   this->getWeaponManager().setSlotDirection(9, Quaternion(+M_PI, Vector(1,0,0)));:
+  //
+  this->getWeaponManager().setSlotPosition(6, Vector(-1, 0.0, 0));
+  this->getWeaponManager().setSlotCapability(6, WTYPE_ALLDIRS | WTYPE_DIRECTIONAL);
+  //
+  //   this->getWeaponManager().setSlotPosition(8, Vector(-2.5, -0.3, -2.0));
+  //   this->getWeaponManager().setSlotDirection(8, Quaternion(-M_PI, Vector(1,0,0)));
+  //
+  //   this->getWeaponManager().setSlotPosition(9, Vector(-2.5, -0.3, 2.0));
+  //   this->getWeaponManager().setSlotDirection(9, Quaternion(+M_PI, Vector(1,0,0)));:
 
   this->getWeaponManager().getFixedTarget()->setParent(this);
@@ -310,5 +312,4 @@
 void SpaceShip::collidesWith(WorldEntity* entity, const Vector& location)
 {
-
 }
 
@@ -332,5 +333,5 @@
 
   if( ( xMouse != 0 || yMouse != 0 ) && this->getOwner() == SharedNetworkData::getInstance()->getHostID() )
-   {
+  {
     if (xMouse > controlVelocityX) xMouse = controlVelocityX;
     else if (xMouse < -controlVelocityX) xMouse = -controlVelocityX;
@@ -342,13 +343,13 @@
     mouseDir *= (Quaternion(-M_PI/4*xMouse*mouseSensitivity, Vector(0,1,0))*Quaternion(-M_PI/4*yMouse*mouseSensitivity*yInvert, Vector(0,0,1))*pitchDir);
     xMouse = yMouse = 0;
-   }
-
-
-//   if( this != State::getPlayer()->getControllable())
-//     return;
+  }
+
+
+  //   if( this != State::getPlayer()->getControllable())
+  //     return;
 
   // spaceship controlled movement fire(bool bF){ this->bFire = bF;}
   //if (this->getOwner() == this->getHostID())
-    this->calculateVelocity(time);
+  this->calculateVelocity(time);
 
 
@@ -363,8 +364,8 @@
 
   //orient the spaceship in direction of the mouse
-   rotQuat = Quaternion::quatSlerp( this->getAbsDir(), mouseDir, 0.5);//fabsf(time)*shipInertia);
-   if (this->getAbsDir().distance(rotQuat) > 0.00000000000001)
+  rotQuat = Quaternion::quatSlerp( this->getAbsDir(), mouseDir, 0.5);//fabsf(time)*shipInertia);
+  if (this->getAbsDir().distance(rotQuat) > 0.00000000000001)
     this->setAbsDir( rotQuat);
-   //this->setAbsDirSoft(mouseDir,5);
+  //this->setAbsDirSoft(mouseDir,5);
 
   // this is the air friction (necessary for a smooth control)
@@ -388,5 +389,5 @@
   this->shiftCoor(move);
 
-//   PRINTF(0)("id of %s is: %i\n", this->getName(), this->getOMListNumber());
+  //   PRINTF(0)("id of %s is: %i\n", this->getName(), this->getOMListNumber());
 
 }
@@ -409,26 +410,26 @@
 
   if( this->bUp )
-   {
-     //this->shiftCoor(this->getAbsDirX());
-      //accel += (this->getAbsDirX())*2;
-      accel += (this->getAbsDirX())*acceleration;
-
-   }
+  {
+    //this->shiftCoor(this->getAbsDirX());
+    //accel += (this->getAbsDirX())*2;
+    accel += (this->getAbsDirX())*acceleration;
+
+  }
 
   if( this->bDown )
-   {
-     //this->shiftCoor((this->getAbsDirX())*-1);
-     //accel -= (this->getAbsDirX())*2;
+  {
+    //this->shiftCoor((this->getAbsDirX())*-1);
+    //accel -= (this->getAbsDirX())*2;
     //if(velocity.len() > 50)
-     accel -= (this->getAbsDirX())*0.5*acceleration;
-
-
-
-   }
+    accel -= (this->getAbsDirX())*0.5*acceleration;
+
+
+
+  }
 
   if( this->bLeft/* > -this->getRelCoor().z*2*/)
   {
     this->shiftDir(Quaternion(time, Vector(0,1,0)));
-//    accel -= rightDirection;
+    //    accel -= rightDirection;
     //velocityDir.normalize();
     //rot +=Vector(1,0,0);
@@ -449,5 +450,5 @@
   {
     mouseDir *= Quaternion(-time*2, Vector(1,0,0));
-//    accel -= rightDirection;
+    //    accel -= rightDirection;
     //velocityDir.normalize();
     //rot +=Vector(1,0,0);
@@ -467,5 +468,5 @@
     this->shiftDir(Quaternion(time, Vector(0,0,1)));
 
-//    accel += upDirection;
+    //    accel += upDirection;
     //velocityDir.normalize();
     //rot += Vector(0,0,1);
@@ -495,7 +496,7 @@
 
   if( event.type == KeyMapper::PEV_LEFT)
-      this->bRollL = event.bPressed;
+    this->bRollL = event.bPressed;
   else if( event.type == KeyMapper::PEV_RIGHT)
-      this->bRollR = event.bPressed;
+    this->bRollR = event.bPressed;
   else if( event.type == KeyMapper::PEV_FORWARD)
     this->bUp = event.bPressed; //this->shiftCoor(0,.1,0);
Index: trunk/src/world_entities/space_ships/space_ship.h
===================================================================
--- trunk/src/world_entities/space_ships/space_ship.h	(revision 9656)
+++ trunk/src/world_entities/space_ships/space_ship.h	(revision 9869)
@@ -19,4 +19,5 @@
 class SpaceShip : public Playable
 {
+  ObjectListDeclaration(SpaceShip);
 
   public:
@@ -36,5 +37,5 @@
     virtual void postSpawn();
     virtual void leftWorld();
-    
+
     virtual void destroy(WorldEntity* killer);
     virtual void respawn();
Index: trunk/src/world_entities/space_ships/spacecraft_2d.cc
===================================================================
--- trunk/src/world_entities/space_ships/spacecraft_2d.cc	(revision 9656)
+++ trunk/src/world_entities/space_ships/spacecraft_2d.cc	(revision 9869)
@@ -30,6 +30,6 @@
 
 #include "graphics_engine.h"
-#include "dot_emitter.h"
-#include "sprite_particles.h"
+#include "particles/dot_emitter.h"
+#include "particles/sprite_particles.h"
 
 #include "debug.h"
@@ -38,16 +38,18 @@
 
 
-CREATE_FACTORY(Spacecraft2D, CL_SPACECRAFT_2D);
-
-
-CREATE_SCRIPTABLE_CLASS(Spacecraft2D, CL_SPACECRAFT_2D,
-                        addMethod("hasPlayer", ExecutorLua0ret<Playable,bool>(&Playable::hasPlayer))
+#include "class_id_DEPRECATED.h"
+ObjectListDefinitionID(Spacecraft2D, CL_SPACECRAFT_2D);
+CREATE_FACTORY(Spacecraft2D);
+
+CREATE_SCRIPTABLE_CLASS(Spacecraft2D,
+			addMethod("hasPlayer", Executor0ret<Playable, lua_State*,bool>(&Playable::hasPlayer))
                         //Coordinates
-                        ->addMethod("setAbsCoor", ExecutorLua3<PNode,float,float,float>(&PNode::setAbsCoor))
-                        ->addMethod("getAbsCoorX", ExecutorLua0ret<PNode, float>(&PNode::getAbsCoorX))
-                        ->addMethod("getAbsCoorY", ExecutorLua0ret<PNode, float>(&PNode::getAbsCoorY))
-                        ->addMethod("getAbsCoorZ", ExecutorLua0ret<PNode, float>(&PNode::getAbsCoorZ))
-                        ->addMethod("setAirFriction", ExecutorLua1<Spacecraft2D, float>(&Spacecraft2D::setAirFriction))
+			    ->addMethod("setAbsCoor", Executor3<PNode, lua_State*,float,float,float>(&PNode::setAbsCoor))
+			    ->addMethod("getAbsCoorX", Executor0ret<PNode, lua_State*, float>(&PNode::getAbsCoorX))
+			    ->addMethod("getAbsCoorY", Executor0ret<PNode, lua_State*, float>(&PNode::getAbsCoorY))
+			    ->addMethod("getAbsCoorZ", Executor0ret<PNode, lua_State*, float>(&PNode::getAbsCoorZ))
+			    ->addMethod("setAirFriction", Executor1<Spacecraft2D, lua_State*, float>(&Spacecraft2D::setAirFriction))
                        );
+
 
 
@@ -85,12 +87,12 @@
 
   //weapons:
-  Weapon* wpRight = dynamic_cast<Weapon*>(Factory::fabricate(CL_LASER_CANNON));
+  Weapon* wpRight = dynamic_cast<Weapon*>(Factory::fabricate("LaserCannon"));
   wpRight->setName("Cannon_Right");
-  Weapon* wpLeft = dynamic_cast<Weapon*>(Factory::fabricate(CL_LASER_CANNON));
+  Weapon* wpLeft = dynamic_cast<Weapon*>(Factory::fabricate("LaserCannon"));
   wpLeft->setName("Cannon_Left");
 
-  Weapon* turretLeft = dynamic_cast<Weapon*>(Factory::fabricate(CL_BOOMERANG_GUN));
+  Weapon* turretLeft = dynamic_cast<Weapon*>(Factory::fabricate("BoomerangGun"));
   wpRight->setName("Turret_Left");
-  Weapon* turretRight = dynamic_cast<Weapon*>(Factory::fabricate(CL_BOOMERANG_GUN));
+  Weapon* turretRight = dynamic_cast<Weapon*>(Factory::fabricate("BoomerangGun"));
   wpLeft->setName("Turret_Right");
 
@@ -125,5 +127,5 @@
 {
   //  this->setRelDir(Quaternion(M_PI, Vector(1,0,0)));
-  this->setClassID(CL_SPACECRAFT_2D, "Spacecraft2D");
+  this->registerObject(this, Spacecraft2D::_objectList);
 
   this->setSupportedPlaymodes(Playable::Full3D | Playable::Horizontal );
Index: trunk/src/world_entities/space_ships/spacecraft_2d.h
===================================================================
--- trunk/src/world_entities/space_ships/spacecraft_2d.h	(revision 9656)
+++ trunk/src/world_entities/space_ships/spacecraft_2d.h	(revision 9869)
@@ -16,4 +16,5 @@
 class Spacecraft2D : public Playable
 {
+  ObjectListDeclaration(Spacecraft2D);
   public:
     Spacecraft2D(const std::string& fileName);
Index: trunk/src/world_entities/space_ships/turbine_hover.cc
===================================================================
--- trunk/src/world_entities/space_ships/turbine_hover.cc	(revision 9656)
+++ trunk/src/world_entities/space_ships/turbine_hover.cc	(revision 9869)
@@ -29,10 +29,12 @@
 
 #include "graphics_engine.h"
-#include "dot_emitter.h"
-#include "sprite_particles.h"
+#include "particles/dot_emitter.h"
+#include "particles/sprite_particles.h"
 
 #include "debug.h"
 
-CREATE_FACTORY(TurbineHover, CL_TURBINE_HOVER);
+#include "class_id_DEPRECATED.h"
+ObjectListDefinitionID(TurbineHover, CL_TURBINE_HOVER);
+CREATE_FACTORY(TurbineHover);
 
 /**
@@ -101,5 +103,5 @@
 {
   //  this->setRelDir(Quaternion(M_PI, Vector(1,0,0)));
-  this->setClassID(CL_TURBINE_HOVER, "TurbineHover");
+  this->registerObject(this, TurbineHover::_objectList);
 
   this->setSupportedPlaymodes(Playable::Full3D | Playable::Horizontal | Playable::Vertical);
Index: trunk/src/world_entities/space_ships/turbine_hover.h
===================================================================
--- trunk/src/world_entities/space_ships/turbine_hover.h	(revision 9656)
+++ trunk/src/world_entities/space_ships/turbine_hover.h	(revision 9869)
@@ -18,65 +18,66 @@
 class TurbineHover : public Playable
 {
-  public:
-    TurbineHover(const std::string& fileName);
-    TurbineHover(const TiXmlElement* root = NULL);
-    virtual ~TurbineHover();
+  ObjectListDeclaration(TurbineHover);
+public:
+  TurbineHover(const std::string& fileName);
+  TurbineHover(const TiXmlElement* root = NULL);
+  virtual ~TurbineHover();
 
-    void setBoostColor(const Color& color);
+  void setBoostColor(const Color& color);
 
-    virtual void loadParams(const TiXmlElement* root);
-    virtual void setPlayDirection(const Quaternion& rot, float speed = 0.0f);
-    virtual void enter();
-    virtual void leave();
+  virtual void loadParams(const TiXmlElement* root);
+  virtual void setPlayDirection(const Quaternion& rot, float speed = 0.0f);
+  virtual void enter();
+  virtual void leave();
 
-    virtual void setTeam(int teamID);
+  virtual void setTeam(int teamID);
 
-    virtual void postSpawn();
-    virtual void leftWorld();
-    virtual void respawn();
+  virtual void postSpawn();
+  virtual void leftWorld();
+  virtual void respawn();
 
-    virtual void collidesWith(WorldEntity* entity, const Vector& location);
-    virtual void tick(float dt);
-    virtual void draw() const;
+  virtual void collidesWith(WorldEntity* entity, const Vector& location);
+  virtual void tick(float dt);
+  virtual void draw() const;
 
-    virtual void process(const Event &event);
+  virtual void process(const Event &event);
 
-  private:
-    void init();
-    void movement(float dt);
+private:
+  void init();
+  void movement(float dt);
 
-  private:
-    bool                  bForward;           //!< forward button pressed.
-    bool                  bBackward;          //!< backward button pressed.
-    bool                  bLeft;              //!< left button pressed.
-    bool                  bRight;             //!< right button pressed.
-    bool                  bAscend;            //!< ascend button pressed.
-    bool                  bDescend;           //!< descend button presses.
+private:
+  bool                  bForward;           //!< forward button pressed.
+  bool                  bBackward;          //!< backward button pressed.
+  bool                  bLeft;              //!< left button pressed.
+  bool                  bRight;             //!< right button pressed.
+  bool                  bAscend;            //!< ascend button pressed.
+  bool                  bDescend;           //!< descend button presses.
 
-    int                   yInvert;
-    float                 mouseSensitivity;   //!< the mouse sensitivity
+  int                   yInvert;
+  float                 mouseSensitivity;   //!< the mouse sensitivity
 
-    PNode                 wingNodeLeft;
-    PNode                 wingNodeRight;
-    PNode                 rotorNodeLeft;
-    PNode                 rotorNodeRight;
+  PNode                 wingNodeLeft;
+  PNode                 wingNodeRight;
+  PNode                 rotorNodeLeft;
+  PNode                 rotorNodeRight;
 
-    PNode                 cameraNode;
-    float                 cameraLook;
-    float                 rotation;
+  PNode                 cameraNode;
+  float                 cameraLook;
+  float                 rotation;
 
-   // Vector                velocity;           //!< the velocity of the TurbineHover.
-    Quaternion            direction;          //!< the direction of the TurbineHover.
-    float                 travelSpeed;        //!< the current speed of the Hove (to make soft movement)
-    float                 acceleration;       //!< the acceleration of the TurbineHover.
-    float                 airFriction;        //!< AirFriction.
+  // Vector                velocity;           //!< the velocity of the TurbineHover.
+  Quaternion            direction;          //!< the direction of the TurbineHover.
+  float                 travelSpeed;        //!< the current speed of the Hove (to make soft movement)
+  float                 acceleration;       //!< the acceleration of the TurbineHover.
+  float                 airFriction;        //!< AirFriction.
 
-    float                 rotorSpeed;         //!< the speed of the rotor.
-    float                 rotorCycle;         //!< The Cycle the rotor is in.
+  float                 rotorSpeed;         //!< the speed of the rotor.
+  float                 rotorCycle;         //!< The Cycle the rotor is in.
 
-    float                 airViscosity;
+  float                 airViscosity;
 
-    ParticleEmitter*      burstEmitter[2];
-    ParticleSystem*       burstSystem;
+  ParticleEmitter*      burstEmitter[2];
+  ParticleSystem*       burstSystem;
 };
 
Index: trunk/src/world_entities/spawning_point.cc
===================================================================
--- trunk/src/world_entities/spawning_point.cc	(revision 9656)
+++ trunk/src/world_entities/spawning_point.cc	(revision 9869)
@@ -22,6 +22,4 @@
 #include "world_entity.h"
 
-#include "class_list.h"
-
 #include "compiler.h"
 
@@ -35,6 +33,7 @@
 #include "converter.h"
 
-CREATE_FACTORY( SpawningPoint, CL_SPAWNING_POINT );
-
+#include "class_id_DEPRECATED.h"
+ObjectListDefinitionID(SpawningPoint, CL_SPAWNING_POINT);
+CREATE_FACTORY( SpawningPoint);
 /**
  *  constructor
@@ -52,5 +51,5 @@
 void SpawningPoint::init()
 {
-  this->setClassID(CL_SPAWNING_POINT, "SpawningPoint");
+  this->registerObject(this, SpawningPoint::_objectList);
   PRINTF(0)("Created SpawningPoint\n");
 
@@ -84,5 +83,5 @@
   /* load teamId */
   LoadParam(root, "teamId", this, SpawningPoint, setTeamId)
-      .describe("sets teamId");
+  .describe("sets teamId");
 }
 
@@ -108,12 +107,9 @@
 void SpawningPoint::spawn(Playable* entity)
 {
-  const std::list<BaseObject*> * list = ClassList::getList( CL_PLAYABLE );
-
   bool found = false;
 
-  if ( !list )
-    return;
-
-  for ( std::list<BaseObject*>::const_iterator it = list->begin(); it != list->end(); it++ )
+  for (ObjectList<Playable>::const_iterator it = Playable::objectList().begin();
+       it != Playable::objectList().end();
+       ++it)
   {
     if ( *it == entity )
@@ -162,12 +158,9 @@
       this->spawn(it->entity);
 
-      const std::list<BaseObject*> * list = ClassList::getList( CL_PLAYABLE );
-
       bool found = false;
 
-      if ( !list )
-        return;
-
-      for ( std::list<BaseObject*>::const_iterator it2 = list->begin(); it2 != list->end(); it2++ )
+      for (ObjectList<Playable>::const_iterator it2 = Playable::objectList().begin();
+           it2 != Playable::objectList().end();
+           ++it2)
       {
         if ( *it2 == it->entity )
@@ -202,6 +195,5 @@
  */
 void SpawningPoint::draw() const
-{
-}
+{}
 
 void SpawningPoint::sendRespawnMessage( int uniqueId )
@@ -243,16 +235,13 @@
   Playable      * playable = NULL;
 
-  const std::list<BaseObject*> * list = ClassList::getList( CL_SPAWNING_POINT );
-
-  if ( list )
-  {
-    for ( std::list<BaseObject*>::const_iterator it = list->begin(); it != list->end(); it++ )
-    {
-      PRINTF(0)("%d:%d\n", dynamic_cast<SpawningPoint*>(*it)->getUniqueID(), spUniqueId);
-      if ( dynamic_cast<SpawningPoint*>(*it)->getUniqueID() == spUniqueId )
-      {
-        sp = dynamic_cast<SpawningPoint*>(*it);
-        break;
-      }
+  for (ObjectList<SpawningPoint>::const_iterator it = SpawningPoint::objectList().begin();
+       it != SpawningPoint::objectList().end();
+       ++it)
+  {
+    PRINTF(0)("%d:%d\n", (*it)->getUniqueID(), spUniqueId);
+    if ( (*it)->getUniqueID() == spUniqueId )
+    {
+      sp = (*it);
+      break;
     }
   }
@@ -264,15 +253,12 @@
   }
 
-  list = ClassList::getList( CL_PLAYABLE );
-
-  if ( list )
-  {
-    for ( std::list<BaseObject*>::const_iterator it = list->begin(); it != list->end(); it++ )
-    {
-      if ( dynamic_cast<Playable*>(*it)->getUniqueID() == uniqueId )
-      {
-        playable = dynamic_cast<Playable*>(*it);
-        break;
-      }
+  for (ObjectList<Playable>::const_iterator it = Playable::objectList().begin();
+       it != Playable::objectList().end();
+       ++it)
+  {
+    if ( (*it)->getUniqueID() == uniqueId )
+    {
+      playable = (*it);
+      break;
     }
   }
Index: trunk/src/world_entities/spawning_point.h
===================================================================
--- trunk/src/world_entities/spawning_point.h	(revision 9656)
+++ trunk/src/world_entities/spawning_point.h	(revision 9869)
@@ -42,5 +42,5 @@
  */
 class SpawningPoint : public WorldEntity {
-
+  ObjectListDeclaration(SpawningPoint);
   public:
     SpawningPoint(const TiXmlElement* root = NULL);
Index: trunk/src/world_entities/spectator.cc
===================================================================
--- trunk/src/world_entities/spectator.cc	(revision 9656)
+++ trunk/src/world_entities/spectator.cc	(revision 9869)
@@ -22,8 +22,7 @@
 #include "shared_network_data.h"
 
-CREATE_FACTORY(Spectator, CL_SPECTATOR);
-
-
-
+#include "class_id_DEPRECATED.h"
+ObjectListDefinitionID(Spectator, CL_SPECTATOR);
+CREATE_FACTORY(Spectator);
 
 
@@ -58,5 +57,5 @@
 {
 //  this->setRelDir(Quaternion(M_PI, Vector(1,0,0)));
-  this->setClassID(CL_SPECTATOR, "Spectator");
+  this->registerObject(this, Spectator::_objectList);
 
   this->getWeaponManager().changeWeaponConfig(1);
@@ -89,5 +88,5 @@
   dynamic_cast<Element2D*>(this->getWeaponManager().getFixedTarget())->setVisibility( false);
 
- 
+
   registerVar( new SynchronizeableBool( &bLeft, &bLeft, "bLeft", PERMISSION_OWNER ) );
   registerVar( new SynchronizeableBool( &bRight, &bRight, "bRight", PERMISSION_OWNER ) );
@@ -161,50 +160,50 @@
 {
   Playable::tick( time );
-  
+
   if( ( xMouse != 0 || yMouse != 0 ) && this->getOwner() == SharedNetworkData::getInstance()->getHostID() )
   {
     xMouse *= time / 10;
     yMouse *= time / 10;
-    
+
     angleX -= xMouse;
     angleY -= yMouse;
-    
+
     if ( angleY > 2.05 )
       angleY = 2.05;
-    
+
     if ( angleY < -1.15 )
       angleY = -1.15;
-    
+
     this->mouseDir = Quaternion( angleX, Vector( 0, 1, 0 ) ) * Quaternion( angleY, Vector( 0, 0, 1 ) );
-    
+
     xMouse = yMouse = 0;
   }
-  
+
   this->setAbsDir( this->mouseDir );
-  
+
   Vector velocity;
-  
+
   if ( this->bForward )
   {
     velocity += this->getAbsDirX();
   }
-  
+
   if ( this->bBackward )
   {
     velocity -= this->getAbsDirX();
   }
-  
+
   if ( this->bRight )
   {
     velocity += this->getAbsDirZ();
   }
-  
+
   if ( this->bLeft )
   {
     velocity -= this->getAbsDirZ();
   }
-  
+
   velocity *= 100;
-  
+
   this->shiftCoor( velocity*time );
 }
Index: trunk/src/world_entities/spectator.h
===================================================================
--- trunk/src/world_entities/spectator.h	(revision 9656)
+++ trunk/src/world_entities/spectator.h	(revision 9869)
@@ -11,4 +11,5 @@
 class Spectator : public Playable
 {
+  ObjectListDeclaration(Spectator);
 
   public:
@@ -37,5 +38,5 @@
     bool                  bForward;
     bool                  bBackward;
-    
+
     float                 xMouse;             //!< mouse moved in x-Direction
     float                 yMouse;             //!< mouse moved in y-Direction
Index: trunk/src/world_entities/terrain.cc
===================================================================
--- trunk/src/world_entities/terrain.cc	(revision 9656)
+++ trunk/src/world_entities/terrain.cc	(revision 9869)
@@ -18,9 +18,9 @@
 #include "terrain.h"
 
+#include "util/loading/resource_manager.h"
 #include "util/loading/load_param.h"
 #include "util/loading/factory.h"
 #include "spatial_separation.h"
 
-#include "util/loading/resource_manager.h"
 #include "model.h"
 #include "network_game_manager.h"
@@ -32,8 +32,9 @@
 
 #include "state.h"
-
-
-
-CREATE_FACTORY(Terrain, CL_TERRAIN);
+#include "debug.h"
+
+#include "class_id_DEPRECATED.h"
+ObjectListDefinitionID(Terrain, CL_TERRAIN);
+CREATE_FACTORY(Terrain);
 
 /**
@@ -88,12 +89,8 @@
 Terrain::~Terrain ()
 {
-  if (objectList)
-    glDeleteLists(this->objectList, 1);
+  if (modelList)
+    glDeleteLists(this->modelList, 1);
   if( this->ssp)
     delete ssp;
-  if (this->vegetation)
-  {
-    ResourceManager::getInstance()->unload(this->vegetation);
-  }
 
   if(this->heightMap)
@@ -104,9 +101,9 @@
 void Terrain::init()
 {
-  this->setClassID(CL_TERRAIN, "Terrain");
+  this->registerObject(this, Terrain::_objectList);
   this->toList(OM_ENVIRON_NOTICK);
   this->toReflectionList();
 
-  this->objectList = 0;
+  this->modelList = 0;
   this->ssp = NULL;
   this->vegetation = NULL;
@@ -147,6 +144,6 @@
   this->heightMap = NULL;
 
-  std::string hmName = ResourceManager::getFullName(heightMapFile);
-  std::string hmColorName = ResourceManager::getFullName(colorMap);
+  std::string hmName = Resources::ResourceManager::getInstance()->prependAbsoluteMainPath(heightMapFile);
+  std::string hmColorName = Resources::ResourceManager::getInstance()->prependAbsoluteMainPath(colorMap);
 
 
@@ -180,9 +177,10 @@
   PRINTF(4)("loadVegetation: %s\n", vegetationFile.c_str());
   if (this->vegetation)
-    ResourceManager::getInstance()->unload(this->vegetation, RP_LEVEL);
+    this->vegetation = 0;
   if (!vegetationFile.empty())
   {
     PRINTF(4)("fetching %s\n", vegetationFile.c_str());
-    this->vegetation = dynamic_cast<Model*>(ResourceManager::getInstance()->load(vegetationFile, OBJ, RP_CAMPAIGN));
+    this->loadModel(vegetationFile, 1.0, 2);
+    this->vegetation = this->getModel(2);
   }
   else
@@ -206,6 +204,6 @@
   //glRotatef (this->getAbsDir().getSpacialAxisAngle(), tmpRot.x, tmpRot.y, tmpRot.z );
 
-  if (this->objectList)
-    glCallList(this->objectList);
+  if (this->modelList)
+    glCallList(this->modelList);
   else if (this->getModel())
     this->getModel()->draw();
@@ -256,6 +254,6 @@
   if (debugTerrain == TERRAIN_DAVE)
   {
-    objectList = glGenLists(1);
-    glNewList (objectList, GL_COMPILE);
+    modelList = glGenLists(1);
+    glNewList (modelList, GL_COMPILE);
 
     glColor3f(1.0,0,0);
Index: trunk/src/world_entities/terrain.h
===================================================================
--- trunk/src/world_entities/terrain.h	(revision 9656)
+++ trunk/src/world_entities/terrain.h	(revision 9869)
@@ -12,5 +12,4 @@
 
 #include "world_entity.h"
-#include "vector.h"
 
 // FORWARD DECLARATION
@@ -26,4 +25,5 @@
 class Terrain : public WorldEntity
 {
+  ObjectListDeclaration(Terrain);
 
  public:
@@ -52,5 +52,5 @@
  private:
    Model*              vegetation;
-   int                 objectList;
+   int                 modelList;
 
    HeightMap*          heightMap;
Index: trunk/src/world_entities/test_entity.cc
===================================================================
--- trunk/src/world_entities/test_entity.cc	(revision 9656)
+++ trunk/src/world_entities/test_entity.cc	(revision 9869)
@@ -26,5 +26,5 @@
 
 #include "test_entity.h"
-
+#include "debug.h"
 
 #include "interactive_model.h"
@@ -35,14 +35,14 @@
 
 
-
-CREATE_FACTORY(TestEntity, CL_TEST_ENTITY);
+#include "class_id_DEPRECATED.h"
+ObjectListDefinition(TestEntity);
+CREATE_FACTORY(TestEntity);
 
 #include "script_class.h"
-CREATE_SCRIPTABLE_CLASS(TestEntity, CL_TEST_ENTITY,
-                            addMethod("setAbsCoor", ExecutorLua3<PNode,float,float,float>(&PNode::setAbsCoor))
-                            ->addMethod("getAbsCoorX", ExecutorLua0ret<PNode, float>(&PNode::getAbsCoorX))
-                            ->addMethod("getAbsCoorY", ExecutorLua0ret<PNode, float>(&PNode::getAbsCoorY))
-                            ->addMethod("getAbsCoorZ", ExecutorLua0ret<PNode, float>(&PNode::getAbsCoorZ))
-                            
+CREATE_SCRIPTABLE_CLASS(TestEntity,
+                        addMethod("setAbsCoor", Executor3<PNode, lua_State*,float,float,float>(&PNode::setAbsCoor))
+                        ->addMethod("getAbsCoorX", Executor0ret<PNode, lua_State*, float>(&PNode::getAbsCoorX))
+                        ->addMethod("getAbsCoorY", Executor0ret<PNode, lua_State*, float>(&PNode::getAbsCoorY))
+                        ->addMethod("getAbsCoorZ", Executor0ret<PNode, lua_State*, float>(&PNode::getAbsCoorZ))
                        );
 
@@ -75,5 +75,5 @@
 void TestEntity::init()
 {
-  this->setClassID(CL_TEST_ENTITY, "TestEntity");
+  this->registerObject(this, TestEntity::_objectList);
   this->toList(OM_GROUP_00);
 
@@ -91,6 +91,6 @@
 
   LoadParam(root, "md2animation", this, TestEntity, setAnim)
-      .describe("sets the animation of the md2 model")
-      .defaultValues(1);
+  .describe("sets the animation of the md2 model")
+  .defaultValues(1);
 
 }
Index: trunk/src/world_entities/test_entity.h
===================================================================
--- trunk/src/world_entities/test_entity.h	(revision 9656)
+++ trunk/src/world_entities/test_entity.h	(revision 9869)
@@ -15,4 +15,5 @@
 class TestEntity : public WorldEntity, public PhysicsInterface
 {
+  ObjectListDeclaration(TestEntity);
  public:
   TestEntity ();
Index: trunk/src/world_entities/weapons/aim.cc
===================================================================
--- trunk/src/world_entities/weapons/aim.cc	(revision 9656)
+++ trunk/src/world_entities/weapons/aim.cc	(revision 9869)
@@ -29,4 +29,5 @@
 
 
+ObjectListDefinition(Aim);
 
 /**
@@ -50,6 +51,6 @@
 Aim::~Aim ()
 {
-/*  if (this->text != NULL)
-    delete this->text;*/
+  /*  if (this->text != NULL)
+      delete this->text;*/
 }
 
@@ -59,5 +60,5 @@
 void Aim::init()
 {
-  this->setClassID(CL_CROSSHAIR, "Aim");
+  this->registerObject(this, Aim::_objectList);
   this->setName("Aim");
 
@@ -79,10 +80,10 @@
 
 
-/*  this->text = new Text();
-  this->text->setLayer(this->getLayer());
-  this->text->setParent2D(this);
-  this->text->setRelCoor2D(10, -50);
-  this->text->setParentMode2D(E2D_PARENT_MOVEMENT);
-  this->text->setText("Testing");*/
+  /*  this->text = new Text();
+    this->text->setLayer(this->getLayer());
+    this->text->setParent2D(this);
+    this->text->setRelCoor2D(10, -50);
+    this->text->setParentMode2D(E2D_PARENT_MOVEMENT);
+    this->text->setText("Testing");*/
 }
 
@@ -92,11 +93,11 @@
 
   LoadParam(root, "texture", this, Aim, setTexture)
-      .describe("the texture-file to load onto the Aim");
+  .describe("the texture-file to load onto the Aim");
 
   LoadParam(root, "size", this, Aim, setSize)
-      .describe("the size of the Aim in Pixels");
+  .describe("the size of the Aim in Pixels");
 
   LoadParam(root, "rotation-speed", this, Aim, setRotationSpeed)
-      .describe("the Speed with which the Aim should rotate");
+  .describe("the Speed with which the Aim should rotate");
 
   LoadParam(root, "target-group", this, Aim, setTargetGroupS);
@@ -107,6 +108,6 @@
   ObjectManager::EntityList::iterator entity;
   //printf("%d\n", this->targetGroup);
-  for (entity = State::getObjectManager()->getObjectList(this->targetGroup).begin();
-       entity != State::getObjectManager()->getObjectList(this->targetGroup).end();
+  for (entity = State::getObjectManager()->getEntityList(this->targetGroup).begin();
+       entity != State::getObjectManager()->getEntityList(this->targetGroup).end();
        entity ++)
   {
@@ -117,5 +118,5 @@
       //if (this->getParent() != (*entity))
       {
-        printf("found target::: %d %s::%s\n", (*entity)->getOMListNumber(), (*entity)->getClassCName(), (*entity)->getCName());
+        //        printf("found target::: %d %s::%s\n", (*entity)->getOMListNumber(), (*entity)->getClassCName(), (*entity)->getCName());
         this->anim->replay();
         this->setParentSoft(*entity, 5);
@@ -125,6 +126,6 @@
   }
 
-   //if no target found:
-   this->setParent(PNode::getNullParent());
+  //if no target found:
+  this->setParent(PNode::getNullParent());
 }
 
@@ -165,42 +166,42 @@
   this->shiftDir2D(dt * rotationSpeed);
 
-//   char outputText[100];
-//   sprintf(outputText, "%s - distance: %f\n", this->getParent()->getName(), (this->source->getAbsCoor() - this->getAbsCoor()).len());
-//   this->text->setText(outputText);
-
-
-//  if (this->source->getAbsCoor().x > this->getAbsCoor().x )
+  //   char outputText[100];
+  //   sprintf(outputText, "%s - distance: %f\n", this->getParent()->getName(), (this->source->getAbsCoor() - this->getAbsCoor()).len());
+  //   this->text->setText(outputText);
+
+
+  //  if (this->source->getAbsCoor().x > this->getAbsCoor().x )
   diffVec = ( this->getAbsCoor() - this->source->getAbsCoor() );
-//only look for target if the aim hasn`t locked a target yet or if the actual target is out of range
-   if(this->getParent() == PNode::getNullParent() ||
+  //only look for target if the aim hasn`t locked a target yet or if the actual target is out of range
+  if(this->getParent() == PNode::getNullParent() ||
       diffVec.len() > range )// ||
-     //( acos( (this->source->getAbsDirX()).dot(diffVec)/(diffVec.len() * (this->source->getAbsDirX()).len() ) ) > angle))
-    {
-     this->setParentSoft(PNode::getNullParent(),5);
-     this->searchTarget();
-    }
-
-//   float z = 0.0f;
-//   glReadPixels ((int)this->getAbsCoor2D().x,
-//                  GraphicsEngine::getInstance()->getResolutionY()-(int)this->getAbsCoor2D().y-1,
-//                  1,
-//                  1,
-//                  GL_DEPTH_COMPONENT,
-//                  GL_FLOAT,
-//                  &z);
-//
-//
-//   GLdouble objX=.0, objY=.0, objZ=.0;
-//   gluUnProject(this->getAbsCoor2D().x,
-//                GraphicsEngine::getInstance()->getResolutionY()-this->getAbsCoor2D().y-1,
-//                .99,  // z
-//                GraphicsEngine::modMat,
-//                GraphicsEngine::projMat,
-//                GraphicsEngine::viewPort,
-//                &objX,
-//                &objY,
-//                &objZ );
-//aa
-//   this->setAbsCoor(objX, objY, objZ);
+    //( acos( (this->source->getAbsDirX()).dot(diffVec)/(diffVec.len() * (this->source->getAbsDirX()).len() ) ) > angle))
+  {
+    this->setParentSoft(PNode::getNullParent(),5);
+    this->searchTarget();
+  }
+
+  //   float z = 0.0f;
+  //   glReadPixels ((int)this->getAbsCoor2D().x,
+  //                  GraphicsEngine::getInstance()->getResolutionY()-(int)this->getAbsCoor2D().y-1,
+  //                  1,
+  //                  1,
+  //                  GL_DEPTH_COMPONENT,
+  //                  GL_FLOAT,
+  //                  &z);
+  //
+  //
+  //   GLdouble objX=.0, objY=.0, objZ=.0;
+  //   gluUnProject(this->getAbsCoor2D().x,
+  //                GraphicsEngine::getInstance()->getResolutionY()-this->getAbsCoor2D().y-1,
+  //                .99,  // z
+  //                GraphicsEngine::modMat,
+  //                GraphicsEngine::projMat,
+  //                GraphicsEngine::viewPort,
+  //                &objX,
+  //                &objY,
+  //                &objZ );
+  //aa
+  //   this->setAbsCoor(objX, objY, objZ);
 }
 
@@ -211,22 +212,22 @@
 {
 
- if( this->getParent() != PNode::getNullParent() )
+  if( this->getParent() != PNode::getNullParent() )
   {
-  glPushMatrix();
-  glTranslatef(this->getAbsCoor2D().x, this->getAbsCoor2D().y, 0);
-
-  glRotatef(this->getAbsDir2D(), 0,0,1);
-  this->material.select();
-  glBegin(GL_TRIANGLE_STRIP);
-  glTexCoord2f(0, 0);
-  glVertex2f(-this->getSizeX2D(), -this->getSizeY2D());
-  glTexCoord2f(1, 0);
-  glVertex2f(this->getSizeX2D(), -this->getSizeY2D());
-  glTexCoord2f(0, 1);
-  glVertex2f(-this->getSizeX2D(), this->getSizeY2D());
-  glTexCoord2f(1, 1);
-  glVertex2f(this->getSizeX2D(), this->getSizeY2D());
-  glEnd();
-  glPopMatrix();
+    glPushMatrix();
+    glTranslatef(this->getAbsCoor2D().x, this->getAbsCoor2D().y, 0);
+
+    glRotatef(this->getAbsDir2D(), 0,0,1);
+    this->material.select();
+    glBegin(GL_TRIANGLE_STRIP);
+    glTexCoord2f(0, 0);
+    glVertex2f(-this->getSizeX2D(), -this->getSizeY2D());
+    glTexCoord2f(1, 0);
+    glVertex2f(this->getSizeX2D(), -this->getSizeY2D());
+    glTexCoord2f(0, 1);
+    glVertex2f(-this->getSizeX2D(), this->getSizeY2D());
+    glTexCoord2f(1, 1);
+    glVertex2f(this->getSizeX2D(), this->getSizeY2D());
+    glEnd();
+    glPopMatrix();
   }
 
Index: trunk/src/world_entities/weapons/aim.h
===================================================================
--- trunk/src/world_entities/weapons/aim.h	(revision 9656)
+++ trunk/src/world_entities/weapons/aim.h	(revision 9869)
@@ -19,4 +19,5 @@
 template<class T> class tAnimation;
 
+
 //! An Aim for zooming in on Targets.
 /**
@@ -28,4 +29,5 @@
 class Aim : public PNode, public Element2D
 {
+  ObjectListDeclaration(Aim);
 
 public:
Index: trunk/src/world_entities/weapons/aiming_system.cc
===================================================================
--- trunk/src/world_entities/weapons/aiming_system.cc	(revision 9656)
+++ trunk/src/world_entities/weapons/aiming_system.cc	(revision 9869)
@@ -21,13 +21,12 @@
 
 #include "state.h"
+#include "debug.h"
 
 #include "aabb.h"
 #include "obb_tree.h"
 
-#include <vector>
 
 
-
-
+ObjectListDefinition(AimingSystem);
 
 /**
@@ -55,5 +54,5 @@
 void AimingSystem::init()
 {
-  this->setClassID(CL_AIMING_SYSTEM, "AimingSystem");
+  this->registerObject(this, AimingSystem::_objectList);
   this->setName("AimingSystem");
 
@@ -63,5 +62,5 @@
   // registering default reactions:
   this->unsubscribeReaction(CREngine::CR_OBJECT_DAMAGE);
-  this->subscribeReaction(CREngine::CR_OBJECT_DAMAGE, CL_WORLD_ENTITY);
+  this->subscribeReaction(CREngine::CR_OBJECT_DAMAGE, WorldEntity::staticClassID());
 
   this->range = 1000.0f;
Index: trunk/src/world_entities/weapons/aiming_system.h
===================================================================
--- trunk/src/world_entities/weapons/aiming_system.h	(revision 9656)
+++ trunk/src/world_entities/weapons/aiming_system.h	(revision 9869)
@@ -21,4 +21,5 @@
 class AimingSystem : public WorldEntity
 {
+  ObjectListDeclaration(AimingSystem);
 
  public:
Index: trunk/src/world_entities/weapons/aiming_turret.cc
===================================================================
--- trunk/src/world_entities/weapons/aiming_turret.cc	(revision 9656)
+++ trunk/src/world_entities/weapons/aiming_turret.cc	(revision 9869)
@@ -27,6 +27,7 @@
 #include "util/loading/factory.h"
 
-CREATE_FACTORY(AimingTurret, CL_AIMING_TURRET);
-
+#include "class_id_DEPRECATED.h"
+ObjectListDefinitionID(AimingTurret, CL_AIMING_TURRET);
+CREATE_FACTORY(AimingTurret);
 
 
@@ -64,5 +65,5 @@
 void AimingTurret::init()
 {
-  this->setClassID(CL_AIMING_TURRET, "AimingTurret");
+  this->registerObject(this, AimingTurret::_objectList);
 
   Animation3D* animation1 = this->getAnimation(WS_ACTIVATING, this);
@@ -86,5 +87,5 @@
 
   this->setCapability(WTYPE_ALLDIRS | WTYPE_TURRET);
-  this->setProjectileType(CL_GUIDED_MISSILE);
+  this->setProjectileTypeC("GuidedMissile");
 
 
Index: trunk/src/world_entities/weapons/aiming_turret.h
===================================================================
--- trunk/src/world_entities/weapons/aiming_turret.h	(revision 9656)
+++ trunk/src/world_entities/weapons/aiming_turret.h	(revision 9869)
@@ -13,4 +13,6 @@
 class AimingTurret : public Weapon
 {
+  ObjectListDeclaration(AimingTurret);
+
 public:
   AimingTurret ();
Index: trunk/src/world_entities/weapons/ammo_container.cc
===================================================================
--- trunk/src/world_entities/weapons/ammo_container.cc	(revision 9656)
+++ trunk/src/world_entities/weapons/ammo_container.cc	(revision 9869)
@@ -23,17 +23,17 @@
 
 
-
+ObjectListDefinition(AmmoContainer);
 /**
  * standard constructor
  * @todo this constructor is not jet implemented - do it
 */
-AmmoContainer::AmmoContainer (ClassID projectileType, float maxEnergy)
+AmmoContainer::AmmoContainer (const ClassID& projectileType, float maxEnergy)
 {
-   this->setClassID(CL_AMMO_CONTAINER, "AmmoContainer");
+  this->registerObject(this, AmmoContainer::_objectList);
 
-   this->projectileType = projectileType;
-   this->maxEnergy = maxEnergy;
+  this->projectileType = projectileType;
+  this->maxEnergy = maxEnergy;
 
-   this->energy = 0.0;
+  this->energy = 0.0;
 }
 
Index: trunk/src/world_entities/weapons/ammo_container.h
===================================================================
--- trunk/src/world_entities/weapons/ammo_container.h	(revision 9656)
+++ trunk/src/world_entities/weapons/ammo_container.h	(revision 9869)
@@ -17,10 +17,11 @@
 //! A class for Storing energy of Projectiles.
 class AmmoContainer : public BaseObject {
+  ObjectListDeclaration(AmmoContainer);
 
  public:
-  AmmoContainer(ClassID projectileType, float maxEnergy = DEFAULT_MAX_ENERGY);
+  AmmoContainer(const ClassID& id, float maxEnergy = DEFAULT_MAX_ENERGY);
   virtual ~AmmoContainer();
 
-  bool operator=(ClassID projectileType) const { return (this->projectileType == projectileType); };
+  bool operator=(int projectileType) const { return (this->projectileType == projectileType); };
   ClassID getProjectileType() const { return this->projectileType; };
 
Index: trunk/src/world_entities/weapons/boomerang_gun.cc
===================================================================
--- trunk/src/world_entities/weapons/boomerang_gun.cc	(revision 9656)
+++ trunk/src/world_entities/weapons/boomerang_gun.cc	(revision 9869)
@@ -27,5 +27,7 @@
 #include "util/loading/factory.h"
 
-CREATE_FACTORY(BoomerangGun, CL_BOOMERANG_GUN);
+#include "class_id_DEPRECATED.h"
+ObjectListDefinitionID(BoomerangGun, CL_BOOMERANG_GUN);
+CREATE_FACTORY(BoomerangGun);
 
 
@@ -61,5 +63,5 @@
 void BoomerangGun::init()
 {
-  this->setClassID(CL_BOOMERANG_GUN, "BoomerangGun");
+  this->registerObject(this, BoomerangGun::_objectList);
 
 
@@ -85,5 +87,5 @@
 
   this->setCapability(WTYPE_ALLDIRS | WTYPE_TURRET);
-  this->setProjectileType(CL_BOOMERANG_PROJECTILE);
+  this->setProjectileTypeC("BoomerangProjectile");
 
   this->loadModel("models/guns/turret1.obj", 5.0);
Index: trunk/src/world_entities/weapons/boomerang_gun.h
===================================================================
--- trunk/src/world_entities/weapons/boomerang_gun.h	(revision 9656)
+++ trunk/src/world_entities/weapons/boomerang_gun.h	(revision 9869)
@@ -11,4 +11,5 @@
 class BoomerangGun : public Weapon
   {
+    ObjectListDeclaration(BoomerangGun);
   public:
     BoomerangGun ();
Index: trunk/src/world_entities/weapons/cannon.cc
===================================================================
--- trunk/src/world_entities/weapons/cannon.cc	(revision 9656)
+++ trunk/src/world_entities/weapons/cannon.cc	(revision 9869)
@@ -32,10 +32,11 @@
 #include "animation3d.h"
 
-#include "fast_factory.h"
-
-
-
-
-CREATE_FACTORY(Cannon, CL_CANNON);
+#include "loading/fast_factory.h"
+
+
+
+#include "class_id_DEPRECATED.h"
+ObjectListDefinitionID(Cannon, CL_CANNON);
+CREATE_FACTORY(Cannon);
 
 /**
@@ -69,5 +70,5 @@
 void Cannon::init()
 {
-  this->setClassID(CL_CANNON, "Cannon");
+  this->registerObject(this, Cannon::_objectList);
 
 //  this->model = (Model*)ResourceManager::getInstance()->load("models/guns/test_gun.obj", OBJ, RP_CAMPAIGN);
@@ -88,5 +89,5 @@
 
   this->setCapability(WTYPE_ALLDIRS | WTYPE_DIRECTIONAL | WTYPE_HEAVY);
-  this->setProjectileType(CL_BOMB);
+  this->setProjectileTypeC("Bomb");
   this->prepareProjectiles(5);
 
Index: trunk/src/world_entities/weapons/cannon.h
===================================================================
--- trunk/src/world_entities/weapons/cannon.h	(revision 9656)
+++ trunk/src/world_entities/weapons/cannon.h	(revision 9869)
@@ -12,4 +12,5 @@
 class Cannon : public Weapon
   {
+    ObjectListDeclaration(Cannon);
   public:
     Cannon ();
Index: trunk/src/world_entities/weapons/crosshair.cc
===================================================================
--- trunk/src/world_entities/weapons/crosshair.cc	(revision 9656)
+++ trunk/src/world_entities/weapons/crosshair.cc	(revision 9869)
@@ -26,5 +26,5 @@
 
 
-
+ObjectListDefinition(Crosshair);
 /**
  * standart constructor
@@ -54,5 +54,5 @@
 void Crosshair::init()
 {
-  this->setClassID(CL_CROSSHAIR, "Crosshair");
+  this->registerObject(this, Crosshair::_objectList);
   this->setName("Crosshair");
 
Index: trunk/src/world_entities/weapons/crosshair.h
===================================================================
--- trunk/src/world_entities/weapons/crosshair.h	(revision 9656)
+++ trunk/src/world_entities/weapons/crosshair.h	(revision 9869)
@@ -22,5 +22,5 @@
 //! A class that enables the
 class Crosshair : public PNode, public Element2D, public EventListener {
-
+  ObjectListDeclaration(Crosshair);
  public:
   Crosshair(const TiXmlElement* root = NULL);
Index: trunk/src/world_entities/weapons/fps_sniper_rifle.cc
===================================================================
--- trunk/src/world_entities/weapons/fps_sniper_rifle.cc	(revision 9656)
+++ trunk/src/world_entities/weapons/fps_sniper_rifle.cc	(revision 9869)
@@ -29,5 +29,5 @@
 
 
-#include "fast_factory.h"
+#include "loading/fast_factory.h"
 
 #include "fps_sniper_rifle.h"
@@ -39,5 +39,7 @@
 
 
-CREATE_FACTORY(FPSSniperRifle, CL_FPS_SNIPER_RIFLE);
+#include "class_id_DEPRECATED.h"
+ObjectListDefinitionID(FPSSniperRifle, CL_FPS_SNIPER_RIFLE);
+CREATE_FACTORY(FPSSniperRifle);
 
 /**
@@ -76,5 +78,5 @@
 void FPSSniperRifle::init()
 {
-  this->setClassID(CL_FPS_SNIPER_RIFLE, "FPSSniperRifle");
+  this->registerObject(this, FPSSniperRifle::_objectList);
 
   this->loadModel("models/guns/fps_sniper_rifle.obj", 0.2);
@@ -98,5 +100,5 @@
 
   this->setCapability(WTYPE_ALLDIRS | WTYPE_DIRECTIONAL);
-  this->setProjectileType(CL_LASER);
+  this->setProjectileTypeC("Laser");
   this->prepareProjectiles(20);
 
@@ -181,5 +183,6 @@
 
   this->material->select();
-  static_cast<StaticModel*>(this->getModel())->draw();
+  this->getModel()->draw();
+  //static_cast<StaticModel*>(this->getModel())->draw();
 
   glPopMatrix();
Index: trunk/src/world_entities/weapons/fps_sniper_rifle.h
===================================================================
--- trunk/src/world_entities/weapons/fps_sniper_rifle.h	(revision 9656)
+++ trunk/src/world_entities/weapons/fps_sniper_rifle.h	(revision 9869)
@@ -39,4 +39,6 @@
 class FPSSniperRifle : public Weapon
   {
+    ObjectListDeclaration(FPSSniperRifle);
+
   public:
     FPSSniperRifle (int leftRight);
Index: trunk/src/world_entities/weapons/hyperblaster.cc
===================================================================
--- trunk/src/world_entities/weapons/hyperblaster.cc	(revision 9656)
+++ trunk/src/world_entities/weapons/hyperblaster.cc	(revision 9869)
@@ -31,10 +31,11 @@
 #include "animation3d.h"
 
-#include "fast_factory.h"
+#include "loading/fast_factory.h"
 
 
 
-
-CREATE_FACTORY(Hyperblaster, CL_HYPERBLASTER);
+#include "class_id_DEPRECATED.h"
+ObjectListDefinitionID(Hyperblaster, CL_HYPERBLASTER);
+CREATE_FACTORY(Hyperblaster);
 
 Hyperblaster::Hyperblaster(const TiXmlElement* root)
@@ -56,5 +57,5 @@
 void Hyperblaster::init()
 {
-  this->setClassID(CL_HYPERBLASTER, "Hyperblaster");
+  this->registerObject(this, Hyperblaster::_objectList);
 
 //  this->model = (Model*)ResourceManager::getInstance()->load("models/guns/test_gun.obj", OBJ, RP_CAMPAIGN);
@@ -76,5 +77,5 @@
 
   this->setCapability(WTYPE_ALLDIRS | WTYPE_DIRECTIONAL | WTYPE_HEAVY);
-  this->setProjectileType(CL_HYPERBLAST);
+  this->setProjectileTypeC("Hyperblast");
   this->prepareProjectiles(2);
 
Index: trunk/src/world_entities/weapons/hyperblaster.h
===================================================================
--- trunk/src/world_entities/weapons/hyperblaster.h	(revision 9656)
+++ trunk/src/world_entities/weapons/hyperblaster.h	(revision 9869)
@@ -12,5 +12,6 @@
 class Hyperblaster : public Weapon
   {
-  public:
+    ObjectListDeclaration(Hyperblaster);
+    public:
     Hyperblaster (const TiXmlElement* root = NULL);
     virtual ~Hyperblaster ();
Index: trunk/src/world_entities/weapons/laser_cannon.cc
===================================================================
--- trunk/src/world_entities/weapons/laser_cannon.cc	(revision 9656)
+++ trunk/src/world_entities/weapons/laser_cannon.cc	(revision 9869)
@@ -29,8 +29,9 @@
 #include "animation3d.h"
 
-#include "fast_factory.h"
+#include "loading/fast_factory.h"
 
-CREATE_FACTORY(LaserCannon, CL_LASER_CANNON);
-
+#include "class_id_DEPRECATED.h"
+ObjectListDefinitionID(LaserCannon, CL_LASER_CANNON);
+CREATE_FACTORY(LaserCannon);
 
 LaserCannon::LaserCannon(const TiXmlElement* root)
@@ -52,5 +53,5 @@
 void LaserCannon::init()
 {
-  this->setClassID(CL_LASER_CANNON, "LaserCannon");
+  this->registerObject(this, LaserCannon::_objectList);
 
 //  this->model = (Model*)ResourceManager::getInstance()->load("models/guns/laser_cannon.obj", OBJ, RP_CAMPAIGN);
@@ -72,5 +73,5 @@
 
   this->setCapability(WTYPE_ALLDIRS | WTYPE_DIRECTIONAL);
-  this->setProjectileType(CL_RAIL_PROJECTILE);
+  this->setProjectileTypeC("RailProjectile");
   this->prepareProjectiles(100);
   this->setEmissionPoint(Vector(2.8,0,0) * 5.0);
Index: trunk/src/world_entities/weapons/laser_cannon.h
===================================================================
--- trunk/src/world_entities/weapons/laser_cannon.h	(revision 9656)
+++ trunk/src/world_entities/weapons/laser_cannon.h	(revision 9869)
@@ -29,5 +29,6 @@
 class LaserCannon : public Weapon
   {
-  public:
+    ObjectListDeclaration(LaserCannon);
+    public:
     LaserCannon (const TiXmlElement* root = NULL);
     virtual ~LaserCannon ();
Index: trunk/src/world_entities/weapons/targeting_turret.cc
===================================================================
--- trunk/src/world_entities/weapons/targeting_turret.cc	(revision 9656)
+++ trunk/src/world_entities/weapons/targeting_turret.cc	(revision 9869)
@@ -26,9 +26,10 @@
 #include "util/loading/factory.h"
 
-CREATE_FACTORY(TargetingTurret, CL_TARGETING_TURRET);
+#include "class_id_DEPRECATED.h"
+ObjectListDefinitionID(TargetingTurret, CL_TARGETING_TURRET);
+CREATE_FACTORY(TargetingTurret);
 
 
 TargetingTurret::TargetingTurret(const TiXmlElement* root)
-  : target(this)
 {
   this->init();
@@ -42,4 +43,6 @@
 TargetingTurret::~TargetingTurret ()
 {
+  if(Aim::objectList().exists(target))
+    delete target;
   // model will be deleted from WorldEntity-destructor
 //  delete this->target;
@@ -48,5 +51,6 @@
 void TargetingTurret::init()
 {
-  this->setClassID(CL_TARGETING_TURRET, "TargetingTurret");
+  this->registerObject(this, TargetingTurret::_objectList);
+  this->target = new Aim(this);
 
   Animation3D* animation1 = this->getAnimation(WS_ACTIVATING, this);
@@ -70,5 +74,5 @@
 
   this->setCapability(WTYPE_ALLDIRS | WTYPE_TURRET);
-  this->setProjectileType(CL_GUIDED_MISSILE);
+  this->setProjectileTypeC("GuidedMissile");
 
 
@@ -76,9 +80,9 @@
   //this->getProjectileFactory()->prepare(100);
 
-  this->target.setVisibility(false);
-  this->target.addNodeFlags(PNODE_PROHIBIT_DELETE_WITH_PARENT | PNODE_PROHIBIT_CHILD_DELETE);
-  this->target.setRange(1000);
-  this->target.setAngle(M_PI_4);
-  this->lockedTarget = &this->target;
+  this->target->setVisibility(false);
+  this->target->addNodeFlags(PNODE_PROHIBIT_DELETE_WITH_PARENT | PNODE_PROHIBIT_CHILD_DELETE);
+  this->target->setRange(1000);
+  this->target->setAngle(M_PI_4);
+  this->lockedTarget = this->target;
 
   this->lockedTime = 0;
@@ -97,5 +101,5 @@
   Weapon::loadParams(root);
 
-  LoadParam(root, "target-group", &target, Aim, setTargetGroupS);
+  LoadParam(root, "target-group", target, Aim, setTargetGroupS);
 
 }
@@ -109,5 +113,5 @@
 void TargetingTurret::deactivate()
 {
-  this->target.setVisibility(false);
+  this->target->setVisibility(false);
 }
 
@@ -117,14 +121,14 @@
     return;
 
-  this->target.tick(dt);
+  this->target->tick(dt);
 
   if( lockedTime >= neededLockTime )
    {
-    lockedTarget = this->target.getParent();
+    lockedTarget = this->target->getParent();
     lockedTime = 0;
    }
 
 
-  if(this->target.getParent() == PNode::getNullParent())
+  if(this->target->getParent() == PNode::getNullParent())
    lockedTime = 0;
   else
Index: trunk/src/world_entities/weapons/targeting_turret.h
===================================================================
--- trunk/src/world_entities/weapons/targeting_turret.h	(revision 9656)
+++ trunk/src/world_entities/weapons/targeting_turret.h	(revision 9869)
@@ -12,4 +12,5 @@
 class TargetingTurret : public Weapon
 {
+  ObjectListDeclaration(TargetingTurret);
 public:
   TargetingTurret(const TiXmlElement* root = NULL);
@@ -26,5 +27,5 @@
   virtual void draw() const;
 
-  void setTargetGroup(OM_LIST targetGroup) { this->target.setTargetGroup(targetGroup); };
+  void setTargetGroup(OM_LIST targetGroup) { this->target->setTargetGroup(targetGroup); };
   const PNode* getLockedTarget() const { return lockedTarget; };
 
@@ -33,5 +34,5 @@
 
 private:
-  Aim            target;
+  Aim*           target;
   PNode*         lockedTarget;
   float          lockedTime;
Index: trunk/src/world_entities/weapons/test_gun.cc
===================================================================
--- trunk/src/world_entities/weapons/test_gun.cc	(revision 9656)
+++ trunk/src/world_entities/weapons/test_gun.cc	(revision 9869)
@@ -31,8 +31,9 @@
 #include "animation3d.h"
 
-#include "fast_factory.h"
-
-CREATE_FACTORY(TestGun, CL_TEST_GUN);
-
+#include "loading/fast_factory.h"
+
+#include "class_id_DEPRECATED.h"
+ObjectListDefinitionID(TestGun, CL_TEST_GUN);
+CREATE_FACTORY(TestGun);
 /**
  *  standard constructor
@@ -109,6 +110,5 @@
 void TestGun::init()
 {
-  this->setClassID(CL_TEST_GUN, "TestGun");
-
+  this->registerObject(this, TestGun::_objectList);
 //  this->model = (Model*)ResourceManager::getInstance()->load("models/guns/test_gun.obj", OBJ, RP_CAMPAIGN);
 
@@ -129,5 +129,5 @@
 
   this->setCapability(WTYPE_ALLDIRS | WTYPE_DIRECTIONAL);
-  this->setProjectileType(CL_LASER);
+  this->setProjectileTypeC("Laser");
   this->prepareProjectiles(100);
 
Index: trunk/src/world_entities/weapons/test_gun.h
===================================================================
--- trunk/src/world_entities/weapons/test_gun.h	(revision 9656)
+++ trunk/src/world_entities/weapons/test_gun.h	(revision 9869)
@@ -37,4 +37,5 @@
 class TestGun : public Weapon
   {
+    ObjectListDeclaration(TestGun);
   public:
     TestGun (int leftRight);
Index: trunk/src/world_entities/weapons/turret.cc
===================================================================
--- trunk/src/world_entities/weapons/turret.cc	(revision 9656)
+++ trunk/src/world_entities/weapons/turret.cc	(revision 9869)
@@ -27,7 +27,7 @@
 #include "util/loading/factory.h"
 
-CREATE_FACTORY(Turret, CL_TURRET);
-
-
+#include "class_id_DEPRECATED.h"
+ObjectListDefinitionID(Turret, CL_TURRET);
+CREATE_FACTORY(Turret);
 
 /**
@@ -62,5 +62,5 @@
 void Turret::init()
 {
-  this->setClassID(CL_TURRET, "Turret");
+  this->registerObject(this, Turret::_objectList);
 
 
@@ -86,5 +86,5 @@
 
   this->setCapability(WTYPE_ALLDIRS | WTYPE_TURRET);
-  this->setProjectileType(CL_ROCKET);
+  this->setProjectileTypeC("Rocket");
 
   this->loadModel("models/guns/turret1.obj");
Index: trunk/src/world_entities/weapons/turret.h
===================================================================
--- trunk/src/world_entities/weapons/turret.h	(revision 9656)
+++ trunk/src/world_entities/weapons/turret.h	(revision 9869)
@@ -11,4 +11,5 @@
 class Turret : public Weapon
   {
+    ObjectListDeclaration(Turret);
   public:
     Turret ();
Index: trunk/src/world_entities/weapons/weapon.cc
===================================================================
--- trunk/src/world_entities/weapons/weapon.cc	(revision 9656)
+++ trunk/src/world_entities/weapons/weapon.cc	(revision 9869)
@@ -21,9 +21,7 @@
 #include "weapon.h"
 
-#include "fast_factory.h"
+#include "loading/fast_factory.h"
 #include "world_entities/projectiles/projectile.h"
 
-#include "util/loading/resource_manager.h"
-#include "class_list.h"
 #include "util/loading/factory.h"
 #include "util/loading/load_param.h"
@@ -33,8 +31,9 @@
 #include "sound_source.h"
 #include "sound_buffer.h"
+#include "resource_sound_buffer.h"
 
 #include "elements/glgui_energywidget.h"
 
-
+ObjectListDefinition(Weapon);
 
 ////////////////////
@@ -58,11 +57,8 @@
 {
   for (int i = 0; i < WS_STATE_COUNT; i++)
-    if (this->animation[i] && ClassList::exists(animation[i], CL_ANIMATION))  //!< @todo this should check animation3D
+    if (this->animation[i] && Animation::objectList().exists(animation[i]))  //!< @todo this should check animation3D
       delete this->animation[i];
-  for (int i = 0; i < WA_ACTION_COUNT; i++)
-    if (this->soundBuffers[i] != NULL && ClassList::exists(this->soundBuffers[i], CL_SOUND_BUFFER))
-      ResourceManager::getInstance()->unload(this->soundBuffers[i]);
-
-  if (ClassList::exists(this->soundSource, CL_SOUND_SOURCE))
+
+  if (OrxSound::SoundSource::objectList().exists(this->soundSource))
     delete this->soundSource;
 }
@@ -73,10 +69,10 @@
  * @returns the newly created Weapon.
  */
-Weapon* Weapon::createWeapon(ClassID weaponID)
+Weapon* Weapon::createWeapon(const ClassID& weaponID)
 {
   BaseObject* createdObject = Factory::fabricate(weaponID);
   if (createdObject != NULL)
   {
-    if (createdObject->isA(CL_WEAPON))
+    if (createdObject->isA(Weapon::staticClassID()))
       return dynamic_cast<Weapon*>(createdObject);
     else
@@ -89,4 +85,21 @@
 }
 
+Weapon* Weapon::createWeapon(const std::string& weaponName)
+{
+  BaseObject* createdObject = Factory::fabricate(weaponName);
+  if (createdObject != NULL)
+  {
+    if (createdObject->isA(Weapon::staticClassID()))
+      return dynamic_cast<Weapon*>(createdObject);
+    else
+    {
+      delete createdObject;
+      return NULL;
+    }
+  }
+  return NULL;
+}
+
+
 /**
  * initializes the Weapon with ALL default values
@@ -96,5 +109,5 @@
 void Weapon::init()
 {
-  this->setClassID(CL_WEAPON, "Weapon");
+  this->registerObject(this, Weapon::_objectList);
   this->currentState     = WS_INACTIVE;            //< Normaly the Weapon is Inactive
   this->requestedAction  = WA_NONE;                //< No action is requested by default
@@ -105,6 +118,4 @@
     this->animation[i] = NULL;                   //< No animation
   }
-  for (int i = 0; i < WA_ACTION_COUNT; i++)
-    this->soundBuffers[i] = NULL;                  //< No Sounds
 
   this->soundSource = new OrxSound::SoundSource(this);       //< Every Weapon has exacty one SoundSource.
@@ -115,5 +126,5 @@
   this->defaultTarget = NULL;                      //< Nothing is Targeted by default.
 
-  this->projectile = CL_NULL;                      //< No Projectile Class is Connected to this weapon
+  this->projectile = NullClass::staticClassID();         //< No Projectile Class is Connected to this weapon
   this->projectileFactory = NULL;                  //< No Factory generating Projectiles is selected.
 
@@ -163,8 +174,6 @@
  * What it does, is telling the Weapon what Projectiles it can Emit.
  */
-void Weapon::setProjectileType(ClassID projectile)
-{
-  if (projectile == CL_NULL)
-    return;
+void Weapon::setProjectileType(const ClassID& projectile)
+{
   this->projectile = projectile;
   this->projectileFactory = FastFactory::searchFastFactory(projectile);
@@ -259,11 +268,9 @@
   if (action >= WA_ACTION_COUNT)
     return;
-  if (this->soundBuffers[action] != NULL)
-    ResourceManager::getInstance()->unload(this->soundBuffers[action]);
 
   else if (!soundFile.empty())
   {
-    this->soundBuffers[action] = (OrxSound::SoundBuffer*)ResourceManager::getInstance()->load(soundFile, WAV);
-    if (this->soundBuffers[action] != NULL)
+    this->soundBuffers[action] = OrxSound::ResourceSoundBuffer(soundFile);
+    if (this->soundBuffers[action].loaded())
     {
       PRINTF(4)("Loaded sound %s to action %s.\n", soundFile.c_str(), actionToChar(action));
@@ -275,5 +282,5 @@
   }
   else
-    this->soundBuffers[action] = NULL;
+    this->soundBuffers[action] = OrxSound::SoundBuffer();
 }
 
@@ -409,21 +416,21 @@
   {
     case WA_SHOOT:
-      return this->fireW();
-      break;
+    return this->fireW();
+    break;
     case WA_CHARGE:
-      return this->chargeW();
-      break;
+    return this->chargeW();
+    break;
     case WA_RELOAD:
-      return this->reloadW();
-      break;
+    return this->reloadW();
+    break;
     case WA_DEACTIVATE:
-      return this->deactivateW();
-      break;
+    return this->deactivateW();
+    break;
     case WA_ACTIVATE:
-      return this->activateW();
-      break;
+    return this->activateW();
+    break;
     default:
-      PRINTF(2)("Action %s Not Implemented yet \n", Weapon::actionToChar(action));
-      return false;
+    PRINTF(2)("Action %s Not Implemented yet \n", Weapon::actionToChar(action));
+    return false;
   }
 }
@@ -438,5 +445,5 @@
   {
     // play Sound
-    if (likely(this->soundBuffers[WA_ACTIVATE] != NULL))
+    if (likely(this->soundBuffers[WA_ACTIVATE].loaded()))
       this->soundSource->play(this->soundBuffers[WA_ACTIVATE]);
     this->updateWidgets();
@@ -460,5 +467,5 @@
     PRINTF(4)("Deactivating the Weapon %s\n", this->getCName());
     // play Sound
-    if (this->soundBuffers[WA_DEACTIVATE] != NULL)
+    if (this->soundBuffers[WA_DEACTIVATE].loaded())
       this->soundSource->play(this->soundBuffers[WA_DEACTIVATE]);
     // deactivate
@@ -479,5 +486,5 @@
   {
     // playing Sound
-    if (this->soundBuffers[WA_CHARGE] != NULL)
+    if (this->soundBuffers[WA_CHARGE].loaded())
       this->soundSource->play(this->soundBuffers[WA_CHARGE]);
 
@@ -504,5 +511,5 @@
   {
     // playing Sound
-    if (this->soundBuffers[WA_SHOOT] != NULL)
+    if (this->soundBuffers[WA_SHOOT].loaded())
       this->soundSource->play(this->soundBuffers[WA_SHOOT]);
     this->updateWidgets();
@@ -528,5 +535,5 @@
 {
   PRINTF(4)("Reloading Weapon %s\n", this->getCName());
-  if (this->ammoContainer.get() != NULL &&
+  if (!this->ammoContainer.isNull() &&
       unlikely(this->energy + this->ammoContainer->getStoredEnergy() < this->minCharge))
   {
@@ -537,8 +544,8 @@
 
 
-  if (this->soundBuffers[WA_RELOAD] != NULL)
+  if (this->soundBuffers[WA_RELOAD].loaded())
     this->soundSource->play(this->soundBuffers[WA_RELOAD]);
 
-  if (this->ammoContainer.get() != NULL)
+  if (!this->ammoContainer.isNull())
     this->ammoContainer->fillWeapon(this);
   else
@@ -680,24 +687,24 @@
   {
     case WA_SHOOT:
-      return "shoot";
-      break;
+    return "shoot";
+    break;
     case WA_CHARGE:
-      return "charge";
-      break;
+    return "charge";
+    break;
     case WA_RELOAD:
-      return "reload";
-      break;
+    return "reload";
+    break;
     case WA_ACTIVATE:
-      return "activate";
-      break;
+    return "activate";
+    break;
     case WA_DEACTIVATE:
-      return "deactivate";
-      break;
+    return "deactivate";
+    break;
     case WA_SPECIAL1:
-      return "special1";
-      break;
+    return "special1";
+    break;
     default:
-      return "none";
-      break;
+    return "none";
+    break;
   }
 }
@@ -743,27 +750,27 @@
   {
     case WS_SHOOTING:
-      return "shooting";
-      break;
+    return "shooting";
+    break;
     case WS_CHARGING:
-      return "charging";
-      break;
+    return "charging";
+    break;
     case WS_RELOADING:
-      return "reloading";
-      break;
+    return "reloading";
+    break;
     case WS_ACTIVATING:
-      return "activating";
-      break;
+    return "activating";
+    break;
     case WS_DEACTIVATING:
-      return "deactivating";
-      break;
+    return "deactivating";
+    break;
     case WS_IDLE:
-      return "idle";
-      break;
+    return "idle";
+    break;
     case WS_INACTIVE:
-      return "inactive";
-      break;
+    return "inactive";
+    break;
     default:
-      return "none";
-      break;
-  }
-}
+    return "none";
+    break;
+  }
+}
Index: trunk/src/world_entities/weapons/weapon.h
===================================================================
--- trunk/src/world_entities/weapons/weapon.h	(revision 9656)
+++ trunk/src/world_entities/weapons/weapon.h	(revision 9869)
@@ -19,4 +19,6 @@
 #include "ammo_container.h"
 
+#include "sound_buffer.h"
+
 // FORWARD DECLARATION
 class Projectile;
@@ -83,9 +85,12 @@
 class Weapon : public WorldEntity
 {
+  ObjectListDeclaration(Weapon);
+
   public:
     // INITIALISATION //
     Weapon ();
     virtual ~Weapon ();
-    static Weapon* createWeapon(ClassID weaponID);
+    static Weapon* createWeapon(const ClassID& weaponID);
+    static Weapon* createWeapon(const std::string& weaponName);
 
     void init();
@@ -110,5 +115,5 @@
     /** @returns the Capabilities of this Weapon */
     inline long getCapability() const { return this->capability; };
-    void setProjectileType(ClassID projectile);
+    void setProjectileType(const ClassID& projectile);
     void setProjectileTypeC(const std::string& projectile);
     /** @returns The projectile's classID */
@@ -216,12 +221,12 @@
     // PHASES //
     ////////////
-    OrxSound::SoundSource* soundSource;                      //!< A SoundSource to play sound from (this is connected to the PNode of the Weapon)
-
-    WeaponState            currentState;                     //!< The State the weapon is in.
-    WeaponAction           requestedAction;                  //!< An action to try to Engage after the currentState ends.
-    float                  stateDuration;                    //!< how long the state has taken until now.
-    float                  times[WS_STATE_COUNT];            //!< Times to stay in the different States @see WeaponState.
-    Animation3D*           animation[WS_STATE_COUNT];        //!< Animations for all the States (you can say yourself on what part of the gun this animation acts).
-    OrxSound::SoundBuffer* soundBuffers[WA_ACTION_COUNT];    //!< SoundBuffers for all actions @see WeaponAction.
+    OrxSound::SoundSource* soundSource;                     //!< A SoundSource to play sound from (this is connected to the PNode of the Weapon)
+
+    WeaponState            currentState;                    //!< The State the weapon is in.
+    WeaponAction           requestedAction;                 //!< An action to try to Engage after the currentState ends.
+    float                  stateDuration;                   //!< how long the state has taken until now.
+    float                  times[WS_STATE_COUNT];           //!< Times to stay in the different States @see WeaponState.
+    Animation3D*           animation[WS_STATE_COUNT];       //!< Animations for all the States (you can say yourself on what part of the gun this animation acts).
+    OrxSound::SoundBuffer  soundBuffers[WA_ACTION_COUNT];   //!< SoundBuffers for all actions @see WeaponAction.
 
     PNode                  emissionPoint;                   //!< The point, where the projectiles are emitted. (this is coppled with the Weapon by default)
Index: trunk/src/world_entities/weapons/weapon_manager.cc
===================================================================
--- trunk/src/world_entities/weapons/weapon_manager.cc	(revision 9656)
+++ trunk/src/world_entities/weapons/weapon_manager.cc	(revision 9869)
@@ -17,14 +17,13 @@
 */
 
-#define DEBUG_SPECIAL_MODULE 4 //DEBUG_MODULE_WEAPON
+#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_WEAPON
 
 #include "weapon_manager.h"
 #include "weapon.h"
 #include "crosshair.h"
-#include "class_list.h"
 
 #include "playable.h"
 
-#include "util/loading/load_param.h"
+#include "util/loading/load_param_xml.h"
 #include "util/loading/factory.h"
 
@@ -32,4 +31,5 @@
 
 
+ObjectListDefinition(WeaponManager);
 /**
  * @brief this initializes the weaponManager for a given nnumber of weapon slots
@@ -57,6 +57,6 @@
   // crosshair being a PNode it must not be deleted (this is because PNodes delete themselves.)
   // rennerc: crosshair seems not to delete itselve
-  if (ClassList::exists(this->crosshair, CL_CROSSHAIR))
-    delete this->crosshair;
+  //if (Crosshair::objectList().exists(this->crosshair))
+  //  delete this->crosshair;
 }
 
@@ -66,5 +66,5 @@
 void WeaponManager::init()
 {
-  this->setClassID(CL_WEAPON_MANAGER, "WeaponManager");
+  this->registerObject(this, WeaponManager::_objectList);
 
   this->parentNode = NULL;
@@ -298,9 +298,9 @@
   {
     this->parentNode->addChild(weapon);
-    if (this->parentEntity->isA(CL_PLAYABLE))
+    if (this->parentEntity->isA(Playable::staticClassID()))
       dynamic_cast<Playable*>(this->parentEntity)->weaponConfigChanged();
     weapon->setDefaultTarget(this->crosshair);
   }
-  PRINTF(3)("Added a new Weapon (%s::%s) to the WeaponManager: config %i/ slot %i\n", weapon->getClassCName(), weapon->getCName(), configID, slotID);
+  PRINTF(4)("Added a new Weapon (%s::%s) to the WeaponManager: config %i/ slot %i\n", weapon->getClassCName(), weapon->getCName(), configID, slotID);
   return true;
 }
@@ -311,5 +311,5 @@
  * @param ammo the ammo to increase
  */
-float WeaponManager::increaseAmmunition(ClassID projectileType, float ammo)
+float WeaponManager::increaseAmmunition(const ClassID& projectileType, float ammo)
 {
   return this->getAmmoContainer(projectileType)->increaseEnergy(ammo);
@@ -324,5 +324,5 @@
 {
   assert (weapon != NULL);
-  return this->increaseAmmunition(weapon->getLeafClassID(), ammo);
+  return this->increaseAmmunition(weapon->getClassID(), ammo);
 
 }
@@ -468,5 +468,5 @@
       else
         this->currentSlotConfig[i].position.deactivateNode();
-      if (this->parentEntity != NULL && this->parentEntity->isA(CL_PLAYABLE))
+      if (this->parentEntity != NULL && this->parentEntity->isA(Playable::staticClassID()))
         dynamic_cast<Playable*>(this->parentEntity)->weaponConfigChanged();
     }
@@ -523,5 +523,5 @@
 }
 
-CountPointer<AmmoContainer>& WeaponManager::getAmmoContainer(ClassID projectileType)
+CountPointer<AmmoContainer>& WeaponManager::getAmmoContainer(const ClassID& projectileType)
 {
   for (unsigned int i = 0; i < this->ammo.size(); i++)
@@ -537,5 +537,5 @@
 {
   assert (weapon != NULL);
-  return (this->getAmmoContainer(weapon->getLeafClassID()));
+  return (this->getAmmoContainer(weapon->getClassID()));
 }
 
Index: trunk/src/world_entities/weapons/weapon_manager.h
===================================================================
--- trunk/src/world_entities/weapons/weapon_manager.h	(revision 9656)
+++ trunk/src/world_entities/weapons/weapon_manager.h	(revision 9869)
@@ -39,4 +39,5 @@
  */
 class WeaponManager : public BaseObject {
+  ObjectListDeclaration(WeaponManager);
 
   //! an enumerator defining a Slot, where a Weapon can be stored inside.
@@ -89,5 +90,5 @@
     void changeWeaponConfig(int weaponConfig);
 
-    float increaseAmmunition(ClassID projectileType, float ammo);
+    float increaseAmmunition(const ClassID& projectileType, float ammo);
     float inclreaseAmmunition(const Weapon* weapon, float ammo);
 
@@ -106,5 +107,5 @@
  // private:
     int getNextFreeSlot(int configID, long capability = WTYPE_ALL);
-    CountPointer<AmmoContainer>& getAmmoContainer(ClassID projectileType);
+    CountPointer<AmmoContainer>& getAmmoContainer(const ClassID& projectileType);
     CountPointer<AmmoContainer>& getAmmoContainer(const Weapon* weapon);
 
Index: trunk/src/world_entities/weather_effects/atmospheric_engine.cc
===================================================================
--- trunk/src/world_entities/weather_effects/atmospheric_engine.cc	(revision 9869)
+++ trunk/src/world_entities/weather_effects/atmospheric_engine.cc	(revision 9869)
@@ -0,0 +1,112 @@
+/*
+   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: Andreas Maechler, David Hasenfratz
+   co-programmer: ...
+*/
+
+#include "atmospheric_engine.h"
+
+#include "weather_effects/fog_effect.h"
+
+#include "util/loading/load_param_xml.h"
+#include "util/loading/factory.h"
+
+ObjectListDefinition(AtmosphericEngine);
+
+/**
+ * @param root The XML-element to load the AtmosphericEngine from
+ */
+AtmosphericEngine::AtmosphericEngine()
+{
+  this->registerObject(this, AtmosphericEngine::_objectList);
+}
+
+/**
+ *  The Pointer to this AtmosphericEngine
+*/
+AtmosphericEngine* AtmosphericEngine::singletonRef = NULL;
+
+
+/**
+ *  destroys a AtmosphericEngine
+ */
+AtmosphericEngine::~AtmosphericEngine()
+{
+  AtmosphericEngine::singletonRef = NULL;
+
+  while(!WeatherEffect::objectList().empty())
+    delete WeatherEffect::objectList().front();
+}
+
+/**
+ * @param root The XML-element to load the AtmosphericEngine from
+ */
+void AtmosphericEngine::loadParams(const TiXmlElement* root)
+{
+  LoadParamXML(root, "WeatherEffect", this, AtmosphericEngine, loadWeatherEffect);
+  LoadParamXML(root, "SunEffect", this, AtmosphericEngine, loadSunEffect);
+}
+
+/**
+ * @param root The XML-element to load WeatherEffects from
+ */
+void AtmosphericEngine::loadWeatherEffect(const TiXmlElement* root)
+{
+  LOAD_PARAM_START_CYCLE(root, element);
+  {
+    PRINTF(4)("element is: %s\n", element->Value());
+    // Factory::fabricate(element);
+
+    BaseObject* bo = Factory::fabricate(element);
+    if( bo == NULL)
+      PRINTF(0)(" Could not create Element %s\n", element->Value());
+  }
+  LOAD_PARAM_END_CYCLE(element);
+}
+
+/**
+ * @param root The XML-element to load SunEffects from
+ */
+void AtmosphericEngine::loadSunEffect(const TiXmlElement* root)
+{
+  LOAD_PARAM_START_CYCLE(root, element);
+  {
+    PRINTF(4)("element is: %s\n", element->Value());
+  }
+  LOAD_PARAM_END_CYCLE(element);
+}
+
+
+/**
+ * draws the effect, if needed
+ */
+void AtmosphericEngine::draw() const
+{
+  for (ObjectList<WeatherEffect>::const_iterator it = WeatherEffect::objectList().begin();
+       it != WeatherEffect::objectList().end();
+       ++it)
+    (*it)->draw();
+}
+
+
+
+/**
+ * ticks the effect if there is any time dependancy
+ */
+void AtmosphericEngine::tick(float dt)
+{
+
+  for (ObjectList<WeatherEffect>::const_iterator it = WeatherEffect::objectList().begin();
+       it != WeatherEffect::objectList().end();
+       ++it)
+    (*it)->tick(dt);
+}
Index: trunk/src/world_entities/weather_effects/atmospheric_engine.h
===================================================================
--- trunk/src/world_entities/weather_effects/atmospheric_engine.h	(revision 9869)
+++ trunk/src/world_entities/weather_effects/atmospheric_engine.h	(revision 9869)
@@ -0,0 +1,43 @@
+/*!
+ * @file atmospheric_engine.h
+ *
+ */
+
+#ifndef _ATMOSPHERIC_ENGINE_H
+#define _ATMOSPHERIC_ENGINE_H
+
+#include "base_object.h"
+
+
+class TiXmlElement;
+
+class AtmosphericEngine : public BaseObject
+{
+  ObjectListDeclaration(AtmosphericEngine);
+  public:
+    ~AtmosphericEngine();
+
+    /** @returns a Pointer to the only object of this Class */
+    inline static AtmosphericEngine* getInstance() { if (!AtmosphericEngine::singletonRef) AtmosphericEngine::singletonRef = new AtmosphericEngine();  return AtmosphericEngine::singletonRef; };
+
+    void loadParams(const TiXmlElement* root);
+
+    void init();
+
+    void draw() const;
+    void tick(float dt);
+
+    // inline bool isActivated() const { return this->bActivated; }
+
+    void loadWeatherEffect(const TiXmlElement* root);
+    void loadSunEffect(const TiXmlElement* root);
+
+  private:
+
+    AtmosphericEngine();
+
+    static AtmosphericEngine*     singletonRef;       //!< Pointer to the only instance of this Class
+};
+
+
+#endif /* _ATMOSPHERIC_ENGINE */
Index: trunk/src/world_entities/weather_effects/cloud_effect.cc
===================================================================
--- trunk/src/world_entities/weather_effects/cloud_effect.cc	(revision 9869)
+++ trunk/src/world_entities/weather_effects/cloud_effect.cc	(revision 9869)
@@ -0,0 +1,451 @@
+/*
+  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: hdavid, amaechler
+
+  INSPIRED BY http://www.codesampler.com/usersrc/usersrc_6.htm#oglu_sky_dome_shader
+*/
+
+#include "cloud_effect.h"
+
+#include "util/loading/load_param.h"
+#include "util/loading/factory.h"
+
+#include "material.h"
+#include "state.h"
+#include "p_node.h"
+#include "shader.h"
+#include "shell_command.h"
+#include "t_animation.h"
+#include "script_class.h"
+
+#include "resource_shader.h"
+
+#include "class_id_DEPRECATED.h"
+
+Vector    CloudEffect::cloudColor;
+Vector    CloudEffect::skyColor;
+Vector    CloudEffect::newCloudColor;
+Vector    CloudEffect::newSkyColor;
+
+bool      CloudEffect::fadeSky;
+bool      CloudEffect::fadeCloud;
+float     CloudEffect::fadeTime;
+
+ObjectListDefinitionID(CloudEffect, CL_CLOUD_EFFECT);
+
+
+SHELL_COMMAND(activate, CloudEffect, activateCloud);
+SHELL_COMMAND(deactivate, CloudEffect, deactivateCloud);
+SHELL_COMMAND(skyColor, CloudEffect, shellSkyColor);
+SHELL_COMMAND(cloudColor, CloudEffect, shellCloudColor);
+
+
+CREATE_SCRIPTABLE_CLASS(CloudEffect,
+                        addMethod("skyColor", Executor4<CloudEffect, lua_State*,float,float,float,float>(&CloudEffect::shellSkyColor))
+                        ->addMethod("cloudColor", Executor4<CloudEffect, lua_State*,float,float,float,float>(&CloudEffect::shellCloudColor))
+                        ->addMethod("activate", Executor0<CloudEffect, lua_State*>(&CloudEffect::activate))
+                        ->addMethod("deactivate", Executor0<CloudEffect, lua_State*>(&CloudEffect::deactivate))
+                       );
+
+
+CREATE_FACTORY(CloudEffect);
+
+CloudEffect::CloudEffect(const TiXmlElement* root) {
+  this->registerObject(this, CloudEffect::_objectList);
+
+    this->init();
+
+    if (root != NULL)
+        this->loadParams(root);
+
+    if(cloudActivate)
+        this->activate();
+}
+
+CloudEffect::~CloudEffect() {
+    this->deactivate();
+
+    if (glIsTexture(noise3DTexName))
+        glDeleteTextures(1, &noise3DTexName);
+}
+
+
+void CloudEffect::init() {
+    PRINTF(4)("Initializing CloudEffect\n");
+
+    // default values
+    this->offsetZ = 0;
+    this->animationSpeed = 2;
+    this->scale = 0.0004f;
+    this->atmosphericRadius = 4000;
+    this->planetRadius = 1500;
+    this->divs = 15;
+    this->cloudActivate = false;
+    fadeSky = false;
+    fadeCloud = false;
+
+
+    skyColor = Vector(0.0f, 0.0f, 0.8f);
+    cloudColor = Vector(0.8f, 0.8f, 0.8f);
+    newSkyColor = skyColor;
+    newCloudColor = cloudColor;
+
+    this->noise3DTexSize = 128;
+    this->noise3DTexName = 0;
+
+    this->make3DNoiseTexture();
+
+    glGenTextures(1, &noise3DTexName);
+    glBindTexture(GL_TEXTURE_3D, noise3DTexName);
+
+    glTexParameterf(GL_TEXTURE_3D, GL_TEXTURE_WRAP_S, GL_REPEAT);
+    glTexParameterf(GL_TEXTURE_3D, GL_TEXTURE_WRAP_T, GL_REPEAT);
+    glTexParameterf(GL_TEXTURE_3D, GL_TEXTURE_WRAP_R, GL_REPEAT);
+    glTexParameterf(GL_TEXTURE_3D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
+    glTexParameterf(GL_TEXTURE_3D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
+
+    glTexImage3D(GL_TEXTURE_3D, 0, GL_RGBA,
+                 noise3DTexSize, noise3DTexSize, noise3DTexSize,
+                 0, GL_RGBA, GL_UNSIGNED_BYTE, noise3DTexPtr);
+
+    this->skydome = new Skydome();
+    this->skydome->setTexture(noise3DTexName);
+
+    this->shader = ResourceShader("/shaders/cloud.vert", "/shaders/cloud.frag");
+
+    this->shader.activateShader();
+
+    Shader::Uniform(shader, "Noise").set(0);
+
+    this->offset = new Shader::Uniform(shader, "Offset");
+    this->skycolor = new Shader::Uniform(shader, "SkyColor");
+    this->cloudcolor = new Shader::Uniform(shader, "CloudColor");
+
+    this->shader.deactivateShader();
+
+    this->skydome->setShader(&shader);
+}
+
+
+void CloudEffect::loadParams(const TiXmlElement* root) {
+    WeatherEffect::loadParams(root);
+
+    LoadParam(root, "speed", this, CloudEffect, setAnimationSpeed);
+    LoadParam(root, "scale", this, CloudEffect, setCloudScale);
+    LoadParam(root, "cloudcolor", this, CloudEffect, setCloudColor);
+    LoadParam(root, "skycolor", this, CloudEffect, setSkyColor);
+
+    LoadParam(root, "planetRadius", this, CloudEffect, setPlanetRadius);
+    LoadParam(root, "atmosphericRadius", this, CloudEffect, setAtmosphericRadius);
+    LoadParam(root, "divisions", this, CloudEffect, setDivisions);
+
+    LOAD_PARAM_START_CYCLE(root, element);
+    {
+        LoadParam_CYCLE(element, "option", this, CloudEffect, setCloudOption);
+    }
+    LOAD_PARAM_END_CYCLE(element);
+}
+
+
+void CloudEffect::activate() {
+    PRINTF(0)( "Activating\n");
+
+    // Can only be set after the loadParams call
+    this->shader.activateShader();
+    Shader::Uniform(shader, "Scale").set(this->scale);
+    this->skycolor->set
+    (skyColor.x, skyColor.y, skyColor.z);
+    this->cloudcolor->set
+    (cloudColor.x, cloudColor.y, cloudColor.z);
+    this->shader.deactivateShader();
+
+    this->skydome->generateSkyPlane(this->divs, this->planetRadius, this->atmosphericRadius, 1, 1);
+    this->skydome->activate();
+
+    this->cloudActivate = true;
+}
+
+void CloudEffect::deactivate() {
+    PRINTF(4)("Deactivating CloudEffect\n");
+
+    this->skydome->deactivate();
+    this->cloudActivate = false;
+}
+
+void CloudEffect::draw() const {}
+
+void CloudEffect::tick (float dt) {
+
+    if (this->cloudActivate) {
+
+        this->offsetZ += 0.05 * dt * this->animationSpeed;
+
+        this->shader.activateShader();
+        this->offset->set
+        (0.0f, 0.0f, offsetZ);
+
+        if(cloudColor != newCloudColor) {
+
+            if(fadeCloud) {
+
+                this->cloudColorFadeX = new tAnimation<CloudEffect>(this, &CloudEffect::setColorCloudX);
+                this->cloudColorFadeX->setInfinity(ANIM_INF_CONSTANT);
+                this->cloudColorFadeY = new tAnimation<CloudEffect>(this, &CloudEffect::setColorCloudY);
+                this->cloudColorFadeY->setInfinity(ANIM_INF_CONSTANT);
+                this->cloudColorFadeZ = new tAnimation<CloudEffect>(this, &CloudEffect::setColorCloudZ);
+                this->cloudColorFadeZ->setInfinity(ANIM_INF_CONSTANT);
+
+                this->cloudColorFadeX->addKeyFrame(cloudColor.x, fadeTime, ANIM_LINEAR);
+                this->cloudColorFadeX->addKeyFrame(newCloudColor.x, 0, ANIM_LINEAR);
+
+                this->cloudColorFadeY->addKeyFrame(cloudColor.y, fadeTime, ANIM_LINEAR);
+                this->cloudColorFadeY->addKeyFrame(newCloudColor.y, 0, ANIM_LINEAR);
+
+                this->cloudColorFadeZ->addKeyFrame(cloudColor.z, fadeTime, ANIM_LINEAR);
+                this->cloudColorFadeZ->addKeyFrame(newCloudColor.z, 0, ANIM_LINEAR);
+
+                fadeCloud = false;
+
+                this->cloudColorFadeX->replay();
+                this->cloudColorFadeY->replay();
+                this->cloudColorFadeZ->replay();
+            }
+
+            this->cloudcolor->set
+            (this->cloudColor.x, this->cloudColor.y, this->cloudColor.z);
+        }
+
+        if(skyColor != newSkyColor) {
+
+            if(fadeSky) {
+
+                this->skyColorFadeX = new tAnimation<CloudEffect>(this, &CloudEffect::setColorSkyX);
+                this->skyColorFadeX->setInfinity(ANIM_INF_CONSTANT);
+                this->skyColorFadeY = new tAnimation<CloudEffect>(this, &CloudEffect::setColorSkyY);
+                this->skyColorFadeY->setInfinity(ANIM_INF_CONSTANT);
+                this->skyColorFadeZ = new tAnimation<CloudEffect>(this, &CloudEffect::setColorSkyZ);
+                this->skyColorFadeZ->setInfinity(ANIM_INF_CONSTANT);
+
+                this->skyColorFadeX->addKeyFrame(skyColor.x, fadeTime, ANIM_LINEAR);
+                this->skyColorFadeX->addKeyFrame(newSkyColor.x, 0, ANIM_LINEAR);
+
+                this->skyColorFadeY->addKeyFrame(skyColor.y, fadeTime, ANIM_LINEAR);
+                this->skyColorFadeY->addKeyFrame(newSkyColor.y, 0, ANIM_LINEAR);
+
+                this->skyColorFadeZ->addKeyFrame(skyColor.z, fadeTime, ANIM_LINEAR);
+                this->skyColorFadeZ->addKeyFrame(newSkyColor.z, 0, ANIM_LINEAR);
+
+                fadeSky = false;
+
+                this->skyColorFadeX->replay();
+                this->skyColorFadeY->replay();
+                this->skyColorFadeZ->replay();
+            }
+
+            this->skycolor->set
+            (this->skyColor.x, this->skyColor.y, this->skyColor.z);
+        }
+
+        this->shader.deactivateShader();
+    }
+}
+
+
+void CloudEffect::setColorSkyX(float color) {
+    skyColor.x = color;
+}
+void CloudEffect::setColorSkyY(float color) {
+    skyColor.y = color;
+}
+void CloudEffect::setColorSkyZ(float color) {
+    skyColor.z = color;
+}
+void CloudEffect::setColorCloudX(float color) {
+    cloudColor.x = color;
+}
+void CloudEffect::setColorCloudY(float color) {
+    cloudColor.y = color;
+}
+void CloudEffect::setColorCloudZ(float color) {
+    cloudColor.z = color;
+}
+
+void CloudEffect::changeSkyColor(Vector color, float time) {
+    newSkyColor = color;
+    fadeSky = true;
+    fadeTime = time;
+}
+
+
+void CloudEffect::changeCloudColor(Vector color, float time) {
+    newCloudColor = color;
+    fadeCloud = true;
+    fadeTime = time;
+}
+
+void CloudEffect::shellSkyColor(float colorX, float colorY, float colorZ, float time) {
+    changeSkyColor( Vector(colorX, colorY, colorZ), time);
+}
+
+void CloudEffect::shellCloudColor(float colorX, float colorY, float colorZ, float time) {
+    changeCloudColor( Vector(colorX, colorY, colorZ), time);
+}
+
+
+
+void CloudEffect::make3DNoiseTexture() {
+    int f, i, j, k, inc;
+    int startFrequency = 4;
+    int numOctaves = 4;
+    double ni[3];
+    double inci, incj, inck;
+    int frequency = startFrequency;
+    GLubyte *ptr;
+    double amp = 0.5;
+
+    if ((noise3DTexPtr = (GLubyte *) malloc(noise3DTexSize *
+                                            noise3DTexSize *
+                                            noise3DTexSize * 4)) == NULL)
+        PRINTF(0)("ERROR: Could not allocate 3D noise texture\n");
+
+    for (f=0, inc=0; f < numOctaves;
+            ++f, frequency *= 2, ++inc, amp *= 0.5) {
+        SetNoiseFrequency(frequency);
+        ptr = noise3DTexPtr;
+        ni[0] = ni[1] = ni[2] = 0;
+
+        inci = 1.0 / (noise3DTexSize / frequency);
+        for (i=0; i<noise3DTexSize; ++i, ni[0] += inci) {
+            incj = 1.0 / (noise3DTexSize / frequency);
+            for (j=0; j<noise3DTexSize; ++j, ni[1] += incj) {
+                inck = 1.0 / (noise3DTexSize / frequency);
+                for (k=0; k<noise3DTexSize; ++k, ni[2] += inck, ptr+= 4) {
+                    *(ptr+inc) = (GLubyte) (((noise3(ni)+1.0) * amp)*128.0);
+                }
+            }
+        }
+    }
+}
+
+void CloudEffect::initNoise() {
+    int i, j, k;
+
+    srand(30757);
+    for (i = 0 ; i < B ; i++) {
+        p[i] = i;
+        g1[i] = (double)((rand() % (B + B)) - B) / B;
+
+        for (j = 0 ; j < 2 ; j++)
+            g2[i][j] = (double)((rand() % (B + B)) - B) / B;
+        normalize2(g2[i]);
+
+        for (j = 0 ; j < 3 ; j++)
+            g3[i][j] = (double)((rand() % (B + B)) - B) / B;
+        normalize3(g3[i]);
+    }
+
+    while (--i) {
+        k = p[i];
+        p[i] = p[j = rand() % B];
+        p[j] = k;
+    }
+
+    for (i = 0 ; i < B + 2 ; i++) {
+        p[B + i] = p[i];
+        g1[B + i] = g1[i];
+        for (j = 0 ; j < 2 ; j++)
+            g2[B + i][j] = g2[i][j];
+        for (j = 0 ; j < 3 ; j++)
+            g3[B + i][j] = g3[i][j];
+    }
+}
+
+void CloudEffect::SetNoiseFrequency( int frequency) {
+    start = 1;
+    B = frequency;
+    BM = B-1;
+}
+
+double CloudEffect::noise3( double vec[3]) {
+    int bx0, bx1, by0, by1, bz0, bz1, b00, b10, b01, b11;
+    double rx0, rx1, ry0, ry1, rz0, rz1, *q, sy, sz, a, b, c, d, t, u, v;
+    int i, j;
+
+    if (start) {
+        start = 0;
+        initNoise();
+    }
+
+    setup(0, bx0,bx1, rx0,rx1);
+    setup(1, by0,by1, ry0,ry1);
+    setup(2, bz0,bz1, rz0,rz1);
+
+    i = p[ bx0 ];
+    j = p[ bx1 ];
+
+    b00 = p[ i + by0 ];
+    b10 = p[ j + by0 ];
+    b01 = p[ i + by1 ];
+    b11 = p[ j + by1 ];
+
+    t  = s_curve(rx0);
+    sy = s_curve(ry0);
+    sz = s_curve(rz0);
+
+    q = g3[ b00 + bz0 ] ;
+    u = at3(rx0,ry0,rz0);
+    q = g3[ b10 + bz0 ] ;
+    v = at3(rx1,ry0,rz0);
+    a = lerp(t, u, v);
+
+    q = g3[ b01 + bz0 ] ;
+    u = at3(rx0,ry1,rz0);
+    q = g3[ b11 + bz0 ] ;
+    v = at3(rx1,ry1,rz0);
+    b = lerp(t, u, v);
+
+    c = lerp(sy, a, b);
+
+    q = g3[ b00 + bz1 ] ;
+    u = at3(rx0,ry0,rz1);
+    q = g3[ b10 + bz1 ] ;
+    v = at3(rx1,ry0,rz1);
+    a = lerp(t, u, v);
+
+    q = g3[ b01 + bz1 ] ;
+    u = at3(rx0,ry1,rz1);
+    q = g3[ b11 + bz1 ] ;
+    v = at3(rx1,ry1,rz1);
+    b = lerp(t, u, v);
+
+    d = lerp(sy, a, b);
+
+    return lerp(sz, c, d);
+}
+
+void CloudEffect::normalize2( double v[2]) {
+    double s;
+
+    s = sqrt(v[0] * v[0] + v[1] * v[1]);
+    v[0] = v[0] / s;
+    v[1] = v[1] / s;
+}
+
+void CloudEffect::normalize3( double v[3]) {
+    double s;
+
+    s = sqrt(v[0] * v[0] + v[1] * v[1] + v[2] * v[2]);
+    v[0] = v[0] / s;
+    v[1] = v[1] / s;
+    v[2] = v[2] / s;
+}
+
Index: trunk/src/world_entities/weather_effects/cloud_effect.h
===================================================================
--- trunk/src/world_entities/weather_effects/cloud_effect.h	(revision 9869)
+++ trunk/src/world_entities/weather_effects/cloud_effect.h	(revision 9869)
@@ -0,0 +1,172 @@
+/**
+ * @file cloud_effect.h
+ * Create clouds
+*/
+
+#ifndef _CLOUD_EFFECT
+#define _CLOUD_EFFECT
+
+#include "weather_effect.h"
+
+#include "sound_buffer.h"
+#include "sound_source.h"
+
+#include "skydome.h"
+#include "material.h"
+#include "shader.h"
+
+#define MAXB 0x100
+#define N 0x1000
+#define NP 12   /* 2^N */
+#define NM 0xfff
+
+#define s_curve(t) ( t * t * (3. - 2. * t) )
+#define lerp(t, a, b) ( a + t * (b - a) )
+#define setup(i,b0,b1,r0,r1)\
+        t = vec[i] + N;\
+        b0 = ((int)t) & BM;\
+        b1 = (b0+1) & BM;\
+        r0 = t - (int)t;\
+        r1 = r0 - 1.;
+#define at2(rx,ry) ( rx * q[0] + ry * q[1] )
+#define at3(rx,ry,rz) ( rx * q[0] + ry * q[1] + rz * q[2] )
+
+// FORWARD DECLARATION
+template <class T>
+class tAnimation;
+
+class CloudEffect : public WeatherEffect {
+  ObjectListDeclaration(CloudEffect);
+
+public:
+
+    CloudEffect(const TiXmlElement* root = NULL);
+    virtual ~CloudEffect();
+
+    virtual void loadParams(const TiXmlElement* root);
+
+    virtual void init();
+
+    virtual void activate();
+    virtual void deactivate();
+
+    void activateCloud() {
+        this->activate();
+    }
+    void deactivateCloud() {
+        this->deactivate();
+    }
+
+    void setCloudOption(const std::string& option) {
+        if (option == "activate")
+            this->cloudActivate = true;
+    }
+
+    void setAnimationSpeed(float speed) {
+        this->animationSpeed = speed;
+    }
+
+    void setCloudScale(float scale) {
+        this->scale = scale;
+    }
+
+    void setCloudColor(float colorX, float colorY, float colorZ) {
+        this->cloudColor = Vector(colorX, colorY, colorZ);
+    }
+
+    void setSkyColor(float colorX, float colorY, float colorZ) {
+        this->skyColor = Vector(colorX, colorY, colorZ);
+    }
+
+    void setPlanetRadius(float planetRadius) {
+        this->planetRadius = planetRadius;
+    }
+
+    void setAtmosphericRadius(float atmosphericRadius) {
+        this->atmosphericRadius = atmosphericRadius;
+    }
+
+    void setDivisions(int divs) {
+        this->divs = divs;
+    }
+
+    virtual void draw() const;
+    virtual void tick(float dt);
+
+    static void changeSkyColor(Vector color, float time);
+    static void changeCloudColor(Vector color, float time);
+
+    void setColorSkyX(float color);
+    void setColorSkyY(float color);
+    void setColorSkyZ(float color);
+    void setColorCloudX(float color);
+    void setColorCloudY(float color);
+    void setColorCloudZ(float color);
+
+    static Vector cloudColor;
+    static Vector skyColor;
+
+    void make3DNoiseTexture();
+    void initNoise();
+    void SetNoiseFrequency(int frequency);
+    double noise3(double vec[3]);
+    void normalize2(double v[2]);
+    void normalize3(double v[3]);
+
+    void generateSkyPlane(int divisions, float planetRadius, float atmosphereRadius,
+                          float hTile, float vTile);
+
+    void shellSkyColor(float colorX, float colorY, float colorZ, float time);
+    void shellCloudColor(float colorX, float colorY, float colorZ, float time);
+
+
+private:
+
+    bool                    cloudActivate;
+    float                   animationSpeed;
+
+    static Vector           newSkyColor;
+    static Vector           newCloudColor;
+
+    // Material             cloudMaterial;
+    Skydome*                 skydome;
+
+    tAnimation<CloudEffect>*  skyColorFadeX;
+    tAnimation<CloudEffect>*  skyColorFadeY;
+    tAnimation<CloudEffect>*  skyColorFadeZ;
+    tAnimation<CloudEffect>*  cloudColorFadeX;
+    tAnimation<CloudEffect>*  cloudColorFadeY;
+    tAnimation<CloudEffect>*  cloudColorFadeZ;
+    static bool fadeSky;
+    static bool fadeCloud;
+    static float fadeTime;
+
+    // SHADER STUFF
+    Shader           shader;
+    Shader::Uniform* offset;
+    Shader::Uniform* skycolor;
+    Shader::Uniform* cloudcolor;
+    float            offsetZ;
+    float            scale;
+    float            planetRadius;
+    float            atmosphericRadius;
+    int              divs;
+
+    // NOISE STUFF
+    int              noise3DTexSize;
+    GLuint           noise3DTexName;
+    GLubyte          *noise3DTexPtr;
+
+    int              p[MAXB + MAXB + 2];
+    double           g3[MAXB + MAXB + 2][3];
+    double           g2[MAXB + MAXB + 2][2];
+    double           g1[MAXB + MAXB + 2];
+
+    int              start;
+    int              B;
+    int              BM;
+
+
+};
+
+#endif  /* _CLOUD_EFFECT */
Index: trunk/src/world_entities/weather_effects/fog_effect.cc
===================================================================
--- trunk/src/world_entities/weather_effects/fog_effect.cc	(revision 9869)
+++ trunk/src/world_entities/weather_effects/fog_effect.cc	(revision 9869)
@@ -0,0 +1,263 @@
+/*
+  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: hdavid, amaechler
+*/
+
+#include "fog_effect.h"
+
+#include "util/loading/load_param.h"
+#include "util/loading/factory.h"
+
+#include "shell_command.h"
+#include "script_class.h"
+#include "cloud_effect.h"
+#include "debug.h"
+
+ObjectListDefinition(FogEffect);
+// Define shell commands
+//SHELL_COMMAND(activate, FogEffect, activateFog);
+//SHELL_COMMAND(deactivate, FogEffect, deactivateFog);
+SHELL_COMMAND(fadein, FogEffect, fadeInFog);
+SHELL_COMMAND(fadeout, FogEffect, fadeOutFog);
+
+#include "class_id_DEPRECATED.h"
+
+CREATE_SCRIPTABLE_CLASS(FogEffect,
+                        addMethod("fadeIn", Executor0<FogEffect, lua_State*>(&FogEffect::fadeInFog))
+                            ->addMethod("fadeOut", Executor0<FogEffect, lua_State*>(&FogEffect::fadeOutFog))
+                            ->addMethod("activate", Executor0<FogEffect, lua_State*>(&FogEffect::activate))
+                            ->addMethod("deactivate", Executor0<FogEffect, lua_State*>(&FogEffect::deactivate))
+                       );
+
+CREATE_FACTORY(FogEffect);
+
+/**
+ * @brief standard constructor
+ */
+FogEffect::FogEffect(const TiXmlElement* root) {
+  this->registerObject(this, FogEffect::_objectList);
+    // Initialize values
+    this->init();
+
+    // Load XML params
+    if (root != NULL)
+        this->loadParams(root);
+
+    // Activate fog, if chosen to be activated by default
+    if (this->fogActivate)
+        this->activate();
+}
+
+/**
+ * @brief standard destructor
+ */
+FogEffect::~FogEffect() {
+    this->deactivate();
+}
+
+/**
+ * @brief initalizes the fog effect with default values
+ */
+void FogEffect::init() {
+    // default values
+  this->fogMode = GL_LINEAR;
+  this->fogDensity = 0.005;
+  this->fogStart = 0;
+  this->fogEnd = 300;
+  this->colorVector = Vector(0.6, 0.0, 0.0);
+
+    // init variables
+  this->fogFadeInDuration = 0;
+  this->fogFadeOutDuration = 0;
+  this->fogFadeDensity = 0;
+  this->fogFadeEnd = 0;
+
+  this->localTimer = 0;
+  this->fogActivate = false;
+  this->fogFadeInActivate = false;
+  this->fogFadeOutActivate = false;
+
+  this->cloudColor = Vector(0.2f, 0.3f, 0.3f);
+  this->skyColor = Vector(0.2f, 0.3f, 0.3f);
+}
+
+/**
+ * @brief loads the fog effect parameters.
+ * @param root: the XML-Element to load the data from
+ */
+void FogEffect::loadParams(const TiXmlElement* root) {
+    WeatherEffect::loadParams(root);
+
+    LoadParam(root, "mode", this, FogEffect, setFogMode).describe("fog mode (linear, exponential)");
+    LoadParam(root, "density", this, FogEffect, setFogDensity).describe("fog density if exp. fog");
+    LoadParam(root, "range", this, FogEffect, setFogRange).describe("fog range: start, end");
+    LoadParam(root, "color", this, FogEffect, setFogColor).describe("fog color: r,g,b");
+    LoadParam(root, "fadeinduration", this, FogEffect, setFogFadeIn).describe("duration of the fade in");
+    LoadParam(root, "fadeoutduration", this, FogEffect, setFogFadeOut).describe("duration of the fade out");
+    LoadParam(root, "cloudcolor", this, FogEffect, setCloudColor);
+    LoadParam(root, "skycolor", this, FogEffect, setSkyColor);
+
+    LOAD_PARAM_START_CYCLE(root, element);
+    {
+      LoadParam_CYCLE(element, "option", this, FogEffect, setFogOption).describe("sets a fog option: activate");
+    }
+    LOAD_PARAM_END_CYCLE(element);
+}
+
+/**
+ * @brief activates the fog effect
+ */
+void FogEffect::activate() {
+    PRINTF(3)( "Activating FogEffect\n");
+
+    // init fogGL
+    GLfloat fogColor[4] = { colorVector.x, colorVector.y, colorVector.z, 1.0};
+    glFogi(GL_FOG_MODE, this->fogMode);
+    glFogfv(GL_FOG_COLOR, fogColor);
+    glHint(GL_FOG_HINT, GL_DONT_CARE);
+    glFogf(GL_FOG_DENSITY, this->fogDensity);
+    glFogf(GL_FOG_START, this->fogStart);
+    glFogf(GL_FOG_END, this->fogEnd);
+
+    this->fogActivate = true;
+
+    glEnable(GL_FOG);
+
+    // Store cloud- and sky color before the snow
+    this->oldCloudColor = CloudEffect::cloudColor;
+    this->oldSkyColor   = CloudEffect::skyColor;
+
+    // Change the colors
+    CloudEffect::changeCloudColor(this->cloudColor, this->fogFadeInDuration);
+    CloudEffect::changeSkyColor(this->skyColor, this->fogFadeInDuration);
+}
+
+/**
+ * @brief deactivates the fog effect
+ */
+void FogEffect::deactivate() {
+    PRINTF(3)("Deactivating FogEffect\n");
+
+    this->fogFadeInActivate = false;
+    this->fogFadeOutActivate = false;
+    this->fogActivate = false;
+
+    glDisable(GL_FOG);
+}
+
+/**
+ * @brief draws the fog effect
+ */
+void FogEffect::draw() const {
+
+    if (!this->fogActivate)
+        return;
+
+    // If fog is fading
+    if ( this->fogFadeInActivate || this->fogFadeOutActivate ) {
+        if ( this->fogMode == GL_LINEAR)
+            glFogf(GL_FOG_END, this->fogFadeEnd);
+        else
+            glFogf(GL_FOG_DENSITY, this->fogFadeDensity);
+    }
+}
+
+/**
+ * @brief ticks the fog effect
+ * @param dt: tick float
+ */
+void FogEffect::tick(float dt) {
+
+    if (!this->fogActivate)
+        return;
+
+    // If fog is fading in
+    if ( this->fogFadeInActivate ) {
+        this->localTimer += dt;
+
+        if ( this->fogMode == GL_LINEAR)
+          this->fogFadeEnd = 2000 * (1 - ( this->localTimer / this->fogFadeInDuration )) + this->fogEnd;
+        else
+            this->fogFadeDensity = ( this->localTimer / this->fogFadeInDuration ) * this->fogDensity;
+
+        if ( this->localTimer >= this->fogFadeInDuration )
+            this->fogFadeInActivate = false;
+    }
+
+    // If fog is fading out
+    if ( this->fogFadeOutActivate ) {
+        this->localTimer += dt;
+
+        if ( this->fogMode == GL_LINEAR)
+          this->fogFadeEnd = 2000 * ( this->localTimer / this->fogFadeOutDuration ) + this->fogEnd;
+        else
+            this->fogFadeDensity = 1 - (( this->localTimer / this->fogFadeOutDuration ) * this->fogDensity);
+
+        if ( this->localTimer >= this->fogFadeOutDuration )
+            this->deactivate();
+    }
+}
+
+/**
+ * @brief fades the fog in
+ */
+void FogEffect::fadeInFog() {
+
+    // If Fog is already fading out, stop it
+    this->fogFadeOutActivate = false;
+
+    // If Fog is already on, turn it off first
+    if (this->fogActivate)
+        this->deactivate();
+
+    // If no manual FadeIn value was set, set a default value
+    if (!this->fogFadeInDuration > 0)
+        this->fogFadeInDuration = 10;
+
+    // Reset local timer
+    this->localTimer = 0;
+
+    // Activate Fog
+    this->activate();
+
+    // set FogFadeIn activate
+    this->fogFadeInActivate = true;
+}
+
+/**
+ * @brief fades the fog out
+ */
+void FogEffect::fadeOutFog() {
+
+    // If Fog is already fading in, stop it
+    this->fogFadeInActivate = false;
+
+
+    // If Fog is off, turn it on first
+    if (!this->fogActivate)
+        this->activate();
+
+    // If no manual FadeOut value was set, set a default value
+    if (!this->fogFadeOutDuration > 0)
+        this->fogFadeOutDuration = 10;
+
+    // set FogFadeOut activate
+    this->fogFadeOutActivate = true;
+
+    // Reset local timer
+    this->localTimer = 0;
+
+    // Restore the old cloud- and sky color
+    CloudEffect::changeCloudColor(this->oldCloudColor, this->fogFadeOutDuration);
+    CloudEffect::changeSkyColor(this->oldSkyColor, this->fogFadeOutDuration);
+}
+
Index: trunk/src/world_entities/weather_effects/fog_effect.h
===================================================================
--- trunk/src/world_entities/weather_effects/fog_effect.h	(revision 9869)
+++ trunk/src/world_entities/weather_effects/fog_effect.h	(revision 9869)
@@ -0,0 +1,130 @@
+/**
+ * @file fog_effect.h
+ * Generates simple openGL fog
+*/
+
+#ifndef _FOG_EFFECT
+#define _FOG_EFFECT
+
+#include "weather_effect.h"
+#include "glincl.h"
+#include "vector.h"
+
+class CloudEffect;
+
+class FogEffect : public WeatherEffect
+{
+  ObjectListDeclaration(FogEffect);
+public:
+  FogEffect(const TiXmlElement* root = NULL);
+  virtual ~FogEffect();
+
+  virtual void loadParams(const TiXmlElement* root);
+
+  virtual void init();
+
+  virtual void activate();
+  virtual void deactivate();
+
+  void activateFog()
+  {
+    this->activate();
+  }
+
+  void deactivateFog()
+  {
+    this->deactivate();
+  }
+
+  virtual void draw() const;
+  virtual void tick(float dt);
+
+  inline void setFogMode(const std::string& mode)
+  {
+    this->fogMode = this->stringToFogMode(mode);
+  }
+
+  inline void setFogDensity(float density)
+  {
+    this->fogDensity = density;
+  }
+
+  inline void setFogRange(float start, float end)
+  {
+    this->fogStart = start;
+    this->fogEnd = end;
+  }
+
+  inline void setFogColor(float r, float g, float b)
+  {
+    this->colorVector = Vector(r, g, b);
+  }
+
+  inline void setFogFadeIn(float fadein)
+  {
+    this->fogFadeInDuration = fadein;
+  }
+
+  inline void setFogFadeOut(float fadeout)
+  {
+    this->fogFadeOutDuration = fadeout;
+  }
+
+  inline void setFogOption(const std::string& option)
+  {
+    if (option == "activate")
+      this->fogActivate = true;
+  }
+
+  inline void setCloudColor(float colorX, float colorY, float colorZ)
+  {
+    this->cloudColor = Vector(colorX, colorY, colorZ);
+  }
+  inline void setSkyColor(float colorX, float colorY, float colorZ)
+  {
+    this->skyColor = Vector(colorX, colorY, colorZ);
+  }
+
+  void fadeInFog();
+  void fadeOutFog();
+
+
+private:
+  inline GLint stringToFogMode(const std::string& mode)
+  {
+    if(mode == "GL_LINEAR")
+      return GL_LINEAR;
+    else if(mode == "GL_EXP")
+      return GL_EXP;
+    else if(mode == "GL_EXP2" )
+      return GL_EXP2;
+    else
+      return -1;
+  }
+
+  bool          fogActivate;
+
+  bool          fogFadeInActivate;
+  bool          fogFadeOutActivate;
+
+  GLfloat       fogFadeInDuration;
+  GLfloat       fogFadeOutDuration;
+
+  GLint         fogMode;
+  GLfloat       fogDensity;
+  GLfloat       fogFadeDensity;
+
+  GLfloat       fogStart;
+  GLfloat       fogEnd;
+  GLfloat       fogFadeEnd;
+
+  Vector        colorVector;
+  float         localTimer;
+
+  Vector oldSkyColor;
+  Vector oldCloudColor;
+  Vector skyColor;
+  Vector cloudColor;
+};
+
+#endif  /* _FOG_EFFECT */
Index: trunk/src/world_entities/weather_effects/lense_flare.cc
===================================================================
--- trunk/src/world_entities/weather_effects/lense_flare.cc	(revision 9869)
+++ trunk/src/world_entities/weather_effects/lense_flare.cc	(revision 9869)
@@ -0,0 +1,230 @@
+
+
+/*
+   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
+*/
+
+#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_GRAPHICS
+
+#include "lense_flare.h"
+
+#include "util/loading/load_param.h"
+#include "util/loading/factory.h"
+
+#include "glincl.h"
+#include "texture.h"
+
+#include "light.h"
+#include "state.h"
+#include "debug.h"
+
+#include "render2D/image_plane.h"
+
+#include "light.h"
+#include "camera.h"
+
+#include "class_id_DEPRECATED.h"
+
+ObjectListDefinitionID(LenseFlare, CL_LENSE_FLARE);
+CREATE_FACTORY(LenseFlare);
+
+/**
+ * @brief default constructor
+ * @param root The XML-element to load the LenseFlare from
+ */
+LenseFlare::LenseFlare(const TiXmlElement* root) {
+  this->registerObject(this, LenseFlare::_objectList);
+
+    /*          length                      image scale */
+    this->flareMatrix[0] = 1.0f;
+    this->flareMatrix[1] = 1.0f;
+    this->flareMatrix[2] = 0.5f;
+    this->flareMatrix[3] = 0.5f;
+    this->flareMatrix[4] = 0.33f;
+    this->flareMatrix[5] = 0.25f;
+    this->flareMatrix[6] = 0.125f;
+    this->flareMatrix[7] = 1.0f;
+    this->flareMatrix[8] = -0.5f;
+    this->flareMatrix[9] = 0.5f;
+    this->flareMatrix[10] = -0.25f;
+    this->flareMatrix[11] = 0.15f;
+    this->flareMatrix[12] = -1.82f;
+    this->flareMatrix[13] = 0.25f;
+
+    this->lightSource = (LightManager::getInstance())->getLight(0);
+    PRINTF(4)("light is: %p\n", this->lightSource);
+
+    if (root != NULL) {
+        this->loadParams(root);
+        this->activate();
+    }
+
+    this->bVisible = true;
+    this->setSourceVisibility(false);
+
+}
+
+
+/**
+ *  destroys a LenseFlare
+ */
+LenseFlare::~LenseFlare() {
+    std::vector<ImagePlane*>::iterator it;
+    for( it = flares.begin(); it != flares.end(); it++)
+        delete (*it);
+}
+
+
+/**
+ * @param root The XML-element to load the LenseFlare from
+ */
+void LenseFlare::loadParams(const TiXmlElement* root) {
+    GraphicsEffect::loadParams(root);
+
+    LOAD_PARAM_START_CYCLE(root, element);
+    {
+        LoadParam_CYCLE(element, "add-flare-texture", this, LenseFlare, addFlare)
+        .describe("adds a lensflare texture to the engine");
+    }
+    LOAD_PARAM_END_CYCLE(element);
+}
+
+
+/**
+ * initializes the fog effect
+ */
+void LenseFlare::init() {}
+
+
+/**
+ * activates the fog effect
+ */
+void LenseFlare::activate() {
+    this->bActivated = true;
+}
+
+
+/**
+ * deactivates the fog effect
+ */
+void LenseFlare::deactivate() {
+    this->bActivated = false;
+}
+
+
+/**
+ * @brief converts a gl mode char to a GLint
+ * @param mode the mode character
+ */
+GLint LenseFlare::stringToFogMode(const std::string& mode) {
+    return 0;
+}
+
+
+/**
+ * @brief adds a texture flare
+ * @param textureName the name of the flare texture
+ *
+ *  1st: Texture of the Sun/Light source itself
+ *  2nd: Texture of the fist halo
+ *  3rd: Texture of small burst
+ *  4th: Texture of the second halo
+ *  5th: Texutre of the second burst
+ *  6th: Texture of the third halo
+ *  7th: Texture of the third burst
+ */
+void LenseFlare::addFlare(const std::string& textureName) {
+    if( this->flares.size() > LF_MAX_FLARES) {
+        PRINTF(2)("You tried to add more than %i lense flares, ignoring\n", LF_MAX_FLARES);
+        return;
+    }
+
+    ImagePlane* bb = new ImagePlane(NULL);
+    if (this->flares.empty())
+        bb->setLayer(E2D_LAYER_BELOW_ALL);
+    bb->setTexture(textureName);
+    bb->setSize(50, 50);
+    this->flares.push_back(bb);
+    bb->setVisibility(true);
+
+    PRINTF(4)("Added a Lenseflare ImagePlane with texture %s\n", textureName.c_str());
+
+    // the first flare belongs to the light source
+    if( this->flares.size() == 1 && this->lightSource != NULL) {
+        bb->setBindNode(static_cast<PNode*>(this->lightSource));
+    }
+
+    PRINTF(4)("Finished adding\n");
+}
+
+
+void LenseFlare::setSourceVisibility(bool visibility) {
+    if (this->bVisible == visibility)
+        return;
+
+    std::vector<ImagePlane*>::const_iterator it;
+    for(it = ++flares.begin(); it != flares.end(); it++)
+        (*it)->setVisibility(visibility);
+    this->bVisible = visibility;
+}
+
+
+/**
+ * tick the effect
+ */
+void LenseFlare::tick(float dt) {
+    if( unlikely(!this->bActivated || this->flares.size() == 0))
+        return;
+
+    // refetch light source information if needed
+    if( unlikely( this->lightSource == NULL)) {
+        this->lightSource = (LightManager::getInstance())->getLight(0);
+        if( this->flares.size() > 0)
+            this->flares[0]->setBindNode(static_cast<PNode*>(this->lightSource));
+    }
+
+    //set the frustum plane
+    if (!flares.empty())
+        this->setSourceVisibility(this->flares[0]->isVisible());
+
+
+    // always update the screen center, it could be, that the window is resized
+    this->screenCenter = Vector2D(State::getResX()/2.0f, State::getResY()/2.0f);
+
+    // flare vector is the direction from the center to the light source
+    this->flareVector = this->flares[0]->getAbsCoor2D() - this->screenCenter;
+    this->distance = this->flareVector.len();
+    this->flareVector.normalize();
+
+    // now calculate the new coordinates of the billboards
+    std::vector<ImagePlane*>::iterator it;
+    int i;
+    for( it = flares.begin(), i = 0; it != flares.end(); it++, i++) {
+        // set the new position
+        if( i == 0)
+            continue;
+
+        (*it)->setAbsCoor2D( this->screenCenter + this->flareVector * this->flareMatrix[i * 2] * this->distance);
+        (*it)->setSize2D(50.0f * this->flareMatrix[i * 2 + 1], 50.0f * this->flareMatrix[i * 2 + 1]);
+        PRINTF(5)("Tick flare %i @ (%f, %f)\n", i, (*it)->getAbsCoor2D().x, (*it)->getAbsCoor2D().y);
+    }
+}
+
+
+/**
+ * draws the LenseFlares
+ */
+void LenseFlare::draw() const {
+    if( !this->bActivated)
+        return;
+}
Index: trunk/src/world_entities/weather_effects/lense_flare.h
===================================================================
--- trunk/src/world_entities/weather_effects/lense_flare.h	(revision 9869)
+++ trunk/src/world_entities/weather_effects/lense_flare.h	(revision 9869)
@@ -0,0 +1,65 @@
+/**
+ * @file lense_flare.h
+ *  lense flare effect
+ */
+
+#ifndef _LENSE_FLARE
+#define _LENSE_FLARE
+
+#include "graphics_effect.h"
+
+#include <vector>
+
+#include "vector2D.h"
+#include "plane.h"
+#include "glincl.h"
+
+
+#define LF_MAX_FLARES 7
+
+
+class TiXmlElement;
+class Light;
+class ImagePlane;
+
+//! A class that handles LenseFlares. The LenseFlareManager operates on this.
+class LenseFlare : public GraphicsEffect
+{
+  ObjectListDeclaration(LenseFlare);
+  public:
+    LenseFlare(const TiXmlElement* root = NULL);
+    virtual ~LenseFlare();
+
+    virtual void loadParams(const TiXmlElement* root);
+
+    virtual void init();
+
+    virtual void activate();
+    virtual void deactivate();
+
+    virtual void draw() const;
+    virtual void tick(float dt);
+
+    void addFlare(const std::string& textureName);
+
+
+  private:
+    GLint stringToFogMode(const std::string& mode);
+    void setSourceVisibility(bool visibility) ;
+
+
+  private:
+    bool                     bVisible;          //!< Checks visibility
+    Light*                   lightSource;        //!< reference to the sun (or primary light source)
+    std::vector<ImagePlane*> flares;             //!< the flares array
+
+    Vector2D                 flareVector;        //!< the axis to draw the flares on
+    float                    distance;           //!< distance from center to source
+    Vector2D                 screenCenter;       //!< the vector marking the center of the screen
+
+    float                    flareMatrix[14];
+    Plane                    frustumPlane;       //!< plane that marks the view frustum
+};
+
+
+#endif /* _LENSE_FLARE */
Index: trunk/src/world_entities/weather_effects/lightning_effect.cc
===================================================================
--- trunk/src/world_entities/weather_effects/lightning_effect.cc	(revision 9869)
+++ trunk/src/world_entities/weather_effects/lightning_effect.cc	(revision 9869)
@@ -0,0 +1,288 @@
+/*
+   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: hdavid, amaechler
+*/
+
+#include "lightning_effect.h"
+
+#include "state.h"
+
+#include "util/loading/load_param.h"
+#include "util/loading/factory.h"
+#include "sound/resource_sound_buffer.h"
+
+#include "effects/billboard.h"
+
+#include "shell_command.h"
+#include "light.h"
+#include "cloud_effect.h"
+#include "script_class.h"
+#include "debug.h"
+#include "class_id_DEPRECATED.h"
+
+ObjectListDefinitionID(LightningEffect, CL_LIGHTNING_EFFECT);
+
+SHELL_COMMAND(activate, LightningEffect, activateLightning);
+SHELL_COMMAND(deactivate, LightningEffect, deactivateLightning);
+
+CREATE_SCRIPTABLE_CLASS(LightningEffect,
+                        addMethod("activate", Executor0<LightningEffect, lua_State*>(&LightningEffect::activate))
+                            ->addMethod("deactivate", Executor0<LightningEffect, lua_State*>(&LightningEffect::deactivate))
+                       );
+
+CREATE_FACTORY(LightningEffect);
+
+LightningEffect::LightningEffect(const TiXmlElement* root) {
+  this->registerObject(this, LightningEffect::_objectList);
+    this->init();
+
+    if (root != NULL)
+        this->loadParams(root);
+
+    if(this->lightningActivate)
+        this->activate();
+}
+
+LightningEffect::~LightningEffect() {
+    this->deactivate();
+}
+
+void LightningEffect::loadParams(const TiXmlElement* root) {
+    WeatherEffect::loadParams(root);
+
+    LoadParam(root, "coord", this, LightningEffect, coord);
+    LoadParam(root, "frequency", this, LightningEffect, setFlashFrequency);
+    LoadParam(root, "const-time", this, LightningEffect, setFlashConstTime);
+    LoadParam(root, "rising-time", this, LightningEffect, setFlashRisingTime);
+    LoadParam(root, "size", this, LightningEffect, setFlashSize);
+    LoadParam(root, "seed", this, LightningEffect, setFlashSeed);
+
+    LOAD_PARAM_START_CYCLE(root, element);
+    {
+        LoadParam_CYCLE(element, "option", this, LightningEffect, setLightningOption);
+    }
+    LOAD_PARAM_END_CYCLE(element);
+}
+
+
+void LightningEffect::init() {
+    //default values
+    this->lightningActivate = false;
+
+    this->flashFrequency = 4.0f;
+    this->flashFrequencyBase = 4.0f;
+    this->flashFrequencySeed = 2.0f;
+
+    this->flashHoldTime = 0.1f;
+    this->flashRisingTime = 0.03f;
+
+    this->seedX = 500.f;
+    this->seedZ = 1000.0f;
+
+    this->width = 640.0f;
+    this->height = 400.0f;
+    this->seedWidth = 100.0f;
+    this->seedHeight = 100.0f;
+
+    this->lightningMove = false;
+
+    this->mainPosX = 0;
+    this->mainPosY = 100;
+    this->mainPosZ = 5;
+
+    this->time = 0.0;
+
+    // initialize thunder billboard
+    int i;
+    for (i = 0; i < 4; i++) {
+        this->thunderBolt[i] = new Billboard(NULL);
+        this->thunderBolt[i]->setSize(this->width, this->height);
+        this->thunderBolt[i]->setVisibiliy(false);
+    }
+
+    //should load both texture
+    this->thunderTextureA = true;
+    this->setTexture();
+    this->switchTexture();
+
+    if (this->lightningMove) {
+        this->cameraCoor = State::getCameraNode()->getAbsCoor();
+        for (i = 0; i < 4; i++)
+          this->thunderBolt[i]->setAbsCoor(this->cameraCoor.x + this->mainPosX, this->mainPosY, this->cameraCoor.z + this->mainPosZ);
+    } else
+        for (i = 0; i < 4; i++)
+          this->thunderBolt[i]->setAbsCoor(this->mainPosX, this->mainPosY, this->mainPosZ);
+
+    this->flashLight = new Light();
+    this->flashLight->setDiffuseColor(0,0,0);
+    this->flashLight->setSpecularColor(0,0,0);
+
+    //load sound
+    this->thunderBuffer = OrxSound::ResourceSoundBuffer("sound/atmosphere/thunder.wav");
+
+}
+
+void LightningEffect::coord(float x, float y, float z) {
+    int i;
+
+    if (this->lightningMove) {
+        this->cameraCoor = State::getCameraNode()->getAbsCoor();
+        for (i = 0; i < 4; i++)
+            this->thunderBolt[i]->setAbsCoor(this->cameraCoor.x+x, y, this->cameraCoor.z+z);
+    } else
+        for (i = 0; i < 4; i++)
+            this->thunderBolt[i]->setAbsCoor(x, y, z);
+
+    this->mainPosX = x;
+    this->mainPosY = y;
+    this->mainPosZ = z;
+}
+
+
+void LightningEffect::setFlashSize(float width, float height, float seedWidth, float seedHeight) {
+    this->width = width;
+    this->height = height;
+    this->seedWidth = seedWidth;
+    this->seedHeight = seedHeight;
+
+    int i;
+    for (i = 0; i < 4; i++)
+        this->thunderBolt[i]->setSize(this->width, this->height);
+
+}
+
+
+void LightningEffect::activate() {
+    PRINTF(3)( "Activating LightningEffect\n" );
+    this->lightningActivate = true;
+
+    this->time = 0;
+}
+
+
+void LightningEffect::deactivate() {
+    PRINTF(3)("Deactivating LightningEffect\n");
+    this->lightningActivate = false;
+
+    int i;
+    for (i = 0; i < 4; i++)
+        this->thunderBolt[i]->setVisibiliy(false);
+
+}
+
+void LightningEffect::tick (float dt) {
+    if(!lightningActivate)
+        return;
+
+    this->time += dt;
+
+    float x;
+    x = (float)rand()/(float)RAND_MAX;
+
+    if( this->time > this->flashFrequency) {
+        // Reset timer
+        this->time = 0.0f;
+
+        // Move thunderBolt to start position
+        this->flashLight->setAbsCoor(this->thunderBolt[0]->getAbsCoor().x, this->thunderBolt[0]->getAbsCoor().y, this->thunderBolt[0]->getAbsCoor().z);
+
+        // Start a flash & lightning cycle
+        this->thunderBolt[0]->setVisibiliy(true);
+
+        // Lighten up environment
+        this->flashLight->setDiffuseColor(1,1,1);
+        this->flashLight->setSpecularColor(1,1,1);
+
+
+        // Play thunder sound
+        this->soundSource.play(this->thunderBuffer);
+    }
+
+    if( this->thunderBolt[0]->isVisible() && this->time > this->flashRisingTime*1/3 ) {
+        this->thunderBolt[0]->setVisibiliy(false);
+        this->thunderBolt[1]->setVisibiliy(true);
+    } else if( this->thunderBolt[1]->isVisible() && this->time > this->flashRisingTime*2/3 ) {
+        this->thunderBolt[1]->setVisibiliy(false);
+        this->thunderBolt[2]->setVisibiliy(true);
+
+    } else if( this->thunderBolt[2]->isVisible() && this->time > this->flashRisingTime) {
+        this->thunderBolt[2]->setVisibiliy(false);
+        this->thunderBolt[3]->setVisibiliy(true);
+    }
+
+    if( this->thunderBolt[3]->isVisible() && this->time > this->flashHoldTime) {
+        this->thunderBolt[3]->setVisibiliy(false);
+
+        this->time = 0.0f;
+        this->flashLight->setDiffuseColor(0,0,0);
+        this->flashLight->setSpecularColor(0,0,0);
+
+        this->newCoordinates();
+    }
+}
+
+void LightningEffect::newCoordinates() {
+
+    float posX, posZ;
+
+    if(this->lightningMove) {
+        this->cameraCoor = State::getCameraNode()->getAbsCoor();
+        posX = this->mainPosX - this->seedX * (float)rand()/(float)RAND_MAX + this->cameraCoor.x;
+        posZ = this->mainPosZ + this->seedZ * (float)rand()/(float)RAND_MAX + this->cameraCoor.z;
+    } else {
+        posX = this->mainPosX - this->seedX * (float)rand()/(float)RAND_MAX;
+        posZ = this->mainPosZ + this->seedZ * (float)rand()/(float)RAND_MAX;
+    }
+
+    this->switchTexture();
+
+    int i;
+    for (i = 0; i < 4; i++)
+        this->thunderBolt[i]->setAbsCoor(posX, this->mainPosY, posZ);
+
+    this->flashFrequency = this->flashFrequencyBase + this->flashFrequencySeed * (float)rand()/(float)RAND_MAX;
+
+    float w = this->width + this->seedWidth * (float)rand()/(float)RAND_MAX;
+    float h = this->height + this->seedHeight * (float)rand()/(float)RAND_MAX;
+
+    for (i = 0; i < 4; i++)
+        this->thunderBolt[i]->setSize(w, h);
+
+}
+
+void LightningEffect::setTexture() {
+
+  if (this->thunderTextureA) {
+    this->thunderBolt[0]->setTexture("maps/thunderbA1.png");
+    this->thunderBolt[1]->setTexture("maps/thunderbA2.png");
+    this->thunderBolt[2]->setTexture("maps/thunderbA3.png");
+    this->thunderBolt[3]->setTexture("maps/thunderbA4.png");
+  }
+  else {
+    this->thunderBolt[0]->setTexture("maps/thunderbB1.png");
+    this->thunderBolt[1]->setTexture("maps/thunderbB2.png");
+    this->thunderBolt[2]->setTexture("maps/thunderbB3.png");
+    this->thunderBolt[3]->setTexture("maps/thunderbB4.png");
+  }
+
+}
+
+void LightningEffect::switchTexture() {
+
+  if (this->thunderTextureA)
+    this->thunderTextureA = false;
+  else
+    this->thunderTextureA = true;
+
+  this->setTexture();
+
+}
Index: trunk/src/world_entities/weather_effects/lightning_effect.h
===================================================================
--- trunk/src/world_entities/weather_effects/lightning_effect.h	(revision 9869)
+++ trunk/src/world_entities/weather_effects/lightning_effect.h	(revision 9869)
@@ -0,0 +1,124 @@
+/**
+* @file lightning_effect.h
+*/
+
+#ifndef _LIGHTNING_EFFECT
+#define _LIGHTNING_EFFECT
+
+#include "vector.h"
+#include "vector2D.h"
+
+#include "weather_effect.h"
+
+#include "sound_buffer.h"
+#include "sound_source.h"
+
+class Billboard;
+class Light;
+
+class LightningEffect : public WeatherEffect
+{
+  ObjectListDeclaration(LightningEffect);
+public:
+  LightningEffect(const TiXmlElement* root = NULL);
+  virtual ~LightningEffect();
+
+  virtual void loadParams(const TiXmlElement* root);
+
+  virtual void init();
+
+  virtual void activate();
+  virtual void deactivate();
+
+  inline  void activateLightning()
+  {
+    this->activate();
+  }
+  inline  void deactivateLightning()
+  {
+    this->deactivate();
+  }
+
+  virtual void tick(float dt);
+
+  void coord(float x, float y, float z);
+  void setFlashSize(float width, float height, float seedWidth, float seedHeight);
+
+  inline void setLightningOption(const std::string& option)
+  {
+    if (option == "activate")
+      this->lightningActivate = true;
+    if (option == "movelightning")
+      this->lightningMove = true;
+  }
+
+  inline void setFlashFrequency(float baseFrequency, float seedTime)
+  {
+    this->flashFrequencyBase = baseFrequency;
+    this->flashFrequency = baseFrequency;
+    this->flashFrequencySeed = seedTime;
+  }
+
+  inline void setFlashConstTime(float holdTime)
+  {
+    this->flashHoldTime = holdTime;
+  }
+
+  inline void setFlashRisingTime(float flashRisingTime)
+  {
+    if(flashRisingTime > this->flashHoldTime)
+      this->flashRisingTime = this->flashHoldTime * 0.5;
+    else
+      this->flashRisingTime = flashRisingTime;
+  }
+
+  inline void setFlashSeed(float seedX, float seedZ)
+  {
+    this->seedX = seedX;
+    this->seedZ = seedZ;
+  }
+
+
+private:
+
+  void newCoordinates();
+  void setTexture();
+  void switchTexture();
+
+  Billboard* thunderBolt[4];
+  bool thunderTextureA;
+
+  bool lightningActivate;
+  bool lightningMove;
+
+  float flashFrequency;
+  float flashFrequencyBase;
+  float flashHoldTime;
+  float flashRisingTime;
+
+  float time;
+
+  float width;
+  float height;
+  float seedWidth;
+  float seedHeight;
+
+  float seedX;
+  float seedZ;
+  float flashFrequencySeed;
+
+  float mainPosX;
+  float mainPosY;
+  float mainPosZ;
+
+  Vector origSkyColor;
+  Vector cameraCoor;
+
+  Light* flashLight;
+
+  OrxSound::SoundSource    soundSource;
+  OrxSound::SoundBuffer    thunderBuffer;
+
+};
+
+#endif  /* _LIGHTNING_EFFECT */
Index: trunk/src/world_entities/weather_effects/rain_effect.cc
===================================================================
--- trunk/src/world_entities/weather_effects/rain_effect.cc	(revision 9869)
+++ trunk/src/world_entities/weather_effects/rain_effect.cc	(revision 9869)
@@ -0,0 +1,333 @@
+/*
+  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: hdavid, amaechler
+*/
+
+#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_GRAPHICS
+
+#include "rain_effect.h"
+
+#include "util/loading/load_param.h"
+#include "util/loading/factory.h"
+#include "sound/resource_sound_buffer.h"
+
+#include "glincl.h"
+#include "p_node.h"
+#include "state.h"
+#include "particles/spark_particles.h"
+#include "particles/plane_emitter.h"
+#include "shell_command.h"
+#include "light.h"
+#include "cloud_effect.h"
+#include "script_class.h"
+#include "debug.h"
+
+#include "class_id_DEPRECATED.h"
+
+ObjectListDefinitionID(RainEffect, CL_RAIN_EFFECT);
+
+// Define shell commands
+//SHELL_COMMAND(activate, RainEffect, activateRain);
+//SHELL_COMMAND(deactivate, RainEffect, deactivateRain);
+SHELL_COMMAND(startraining, RainEffect, startRaining);
+SHELL_COMMAND(stopraining, RainEffect, stopRaining);
+
+
+
+CREATE_SCRIPTABLE_CLASS(RainEffect,
+                        addMethod("startRaining", Executor0<RainEffect, lua_State*>(&RainEffect::startRaining))
+                            ->addMethod("stopRaining", Executor0<RainEffect, lua_State*>(&RainEffect::stopRaining))
+                            ->addMethod("activate", Executor0<RainEffect, lua_State*>(&RainEffect::activate))
+                            ->addMethod("deactivate", Executor0<RainEffect, lua_State*>(&RainEffect::deactivate))
+                       );
+
+CREATE_FACTORY(RainEffect);
+
+/**
+ * @brief standard constructor
+ */
+RainEffect::RainEffect(const TiXmlElement* root) {
+  this->registerObject(this, RainEffect::_objectList);
+    this->init();
+
+    if (root != NULL)
+        this->loadParams(root);
+
+    //load rain sound
+    this->rainBuffer = OrxSound::ResourceSoundBuffer("sound/atmosphere/rain.wav");
+
+    //load wind sound
+    if (this->rainWindForce != 0) {
+      this->windBuffer = OrxSound::ResourceSoundBuffer("sound/atmosphere/wind.wav");
+    }
+
+    if(rainActivate) {
+        this->activate();
+        RainEffect::rainParticles->precache((int)this->rainLife * 2);
+    }
+}
+
+/**
+ * @brief standard deconstructor
+ */
+RainEffect::~RainEffect() {
+    this->deactivate();
+}
+
+/**
+ * @brief initalizes the rain effect with default values
+ */
+void RainEffect::init() {
+
+    this->rainParticles = NULL;
+    this->emitter = NULL;
+    this->lightMan = NULL;
+
+    //Default values
+    this->rainActivate = false;
+    this->rainFadeInActivate = false;
+    this->rainFadeOutActivate = false;
+
+    this->rainMove = false;
+    this->rainCoord = Vector(500, 500, 500);
+    this->rainSize = Vector2D(1000, 1000);
+    this->rainRate = 4000;
+    this->rainVelocity = -300;
+    this->rainLife = 4;
+    this->rainWindForce  = 0;
+    this->rainFadeInDuration = 10;
+    this->rainFadeOutDuration = 10;
+
+    this->cloudColor = Vector(0.6f, 0.6f, 0.6f);
+    this->skyColor = Vector(0.0f, 0.0f, 0.0f);
+
+    this->rainMaxParticles = this->rainRate * this->rainLife;
+    this->localTimer = 0;
+    this->soundRainVolume = 0.3f;
+    this->emitter = new PlaneEmitter(this->rainSize);
+
+    lightMan = LightManager::getInstance();
+}
+
+/**
+ * @brief loads the rain effect parameters.
+ * @param root: the XML-Element to load the data from
+ */
+void RainEffect::loadParams(const TiXmlElement* root) {
+    WeatherEffect::loadParams(root);
+
+    LoadParam(root, "coord", this, RainEffect, setRainCoord);
+    LoadParam(root, "size", this, RainEffect, setRainSize);
+    LoadParam(root, "rate", this, RainEffect, setRainRate);
+    LoadParam(root, "velocity", this, RainEffect, setRainVelocity);
+    LoadParam(root, "life", this, RainEffect, setRainLife);
+    LoadParam(root, "wind", this, RainEffect, setRainWind);
+    LoadParam(root, "fadeinduration", this, RainEffect, setRainFadeIn);
+    LoadParam(root, "fadeoutduration", this, RainEffect, setRainFadeOut);
+    LoadParam(root, "cloudcolor", this, RainEffect, setCloudColor);
+    LoadParam(root, "skycolor", this, RainEffect, setSkyColor);
+
+    LOAD_PARAM_START_CYCLE(root, element);
+    {
+        LoadParam_CYCLE(element, "option", this, RainEffect, setRainOption);
+    }
+    LOAD_PARAM_END_CYCLE(element);
+}
+
+SparkParticles* RainEffect::rainParticles = NULL;
+
+/**
+ * @brief activates the rain effect
+ */
+void RainEffect::activate() {
+    PRINTF(3)( "Activating RainEffect, coord: %f, %f, %f, size: %f, %f, rate: %f, velocity: %f, moveRain: %s\n", this->rainCoord.x, this->rainCoord.y, this->rainCoord.z, this->rainSize.x, this-> rainSize.y, this->rainRate, this->rainVelocity, this->rainMove ? "true" : "false" );
+
+    this->rainActivate = true;
+
+    if (unlikely(RainEffect::rainParticles == NULL)) {
+        RainEffect::rainParticles = new SparkParticles((int) this->rainMaxParticles);
+        RainEffect::rainParticles->setName("RainParticles");
+        RainEffect::rainParticles->setLifeSpan(this->rainLife, 2);
+        RainEffect::rainParticles->setRadius(0, 0.03);
+        RainEffect::rainParticles->setRadius(0.2, 0.02);
+        RainEffect::rainParticles->setRadius(1, 0.01);
+        RainEffect::rainParticles->setColor(0, 0.3, 0.3, 0.5, 0.2);   // grey blue 1
+        RainEffect::rainParticles->setColor(0.5, 0.4, 0.4, 0.5, 0.2); // grey blue 2
+        RainEffect::rainParticles->setColor(1, 0.7, 0.7, 0.7, 0.2);   // light grey
+    }
+
+    this->emitter->setSystem(RainEffect::rainParticles);
+    this->emitter->setRelCoor(this->rainCoord);
+    this->emitter->setEmissionRate(this->rainRate);
+    this->emitter->setEmissionVelocity(this->rainVelocity);
+    this->emitter->setSpread(this->rainWindForce / 50, 0.2);
+
+    // play rain sound and loop it
+    this->soundSource.play(this->rainBuffer, this->soundRainVolume, true);
+
+    // if there's wind, play wind sound
+    if (this->rainWindForce > 0)
+        this->soundSource.play(this->windBuffer, 0.1f * this->rainWindForce, true);
+
+    // Store cloud- and sky color before the rain;
+    this->oldCloudColor = CloudEffect::cloudColor;
+    this->oldSkyColor   = CloudEffect::skyColor;
+
+    // If we're not fading, change color immediately
+    if (!this->rainFadeInActivate || !this->rainFadeOutActivate) {
+        CloudEffect::changeCloudColor(this->cloudColor, 0.2);
+        CloudEffect::changeSkyColor(this->skyColor, 0.2);
+    }
+
+    //lightMan->setAmbientColor(.1,.1,.1);
+}
+
+/**
+ * @brief deactivates the rain effect
+ */
+void RainEffect::deactivate() {
+    PRINTF(3)("Deactivating RainEffect\n");
+
+    this->rainActivate = false;
+    this->rainFadeInActivate = false;
+    this->rainFadeOutActivate = false;
+
+    //if(this->emitter)
+    //  this->emitter->setSystem(NULL);
+    //this->hideRain();
+
+    // Stop Sound
+    this->soundSource.stop();
+
+    // Restore the old cloud- and sky color
+    CloudEffect::changeCloudColor(this->oldCloudColor, 0.2);
+    CloudEffect::changeSkyColor(this->oldSkyColor, 0.2);
+}
+
+/**
+ * @brief ticks the rain effect
+ * @param dt: tick float
+ */
+void RainEffect::tick (float dt) {
+    if (!this->rainActivate)
+        return;
+
+    if (this->rainMove) {
+        this->rainCoord = State::getCameraNode()->getAbsCoor();
+        this->emitter->setRelCoor(this->rainCoord.x , this->rainCoord.y+800, this->rainCoord.z);
+    }
+
+    if (this->rainFadeInActivate) {
+        PRINTF(4)("tick fading IN RainEffect\n");
+
+        this->localTimer += dt;
+        float progress = this->localTimer / this->rainFadeInDuration;
+
+        // use alpha in color to fade in rain
+        RainEffect::rainParticles->setColor(0,   0.3, 0.3, 0.5, 0.2 * progress); // grey blue 1
+        RainEffect::rainParticles->setColor(0.5, 0.4, 0.4, 0.5, 0.2 * progress); // grey blue 2
+        RainEffect::rainParticles->setColor(1,   0.7, 0.7, 0.7, 0.2 * progress); // light grey
+
+        // increase radius for more "heavy" rain
+        RainEffect::rainParticles->setRadius(0, 0.03 * progress);
+        RainEffect::rainParticles->setRadius(0.2, 0.02 * progress);
+        RainEffect::rainParticles->setRadius(1, 0.01 * progress);
+
+        // increase sound volume
+        if (progress > 0.5) {
+          if (!this->soundSource.isPlaying())
+            this->soundSource.play(this->rainBuffer, this->soundRainVolume, true);
+          this->soundSource.gain(this->rainBuffer, this->soundRainVolume * progress * 2 - 0.5);
+        }
+
+        if (progress >= 1)
+            this->rainFadeInActivate = false;
+
+        lightMan->setAmbientColor(1-progress, 1-progress, 1-progress);
+    }
+
+    if (this->rainFadeOutActivate) {
+        PRINTF(4)("tick fading OUT RainEffect\n");
+
+        this->localTimer += dt;
+        float progress = 1 - (this->localTimer / this->rainFadeOutDuration);
+
+        // use alpha in color to fade out
+        RainEffect::rainParticles->setColor(0,   0.3, 0.3, 0.5, 0.2 * progress); // grey blue 1
+        RainEffect::rainParticles->setColor(0.5, 0.4, 0.4, 0.5, 0.2 * progress); // grey blue 2
+        RainEffect::rainParticles->setColor(1,   0.7, 0.7, 0.7, 0.2 * progress); // light grey
+
+        // decrease radius
+        RainEffect::rainParticles->setRadius(0, 0.03 * progress);
+        RainEffect::rainParticles->setRadius(0.2, 0.02 * progress);
+        RainEffect::rainParticles->setRadius(1, 0.01 * progress);
+
+        // decrease sound volume
+        if (!this->soundSource.isPlaying())
+            this->soundSource.play(this->rainBuffer, this->soundRainVolume, true);
+        this->soundSource.gain(this->rainBuffer, this->soundRainVolume * progress);
+
+        if (progress <= 0) {
+            PRINTF(4)("tick fading OUT RainEffect COMPLETED! Deactivating...\n");
+            this->rainFadeOutActivate = false;
+            this->deactivate();
+        }
+        lightMan->setAmbientColor(1-progress, 1-progress, 1-progress);
+    }
+}
+
+/**
+ * @brief starts raining slowly
+*/
+void RainEffect::startRaining() {
+    PRINTF(4)("startRaining function;\n");
+
+    // If it is already raining, do nothing
+    if (this->rainActivate)
+        return;
+
+    this->localTimer = 0;
+    this->rainFadeInActivate = true;
+
+    PRINTF(4)("startRaining function complete; fadedur: %f\n", this->rainFadeInDuration);
+    this->activate();
+
+    CloudEffect::changeCloudColor(this->cloudColor, this->rainFadeInDuration);
+    CloudEffect::changeSkyColor(this->skyColor, this->rainFadeInDuration);
+}
+
+/**
+ * @brief stops raining slowly
+ */
+void RainEffect::stopRaining() {
+    PRINTF(4)("stopRaining function;\n");
+
+    // If it is not raining, do nothing
+    if (!this->rainActivate)
+        return;
+
+    this->localTimer = 0;
+    this->rainFadeOutActivate = true;
+
+    PRINTF(4)("stopRaining function completed; fadedur: %f\n", this->rainFadeOutDuration);
+
+    CloudEffect::changeCloudColor(this->oldCloudColor, this->rainFadeOutDuration);
+    CloudEffect::changeSkyColor(this->oldSkyColor, this->rainFadeOutDuration);
+}
+
+/**
+ * @brief hides the rain
+ */
+void RainEffect::hideRain() {
+    RainEffect::rainParticles->setColor(0, 0,0,0, 0);
+    RainEffect::rainParticles->setColor(0, 0,0,0, 0);
+}
Index: trunk/src/world_entities/weather_effects/rain_effect.h
===================================================================
--- trunk/src/world_entities/weather_effects/rain_effect.h	(revision 9869)
+++ trunk/src/world_entities/weather_effects/rain_effect.h	(revision 9869)
@@ -0,0 +1,144 @@
+/**
+ * @file rain_effect.h
+ * Generates rain using the particle engine
+*/
+
+#ifndef _RAIN_EFFECT
+#define _RAIN_EFFECT
+
+#include "weather_effect.h"
+
+#include "vector.h"
+#include "vector2D.h"
+#include <string>
+
+#include "particles/particle_system.h"
+
+class SparkParticles;
+class PlainEmitter;
+class LightManager;
+class CloudEffect;
+
+#include "sound_buffer.h"
+#include "sound_source.h"
+
+class RainEffect : public WeatherEffect
+{
+  ObjectListDeclaration(RainEffect);
+public:
+  RainEffect(const TiXmlElement* root = NULL);
+  virtual ~RainEffect();
+
+  virtual void loadParams(const TiXmlElement* root);
+
+  virtual void init();
+
+  virtual void activate();
+  virtual void deactivate();
+
+  inline void activateRain()
+  {
+    this->activate();
+  }
+
+  inline void deactivateRain()
+  {
+    this->deactivate();
+  }
+
+  virtual void tick(float dt);
+
+  void startRaining();
+  void stopRaining();
+
+  void hideRain();
+
+  inline void setRainCoord(float x, float y, float z)
+  {
+    this->rainCoord = Vector(x, y, z);
+  }
+  inline void setRainSize(float x, float y)
+  {
+    this->rainSize = Vector2D(x, y);
+  }
+  inline void setRainRate(float rate)
+  {
+    this->rainRate = rate;
+  }
+  inline void setRainVelocity(float velocity)
+  {
+    this->rainVelocity = -velocity;
+  }
+  inline void setRainLife(float life)
+  {
+    this->rainLife = life;
+  }
+  inline void setRainWind(int force)
+  {
+    this->rainWindForce = force;
+  }
+
+  inline void setRainFadeIn(float fadein)
+  {
+    this->rainFadeInDuration = fadein;
+  }
+  inline void setRainFadeOut(float fadeout)
+  {
+    this->rainFadeOutDuration = fadeout;
+  }
+
+  inline void setCloudColor(float colorX, float colorY, float colorZ)
+  {
+    this->cloudColor = Vector(colorX, colorY, colorZ);
+  }
+  inline void setSkyColor(float colorX, float colorY, float colorZ)
+  {
+    this->skyColor = Vector(colorX, colorY, colorZ);
+  }
+
+  inline void setRainOption(const std::string& option)
+  {
+    if (option == "moverain")
+      this->rainMove = true;
+    if (option == "activate")
+      this->rainActivate = true;
+  }
+
+
+private:
+  static SparkParticles*      rainParticles;
+  ParticleEmitter*            emitter;
+
+  float                       localTimer;
+
+  GLfloat                     rainFadeInDuration;
+  GLfloat                     rainFadeOutDuration;
+  bool                        rainFadeInActivate;
+  bool                        rainFadeOutActivate;
+
+  Vector                      rainCoord;
+  Vector2D                    rainSize;
+  GLfloat                     rainRate;
+  GLfloat                     rainVelocity;
+  GLfloat                     rainLife;
+  GLfloat                     rainMaxParticles;
+  int                         rainWindForce;
+  bool                        rainMove;
+  bool                        rainActivate;
+
+  OrxSound::SoundSource       soundSource;
+  OrxSound::SoundBuffer       rainBuffer;
+  OrxSound::SoundBuffer       windBuffer;
+
+  float                       soundRainVolume;
+
+  Vector                      oldSkyColor;
+  Vector                      oldCloudColor;
+  Vector                      skyColor;
+  Vector                      cloudColor;
+
+  LightManager*               lightMan;
+
+};
+
+#endif  /* _RAIN_EFFECT */
Index: trunk/src/world_entities/weather_effects/snow_effect.cc
===================================================================
--- trunk/src/world_entities/weather_effects/snow_effect.cc	(revision 9869)
+++ trunk/src/world_entities/weather_effects/snow_effect.cc	(revision 9869)
@@ -0,0 +1,233 @@
+/*
+        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: hdavid, amaechler
+*/
+
+#include "snow_effect.h"
+
+#include "util/loading/load_param.h"
+#include "util/loading/factory.h"
+#include "sound/resource_sound_buffer.h"
+
+#include "glincl.h"
+#include "debug.h"
+
+#include "p_node.h"
+#include "state.h"
+#include "particles/sprite_particles.h"
+#include "particles/plane_emitter.h"
+#include "shell_command.h"
+#include "script_class.h"
+#include "cloud_effect.h"
+
+#include "class_id_DEPRECATED.h"
+
+ObjectListDefinitionID(SnowEffect, CL_SNOW_EFFECT);
+SHELL_COMMAND(activate, SnowEffect, activateSnow);
+SHELL_COMMAND(deactivate, SnowEffect, deactivateSnow);
+
+
+CREATE_SCRIPTABLE_CLASS(SnowEffect,
+                        addMethod("activate", Executor0<SnowEffect, lua_State*>(&SnowEffect::activate))
+                        ->addMethod("deactivate", Executor0<SnowEffect, lua_State*>(&SnowEffect::deactivate))
+                       );
+
+CREATE_FACTORY(SnowEffect);
+
+SnowEffect::SnowEffect(const TiXmlElement* root)
+{
+  this->registerObject(this, SnowEffect::_objectList);
+
+  this->init();
+
+  if (root != NULL)
+    this->loadParams(root);
+
+  //load wind sound
+  if (this->snowWindForce >= 1)
+  {
+    this->windBuffer = OrxSound::ResourceSoundBuffer("sound/atmosphere/wind.wav");
+  }
+
+  if(snowActivate)
+  {
+    this->activate();
+    SnowEffect::snowParticles->precache((int) this->snowLife);
+  }
+}
+
+
+SnowEffect::~SnowEffect()
+{
+  this->deactivate();
+}
+
+SpriteParticles* SnowEffect::snowParticles = NULL;
+
+void SnowEffect::loadParams(const TiXmlElement* root)
+{
+  WeatherEffect::loadParams(root);
+
+  LoadParam(root, "numParticles", this, SnowEffect, numParticles);
+  LoadParam(root, "materialTexture", this, SnowEffect, materialTexture);
+  LoadParam(root, "lifeSpans", this, SnowEffect, lifeSpan);
+  LoadParam(root, "radius", this, SnowEffect, radius);
+  LoadParam(root, "mass", this, SnowEffect, mass);
+  LoadParam(root, "emissionRate", this, SnowEffect, emissionRate);
+  LoadParam(root, "emissionVelocity", this, SnowEffect, emissionVelocity);
+  LoadParam(root, "wind", this, SnowEffect, wind);
+  LoadParam(root, "size", this, SnowEffect, size);
+  LoadParam(root, "coord", this, SnowEffect, coord);
+  LoadParam(root, "cloudcolor", this, SnowEffect, setCloudColor);
+  LoadParam(root, "skycolor", this, SnowEffect, setSkyColor);
+  LoadParam(root, "fadetime", this, SnowEffect, setFadeTime);
+
+  LOAD_PARAM_START_CYCLE(root, element);
+  {
+    LoadParam_CYCLE(element, "option", this, SnowEffect, setSnowOption);
+  }
+  LOAD_PARAM_END_CYCLE(element);
+}
+
+void SnowEffect::init()
+{
+  this->emitter = new PlaneEmitter();
+
+  // Default values
+  this->snowActivate = false;
+  this->snowMove = false;
+  this->particles = 12000;
+  this->texture = "maps/snow_flake_01_32x32.png";
+  this->snowLife = 8;
+  this->randomLife = 2;
+  this->snowRadius = 3.5;
+  this->randomRadius = 1;
+  this->snowMass = 1.0;
+  this->randomMass = 0.3;
+  this->rate = 900;
+  this->velocity = -100;
+  this->randomVelocity = 5;
+  this->angle = 0.5;
+  this->randomAngle = 0.2;
+  this->alpha = 0.5;
+  this->snowSize = Vector2D(2500, 2500);
+  this->snowCoord = Vector(100,450,400);
+  this->snowWindForce = 1;
+
+  this->fadeTime = 10;
+  this->cloudColor = Vector(0.2f, 0.2f, 0.2f);
+  this->skyColor = Vector(0.0f, 0.0f, 0.0f);
+}
+
+void SnowEffect::activate()
+{
+  PRINTF(3)("Activating SnowEffect\n");
+
+  this->snowActivate = true;
+
+  SnowEffect::snowParticles = new SpriteParticles(particles);
+  SnowEffect::snowParticles->setName("SnowEffectTrailParticles");
+  SnowEffect::snowParticles->setMaterialTexture(texture);
+  SnowEffect::snowParticles->setLifeSpan(snowLife, randomLife);
+  SnowEffect::snowParticles->setRadius(0.0, snowRadius, randomRadius);
+  SnowEffect::snowParticles->setRadius(0.2, snowRadius, randomRadius*0.8);
+  SnowEffect::snowParticles->setRadius(1.0, snowRadius, randomRadius*0.5);
+  SnowEffect::snowParticles->setMass(0, snowMass, randomMass);
+  SnowEffect::snowParticles->setColor(0,1, 1, 1, alpha);
+  SnowEffect::snowParticles->setColor(.5, .6, .6, .6, alpha/2);
+  SnowEffect::snowParticles->setColor(1, .0, .0, .0, .0);
+
+  this->emitter->setSystem(SnowEffect::snowParticles);
+
+  this->emitter->setRelCoor(snowCoord);
+  this->emitter->setEmissionRate(rate);
+  this->emitter->setEmissionVelocity(velocity, randomVelocity);
+  this->emitter->setSpread(angle * this->snowWindForce , randomAngle * this->snowWindForce);
+  this->emitter->setSize(snowSize);
+
+  if (this->snowWindForce != 0)
+    this->soundSource.play(this->windBuffer, 0.1f * this->snowWindForce, true);
+
+  // Store cloud- and sky color before the snow
+  this->oldCloudColor = CloudEffect::cloudColor;
+  this->oldSkyColor   = CloudEffect::skyColor;
+
+  // Change the colors
+  CloudEffect::changeCloudColor(this->cloudColor, this->fadeTime);
+  CloudEffect::changeSkyColor(this->skyColor, this->fadeTime);
+
+}
+
+
+void SnowEffect::deactivate()
+{
+  PRINTF(3)("Deactivating SnowEffect\n");
+
+  this->snowActivate = false;
+  this->emitter->setSystem(NULL);
+
+  // Restore the old cloud- and sky color
+  CloudEffect::changeCloudColor(this->oldCloudColor, this->fadeTime);
+  CloudEffect::changeSkyColor(this->oldSkyColor, this->fadeTime);
+}
+
+void SnowEffect::draw() const
+{
+  if (!this->snowActivate)
+    return;
+}
+
+void SnowEffect::tick(float dt)
+{
+  if (!this->snowActivate)
+    return;
+
+  /*
+  float distance = (State::getCameraNode()->getAbsCoor() - Vector(snowCoord.x, State::getCameraNode()->getAbsCoor().y, snowCoord.z)).len();
+
+  if(activated)
+  {
+  if(distance > 0.3*snowSize.x || distance > 0.3*snowSize.y)
+                  this->deactivate();
+  else if(distance > 0.25*snowSize.x || distance > 0.25*snowSize.y)
+  this->alpha = 0.15;
+  else if(distance > 0.2*snowSize.x || distance > 0.2*snowSize.y)
+  this->alpha = 0.25;
+  else if(distance > 0.1*snowSize.x || distance > 0.1*snowSize.y)
+  this->alpha = 0.4;
+
+  SnowEffect::snowParticles->setColor(0,1, 1, 1, alpha);
+  SnowEffect::snowParticles->setColor(.5, .6, .6, .6, alpha/2);
+  SnowEffect::snowParticles->setColor(1, .0, .0, .0, .0);
+  }
+  else
+  {
+  if(distance < 0.3*snowSize.x || distance < 0.3*snowSize.y )
+  this->activate();
+  if( distance < 0.25*snowSize.x || distance < 0.25*snowSize.y )
+  this->alpha = 0.25;
+  else if( distance < 0.2*snowSize.x || distance < 0.2*snowSize.y )
+  this->alpha = 0.4;
+  else if( distance < 0.1*snowSize.x || distance < 0.1*snowSize.y )
+  this->alpha = 0.5;
+
+  SnowEffect::snowParticles->setColor(0,1, 1, 1, alpha);
+  SnowEffect::snowParticles->setColor(.5, .6, .6, .6, alpha/2);
+  SnowEffect::snowParticles->setColor(1, .0, .0, .0, .0);
+  }*/
+
+  if (this->snowMove)
+  {
+    this->snowCoord = State::getCameraNode()->getAbsCoor();
+    this->emitter->setRelCoor(this->snowCoord.x , this->snowCoord.y+300, this->snowCoord.z);
+  }
+}
Index: trunk/src/world_entities/weather_effects/snow_effect.h
===================================================================
--- trunk/src/world_entities/weather_effects/snow_effect.h	(revision 9869)
+++ trunk/src/world_entities/weather_effects/snow_effect.h	(revision 9869)
@@ -0,0 +1,148 @@
+/**
+* @file snow_effect.h
+*/
+
+#ifndef _SNOW_EFFECT
+#define _SNOW_EFFECT
+
+#include "vector.h"
+#include "particles/particle_system.h"
+#include "material.h"
+#include "vector2D.h"
+
+#include "weather_effect.h"
+
+class SpriteParticles;
+class PlaneEmitter;
+class PNode;
+class CloudEffect;
+
+#include "sound_source.h"
+#include "sound_buffer.h"
+
+class SnowEffect : public WeatherEffect
+{
+  ObjectListDeclaration(SnowEffect);
+public:
+  SnowEffect(const TiXmlElement* root = NULL);
+  virtual ~SnowEffect();
+
+  virtual void loadParams(const TiXmlElement* root);
+
+  virtual void init();
+
+  virtual void activate();
+  virtual void deactivate();
+
+  inline void activateSnow()
+  {
+    this->activate();
+  }
+  inline void deactivateSnow()
+  {
+    this->deactivate();
+  }
+
+  virtual void draw() const;
+  virtual void tick(float dt);
+
+
+  inline void numParticles(int n)
+  {
+    this->particles = n;
+  }
+  inline void materialTexture(const std::string& texture)
+  {
+    this->texture = texture;
+  }
+  inline void lifeSpan(float lifeSpan, float randomLifeSpan)
+  {
+    this->snowLife = lifeSpan;
+    this->randomLife = randomLifeSpan;
+  }
+  inline void radius(float radius, float randomRadius)
+  {
+    this->snowRadius = radius;
+    this->randomRadius = randomRadius;
+  }
+  inline void mass(float mass, float randomMass)
+  {
+    this->snowMass = mass;
+    this->randomMass = randomMass;
+  }
+  inline void emissionRate(float emissionRate)
+  {
+    this->rate = emissionRate;
+  }
+  inline void emissionVelocity(float velocity, float randomVelocity)
+  {
+    this->velocity = velocity;
+    this->randomVelocity = randomVelocity;
+  }
+  inline void size(float sizeX, float sizeY)
+  {
+    this->snowSize = Vector2D(sizeX, sizeY);
+  }
+  inline void coord(float x, float y, float z)
+  {
+    this->snowCoord = Vector(x, y, z);
+  }
+  inline void wind(int force)
+  {
+    this->snowWindForce = force;
+  }
+  inline void setCloudColor(float colorX, float colorY, float colorZ)
+  {
+    this->cloudColor = Vector(colorX, colorY, colorZ);
+  }
+  inline void setSkyColor(float colorX, float colorY, float colorZ)
+  {
+    this->skyColor = Vector(colorX, colorY, colorZ);
+  }
+  inline void setFadeTime(float time)
+  {
+    this->fadeTime = time;
+  }
+
+  inline void setSnowOption(const std::string& option)
+  {
+    /*if (option == "fade") this->snowFade = true;*/
+    if (option == "movesnow")
+      this->snowMove = true;
+    if (option == "activate")
+      this->snowActivate = true;
+  }
+
+
+private:
+  int               particles;
+  std::string       texture;
+  float             snowLife, randomLife;
+  float             snowRadius, randomRadius;
+  float             snowMass, randomMass;
+  float             rate;
+  float             velocity, randomVelocity;
+  float             angle, randomAngle;
+  float             alpha;
+  float             fadeTime;
+  Vector            snowCoord;
+  Vector2D          snowSize;
+  int               snowWindForce;
+
+  bool              snowMove;
+  bool              snowActivate;
+
+  PlaneEmitter*     emitter;
+
+  static SpriteParticles*   snowParticles;
+  OrxSound::SoundSource     soundSource;
+  OrxSound::SoundBuffer     windBuffer;
+
+  Vector            oldSkyColor;
+  Vector            oldCloudColor;
+  Vector            skyColor;
+  Vector            cloudColor;
+};
+
+
+#endif  /* _SNOW_EFFECT */
Index: trunk/src/world_entities/weather_effects/sun_effect.cc
===================================================================
--- trunk/src/world_entities/weather_effects/sun_effect.cc	(revision 9869)
+++ trunk/src/world_entities/weather_effects/sun_effect.cc	(revision 9869)
@@ -0,0 +1,76 @@
+
+
+/*
+   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: hdavid, amaechler
+*/
+
+
+#include "sun_effect.h"
+
+#include "util/loading/load_param.h"
+
+
+
+
+
+
+/**
+ * @param root The XML-element to load the SunEffect from
+ */
+SunEffect::SunEffect(const TiXmlElement* root)
+{
+//  this->setClassID(CL_SUN_EFFECT, "SunEffect");
+  this->bActivated = false;
+}
+
+
+/**
+ *  destroys a SunEffect
+ */
+SunEffect::~SunEffect()
+{
+
+}
+
+
+/**
+ * @param root The XML-element to load the SunEffect from
+ */
+void SunEffect::loadParams(const TiXmlElement* root)
+{
+  BaseObject::loadParams(root);
+}
+
+
+/**
+ *  initializes the graphics effect
+ */
+void SunEffect::init()
+{}
+
+
+
+/**
+ * draws the effect, if needed
+ */
+void SunEffect::draw() const
+{}
+
+
+
+/**
+ * ticks the effect if there is any time dependancy
+ */
+void SunEffect::tick(float dt)
+{}
+
Index: trunk/src/world_entities/weather_effects/sun_effect.h
===================================================================
--- trunk/src/world_entities/weather_effects/sun_effect.h	(revision 9869)
+++ trunk/src/world_entities/weather_effects/sun_effect.h	(revision 9869)
@@ -0,0 +1,37 @@
+/*!
+ * @file sun_effect.h
+ *
+ */
+
+#ifndef _SUN_EFFECT_H
+#define _SUN_EFFECT_H
+
+#include "base_object.h"
+
+
+class TiXmlElement;
+
+class SunEffect : public BaseObject
+{
+  public:
+    SunEffect(const TiXmlElement* root = NULL);
+    virtual ~SunEffect();
+
+    virtual void loadParams(const TiXmlElement* root);
+
+    virtual void init();
+
+    virtual void activate() = 0;
+    virtual void deactivate() = 0;
+
+    virtual void draw() const;
+    virtual void tick(float dt);
+
+    inline bool isActivated() const { return this->bActivated; }
+
+  protected:
+    bool              bActivated;
+};
+
+
+#endif /* _SUN_EFFECT */
Index: trunk/src/world_entities/weather_effects/volfog_effect.cc
===================================================================
--- trunk/src/world_entities/weather_effects/volfog_effect.cc	(revision 9869)
+++ trunk/src/world_entities/weather_effects/volfog_effect.cc	(revision 9869)
@@ -0,0 +1,198 @@
+/*
+  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: hdavid, amaechler
+*/
+
+#include "volfog_effect.h"
+
+#include "util/loading/load_param.h"
+#include "util/loading/factory.h"
+
+#include "p_node.h"
+#include "state.h"
+
+#include "glincl.h"
+//#include "shell_command.h"
+#include "debug.h"
+
+
+#define GLX_GLXEXT_PROTOTYPES
+//#include <GL/glx.h>
+// #include <GL/glut.h>
+
+//#include <GL/glext.h> //OpenGL Extensions
+//#include <GL/glxext.h> // GLX Extensions
+
+#ifndef GL_EXT_fog_coord
+#define GL_EXT_fog_coord 1
+typedef void (APIENTRY * PFNGLFOGCOORDFEXTPROC) (GLfloat coord);
+typedef void (APIENTRY * PFNGLFOGCOORDFVEXTPROC) (const GLfloat *coord);
+typedef void (APIENTRY * PFNGLFOGCOORDDEXTPROC) (GLdouble coord);
+typedef void (APIENTRY * PFNGLFOGCOORDDVEXTPROC) (const GLdouble *coord);
+typedef void (APIENTRY * PFNGLFOGCOORDPOINTEREXTPROC) (GLenum type, GLsizei stride, const GLvoid *pointer);
+#endif
+
+PFNGLFOGCOORDFEXTPROC glFogCoordfEXT = 0;
+PFNGLFOGCOORDFVEXTPROC glFogCoordfvEXT = 0;
+PFNGLFOGCOORDDEXTPROC glFogCoorddEXT = 0;
+PFNGLFOGCOORDDVEXTPROC glFogCoorddvEXT = 0;
+PFNGLFOGCOORDPOINTEREXTPROC glFogCoordPointerEXT = 0;
+
+
+#include "class_id_DEPRECATED.h"
+ObjectListDefinitionID(VolFogEffect, CL_VOLFOG_EFFECT);
+CREATE_FACTORY(VolFogEffect);
+
+VolFogEffect::VolFogEffect(const TiXmlElement* root) {
+  this->registerObject(this, VolFogEffect::_objectList);
+
+    if (root != NULL)
+        this->loadParams(root);
+
+    // Initialize Effect
+    this->init();
+
+    // Activate Effect
+    this->activate();
+}
+
+
+VolFogEffect::~VolFogEffect() {
+    this->deactivate();
+}
+
+void VolFogEffect::loadParams(const TiXmlElement* root) {
+    WeatherEffect::loadParams(root);
+}
+
+void VolFogEffect::init() {
+    PRINTF(3)("Initalize VolFogEffect\n");
+
+    // set fog mode
+    GLenum fogMode  = GL_EXP;
+
+    // set fog density
+    float  fogDensity  = 0.001f;
+
+    // set fog near & far distance
+    float fogStart = 0.0f;
+    float fogEnd   = 1000.0f;
+
+    // Set fog color
+    float fogColor[4] = {0.6f,0.58f,0.79f,0.0f};
+
+
+    /*    glFogCoordfEXT       = (PFNGLFOGCOORDFEXTPROC)glXGetProcAddressARB((const GLubyte*)"glFogCoordfEXT");
+    glFogCoordfvEXT      = (PFNGLFOGCOORDFVEXTPROC)glXGetProcAddressARB((const GLubyte*)"glFogCoordfvEXT");
+    glFogCoorddEXT       = (PFNGLFOGCOORDDEXTPROC)glXGetProcAddressARB((const GLubyte*)"glFogCoorddEXT");
+    glFogCoorddvEXT      = (PFNGLFOGCOORDDVEXTPROC)glXGetProcAddressARB((const GLubyte*)"glFogCoorddvEXT");
+    glFogCoordPointerEXT = (PFNGLFOGCOORDPOINTEREXTPROC)glXGetProcAddressARB((const GLubyte*)"glFogCoordPointerEXT");
+    */
+    // set the fog attributes
+    glFogf (GL_FOG_START,  fogStart);
+    glFogf (GL_FOG_END,    fogEnd);
+    glFogfv(GL_FOG_COLOR,  fogColor);
+    glFogi (GL_FOG_MODE,   fogMode);
+    glFogf (GL_FOG_DENSITY,fogDensity);
+    glFogi (GL_FOG_COORDINATE_SOURCE_EXT,GL_FOG_COORDINATE_EXT);
+
+    // enable the fog
+    glEnable(GL_FOG);
+
+    if (glewInit() == GLEW_OK)
+        PRINTF(4)("glewInit OK\n");
+    else
+        PRINTF(4)("glewInit failed\n");
+
+    if (glewGetExtension("GL_EXT_fog_coord"))
+        PRINTF(4)("GL_EXT_fog_coord extension found\n");
+}
+
+
+void VolFogEffect::activate() {
+    PRINTF(3)("Activating VolFogEffect\n");
+}
+
+void VolFogEffect::deactivate() {
+    PRINTF(3)("Deactivating VolFogEffect\n");
+
+    glDisable(GL_FOG);
+}
+
+
+/**
+* draws the effect, if needed
+*/
+void VolFogEffect::draw() const {
+    glPushAttrib(GL_ENABLE_BIT);
+    glClearColor(fogColor[0],fogColor[1],fogColor[2],0.0f);
+    glShadeModel(GL_SMOOTH);
+    glEnable(GL_DEPTH_TEST);
+    glEnable(GL_CULL_FACE);
+    glCullFace(GL_BACK);
+
+    /* clear all pixels in colour buffer */
+    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
+
+    /* Enable blending */
+    //glEnable(GL_BLEND);
+    //glBlendFunc(GL_SRC_ALPHA, GL_DST_ALPHA);
+
+    int i;
+    glLoadIdentity();
+
+
+    glBegin( GL_LINES );
+    glNormal3f(0,1,0);
+    for(i=-20;i<=20;i+=2) {
+        float fog_c;
+        float diff[3];
+
+        diff[0] = State::getCameraNode()->getAbsCoor().x - i;
+        diff[2] = State::getCameraNode()->getAbsCoor().z + 20;
+        diff[1] = State::getCameraNode()->getAbsCoor().y;
+        fog_c = 1.3f*sqrt(diff[0]*diff[0]+diff[1]*diff[1]+diff[2]*diff[2]);
+        glFogCoordfEXT(fog_c*2);
+        glVertex3f(i,0,-20);
+
+        diff[0] = State::getCameraNode()->getAbsCoor().x - i;
+        diff[2] = State::getCameraNode()->getAbsCoor().z + 20;
+        diff[1] = State::getCameraNode()->getAbsCoor().y;
+        fog_c = 1.3f*sqrt(diff[0]*diff[0]+diff[1]*diff[1]+diff[2]*diff[2]);
+        glFogCoordfEXT(fog_c*2);
+        glVertex3f(i,0,20);
+
+        diff[0] = State::getCameraNode()->getAbsCoor().x - i;
+        diff[2] = State::getCameraNode()->getAbsCoor().z + 20;
+        diff[1] = State::getCameraNode()->getAbsCoor().y;
+        fog_c = 1.3f*sqrt(diff[0]*diff[0]+diff[1]*diff[1]+diff[2]*diff[2]);
+        glFogCoordfEXT(fog_c*2);
+        glVertex3f(-20,0,i);
+
+        diff[0] = State::getCameraNode()->getAbsCoor().x - i;
+        diff[2] = State::getCameraNode()->getAbsCoor().z + 20;
+        diff[1] = State::getCameraNode()->getAbsCoor().y;
+        fog_c = 1.3f*sqrt(diff[0]*diff[0]+diff[1]*diff[1]+diff[2]*diff[2]);
+        glFogCoordfEXT(fog_c*2);
+        glVertex3f(20,0,i);
+    }
+    glEnd();
+
+    glPopAttrib();
+
+}
+
+
+/**
+* ticks the effect if there is any time dependancy
+*/
+void VolFogEffect::tick(float dt) {}
Index: trunk/src/world_entities/weather_effects/volfog_effect.h
===================================================================
--- trunk/src/world_entities/weather_effects/volfog_effect.h	(revision 9869)
+++ trunk/src/world_entities/weather_effects/volfog_effect.h	(revision 9869)
@@ -0,0 +1,35 @@
+/**
+* @file volfog_effect.h
+*/
+
+#ifndef _VOLFOG_EFFECT
+#define _VOLFOG_EFFECT
+
+#include "vector.h"
+
+#include "weather_effect.h"
+#include "glincl.h"
+
+class VolFogEffect : public WeatherEffect
+{
+  ObjectListDeclaration(VolFogEffect);
+public:
+  VolFogEffect(const TiXmlElement* root = NULL);
+  virtual ~VolFogEffect();
+
+  virtual void loadParams(const TiXmlElement* root);
+
+  virtual void init();
+
+  virtual void activate();
+  virtual void deactivate();
+
+  virtual void draw() const;
+  virtual void tick(float dt);
+
+private:
+  GLfloat fogColor[4];
+
+};
+
+#endif  /* _VOLFOG_EFFECT */
Index: trunk/src/world_entities/weather_effects/weather_effect.cc
===================================================================
--- trunk/src/world_entities/weather_effects/weather_effect.cc	(revision 9869)
+++ trunk/src/world_entities/weather_effects/weather_effect.cc	(revision 9869)
@@ -0,0 +1,74 @@
+
+
+/*
+   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: hdavid, amaechler
+*/
+
+// TODO: descriptions to loadparams, movealong unified, start activation
+
+#include "weather_effect.h"
+#include "util/loading/load_param.h"
+
+ObjectListDefinition(WeatherEffect);
+
+/**
+ * @param root The XML-element to load the WeatherEffect from
+ */
+WeatherEffect::WeatherEffect(const TiXmlElement* root)
+{
+  this->registerObject(this, WeatherEffect::_objectList);
+  this->bActivated = false;
+}
+
+
+/**
+ *  destroys a WeatherEffects
+ */
+WeatherEffect::~WeatherEffect()
+{
+
+}
+
+
+/**
+ * @param root The XML-element to load the WeatherEffects from
+ */
+void WeatherEffect::loadParams(const TiXmlElement* root)
+{
+  BaseObject::loadParams(root);
+}
+
+
+/**
+ *  initializes the graphics effect
+ */
+void WeatherEffect::init()
+{
+}
+
+
+
+/**
+ * draws the effect, if needed
+ */
+void WeatherEffect::draw() const
+{}
+
+
+
+/**
+ * ticks the effect if there is any time dependancy
+ */
+void WeatherEffect::tick(float dt)
+{}
+
Index: trunk/src/world_entities/weather_effects/weather_effect.h
===================================================================
--- trunk/src/world_entities/weather_effects/weather_effect.h	(revision 9869)
+++ trunk/src/world_entities/weather_effects/weather_effect.h	(revision 9869)
@@ -0,0 +1,38 @@
+/*!
+ * @file weather_effect.h
+ *
+ */
+
+#ifndef _WEATHER_EFFECT_H
+#define _WEATHER_EFFECT_H
+
+#include "base_object.h"
+
+
+class WeatherEffect : public BaseObject
+{
+  ObjectListDeclaration(WeatherEffect);
+
+  public:
+    WeatherEffect(const TiXmlElement* root = NULL);
+    virtual ~WeatherEffect();
+
+    virtual void loadParams(const TiXmlElement* root);
+
+    virtual void init();
+
+    virtual void activate() = 0;
+    virtual void deactivate() = 0;
+
+    virtual void draw() const;
+    virtual void tick(float dt);
+
+    inline  bool isActivated() const { return this->bActivated; }
+
+
+  protected:
+    bool              bActivated;
+};
+
+
+#endif /* _WEATHER_EFFECT */
Index: trunk/src/world_entities/world_entity.cc
===================================================================
--- trunk/src/world_entities/world_entity.cc	(revision 9656)
+++ trunk/src/world_entities/world_entity.cc	(revision 9869)
@@ -20,5 +20,6 @@
 #include "shell_command.h"
 
-#include "model.h"
+#include "util/loading/resource_manager.h"
+#include "resource_obj.h"
 #include "md2/md2Model.h"
 #include "md3/md3_model.h"
@@ -26,5 +27,4 @@
 #include "aabb_tree_node.h"
 
-#include "util/loading/resource_manager.h"
 #include "util/loading/load_param.h"
 #include "obb_tree.h"
@@ -39,5 +39,7 @@
 #include "game_rules.h"
 #include "kill.h"
-
+#include "debug.h"
+
+#include "projectiles/projectile.h"
 
 SHELL_COMMAND(model, WorldEntity, loadModel)
@@ -47,4 +49,6 @@
 SHELL_COMMAND(debugEntity, WorldEntity, debugWE);
 
+
+ObjectListDefinition(WorldEntity);
 /**
  *  Loads the WordEntity-specific Part of any derived Class
@@ -56,5 +60,5 @@
     : Synchronizeable()
 {
-  this->setClassID(CL_WORLD_ENTITY, "WorldEntity");
+  this->registerObject(this, WorldEntity::_objectList);
 
   this->obbTree = NULL;
@@ -72,5 +76,4 @@
   this->objectListNumber = OM_INIT;
   this->lastObjectListNumber = OM_INIT;
-  this->objectListIterator = NULL;
 
   // reset all collision handles to NULL == unsubscribed state
@@ -81,5 +84,5 @@
 
   // registering default reactions:
-  this->subscribeReaction(CREngine::CR_OBJECT_DAMAGE, /*CL_WORLD_ENTITY*/ CL_PROJECTILE);
+  this->subscribeReaction(CREngine::CR_OBJECT_DAMAGE, /* WorldEntity::staticClassID(), */ Projectile::staticClassID());
 
   this->toList(OM_NULL);
@@ -160,7 +163,7 @@
   std::string name = fileName;
 
-  if (  name.find( ResourceManager::getInstance()->getDataDir() ) == 0 )
-  {
-    name.erase(ResourceManager::getInstance()->getDataDir().size());
+  if (  name.find( Resources::ResourceManager::getInstance()->mainGlobalPath().name() ) == 0 )
+  {
+    name.erase(Resources::ResourceManager::getInstance()->mainGlobalPath().name().size());
   }
 
@@ -178,5 +181,5 @@
       {
         lodFile[offset] = 48+(int)i;
-        if (ResourceManager::isInDataDir(lodFile))
+        if (Resources::ResourceManager::getInstance()->checkFileInMainPath( lodFile))
           this->loadModel(lodFile, scaling, i);
       }
@@ -188,16 +191,20 @@
       this->scaling = 1.0;
     }
+    /// LOADING AN OBJ FILE
     if(fileName.find(".obj") != std::string::npos)
     {
       PRINTF(4)("fetching OBJ file: %s\n", fileName.c_str());
-      BaseObject* loadedModel = ResourceManager::getInstance()->load(fileName, OBJ, RP_CAMPAIGN, this->scaling);
-      if (loadedModel != NULL)
-        this->setModel(dynamic_cast<Model*>(loadedModel), modelNumber);
+      StaticModel* model = new StaticModel();
+      *model = ResourceOBJ(fileName, this->scaling);
+      if (model->getVertexCount() > 0)
+      {
+        this->setModel(model, modelNumber);
+	if( modelNumber == 0 /* FIXME && !this->isA(CL_WEAPON) */)
+	  this->buildObbTree(obbTreeDepth);
+      }
       else
-        PRINTF(1)("OBJ-File %s not found.\n", fileName.c_str());
-
-      if( modelNumber == 0 && !this->isA(CL_WEAPON))
-        this->buildObbTree(obbTreeDepth);
-    }
+        delete model;
+    }
+    /// LOADING AN MD2-model
     else if(fileName.find(".md2") != std::string::npos)
     {
@@ -210,12 +217,13 @@
         this->buildObbTree(obbTreeDepth);
     }
+    /// LOADING AN MD3-MODEL.
     else if(fileName.find(".md3") != std::string::npos)
     {
       PRINTF(4)("fetching MD3 file: %s\n", fileName.c_str());
-      Model* m = new md3::MD3Model(fileName, this->scaling);
-      this->setModel(m, 0);
-
-//       if( m != NULL)
-//         this->buildObbTree(obbTreeDepth);
+//      Model* m = new md3::MD3Model(fileName, this->scaling);
+//      this->setModel(m, 0);
+
+      //       if( m != NULL)
+      //         this->buildObbTree(obbTreeDepth);
     }
   }
@@ -238,12 +246,5 @@
   if (this->models[modelNumber] != NULL)
   {
-    Resource* resource = ResourceManager::getInstance()->locateResourceByPointer(dynamic_cast<BaseObject*>(this->models[modelNumber]));
-    if (resource != NULL)
-      ResourceManager::getInstance()->unload(resource, RP_LEVEL);
-    else
-    {
-      PRINTF(4)("Forcing model deletion\n");
-      delete this->models[modelNumber];
-    }
+    delete this->models[modelNumber];
   }
 
@@ -281,5 +282,6 @@
   }
 
-  if( this->models[0] != NULL) {
+  if( this->models[0] != NULL)
+  {
     this->aabbNode = new AABBTreeNode();
     this->aabbNode->spawnBVTree(this->models[0]);
@@ -300,5 +302,5 @@
  *  @param target1 a filter target (classID)
  */
-void WorldEntity::subscribeReaction(CREngine::CRType type, long target1)
+void WorldEntity::subscribeReaction(CREngine::CRType type, const ClassID& target1)
 {
   this->subscribeReaction(type);
@@ -314,5 +316,5 @@
  *  @param target1 a filter target (classID)
  */
-void WorldEntity::subscribeReaction(CREngine::CRType type, long target1, long target2)
+void WorldEntity::subscribeReaction(CREngine::CRType type, const ClassID& target1, const ClassID& target2)
 {
   this->subscribeReaction(type);
@@ -329,5 +331,5 @@
  *  @param target1 a filter target (classID)
  */
-void WorldEntity::subscribeReaction(CREngine::CRType type, long target1, long target2, long target3)
+void WorldEntity::subscribeReaction(CREngine::CRType type, const ClassID& target1, const ClassID& target2, const ClassID& target3)
 {
   this->subscribeReaction(type);
@@ -345,5 +347,5 @@
  *  @param target1 a filter target (classID)
  */
-void WorldEntity::subscribeReaction(CREngine::CRType type, long target1, long target2, long target3, long target4)
+void WorldEntity::subscribeReaction(CREngine::CRType type, const ClassID& target1, const ClassID& target2, const ClassID& target3, const ClassID& target4)
 {
   this->subscribeReaction(type);
@@ -365,5 +367,6 @@
 void WorldEntity::subscribeReaction(CREngine::CRType type)
 {
-  if( this->collisionHandles[type] != NULL)  {
+  if( this->collisionHandles[type] != NULL)
+  {
     PRINTF(2)("Registering for a CollisionReaction already subscribed to! Skipping\n");
     return;
@@ -496,6 +499,6 @@
 void removeFromReflectionList()
 {
-/// TODO
-///  State::getObject
+  /// TODO
+  ///  State::getObject
 }
 
@@ -556,8 +559,8 @@
   {
 
-  this->setAbsCoor(ray_2 - v);
-
-  }
-    else
+    this->setAbsCoor(ray_2 - v);
+
+  }
+  else
   {
     if(ray_1.x == this->getAbsCoor().x + v.x && ray_1.y == this->getAbsCoor().y + v.y + 0.1 && ray_1.z ==this->getAbsCoor().z + v.z)
@@ -643,6 +646,6 @@
     }
 
-//     if( this->aabbNode != NULL)
-//       this->aabbNode->drawBV(0, DRAW_BV_POLYGON, Vector(1, 0.6, 0.2), true);
+    //     if( this->aabbNode != NULL)
+    //       this->aabbNode->drawBV(0, DRAW_BV_POLYGON, Vector(1, 0.6, 0.2), true);
 
     glPopMatrix();
Index: trunk/src/world_entities/world_entity.h
===================================================================
--- trunk/src/world_entities/world_entity.h	(revision 9656)
+++ trunk/src/world_entities/world_entity.h	(revision 9869)
@@ -37,7 +37,9 @@
 
 
+
 //! Basis-class all interactive stuff in the world is derived from
 class WorldEntity : public PNode
 {
+  ObjectListDeclaration(WorldEntity);
 public:
   WorldEntity();
@@ -49,5 +51,5 @@
   void loadModel2(const std::string& fileN, float scal = 1.0f){this->loadModel(fileN,scal,0,4);}
   void setModel(Model* model, unsigned int modelNumber = 0);
-  Model* getModel(unsigned int modelNumber = 0) const { return (this->models.size() > modelNumber)? this->models[modelNumber] : NULL; };
+Model* getModel(unsigned int modelNumber = 0) const { return (this->models.size() > modelNumber)? this->models[modelNumber] : NULL; };
 
   inline void loadMD2Texture(const std::string& fileName) { this->md2TextureFileName = fileName; }
@@ -73,5 +75,5 @@
 
 
-/** @returns a reference to the obb tree of this worldentity */
+  /** @returns a reference to the obb tree of this worldentity */
   inline BVTree* getOBBTree() const { return this->obbTree; };
   inline void setOBBTree(OBBTree* tree) { /*if( this->obbTree != NULL) delete this->obbTree;*/ this->obbTree = (BVTree*)tree; }
@@ -81,8 +83,8 @@
   /* --- Collision Reaction Block --- */
   void subscribeReaction(CREngine::CRType type);
-  void subscribeReaction(CREngine::CRType type, long target1);
-  void subscribeReaction(CREngine::CRType type, long target1, long target2);
-  void subscribeReaction(CREngine::CRType type, long target1, long target2, long target3);
-  void subscribeReaction(CREngine::CRType type, long target1, long target2, long target3, long target4);
+  void subscribeReaction(CREngine::CRType type, const ClassID& target1);
+  void subscribeReaction(CREngine::CRType type, const ClassID& target1, const ClassID& target2);
+  void subscribeReaction(CREngine::CRType type, const ClassID& target1, const ClassID& target2, const ClassID& target3);
+  void subscribeReaction(CREngine::CRType type, const ClassID& target1, const ClassID& target2, const ClassID& target3, const ClassID& target4);
 
   void unsubscribeReaction(CREngine::CRType type);
@@ -126,10 +128,10 @@
 
   void hide() { if( this->objectListNumber != OM_DEAD) this->lastObjectListNumber = this->objectListNumber; this->toList(OM_DEAD); }
-  void unhide() { if( this->objectListNumber != this->lastObjectListNumber) this->toList(this->lastObjectListNumber); }
+void unhide() { if( this->objectListNumber != this->lastObjectListNumber) this->toList(this->lastObjectListNumber); }
 
 
   /* --- Character Attribute Block --- */
   /** @returns the scaling of the model */
-  float getScaling(){return this->scaling;}
+float getScaling(){return this->scaling;}
   /** @returns the damage dealt by this world entity */
   float getDamage() const { return this->damage; }
@@ -216,5 +218,5 @@
   bool                    bOnGround;                       //!< true if this entity is standing on the ground
 
-  protected:
+protected:
   Vector                  velocity;                        //!< speed of the entity
 
