Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Nov 24, 2005, 3:06:54 PM (19 years ago)
Author:
snellen
Message:

guided_missile updated

Location:
branches/guidedmissile/src/world_entities/weapons
Files:
2 copied

Legend:

Unmodified
Added
Removed
  • branches/guidedmissile/src/world_entities/weapons/guided_missile.cc

    r5758 r5759  
    1010
    1111   ### File Specific
    12    main-programmer: Patrick Boenzli
    13    co-programmer: Benjamin Grauer
     12   main-programmer: Silvan Nellen
     13   co-programmer:
    1414
    1515*/
    1616#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_WEAPON
    1717
    18 #include "rocket.h"
     18#include "guided_missile.h"
    1919
    2020#include "fast_factory.h"
     
    3232using namespace std;
    3333
    34 CREATE_FAST_FACTORY_STATIC(Rocket, CL_ROCKET);
     34CREATE_FAST_FACTORY_STATIC(GuidedMissile, CL_GUIDED_MISSILE);
    3535
    3636/**
    3737 *  standard constructor
    3838*/
    39 Rocket::Rocket () : Projectile()
     39GuidedMissile::GuidedMissile () : Projectile()
    4040{
    41   this->setClassID(CL_TEST_BULLET, "Rocket");
     41  this->setClassID(CL_GUIDED_MISSILE, "GuidedMissile");
    4242
    4343  float modelSize = .3;
    44   this->loadModel("models/projectiles/orx-rocket.obj", .3);
     44  this->loadModel("models/projectiles/orx-guided_missile.obj", .3);
    4545
    4646  this->energyMin = 1;
     
    5858 *  standard deconstructor
    5959*/
    60 Rocket::~Rocket ()
     60GuidedMissile::~GuidedMissile ()
    6161{
    6262  // delete this->emitter;
    6363
    6464  /* this is normaly done by World.cc by deleting the ParticleEngine */
    65   if (Rocket::trailParticles != NULL && ClassList::getList(CL_TEST_BULLET)->getSize() <= 1)
     65  if (GuidedMissile::trailParticles != NULL && ClassList::getList(CL_TEST_BULLET)->getSize() <= 1)
    6666  {
    67     if (ClassList::exists(Rocket::trailParticles, CL_PARTICLE_SYSTEM))
    68       delete Rocket::trailParticles;
    69     Rocket::trailParticles = NULL;
     67    if (ClassList::exists(GuidedMissile::trailParticles, CL_PARTICLE_SYSTEM))
     68      delete GuidedMissile::trailParticles;
     69    GuidedMissile::trailParticles = NULL;
    7070  }
    71   if (Rocket::explosionParticles != NULL && ClassList::getList(CL_TEST_BULLET)->getSize() <= 1)
     71  if (GuidedMissile::explosionParticles != NULL && ClassList::getList(CL_TEST_BULLET)->getSize() <= 1)
    7272  {
    73     if (ClassList::exists(Rocket::explosionParticles, CL_PARTICLE_SYSTEM))
    74       delete Rocket::explosionParticles;
    75     Rocket::explosionParticles = NULL;
     73    if (ClassList::exists(GuidedMissile::explosionParticles, CL_PARTICLE_SYSTEM))
     74      delete GuidedMissile::explosionParticles;
     75    GuidedMissile::explosionParticles = NULL;
    7676  }
    7777
    7878}
    7979
    80 ParticleSystem* Rocket::trailParticles = NULL;
    81 ParticleSystem* Rocket::explosionParticles = NULL;
     80ParticleSystem* GuidedMissile::trailParticles = NULL;
     81ParticleSystem* GuidedMissile::explosionParticles = NULL;
    8282
    83 void Rocket::activate()
     83void GuidedMissile::activate()
    8484{
    8585  State::getWorldEntityList()->add(this);
    86   if (unlikely(Rocket::trailParticles == NULL))
     86  if (unlikely(GuidedMissile::trailParticles == NULL))
    8787  {
    88     Rocket::trailParticles = new ParticleSystem(2000, PARTICLE_SPRITE);
    89     Rocket::trailParticles->setName("RocketTrailParticles");
    90     Rocket::trailParticles->setMaterialTexture("maps/radial-trans-noise.png");
    91     Rocket::trailParticles->setLifeSpan(1.0, .3);
    92     Rocket::trailParticles->setRadius(0.0, .5);
    93     Rocket::trailParticles->setRadius(0.2, 2.0);
    94     Rocket::trailParticles->setRadius(.5, .8);
    95     Rocket::trailParticles->setRadius(1.0, .8);
    96     Rocket::trailParticles->setColor(0.0, 1,0,0,.7);
    97     Rocket::trailParticles->setColor(0.2, .8,.8,0,.5);
    98     Rocket::trailParticles->setColor(0.5, .8,.8,.8,.8);
    99     Rocket::trailParticles->setColor(1.0, .8,.8,.8,.0);
     88    GuidedMissile::trailParticles = new ParticleSystem(2000, PARTICLE_SPRITE);
     89    GuidedMissile::trailParticles->setName("GuidedMissileTrailParticles");
     90    GuidedMissile::trailParticles->setMaterialTexture("maps/radial-trans-noise.png");
     91    GuidedMissile::trailParticles->setLifeSpan(1.0, .3);
     92    GuidedMissile::trailParticles->setRadius(0.0, .5);
     93    GuidedMissile::trailParticles->setRadius(0.2, 2.0);
     94    GuidedMissile::trailParticles->setRadius(.5, .8);
     95    GuidedMissile::trailParticles->setRadius(1.0, .8);
     96    GuidedMissile::trailParticles->setColor(0.0, 1,0,0,.7);
     97    GuidedMissile::trailParticles->setColor(0.2, .8,.8,0,.5);
     98    GuidedMissile::trailParticles->setColor(0.5, .8,.8,.8,.8);
     99    GuidedMissile::trailParticles->setColor(1.0, .8,.8,.8,.0);
    100100  }
    101   if (unlikely(Rocket::explosionParticles == NULL))
     101  if (unlikely(GuidedMissile::explosionParticles == NULL))
    102102  {
    103     Rocket::explosionParticles = new ParticleSystem(200, PARTICLE_SPRITE);
    104     Rocket::explosionParticles->setName("RocketExplosionParticles");
    105     Rocket::explosionParticles->setMaterialTexture("maps/radial-trans-noise.png");
    106     Rocket::explosionParticles->setLifeSpan(.5, .3);
    107     Rocket::explosionParticles->setRadius(0.0, 10);
    108     Rocket::explosionParticles->setRadius(.5, 15.0);
    109     Rocket::explosionParticles->setRadius(1.0, 10.0);
    110     Rocket::explosionParticles->setColor(0.0, 0,1,0,1);
    111     Rocket::explosionParticles->setColor(0.5, .8,.8,0,.8);
    112     Rocket::explosionParticles->setColor(0.8, .8,.8,.3,.8);
    113     Rocket::explosionParticles->setColor(1.0, 1,1,1,.0);
     103    GuidedMissile::explosionParticles = new ParticleSystem(200, PARTICLE_SPRITE);
     104    GuidedMissile::explosionParticles->setName("GuidedMissileExplosionParticles");
     105    GuidedMissile::explosionParticles->setMaterialTexture("maps/radial-trans-noise.png");
     106    GuidedMissile::explosionParticles->setLifeSpan(.5, .3);
     107    GuidedMissile::explosionParticles->setRadius(0.0, 10);
     108    GuidedMissile::explosionParticles->setRadius(.5, 15.0);
     109    GuidedMissile::explosionParticles->setRadius(1.0, 10.0);
     110    GuidedMissile::explosionParticles->setColor(0.0, 0,1,0,1);
     111    GuidedMissile::explosionParticles->setColor(0.5, .8,.8,0,.8);
     112    GuidedMissile::explosionParticles->setColor(0.8, .8,.8,.3,.8);
     113    GuidedMissile::explosionParticles->setColor(1.0, 1,1,1,.0);
    114114  }
    115115
    116   ParticleEngine::getInstance()->addConnection(this->emitter, Rocket::trailParticles);
     116  ParticleEngine::getInstance()->addConnection(this->emitter, GuidedMissile::trailParticles);
    117117
    118118  this->update(0);
     
    122122
    123123
    124 void Rocket::deactivate()
     124void GuidedMissile::deactivate()
    125125{
    126126  ParticleEngine::getInstance()->breakConnections(this->emitter);
     
    129129//  GarbageCollector::getInstance()->collect(this);
    130130  State::getWorldEntityList()->remove(this);
    131   Rocket::fastFactory->kill(this);
     131  GuidedMissile::fastFactory->kill(this);
    132132}
    133133
    134134
    135 void Rocket::collidesWith(WorldEntity* entity, const Vector& location)
     135void GuidedMissile::collidesWith(WorldEntity* entity, const Vector& location)
    136136{
    137137  if (this->hitEntity != entity && entity->isA(CL_NPC))
     
    144144 * @param time since last tick
    145145*/
    146 void Rocket::tick (float time)
     146void GuidedMissile::tick (float time)
    147147{
    148148  //Vector v = *this->flightDirection * ( this->speed * time * 1000 + 0.1);
     
    164164 *  the function gets called, when the projectile is destroyed
    165165*/
    166 void Rocket::destroy ()
     166void GuidedMissile::destroy ()
    167167{
    168   PRINTF(5)("DESTROY Rocket\n");
     168  PRINTF(5)("DESTROY GuidedMissile\n");
    169169  this->lifeCycle = .95; //!< @todo calculate this usefully.
    170   ParticleEngine::getInstance()->breakConnection(this->emitter, Rocket::trailParticles);
    171   ParticleEngine::getInstance()->addConnection(this->emitter, Rocket::explosionParticles);
     170  ParticleEngine::getInstance()->breakConnection(this->emitter, GuidedMissile::trailParticles);
     171  ParticleEngine::getInstance()->addConnection(this->emitter, GuidedMissile::explosionParticles);
    172172
    173173  this->emitter->setEmissionRate(1000.0);
     
    178178
    179179
    180 void Rocket::draw () const
     180void GuidedMissile::draw () const
    181181{
    182182  glMatrixMode(GL_MODELVIEW);
  • branches/guidedmissile/src/world_entities/weapons/guided_missile.h

    r5758 r5759  
    11/*!
    2  * @file rocket.h
    3  * @brief a Rocket Projectile
     2 * @file guided_missile.h
     3 * @brief a GuidedMissile Projectile
    44*/
    55
    6 #ifndef _ROCKET_H
    7 #define _ROCKET_H
     6#ifndef _GUIDED_MISSILE_H
     7#define _GUIDED_MISSILE_H
    88
    99#include "projectile.h"
     
    1414class ParticleEmitter;
    1515class FastFactory;
     16class Aim;
    1617
    17 class Rocket : public Projectile
     18class GuidedMissile : public Projectile
    1819{
    1920  public:
    20     Rocket ();
    21     virtual ~Rocket ();
     21    GuidedMissile ();
     22    virtual ~GuidedMissile ();
    2223
    23 
     24    void setTarget(PNode* target);
    2425    virtual void activate();
    2526    virtual void deactivate();
     
    3940
    4041    ParticleEmitter*                  emitter;
    41 
     42    Aim*                              target;
    4243
    4344    WorldEntity* hitEntity; // FIXME TEMPORARY
     
    4546};
    4647
    47 #endif /* _ROCKET_H */
     48#endif /* _GUIDED_MISSILE_H */
Note: See TracChangeset for help on using the changeset viewer.