Index: trunk/src/Makefile.am
===================================================================
--- trunk/src/Makefile.am	(revision 6100)
+++ trunk/src/Makefile.am	(revision 6113)
@@ -81,4 +81,6 @@
                   world_entities/power_ups/turret_power_up.cc \
                   world_entities/power_ups/laser_power_up.cc \
+                  world_entities/power_ups/weapon_power_up.cc \
+                  world_entities/power_ups/param_power_up.cc \
                   world_entities/space_ships/space_ship.cc \
                   world_entities/space_ships/helicopter.cc \
@@ -94,4 +96,5 @@
                  world_entities/world_entity.h \
                  world_entities/camera.h \
+                 world_entities/extendable.h \
                  world_entities/playable.h \
                  world_entities/player.h \
@@ -123,4 +126,6 @@
                  world_entities/power_ups/turret_power_up.h \
                  world_entities/power_ups/laser_power_up.h \
+                 world_entities/power_ups/param_power_up.h \
+                 world_entities/power_ups/weapon_power_up.h \
                  world_entities/space_ships/space_ship.h \
                  world_entities/space_ships/helicopter.h \
Index: trunk/src/defs/class_id.h
===================================================================
--- trunk/src/defs/class_id.h	(revision 6100)
+++ trunk/src/defs/class_id.h	(revision 6113)
@@ -87,4 +87,5 @@
   CL_WEAPON                     =    0x00210000,
   CL_POWER_UP                   =    0x00220000,
+  CL_EXTENDABLE                  =    0x00220000,
 
   // SUPER-Modeling
@@ -149,4 +150,6 @@
   CL_TURRET_POWER_UP            =    0x00000211,
   CL_LASER_POWER_UP             =    0x00000212,
+  CL_WEAPON_POWER_UP            =    0x00000213,
+  CL_PARAM_POWER_UP             =    0x00000214,
 
   CL_TEST_GUN                   =    0x00000230,
Index: trunk/src/world_entities/extendable.h
===================================================================
--- trunk/src/world_entities/extendable.h	(revision 6113)
+++ trunk/src/world_entities/extendable.h	(revision 6113)
@@ -0,0 +1,28 @@
+/*!
+ * @file proto_class.h
+ * @brief Interface for Worldentities that can picku up powerups.
+*/
+
+#ifndef _EXTENDABLE_H
+#define _EXTENDABLE_H
+
+#include "base_object.h"
+
+// FORWARD DECLARATION
+class PowerUp;
+
+#include "power_ups/power_up.h"
+
+//! A class for ...
+class Extendable : virtual public BaseObject {
+
+ public:
+//   Extendable();
+//   virtual ~Extendable();
+   virtual bool pickup(PowerUp* powerUp) { return false; };
+
+ private:
+
+};
+
+#endif /* _EXTENDABLE_H */
Index: trunk/src/world_entities/power_ups/laser_power_up.cc
===================================================================
--- trunk/src/world_entities/power_ups/laser_power_up.cc	(revision 6100)
+++ trunk/src/world_entities/power_ups/laser_power_up.cc	(revision 6113)
@@ -27,10 +27,10 @@
 CREATE_FACTORY(LaserPowerUp, CL_LASER_POWER_UP);
 
-LaserPowerUp::LaserPowerUp ()
+LaserPowerUp::LaserPowerUp () : PowerUp(0.0, 1.0, 0.0)
 {
   this->init();
 }
 
