Index: /trunk/src/defs/class_id.h
===================================================================
--- /trunk/src/defs/class_id.h	(revision 6809)
+++ /trunk/src/defs/class_id.h	(revision 6810)
@@ -196,4 +196,5 @@
   CL_CANNON                     =    0x00000233,
   CL_TARGETING_TURRET           =    0x00000234,
+  CL_HYPERBLASTER               =    0x00000235,
 
   CL_TEST_BULLET                =    0x00000240,
@@ -203,4 +204,5 @@
   CL_GROUND_TURRET              =    0x00000244,
   CL_GUIDED_MISSILE             =    0x00000245,
+  CL_HYPERBLAST                 =    0x00000246,
 
   CL_NPC_TEST1                  =    0x00000301,
Index: /trunk/src/world_entities/Makefile.am
===================================================================
--- /trunk/src/world_entities/Makefile.am	(revision 6809)
+++ /trunk/src/world_entities/Makefile.am	(revision 6810)
@@ -35,4 +35,5 @@
                   world_entities/weapons/targeting_turret.cc \
                   world_entities/weapons/cannon.cc \
+                  world_entities/weapons/hyperblaster.cc \
                   world_entities/weapons/aim.cc \
                   world_entities/weapons/crosshair.cc \
@@ -44,4 +45,5 @@
                   world_entities/projectiles/rocket.cc \
                   world_entities/projectiles/guided_missile.cc \
+                  world_entities/projectiles/hyperblast.cc \
                   \
                   world_entities/power_ups/power_up.cc \
