Index: orxonox/branches/physics/src/class_list.h
===================================================================
--- orxonox/branches/physics/src/class_list.h	(revision 4301)
+++ orxonox/branches/physics/src/class_list.h	(revision 4301)
@@ -0,0 +1,18 @@
+/*! 
+    \file class_list.h
+    \brief list of orxonox classes
+
+    this is used by the ObjectManager to identify and load important classes
+*/
+
+
+//! list of all classes to be loadable in via the ObjectManager
+typedef enum classList 
+{
+  CL_PROJECTILE,
+  CL_TEST_BULLET,
+
+  CL_NUMBER
+};
+  
+
Index: orxonox/branches/physics/src/defs/debug.h
===================================================================
--- orxonox/branches/physics/src/defs/debug.h	(revision 4300)
+++ orxonox/branches/physics/src/defs/debug.h	(revision 4301)
@@ -56,21 +56,22 @@
 // DEFINE MODULES
 #define DEBUG_MODULE_ORXONOX            0
-#define DEBUG_MODULE_WORLD              1
-#define DEBUG_MODULE_PNODE              1
+#define DEBUG_MODULE_WORLD              0
+#define DEBUG_MODULE_PNODE              0
 #define DEBUG_MODULE_WORLD_ENTITY       0
-#define DEBUG_MODULE_COMMAND_NODE       4
+#define DEBUG_MODULE_COMMAND_NODE       0
 #define DEBUG_MODULE_GRAPHICS           0
 #define DEBUG_MODULE_LOAD               2
 
-#define DEBUG_MODULE_IMPORTER           3
+#define DEBUG_MODULE_IMPORTER           0
 #define DEBUG_MODULE_TRACK_MANAGER      0
 #define DEBUG_MODULE_GARBAGE_COLLECTOR  0
+#define DEBUG_MODULE_OBJECT_MANAGER     3
 #define DEBUG_MODULE_LIGHT              0
 #define DEBUG_MODULE_PLAYER             1
-#define DEBUG_MODULE_WEAPON             3
+#define DEBUG_MODULE_WEAPON             0
 #define DEBUG_MODULE_MATH               0
 #define DEBUG_MODULE_FONT               1
 #define DEBUG_MODULE_ANIM               1
-#define DEBUG_MODULE_PARTICLE           4
+#define DEBUG_MODULE_PARTICLE           1
 
 #define DEBUG_MODULE_NULL_PARENT        0
Index: orxonox/branches/physics/src/lib/graphics/importer/md2Model.cc
===================================================================
--- orxonox/branches/physics/src/lib/graphics/importer/md2Model.cc	(revision 4300)
+++ orxonox/branches/physics/src/lib/graphics/importer/md2Model.cc	(revision 4301)
@@ -68,7 +68,9 @@
 
 /********************************************************************************
- *   MD2Model                                                                   *
- ********************************************************************************/
-
+ *   MD2Model                                                                   * ********************************************************************************/
+
+/*
+  \brief simple constructor initializing all variables
+*/
 MD2Model::MD2Model()
 {
@@ -80,5 +82,9 @@
 }
 
-
+/*
+  \brief simple destructor, dereferencing all variables
+
+  this is where the ressource manager is cleaning the stuff
+*/
 MD2Model::~MD2Model()
 {
@@ -86,5 +92,9 @@
 }
 
