Index: trunk/src/world_entities/items/power_ups/laser_power_up.cc
===================================================================
--- trunk/src/world_entities/items/power_ups/laser_power_up.cc	(revision 10618)
+++ trunk/src/world_entities/items/power_ups/laser_power_up.cc	(revision 10618)
@@ -0,0 +1,123 @@
+/*
+   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 "laser_power_up.h"
+#include "util/loading/factory.h"
+#include "state.h"
+#include "network_game_manager.h"
+
+#include "primitive_model.h"
+
+
+
+ObjectListDefinition(LaserPowerUp);
+CREATE_FACTORY(LaserPowerUp);
+
+LaserPowerUp::LaserPowerUp () : PowerUp(0.0, 1.0, 0.0)
+{
+  this->init();
+}
+
+LaserPowerUp::LaserPowerUp(const TiXmlElement* root) : PowerUp(0.0, 1.0, 0.0)
+{
+  this->init();
+
+  this->loadParams(root);
+}
+
+
+LaserPowerUp::~LaserPowerUp ()
+{
+  delete this->sphereModel;
+  delete this->sphereMaterial;
+}
+
+
+void LaserPowerUp::init()
+{
+  this->registerObject(this, LaserPowerUp::_objectList);
+  this->loadModel("models/guns/test_gun.obj", 2.0);
+
+  this->sphereModel = new PrimitiveModel(PRIM_SPHERE, 7, 5);
+  this->sphereMaterial = new Material;
+  this->sphereMaterial->setTransparency(.1);
+  this->sphereMaterial->setDiffuse(.7, .7, .1);
+
+  this->rotation = Vector(0,1,0);
+  this->cycle    = (float)rand()/RAND_MAX*M_2_PI;
+  this->shiftDir(Quaternion((float)rand()/RAND_MAX*M_2_PI, this->rotation));
+}
+
+
+void LaserPowerUp::loadParams(const TiXmlElement* root)
+{
+  PowerUp::loadParams(root);
+
+}
+
+
+/**
+ * this function is called, when two entities collide
+ * @param entity: the world entity with whom it collides
+ *
+ * Implement behaviour like damage application or other miscellaneous collision stuff in this function
+ */
+void LaserPowerUp::collidesWith(WorldEntity* entity, const Vector& location)
+{
+ // PRINTF(3)("collision %s vs %s @ (%f,%f,%f)\n", this->getClassCName(), entity->getClassCName(), location.x, location.y, location.z);
+  if (entity->isA(Playable::staticClassID()))
+  this->toList(OM_DEAD);
+}
+
+/**
+ *  this method is called every frame
+ * @param time: the time in seconds that has passed since the last tick
+ *
+ * Handle all stuff that should update with time inside this method (movement, animation, etc.)
+*/
+void LaserPowerUp::tick(float dt)
+{
+  this->shiftDir(Quaternion(dt, this->rotation));
+  this->cycle+=dt;
+
+}
+
+/**
+ *  the entity is drawn onto the screen with this function
+ *
+ * This is a central function of an entity: call it to let the entity painted to the screen.
+ * Just override this function with whatever you want to be drawn.
+*/
+void LaserPowerUp::draw() const
+{
+  glMatrixMode(GL_MODELVIEW);
+  glPushMatrix();
+  /* translate */
+  glTranslatef (this->getAbsCoor ().x,
+                this->getAbsCoor ().y + cos(this->cycle*3.0)*2.0,
+                this->getAbsCoor ().z);
+  /* rotate */
+  Vector tmpRot = this->getAbsDir().getSpacialAxis();
+  glRotatef (this->getAbsDir().getSpacialAxisAngle(), tmpRot.x, tmpRot.y, tmpRot.z );
+  this->getModel()->draw();
+
+  this->sphereMaterial->select();
+  this->sphereModel->draw();
+  glPopMatrix();
+}
+
+
Index: trunk/src/world_entities/items/power_ups/laser_power_up.h
===================================================================
--- trunk/src/world_entities/items/power_ups/laser_power_up.h	(revision 10618)
+++ trunk/src/world_entities/items/power_ups/laser_power_up.h	(revision 10618)
@@ -0,0 +1,40 @@
+/*!
+ * @file laser_power_up.h
+ * @brief A class representing a PowerUp in the world.
+*/
+
+#ifndef _LASER_POWER_UP_H
+#define _LASER_POWER_UP_H
+
+#include "power_up.h"
+
+/* FORWARD DEFINITION */
+class Material;
+
+class LaserPowerUp : public PowerUp {
+  ObjectListDeclaration(LaserPowerUp);
+
+ public:
+  LaserPowerUp();
+  LaserPowerUp(const TiXmlElement* root);
+  virtual ~LaserPowerUp ();
+
+  virtual void loadParams(const TiXmlElement* root);
+
+
+  virtual void collidesWith(WorldEntity* entity, const Vector& location);
+  virtual void tick(float dt);
+  virtual void draw() const;
+
+  private:
+   void init();
+
+  private:
+   Vector              rotation;
+   float               cycle;
+
+   Model*              sphereModel;
+   Material*           sphereMaterial;
+};
+
+#endif /* _LASER_POWER_UP_H */
Index: trunk/src/world_entities/items/power_ups/param_power_up.cc
===================================================================
--- trunk/src/world_entities/items/power_ups/param_power_up.cc	(revision 10618)
+++ trunk/src/world_entities/items/power_ups/param_power_up.cc	(revision 10618)
@@ -0,0 +1,126 @@
+/*
+   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 "util/loading/factory.h"
+#include "state.h"
+
+#include "primitive_model.h"
+
+#include "util/loading/factory.h"
+#include "util/loading/load_param.h"
+#include "network_game_manager.h"
+
+
+
+ObjectListDefinition(ParamPowerUp);
+CREATE_FACTORY(ParamPowerUp);
+
+const char* ParamPowerUp::paramTypes[] = {
+  "shield",
+  "max-shield",
+  "health",
+  "max-health",
+};
+
+ParamPowerUp::ParamPowerUp(const TiXmlElement* root) : PowerUp(0.0, 1.0, 0.0)
+{
+  this->init();
+  this->loadPickupSound("sounds/powerups/power_up_6.wav");
+  if( root != NULL)
+    this->loadParams(root);
+
+  registerVar( new SynchronizeableInt( (int*)&type, (int*)&type, "type", PERMISSION_MASTER_SERVER ) );
+  registerVar( new SynchronizeableFloat( &value, &value, "value", PERMISSION_MASTER_SERVER ) );
+  registerVar( new SynchronizeableFloat( &max_value, &max_value, "max_value", PERMISSION_MASTER_SERVER ) );
+  registerVar( new SynchronizeableFloat( &min_value, &min_value, "min_value", PERMISSION_MASTER_SERVER ) );
+}
+
+
+ParamPowerUp::~ParamPowerUp ()
+{
+}
+
+
+void ParamPowerUp::init()
+{
+  this->registerObject(this, ParamPowerUp::_objectList);
+  this->value = 0;
+  this->max_value = 0;
+  this->min_value = 0;
+}
+
+
+void ParamPowerUp::loadParams(const TiXmlElement* root)
+{
+  PowerUp::loadParams(root);
+  LoadParam(root, "type", this, ParamPowerUp, setType);
+
+  if( root != NULL && 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(float value)
+{
+  this->value = value;
+}
+
+void ParamPowerUp::setType(const std::string& type)
+{
+  for(int i = 0; i < POWERUP_PARAM_size; ++i) {
+    if(type == paramTypes[i]) {
+      this->type = (EnumParamPowerUpType)i;
+      break;
+    }
+  }
+}
+
+void ParamPowerUp::setMaxValue(float value)
+{
+  this->max_value = value;
+}
+
+void ParamPowerUp::setMinValue(float value)
+{
+  this->min_value = value;
+}
+
+float ParamPowerUp::getValue()
+{
+  return this->value;
+}
+
+EnumParamPowerUpType ParamPowerUp::getType()
+{
+  return this->type;
+}
+
+void ParamPowerUp::respawn()
+{
+  if(this->min_value != this->max_value)
+  {
+    this->value = this->min_value + rand() * (this->max_value - this->min_value);
+  }
+}
+
Index: trunk/src/world_entities/items/power_ups/param_power_up.h
===================================================================
--- trunk/src/world_entities/items/power_ups/param_power_up.h	(revision 10618)
+++ trunk/src/world_entities/items/power_ups/param_power_up.h	(revision 10618)
@@ -0,0 +1,52 @@
+/*!
+ * @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 {
+  POWERUP_PARAM_SHIELD,
+  POWERUP_PARAM_MAX_SHIELD,
+  POWERUP_PARAM_HEALTH,
+  POWERUP_PARAM_MAX_HEALTH,
+  POWERUP_PARAM_size
+} EnumParamPowerUpType;
+
+class ParamPowerUp : public PowerUp {
+  ObjectListDeclaration(ParamPowerUp);
+
+public:
+  ParamPowerUp(const TiXmlElement* root = NULL);
+  virtual ~ParamPowerUp ();
+
+  void setValue(float value);
+  void setMaxValue(float value);
+  void setMinValue(float value);
+  void setType(const std::string& type);
+  EnumParamPowerUpType getType();
+  float getValue();
+
+protected:
+  virtual void respawn();
+
+private:
+  void init();
+  virtual void loadParams(const TiXmlElement* root);
+
+private:
+  EnumParamPowerUpType    type;
+  float                   value;
+  float                   max_value;
+  float                   min_value;
+
+  static const char*      paramTypes[];
+
+};
+
+#endif /* _PARAM_POWER_UP_H */
Index: trunk/src/world_entities/items/power_ups/power_up.cc
===================================================================
--- trunk/src/world_entities/items/power_ups/power_up.cc	(revision 10618)
+++ trunk/src/world_entities/items/power_ups/power_up.cc	(revision 10618)
@@ -0,0 +1,175 @@
+/*
+   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: Manuel Leuenberger
+   co-programmer: ...
+*/
+
+#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_WORLD_ENTITY
+
+
+#include "power_up.h"
+#include "extendable.h"
+#include "primitive_model.h"
+
+#include "sound/resource_sound_buffer.h"
+#include "util/loading/load_param.h"
+
+#include "debug.h"
+
+ObjectListDefinition(PowerUp);
+
+PowerUp::PowerUp(float r, float g, float b)
+{
+  this->registerObject(this, PowerUp::_objectList);
+
+  this->respawnType = RESPAWN_TIME;
+  this->respawnStart = 10;
+  this->model = NULL;
+  /*  if(!PowerUp::sphereModel) {*/
+
+  Model* sphereModel = new PrimitiveModel(PRIM_SPHERE, 7, 5);
+
+  this->setModel(sphereModel);
+  this->buildObbTree( 4);
+  this->sphereMaterial = new Material;
+  this->sphereMaterial->setTransparency(.8);
+  this->sphereMaterial->setDiffuse(r, g, b);
+  this->toList(OM_COMMON);
+
+  this->soundSource.setSourceNode(this);
+
+  this->collider = NULL;
+}
+
+PowerUp::~PowerUp ()
+{
+  delete this->sphereMaterial;
+}
+
+
+void PowerUp::loadParams(const TiXmlElement* root)
+{
+  WorldEntity::loadParams(root);
+
+  LoadParam(root, "respawnType", this, PowerUp, setRespawnType);
+
+  LoadParam(root, "respawnTime", this, PowerUp, setRespawnTime);
+
+  LoadParam(root, "pickup-sound", this, PowerUp, loadPickupSound);
+
+  LoadParam(root, "respawn-sound", this, PowerUp, loadRespawnSound);
+}
+
+
+void PowerUp::loadPickupSound(const std::string& pickupSound)
+{
+  if (!pickupSound.empty())
+    this->pickupBuffer = OrxSound::ResourceSoundBuffer(pickupSound);
+  else
+    this->pickupBuffer = OrxSound::SoundBuffer();
+}
+
+void PowerUp::loadRespawnSound(const std::string& respawnSound)
+{
+  if (!respawnSound.empty())
+    this->respawnBuffer = OrxSound::ResourceSoundBuffer(respawnSound);
+  else
+    this->respawnBuffer = OrxSound::SoundBuffer();
+}
+
+
+void PowerUp::collidesWith (WorldEntity* entity, const Vector& location)
+{
+  if(this->collider != entity && entity->isA(Extendable::staticClassID()))
+  {
+    this->collider = entity;
+    if(dynamic_cast<Extendable*>(entity)->pickup(this))
+    {
+      if(pickupBuffer.loaded())
+        this->soundSource.play(this->pickupBuffer);
+
+      switch(respawnType)
+      {
+      case RESPAWN_NONE:
+        this->toList(OM_DEAD);
+        break;
+      case RESPAWN_TIME:
+        this->toList(OM_DEAD_TICK);
+        this->respawnTime = this->respawnStart;
+        break;
+        default:
+          /* NOT HANDLED */
+          break;
+      }
+    }
+  }
+}
+
+void PowerUp::tick(float dt)
+{
+  if(this->getOMListNumber() != OM_COMMON)
+  {
+    this->respawnTime -= dt;
+    if(this->respawnTime <= 0)
+    {
+      this->toList(OM_COMMON);
+      this->collider = NULL;
+      if (likely(this->respawnBuffer.loaded()))
+        this->soundSource.play(this->respawnBuffer);
+
+    }
+  }
+}
+
+void PowerUp::draw() const
+{
+  if(this->model != NULL)
+  {
+    glMatrixMode(GL_MODELVIEW);
+    glPushMatrix();
+    glTranslatef (this->getAbsCoor ().x,
+                  this->getAbsCoor ().y,
+                  this->getAbsCoor ().z);
+    Vector tmpRot = this->getAbsDir().getSpacialAxis();
+    glRotatef (this->getAbsDir().getSpacialAxisAngle(), tmpRot.x, tmpRot.y, tmpRot.z );
+    this->model->draw();
+    glPopMatrix();
+  }
+  this->sphereMaterial->select();
+  WorldEntity::draw();
+}
+
+const char* PowerUp::respawnTypes[] =
+  {
+    "none",
+    "time"
+  };
+
+
+void PowerUp::setRespawnType(const std::string& type)
+{
+  for(int i = 0; i < RESPAWN_size; ++i)
+  {
+    if(type == respawnTypes[i])
+    {
+      this->respawnType = (PowerUpRespawn)i;
+      break;
+    }
+  }
+}
+
+void PowerUp::setRespawnTime(const float respawnTime)
+{
+  this->respawnStart = respawnTime;
+}
+
+
Index: trunk/src/world_entities/items/power_ups/power_up.h
===================================================================
--- trunk/src/world_entities/items/power_ups/power_up.h	(revision 10618)
+++ trunk/src/world_entities/items/power_ups/power_up.h	(revision 10618)
@@ -0,0 +1,57 @@
+/*!
+ * @file power_up.h
+ * @brief A class representing a PowerUp in the world.
+*/
+
+#ifndef _POWER_UP_H
+#define _POWER_UP_H
+
+#include "world_entity.h"
+
+#include "sound_buffer.h"
+#include "sound_source.h"
+
+class Material;
+
+typedef enum PowerUpRespawn {
+  RESPAWN_NONE,
+  RESPAWN_TIME,
+  RESPAWN_size
+} PowerUpRespawn;
+
+class PowerUp : public WorldEntity {
+  ObjectListDeclaration(PowerUp);
+
+public:
+  virtual void loadParams(const TiXmlElement* root);
+  void collidesWith (WorldEntity* entity, const Vector& location);
+
+  void loadPickupSound(const std::string& pickupSound);
+  void loadRespawnSound(const std::string& respawnSound);
+
+  virtual void draw () const;
+  virtual void tick(float dt);
+  void setRespawnType(const std::string& type);
+  void setRespawnTime(const float respawn);
+
+protected:
+  PowerUp(float r, float g, float b);
+  virtual ~PowerUp ();
+
+protected:
+  Model* model;
+
+private:
+  OrxSound::SoundSource  soundSource;
+  OrxSound::SoundBuffer  pickupBuffer;
+  OrxSound::SoundBuffer  respawnBuffer;
+  Material*              sphereMaterial;
+  PowerUpRespawn         respawnType;
+  float                  respawnTime;
+  float                  respawnStart;
+  static const char*     respawnTypes[];
+
+  WorldEntity*           collider;
+};
+
+#endif /* _POWER_UP_H */
Index: trunk/src/world_entities/items/power_ups/turret_power_up.cc
===================================================================
--- trunk/src/world_entities/items/power_ups/turret_power_up.cc	(revision 10618)
+++ trunk/src/world_entities/items/power_ups/turret_power_up.cc	(revision 10618)
@@ -0,0 +1,117 @@
+/*
+   orxonox - the future of 3D-vertical-scrollers
+
+   Copyright (C) 2004 orx
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+   ### File Specific:
+   main-programmer: Benjamin Grauer
+   co-programmer: ...
+*/
+
+#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_WORLD_ENTITY
+
+#include "turret_power_up.h"
+#include "util/loading/factory.h"
+#include "network_game_manager.h"
+#include "state.h"
+
+#include "primitive_model.h"
+
+
+
+ObjectListDefinition(TurretPowerUp);
+CREATE_FACTORY(TurretPowerUp);
+
+TurretPowerUp::TurretPowerUp(const TiXmlElement* root) : PowerUp(0.0, 1.0, 0.0)
+{
+  this->init();
+
+  if( root != NULL)
+    this->loadParams(root);
+}
+
+
+TurretPowerUp::~TurretPowerUp ()
+{
+  delete this->sphereModel;
+  delete this->sphereMaterial;
+}
+
+
+void TurretPowerUp::init()
+{
+  this->registerObject(this, TurretPowerUp::_objectList);
+  this->loadModel("models/guns/turret1.obj", 2.0);
+
+  this->sphereModel = new PrimitiveModel(PRIM_SPHERE, 7, 5);
+  this->sphereMaterial = new Material;
+  this->sphereMaterial->setTransparency(.1);
+  this->sphereMaterial->setDiffuse(.1, .1, .8);
+
+  this->rotation = Vector(0,1,0);
+  this->cycle    = (float)rand()/RAND_MAX*M_2_PI;
+  this->shiftDir(Quaternion((float)rand()/RAND_MAX*M_2_PI, this->rotation));
+}
+
+
+void TurretPowerUp::loadParams(const TiXmlElement* root)
+{
+  PowerUp::loadParams(root);
+
+}
+
+
+/**
+ * this function is called, when two entities collide
+ * @param entity: the world entity with whom it collides
+ *
+ * Implement behaviour like damage application or other miscellaneous collision stuff in this function
+ */
+void TurretPowerUp::collidesWith(WorldEntity* entity, const Vector& location)
+{
+ // PRINTF(3)("collision %s vs %s @ (%f,%f,%f)\n", this->getClassCName(), entity->getClassCName(), location.x, location.y, location.z);
+  if (entity->isA(Playable::staticClassID()))
+   this->toList(OM_DEAD);
+}
+
+/**
+ *  this method is called every frame
+ * @param time: the time in seconds that has passed since the last tick
+ *
+ * Handle all stuff that should update with time inside this method (movement, animation, etc.)
+*/
+void TurretPowerUp::tick(float dt)
+{
+  this->shiftDir(Quaternion(dt, this->rotation));
+  this->cycle+=dt;
+
+}
+
+/**
+ *  the entity is drawn onto the screen with this function
+ *
+ * This is a central function of an entity: call it to let the entity painted to the screen.
+ * Just override this function with whatever you want to be drawn.
+*/
+void TurretPowerUp::draw() const
+{
+  glMatrixMode(GL_MODELVIEW);
+  glPushMatrix();
+  /* translate */
+  glTranslatef (this->getAbsCoor ().x,
+                this->getAbsCoor ().y + cos(this->cycle*3.0)*2.0,
+                this->getAbsCoor ().z);
+  /* rotate */
+  Vector tmpRot = this->getAbsDir().getSpacialAxis();
+  glRotatef (this->getAbsDir().getSpacialAxisAngle(), tmpRot.x, tmpRot.y, tmpRot.z );
+  this->getModel()->draw();
+
+  this->sphereMaterial->select();
+  this->sphereModel->draw();
+  glPopMatrix();
+}
Index: trunk/src/world_entities/items/power_ups/turret_power_up.h
===================================================================
--- trunk/src/world_entities/items/power_ups/turret_power_up.h	(revision 10618)
+++ trunk/src/world_entities/items/power_ups/turret_power_up.h	(revision 10618)
@@ -0,0 +1,38 @@
+/*!
+ * @file turret_power_up.h
+ * @brief A class representing a PowerUp in the world.
+*/
+
+#ifndef _TURRET_POWER_UP_H
+#define _TURRET_POWER_UP_H
+
+#include "power_up.h"
+
+/* FORWARD DEFINITION */
+class Material;
+
+class TurretPowerUp : public PowerUp {
+  ObjectListDeclaration(TurretPowerUp);
+
+ public:
+  TurretPowerUp(const TiXmlElement* root = NULL);
+  virtual ~TurretPowerUp ();
+
+  virtual void loadParams(const TiXmlElement* root);
+
+  virtual void collidesWith(WorldEntity* entity, const Vector& location);
+  virtual void tick(float dt);
+  virtual void draw() const;
+
+  private:
+   void init();
+
+  private:
+   Vector              rotation;
+   float               cycle;
+
+   Model*              sphereModel;
+   Material*           sphereMaterial;
+};
+
+#endif /* _TURRET_POWER_UP_H */
Index: trunk/src/world_entities/items/power_ups/weapon_power_up.cc
===================================================================
--- trunk/src/world_entities/items/power_ups/weapon_power_up.cc	(revision 10618)
+++ trunk/src/world_entities/items/power_ups/weapon_power_up.cc	(revision 10618)
@@ -0,0 +1,105 @@
+/*
+   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 "util/loading/factory.h"
+#include "state.h"
+#include "network_game_manager.h"
+
+#include "primitive_model.h"
+
+#include "util/loading/factory.h"
+#include "util/loading/load_param.h"
+#include "debug.h"
+
+
+ObjectListDefinition(WeaponPowerUp);
+CREATE_FACTORY(WeaponPowerUp);
+
+WeaponPowerUp::WeaponPowerUp(const TiXmlElement* root) : PowerUp(1.0, 1.0, 0.0)
+{
+  this->init();
+  if( root != NULL)
+    this->loadParams(root);
+}
+
+
+WeaponPowerUp::~WeaponPowerUp ()
+{
+}
+
+
+void WeaponPowerUp::init()
+{
+  this->registerObject(this, WeaponPowerUp::_objectList);
+  this->loadPickupSound("sounds/powerups/whats this2.wav");
+
+  this->weaponXML = NULL;
+  this->weapon = NULL;
+}
+
+
+void WeaponPowerUp::loadParams(const TiXmlElement* root)
+{
+  PowerUp::loadParams(root);
+  const TiXmlElement* elem = root->FirstChildElement("weapon");
+  if(elem != NULL && (elem = elem->FirstChildElement()) != NULL)
+  {
+    this->weaponXML = elem;
+    newWeapon();
+  }
+  else
+  {
+    LoadParam(root, "weaponID", this, WeaponPowerUp, setWeaponClass);
+  }
+}
+
+Weapon* WeaponPowerUp::getWeapon()
+{
+  return this->weapon;
+}
+
+bool WeaponPowerUp::process(WeaponManager* manager)
+{
+  if(manager->addWeapon(this->weapon)) {
+    newWeapon();
+  }
+  else {
+    manager->increaseAmmunition(this->weapon->getProjectileType(), this->weapon->getEnergy());
+  }
+  return true;
+}
+
+void WeaponPowerUp::newWeapon()
+{
+  this->weapon = dynamic_cast<Weapon*>((weaponXML == NULL)
+      ? Factory::fabricate((this->weapon->getClassID()))
+      : Factory::fabricate((const TiXmlElement*)this->getXmlElem()->FirstChildElement("weapon")));
+  this->model = this->weapon->getModel(0);
+}
+
+void WeaponPowerUp::setWeaponClass(const std::string& name)
+{
+  this->weapon = dynamic_cast<Weapon*>(Factory::fabricate(name));
+  if (this->weapon == NULL)
+  {
+    PRINTF(1)("Unable to load Weapon. %s\n", name.c_str());
+    this->weapon = dynamic_cast<Weapon*>(Factory::fabricate("Turret"));
+  }
+  this->model = this->weapon->getModel(0);
+}
+
Index: trunk/src/world_entities/items/power_ups/weapon_power_up.h
===================================================================
--- trunk/src/world_entities/items/power_ups/weapon_power_up.h	(revision 10618)
+++ trunk/src/world_entities/items/power_ups/weapon_power_up.h	(revision 10618)
@@ -0,0 +1,38 @@
+/*!
+ * @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"
+#include "weapons/weapon_manager.h"
+
+/* FORWARD DEFINITION */
+
+class WeaponPowerUp : public PowerUp {
+ObjectListDeclaration(WeaponPowerUp);
+public:
+  WeaponPowerUp(const TiXmlElement* root = NULL);
+  virtual ~WeaponPowerUp ();
+
+  virtual void loadParams(const TiXmlElement* root);
+
+  Weapon* getWeapon();
+  void setWeaponClass(const std::string& name);
+
+  bool process(WeaponManager* manager);
+
+private:
+  void init();
+  void newWeapon();
+private:
+  Weapon* weapon;
+  const TiXmlElement* weaponXML;
+
+  void createWeapon();
+};
+
+#endif /* _WEAPON_POWER_UP_H */
