Index: /trunk/src/Makefile.am
===================================================================
--- /trunk/src/Makefile.am	(revision 9005)
+++ /trunk/src/Makefile.am	(revision 9006)
@@ -46,5 +46,5 @@
 		lib/graphics/effects/snow_effect.cc \
 		lib/graphics/effects/cloud_effect.cc \
-		lib/graphics/effects/lightening_effect.cc \
+		lib/graphics/effects/lightning_effect.cc \
 		lib/graphics/effects/lense_flare.cc \
 		\
Index: /trunk/src/defs/class_id.h
===================================================================
--- /trunk/src/defs/class_id.h	(revision 9005)
+++ /trunk/src/defs/class_id.h	(revision 9006)
@@ -336,5 +336,5 @@
   CL_SNOW_EFFECT                =    0x00000a14,
   CL_CLOUD_EFFECT               =    0x00000a15,
-  CL_LIGHTENING_EFFECT          =    0x00000a16,
+  CL_LIGHTNING_EFFECT          =    0x00000a16,
   CL_EXPLOSION                  =    0x00000a20,
   CL_LIGHTNING_BOLT             =    0x00000a21,
Index: /trunk/src/lib/graphics/Makefile.am
===================================================================
--- /trunk/src/lib/graphics/Makefile.am	(revision 9005)
+++ /trunk/src/lib/graphics/Makefile.am	(revision 9006)
@@ -29,5 +29,5 @@
 		effects/snow_effect.cc \
 		effects/cloud_effect.cc \
-		effects/lightening_effect.cc \
+		effects/lightning_effect.cc \
 		effects/lense_flare.cc
 
@@ -58,5 +58,5 @@
 		effects/snow_effect.h \
 		effects/cloud_effect.h \
-		effects/lightening_effect.h \
+		effects/lightning_effect.h \
 		effects/lense_flare.h
 
Index: /trunk/src/lib/graphics/effects/cloud_effect.cc
===================================================================
--- /trunk/src/lib/graphics/effects/cloud_effect.cc	(revision 9005)
+++ /trunk/src/lib/graphics/effects/cloud_effect.cc	(revision 9006)
@@ -1,15 +1,15 @@
 /*
   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
 */
@@ -26,11 +26,20 @@
 #include "shader.h"
 #include "shell_command.h"
+#include "t_animation.h"
+#include "script_class.h"
 
 #include "parser/tinyxml/tinyxml.h"
 
-Vector  CloudEffect::cloudColor;
-Vector  CloudEffect::skyColor;
-Vector  CloudEffect::newCloudColor;
-Vector  CloudEffect::newSkyColor;
+Vector    CloudEffect::cloudColor;
+Vector    CloudEffect::skyColor;
+Vector    CloudEffect::newCloudColor;
+Vector    CloudEffect::newSkyColor;
+
+bool      CloudEffect::fadeSky;
+bool      CloudEffect::fadeCloud;
+float     CloudEffect::fadeTime;
+bool      CloudEffect::flashSkyActivate;
+float     CloudEffect::localTimer;
+float     CloudEffect::flashTime;
 
 using namespace std;
@@ -38,323 +47,430 @@
 SHELL_COMMAND(activate, CloudEffect, activateCloud);
 SHELL_COMMAND(deactivate, CloudEffect, deactivateCloud);
+SHELL_COMMAND(skyColor, CloudEffect, shellSkyColor);
+SHELL_COMMAND(cloudColor, CloudEffect, shellCloudColor);
+
+
+CREATE_SCRIPTABLE_CLASS(CloudEffect, CL_CLOUD_EFFECT,
+                        addMethod("skyColor", ExecutorLua4<CloudEffect,float,float,float,float>(&CloudEffect::shellSkyColor))
+                      ->addMethod("cloudColor", ExecutorLua4<CloudEffect,float,float,float,float>(&CloudEffect::shellCloudColor))
+                       );
+
 
 CREATE_FACTORY(CloudEffect, CL_CLOUD_EFFECT);
 
-CloudEffect::CloudEffect(const TiXmlElement* root)
-{
-  this->setClassID(CL_CLOUD_EFFECT, "CloudEffect");
-
-  this->init();
-
-  if (root != NULL)
-    this->loadParams(root);
-
-  if(cloudActivate)
-    this->activate();
-}
-
-CloudEffect::~CloudEffect()
-{
-  this->deactivate();
-
-  if (glIsTexture(noise3DTexName))
-    glDeleteTextures(1, &noise3DTexName);
-
-  delete shader;
-}
-
-
-void CloudEffect::init()
-{
-  PRINTF(0)("Initializing CloudEffect\n");
-
-  this->offsetZ = 0;
-  this->animationSpeed = 2;
-  this->scale = 0.0004f;
-  this->atmosphericRadius = 4000;
-  this->planetRadius = 1500;
-  this->divs = 50;
-
-  skyColor = Vector(0.0f, 0.0f, 0.8f);
-  cloudColor = Vector(0.8f, 0.8f, 0.8f);
-  newSkyColor = skyColor;
-  newCloudColor = cloudColor;
-  this->fadeTime = 3;
-
-  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 = new Shader(ResourceManager::getInstance()->getDataDir() + "/shaders/cloud.vert",
-                            ResourceManager::getInstance()->getDataDir() + "/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->cloudActivate = true;
-}
-
-void CloudEffect::deactivate()
-{
-  PRINTF(0)("Deactivating CloudEffect\n");
-
-  this->cloudActivate = false;
-}
-
-void CloudEffect::draw() const
-  {}
-
-void CloudEffect::tick (float dt)
-{
-  if (this->cloudActivate)
-  {
-    this->offsetZ += 0.05 * dt * this->animationSpeed;
+CloudEffect::CloudEffect(const TiXmlElement* root) {
+    this->setClassID(CL_CLOUD_EFFECT, "CloudEffect");
+
+    this->init();
+
+    if (root != NULL)
+        this->loadParams(root);
+
+    if(cloudActivate)
+        this->activate();
+}
+
+CloudEffect::~CloudEffect() {
+    this->deactivate();
+
+    if (glIsTexture(noise3DTexName))
+        glDeleteTextures(1, &noise3DTexName);
+
+    delete shader;
+}
+
+
+void CloudEffect::init() {
+    PRINTF(0)("Initializing CloudEffect\n");
+
+    // default values
+    this->offsetZ = 0;
+    this->animationSpeed = 2;
+    this->scale = 0.0004f;
+    this->atmosphericRadius = 4000;
+    this->planetRadius = 1500;
+    this->divs = 15;
+    fadeSky = false;
+    fadeCloud = false;
+
+    flashSkyActivate = false;
+    localTimer = 0;
+    flashTime = 0;
+
+    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 = new Shader(ResourceManager::getInstance()->getDataDir() + "/shaders/cloud.vert",
+                              ResourceManager::getInstance()->getDataDir() + "/shaders/cloud.frag");
 
     this->shader->activateShader();
-    this->offset->set(0.0f, 0.0f, offsetZ);
-    
-    //if(cloudColor != newCloudColor)
-    //{
-      // TODO: fade from cloudColor to newCloudColor
-      cloudColor = newCloudColor;
-      this->cloudcolor->set(this->cloudColor.x, this->cloudColor.y, this->cloudColor.z);
-    //}
-    //if(cloudColor != newCloudColor)
-    //{
-      // TODO: fade from skyColor to newSkyColor
-      skyColor = newSkyColor;
-      this->skycolor->set(this->skyColor.x, this->skyColor.y, this->skyColor.z);
-    //}
-    
+
+    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();
-  }
-}
-
-
-void CloudEffect::changeSkyColor(Vector color)
-{
-  newSkyColor = color;
-}
-
-
-void CloudEffect::changeCloudColor(Vector color)
-{
-  newCloudColor = color;
-}
-
-
-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)
+
+    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);
     {
-      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);
+        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(0)("Deactivating CloudEffect\n");
+
+    this->skydome->deactivate();
+    this->cloudActivate = false;
+}
+
+void CloudEffect::draw() const {}
+
+void CloudEffect::tick (float dt) {
+
+    if (this->cloudActivate) {
+
+        localTimer += dt;
+
+        this->offsetZ += 0.05 * dt * this->animationSpeed;
+
+        this->shader->activateShader();
+        this->offset->set(0.0f, 0.0f, offsetZ);
+
+        if (flashSkyActivate) {
+
+            this->skycolor->set(1, 1, 1);
+            PRINTF(0)("SkyColor set to white\n");
+
+            if (localTimer > flashTime) {
+                flashSkyActivate = false;
+                this->skycolor->set(this->skyColor.x, this->skyColor.y, this->skyColor.z);
+                PRINTF(0)("SkyColor reset\n");
+            }
+
+        } else {
+
+            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);
+            }
         }
