Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 6810 in orxonox.OLD for trunk/src/world_entities/projectiles


Ignore:
Timestamp:
Jan 28, 2006, 3:30:54 PM (19 years ago)
Author:
bensch
Message:

trunk: added hyperblaster

Location:
trunk/src/world_entities/projectiles
Files:
2 copied

Legend:

Unmodified
Added
Removed
  • trunk/src/world_entities/projectiles/hyperblast.cc

    r6807 r6810  
    1010
    1111   ### File Specific
    12    main-programmer: Patrick Boenzli
    13    co-programmer: Benjamin Grauer
     12   main-programmer: Benjamin Grauer
     13   co-programmer: ...
    1414
    1515*/
    1616#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_WEAPON
    1717
    18 #include "rocket.h"
     18#include "hyperblast.h"
    1919
    2020#include "fast_factory.h"
     
    2525#include "particle_emitter.h"
    2626#include "sprite_particles.h"
     27#include "spark_particles.h"
    2728
    2829
    2930using namespace std;
    3031
    31 CREATE_FAST_FACTORY_STATIC(Rocket, CL_ROCKET);
     32CREATE_FAST_FACTORY_STATIC(Hyperblast, CL_HYPERBLAST);
    3233
    3334/**
    3435 *  standard constructor
    3536*/
    36 Rocket::Rocket () : Projectile()
     37Hyperblast::Hyperblast () : Projectile()
    3738{
    38   this->setClassID(CL_ROCKET, "Rocket");
     39  this->setClassID(CL_HYPERBLAST, "Hyperblast");
    3940
    4041  float modelSize = .3;
    41   this->loadModel("models/projectiles/orx-rocket.obj", .3);
     42  this->loadModel("models/projectiles/orx-hyperblast.obj", .3);
    4243
    4344  this->setMinEnergy(1);
     
    5455 *  standard deconstructor
    5556*/
    56 Rocket::~Rocket ()
     57Hyperblast::~Hyperblast ()
    5758{
    58   // delete this->emitter;
    59 
    6059  /* this is normaly done by World.cc by deleting the ParticleEngine */
    61   if (Rocket::trailParticles != NULL && ClassList::getList(CL_ROCKET)->size() <= 1)
     60  if (Hyperblast::extParticles != NULL && ClassList::getList(CL_HYPERBLAST)->size() <= 1)
    6261  {
    63 /*    if (ClassList::exists(Rocket::trailParticles, CL_PARTICLE_SYSTEM))
    64       delete Rocket::trailParticles;*/
    65     Rocket::trailParticles = NULL;
     62    Hyperblast::extParticles = NULL;
    6663  }
    67   if (Rocket::explosionParticles != NULL && ClassList::getList(CL_ROCKET)->size() <= 1)
     64  if (Hyperblast::explosionParticles != NULL && ClassList::getList(CL_HYPERBLAST)->size() <= 1)
    6865  {
    69 /*    if (ClassList::exists(Rocket::explosionParticles, CL_PARTICLE_SYSTEM))
    70       delete Rocket::explosionParticles;*/
    71     Rocket::explosionParticles = NULL;
     66    Hyperblast::explosionParticles = NULL;
    7267  }
    7368
    7469}
    7570
    76 SpriteParticles* Rocket::trailParticles = NULL;
    77 SpriteParticles* Rocket::explosionParticles = NULL;
     71SpriteParticles* Hyperblast::extParticles = NULL;
     72SparkParticles* Hyperblast::explosionParticles = NULL;
    7873
    79 void Rocket::activate()
     74void Hyperblast::activate()
    8075{
    81   if (unlikely(Rocket::trailParticles == NULL))
     76  if (unlikely(Hyperblast::extParticles == NULL))
    8277  {
    83     Rocket::trailParticles = new SpriteParticles(2000);
    84     Rocket::trailParticles->setName("RocketTrailParticles");
    85     Rocket::trailParticles->setMaterialTexture("maps/radial-trans-noise.png");
    86     Rocket::trailParticles->setLifeSpan(1.0, .3);
    87     Rocket::trailParticles->setRadius(0.0, .5);
    88     Rocket::trailParticles->setRadius(0.2, 2.0);
    89     Rocket::trailParticles->setRadius(.5, .8);
    90     Rocket::trailParticles->setRadius(1.0, .8);
    91     Rocket::trailParticles->setColor(0.0, 1,0,0,.7);
    92     Rocket::trailParticles->setColor(0.2, .8,.8,0,.5);
    93     Rocket::trailParticles->setColor(0.5, .8,.8,.8,.8);
    94     Rocket::trailParticles->setColor(1.0, .8,.8,.8,.0);
     78    Hyperblast::extParticles = new SpriteParticles(2000);
     79    Hyperblast::extParticles->setName("HyperblastTrailParticles");
     80    Hyperblast::extParticles->setMaterialTexture("maps/radial-trans-noise.png");
     81    Hyperblast::extParticles->setLifeSpan(1.0, .3);
     82    Hyperblast::extParticles->setRadius(0.0, .5);
     83    Hyperblast::extParticles->setRadius(0.2, 2.0);
     84    Hyperblast::extParticles->setRadius(.5, .8);
     85    Hyperblast::extParticles->setRadius(1.0, .8);
     86    Hyperblast::extParticles->setColor(0.0, 1,0,0,.7);
     87    Hyperblast::extParticles->setColor(0.2, .8,.8,0,.5);
     88    Hyperblast::extParticles->setColor(0.5, .8,.8,.8,.8);
     89    Hyperblast::extParticles->setColor(1.0, .8,.8,.8,.0);
    9590  }
    96   if (unlikely(Rocket::explosionParticles == NULL))
     91  if (unlikely(Hyperblast::explosionParticles == NULL))
    9792  {
    98     Rocket::explosionParticles = new SpriteParticles(200);
    99     Rocket::explosionParticles->setName("RocketExplosionParticles");
    100     Rocket::explosionParticles->setMaterialTexture("maps/radial-trans-noise.png");
    101     Rocket::explosionParticles->setLifeSpan(.5, .3);
    102     Rocket::explosionParticles->setRadius(0.0, 10);
    103     Rocket::explosionParticles->setRadius(.5, 15.0);
    104     Rocket::explosionParticles->setRadius(1.0, 10.0);
    105     Rocket::explosionParticles->setColor(0.0, 0,1,0,1);
    106     Rocket::explosionParticles->setColor(0.5, .8,.8,0,.8);
    107     Rocket::explosionParticles->setColor(0.8, .8,.8,.3,.8);
    108     Rocket::explosionParticles->setColor(1.0, 1,1,1,.0);
     93    Hyperblast::explosionParticles = new SparkParticles(200);
     94    Hyperblast::explosionParticles->setName("HyperblastExplosionParticles");
     95    Hyperblast::explosionParticles->setLifeSpan(.5, .3);
     96    Hyperblast::explosionParticles->setRadius(0.0, 10);
     97    Hyperblast::explosionParticles->setRadius(.5, 15.0);
     98    Hyperblast::explosionParticles->setRadius(1.0, 10.0);
     99    Hyperblast::explosionParticles->setColor(0.0, 0,1,0,1);
     100    Hyperblast::explosionParticles->setColor(0.5, .8,.8,0,.8);
     101    Hyperblast::explosionParticles->setColor(0.8, .8,.8,.3,.8);
     102    Hyperblast::explosionParticles->setColor(1.0, 1,1,1,.0);
    109103  }
    110104
    111   this->emitter->setSystem(Rocket::trailParticles);
     105  this->emitter->setSystem(Hyperblast::extParticles);
    112106
    113107  this->updateNode(0);
     
    117111
    118112
    119 void Rocket::deactivate()
     113void Hyperblast::deactivate()
    120114{
    121115  this->emitter->setSystem(NULL);
     
    125119//  GarbageCollector::getInstance()->collect(this);
    126120  this->toList(OM_DEAD);
    127   Rocket::fastFactory->kill(this);
     121  Hyperblast::fastFactory->kill(this);
    128122}
    129123
    130124
    131 void Rocket::collidesWith(WorldEntity* entity, const Vector& location)
     125void Hyperblast::collidesWith(WorldEntity* entity, const Vector& location)
    132126{
    133127  if (this->hitEntity != entity)
     
    140134 * @param time since last tick
    141135*/
    142 void Rocket::tick (float dt)
     136void Hyperblast::tick (float dt)
    143137{
    144138  //Vector v = *this->flightDirection * ( this->speed * time * 1000 + 0.1);
     
    153147 *  the function gets called, when the projectile is destroyed
    154148*/
    155 void Rocket::destroy ()
     149void Hyperblast::destroy ()
    156150{
    157   PRINTF(5)("DESTROY Rocket\n");
     151  PRINTF(5)("DESTROY Hyperblast\n");
    158152  this->lifeCycle = .95; //!< @todo calculate this usefully.
    159   this->emitter->setSystem(Rocket::explosionParticles);
     153  this->emitter->setSystem(Hyperblast::explosionParticles);
    160154
    161155  this->emitter->setEmissionRate(1000.0);
     
    166160
    167161
    168 void Rocket::draw () const
     162void Hyperblast::draw () const
    169163{
    170164  glMatrixMode(GL_MODELVIEW);
  • trunk/src/world_entities/projectiles/hyperblast.h

    r6807 r6810  
    11/*!
    2  * @file rocket.h
    3  * @brief a Rocket Projectile
     2 * @file hyperblast.h
     3 * @brief a Hyperblast Projectile
    44*/
    55
    6 #ifndef _ROCKET_H
    7 #define _ROCKET_H
     6#ifndef _HYPERBLAST_H
     7#define _HYPERBLAST_H
    88
    99#include "projectile.h"
     
    1212class Weapon;
    1313class SpriteParticles;
     14class SparkParticles;
    1415class ParticleEmitter;
    1516class FastFactory;
    1617
    17 class Rocket : public Projectile
     18class Hyperblast : public Projectile
    1819{
    1920  public:
    20     Rocket ();
    21     virtual ~Rocket ();
     21    Hyperblast ();
     22    virtual ~Hyperblast ();
    2223
    2324
     
    3536  private:
    3637    static FastFactory*               fastFactory;
    37     static SpriteParticles*           trailParticles;
    38     static SpriteParticles*           explosionParticles;
     38    static SpriteParticles*           extParticles;
     39    static SparkParticles*            explosionParticles;
    3940
    4041    ParticleEmitter*                  emitter;
    4142
    42 
    4343    WorldEntity* hitEntity; // FIXME TEMPORARY
    44 
    4544};
    4645
    47 #endif /* _ROCKET_H */
     46#endif /* _HYPERBLAST_H */
Note: See TracChangeset for help on using the changeset viewer.