Changeset 6810 in orxonox.OLD for trunk/src/world_entities/projectiles
- Timestamp:
- Jan 28, 2006, 3:30:54 PM (19 years ago)
- Location:
- trunk/src/world_entities/projectiles
- Files:
-
- 2 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/world_entities/projectiles/hyperblast.cc
r6807 r6810 10 10 11 11 ### File Specific 12 main-programmer: Patrick Boenzli13 co-programmer: Benjamin Grauer12 main-programmer: Benjamin Grauer 13 co-programmer: ... 14 14 15 15 */ 16 16 #define DEBUG_SPECIAL_MODULE DEBUG_MODULE_WEAPON 17 17 18 #include " rocket.h"18 #include "hyperblast.h" 19 19 20 20 #include "fast_factory.h" … … 25 25 #include "particle_emitter.h" 26 26 #include "sprite_particles.h" 27 #include "spark_particles.h" 27 28 28 29 29 30 using namespace std; 30 31 31 CREATE_FAST_FACTORY_STATIC( Rocket, CL_ROCKET);32 CREATE_FAST_FACTORY_STATIC(Hyperblast, CL_HYPERBLAST); 32 33 33 34 /** 34 35 * standard constructor 35 36 */ 36 Rocket::Rocket () : Projectile()37 Hyperblast::Hyperblast () : Projectile() 37 38 { 38 this->setClassID(CL_ ROCKET, "Rocket");39 this->setClassID(CL_HYPERBLAST, "Hyperblast"); 39 40 40 41 float modelSize = .3; 41 this->loadModel("models/projectiles/orx- rocket.obj", .3);42 this->loadModel("models/projectiles/orx-hyperblast.obj", .3); 42 43 43 44 this->setMinEnergy(1); … … 54 55 * standard deconstructor 55 56 */ 56 Rocket::~Rocket ()57 Hyperblast::~Hyperblast () 57 58 { 58 // delete this->emitter;59 60 59 /* 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) 62 61 { 63 /* if (ClassList::exists(Rocket::trailParticles, CL_PARTICLE_SYSTEM)) 64 delete Rocket::trailParticles;*/ 65 Rocket::trailParticles = NULL; 62 Hyperblast::extParticles = NULL; 66 63 } 67 if ( Rocket::explosionParticles != NULL && ClassList::getList(CL_ROCKET)->size() <= 1)64 if (Hyperblast::explosionParticles != NULL && ClassList::getList(CL_HYPERBLAST)->size() <= 1) 68 65 { 69 /* if (ClassList::exists(Rocket::explosionParticles, CL_PARTICLE_SYSTEM)) 70 delete Rocket::explosionParticles;*/ 71 Rocket::explosionParticles = NULL; 66 Hyperblast::explosionParticles = NULL; 72 67 } 73 68 74 69 } 75 70 76 SpriteParticles* Rocket::trailParticles = NULL;77 Sp riteParticles* Rocket::explosionParticles = NULL;71 SpriteParticles* Hyperblast::extParticles = NULL; 72 SparkParticles* Hyperblast::explosionParticles = NULL; 78 73 79 void Rocket::activate()74 void Hyperblast::activate() 80 75 { 81 if (unlikely( Rocket::trailParticles == NULL))76 if (unlikely(Hyperblast::extParticles == NULL)) 82 77 { 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); 95 90 } 96 if (unlikely( Rocket::explosionParticles == NULL))91 if (unlikely(Hyperblast::explosionParticles == NULL)) 97 92 { 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); 109 103 } 110 104 111 this->emitter->setSystem( Rocket::trailParticles);105 this->emitter->setSystem(Hyperblast::extParticles); 112 106 113 107 this->updateNode(0); … … 117 111 118 112 119 void Rocket::deactivate()113 void Hyperblast::deactivate() 120 114 { 121 115 this->emitter->setSystem(NULL); … … 125 119 // GarbageCollector::getInstance()->collect(this); 126 120 this->toList(OM_DEAD); 127 Rocket::fastFactory->kill(this);121 Hyperblast::fastFactory->kill(this); 128 122 } 129 123 130 124 131 void Rocket::collidesWith(WorldEntity* entity, const Vector& location)125 void Hyperblast::collidesWith(WorldEntity* entity, const Vector& location) 132 126 { 133 127 if (this->hitEntity != entity) … … 140 134 * @param time since last tick 141 135 */ 142 void Rocket::tick (float dt)136 void Hyperblast::tick (float dt) 143 137 { 144 138 //Vector v = *this->flightDirection * ( this->speed * time * 1000 + 0.1); … … 153 147 * the function gets called, when the projectile is destroyed 154 148 */ 155 void Rocket::destroy ()149 void Hyperblast::destroy () 156 150 { 157 PRINTF(5)("DESTROY Rocket\n");151 PRINTF(5)("DESTROY Hyperblast\n"); 158 152 this->lifeCycle = .95; //!< @todo calculate this usefully. 159 this->emitter->setSystem( Rocket::explosionParticles);153 this->emitter->setSystem(Hyperblast::explosionParticles); 160 154 161 155 this->emitter->setEmissionRate(1000.0); … … 166 160 167 161 168 void Rocket::draw () const162 void Hyperblast::draw () const 169 163 { 170 164 glMatrixMode(GL_MODELVIEW); -
trunk/src/world_entities/projectiles/hyperblast.h
r6807 r6810 1 1 /*! 2 * @file rocket.h3 * @brief a Rocket Projectile2 * @file hyperblast.h 3 * @brief a Hyperblast Projectile 4 4 */ 5 5 6 #ifndef _ ROCKET_H7 #define _ ROCKET_H6 #ifndef _HYPERBLAST_H 7 #define _HYPERBLAST_H 8 8 9 9 #include "projectile.h" … … 12 12 class Weapon; 13 13 class SpriteParticles; 14 class SparkParticles; 14 15 class ParticleEmitter; 15 16 class FastFactory; 16 17 17 class Rocket : public Projectile18 class Hyperblast : public Projectile 18 19 { 19 20 public: 20 Rocket ();21 virtual ~ Rocket ();21 Hyperblast (); 22 virtual ~Hyperblast (); 22 23 23 24 … … 35 36 private: 36 37 static FastFactory* fastFactory; 37 static SpriteParticles* trailParticles;38 static Sp riteParticles*explosionParticles;38 static SpriteParticles* extParticles; 39 static SparkParticles* explosionParticles; 39 40 40 41 ParticleEmitter* emitter; 41 42 42 43 43 WorldEntity* hitEntity; // FIXME TEMPORARY 44 45 44 }; 46 45 47 #endif /* _ ROCKET_H */46 #endif /* _HYPERBLAST_H */
Note: See TracChangeset
for help on using the changeset viewer.