-      }
-    }
-  }
-}
-
-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;
-}
-
+
+        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::flashSky( float time ) {
+
+  flashSkyActivate = true;
+  localTimer = 0;
+  flashTime = 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/lib/graphics/effects/cloud_effect.h
===================================================================
--- /trunk/src/lib/graphics/effects/cloud_effect.h	(revision 9005)
+++ /trunk/src/lib/graphics/effects/cloud_effect.h	(revision 9006)
@@ -1,5 +1,5 @@
 /**
  * @file cloud_effect.h
- * Creates clouds
+ * Create clouds
 */
 
@@ -32,105 +32,143 @@
 #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
-{
+class CloudEffect : public WeatherEffect {
+
 public:
-  CloudEffect(const TiXmlElement* root = NULL);
-  virtual ~CloudEffect();
 
-  virtual void loadParams(const TiXmlElement* root);
+    CloudEffect(const TiXmlElement* root = NULL);
+    virtual ~CloudEffect();
 
-  virtual void init();
+    virtual void loadParams(const TiXmlElement* root);
 
-  virtual void activate();
-  virtual void deactivate();
+    virtual void init();
 
-  inline void activateCloud()
-  { this->activate(); }
+    virtual void activate();
+    virtual void deactivate();
 
-  inline void deactivateCloud()
-  { this->deactivate(); }
+    void activateCloud() {
+        this->activate();
+    }
+    void deactivateCloud() {
+        this->deactivate();
+    }
 
-  inline void setCloudOption(const std::string& option)
-  {
-    if (option == "activate")
-      this->cloudActivate = true;
-  }
+    void setCloudOption(const std::string& option) {
+        if (option == "activate")
+            this->cloudActivate = true;
+    }
 
-  inline void setAnimationSpeed(float speed)
-{ this->animationSpeed = speed; }
+    void setAnimationSpeed(float speed) {
+        this->animationSpeed = speed;
+    }
 
-  inline void setCloudScale(float scale)
-  { this->scale = scale; }
+    void setCloudScale(float scale) {
+        this->scale = scale;
+    }
 
-  inline void setCloudColor(float colorX, float colorY, float colorZ)
-  { this->cloudColor = Vector(colorX, colorY, colorZ); }
+    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 setSkyColor(float colorX, float colorY, float colorZ) {
+        this->skyColor = Vector(colorX, colorY, colorZ);
+    }
 
-  inline void setPlanetRadius(float planetRadius)
-  { this->planetRadius = planetRadius; }
+    void setPlanetRadius(float planetRadius) {
+        this->planetRadius = planetRadius;
+    }
 
-  inline void setAtmosphericRadius(float atmosphericRadius)
-  { this->atmosphericRadius = atmosphericRadius; }
+    void setAtmosphericRadius(float atmosphericRadius) {
+        this->atmosphericRadius = atmosphericRadius;
+    }
 
-  inline void setDivisions(int divs)
-  { this->divs = divs; }
+    void setDivisions(int divs) {
+        this->divs = divs;
+    }
 
-  virtual void draw() const;
-  virtual void tick(float dt);
+    virtual void draw() const;
+    virtual void tick(float dt);
 
-  static void changeSkyColor(Vector color);
-  static void changeCloudColor(Vector color);
-  
-  static Vector    cloudColor;
-  static Vector    skyColor;
+    static void changeSkyColor(Vector color, float time);
+    static void changeCloudColor(Vector color, float time);
 
-  void make3DNoiseTexture();
-  void initNoise();
-  void SetNoiseFrequency(int frequency);
-  double noise3(double vec[3]);
-  void normalize2(double v[2]);
-  void normalize3(double v[3]);
+    void setColorSkyX(float color);
+    void setColorSkyY(float color);
+    void setColorSkyZ(float color);
+    void setColorCloudX(float color);
+    void setColorCloudY(float color);
+    void setColorCloudZ(float color);
 
-  void generateSkyPlane(int divisions, float planetRadius, float atmosphereRadius,
-                        float hTile, float vTile);
+    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);
+
+    static void flashSky(float time);
+
 private:
 
-  bool             cloudActivate;
-  float            animationSpeed;
-  float            fadeTime;
-  
-  static Vector           newSkyColor;
-  static Vector           newCloudColor;
+    bool                    cloudActivate;
+    float                   animationSpeed;
 
-  // Material                 cloudMaterial;
-  Skydome*         skydome;
+    static Vector           newSkyColor;
+    static Vector           newCloudColor;
 
-  // SHADER STUFF
-  Shader*          shader;
-  Shader::Uniform* offset;
-  Shader::Uniform* skycolor;
-  Shader::Uniform* cloudcolor;
-  float            offsetZ;
-  float            scale;
-  float            planetRadius;
-  float            atmosphericRadius;
-  int              divs;
+    // Material             cloudMaterial;
+    Skydome*                 skydome;
 
-  // NOISE STUFF
-  int              noise3DTexSize;
-  GLuint           noise3DTexName;
-  GLubyte          *noise3DTexPtr;
+    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;
 
-  int              p[MAXB + MAXB + 2];
-  double           g3[MAXB + MAXB + 2][3];
-  double           g2[MAXB + MAXB + 2][2];
-  double           g1[MAXB + MAXB + 2];
+    // SHADER STUFF
+    Shader*          shader;
+    Shader::Uniform* offset;
+    Shader::Uniform* skycolor;
+    Shader::Uniform* cloudcolor;
+    float            offsetZ;
+    float            scale;
+    float            planetRadius;
+    float            atmosphericRadius;
+    int              divs;
 
-  int              start;
-  int              B;
-  int              BM;
+    // 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;
+
+    static bool      flashSkyActivate;
+    static float     localTimer;
+    static float     flashTime;
+
 };
 
Index: /trunk/src/lib/graphics/effects/fog_effect.cc
===================================================================
--- /trunk/src/lib/graphics/effects/fog_effect.cc	(revision 9005)
+++ /trunk/src/lib/graphics/effects/fog_effect.cc	(revision 9006)
@@ -103,5 +103,5 @@
  */
 void FogEffect::activate() {
-    PRINTF(0)( "Activating FogEffect\n");
+    PRINTF(3)( "Activating FogEffect\n");
 
     // init fogGL
@@ -123,5 +123,5 @@
  */
 void FogEffect::deactivate() {
-    PRINTF(0)("Deactivating FogEffect\n");
+    PRINTF(3)("Deactivating FogEffect\n");
 
     this->fogFadeInActivate = false;
Index: /trunk/src/lib/graphics/effects/lense_flare.cc
===================================================================
--- /trunk/src/lib/graphics/effects/lense_flare.cc	(revision 9005)
+++ /trunk/src/lib/graphics/effects/lense_flare.cc	(revision 9006)
@@ -64,5 +64,5 @@
 
     this->lightSource = (LightManager::getInstance())->getLight(0);
-    PRINTF(0)("light is: %p\n", this->lightSource);
+    PRINTF(4)("light is: %p\n", this->lightSource);
 
     if (root != NULL) {
Index: unk/src/lib/graphics/effects/lightening_effect.cc
===================================================================
--- /trunk/src/lib/graphics/effects/lightening_effect.cc	(revision 9005)
+++ 	(revision )
@@ -1,302 +1,0 @@
-/*
-   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 "lightening_effect.h"
-
-#include "state.h"
-
-#include "util/loading/load_param.h"
-#include "util/loading/factory.h"
-#include "util/loading/resource_manager.h"
-
-#include "effects/billboard.h"
-
-#include "glincl.h"
-#include "parser/tinyxml/tinyxml.h"
-
-#include "shell_command.h"
-#include "light.h"
-
-SHELL_COMMAND(activate, LighteningEffect, activateLightening);
-SHELL_COMMAND(deactivate, LighteningEffect, deactivateLightening);
-
-using namespace std;
-
-CREATE_FACTORY(LighteningEffect, CL_LIGHTENING_EFFECT);
-
-LighteningEffect::LighteningEffect(const TiXmlElement* root)
-{
-  this->setClassID(CL_LIGHTENING_EFFECT, "LighteningEffect");
-
-  this->init();
-
-  if (root != NULL)
-    this->loadParams(root);
-
-  if(this->lighteningActivate)
-    this->activate();
-}
-
-LighteningEffect::~LighteningEffect()
-{
-  this->deactivate();
-}
-
-void LighteningEffect::loadParams(const TiXmlElement* root)
-{
-  WeatherEffect::loadParams(root);
-
-  LoadParam(root, "coord", this, LighteningEffect, coord);
-  LoadParam(root, "frequency", this, LighteningEffect, setFlashFrequency);
-  LoadParam(root, "const-time", this, LighteningEffect, setFlashConstTime);
-  LoadParam(root, "rising-time", this, LighteningEffect, setFlashRisingTime);
-  LoadParam(root, "size", this, LighteningEffect, setFlashSize);
-  LoadParam(root, "seed", this, LighteningEffect, setFlashSeed);
-
-  LOAD_PARAM_START_CYCLE(root, element);
-  {
-    LoadParam_CYCLE(element, "option", this, LighteningEffect, setLighteningOption);
-  }
-  LOAD_PARAM_END_CYCLE(element);
-}
-
-
-void LighteningEffect::init()
-{
-  //default values
-  this->lighteningActivate = 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 = 700.0f;
-  this->height = 250.0f;
-  this->seedWidth = 50.0f;
-  this->seedHeight = 50.0f;
-
-  this->lighteningMove = false;
-
-  this->mainPosX = 1200;
-  this->mainPosY = 900;
-  this->mainPosZ = 0;
-
-  this->time = 0.0;
-
-  // initialize lightening textures
-  this->billboard[0] = new Billboard(NULL);
-  this->billboard[0]->setTexture("maps/lightning_bolt1.png");
-  this->billboard[0]->setSize(this->width, this->height);
-  this->billboard[0]->setVisibiliy(false);
-
-  this->billboard[1] = new Billboard(NULL);
-  this->billboard[1]->setTexture("maps/lightning_bolt2.png");
-  this->billboard[1]->setSize(this->width, this->height);
-  this->billboard[1]->setVisibiliy(false);
-
-  this->billboard[2] = new Billboard(NULL);
-  this->billboard[2]->setTexture("maps/lightning_bolt3.png");
-  this->billboard[2]->setSize(this->width, this->height);
-  this->billboard[2]->setVisibiliy(false);
-
-  this->billboard[3] = new Billboard(NULL);
-  this->billboard[3]->setTexture("maps/lightning_bolt4.png");
-  this->billboard[3]->setSize(this->width, this->height);
-  this->billboard[3]->setVisibiliy(false);
-
-  if (this->lighteningMove)
-  {
-    this->cameraCoor = State::getCameraNode()->getAbsCoor();
-    this->billboard[0]->setAbsCoor(this->cameraCoor.x+1200,900,this->cameraCoor.z+0);
-    this->billboard[1]->setAbsCoor(this->cameraCoor.x+1200,900,this->cameraCoor.z+0);
-    this->billboard[2]->setAbsCoor(this->cameraCoor.x+1200,900,this->cameraCoor.z+0);
-    this->billboard[3]->setAbsCoor(this->cameraCoor.x+1200,900,this->cameraCoor.z+0);
-  }
-  else
-  {
-    this->billboard[0]->setAbsCoor(1200,900,0);
-    this->billboard[1]->setAbsCoor(1200,900,0);
-    this->billboard[2]->setAbsCoor(1200,900,0);
-    this->billboard[3]->setAbsCoor(1200,900,0);
-  }
-
-  this->flashLight = new Light();
-  this->flashLight->setDiffuseColor(0,0,0);
-  this->flashLight->setSpecularColor(0,0,0);
-
-  //load sound
-  if (this->thunderBuffer != NULL)
-    ResourceManager::getInstance()->unload(this->thunderBuffer);
-  this->thunderBuffer = (OrxSound::SoundBuffer*)ResourceManager::getInstance()->load("sound/atmosphere/thunder.wav", WAV);
-
-}
-
-void LighteningEffect::coord(float x, float y, float z)
-{
-  if (this->lighteningMove)
-  {
-    this->cameraCoor = State::getCameraNode()->getAbsCoor();
-    this->billboard[0]->setAbsCoor(this->cameraCoor.x+x, y, this->cameraCoor.z+z);
-    this->billboard[1]->setAbsCoor(this->cameraCoor.x+x, y, this->cameraCoor.z+z);
-    this->billboard[2]->setAbsCoor(this->cameraCoor.x+x, y, this->cameraCoor.z+z);
-    this->billboard[3]->setAbsCoor(this->cameraCoor.x+x, y, this->cameraCoor.z+z);
-  }
-  else
-  {
-    this->billboard[0]->setAbsCoor(x, y, z);
-    this->billboard[1]->setAbsCoor(x, y, z);
-    this->billboard[2]->setAbsCoor(x, y, z);
-    this->billboard[3]->setAbsCoor(x, y, z);
-  }
-
-  this->mainPosX = x;
-  this->mainPosY = y;
-  this->mainPosZ = z;
-}
-
-
-void LighteningEffect::setFlashSize(float width, float height, float seedWidth, float seedHeight)
-{
-  this->width = width;
-  this->height = height;
-  this->seedWidth = seedWidth;
-  this->seedHeight = seedHeight;
-
-  this->billboard[0]->setSize(this->width, this->height);
-  this->billboard[1]->setSize(this->width, this->height);
-  this->billboard[2]->setSize(this->width, this->height);
-  this->billboard[3]->setSize(this->width, this->height);
-}
-
-
-void LighteningEffect::activate()
-{
-  PRINTF(0)( "Activating LighteningEffect\n" );
-  this->lighteningActivate = true;
-
-  this->time = 0;
-}
-
-
-void LighteningEffect::deactivate()
-{
-  PRINTF(0)("Deactivating LighteningEffect\n");
-  this->lighteningActivate = false;
-
-  this->billboard[0]->setVisibiliy(false);
-  this->billboard[1]->setVisibiliy(false);
-  this->billboard[2]->setVisibiliy(false);
-  this->billboard[3]->setVisibiliy(false);
-}
-
-void LighteningEffect::tick (float dt)
-{
-  if(!lighteningActivate)
-    return;
-
-  this->time += dt;
-
-  float x;
-  x = (float)rand()/(float)RAND_MAX;
-
-  // TODO: Make random flashing with short light dingsda:)
-
-  if( this->time > this->flashFrequency)
-  {
-    // Reset timer
-    this->time = 0.0f;
-
-    // Move billboard to start position
-    this->flashLight->setAbsCoor(this->billboard[0]->getAbsCoor().x, this->billboard[0]->getAbsCoor().y, this->billboard[0]->getAbsCoor().z);
-
-    // Start a flash & lightening cycle
-    this->billboard[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->billboard[0]->isVisible() && this->time > this->flashRisingTime*1/3 )
-  {
-    this->billboard[0]->setVisibiliy(false);
-    this->billboard[1]->setVisibiliy(true);
-  }
-  else if( this->billboard[1]->isVisible() && this->time > this->flashRisingTime*2/3 )
-  {
-    this->billboard[1]->setVisibiliy(false);
-    this->billboard[2]->setVisibiliy(true);
-
-  }
-  else if( this->billboard[2]->isVisible() && this->time > this->flashRisingTime)
-  {
-    this->billboard[2]->setVisibiliy(false);
-    this->billboard[3]->setVisibiliy(true);
-  }
-
-  if( this->billboard[3]->isVisible() && this->time > this->flashHoldTime)
-  {
-    this->billboard[3]->setVisibiliy(false);
-    this->time = 0.0f;
-    this->flashLight->setDiffuseColor(0,0,0);
-    this->flashLight->setSpecularColor(0,0,0);
-
-    this->newCoordinates();
-  }
-}
-
-void LighteningEffect::newCoordinates() {
-
-    float posX, posZ;
-
-    if(this->lighteningMove)
-    {
-
-      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->billboard[0]->setAbsCoor(posX, this->mainPosY, posZ);
-    this->billboard[1]->setAbsCoor(posX, this->mainPosY, posZ);
-    this->billboard[2]->setAbsCoor(posX, this->mainPosY, posZ);
-    this->billboard[3]->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;
-
-    this->billboard[0]->setSize(w, h);
-    this->billboard[1]->setSize(w, h);
-    this->billboard[2]->setSize(w, h);
-    this->billboard[3]->setSize(w, h);
-}
Index: unk/src/lib/graphics/effects/lightening_effect.h
===================================================================
--- /trunk/src/lib/graphics/effects/lightening_effect.h	(revision 9005)
+++ 	(revision )
@@ -1,102 +1,0 @@
-/**
-* @file lightening_effect.h
-*/
-
-#ifndef _LIGHTENING_EFFECT
-#define _LIGHTENING_EFFECT
-
-#include "vector.h"
-#include "vector2D.h"
-
-#include "weather_effect.h"
-
-#include "sound_buffer.h"
-#include "sound_source.h"
-
-class Billboard;
-class Light;
-
-class LighteningEffect : public WeatherEffect
-{
-	public:
-		LighteningEffect(const TiXmlElement* root = NULL);
-		virtual ~LighteningEffect();
-
-		virtual void loadParams(const TiXmlElement* root);
-
-		virtual void init();
-
-		virtual void activate();
-		virtual void deactivate();
-
-		inline  void activateLightening() { this->activate(); }
-		inline  void deactivateLightening() { 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 setLighteningOption(const std::string& option) {
-			if (option == "activate") this->lighteningActivate = true;
-			if (option == "movelightening") this->lighteningMove = 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:
-		Billboard* billboard[4];
-		bool lighteningActivate;
-		bool lighteningMove;
-
-		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;
-
-    void newCoordinates();
-
-		Vector cameraCoor;
-
-		Light* flashLight;
-
-		OrxSound::SoundSource    soundSource;
-		OrxSound::SoundBuffer*   thunderBuffer;
-
-};
-
-#endif  /* _LIGHTENING_EFFECT */
Index: /trunk/src/lib/graphics/effects/lightning_effect.cc
===================================================================
--- /trunk/src/lib/graphics/effects/lightning_effect.cc	(revision 9006)
+++ /trunk/src/lib/graphics/effects/lightning_effect.cc	(revision 9006)
@@ -0,0 +1,286 @@
+/*
+   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 "util/loading/resource_manager.h"
+
+#include "effects/billboard.h"
+
+#include "glincl.h"
+#include "parser/tinyxml/tinyxml.h"
+
+#include "shell_command.h"
+#include "light.h"
+#include "cloud_effect.h"
+
+SHELL_COMMAND(activate, LightningEffect, activateLightning);
+SHELL_COMMAND(deactivate, LightningEffect, deactivateLightning);
+
+using namespace std;
+
+CREATE_FACTORY(LightningEffect, CL_LIGHTNING_EFFECT);
+
+LightningEffect::LightningEffect(const TiXmlElement* root) {
+    this->setClassID(CL_LIGHTNING_EFFECT, "LightningEffect");
+
+    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);
+    }
+
+    this->thunderTextureA = true;
+    this->setTexture();
+
+    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
+    if (this->thunderBuffer != NULL)
+        ResourceManager::getInstance()->unload(this->thunderBuffer);
+    this->thunderBuffer = (OrxSound::SoundBuffer*)ResourceManager::getInstance()->load("sound/atmosphere/thunder.wav", 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);
+
+        CloudEffect::flashSky(0.02);
+
+        // 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);
+        CloudEffect::changeSkyColor(Vector(0,0,1), 0.02);
+
+        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/lib/graphics/effects/lightning_effect.h
===================================================================
--- /trunk/src/lib/graphics/effects/lightning_effect.h	(revision 9006)
+++ /trunk/src/lib/graphics/effects/lightning_effect.h	(revision 9006)
@@ -0,0 +1,115 @@
+/**
+* @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 {
+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/lib/graphics/effects/rain_effect.cc
===================================================================
--- /trunk/src/lib/graphics/effects/rain_effect.cc	(revision 9005)
+++ /trunk/src/lib/graphics/effects/rain_effect.cc	(revision 9006)
@@ -1,15 +1,17 @@
 /*
   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"
@@ -43,45 +45,41 @@
  * @brief standard constructor
  */
-RainEffect::RainEffect(const TiXmlElement* root)
-{
-  this->setClassID(CL_RAIN_EFFECT, "RainEffect");
-
-  this->init();
-
-  if (root != NULL)
-    this->loadParams(root);
-
-  //load rain sound
-  if (this->rainBuffer != NULL)
-    ResourceManager::getInstance()->unload(this->rainBuffer);
-  this->rainBuffer = (OrxSound::SoundBuffer*)ResourceManager::getInstance()->load("sound/atmosphere/rain.wav", WAV);
-
-  //load wind sound
-  if (this->rainWindForce != 0)
-  {
+RainEffect::RainEffect(const TiXmlElement* root) {
+    this->setClassID(CL_RAIN_EFFECT, "RainEffect");
+
+    this->init();
+
+    if (root != NULL)
+        this->loadParams(root);
+
+    //load rain sound
+    if (this->rainBuffer != NULL)
+        ResourceManager::getInstance()->unload(this->rainBuffer);
+    this->rainBuffer = (OrxSound::SoundBuffer*)ResourceManager::getInstance()->load("sound/atmosphere/rain.wav", WAV);
+
+    //load wind sound
+    if (this->rainWindForce != 0) {
+        if (this->windBuffer != NULL)
+            ResourceManager::getInstance()->unload(this->windBuffer);
+        this->windBuffer = (OrxSound::SoundBuffer*)ResourceManager::getInstance()->load("sound/atmosphere/wind.wav", WAV);
+    }
+
+    if(rainActivate) {
+        this->activate();
+        RainEffect::rainParticles->precache((int)this->rainLife * 2);
+    }
+}
+
+/**
+ * @brief standard deconstructor
+ */
+RainEffect::~RainEffect() {
+    this->deactivate();
+
+    if (this->rainBuffer != NULL)
+        ResourceManager::getInstance()->unload(this->rainBuffer);
+
     if (this->windBuffer != NULL)
-      ResourceManager::getInstance()->unload(this->windBuffer);
-    this->windBuffer = (OrxSound::SoundBuffer*)ResourceManager::getInstance()->load("sound/atmosphere/wind.wav", WAV);
-  }
-
-  if(rainActivate)
-  {
-    this->activate();
-    RainEffect::rainParticles->precache((int)this->rainLife * 2);
-  }
-}
-
-/**
- * @brief standard deconstructor
- */
-RainEffect::~RainEffect()
-{
-  this->deactivate();
-
-  if (this->rainBuffer != NULL)
-    ResourceManager::getInstance()->unload(this->rainBuffer);
-
-  if (this->windBuffer != NULL)
-    ResourceManager::getInstance()->unload(this->windBuffer);
+        ResourceManager::getInstance()->unload(this->windBuffer);
 }
 
@@ -89,28 +87,28 @@
  * @brief initalizes the rain effect with default values
  */
-void RainEffect::init()
-{
-  //Default values
-  this->rainActivate = 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 = 0;
-  this->rainFadeOutDuration = 0;
-  
-  this->cloudColor = Vector(0.8f, 0.8f, 0.8f);
-  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();
-  this->rainAmbient = lightMan->getAmbientColor();
+void RainEffect::init() {
+    //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);
+
 }
 
@@ -119,24 +117,23 @@
  * @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);
+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);
 }
 
@@ -146,47 +143,43 @@
  * @brief activates the rain effect
  */
-void RainEffect::activate()
-{
-  PRINTF(0)( "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);
-
-  // plays the rain sound and loops it 
-  this->soundSource.play(this->rainBuffer, this->soundRainVolume, true);
-
-  // if there is wind, play the wind sound
-  if (this->rainWindForce != 0)
-    this->soundSource.play(this->windBuffer, 0.1f * this->rainWindForce, true);
-
-  if (this->rainFadeInDuration == 0)
-    lightMan->setAmbientColor(.1,.1,.1);
-  
-  // Change the cloudcolor,skycolor
-  this->oldCloudColor = CloudEffect::cloudColor;
-  this->oldSkyColor = CloudEffect::skyColor;
-  CloudEffect::changeCloudColor(this->cloudColor);
-  CloudEffect::changeSkyColor(this->skyColor);
+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);
+        CloudEffect::changeSkyColor(this->skyColor, 0);
+    }
 }
 
@@ -194,19 +187,19 @@
  * @brief deactivates the rain effect
  */
-void RainEffect::deactivate()
-{
-  PRINTF(0)("Deactivating RainEffect\n");
-
-  this->rainActivate = false;
-  this->emitter->setSystem(NULL);
-
-  // Stop Sound
-  this->soundSource.stop();
-
-  // Restore Light Ambient
-  lightMan->setAmbientColor(this->rainAmbient, this->rainAmbient, this->rainAmbient);
-  
-  CloudEffect::changeCloudColor(this->oldCloudColor);
-  CloudEffect::changeSkyColor(this->oldSkyColor);
+void RainEffect::deactivate() {
+    PRINTF(3)("Deactivating RainEffect\n");
+
+    this->rainActivate = false;
+    this->rainFadeInActivate = false;
+    this->rainFadeOutActivate = false;
+
+    this->emitter->setSystem(NULL);
+
+    // Stop Sound
+    this->soundSource.stop();
+
+    // Restore the old cloud- and sky color
+    CloudEffect::changeCloudColor(this->oldCloudColor, 0);
+    CloudEffect::changeSkyColor(this->oldSkyColor, 0);
 }
 
@@ -215,68 +208,65 @@
  * @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->rainFadeInDuration != 0 && this->localTimer < this->rainFadeInDuration)
-  {
-    this->localTimer += dt;
-    float progress = this->localTimer / this->rainFadeInDuration;
-
-    // Dim Light
-    lightMan->setAmbientColor(1 - progress * 0.9, 1 - progress * 0.9, 1 - progress * 0.9);
-
-    // use alpha in color to fade in
-    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 (!this->soundSource.isPlaying())
-      this->soundSource.play(this->rainBuffer, this->soundRainVolume, true);
-
-    this->soundSource.gain(this->rainBuffer, this->soundRainVolume * progress);
-  }
-  else if ( this->rainFadeOutDuration != 0 )
-  {
-    if ( this->localTimer < this->rainFadeOutDuration )
-    {
-      this->localTimer += dt;
-      float progress = 1 - (this->localTimer / this->rainFadeOutDuration);
-
-      // Fade In Light
-      lightMan->setAmbientColor(1 - progress * 0.9, 1 - progress * 0.9, 1 - progress * 0.9);
-
-      // 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);
-    }
-    else
-      this->deactivate();
-  }
+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 (!this->soundSource.isPlaying())
+            this->soundSource.play(this->rainBuffer, this->soundRainVolume, true);
+        this->soundSource.gain(this->rainBuffer, this->soundRainVolume * progress);
+
+        if (progress >= 1)
+            this->rainFadeInActivate = false;
+    }
+
+    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();
+        }
+    }
 }
 
