Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jul 4, 2006, 7:07:09 PM (18 years ago)
Author:
bensch
Message:

added proj

Location:
branches/presentation/src/world_entities/projectiles
Files:
2 copied

Legend:

Unmodified
Added
Removed
  • branches/presentation/src/world_entities/projectiles/rail_projectiles.cc

    r9164 r9165  
    1616#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_WEAPON
    1717
    18 #include "laser.h"
     18#include "rail_projectile.h"
    1919
    2020#include "state.h"
     
    3030using namespace std;
    3131
    32 CREATE_FAST_FACTORY_STATIC(Laser, CL_LASER);
     32CREATE_FAST_FACTORY_STATIC(RailProjectile, CL_RAIL_PROJECTILE);
    3333
    3434/**
    3535 *  standard constructor
    3636*/
    37 Laser::Laser () : Projectile()
     37RailProjectile::RailProjectile () : Projectile()
    3838{
    39   this->setClassID(CL_LASER, "Laser");
     39  this->setClassID(CL_RAIL_PROJECTILE, "RailProjectile");
    4040
    41   this->loadModel("models/projectiles/laser.obj");
     41  this->loadModel("models/projectiles/rail_projectile.obj");
    4242
    4343  this->setMinEnergy(10);
     
    5656 *  standard deconstructor
    5757*/
    58 Laser::~Laser ()
     58RailProjectile::~RailProjectile ()
    5959{
    6060  // delete this->emitter;
    6161
    6262  /* this is normaly done by World.cc by deleting the ParticleEngine */
    63   if (Laser::explosionParticles != NULL && ClassList::getList(CL_LASER)->size() <= 1)
     63  if (RailProjectile::explosionParticles != NULL && ClassList::getList(CL_RAIL_PROJECTILE)->size() <= 1)
    6464  {
    65     //if (ClassList::exists(Laser::explosionParticles, CL_PARTICLE_SYSTEM))
    66     //  delete Laser::explosionParticles;
    67     PRINTF(1)("Deleting Laser Particles\n");
    68     Laser::explosionParticles = NULL;
     65    //if (ClassList::exists(RailProjectile::explosionParticles, CL_PARTICLE_SYSTEM))
     66    //  delete RailProjectile::explosionParticles;
     67    PRINTF(1)("Deleting RailProjectile Particles\n");
     68    RailProjectile::explosionParticles = NULL;
    6969  }
    7070
    7171}
    7272
    73 SpriteParticles* Laser::explosionParticles = NULL;
     73SpriteParticles* RailProjectile::explosionParticles = NULL;
    7474
    75 void Laser::activate()
     75void RailProjectile::activate()
    7676{
    77   if (unlikely(Laser::explosionParticles == NULL))
     77  if (unlikely(RailProjectile::explosionParticles == NULL))
    7878  {
    79     Laser::explosionParticles = new SpriteParticles(1000);
    80     Laser::explosionParticles->setName("LaserExplosionParticles");
    81     Laser::explosionParticles->setLifeSpan(.5, .3);
    82     Laser::explosionParticles->setRadius(0.0, 10.0);
    83     Laser::explosionParticles->setRadius(.5, 6.0);
    84     Laser::explosionParticles->setRadius(1.0, 3.0);
    85     Laser::explosionParticles->setColor(0.0, 1,1,0,.9);
    86     Laser::explosionParticles->setColor(0.5, .8,.8,0,.5);
    87     Laser::explosionParticles->setColor(1.0, .8,.8,.7,.0);
     79    RailProjectile::explosionParticles = new SpriteParticles(1000);
     80    RailProjectile::explosionParticles->setName("RailProjectileExplosionParticles");
     81    RailProjectile::explosionParticles->setLifeSpan(.5, .3);
     82    RailProjectile::explosionParticles->setRadius(0.0, 10.0);
     83    RailProjectile::explosionParticles->setRadius(.5, 6.0);
     84    RailProjectile::explosionParticles->setRadius(1.0, 3.0);
     85    RailProjectile::explosionParticles->setColor(0.0, 1,1,0,.9);
     86    RailProjectile::explosionParticles->setColor(0.5, .8,.8,0,.5);
     87    RailProjectile::explosionParticles->setColor(1.0, .8,.8,.7,.0);
    8888  }
    8989
     
    9292
    9393
    94 void Laser::deactivate()
     94void RailProjectile::deactivate()
    9595{
    96   assert (Laser::explosionParticles != NULL);
    97   Laser::explosionParticles->removeEmitter(this->emitter);
     96  assert (RailProjectile::explosionParticles != NULL);
     97  RailProjectile::explosionParticles->removeEmitter(this->emitter);
    9898  this->lifeCycle = 0.0;
    9999
    100100  this->toList(OM_NULL);
    101101  this->removeNode();
    102   Laser::fastFactory->kill(this);
     102  RailProjectile::fastFactory->kill(this);
    103103}
    104104
    105105
    106 void Laser::collidesWith(WorldEntity* entity, const Vector& location)
     106void RailProjectile::collidesWith(WorldEntity* entity, const Vector& location)
    107107{
    108108  if (this->hitEntity != entity && entity->isA(CL_NPC))
     
    115115 * @param dt time since last tick
    116116*/
    117 void Laser::tick (float dt)
     117void RailProjectile::tick (float dt)
    118118{
    119119  //Vector v = *this->flightDirection * ( this->speed * time * 1000 + 0.1);
     
    128128 *  the function gets called, when the projectile is destroyed
    129129*/
    130 void Laser::destroy (WorldEntity* killer)
     130void RailProjectile::destroy (WorldEntity* killer)
    131131{
    132132  Projectile::destroy( killer );
    133   PRINTF(5)("DESTROY Laser\n");
     133  PRINTF(5)("DESTROY RailProjectile\n");
    134134  this->lifeCycle = .95; //!< @todo calculate this usefully.
    135135
    136   this->emitter->setSystem(Laser::explosionParticles);
     136  this->emitter->setSystem(RailProjectile::explosionParticles);
    137137}
    138138
    139139
    140 void Laser::draw () const
     140void RailProjectile::draw () const
    141141{
    142142  glPushAttrib(GL_ENABLE_BIT);
  • branches/presentation/src/world_entities/projectiles/rail_projectiles.h

    r9164 r9165  
    11/*!
    2  * @file laser.h
     2 * @file rail_projectile.h
    33 * @brief a projectile, that is been shooted by a weapon
    44*/
    55
    6 #ifndef _LASER_H
    7 #define _LASER_H
     6#ifndef _RAIL_PROJECTILE_H
     7#define _RAIL_PROJECTILE_H
    88
    99#include "projectile.h"
     
    1515class FastFactory;
    1616
    17 class Laser : public Projectile
     17class RailProjectile : public Projectile
    1818{
    1919  public:
    20     Laser ();
    21     virtual ~Laser ();
     20    RailProjectile ();
     21    virtual ~RailProjectile ();
    2222
    2323
     
    4444};
    4545
    46 #endif /* _LASER_H */
     46#endif /* _RAIL_PROJECTILE_H */
Note: See TracChangeset for help on using the changeset viewer.