Index: /trunk/src/world_entities/projectiles/hyperblast.cc
===================================================================
--- /trunk/src/world_entities/projectiles/hyperblast.cc	(revision 6810)
+++ /trunk/src/world_entities/projectiles/hyperblast.cc	(revision 6810)
@@ -0,0 +1,176 @@
+/*
+   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_WEAPON
+
+#include "hyperblast.h"
+
+#include "fast_factory.h"
+
+#include "state.h"
+#include "class_list.h"
+
+#include "particle_emitter.h"
+#include "sprite_particles.h"
+#include "spark_particles.h"
+
+
+using namespace std;
+
+CREATE_FAST_FACTORY_STATIC(Hyperblast, CL_HYPERBLAST);
+
+/**
+ *  standard constructor
+*/
+Hyperblast::Hyperblast () : Projectile()
+{
+  this->setClassID(CL_HYPERBLAST, "Hyperblast");
+
+  float modelSize = .3;
+  this->loadModel("models/projectiles/orx-hyperblast.obj", .3);
+
+  this->setMinEnergy(1);
+  this->setHealthMax(10);
+  this->lifeSpan = 5;
+
+  this->emitter = new ParticleEmitter(Vector(0,1,0), M_2_PI, 100, 5);
+  this->emitter->setParent(this);
+  this->emitter->setSpread(M_PI, M_PI);
+}
+
+
+/**
+ *  standard deconstructor
+*/
+Hyperblast::~Hyperblast ()
+{
+  /* this is normaly done by World.cc by deleting the ParticleEngine */
+  if (Hyperblast::extParticles != NULL && ClassList::getList(CL_HYPERBLAST)->size() <= 1)
+  {
+    Hyperblast::extParticles = NULL;
+  }
+  if (Hyperblast::explosionParticles != NULL && ClassList::getList(CL_HYPERBLAST)->size() <= 1)
+  {
+    Hyperblast::explosionParticles = NULL;
+  }
+
+}
+
+SpriteParticles* Hyperblast::extParticles = NULL;
+SparkParticles* Hyperblast::explosionParticles = NULL;
+
+void Hyperblast::activate()
+{
+  if (unlikely(Hyperblast::extParticles == NULL))
+  {
+    Hyperblast::extParticles = new SpriteParticles(2000);
+    Hyperblast::extParticles->setName("HyperblastTrailParticles");
+    Hyperblast::extParticles->setMaterialTexture("maps/radial-trans-noise.png");
+    Hyperblast::extParticles->setLifeSpan(1.0, .3);
+    Hyperblast::extParticles->setRadius(0.0, .5);
+    Hyperblast::extParticles->setRadius(0.2, 2.0);
+    Hyperblast::extParticles->setRadius(.5, .8);
+    Hyperblast::extParticles->setRadius(1.0, .8);
+    Hyperblast::extParticles->setColor(0.0, 1,0,0,.7);
+    Hyperblast::extParticles->setColor(0.2, .8,.8,0,.5);
+    Hyperblast::extParticles->setColor(0.5, .8,.8,.8,.8);
+    Hyperblast::extParticles->setColor(1.0, .8,.8,.8,.0);
+  }
+  if (unlikely(Hyperblast::explosionParticles == NULL))
+  {
+    Hyperblast::explosionParticles = new SparkParticles(200);
+    Hyperblast::explosionParticles->setName("HyperblastExplosionParticles");
+    Hyperblast::explosionParticles->setLifeSpan(.5, .3);
+    Hyperblast::explosionParticles->setRadius(0.0, 10);
+    Hyperblast::explosionParticles->setRadius(.5, 15.0);
+    Hyperblast::explosionParticles->setRadius(1.0, 10.0);
+    Hyperblast::explosionParticles->setColor(0.0, 0,1,0,1);
+    Hyperblast::explosionParticles->setColor(0.5, .8,.8,0,.8);
+    Hyperblast::explosionParticles->setColor(0.8, .8,.8,.3,.8);
+    Hyperblast::explosionParticles->setColor(1.0, 1,1,1,.0);
+  }
+
+  this->emitter->setSystem(Hyperblast::extParticles);
+
+  this->updateNode(0);
+  this->emitter->setEmissionRate(45.0);
+  this->emitter->setEmissionVelocity(0.0);
+}
+
+
+void Hyperblast::deactivate()
+{
+  this->emitter->setSystem(NULL);
+  this->lifeCycle = 0.0;
+  this->toList(OM_NULL);
+
+//  GarbageCollector::getInstance()->collect(this);
+  this->toList(OM_DEAD);
+  Hyperblast::fastFactory->kill(this);
+}
+
+
+void Hyperblast::collidesWith(WorldEntity* entity, const Vector& location)
+{
+  if (this->hitEntity != entity)
+    this->destroy();
+  this->hitEntity = entity;
+}
+
+/**
+ *  signal tick, time dependent things will be handled here
+ * @param time since last tick
+*/
+void Hyperblast::tick (float dt)
+{
+  //Vector v = *this->flightDirection * ( this->speed * time * 1000 + 0.1);
+  Vector v = this->velocity * (dt);
+  this->shiftCoor(v);
+
+  if(this->tickLifeCycle(dt))
+    this->deactivate();
+}
+
+/**
+ *  the function gets called, when the projectile is destroyed
+*/
+void Hyperblast::destroy ()
+{
+  PRINTF(5)("DESTROY Hyperblast\n");
+  this->lifeCycle = .95; //!< @todo calculate this usefully.
+  this->emitter->setSystem(Hyperblast::explosionParticles);
+
+  this->emitter->setEmissionRate(1000.0);
+  this->emitter->setEmissionVelocity(50.0);
+//  this->deactivate();
+
+}
+
+
+void Hyperblast::draw () const
+{
+  glMatrixMode(GL_MODELVIEW);
+  glPushMatrix();
+
+  float matrix[4][4];
+  glTranslatef (this->getAbsCoor ().x, this->getAbsCoor ().y, this->getAbsCoor ().z);
+  this->getAbsDir().matrix (matrix);
+  glMultMatrixf((float*)matrix);
+  glScalef(2.0, 2.0, 2.0);
+  this->getModel()->draw();
+
+  glPopMatrix();
+}
+
Index: /trunk/src/world_entities/projectiles/hyperblast.h
===================================================================
--- /trunk/src/world_entities/projectiles/hyperblast.h	(revision 6810)
+++ /trunk/src/world_entities/projectiles/hyperblast.h	(revision 6810)
@@ -0,0 +1,46 @@
+/*!
+ * @file hyperblast.h
+ * @brief a Hyperblast Projectile
+*/
+
+#ifndef _HYPERBLAST_H
+#define _HYPERBLAST_H
+
+#include "projectile.h"
+
+class Vector;
+class Weapon;
+class SpriteParticles;
+class SparkParticles;
+class ParticleEmitter;
+class FastFactory;
+
+class Hyperblast : public Projectile
+{
+  public:
+    Hyperblast ();
+    virtual ~Hyperblast ();
+
+
+    virtual void activate();
+    virtual void deactivate();
+
+    virtual void collidesWith(WorldEntity* entity, const Vector& location);
+
+    virtual void destroy ();
+
+    virtual void tick (float time);
+    virtual void draw () const;
+
+
+  private:
+    static FastFactory*               fastFactory;
+    static SpriteParticles*           extParticles;
+    static SparkParticles*            explosionParticles;
+
+    ParticleEmitter*                  emitter;
+
+    WorldEntity* hitEntity; // FIXME TEMPORARY
+};
+
+#endif /* _HYPERBLAST_H */
Index: /trunk/src/world_entities/weapons/hyperblaster.cc
===================================================================
--- /trunk/src/world_entities/weapons/hyperblaster.cc	(revision 6810)
+++ /trunk/src/world_entities/weapons/hyperblaster.cc	(revision 6810)
@@ -0,0 +1,167 @@
+
+
+/*
+   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:
+
+
+   @todo: direction in which the projectile flights
+   @todo: a target to set/hit
+*/
+#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_WEAPON
+
+#include "hyperblaster.h"
+
+#include "world_entity.h"
+#include "model.h"
+#include "world_entities/projectiles/projectile.h"
+#include "weapon_manager.h"
+#include "factory.h"
+
+#include "vector.h"
+#include "list.h"
+#include "animation3d.h"
+
+#include "fast_factory.h"
+
+
+using namespace std;
+
+CREATE_FACTORY(Hyperblaster, CL_HYPERBLASTER);
+
+Hyperblaster::Hyperblaster(const TiXmlElement* root)
+{
+  this->init();
+  if (root != NULL)
+    this->loadParams(root);
+}
+
+/**
+ *  standard deconstructor
+*/
+Hyperblaster::~Hyperblaster ()
+{
+  // model will be deleted from WorldEntity-destructor
+}
+
+
+void Hyperblaster::init()
+{
+  this->setClassID(CL_HYPERBLASTER, "Hyperblaster");
+
+//  this->model = (Model*)ResourceManager::getInstance()->load("models/guns/test_gun.obj", OBJ, RP_CAMPAIGN);
+
+  this->loadModel("models/guns/plasmadriver_#.obj", 2.0);
+
+  this->setStateDuration(WS_SHOOTING, 2.0);
+  this->setStateDuration(WS_RELOADING, 5.0);
+  this->setStateDuration(WS_ACTIVATING, .1);
+  this->setStateDuration(WS_DEACTIVATING, .4);
+
+  this->setEnergyMax(10);
+  this->increaseEnergy(10);
+  //this->minCharge = 2;
+
+  this->setActionSound(WA_SHOOT, "sound/explo.wav");
+  this->setActionSound(WA_ACTIVATE, "sound/voices/hyperblaster.wav");
+
+  this->setCapability(WTYPE_ALLDIRS | WTYPE_DIRECTIONAL | WTYPE_HEAVY);
+  this->setProjectileType(CL_HYPERBLAST);
+  this->prepareProjectiles(2);
+
+//  this->objectComponent1 = new PNode();
+//  Animation3D* animation1 = this->getAnimation(WS_SHOOTING, this->objectComponent1);
+  Animation3D* animation2 = this->getAnimation(WS_ACTIVATING, this);
+  Animation3D* animation3 = this->getAnimation(WS_DEACTIVATING, this);
+  //parent->addChild(this->objectComponent1, PNODE_ALL);
+//  this->addChild(this->objectComponent1);
+
+//  animation1->setInfinity(ANIM_INF_CONSTANT);
+  animation2->setInfinity(ANIM_INF_CONSTANT);
+  animation3->setInfinity(ANIM_INF_CONSTANT);
+
+  this->setEmissionPoint(3.8, 1.2, 0);
+
+//     animation1->addKeyFrame(Vector(0, -1.5, 0), Quaternion(), 0.1, ANIM_LINEAR, ANIM_NULL);
+//     animation1->addKeyFrame(Vector(0, 0, 0), Quaternion(), 0.1, ANIM_LINEAR, ANIM_NULL);
+//     animation1->addKeyFrame(Vector(0, 0, 0), Quaternion(), 0.0, ANIM_LINEAR, ANIM_NULL);
+
+  animation2->addKeyFrame(Vector(1.0, -1.0, 0.0), Quaternion(), 0.3, ANIM_LINEAR, ANIM_NULL);
+  animation2->addKeyFrame(Vector(1.0, 0.0, 0.0), Quaternion(), 0.3, ANIM_LINEAR, ANIM_NULL);
+  animation2->addKeyFrame(Vector(0.0, 0.0, 0.0), Quaternion(), 0.3, ANIM_LINEAR, ANIM_NULL);
+
+  animation3->addKeyFrame(Vector(0.0, 0.0, 0.0), Quaternion(), 0.3, ANIM_LINEAR, ANIM_NULL);
+  animation3->addKeyFrame(Vector(1.0, -1.0, 0.0), Quaternion(), 0.3, ANIM_LINEAR, ANIM_NULL);
+  animation2->addKeyFrame(Vector(1.0, -1.0, 0.0), Quaternion(), 0.3, ANIM_LINEAR, ANIM_NULL);
+}
+
+
+void Hyperblaster::loadParams(const TiXmlElement* root)
+{
+  Weapon::loadParams(root);
+}
+
+
+/**
+ *  this activates the weapon
+
+   This is needed, since there can be more than one weapon on a ship. the
+   activation can be connected with an animation. for example the weapon is
+   been armed out.
+*/
+void Hyperblaster::activate()
+{
+}
+
+
+/**
+ *  this deactivates the weapon
+
+   This is needed, since there can be more than one weapon on a ship. the
+   activation can be connected with an animation. for example the weapon is
+   been armed out.
+*/
+void Hyperblaster::deactivate()
+{
+}
+
+
+/**
+ *  fires the weapon
+
+   this is called from the player.cc, when fire-button is been pushed
+   @todo: the ObjectManager deliveres Projectiles not TestBullets! this should be diffrent
+*/
+void Hyperblaster::fire()
+{
+  Projectile* pj =  this->getProjectile();
+  if (pj == NULL)
+    return;
+
+  pj->setParent(PNode::getNullParent());
+
+  pj->setVelocity(this->getVelocity() + this->getAbsDir().apply(Vector(1,0,0))*15+VECTOR_RAND(5));
+
+  pj->setAbsCoor(this->getEmissionPoint());
+  pj->setAbsDir(this->getAbsDir());
+  pj->activate();
+}
+
+/**
+ *  is called, when the weapon is destroyed
+ *
+ * this is in conjunction with the hit function, so when a weapon is able to get
+ * hit, it can also be destoryed.
+*/
+void Hyperblaster::destroy ()
+{}
Index: /trunk/src/world_entities/weapons/hyperblaster.h
===================================================================
--- /trunk/src/world_entities/weapons/hyperblaster.h	(revision 6810)
+++ /trunk/src/world_entities/weapons/hyperblaster.h	(revision 6810)
@@ -0,0 +1,30 @@
+/*!
+ * @file hyperblaster.h
+ * a weapon that to fire heavy weaponary Hyperblasts.
+*/
+
+
+#ifndef _HYPERBLASTER_H
+#define _HYPERBLASTER_H
+
+#include "weapon.h"
+
+class Hyperblaster : public Weapon
+  {
+  public:
+    Hyperblaster (const TiXmlElement* root = NULL);
+    virtual ~Hyperblaster ();
+
+    void init();
+    virtual void loadParams(const TiXmlElement* root);
+
+    virtual void activate();
+    virtual void deactivate();
+
+    virtual void fire();
+    virtual void destroy();
+
+  private:
+//     PNode* objectComponent1;         //<! the gun is made of multiple parts, these PNodes represent their location and orientation
+  };
+#endif /* _HYPERBLASTER_H */