@@ -284,16 +274,19 @@
  * @brief starts raining slowly
 */
-void RainEffect::startRaining()
-{
-
-  if (this->rainActivate)
-    this->deactivate();
-
-  if (!this->rainFadeInDuration > 0)
-    this->rainFadeInDuration = 20;
-
-  this->localTimer = 0;
-
-  this->activate();
+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);
 }
 
@@ -301,14 +294,18 @@
  * @brief stops raining slowly
  */
-void RainEffect::stopRaining()
-{
-
-  if (!this->rainActivate)
-    this->activate();
-
-  if (!this->rainFadeOutDuration > 0)
-    this->rainFadeOutDuration = 20;
-
-  this->localTimer = 0;
+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);
 }
 
@@ -316,7 +313,6 @@
  * @brief hides the rain
  */
-void RainEffect::hideRain()
-{
-  RainEffect::rainParticles->setColor(0, 0,0,0, 0);
-  RainEffect::rainParticles->setColor(0, 0,0,0, 0);
-}
+void RainEffect::hideRain() {
+    RainEffect::rainParticles->setColor(0, 0,0,0, 0);
+    RainEffect::rainParticles->setColor(0, 0,0,0, 0);
+}
Index: /trunk/src/lib/graphics/effects/rain_effect.h
===================================================================
--- /trunk/src/lib/graphics/effects/rain_effect.h	(revision 9005)
+++ /trunk/src/lib/graphics/effects/rain_effect.h	(revision 9006)
@@ -86,5 +86,5 @@
     this->rainFadeOutDuration = fadeout;
   }