-
+/*
+  \brief load model
+  \param name of the model file
+  \return true if everything worked out smoothly
+*/
 bool MD2Model::loadModel(const char* fileName)
 {
@@ -93,4 +103,9 @@
 
 
+/*
+  \brief load the skin as a material
+  \param name of the texture file
+  \return true if ok
+*/
 bool MD2Model::loadSkin(const char* fileName)
 {
@@ -122,4 +137,10 @@
 
 
+/*
+  \brief sets the animation type
+  \param animation type
+
+  the animation types can be looked up in the animationType table
+*/
 void MD2Model::setAnim(int type)
 {
@@ -140,4 +161,8 @@
 
 
+/*
+  \brief sets the time in seconds passed since the last tick
+  \param time in sec
+*/
 void MD2Model::tick(float time)
 {
@@ -146,4 +171,7 @@
 
 
+/*
+  \brief draws the model: interface for all other classes out in the world
+*/
 void MD2Model::draw()
 {
@@ -159,4 +187,7 @@
 
 
+/*
+  \brief this is an internal function to render this special frame selected by animate()
+*/
 void MD2Model::renderFrame()
 {
@@ -200,4 +231,9 @@
 
 
+/*
+  \brief animates the current model
+
+  depending on the time passed (tick function), the player will select another model
+*/
 void MD2Model::animate()
 {
@@ -222,5 +258,9 @@
 
 
-/* hhmmm... id used a very different way to do lightning... */
+/*
+  \brief this is how id is precessing their lightning
+
+  the details of how the whole lighting process is beeing handled - i have no idea... :)
+*/
 void MD2Model::processLighting()
 {
@@ -228,5 +268,7 @@
 }
 
-
+/*
+  \brief prints out debug informations
+*/
 void MD2Model::debug()
 {
@@ -246,5 +288,7 @@
  ********************************************************************************/
 
-
+/*
+  \brief simple constructor
+*/
 MD2Data::MD2Data()
 {
@@ -261,4 +305,9 @@
 
 
+/*
+  \brief simple destructor
+
+  this will clean out all the necessary data for a specific md2model
+*/
 MD2Data::~MD2Data()
 {
@@ -270,4 +319,9 @@
 
 
+/*
+  \brief this will load the whole model data (vertices, opengl command list, ...)
+  \param name to the model file
+  \return true if success
+*/
 bool MD2Data::loadModel(const char* fileName)
 {
@@ -335,4 +389,9 @@
 
 
+/*
+  \brief loads the skin/material stuff
+  \param name of the skin file
+  \return true if success
+*/
 bool MD2Data::loadSkin(const char* fileName)
 {
Index: orxonox/branches/physics/src/orxonox.cc
===================================================================
--- orxonox/branches/physics/src/orxonox.cc	(revision 4300)
+++ orxonox/branches/physics/src/orxonox.cc	(revision 4301)
@@ -35,4 +35,5 @@
 #include "graphics_engine.h"
 #include "resource_manager.h"
+#include "object_manager.h"
 #include "text_engine.h"
 #include "factory.h"
@@ -56,4 +57,6 @@
   this->world = NULL;
   this->localinput = NULL;
+  this->resourceManager = NULL;
+  this->objectManager = NULL;
 
   this->argc = 0;
@@ -72,4 +75,5 @@
   delete GraphicsEngine::getInstance(); // deleting the Graphics
   delete ResourceManager::getInstance(); // deletes the Resource Manager
+  delete ObjectManager::getInstance();
   delete TextEngine::getInstance();
 }
@@ -225,4 +229,7 @@
   TextEngine::getInstance();
 
+  PRINT(3)("initializing ObjectManager\n");
+  this->objectManager = ObjectManager::getInstance();
+
   return 0;
 }
Index: orxonox/branches/physics/src/orxonox.h
===================================================================
--- orxonox/branches/physics/src/orxonox.h	(revision 4300)
+++ orxonox/branches/physics/src/orxonox.h	(revision 4301)
@@ -16,4 +16,5 @@
 class GameLoader;
 class ResourceManager;
+class ObjectManager;
 
 //! Orxonox core singleton class
@@ -32,4 +33,5 @@
   GameLoader* gameLoader;     //!< The gameLoader
   ResourceManager* resourceManager; //!< The ResourceManager
+  ObjectManager* objectManager; //!< the object manager of the game
   
   bool bQuitOrxonox;          //!< If Orxonox should Quit
Index: orxonox/branches/physics/src/story_entities/world.cc
===================================================================
--- orxonox/branches/physics/src/story_entities/world.cc	(revision 4300)
+++ orxonox/branches/physics/src/story_entities/world.cc	(revision 4301)
@@ -42,4 +42,5 @@
 #include "track_manager.h"
 #include "garbage_collector.h"
+#include "object_manager.h"
 #include "animation_player.h"
 #include "particle_engine.h"
@@ -58,4 +59,6 @@
 
 #include "factory.h"
+
+#include "projectile.h"
 
 using namespace std;
Index: orxonox/branches/physics/src/util/garbage_collector.cc
===================================================================
--- orxonox/branches/physics/src/util/garbage_collector.cc	(revision 4300)
+++ orxonox/branches/physics/src/util/garbage_collector.cc	(revision 4301)
@@ -25,4 +25,5 @@
 
 #include "list.h"
+#include "object_manager.h"
 
 using namespace std;
@@ -137,5 +138,7 @@
 	  entity->remove();
 	  /* then finaly delete reference */
-	  delete entity;
+	  //delete entity;
+	  ObjectManager::getInstance()->addToDeadList(CL_TEST_BULLET, entity);
+	  ObjectManager::getInstance()->debug();
 	}
       entity = iterator->nextElement();
Index: orxonox/branches/physics/src/util/loading/load_param.cc
===================================================================
--- orxonox/branches/physics/src/util/loading/load_param.cc	(revision 4300)
+++ orxonox/branches/physics/src/util/loading/load_param.cc	(revision 4301)
@@ -10,5 +10,5 @@
 
    ### File Specific:
-   main-programmer: Christian Meyer
+   main-programmer: Benjamin Grauer
    co-programmer: ...
 */
@@ -27,6 +27,8 @@
    \param ... the parameter information
 */
-BaseLoadParam::BaseLoadParam(BaseObject* object, const char* paramName, int paramCount, ...)
-{
+BaseLoadParam::BaseLoadParam(const TiXmlElement* root, BaseObject* object, const char* paramName, int paramCount, ...)
+{
+  this->loadString = grabParameter(root, paramName);
+
   this->paramDesc = NULL;
   if (LoadClassDescription::parametersDescription)
@@ -47,5 +49,5 @@
 	  strcpy(this->paramDesc->types[i], tmpTypeName);
 	}
-      va_end(types);  
+      va_end(types);
 
       int argCount = 0;
Index: orxonox/branches/physics/src/util/loading/load_param.h
===================================================================
--- orxonox/branches/physics/src/util/loading/load_param.h	(revision 4300)
+++ orxonox/branches/physics/src/util/loading/load_param.h	(revision 4301)
@@ -65,7 +65,6 @@
 #define LoadParam1(type1) \
  LoadParam(const TiXmlElement* root, const char* paramName, T* pt2Object, void(T::*function)(type1##_TYPE)) \
-  : BaseLoadParam(pt2Object, paramName, 1, type1##_NAME) \
-    { \
-      const char* loadString = grabParameter(root, paramName); \
+   : BaseLoadParam(root, pt2Object, paramName, 1, type1##_NAME)		\
+    { \
       if (loadString != NULL && root != NULL) \
 	(*pt2Object.*function)(type1##_FUNC(loadString)); \
@@ -78,7 +77,6 @@
 #define LoadParam2(type1, type2) \
  LoadParam(const TiXmlElement* root, const char* paramName, T* pt2Object, void(T::*function)(type1##_TYPE, type2##_TYPE)) \
-  : BaseLoadParam(pt2Object, paramName, 2, type1##_NAME, type2##_NAME) \
-    { \
-      const char* loadString = grabParameter(root, paramName); \
+   : BaseLoadParam(root, pt2Object, paramName, 2, type1##_NAME, type2##_NAME) \
+    { \
       if (loadString != NULL && root != NULL) \
 	{ \
@@ -98,7 +96,6 @@
 #define LoadParam3(type1, type2, type3) \
  LoadParam(const TiXmlElement* root, const char* paramName, T* pt2Object, void(T::*function)(type1##_TYPE, type2##_TYPE, type3##_TYPE))\
-  : BaseLoadParam(pt2Object, paramName, 3, type1##_NAME, type2##_NAME, type3##_NAME) \
-    { \
-      const char* loadString = grabParameter(root, paramName); \
+   : BaseLoadParam(root, pt2Object, paramName, 3, type1##_NAME, type2##_NAME, type3##_NAME) \
+    { \
       if (loadString != NULL && root != NULL) \
 	{ \
@@ -118,7 +115,6 @@
 #define LoadParam4(type1, type2, type3, type4) \
  LoadParam(const TiXmlElement* root, const char* paramName, T* pt2Object, void(T::*function)(type1##_TYPE, type2##_TYPE, type3##_TYPE, type4##_TYPE)) \
-  : BaseLoadParam(pt2Object, paramName, 4, type1##_NAME, type2##_NAME, type3##_NAME, type2##_NAME, type4##_NAME) \
-    { \
-      const char* loadString = grabParameter(root, paramName); \
+   : BaseLoadParam(root, pt2Object, paramName, 4, type1##_NAME, type2##_NAME, type3##_NAME, type2##_NAME, type4##_NAME) \
+    { \
       if (loadString != NULL && root != NULL) \
 	{ \
@@ -138,7 +134,6 @@
 #define LoadParam5(type1, type2, type3, type4, type5) \
  LoadParam(const TiXmlElement* root, const char* paramName, T* pt2Object, void(T::*function)(type1##_TYPE, type2##_TYPE, type3##_TYPE, type4##_TYPE, type5##_TYPE)) \
-  : BaseLoadParam(pt2Object, paramName, 5, type1##_NAME, type2##_NAME, type3##_NAME, type2##_NAME, type4##_NAME, type5##_NAME) \
-    { \
-      const char* loadString = grabParameter(root, paramName); \
+   : BaseLoadParam(root, pt2Object, paramName, 5, type1##_NAME, type2##_NAME, type3##_NAME, type2##_NAME, type4##_NAME, type5##_NAME) \
+    { \
       if (loadString != NULL && root != NULL) \
 	{ \
@@ -202,9 +197,10 @@
 
  protected:
-  BaseLoadParam(BaseObject* object, const char* paramName, int paramCount, ...);
+  BaseLoadParam(const TiXmlElement* root, BaseObject* object, const char* paramName, int paramCount, ...);
 
  protected:
   LoadClassDescription* classDesc;               //!< The LoadClassDescription of this LoadParameter
   LoadParamDescription* paramDesc;               //!< The LoadParameterDescription of this LoadParameter
+  const char* loadString;                        //!< The string loaded by this LoadParam
 };
 
Index: orxonox/branches/physics/src/util/object_manager.cc
===================================================================
--- orxonox/branches/physics/src/util/object_manager.cc	(revision 4300)
+++ orxonox/branches/physics/src/util/object_manager.cc	(revision 4301)
@@ -11,5 +11,4 @@
    ### File Specific:
    main-programmer: Patrick Boenzli
-   co-programmer: ...
 */
 
@@ -17,4 +16,7 @@
 
 #include "object_manager.h"
+#include "garbage_collector.h"
+#include "list.h"
+
 
 using namespace std;
@@ -26,6 +28,10 @@
 ObjectManager::ObjectManager () 
 {
-   this->setClassName ("ObjectManager");
+  this->setClassName ("ObjectManager");
+  
+  //this->managedObjectList = new BaseObject*[CL_NUMBER];
+  this->managedObjectList = new tList<BaseObject>*[CL_NUMBER];
 
+  this->garbageCollector = GarbageCollector::getInstance();
 }
 
@@ -45,4 +51,5 @@
 }
 
+
 /**
    \brief standard deconstructor
@@ -52,4 +59,52 @@
 {
   ObjectManager::singletonRef = NULL;
+}
 
+
+void ObjectManager::cache(classList index, int number, const BaseObject &copyObject)
+{
+  //this->managedObjectList[index] = new BaseObject[number];
+  this->managedObjectList[index] = new tList<BaseObject>();
+  for(int i = 0; i < number; ++i)
+    {
+      this->managedObjectList[index]->add(new BaseObject(copyObject));
+    }
 }
+
+
+void ObjectManager::addToDeadList(classList index, BaseObject* object)
+{
+  if( likely(this->managedObjectList[index] != NULL))
+    this->managedObjectList[index]->add(object);
+  else
+    PRINTF(0)(" Error: unable to add object to the list nr. %i: no list initialized - ignoring\n", index);
+}
+
+
+BaseObject* ObjectManager::getFromDeadList(classList index, int number)
+{
+  if( likely(this->managedObjectList[index] != NULL))
+    {
+      BaseObject* obj = this->managedObjectList[index]->firstElement();
+      this->managedObjectList[index]->remove(obj);
+      return obj;
+    }
+  else
+    PRINTF(0)(" Error: unable to get object from the list nr. %i: no elements initialized - ignoring\n", index);
+}
+
+
+void ObjectManager::debug()
+{
+  PRINT(0)("\n==========================| ObjectManager::debug() |===\n");
+  PRINT(0)("=  Number of registerable classes: %i\n", CL_NUMBER );  
+  PRINT(0)("=  Currently cached objects: \n");
+  for(int i = 0; i < CL_NUMBER; ++i)
+    {
+      if(this->managedObjectList[i] != NULL)
+	PRINT(0)("=   o Class Nr. %i has cached %i object(s)\n", i, this->managedObjectList[i]->getSize());
+      else
+	PRINT(0)("=   o Class Nr. %i has cached 0 object(s)\n", i);
+    }
+  PRINT(0)("=======================================================\n");
+}
Index: orxonox/branches/physics/src/util/object_manager.h
===================================================================
--- orxonox/branches/physics/src/util/object_manager.h	(revision 4300)
+++ orxonox/branches/physics/src/util/object_manager.h	(revision 4301)
@@ -18,8 +18,13 @@
 #define OM_
 
+#include "class_list.h"
+
+
 class WorldEntity;
+class GarbageCollector;
 
 
 template<class T> class tList; 
+template<class T> class ManagedObject;
 
 //! the object manager itself
@@ -29,6 +34,10 @@
   static ObjectManager* getInstance(void);
   virtual ~ObjectManager(void);
+  
+  void cache(classList index, int number, const BaseObject &copyObject);
+  void addToDeadList(classList index, BaseObject* object);
+  BaseObject* getFromDeadList(classList index, int number = 1);
 
-  void preLoad();
+  void debug();
 
  private:
@@ -36,8 +45,10 @@
   static ObjectManager* singletonRef;
 
-  tList<WorldEntity>* projectileBuffer;            //!< a list of projectiles that is generated at the beginning to make orx faster
+  //BaseObject** managedObjectList;
+  tList<BaseObject>** managedObjectList;
+  GarbageCollector* garbageCollector;
+};
 
 
-};
 
 #endif /* _OBJECT_MANAGER_H */
Index: orxonox/branches/physics/src/world_entities/player.cc
===================================================================
--- orxonox/branches/physics/src/world_entities/player.cc	(revision 4300)
+++ orxonox/branches/physics/src/world_entities/player.cc	(revision 4301)
@@ -27,4 +27,7 @@
 #include "list.h"
 #include "stdincl.h"
+
+#include "object_manager.h"
+#include "projectile.h"
 
 using namespace std;
@@ -59,5 +62,4 @@
   this->weaponMan->addWeapon(wpRight, W_CONFIG2);
   this->weaponMan->addWeapon(wpLeft, W_CONFIG2);
-
 }
 
Index: orxonox/branches/physics/src/world_entities/test_gun.cc
===================================================================
--- orxonox/branches/physics/src/world_entities/test_gun.cc	(revision 4300)
+++ orxonox/branches/physics/src/world_entities/test_gun.cc	(revision 4301)
@@ -31,4 +31,6 @@
 #include "list.h"
 #include "animation3d.h"
+
+#include "object_manager.h"
 
 using namespace std;
@@ -87,4 +89,7 @@
     }
 
+  BaseObject* p = new TestBullet(this);
+  ObjectManager::getInstance()->cache(CL_TEST_BULLET, 100, *p);
+  ObjectManager::getInstance()->debug();
 }
 