-LaserPowerUp::LaserPowerUp(const TiXmlElement* root)
+LaserPowerUp::LaserPowerUp(const TiXmlElement* root) : PowerUp(0.0, 1.0, 0.0)
 {
   this->init();
Index: trunk/src/world_entities/power_ups/param_power_up.cc
===================================================================
--- trunk/src/world_entities/power_ups/param_power_up.cc	(revision 6113)
+++ trunk/src/world_entities/power_ups/param_power_up.cc	(revision 6113)
@@ -0,0 +1,118 @@
+/*
+   orxonox - the future of 3D-vertical-scrollers
+
+   Copyright (C) 2004 orx
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+   ### File Specific:
+   main-programmer: Benjamin Grauer
+   co-programmer: ...
+*/
+
+#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_WORLD_ENTITY
+
+#include "param_power_up.h"
+#include "factory.h"
+#include "state.h"
+#include "list.h"
+
+#include "primitive_model.h"
+
+#include "factory.h"
+#include "load_param.h"
+
+using namespace std;
+
+CREATE_FACTORY(ParamPowerUp, CL_PARAM_POWER_UP);
+
+const char* ParamPowerUp::paramTypes[] = {
+  "shield"
+};
+
+ParamPowerUp::ParamPowerUp () : PowerUp(0.0, 1.0, 0.0)
+{
+  this->init();
+}
+
+ParamPowerUp::ParamPowerUp(const TiXmlElement* root) : PowerUp(0.0, 1.0, 0.0)
+{
+  this->init();
+  this->loadParams(root);
+}
+
+
+ParamPowerUp::~ParamPowerUp ()
+{
+}
+
+
+void ParamPowerUp::init()
+{
+  this->value = 0;
+  this->max_value = 0;
+  this->min_value = 0;
+}
+
+
+void ParamPowerUp::loadParams(const TiXmlElement* root)
+{
+  static_cast<PowerUp*>(this)->loadParams(root);
+  LoadParam(root, "type", this, ParamPowerUp, setType);
+  if(root->FirstChildElement("value") != NULL) {
+    LoadParam(root, "value", this, ParamPowerUp, setValue);
+  }
+  else {
+    LoadParam(root, "max-value", this, ParamPowerUp, setMaxValue);
+    LoadParam(root, "min-value", this, ParamPowerUp, setMinValue);
+    respawn();
+  }
+}
+
+void ParamPowerUp::setValue(int value)
+{
+  this->value = value;
+}
+
+void ParamPowerUp::setType(const char* type)
+{
+  for(int i = 0; i < PARAM_size; ++i) {
+    if(strcmp(type, paramTypes[i]) == 0) {
+      this->type = (EnumParamPowerUpType)i;
+      break;
+    }
+  }
+}
+
+void ParamPowerUp::setMaxValue(int value)
+{
+  this->max_value = value;
+}
+
+void ParamPowerUp::setMinValue(int value)
+{
+  this->min_value = value;
+}
+
+int ParamPowerUp::getValue()
+{
+  return this->value;
+}
+
+EnumParamPowerUpType ParamPowerUp::getType()
+{
+  return this->type;
+}
+
+void ParamPowerUp::respawn()
+{
+  if(this->min_value != this->max_value)
+  {
+    value = this->min_value + (int)(rand() * (this->max_value - this->min_value));
+  }
+}
+
+
Index: trunk/src/world_entities/power_ups/param_power_up.h
===================================================================
--- trunk/src/world_entities/power_ups/param_power_up.h	(revision 6113)
+++ trunk/src/world_entities/power_ups/param_power_up.h	(revision 6113)
@@ -0,0 +1,47 @@
+/*!
+ * @file weapon_power_up.h
+ * @brief A class representing a PowerUp modifying parameters.
+*/
+
+#ifndef _PARAM_POWER_UP_H
+#define _PARAM_POWER_UP_H
+
+#include "power_up.h"
+
+/* FORWARD DEFINITION */
+
+typedef enum EnumParamPowerUpType {
+  PARAM_SHIELD,
+  PARAM_size
+} EnumParamPowerUpType;
+
+class ParamPowerUp : public PowerUp {
+
+public:
+  ParamPowerUp();
+  ParamPowerUp(const TiXmlElement* root);
+  virtual ~ParamPowerUp ();
+
+  void setValue(int value);
+  void setMaxValue(int value);
+  void setMinValue(int value);
+  void setType(const char* type);
+  EnumParamPowerUpType getType();
+  int getValue();
+
+protected:
+  virtual void respawn();
+
+private:
+  void init();
+  void loadParams(const TiXmlElement* root);
+
+private:
+  static const char* paramTypes[];
+  EnumParamPowerUpType type;
+  int value;
+  int max_value;
+  int min_value;
+};
+
+#endif /* _PARAM_POWER_UP_H */
Index: trunk/src/world_entities/power_ups/power_up.cc
===================================================================
--- trunk/src/world_entities/power_ups/power_up.cc	(revision 6100)
+++ trunk/src/world_entities/power_ups/power_up.cc	(revision 6113)
@@ -10,5 +10,5 @@
 
    ### File Specific:
-   main-programmer: Benjamin Grauer
+   main-programmer: Manuel Leuenberger
    co-programmer: ...
 */
@@ -18,25 +18,79 @@
 
 #include "power_up.h"
-
+#include "extendable.h"
+#include "primitive_model.h"
 
 using namespace std;
 
+Model* PowerUp::sphereModel = NULL;
 
+PowerUp::PowerUp(float r, float g, float b)
+{
+  if(!PowerUp::sphereModel) {
+    PowerUp::sphereModel = new PrimitiveModel(PRIM_SPHERE, 7, 5);
+  }
+  this->sphereMaterial = new Material;
+  this->sphereMaterial->setTransparency(.1);
+  this->sphereMaterial->setDiffuse(r, g, b);
+}
 
-PowerUp::PowerUp ()
+PowerUp::~PowerUp ()
 {
-  this->setClassID(CL_POWER_UP, "PowerUp");
-
+  delete this->sphereMaterial;
 }
 
 
-
-PowerUp::~PowerUp () {}
+void PowerUp::loadParams(const TiXmlElement* root)
+{
+  static_cast<WorldEntity*>(this)->loadParams(root);
+}
 
 
-void PowerUp::loadParam(const TiXmlElement* root)
+void PowerUp::collidesWith (WorldEntity* entity, const Vector& location)
 {
-  static_cast<WorldEntity*>(this)->loadParams(root);
-
+ if(entity->isA(CL_EXTENDABLE))
+  {
+    if(dynamic_cast<Extendable*>(entity)->pickup(this))
+    {
+      this->setVisibiliy(false);
+    }
+  }
 }
 
+void PowerUp::draw() const
+{
+  WorldEntity::draw();
+
+  glMatrixMode(GL_MODELVIEW);
+  glPushMatrix();
+  float matrix[4][4];
+
+  /* translate */
+  glTranslatef (this->getAbsCoor ().x,
+                this->getAbsCoor ().y,
+                this->getAbsCoor ().z);
+  /* rotate */ // FIXME: devise a new Way to rotate this
+  this->getAbsDir ().matrix (matrix);
+  glMultMatrixf((float*)matrix);
+
+  this->sphereMaterial->select();
+  sphereModel->draw();
+
+  glPopMatrix();
+}
+
+const char* PowerUp::respawnTypes[] = {
+  "none",
+  "time"
+};
+
+void PowerUp::setRespawnType(const char* type)
+{
+  for(int i = 0; i < RESPAWN_size; ++i) {
+    if(strcmp(type, respawnTypes[i]) == 0) {
+      this->respawnType = (PowerUpRespawn)i;
+      break;
+    }
+  }
+}
+
Index: trunk/src/world_entities/power_ups/power_up.h
===================================================================
--- trunk/src/world_entities/power_ups/power_up.h	(revision 6100)
+++ trunk/src/world_entities/power_ups/power_up.h	(revision 6113)
@@ -9,10 +9,32 @@
 #include "world_entity.h"
 
+class Material;
+
+typedef enum PowerUpRespawn {
+  RESPAWN_NONE,
+  RESPAWN_TIME,
+  RESPAWN_size
+} PowerUpRespawn;
+
 class PowerUp : public WorldEntity {
 
- public:
-  PowerUp ();
+public:
+  void loadParams(const TiXmlElement* root);
+  void collidesWith (WorldEntity* entity, const Vector& location);
+
+  virtual void draw () const;
+  void setRespawnType(const char* type);
+
+protected:
+  PowerUp(float r, float g, float b);
   virtual ~PowerUp ();
-  void loadParam(const TiXmlElement* root);
+  virtual void respawn() {};
+
+  static Model* sphereModel;
+
+private:
+  Material* sphereMaterial;
+  PowerUpRespawn respawnType;
+  static const char* respawnTypes[];
 };
 
Index: trunk/src/world_entities/power_ups/turret_power_up.cc
===================================================================
--- trunk/src/world_entities/power_ups/turret_power_up.cc	(revision 6100)
+++ trunk/src/world_entities/power_ups/turret_power_up.cc	(revision 6113)
@@ -27,10 +27,10 @@
 CREATE_FACTORY(TurretPowerUp, CL_TURRET_POWER_UP);
 
-TurretPowerUp::TurretPowerUp ()
+TurretPowerUp::TurretPowerUp () : PowerUp(0.0, 1.0, 0.0)
 {
   this->init();
 }
 
-TurretPowerUp::TurretPowerUp(const TiXmlElement* root)
+TurretPowerUp::TurretPowerUp(const TiXmlElement* root) : PowerUp(0.0, 1.0, 0.0)
 {
   this->init();
Index: trunk/src/world_entities/power_ups/weapon_power_up.cc
===================================================================
--- trunk/src/world_entities/power_ups/weapon_power_up.cc	(revision 6113)
+++ trunk/src/world_entities/power_ups/weapon_power_up.cc	(revision 6113)
@@ -0,0 +1,86 @@
+/*
+   orxonox - the future of 3D-vertical-scrollers
+
+   Copyright (C) 2004 orx
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+   ### File Specific:
+   main-programmer: Benjamin Grauer
+   co-programmer: ...
+*/
+
+#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_WORLD_ENTITY
+
+#include "weapon_power_up.h"
+#include "factory.h"
+#include "state.h"
+#include "list.h"
+
+#include "primitive_model.h"
+
+#include "factory.h"
+#include "load_param.h"
+
+using namespace std;
+
+CREATE_FACTORY(WeaponPowerUp, CL_WEAPON_POWER_UP);
+
+WeaponPowerUp::WeaponPowerUp () : PowerUp(1.0, 1.0, 0.0)
+{
+  this->init();
+}
+
+WeaponPowerUp::WeaponPowerUp(const TiXmlElement* root) : PowerUp(1.0, 1.0, 0.0)
+{
+  this->init();
+  this->loadParams(root);
+}
+
+
+WeaponPowerUp::~WeaponPowerUp ()
+{
+}
+
+
+void WeaponPowerUp::init()
+{
+  weaponXML = NULL;
+  weapon = NULL;
+}
+
+
+void WeaponPowerUp::loadParams(const TiXmlElement* root)
+{
+  static_cast<PowerUp*>(this)->loadParams(root);
+  const TiXmlElement* elem = root->FirstChildElement("weapon");
+  if(elem != NULL && (elem = elem->FirstChildElement()) != NULL)
+  {
+    this->weaponXML = elem;
+    respawn();
+  }
+  else
+  {
+    LoadParam(root, "weaponID", this, WeaponPowerUp, setWeaponClass);
+  }
+}
+
+Weapon* WeaponPowerUp::getWeapon()
+{
+  return this->weapon;
+}
+
+void WeaponPowerUp::respawn()
+{
+  this->weapon = dynamic_cast<Weapon*>((weaponXML == NULL)
+      ? Factory::fabricate(static_cast<ClassID>(this->weapon->getClassID()))
+      : Factory::fabricate(weaponXML));
+}
+
+void WeaponPowerUp::setWeaponClass(const char* name)
+{
+  this->weapon = dynamic_cast<Weapon*>(Factory::fabricate(name));
+}
Index: trunk/src/world_entities/power_ups/weapon_power_up.h
===================================================================
--- trunk/src/world_entities/power_ups/weapon_power_up.h	(revision 6113)
+++ trunk/src/world_entities/power_ups/weapon_power_up.h	(revision 6113)
@@ -0,0 +1,37 @@
+/*!
+ * @file weapon_power_up.h
+ * @brief A class representing a PowerUp containing a weapon.
+*/
+
+#ifndef _WEAPON_POWER_UP_H
+#define _WEAPON_POWER_UP_H
+
+#include "power_up.h"
+#include "weapons/weapon.h"
+
+/* FORWARD DEFINITION */
+
+class WeaponPowerUp : public PowerUp {
+
+public:
+  WeaponPowerUp();
+  WeaponPowerUp(const TiXmlElement* root);
+  virtual ~WeaponPowerUp ();
+
+  Weapon* getWeapon();
+  void setWeaponClass(const char* name);
+
+protected:
+  virtual void respawn();
+
+private:
+  void init();
+  void loadParams(const TiXmlElement* root);
+private:
+  Weapon* weapon;
+  const TiXmlElement* weaponXML;
+
+  void createWeapon();
+};
+
+#endif /* _WEAPON_POWER_UP_H */