-  
+
   inline void setCloudColor(float colorX, float colorY, float colorZ)
   {
@@ -113,4 +113,6 @@
   GLfloat                     rainFadeInDuration;
   GLfloat                     rainFadeOutDuration;
+  bool                        rainFadeInActivate;
+  bool                        rainFadeOutActivate;
 
   Vector                      rainCoord;
@@ -130,7 +132,4 @@
   float                       soundRainVolume;
 
-  LightManager*               lightMan;
-  GLfloat                     rainAmbient;
-  
   Vector oldSkyColor;
   Vector oldCloudColor;
Index: /trunk/src/lib/graphics/effects/snow_effect.cc
===================================================================
--- /trunk/src/lib/graphics/effects/snow_effect.cc	(revision 9005)
+++ /trunk/src/lib/graphics/effects/snow_effect.cc	(revision 9006)
@@ -117,5 +117,5 @@
 void SnowEffect::activate()
 {
-	PRINTF(0)("Activating SnowEffect\n");
+	PRINTF(3)("Activating SnowEffect\n");
 
 	this->snowActivate = true;
@@ -149,5 +149,5 @@
 void SnowEffect::deactivate()
 {
-	PRINTF(0)("Deactivating SnowEffect\n");
+	PRINTF(3)("Deactivating SnowEffect\n");
 
 	this->snowActivate = false;
Index: /trunk/src/lib/graphics/effects/volfog_effect.cc
===================================================================
--- /trunk/src/lib/graphics/effects/volfog_effect.cc	(revision 9005)
+++ /trunk/src/lib/graphics/effects/volfog_effect.cc	(revision 9006)
@@ -74,5 +74,5 @@
 
 void VolFogEffect::init() {
-    PRINTF(0)("Initalize VolFogEffect\n");
+    PRINTF(3)("Initalize VolFogEffect\n");
 
     // set fog mode
@@ -108,19 +108,19 @@
 
     if (glewInit() == GLEW_OK)
-        PRINTF(0)("glewInit OK\n");
+        PRINTF(4)("glewInit OK\n");
     else
-        PRINTF(0)("glewInit failed\n");
+        PRINTF(4)("glewInit failed\n");
 
     if (glewGetExtension("GL_EXT_fog_coord"))
-        PRINTF(0)("GL_EXT_fog_coord extension found\n");
+        PRINTF(4)("GL_EXT_fog_coord extension found\n");
 }
 
 
 void VolFogEffect::activate() {
-    PRINTF(0)("Activating VolFogEffect\n");
+    PRINTF(3)("Activating VolFogEffect\n");
 }
 
 void VolFogEffect::deactivate() {
-    PRINTF(0)("Deactivating VolFogEffect\n");
+    PRINTF(3)("Deactivating VolFogEffect\n");
 
     glDisable(GL_FOG);
Index: /trunk/src/lib/gui/gl/glgui_handler.cc
===================================================================
--- /trunk/src/lib/gui/gl/glgui_handler.cc	(revision 9005)
+++ /trunk/src/lib/gui/gl/glgui_handler.cc	(revision 9006)
@@ -88,5 +88,5 @@
   void GLGuiHandler::activate()
   {
-    EventHandler::getInstance()->pushState(ES_MENU);
+    //EventHandler::getInstance()->pushState(ES_MENU);
 
 
@@ -96,5 +96,5 @@
   void GLGuiHandler::deactivate()
   {
-    EventHandler::getInstance()->popState();
+    //EventHandler::getInstance()->popState();
 
 
Index: /trunk/src/lib/util/executor/executor_lua.h
===================================================================
--- /trunk/src/lib/util/executor/executor_lua.h	(revision 9005)
+++ /trunk/src/lib/util/executor/executor_lua.h	(revision 9006)
@@ -44,9 +44,9 @@
   public:
     /**
-     * @brief Constructor of a ExecutorXML
-     * @param function a Function to call
+   * @brief Constructor of a ExecutorXML
+   * @param function a Function to call
      */
     ExecutorLua0(void(T::*function)())
-        : Executor()
+  : Executor()
     {
       this->functionPointer = function;
@@ -91,18 +91,18 @@
   public:
     /**
-     * @brief Constructor of a ExecutorXML
-     * @param function a Function to call
+   * @brief Constructor of a ExecutorXML
+   * @param function a Function to call
      */
     ExecutorLua1(void(T::*function)(type0))
-        : Executor(ExecutorParamType<type0>())
-    {
-      this->functionPointer = function;
-      this->functorType = Executor_Objective | Executor_NoLoadString;
-    }
-
-    /**
-       * @brief executes the Command on BaseObject
-       * @param object the BaseObject to execute this Executor on
-       * @param loadString ignored in this case
+  : Executor(ExecutorParamType<type0>())
+    {
+      this->functionPointer = function;
+      this->functorType = Executor_Objective | Executor_NoLoadString;
+    }
+
+    /**
+     * @brief executes the Command on BaseObject
+     * @param object the BaseObject to execute this Executor on
+     * @param loadString ignored in this case
      */
     virtual void operator()(BaseObject* object, const SubString& = SubString()) const
@@ -120,5 +120,5 @@
 
     /**
-       * @returns a _new_ Copy of this Executor
+     * @returns a _new_ Copy of this Executor
      */
     virtual Executor* clone () const
@@ -140,9 +140,9 @@
   public:
     /**
-     * @brief Constructor of a ExecutorXML
-     * @param function a Function to call
+   * @brief Constructor of a ExecutorXML
+   * @param function a Function to call
      */
     ExecutorLua2(void(T::*function)(type0, type1))
-        : Executor(ExecutorParamType<type0>(), ExecutorParamType<type1>())
+  : Executor(ExecutorParamType<type0>(), ExecutorParamType<type1>())
     {
       this->functionPointer = function;
@@ -166,6 +166,6 @@
 
       (dynamic_cast<T*>(object)->*(functionPointer))(
-        fromLua<type0>(state, 1),
-        fromLua<type1>(state, 2) );
+          fromLua<type0>(state, 1),
+      fromLua<type1>(state, 2) );
     }
 
@@ -217,6 +217,6 @@
       (dynamic_cast<T*>(object)->*(functionPointer))(
           fromLua<type0>(state, 1),
-          fromLua<type1>(state, 2),
-          fromLua<type2>(state, 3) );
+      fromLua<type1>(state, 2),
+      fromLua<type2>(state, 3) );
     }
 
@@ -268,7 +268,7 @@
       (dynamic_cast<T*>(object)->*(functionPointer))(
           fromLua<type0>(state, 1),
-          fromLua<type1>(state, 2),
-          fromLua<type2>(state, 3),
-          fromLua<type3>(state, 4) );
+      fromLua<type1>(state, 2),
+      fromLua<type2>(state, 3),
+      fromLua<type3>(state, 4) );
     }
 
@@ -300,9 +300,9 @@
   public:
     /**
-     * @brief Constructor of a ExecutorXML
-     * @param function a Function to call
+   * @brief Constructor of a ExecutorXML
+   * @param function a Function to call
      */
     ExecutorLua0ret(ret (T::*function)())
-        : Executor()
+  : Executor()
     {
       this->functionPointer = function;
@@ -329,5 +329,5 @@
 
     /**
-                       * @returns a _new_ Copy of this Executor
+     * @returns a _new_ Copy of this Executor
      */
     virtual Executor* clone () const
@@ -349,9 +349,9 @@
   public:
     /**
-     * @brief Constructor of a ExecutorXML
-     * @param function a Function to call
+   * @brief Constructor of a ExecutorXML
+   * @param function a Function to call
      */
     ExecutorLua1ret(ret (T::*function)(type0))
-        : Executor(ExecutorParamType<type0>())
+  : Executor(ExecutorParamType<type0>())
     {
       this->functionPointer = function;
@@ -375,5 +375,5 @@
 
       toLua<ret>(state, (dynamic_cast<T*>(object)->*(functionPointer))(
-                   fromLua<type0>(state, 1)));
+          fromLua<type0>(state, 1)));
     }
 
@@ -397,9 +397,9 @@
   public:
     /**
-     * @brief Constructor of a ExecutorXML
-     * @param function a Function to call
+   * @brief Constructor of a ExecutorXML
+   * @param function a Function to call
      */
     ExecutorLua2ret(ret (T::*function)(type0, type1))
-        : Executor(ExecutorParamType<type0>(), ExecutorParamType<type1>())
+  : Executor(ExecutorParamType<type0>(), ExecutorParamType<type1>())
     {
       this->functionPointer = function;
@@ -423,6 +423,6 @@
 
       toLua<ret>(state, (dynamic_cast<T*>(object)->*(functionPointer))(
-                   fromLua<type0>(state, 1),
-                   fromLua<type1>(state, 2) ));
+          fromLua<type0>(state, 1),
+          fromLua<type1>(state, 2) ));
     }
 
@@ -608,40 +608,40 @@
              ExecutorParamType<type2>(), ExecutorParamType<type3>(),
              ExecutorParamType<type4>(), ExecutorParamType<type5>())
-    {
-      this->functionPointer = function;
-      this->functorType = Executor_Objective | Executor_NoLoadString;
-    }
-
-    /**
-     * @brief executes the Command on BaseObject
-     * @param object the BaseObject to execute this Executor on
-     * @param loadString ignored in this case
-     */
-    virtual void operator()(BaseObject* object, const SubString& = SubString()) const
-    {
-      PRINTF(1)("no usefull executor\n");
-    }
-
-    virtual void operator()(BaseObject* object, int& count, void* values) const
-    {
-      lua_State* state = (lua_State*)values;
-      count = 1;
-
-      toLua<ret>(state, (dynamic_cast<T*>(object)->*(functionPointer))(
-          fromLua<type0>(state, 1),
-          fromLua<type1>(state, 2),
-          fromLua<type2>(state, 3),
-          fromLua<type3>(state, 4),
-          fromLua<type4>(state, 5),
-          fromLua<type5>(state, 6) ));
-    }
-
-    /**
-     * @returns a _new_ Copy of this Executor
-     */
-    virtual Executor* clone () const
-    {
-      return new ExecutorLua6ret<T, ret, type0, type1, type2, type3, type4, type5>(this->functionPointer);
-    }
+             {
+               this->functionPointer = function;
+               this->functorType = Executor_Objective | Executor_NoLoadString;
+             }
+
+    /**
+              * @brief executes the Command on BaseObject
+              * @param object the BaseObject to execute this Executor on
+              * @param loadString ignored in this case
+     */
+             virtual void operator()(BaseObject* object, const SubString& = SubString()) const
+             {
+               PRINTF(1)("no usefull executor\n");
+             }
+
+             virtual void operator()(BaseObject* object, int& count, void* values) const
+             {
+               lua_State* state = (lua_State*)values;
+               count = 1;
+
+               toLua<ret>(state, (dynamic_cast<T*>(object)->*(functionPointer))(
+                   fromLua<type0>(state, 1),
+                   fromLua<type1>(state, 2),
+                   fromLua<type2>(state, 3),
+                   fromLua<type3>(state, 4),
+                   fromLua<type4>(state, 5),
+                   fromLua<type5>(state, 6) ));
+             }
+
+    /**
+              * @returns a _new_ Copy of this Executor
+     */
+             virtual Executor* clone () const
+             {
+               return new ExecutorLua6ret<T, ret, type0, type1, type2, type3, type4, type5>(this->functionPointer);
+             }
   private:
     ret           (T::*functionPointer)(type0, type1, type2, type3, type4, type5);
Index: /trunk/src/world_entities/environments/mapped_water.cc
===================================================================
--- /trunk/src/world_entities/environments/mapped_water.cc	(revision 9005)
+++ /trunk/src/world_entities/environments/mapped_water.cc	(revision 9006)
@@ -19,8 +19,25 @@
 #include "util/loading/resource_manager.h"
 #include "state.h"
+#include "t_animation.h"
 #include "math.h"
-
+#include "glgui.h"
+#include "shell_command.h"
+#include "script_class.h"
 
 CREATE_FACTORY(MappedWater, CL_MAPPED_WATER);
