Index: trunk/src/world_entities/environments/mapped_water.cc
===================================================================
--- trunk/src/world_entities/environments/mapped_water.cc	(revision 9406)
+++ trunk/src/world_entities/environments/mapped_water.cc	(revision 9869)
@@ -17,5 +17,4 @@
 #include "util/loading/load_param.h"
 #include "util/loading/factory.h"
-#include "util/loading/resource_manager.h"
 #include "state.h"
 #include "t_animation.h"
@@ -25,18 +24,22 @@
 #include "script_class.h"
 
-CREATE_FACTORY(MappedWater, CL_MAPPED_WATER);
+#include "resource_shader.h"
+
+#include "class_id_DEPRECATED.h"
+ObjectListDefinitionID(MappedWater, CL_MAPPED_WATER);
+CREATE_FACTORY(MappedWater);
 
 SHELL_COMMAND(gui, MappedWater, toggleGui);
 SHELL_COMMAND(output, MappedWater, saveParams);
 
-CREATE_SCRIPTABLE_CLASS(MappedWater, CL_MAPPED_WATER,
-                        addMethod("waterUV", ExecutorLua2<MappedWater, float, float>(&MappedWater::fadeWaterUV))
-                      ->addMethod("waterFlow", ExecutorLua2<MappedWater, float, float>(&MappedWater::fadeWaterFlow))
-                      ->addMethod("shineSize", ExecutorLua2<MappedWater, float, float>(&MappedWater::fadeShineSize))
-                      ->addMethod("shineStrength", ExecutorLua2<MappedWater, float, float>(&MappedWater::fadeShineStrength))
-                      ->addMethod("reflStrength", ExecutorLua2<MappedWater, float, float>(&MappedWater::fadeReflStrength))
-                      ->addMethod("refraction", ExecutorLua2<MappedWater, float, float>(&MappedWater::fadeRefraction))
-                      ->addMethod("waterHeight", ExecutorLua2<MappedWater, float, float>(&MappedWater::fadeWaterHeight))
-                      ->addMethod("waterColor", ExecutorLua4<MappedWater, float, float, float, float>(&MappedWater::fadeWaterColor)));
+CREATE_SCRIPTABLE_CLASS(MappedWater,
+                        addMethod("waterUV", Executor2<MappedWater, lua_State*, float, float>(&MappedWater::fadeWaterUV))
+                        ->addMethod("waterFlow", Executor2<MappedWater, lua_State*, float, float>(&MappedWater::fadeWaterFlow))
+                        ->addMethod("shineSize", Executor2<MappedWater, lua_State*, float, float>(&MappedWater::fadeShineSize))
+                        ->addMethod("shineStrength", Executor2<MappedWater, lua_State*, float, float>(&MappedWater::fadeShineStrength))
+                        ->addMethod("reflStrength", Executor2<MappedWater, lua_State*, float, float>(&MappedWater::fadeReflStrength))
+                        ->addMethod("refraction", Executor2<MappedWater, lua_State*, float, float>(&MappedWater::fadeRefraction))
+                        ->addMethod("waterHeight", Executor2<MappedWater, lua_State*, float, float>(&MappedWater::fadeWaterHeight))
+                        ->addMethod("waterColor", Executor4<MappedWater, lua_State*, float, float, float, float>(&MappedWater::fadeWaterColor)));
 
 
@@ -47,5 +50,5 @@
 MappedWater::MappedWater(const TiXmlElement* root)
 {
-  this->setClassID(CL_MAPPED_WATER, "MappedWater");
+  this->registerObject(this, MappedWater::_objectList);
   this->toList(OM_ENVIRON);
 
@@ -75,5 +78,4 @@
 MappedWater::~MappedWater()
 {
-  delete shader;
   delete cam_uni;
   delete color_uni;
@@ -163,7 +165,7 @@
 {
   // load shader files
-  shader = new Shader( ResourceManager::getInstance()->getDataDir() + "/shaders/mapped_water.vert", ResourceManager::getInstance()->getDataDir() +"/shaders/mapped_water.frag");
-
-  this->shader->activateShader();
+  shader = ResourceShader( "/shaders/mapped_water.vert", "/shaders/mapped_water.frag");
+
+  this->shader.activateShader();
   // Set the variable "reflection" to correspond to the first texture unit
   Shader::Uniform(shader, "reflection").set(0);
@@ -197,5 +199,5 @@
   cam_uni = new Shader::Uniform(shader, "cameraPos");
 
-  this->shader->deactivateShader();
+  this->shader.deactivateShader();
 }
 
@@ -223,5 +225,5 @@
 void MappedWater::resetWaterColor(float r, float g, float b)
 {
-  this->shader->activateShader();
+  this->shader.activateShader();
   this->waterColor = Vector(r, g, b);
 
@@ -229,5 +231,5 @@
   color_uni->set(waterColor.x, waterColor.y, waterColor.z, 1.0f);
 
-  this->shader->deactivateShader();
+  this->shader.deactivateShader();
 }
 
@@ -238,5 +240,5 @@
 void MappedWater::resetShineSize(float shine)
 {
-  this->shader->activateShader();
+  this->shader.activateShader();
   this->shineSize = shine;
 
@@ -244,5 +246,5 @@
   shineSize_uni->set(this->shineSize);
 
-  this->shader->deactivateShader();
+  this->shader.deactivateShader();
 }
 
@@ -253,5 +255,5 @@
 void MappedWater::resetShineStrength(float strength)
 {
-  this->shader->activateShader();
+  this->shader.activateShader();
   this->shineStrength = strength;
 
@@ -259,5 +261,5 @@
   shineStrength_uni->set(this->shineStrength);
 
-  this->shader->deactivateShader();
+  this->shader.deactivateShader();
 }
 
@@ -268,5 +270,5 @@
 void MappedWater::resetReflStrength(float strength)
 {
-  this->shader->activateShader();
+  this->shader.activateShader();
   this->reflStrength = strength;
 
@@ -274,5 +276,5 @@
   reflStrength_uni->set(this->reflStrength);
 
-  this->shader->deactivateShader();
+  this->shader.deactivateShader();
 }
 
@@ -283,5 +285,5 @@
 void MappedWater::resetRefraction(float refraction)
 {
-  this->shader->activateShader();
+  this->shader.activateShader();
   this->refraction = refraction;
 
@@ -289,5 +291,5 @@
   refr_uni->set(this->refraction);
 
-  this->shader->deactivateShader();
+  this->shader.deactivateShader();
 }
 
@@ -300,5 +302,5 @@
 void MappedWater::resetLightPos(float x, float y, float z)
 {
-  this->shader->activateShader();
+  this->shader.activateShader();
   this->lightPos = Vector(x, y, z);
 
@@ -306,5 +308,5 @@
   light_uni->set(lightPos.x, lightPos.y, lightPos.z, 1.0f);
 
-  this->shader->deactivateShader();
+  this->shader.deactivateShader();
 }
 
@@ -554,5 +556,5 @@
   mat.select();
 
-  this->shader->activateShader();
+  this->shader.activateShader();
 
   // reset the camera uniform to the current cam position
@@ -593,5 +595,5 @@
   glEnd();
 
-  this->shader->deactivateShader();
+  this->shader.deactivateShader();
 
   mat.unselect();
