Changeset 6810 in orxonox.OLD for trunk/src/world_entities
- Timestamp:
- Jan 28, 2006, 3:30:54 PM (19 years ago)
- Location:
- trunk/src/world_entities
- Files:
-
- 1 edited
- 4 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/world_entities/Makefile.am
r6731 r6810 35 35 world_entities/weapons/targeting_turret.cc \ 36 36 world_entities/weapons/cannon.cc \ 37 world_entities/weapons/hyperblaster.cc \ 37 38 world_entities/weapons/aim.cc \ 38 39 world_entities/weapons/crosshair.cc \ … … 44 45 world_entities/projectiles/rocket.cc \ 45 46 world_entities/projectiles/guided_missile.cc \ 47 world_entities/projectiles/hyperblast.cc \ 46 48 \ 47 49 world_entities/power_ups/power_up.cc \ -
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 */ -
trunk/src/world_entities/weapons/hyperblaster.cc
r6807 r6810 12 12 13 13 ### File Specific 14 main-programmer: Patrick Boenzli14 main-programmer: Benjamin Grauer 15 15 co-programmer: 16 16 … … 21 21 #define DEBUG_SPECIAL_MODULE DEBUG_MODULE_WEAPON 22 22 23 #include " cannon.h"23 #include "hyperblaster.h" 24 24 25 25 #include "world_entity.h" … … 38 38 using namespace std; 39 39 40 CREATE_FACTORY( Cannon, CL_CANNON);40 CREATE_FACTORY(Hyperblaster, CL_HYPERBLASTER); 41 41 42 /** 43 * standard constructor 44 45 creates a new weapon 46 */ 47 Cannon::Cannon () 48 : Weapon() 49 { 50 this->init(); 51 } 52 53 54 Cannon::Cannon(const TiXmlElement* root) 42 Hyperblaster::Hyperblaster(const TiXmlElement* root) 55 43 { 56 44 this->init(); … … 62 50 * standard deconstructor 63 51 */ 64 Cannon::~Cannon()52 Hyperblaster::~Hyperblaster () 65 53 { 66 54 // model will be deleted from WorldEntity-destructor … … 68 56 69 57 70 void Cannon::init()58 void Hyperblaster::init() 71 59 { 72 this->setClassID(CL_ CANNON, "Cannon");60 this->setClassID(CL_HYPERBLASTER, "Hyperblaster"); 73 61 74 62 // this->model = (Model*)ResourceManager::getInstance()->load("models/guns/test_gun.obj", OBJ, RP_CAMPAIGN); … … 77 65 78 66 this->setStateDuration(WS_SHOOTING, 2.0); 79 this->setStateDuration(WS_RELOADING, .1);67 this->setStateDuration(WS_RELOADING, 5.0); 80 68 this->setStateDuration(WS_ACTIVATING, .1); 81 69 this->setStateDuration(WS_DEACTIVATING, .4); 82 70 83 this->setEnergyMax(10 0);84 this->increaseEnergy(10 0);71 this->setEnergyMax(10); 72 this->increaseEnergy(10); 85 73 //this->minCharge = 2; 86 74 87 75 this->setActionSound(WA_SHOOT, "sound/explo.wav"); 88 this->setActionSound(WA_ACTIVATE, "sound/voices/ cannon.wav");76 this->setActionSound(WA_ACTIVATE, "sound/voices/hyperblaster.wav"); 89 77 90 78 this->setCapability(WTYPE_ALLDIRS | WTYPE_DIRECTIONAL | WTYPE_HEAVY); 91 this->setProjectileType(CL_ BOMB);92 this->prepareProjectiles( 5);79 this->setProjectileType(CL_HYPERBLAST); 80 this->prepareProjectiles(2); 93 81 94 82 // this->objectComponent1 = new PNode(); … … 109 97 // animation1->addKeyFrame(Vector(0, 0, 0), Quaternion(), 0.0, ANIM_LINEAR, ANIM_NULL); 110 98 111 animation2->addKeyFrame(Vector(0.0, -1.0, 0.0), Quaternion(), 0.3, ANIM_LINEAR, ANIM_NULL); 99 animation2->addKeyFrame(Vector(1.0, -1.0, 0.0), Quaternion(), 0.3, ANIM_LINEAR, ANIM_NULL); 100 animation2->addKeyFrame(Vector(1.0, 0.0, 0.0), Quaternion(), 0.3, ANIM_LINEAR, ANIM_NULL); 112 101 animation2->addKeyFrame(Vector(0.0, 0.0, 0.0), Quaternion(), 0.3, ANIM_LINEAR, ANIM_NULL); 113 102 114 103 animation3->addKeyFrame(Vector(0.0, 0.0, 0.0), Quaternion(), 0.3, ANIM_LINEAR, ANIM_NULL); 115 animation3->addKeyFrame(Vector(0.0, -1.0, 0.0), Quaternion(), 0.3, ANIM_LINEAR, ANIM_NULL); 104 animation3->addKeyFrame(Vector(1.0, -1.0, 0.0), Quaternion(), 0.3, ANIM_LINEAR, ANIM_NULL); 105 animation2->addKeyFrame(Vector(1.0, -1.0, 0.0), Quaternion(), 0.3, ANIM_LINEAR, ANIM_NULL); 116 106 } 117 107 118 108 119 void Cannon::loadParams(const TiXmlElement* root)109 void Hyperblaster::loadParams(const TiXmlElement* root) 120 110 { 121 111 Weapon::loadParams(root); … … 130 120 been armed out. 131 121 */ 132 void Cannon::activate()122 void Hyperblaster::activate() 133 123 { 134 124 } … … 142 132 been armed out. 143 133 */ 144 void Cannon::deactivate()134 void Hyperblaster::deactivate() 145 135 { 146 136 } … … 153 143 @todo: the ObjectManager deliveres Projectiles not TestBullets! this should be diffrent 154 144 */ 155 void Cannon::fire()145 void Hyperblaster::fire() 156 146 { 157 147 Projectile* pj = this->getProjectile(); … … 174 164 * hit, it can also be destoryed. 175 165 */ 176 void Cannon::destroy ()166 void Hyperblaster::destroy () 177 167 {} 178 179 /**180 * this will draw the weapon181 */182 void Cannon::draw () const183 {184 /* draw gun body */185 glMatrixMode(GL_MODELVIEW);186 glPushMatrix();187 glTranslatef (this->getAbsCoor ().x,188 this->getAbsCoor ().y,189 this->getAbsCoor ().z);190 191 Vector tmpRot = this->getAbsDir().getSpacialAxis();192 glRotatef (this->getAbsDir().getSpacialAxisAngle(), tmpRot.x, tmpRot.y, tmpRot.z );193 194 this->getModel()->draw();195 glPopMatrix();196 197 /* draw objectComponent1: gun coil - animated stuff */198 /* glMatrixMode(GL_MODELVIEW);199 glPushMatrix();200 glTranslatef (this->objectComponent1->getAbsCoor ().x,201 this->objectComponent1->getAbsCoor ().y,202 this->objectComponent1->getAbsCoor ().z);203 tmpRot = this->objectComponent1->getAbsDir().getSpacialAxis();204 glRotatef (this->objectComponent1->getAbsDir().getSpacialAxisAngle(), tmpRot.x, tmpRot.y, tmpRot.z );205 this->model->draw(0);206 207 glPopMatrix();*/208 }209 -
trunk/src/world_entities/weapons/hyperblaster.h
r6807 r6810 1 1 /*! 2 * @file cannon.h3 * a weapon that is fix on top of the player to fire heavy weaponary.2 * @file hyperblaster.h 3 * a weapon that to fire heavy weaponary Hyperblasts. 4 4 */ 5 5 6 6 7 #ifndef _ CANNON_H8 #define _ CANNON_H7 #ifndef _HYPERBLASTER_H 8 #define _HYPERBLASTER_H 9 9 10 10 #include "weapon.h" 11 11 12 class Cannon: public Weapon12 class Hyperblaster : public Weapon 13 13 { 14 14 public: 15 Cannon (); 16 Cannon (const TiXmlElement* root); 17 virtual ~Cannon (); 15 Hyperblaster (const TiXmlElement* root = NULL); 16 virtual ~Hyperblaster (); 18 17 19 18 void init(); … … 26 25 virtual void destroy(); 27 26 28 virtual void draw() const;29 30 27 private: 31 28 // PNode* objectComponent1; //<! the gun is made of multiple parts, these PNodes represent their location and orientation 32 29 }; 33 #endif /* _ CANNON_H */30 #endif /* _HYPERBLASTER_H */
Note: See TracChangeset
for help on using the changeset viewer.