+
+SHELL_COMMAND(gui, MappedWater, openGui);
+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)));
+
 
 /**
@@ -45,6 +62,10 @@
   /// initialization of the shaders
   this->initShaders();
-  
-  tempcounter = 0;
+
+  /// calculation of the 4 verts of the water quad
+  this->calcVerts();
+
+  // init gui
+  this->box = NULL;
 }
 
@@ -58,5 +79,8 @@
   delete color_uni;
   delete light_uni;
-  delete shine_uni;
+  delete shineSize_uni;
+  delete shineStrength_uni;
+  delete reflStrength_uni;
+  delete refr_uni;
 }
 
@@ -70,10 +94,13 @@
   this->setWaterSize(100, 100);
   this->setWaterUV(9);
-  this->setWaterFlow(0.08);
+  this->setWaterFlow(0.08f);
   this->setLightPos(0, 10, 0);
   this->setWaterAngle(0);
   this->setNormalMapScale(0.25f);
   this->setWaterColor(0.1f, 0.2f, 0.4f);
-  this->setShininess(128);
+  this->setShineSize(128);
+  this->setShineStrength(0.7f);
+  this->setReflStrength(1.0f);
+  this->setRefraction(0.009f);
 
   // initialization of the texture coords, speeds etc...
@@ -84,5 +111,13 @@
   this->move2 = this->move * this->kNormalMapScale;
 
-
+  // initalize fading bools
+  this->bFadeWaterHeight = false;
+  this->bFadeWaterUV = false;
+  this->bFadeWaterFlow = false;
+  this->bFadeShineSize = false;
+  this->bFadeShineStrength = false;
+  this->bFadeReflStrength = false;
+  this->bFadeRefraction = false;
+  this->bFadeWaterColor = false;
 }
 
@@ -104,7 +139,7 @@
   mat.setDiffuseMap(refrTex, 1);
   // load normal map
-  mat.setDiffuseMap("pictures/normalmap.bmp", GL_TEXTURE_2D, 2);
+  mat.setDiffuseMap("pictures/water_normalmap.bmp", GL_TEXTURE_2D, 2);
   // load dudv map
-  mat.setDiffuseMap("pictures/dudvmap.bmp", GL_TEXTURE_2D, 3);
+  mat.setDiffuseMap("pictures/water_dudvmap.bmp", GL_TEXTURE_2D, 3);
 
   // sets texture parameters for reflection texture
@@ -140,5 +175,5 @@
   Shader::Uniform(shader, "dudvMap").set(3);
   // Set the variable "depthMap" to correspond to the fifth texture unit
-  Shader::Uniform(shader, "depthMap").set(2);
+  Shader::Uniform(shader, "depthMap").set(1);
   // Give the variable "waterColor" a blue color
   color_uni = new Shader::Uniform(shader, "waterColor");
@@ -148,10 +183,34 @@
   light_uni->set(lightPos.x, lightPos.y, lightPos.z, 1.0f);
   // Set the variable "shine"
-  shine_uni = new Shader::Uniform(shader, "kShine");
-  shine_uni->set(this->shininess);
+  shineSize_uni = new Shader::Uniform(shader, "kShine");
+  shineSize_uni->set(this->shineSize);
+  // Set the variable "shineStrength"
+  shineStrength_uni = new Shader::Uniform(shader, "shineStrength");
+  shineStrength_uni->set(this->shineStrength);
+  // Set the variable "reflStrength"
+  reflStrength_uni = new Shader::Uniform(shader, "reflStrength");
+  reflStrength_uni->set(this->reflStrength);
+  // Set the variable "refraction"
+  refr_uni = new Shader::Uniform(shader, "kRefraction");
+  refr_uni->set(this->refraction);
   // uniform for the camera position
   cam_uni = new Shader::Uniform(shader, "cameraPos");
 
   this->shader->deactivateShader();
+}
+
+/**
+ * @brief calculates the 4 verts of the water quad
+ */
+void MappedWater::calcVerts()
+{
+  float deg2radtemp = this->waterAngle / 180 * PI;
+
+  this->waterVerts[2] = this->waterVerts[0] + cos(deg2radtemp) * this->xWidth;
+  this->waterVerts[3] = this->waterVerts[1] + sin(deg2radtemp) * this->xWidth;
+  this->waterVerts[4] = this->waterVerts[0] + cos(deg2radtemp) * this->xWidth - sin(deg2radtemp) * this->zWidth;
+  this->waterVerts[5] = this->waterVerts[1] + sin(deg2radtemp) * this->xWidth + cos(deg2radtemp) * this->zWidth;
+  this->waterVerts[6] = this->waterVerts[0] - sin(deg2radtemp) * this->zWidth;
+  this->waterVerts[7] = this->waterVerts[1] + cos(deg2radtemp) * this->zWidth;
 }
 
@@ -171,5 +230,5 @@
 
   this->shader->deactivateShader();
-};
+}
 
 /**
@@ -177,14 +236,59 @@
  * @param shine new value for the shininess
  */
-void MappedWater::resetShininess(float shine)
+void MappedWater::resetShineSize(float shine)
 {
   this->shader->activateShader();
-  this->shininess = shine;
+  this->shineSize = shine;
 
   // Set the variable "shine"
-  shine_uni->set(this->shininess);
+  shineSize_uni->set(this->shineSize);
 
   this->shader->deactivateShader();
-};
+}
+
+/**
+ * @brief resets the strength of the specular reflection in the Shader
+ * @param strength new value for the strength of the specular reflection
+ */
+void MappedWater::resetShineStrength(float strength)
+{
+  this->shader->activateShader();
+  this->shineStrength = strength;
+
+  // Set the variable "shine"
+  shineStrength_uni->set(this->shineStrength);
+
+  this->shader->deactivateShader();
+}
+
+/**
+ * @brief resets the strength of the reflection in the Shader
+ * @param strength new value for the strength of the reflection
+ */
+void MappedWater::resetReflStrength(float strength)
+{
+  this->shader->activateShader();
+  this->reflStrength = strength;
+
+  // Set the variable "shine"
+  reflStrength_uni->set(this->reflStrength);
+
+  this->shader->deactivateShader();
+}
+
+/**
+ * @brief resets the refraction in the Shader
+ * @param refraction new value for the refraction
+ */
+void MappedWater::resetRefraction(float refraction)
+{
+  this->shader->activateShader();
+  this->refraction = refraction;
+
+  // Set the variable "shine"
+  refr_uni->set(this->refraction);
+
+  this->shader->deactivateShader();
+}
 
 /**
@@ -203,5 +307,5 @@
 
   this->shader->deactivateShader();
-};
+}
 
 /**
@@ -215,11 +319,212 @@
   LoadParam(root, "waterpos", this, MappedWater, setWaterPos);
   LoadParam(root, "watersize", this, MappedWater, setWaterSize);
-  LoadParam(root, "lightpos", this, MappedWater, setLightPos);
   LoadParam(root, "wateruv", this, MappedWater, setWaterUV);
   LoadParam(root, "waterflow", this, MappedWater, setWaterFlow);
+  LoadParam(root, "lightpos", this, MappedWater, setLightPos);
+  LoadParam(root, "waterangle", this, MappedWater, setWaterAngle);
   LoadParam(root, "normalmapscale", this, MappedWater, setNormalMapScale);
-  LoadParam(root, "waterangle", this, MappedWater, setWaterAngle);
+  LoadParam(root, "shinesize", this, MappedWater, setShineSize);
+  LoadParam(root, "shinestrength", this, MappedWater, setShineStrength);
+  LoadParam(root, "reflstrength", this, MappedWater, setReflStrength);
+  LoadParam(root, "refraction", this, MappedWater, setRefraction);
   LoadParam(root, "watercolor", this, MappedWater, setWaterColor);
-  LoadParam(root, "shininess", this, MappedWater, setShininess);
+}
+
+/**
+ * @brief prints the xml code of the water params
+ */
+void MappedWater::saveParams()
+{
+  // it's not too nice, but it works fine
+  PRINTF(0)("\nMappedWater XML Code:\n<MappedWater>\n  <waterpos>%f, %f, %f</waterpos>\n  <watersize>%f, %f</watersize>\n  <wateruv>%f</wateruv>\n  <waterflow>%f</waterflow>\n  <lightpos>%f, %f, %f</lightpos>\n  <waterangle>%f</waterangle>\n  <normalmapscale>%f</normalmapscale>\n  <shinesize>%f</waterpos>\n  <shinestrength>%f</shinestrength>\n  <reflstrength>%f</reflstrength>\n  <refraction>%f</refraction>\n  <watercolor>%f, %f, %f</watercolor>\n</MappedWater>\n", this->waterVerts[0], this->waterHeight, this->waterVerts[1], this->xWidth, this->zWidth, this->waterUV, this->waterFlow, this->lightPos.x, this->lightPos.y, this->lightPos.z, this->waterAngle, this->kNormalMapScale, this->shineSize, this->shineStrength, this->reflStrength, this->refraction, this->waterColor.x, this->waterColor.y, this->waterColor.z);
+}
+
+/**
+ * @brief starts the slider gui that lets you edit all water parameters
+ */
+void MappedWater::openGui()
+{
+  if (this->box == NULL)
+  {
+    this->box = new OrxGui::GLGuiBox(OrxGui::Vertical);
+    {
+      OrxGui::GLGuiBox* waterColorBox = new OrxGui::GLGuiBox(OrxGui::Horizontal);
+      {
+        OrxGui::GLGuiInputLine* waterColorText = new OrxGui::GLGuiInputLine();
+        waterColorText->setText("WaterColor");
+        waterColorBox->pack(waterColorText);
+
+        OrxGui::GLGuiSlider* waterColorR = new OrxGui::GLGuiSlider();
+        waterColorR->setRange(0, 1.0f);
+        waterColorR->setValue(this->waterColor.x);
+        waterColorR->setStep(0.1f);
+        waterColorR->connect(SIGNAL(waterColorR, valueChanged), this, SLOT(MappedWater, resetWaterColorR));
+        waterColorBox->pack(waterColorR);
+
+        OrxGui::GLGuiSlider* waterColorG = new OrxGui::GLGuiSlider();
+        waterColorG->setRange(0, 1.0f);
+        waterColorG->setStep(0.1f);
+        waterColorG->setValue(this->waterColor.y);
+        waterColorG->connect(SIGNAL(waterColorG, valueChanged), this, SLOT(MappedWater, resetWaterColorG));
+        waterColorBox->pack(waterColorG);
+
+        OrxGui::GLGuiSlider* waterColorB = new OrxGui::GLGuiSlider();
+        waterColorB->setRange(0, 1.0f);
+        waterColorB->setStep(0.1f);
+        waterColorB->setValue(this->waterColor.z);
+        waterColorB->connect(SIGNAL(waterColorB, valueChanged), this, SLOT(MappedWater, resetWaterColorB));
+        waterColorBox->pack(waterColorB);
+      }
+      this->box->pack(waterColorBox);
+
+      OrxGui::GLGuiBox* waterUVBox = new OrxGui::GLGuiBox(OrxGui::Horizontal);
+      {
+        OrxGui::GLGuiInputLine* waterUVText = new OrxGui::GLGuiInputLine();
+        waterUVText->setText("WaterUV");
+        waterUVBox->pack(waterUVText);
+
+        OrxGui::GLGuiSlider* waterUV = new OrxGui::GLGuiSlider();
+        waterUV->setRange(1, 20);
+        waterUV->setValue(this->waterUV);
+        waterUV->setStep(1);
+        waterUV->connect(SIGNAL(waterUV, valueChanged), this, SLOT(MappedWater, setWaterUV));
+        waterUVBox->pack(waterUV);
+      }
+      this->box->pack(waterUVBox);
+
+      OrxGui::GLGuiBox* waterFlowBox = new OrxGui::GLGuiBox(OrxGui::Horizontal);
+      {
+        OrxGui::GLGuiInputLine* waterFlowText = new OrxGui::GLGuiInputLine();
+        waterFlowText->setText("WaterFlow");
+        waterFlowBox->pack(waterFlowText);
+
+        OrxGui::GLGuiSlider* waterFlow = new OrxGui::GLGuiSlider();
+        waterFlow->setRange(0.01f, 2);
+        waterFlow->setValue(this->waterFlow);
+        waterFlow->setStep(0.02f);
+        waterFlow->connect(SIGNAL(waterFlow, valueChanged), this, SLOT(MappedWater, setWaterFlow));
+        waterFlowBox->pack(waterFlow);
+      }
+      this->box->pack(waterFlowBox);
+
+      OrxGui::GLGuiBox* shineSizeBox = new OrxGui::GLGuiBox(OrxGui::Horizontal);
+      {
+        OrxGui::GLGuiInputLine* shineSizeText = new OrxGui::GLGuiInputLine();
+        shineSizeText->setText("ShineSize");
+        shineSizeBox->pack(shineSizeText);
+
+        OrxGui::GLGuiSlider* shineSize = new OrxGui::GLGuiSlider();
+        shineSize->setRange(1, 128);
+        shineSize->setValue(this->shineSize);
+        shineSize->setStep(1);
+        shineSize->connect(SIGNAL(shineSize, valueChanged), this, SLOT(MappedWater, resetShineSize));
+        shineSizeBox->pack(shineSize);
+      }
+      this->box->pack(shineSizeBox);
+
+      OrxGui::GLGuiBox* shineStrengthBox = new OrxGui::GLGuiBox(OrxGui::Horizontal);
+      {
+        OrxGui::GLGuiInputLine* shineStrengthText = new OrxGui::GLGuiInputLine();
+        shineStrengthText->setText("ShineStrength");
+        shineStrengthBox->pack(shineStrengthText);
+
+        OrxGui::GLGuiSlider* shineStrength = new OrxGui::GLGuiSlider();
+        shineStrength->setRange(0, 1);
+        shineStrength->setValue(this->shineStrength);
+        shineStrength->setStep(0.1f);
+        shineStrength->connect(SIGNAL(shineStrength, valueChanged), this, SLOT(MappedWater, resetShineStrength));
+        shineStrengthBox->pack(shineStrength);
+      }
+      this->box->pack(shineStrengthBox);
+
+      OrxGui::GLGuiBox* reflStrengthBox = new OrxGui::GLGuiBox(OrxGui::Horizontal);
+      {
+        OrxGui::GLGuiInputLine* reflStrengthText = new OrxGui::GLGuiInputLine();
+        reflStrengthText->setText("ReflStrength");
+        reflStrengthBox->pack(reflStrengthText);
+
+        OrxGui::GLGuiSlider* reflStrength = new OrxGui::GLGuiSlider();
+        reflStrength->setRange(0, 1);
+        reflStrength->setValue(this->reflStrength);
+        reflStrength->setStep(0.1f);
+        reflStrength->connect(SIGNAL(reflStrength, valueChanged), this, SLOT(MappedWater, resetReflStrength));
+        reflStrengthBox->pack(reflStrength);
+      }
+      this->box->pack(reflStrengthBox);
+
+      OrxGui::GLGuiBox* refractionBox = new OrxGui::GLGuiBox(OrxGui::Horizontal);
+      {
+        OrxGui::GLGuiInputLine* refractionText = new OrxGui::GLGuiInputLine();
+        refractionText->setText("Refraction");
+        refractionBox->pack(refractionText);
+
+        OrxGui::GLGuiSlider* refraction = new OrxGui::GLGuiSlider();
+        refraction->setRange(0.001f, 0.1f);
+        refraction->setValue(this->refraction);
+        refraction->setStep(0.004f);
+        refraction->connect(SIGNAL(refraction, valueChanged), this, SLOT(MappedWater, resetRefraction));
+        refractionBox->pack(refraction);
+      }
+      this->box->pack(refractionBox);
+
+      OrxGui::GLGuiBox* lightPosBox = new OrxGui::GLGuiBox(OrxGui::Horizontal);
+      {
+        OrxGui::GLGuiInputLine* lightPosText = new OrxGui::GLGuiInputLine();
+        lightPosText->setText("LightPos");
+        lightPosBox->pack(lightPosText);
+
+        OrxGui::GLGuiSlider* lightPosX = new OrxGui::GLGuiSlider();
+        lightPosX->setRange(-600, 600);
+        lightPosX->setValue(this->lightPos.x);
+        lightPosX->setStep(15);
+        lightPosX->connect(SIGNAL(lightPosX, valueChanged), this, SLOT(MappedWater, resetLightPosX));
+        lightPosBox->pack(lightPosX);
+
+        OrxGui::GLGuiSlider* lightPosY = new OrxGui::GLGuiSlider();
+        lightPosY->setRange(-600, 600);
+        lightPosY->setStep(15);
+        lightPosY->setValue(this->lightPos.y);
+        lightPosY->connect(SIGNAL(lightPosY, valueChanged), this, SLOT(MappedWater, resetLightPosY));
+        lightPosBox->pack(lightPosY);
+
+        OrxGui::GLGuiSlider* lightPosZ = new OrxGui::GLGuiSlider();
+        lightPosZ->setRange(-600, 600);
+        lightPosZ->setStep(15);
+        lightPosZ->setValue(this->lightPos.z);
+        lightPosZ->connect(SIGNAL(lightPosZ, valueChanged), this, SLOT(MappedWater, resetLightPosZ));
+        lightPosBox->pack(lightPosZ);
+      }
+      this->box->pack(lightPosBox);
+
+      OrxGui::GLGuiBox* waterHeightBox = new OrxGui::GLGuiBox(OrxGui::Horizontal);
+      {
+        OrxGui::GLGuiInputLine* waterHeightText = new OrxGui::GLGuiInputLine();
+        waterHeightText->setText("WaterHeight");
+        waterHeightBox->pack(waterHeightText);
+
+        OrxGui::GLGuiSlider* waterHeight = new OrxGui::GLGuiSlider();
+        waterHeight->setRange(-500, 500);
+        waterHeight->setValue(this->waterHeight);
+        waterHeight->setStep(10);
+        waterHeight->connect(SIGNAL(waterHeight, valueChanged), this, SLOT(MappedWater, setWaterHeight));
+        waterHeightBox->pack(waterHeight);
+      }
+      this->box->pack(waterHeightBox);
+    }
+
+    this->box->showAll();
+    this->box->setAbsCoor2D(300, 40);
+    OrxGui::GLGuiHandler::getInstance()->activate();
+    OrxGui::GLGuiHandler::getInstance()->activateCursor();
+  }
+}
+
+/**
+ * @brief closes the water gui
+ */
+void MappedWater::closeGui()
+{
+  delete this->box;
+  this->box = NULL;
 }
 
@@ -230,8 +535,7 @@
 {
   glMatrixMode(GL_MODELVIEW);
-
   glPushMatrix();
-  // don't use a glTranslate here, the reflection point won't be at the right place anymore
-  glRotatef(this->waterAngle, 0, 1, 0);
+
+  // don't use glRotate or glTranslate here... the shader won't work anymore
 
   mat.select();
@@ -247,30 +551,30 @@
   glBegin(GL_QUADS);
   // The back left vertice for the water
-  glMultiTexCoord2f(GL_TEXTURE0, 0, waterUV);            // Reflection texture
-  glMultiTexCoord2f(GL_TEXTURE1, 0, waterUV - move);        // Refraction texture
-  glMultiTexCoord2f(GL_TEXTURE2, 0, normalUV + move2);     // Normal map texture
-  glMultiTexCoord2f(GL_TEXTURE3, 0, 0);                       // DUDV map texture
-  glVertex3f(this->waterPos.x, this->waterPos.y, this->waterPos.z);
+  glMultiTexCoord2f(GL_TEXTURE0, 0, waterUV);                   // Reflection texture
+  glMultiTexCoord2f(GL_TEXTURE1, 0, waterUV - move);            // Refraction texture
+  glMultiTexCoord2f(GL_TEXTURE2, 0, normalUV + move2);          // Normal map texture
+  glMultiTexCoord2f(GL_TEXTURE3, 0, 0);                         // DUDV map texture
+  glVertex3f(this->waterVerts[0], this->waterHeight, this->waterVerts[1]);
 
   // The front left vertice for the water
-  glMultiTexCoord2f(GL_TEXTURE0, 0, 0);                  // Reflection texture
-  glMultiTexCoord2f(GL_TEXTURE1, 0, -move);           // Refraction texture
-  glMultiTexCoord2f(GL_TEXTURE2, 0, move2);          // Normal map texture
-  glMultiTexCoord2f(GL_TEXTURE3, 0, 0);                        // DUDV map texture
-  glVertex3f(this->waterPos.x, this->waterPos.y, this->waterPos.z + this->zWidth);
+  glMultiTexCoord2f(GL_TEXTURE0, 0, 0);                         // Reflection texture
+  glMultiTexCoord2f(GL_TEXTURE1, 0, -move);                     // Refraction texture
+  glMultiTexCoord2f(GL_TEXTURE2, 0, move2);                     // Normal map texture
+  glMultiTexCoord2f(GL_TEXTURE3, 0, 0);                         // DUDV map texture
+  glVertex3f(this->waterVerts[2], this->waterHeight, this->waterVerts[3]);
 
   // The front right vertice for the water
-  glMultiTexCoord2f(GL_TEXTURE0, waterUV, 0);             // Reflection texture
-  glMultiTexCoord2f(GL_TEXTURE1, waterUV, -move);         // Refraction texture
-  glMultiTexCoord2f(GL_TEXTURE2, normalUV, move2);      // Normal map texture
-  glMultiTexCoord2f(GL_TEXTURE3, 0, 0);                        // DUDV map texture
-  glVertex3f(this->waterPos.x + this->xWidth, this->waterPos.y, this->waterPos.z + this->zWidth);
+  glMultiTexCoord2f(GL_TEXTURE0, waterUV, 0);                   // Reflection texture
+  glMultiTexCoord2f(GL_TEXTURE1, waterUV, -move);               // Refraction texture
+  glMultiTexCoord2f(GL_TEXTURE2, normalUV, move2);              // Normal map texture
+  glMultiTexCoord2f(GL_TEXTURE3, 0, 0);                         // DUDV map texture
+  glVertex3f(this->waterVerts[4], this->waterHeight, this->waterVerts[5]);
 
   // The back right vertice for the water
-  glMultiTexCoord2f(GL_TEXTURE0, waterUV, waterUV);        // Reflection texture
-  glMultiTexCoord2f(GL_TEXTURE1, waterUV, waterUV - move);       // Refraction texture
-  glMultiTexCoord2f(GL_TEXTURE2, normalUV, normalUV + move2);  // Normal map texture
-  glMultiTexCoord2f(GL_TEXTURE3, 0, 0);                        // DUDV map texture
-  glVertex3f(this->waterPos.x + this->xWidth, this->waterPos.y, this->waterPos.z);
+  glMultiTexCoord2f(GL_TEXTURE0, waterUV, waterUV);             // Reflection texture
+  glMultiTexCoord2f(GL_TEXTURE1, waterUV, waterUV - move);      // Refraction texture
+  glMultiTexCoord2f(GL_TEXTURE2, normalUV, normalUV + move2);   // Normal map texture
+  glMultiTexCoord2f(GL_TEXTURE3, 0, 0);                         // DUDV map texture
+  glVertex3f(this->waterVerts[6], this->waterHeight, this->waterVerts[7]);
   glEnd();
 
@@ -290,14 +594,118 @@
   this->move += this->waterFlow * dt;
   this->move2 = this->move * this->kNormalMapScale;
-  
-
-//   if(this->tempcounter == 200) {
-//     this->resetWaterColor(1, 0, 0);
-//     resetShininess(1);
-//     resetLightPos(0, 50, 0);
-//     PRINTF(0)("test waterchangecolor ");
-//     }
-//   tempcounter++;
-    
+
+  // fading TODO fix this so it isnt hacky anymore
+  if(bFadeWaterUV)
+  {
+    this->waterUVFader = new tAnimation<MappedWater>(this, &MappedWater::setWaterUV);
+    this->waterUVFader->setInfinity(ANIM_INF_CONSTANT);
+
+    this->waterUVFader->addKeyFrame(this->waterUV, this->waterUVFadeTime, ANIM_LINEAR);
+    this->waterUVFader->addKeyFrame(this->newWaterUV, 0, ANIM_LINEAR);
+
+    bFadeWaterUV = false;
+    this->waterUVFader->replay();
+  }
+
+  if(bFadeWaterFlow)
+  {
+    this->waterFlowFader = new tAnimation<MappedWater>(this, &MappedWater::setWaterFlow);
+    this->waterFlowFader->setInfinity(ANIM_INF_CONSTANT);
+
+    this->waterFlowFader->addKeyFrame(this->waterFlow, this->waterFlowFadeTime, ANIM_LINEAR);
+    this->waterFlowFader->addKeyFrame(this->newWaterFlow, 0, ANIM_LINEAR);
+
+    bFadeWaterFlow = false;
+    this->waterFlowFader->replay();
+  }
+
+  if(bFadeShineSize)
+  {
+    this->shineSizeFader = new tAnimation<MappedWater>(this, &MappedWater::resetShineSize);
+    this->shineSizeFader->setInfinity(ANIM_INF_CONSTANT);
+
+    this->shineSizeFader->addKeyFrame(this->shineSize, this->shineSizeFadeTime, ANIM_LINEAR);
+    this->shineSizeFader->addKeyFrame(this->newShineSize, 0, ANIM_LINEAR);
+
+    bFadeShineSize = false;
+    this->shineSizeFader->replay();
+  }
+
+  if(bFadeShineStrength)
+  {
+    this->shineStrengthFader = new tAnimation<MappedWater>(this, &MappedWater::resetShineStrength);
+    this->shineStrengthFader->setInfinity(ANIM_INF_CONSTANT);
+
+    this->shineStrengthFader->addKeyFrame(this->shineStrength, this->shineStrengthFadeTime, ANIM_LINEAR);
+    this->shineStrengthFader->addKeyFrame(this->newShineStrength, 0, ANIM_LINEAR);
+
+    bFadeShineStrength = false;
+    this->shineStrengthFader->replay();
+  }
+
+  if(bFadeReflStrength)
+  {
+    this->reflStrengthFader = new tAnimation<MappedWater>(this, &MappedWater::resetReflStrength);
+    this->reflStrengthFader->setInfinity(ANIM_INF_CONSTANT);
+
+    this->reflStrengthFader->addKeyFrame(this->reflStrength, this->reflStrengthFadeTime, ANIM_LINEAR);
+    this->reflStrengthFader->addKeyFrame(this->newReflStrength, 0, ANIM_LINEAR);
+
+    bFadeReflStrength = false;
+    this->reflStrengthFader->replay();
+  }
+
+  if(bFadeRefraction)
+  {
+    this->refractionFader = new tAnimation<MappedWater>(this, &MappedWater::resetRefraction);
+    this->refractionFader->setInfinity(ANIM_INF_CONSTANT);
+
+    this->refractionFader->addKeyFrame(this->refraction, this->refractionFadeTime, ANIM_LINEAR);
+    this->refractionFader->addKeyFrame(this->newRefraction, 0, ANIM_LINEAR);
+
+    bFadeRefraction = false;
+    this->refractionFader->replay();
+  }
+
+  if(bFadeWaterHeight)
+  {
+    this->waterHeightFader = new tAnimation<MappedWater>(this, &MappedWater::setWaterHeight);
+    this->waterHeightFader->setInfinity(ANIM_INF_CONSTANT);
+
+    this->waterHeightFader->addKeyFrame(this->waterHeight, this->waterHeightFadeTime, ANIM_LINEAR);
+    this->waterHeightFader->addKeyFrame(this->newWaterHeight, 0, ANIM_LINEAR);
+
+    bFadeWaterHeight = false;
+    this->waterHeightFader->replay();
+  }
+
+  if(bFadeWaterColor)
+  {
+    this->waterColorRFader = new tAnimation<MappedWater>(this, &MappedWater::resetWaterColorR);
+    this->waterColorRFader->setInfinity(ANIM_INF_CONSTANT);
+
+    this->waterColorRFader->addKeyFrame(this->waterColor.x, this->waterColorFadeTime, ANIM_LINEAR);
+    this->waterColorRFader->addKeyFrame(this->newWaterColor.x, 0, ANIM_LINEAR);
+
+    this->waterColorRFader->replay();
+
+    this->waterColorGFader = new tAnimation<MappedWater>(this, &MappedWater::resetWaterColorG);
+    this->waterColorGFader->setInfinity(ANIM_INF_CONSTANT);
+
+    this->waterColorGFader->addKeyFrame(this->waterColor.y, this->waterColorFadeTime, ANIM_LINEAR);
+    this->waterColorGFader->addKeyFrame(this->newWaterColor.y, 0, ANIM_LINEAR);
+
+    this->waterColorGFader->replay();
+
+    this->waterColorBFader = new tAnimation<MappedWater>(this, &MappedWater::resetWaterColorB);
+    this->waterColorBFader->setInfinity(ANIM_INF_CONSTANT);
+
+    this->waterColorBFader->addKeyFrame(this->waterColor.z, this->waterColorFadeTime, ANIM_LINEAR);
+    this->waterColorBFader->addKeyFrame(this->newWaterColor.z, 0, ANIM_LINEAR);
+
+    this->waterColorBFader->replay();
+
+    bFadeWaterColor = false;
+  }
 }
 
@@ -330,8 +738,8 @@
   Vector pos = State::getCameraNode()->getAbsCoor();
 
-  if(pos.y > waterPos.y)
+  if(pos.y > waterHeight)
   {
     // Translate the world, then flip it upside down
-    glTranslatef(0, waterPos.y*2, 0);
+    glTranslatef(0, waterHeight * 2, 0);
     glScalef(1, -1, 1);
 
@@ -340,5 +748,5 @@
 
     // Set our plane equation and turn clipping on
-    double plane[4] = {0, 1, 0, -waterPos.y};
+    double plane[4] = {0, 1, 0, -waterHeight};
     glClipPlane(GL_CLIP_PLANE0, plane);
   }
@@ -347,5 +755,5 @@
     // If the camera is below the water we don't want to flip the world,
     // but just render it clipped so only the top is drawn.
-    double plane[4] = {0, 1, 0, waterPos.y};
+    double plane[4] = {0, 1, 0, waterHeight};
     glClipPlane(GL_CLIP_PLANE0, plane);
   }
@@ -392,7 +800,7 @@
   glEnable(GL_CLIP_PLANE0);
   Vector pos = State::getCameraNode()->getAbsCoor();
-  if(pos.y > waterPos.y)
-  {
-    double plane[4] = {0, -1, 0, waterPos.y};
+  if(pos.y > waterHeight)
+  {
+    double plane[4] = {0, -1, 0, waterHeight};
     glClipPlane(GL_CLIP_PLANE0, plane);
   }
@@ -401,5 +809,5 @@
   {
     glCullFace(GL_FRONT);
-    double plane[4] = {0, 1, 0, -waterPos.y};
+    double plane[4] = {0, 1, 0, -waterHeight};
     glClipPlane(GL_CLIP_PLANE0, plane);
   }
Index: /trunk/src/world_entities/environments/mapped_water.h
===================================================================
--- /trunk/src/world_entities/environments/mapped_water.h	(revision 9005)
+++ /trunk/src/world_entities/environments/mapped_water.h	(revision 9006)
@@ -1,3 +1,3 @@
-/*!
+ /*!
  * @file mapped_water.h
  *  worldentity for flat, cool looking, mapped water
@@ -12,5 +12,8 @@
   <waterangle>0</waterangle>
   <normalmapscale>0.25</normalmapscale><!-- you won't see a big differnce if you change that -->
-  <shininess>128</shininess><!-- the bigger the value, the smaller the specular reflection point -->
+  <shinesize>128</shinesize><!-- the bigger the value, the smaller the specular reflection point -->
+  <shinestrength>0.7</shinestrength>
+  <reflstrength>1</reflstrength>
+  <refraction>0.009</refraction>
   <watercolor>0.1, 0.2, 0.4</watercolor>
 </MappedWater>
@@ -25,4 +28,8 @@
 #include "shader.h"
 
+namespace OrxGui { class GLGuiBox; };
+
+// forward declaration
+template <class T> class tAnimation;
 
 class MappedWater : public WorldEntity
@@ -32,6 +39,7 @@
   virtual ~MappedWater();
 
+  // worldentity functions
   void loadParams(const TiXmlElement* root);
-
+  void saveParams();
   void draw() const;
   void tick(float dt);
@@ -43,25 +51,51 @@
   void deactivateRefraction();
 
+  // slider gui to edit water params during gameplay
+  void openGui();
+  void closeGui();
+
   // functions to set parameters for the water, usually they're called through loadparam
-  void setLightPos(float x, float y, float z) { this->lightPos = Vector(x,y,z); };
-  void setWaterPos(float x, float y, float z) { this->waterPos = Vector(x,y,z); };
-  void setWaterSize(float x, float z) { this->xWidth = x; this->zWidth = z; };
-  void setWaterAngle(float angle) { this->waterAngle = angle; };
-  void setWaterUV(float uv) { this->waterUV = uv; };
-  void setWaterFlow(float flow) { this->waterFlow = flow; };
-  void setNormalMapScale(float scale) { this->kNormalMapScale = scale; };
-  void setShininess(float shine) { this->shininess = shine; };
-  void setWaterColor(float r, float g, float b) { this->waterColor = Vector(r,g,b); };
+  void setLightPos(float x, float y, float z) { this->lightPos = Vector(x,y,z); }
+  void setWaterPos(float x, float y, float z) { this->waterHeight = y; this->waterVerts[0] = x; this->waterVerts[1] = z; }
+  void setWaterHeight(float y) { this->waterHeight = y;  }
+  void setWaterSize(float x, float z) { this->xWidth = x; this->zWidth = z; }
+  void setWaterAngle(float angle) { this->waterAngle = angle; }
+  void setWaterColor(float r, float g, float b) { this->waterColor = Vector(r,g,b); }
+  void setWaterUV(float uv) { this->waterUV = uv; }
+  void setWaterFlow(float flow) { this->waterFlow = flow; }
+  void setNormalMapScale(float scale) { this->kNormalMapScale = scale; }
+  void setShineSize(float shine) { this->shineSize = shine; }
+  void setShineStrength(float strength) { this->shineStrength = strength; }
+  void setReflStrength(float strength) { this->reflStrength = strength; }
+  void setRefraction(float refraction) { this->refraction = refraction; }
 
   // functions to change water parameters during runtime
   // to reset waterUV and waterFlow just use the normal set functions
+  // don't reset kNormalMapScale (because it won't change anything)
+  void resetLightPos(float x, float y, float z);
+  void resetLightPosX(float x) { this->resetLightPos(x, this->lightPos.y, this->lightPos.z); }
+  void resetLightPosY(float y) { this->resetLightPos(this->lightPos.x, y, this->lightPos.z); }
+  void resetLightPosZ(float z) { this->resetLightPos(this->lightPos.x, this->lightPos.y, z); }
+  void resetWaterPos(float x, float y, float z) { this->setWaterPos(x, y, z); this->calcVerts(); }
+  void resetWaterSize(float x, float z) { this->setWaterSize(x, z); this->calcVerts(); }
+  void resetWaterAngle(float angle) { this->setWaterAngle(angle); this->calcVerts(); }
   void resetWaterColor(float r, float g, float b);
-  void resetShininess(float shine);
-  void resetLightPos(float x, float y, float z);
+  void resetWaterColorR(float r) { this->resetWaterColor(r, this->waterColor.y, this->waterColor.z); }
+  void resetWaterColorG(float g) { this->resetWaterColor(this->waterColor.x, g, this->waterColor.z); }
+  void resetWaterColorB(float b) { this->resetWaterColor(this->waterColor.x, this->waterColor.y, b); }
+  void resetShineSize(float shine);
+  void resetShineStrength(float strength);
+  void resetReflStrength(float strength);
+  void resetRefraction(float refraction);
 
-  // fade functions
-  void fadeWaterColor(float r, float g, float b, float time);
-  void fadeShininess(float shine, float time);
-  void fadeLightPos(float x, float y, float z, float time);
+  // fading functions
+  void fadeWaterUV(float uv, float time) { this->newWaterUV = uv; this->waterUVFadeTime = time; this->bFadeWaterUV = true; }
+  void fadeWaterFlow(float flow, float time) { this->newWaterFlow = flow; this->waterFlowFadeTime = time; this->bFadeWaterFlow = true; }
+  void fadeShineSize(float shine, float time) { this->newShineSize = shine; this->shineSizeFadeTime = time; this->bFadeShineSize = true; }
+  void fadeShineStrength(float strength, float time) { this->newShineStrength = strength; this->shineStrengthFadeTime = time; this->bFadeShineStrength = true; }
+  void fadeReflStrength(float strength, float time) { this->newReflStrength = strength; this->reflStrengthFadeTime = time; this->bFadeReflStrength = true; }
+  void fadeRefraction(float refraction, float time) { this->newRefraction = refraction; this->refractionFadeTime = time; this->bFadeRefraction = true; }
+  void fadeWaterHeight(float y, float time) { this->newWaterHeight = y; this->waterHeightFadeTime = time; this->bFadeWaterHeight = true; }
+  void fadeWaterColor(float r, float g, float b, float time) { this->newWaterColor = Vector(r, g, b); this->waterColorFadeTime = time; this->bFadeWaterColor = true; }
 
 private:
@@ -69,29 +103,78 @@
   void initTextures();
   void initShaders();
+  void calcVerts();
 
 private:
-  Vector              waterPos;               //!< position of the water
-  float               xWidth, zWidth;         //!< size of the water quad
-  Vector              lightPos;               //!< position of the light that is used to render the reflection
-  float               waterAngle;             //!< defines how much the water will be turned around the point waterPos
-  Vector              waterColor;             //!< color of the water
-  float               move;                   //!< textures coords, speeds, positions for the shaded textures....
-  float               move2;
-  float               waterUV;                //!< size of the waves
-  float               waterFlow;              //!< speed of the water
-  float               normalUV;
-  float               kNormalMapScale;
-  float               shininess;              //!< the bigger the value, the smaller the specular reflection point
+  Material                  mat;
+  Shader*                   shader;
+  OrxGui::GLGuiBox*         box;
 
-  int                 textureSize;            //!< height and width of the texture
-  Material            mat;
-  Shader*             shader;
-  Shader::Uniform*    cam_uni;                //!< uniform that is used for the camera position
-  Shader::Uniform*    light_uni;              //!< uniform that is used for the light position
-  Shader::Uniform*    color_uni;              //!< uniform that is used for the watercolor
-  Shader::Uniform*    shine_uni;              //!< uniform that is used for the specular shininessd of the water
-  
-  
-  int tempcounter;
+  // water size and position
+  float                     waterHeight;            //!< position of the water
+  float                     waterVerts[8];          //!< coords of the 4 vertexes of the water quad
+  float                     xWidth, zWidth;         //!< size of the water quad
+  float                     waterAngle;             //!< defines how much the water will be turned around the point waterPos
+
+  // values for texture size, scale, texture coords
+  float                     move;
+  float                     move2;
+  float                     waterUV;                //!< size of the waves
+  float                     waterFlow;              //!< speed of the water
+  float                     normalUV;
+  float                     kNormalMapScale;
+  int                       textureSize;            //!< height and width of the texture
+
+  // values for the uniforms
+  Vector                    waterColor;             //!< color of the water
+  Vector                    lightPos;               //!< position of the light that is used to render the reflection
+  float                     shineSize;              //!< the bigger the value, the smaller the specular reflection point
+  float                     shineStrength;
+  float                     reflStrength;
+  float                     refraction;
+
+  // uniforms
+  Shader::Uniform*          cam_uni;                //!< uniform that is used for the camera position
+  Shader::Uniform*          light_uni;              //!< uniform that is used for the light position
+  Shader::Uniform*          color_uni;              //!< uniform that is used for the watercolor
+  Shader::Uniform*          shineSize_uni;          //!< uniform that is used for the specular shininessd of the water
+  Shader::Uniform*          shineStrength_uni;      //!< uniform that is used for the strenght of the specular reflection
+  Shader::Uniform*          reflStrength_uni;       //!< uniform that is used for the strength of the reflection
+  Shader::Uniform*          refr_uni;               //!< uniform that is used for the strength of the refraction
+
+  // fading TODO fix this so it isnt so hacky anymore
+  tAnimation<MappedWater>*  waterUVFader;
+  float                     newWaterUV;
+  float                     waterUVFadeTime;
+  bool                      bFadeWaterUV ;
+  tAnimation<MappedWater>*  waterFlowFader;
+  float                     newWaterFlow;
+  float                     waterFlowFadeTime;
+  bool                      bFadeWaterFlow;
+  tAnimation<MappedWater>*  shineSizeFader;
+  float                     newShineSize;
+  float                     shineSizeFadeTime;
+  bool                      bFadeShineSize;
+  tAnimation<MappedWater>*  shineStrengthFader;
+  float                     newShineStrength;
+  float                     shineStrengthFadeTime;
+  bool                      bFadeShineStrength;
+  tAnimation<MappedWater>*  reflStrengthFader;
+  float                     newReflStrength;
+  float                     reflStrengthFadeTime;
+  bool                      bFadeReflStrength;
+  tAnimation<MappedWater>*  refractionFader;
+  float                     newRefraction;
+  float                     refractionFadeTime;
+  bool                      bFadeRefraction;
+  tAnimation<MappedWater>*  waterHeightFader;
+  float                     newWaterHeight;
+  float                     waterHeightFadeTime;
+  bool                      bFadeWaterHeight;
+  tAnimation<MappedWater>*  waterColorRFader;
+  tAnimation<MappedWater>*  waterColorGFader;
+  tAnimation<MappedWater>*  waterColorBFader;
+  Vector                    newWaterColor;
+  float                     waterColorFadeTime;
+  bool                      bFadeWaterColor;
 };
 
Index: /trunk/src/world_entities/script_trigger.cc
===================================================================
--- /trunk/src/world_entities/script_trigger.cc	(revision 9005)
+++ /trunk/src/world_entities/script_trigger.cc	(revision 9006)
@@ -14,4 +14,5 @@
 */
 
+
 #include "script_trigger.h"
 #include "class_list.h"
@@ -22,18 +23,8 @@
 
 CREATE_SCRIPTABLE_CLASS(ScriptTrigger, CL_SCRIPT_TRIGGER,
-                          //Position
-                     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))
-                     //Set values
-                    // ->addMethod("setTarget", ExecutorLua1<ScriptTrigger, std::string >(&ScriptTrigger::setTarget))
-                    // ->addMethod("setTriggerParent", ExecutorLua1<ScriptTrigger, std::string >(&ScriptTrigger::setTriggerParent))
-                     ->addMethod("setTriggerLasts", ExecutorLua1<ScriptTrigger, bool >(&ScriptTrigger::setTriggerLasts))
-                     ->addMethod("setInvert", ExecutorLua1<ScriptTrigger, bool >(&ScriptTrigger::setInvert))
-                     ->addMethod("setRadius", ExecutorLua1<ScriptTrigger, float >(&ScriptTrigger::setRadius))
-                     //->addMethod("setScript", ExecutorLua1<ScriptTrigger, std::string >(&ScriptTrigger::setScript))
-                     //->addMethod("setFunction", ExecutorLua1<ScriptTrigger, std::string >(&ScriptTrigger::setFunction))
-                     ->addMethod("setDebugDraw", ExecutorLua1<ScriptTrigger, bool >(&ScriptTrigger::setInvert))
+                            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))
                        );
 
@@ -61,10 +52,10 @@
   {
     
-  loadParams(root);
-  
-  if(addToScript && scriptIsOk)
-  {
-    script->addObject( "ScriptTrigger", this->getName());
-  }
+    loadParams(root);
+  
+    if(addToScript && scriptIsOk)
+    {
+      script->addObject( "ScriptTrigger", this->getName());
+    }
   
   }
@@ -88,36 +79,39 @@
 {
 
-    WorldEntity ::loadParams(root);
-
-    LoadParam(root, "file", this, ScriptTrigger, setScript)
-        .describe("the fileName of the script, that should be triggered by this script trigger")
-        .defaultValues("");
-    LoadParam(root, "function", this, ScriptTrigger, setFunction)
-        .describe("the function of the script, that should be triggered by this script trigger")
-        .defaultValues("");
-    LoadParam(root, "abs-coor", this, ScriptTrigger, setAbsCoor)
-        .describe("where this script trigger should be located")
-        .defaultValues("");
-    LoadParam(root, "radius", this, ScriptTrigger, setRadius)
-        .describe("the fileName of the script, that should be triggered by this script trigger")
-        .defaultValues(0);
-    LoadParam(root, "worldentity", this, ScriptTrigger, setTarget)
-        .describe("The name of the target as it is in the *.oxw file")
-        .defaultValues("");
-    LoadParam(root, "triggerparent", this, ScriptTrigger, setTriggerParent)
-        .describe("The name of the parent as it is in the *.oxw file")
-        .defaultValues("");
-    LoadParam(root, "invert", this, ScriptTrigger, setInvert)
-        .describe("")
-        .defaultValues("false");
-    LoadParam(root, "triggerlasts", this, ScriptTrigger, setTriggerLasts)
-        .describe("")
-        .defaultValues("true");
-    LoadParam(root, "debugdraw", this, ScriptTrigger, setDebugDraw)
-        .describe("")
-        .defaultValues("false");
-    LoadParam(root, "addtoscript", this, ScriptTrigger, setAddToScript)
-        .describe("True if this scripttrigger should be aviable in the script")
-        .defaultValues("false");
+  WorldEntity ::loadParams(root);
+
+  LoadParam(root, "file", this, ScriptTrigger, setScript)
+      .describe("the fileName of the script, that should be triggered by this script trigger")
+      .defaultValues("");
+  LoadParam(root, "function", this, ScriptTrigger, setFunction)
+      .describe("the function of the script, that should be triggered by this script trigger")
+      .defaultValues("");
+  LoadParam(root, "abs-coor", this, ScriptTrigger, setAbsCoor)
+      .describe("where this script trigger should be located")
+      .defaultValues("");
+  LoadParam(root, "radius", this, ScriptTrigger, setRadius)
+      .describe("the fileName of the script, that should be triggered by this script trigger")
+      .defaultValues(0);
+  LoadParam(root, "delay", this, ScriptTrigger, setDelay)
+      .describe("the delay after which the funtion sould be triggered")
+      .defaultValues(0);
+  LoadParam(root, "worldentity", this, ScriptTrigger, setTarget)
+      .describe("The name of the target as it is in the *.oxw file")
+      .defaultValues("");
+  LoadParam(root, "triggerparent", this, ScriptTrigger, setTriggerParent)
+      .describe("The name of the parent as it is in the *.oxw file")
+      .defaultValues("");
+  LoadParam(root, "invert", this, ScriptTrigger, setInvert)
+      .describe("")
+      .defaultValues("false");
+  LoadParam(root, "triggerlasts", this, ScriptTrigger, setTriggerLasts)
+      .describe("")
+      .defaultValues("true");
+  LoadParam(root, "debugdraw", this, ScriptTrigger, setDebugDraw)
+      .describe("")
+      .defaultValues("false");
+  LoadParam(root, "addtoscript", this, ScriptTrigger, setAddToScript)
+      .describe("True if this scripttrigger should be aviable in the script")
+      .defaultValues("false");
 }
 
@@ -171,14 +165,14 @@
   
   if( !invert && this->distance(target) < radius)
- {
+  {
     executeAction(timestep);
     scriptCalled = true;
   
- }
- else if( invert && this->distance(target) > radius)
- {
-     executeAction(timestep); 
-     scriptCalled = true;
- }
+  }
+  else if( invert && this->distance(target) > radius)
+  {
+    executeAction(timestep); 
+    scriptCalled = true;
+  }
  //else
    //printf("SCRIPTTRIGGER: target out of range\n");
@@ -190,17 +184,17 @@
 {
   
-     if(scriptIsOk)
-     {
+  if(scriptIsOk)
+  {
        //testScriptingFramework();
-     if(!(script->selectFunction(this->functionName,returnCount)) )
-       printf("Error ScriptTrigger: Selection of %s in %s failed.\n",functionName.c_str(), script->getFileName().c_str());
-     
-     script->pushParam( timestep, this->functionName);
-     
-     if( !(script->executeFunction()) )
-       printf("Error ScriptTrigger: Execution of %s in %s failed.\n",functionName.c_str(), script->getFileName().c_str());
-     
-     scriptFinished = script->getReturnedBool();
-     }
+    if(!(script->selectFunction(this->functionName,returnCount)) )
+      printf("Error ScriptTrigger: Selection of %s in %s failed.\n",functionName.c_str(), script->getFileName().c_str());
+     
+    script->pushParam( timestep, this->functionName);
+     
+    if( !(script->executeFunction()) )
+      printf("Error ScriptTrigger: Execution of %s in %s failed.\n",functionName.c_str(), script->getFileName().c_str());
+     
+    scriptFinished = script->getReturnedBool();
+  }
      
      
@@ -225,5 +219,5 @@
 /*
  void ScriptTrigger::testScriptingFramework()
- {
+{
    std::string file("lunartest2.lua");
    //get script
Index: /trunk/src/world_entities/script_trigger.h
===================================================================
--- /trunk/src/world_entities/script_trigger.h	(revision 9005)
+++ /trunk/src/world_entities/script_trigger.h	(revision 9006)
@@ -37,4 +37,5 @@
     void setTriggerLasts(const bool lasts) { this->triggerLasts = lasts; }
     void setInvert(const bool inv) { this->invert = invert; }
+    void setDelay(float delay) { this->delay = delay; };
     void setRadius(const float radius) { if(radius>0) this->radius = radius; }
     void setScript(const std::string& file);
Index: /trunk/src/world_entities/skydome.cc
===================================================================
--- /trunk/src/world_entities/skydome.cc	(revision 9005)
+++ /trunk/src/world_entities/skydome.cc	(revision 9006)
@@ -1,12 +1,12 @@
 /*
    orxonox - the future of 3D-vertical-scrollers
-
+ 
    Copyright (C) 2006 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
@@ -43,9 +43,11 @@
 {
   PRINTF(0)("Skydome init\n");
-  
+
   this->setClassID(CL_SKYDOME, "Skydome");
   this->toList(OM_BACKGROUND);
-  this->toReflectionList(); 
+  this->toReflectionList();
   
+  activateDome = false;
+
 }
 
@@ -57,5 +59,5 @@
 {
   PRINTF(0)("Deleting Skydome\n");
-  
+
   if (glIsTexture(texture))
     glDeleteTextures(1, &texture);
@@ -74,6 +76,20 @@
 
 
+void Skydome::activate()
+{
+  this->activateDome = true;
+}
+
+void Skydome::deactivate()
+{
+  this->activateDome = false;
+}
+
+
 void Skydome::draw() const
 {
+  if(!activateDome)
+    return;
+  
   glPushAttrib(GL_ENABLE_BIT);
 
@@ -88,5 +104,5 @@
   glPushMatrix();
   glTranslatef(0.0f,pRadius,0.0f);
-  
+
 
   glBegin(GL_TRIANGLES);
@@ -113,7 +129,7 @@
 {
   PRINTF(0)("Generating a sky plane");
-  
+
   // Make sure our vertex array is clear
-  if (planeVertices) 
+  if (planeVertices)
   {
     delete planeVertices;
@@ -130,9 +146,9 @@
   // Set the number of divisions into a valid range
   int divs = divisions;
-  if (divisions < 1) 
+  if (divisions < 1)
     divs = 1;
 
-  if (divisions > 256) 
-    divs = 256; 
+  if (divisions > 256)
+    divs = 256;
 
   pRadius = planetRadius;
@@ -152,5 +168,5 @@
   float delta = plane_size/(float)divs;
   float tex_delta = 2.0f/(float)divs;
-  
+
   // Variables we'll use during the dome's generation
   float x_dist   = 0.0f;
@@ -193,5 +209,5 @@
       int startvert = (i*(divs+1) + j);
 
-        // tri 1
+      // tri 1
       indices[index++] = startvert;
       indices[index++] = startvert+1;
@@ -203,4 +219,4 @@
       indices[index++] = startvert+divs+1;
     }
-  }  
-}
+  }
+}
Index: /trunk/src/world_entities/skydome.h
===================================================================
--- /trunk/src/world_entities/skydome.h	(revision 9005)
+++ /trunk/src/world_entities/skydome.h	(revision 9006)
@@ -34,4 +34,7 @@
   void setShader(Shader* shader);
   void setTexture(GLuint texture);
+  
+  void activate();
+  void deactivate();
 
 private:
@@ -44,4 +47,5 @@
   };
 
+  bool activateDome;
   
   VertexInfo *planeVertices;
