Changeset 9869 in orxonox.OLD for trunk/src/world_entities/projectiles
- Timestamp:
- Oct 3, 2006, 12:19:30 AM (18 years ago)
- Location:
- trunk/src/world_entities/projectiles
- Files:
-
- 18 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/world_entities/projectiles/bomb.cc
r8362 r9869 20 20 #include "primitive_model.h" 21 21 22 #include " dot_emitter.h"23 #include "particle _system.h"22 #include "particles/dot_emitter.h" 23 #include "particles/particle_system.h" 24 24 25 25 #include "debug.h" 26 26 27 CREATE_FAST_FACTORY_STATIC(Bomb, CL_BOMB); 27 #include "class_id_DEPRECATED.h" 28 ObjectListDefinitionID(Bomb, CL_BOMB); 29 CREATE_FAST_FACTORY_STATIC(Bomb); 28 30 29 31 /** … … 67 69 void Bomb::init() 68 70 { 69 this-> setClassID(CL_BOMB, "Bomb");71 this->registerObject(this, Bomb::_objectList); 70 72 71 73 … … 173 175 } 174 176 177 175 178 void Bomb::deactivate() 176 179 { … … 182 185 void Bomb::detonate(float size) 183 186 { 184 ObjectManager::EntityList detonationList; 185 ObjectManager::distanceFromObject(detonationList, *this, size, CL_NPC); 187 /// FIXME 188 /* ObjectManager::EntityList detonationList; 189 ObjectManager::distanceFromObject(detonationList, *this, size, NPC::objectList()); 186 190 while( !detonationList.empty() ) 187 191 { 188 192 detonationList.front()->collidesWith(this, Vector(0,0,0)); 189 193 detonationList.pop_front(); 190 } 194 }*/ 191 195 } -
trunk/src/world_entities/projectiles/bomb.h
r6622 r9869 17 17 class Bomb : public Projectile 18 18 { 19 19 ObjectListDeclaration(Bomb); 20 20 public: 21 21 Bomb(const TiXmlElement* root = NULL); -
trunk/src/world_entities/projectiles/boomerang_projectile.cc
r9235 r9869 20 20 21 21 #include "state.h" 22 #include "class_list.h" 23 24 #include "dot_emitter.h" 25 #include "sprite_particles.h" 22 23 #include "particles/dot_emitter.h" 24 #include "particles/sprite_particles.h" 26 25 27 26 #include "debug.h" 28 27 29 CREATE_FAST_FACTORY_STATIC(BoomerangProjectile, CL_BOOMERANG_PROJECTILE); 28 #include "class_id_DEPRECATED.h" 29 ObjectListDefinitionID(BoomerangProjectile, CL_BOOMERANG_PROJECTILE); 30 CREATE_FAST_FACTORY_STATIC(BoomerangProjectile); 30 31 31 32 /** … … 34 35 BoomerangProjectile::BoomerangProjectile () : Projectile() 35 36 { 36 this-> setClassID(CL_BOOMERANG_PROJECTILE, "BoomerangProjectile");37 this->registerObject(this, BoomerangProjectile::_objectList); 37 38 38 39 this->loadModel("models/projectiles/orx-rocket.obj", 2.0); … … 60 61 61 62 /* this is normaly done by World.cc by deleting the ParticleEngine */ 62 if (BoomerangProjectile::trailParticles != NULL && ClassList::getList(CL_BOOMERANG_PROJECTILE)->size() <= 1)63 { 64 if ( ClassList::exists(BoomerangProjectile::trailParticles, CL_PARTICLE_SYSTEM))63 if (BoomerangProjectile::trailParticles != NULL && BoomerangProjectile::objectList().size() <= 1) 64 { 65 if (ParticleSystem::objectList().exists(BoomerangProjectile::trailParticles)) 65 66 delete BoomerangProjectile::trailParticles; 66 67 BoomerangProjectile::trailParticles = NULL; 67 68 } 68 if (BoomerangProjectile::explosionParticles != NULL && ClassList::getList(CL_BOOMERANG_PROJECTILE)->size() <= 1)69 { 70 if ( ClassList::exists(BoomerangProjectile::explosionParticles, CL_PARTICLE_SYSTEM))69 if (BoomerangProjectile::explosionParticles != NULL && BoomerangProjectile::objectList().size() <= 1) 70 { 71 if (ParticleSystem::objectList().exists(BoomerangProjectile::explosionParticles)) 71 72 delete BoomerangProjectile::explosionParticles; 72 73 BoomerangProjectile::explosionParticles = NULL; -
trunk/src/world_entities/projectiles/boomerang_projectile.h
r9235 r9869 17 17 class BoomerangProjectile : public Projectile 18 18 { 19 ObjectListDeclaration(BoomerangProjectile); 19 20 public: 20 21 BoomerangProjectile (); -
trunk/src/world_entities/projectiles/guided_missile.cc
r9298 r9869 19 19 20 20 #include "state.h" 21 #include "class_list.h" 22 23 #include "dot_emitter.h" 24 #include "sprite_particles.h" 21 22 #include "particles/dot_emitter.h" 23 #include "particles/sprite_particles.h" 25 24 26 25 #include "debug.h" 27 26 28 CREATE_FAST_FACTORY_STATIC(GuidedMissile, CL_GUIDED_MISSILE); 27 #include "class_id_DEPRECATED.h" 28 ObjectListDefinitionID(GuidedMissile, CL_GUIDED_MISSILE); 29 CREATE_FAST_FACTORY_STATIC(GuidedMissile); 29 30 30 31 /** … … 33 34 GuidedMissile::GuidedMissile () : Projectile() 34 35 { 35 this-> setClassID(CL_GUIDED_MISSILE, "GuidedMissile");36 this->registerObject(this, GuidedMissile::_objectList); 36 37 37 38 this->loadModel("models/projectiles/orx-rocket.obj", 2.0); … … 59 60 60 61 /* this is normaly done by World.cc by deleting the ParticleEngine */ 61 if (GuidedMissile::trailParticles != NULL && ClassList::getList(CL_GUIDED_MISSILE)->size() <= 1)62 { 63 if ( ClassList::exists(GuidedMissile::trailParticles, CL_PARTICLE_SYSTEM))62 if (GuidedMissile::trailParticles != NULL && GuidedMissile::objectList().size() <= 1) 63 { 64 if (ParticleSystem::objectList().exists(GuidedMissile::trailParticles)) 64 65 delete GuidedMissile::trailParticles; 65 66 GuidedMissile::trailParticles = NULL; 66 67 } 67 if (GuidedMissile::explosionParticles != NULL && ClassList::getList(CL_GUIDED_MISSILE)->size() <= 1)68 { 69 if ( ClassList::exists(GuidedMissile::explosionParticles, CL_PARTICLE_SYSTEM))68 if (GuidedMissile::explosionParticles != NULL && GuidedMissile::objectList().size() <= 1) 69 { 70 if (ParticleSystem::objectList().exists(GuidedMissile::explosionParticles)) 70 71 delete GuidedMissile::explosionParticles; 71 72 GuidedMissile::explosionParticles = NULL; -
trunk/src/world_entities/projectiles/guided_missile.h
r9656 r9869 16 16 class GuidedMissile : public Projectile 17 17 { 18 ObjectListDeclaration(GuidedMissile); 18 19 public: 19 20 GuidedMissile (); -
trunk/src/world_entities/projectiles/hyperblast.cc
r9235 r9869 19 19 20 20 #include "state.h" 21 #include "class_list.h"22 21 23 #include " box_emitter.h"24 #include " spark_particles.h"22 #include "particles/box_emitter.h" 23 #include "particles/spark_particles.h" 25 24 26 25 #include "debug.h" 27 26 28 CREATE_FAST_FACTORY_STATIC(Hyperblast, CL_HYPERBLAST); 27 #include "class_id_DEPRECATED.h" 28 ObjectListDefinitionID(Hyperblast, CL_HYPERBLAST); 29 CREATE_FAST_FACTORY_STATIC(Hyperblast); 30 29 31 30 32 /** … … 33 35 Hyperblast::Hyperblast () : Projectile() 34 36 { 35 this-> setClassID(CL_HYPERBLAST, "Hyperblast");37 this->registerObject(this, Hyperblast::_objectList); 36 38 37 39 this->loadModel("models/projectiles/hyperblast.obj", 5); … … 55 57 { 56 58 /* this is normaly done by World.cc by deleting the ParticleEngine */ 57 if (Hyperblast::explosionParticles != NULL && ClassList::getList(CL_HYPERBLAST)->size() <= 1)59 if (Hyperblast::explosionParticles != NULL && Hyperblast::objectList().size() <= 1) 58 60 { 59 61 Hyperblast::explosionParticles = NULL; -
trunk/src/world_entities/projectiles/hyperblast.h
r9235 r9869 17 17 class Hyperblast : public Projectile 18 18 { 19 ObjectListDeclaration(Hyperblast); 19 20 public: 20 21 Hyperblast (); -
trunk/src/world_entities/projectiles/laser.cc
r9656 r9869 19 19 20 20 #include "state.h" 21 #include "class_list.h"22 21 #include "model.h" 23 22 24 #include " dot_emitter.h"25 #include " sprite_particles.h"23 #include "particles/dot_emitter.h" 24 #include "particles/sprite_particles.h" 26 25 27 26 #include <cassert> … … 29 28 30 29 31 32 CREATE_FAST_FACTORY_STATIC(Laser, CL_LASER); 30 #include "class_id_DEPRECATED.h" 31 ObjectListDefinition(Laser); 32 CREATE_FAST_FACTORY_STATIC(Laser); 33 33 34 34 /** … … 37 37 Laser::Laser () : Projectile() 38 38 { 39 this-> setClassID(CL_LASER, "Laser");39 this->registerObject(this, Laser::_objectList); 40 40 41 41 this->loadModel("models/projectiles/laser.obj"); … … 61 61 62 62 /* this is normaly done by World.cc by deleting the ParticleEngine */ 63 if (Laser::explosionParticles != NULL && ClassList::getList(CL_LASER)->size() <= 1)63 if (Laser::explosionParticles != NULL && Laser::objectList().size() <= 1) 64 64 { 65 65 //if (ClassList::exists(Laser::explosionParticles, CL_PARTICLE_SYSTEM)) -
trunk/src/world_entities/projectiles/laser.h
r9235 r9869 17 17 class Laser : public Projectile 18 18 { 19 ObjectListDeclaration(Laser); 19 20 public: 20 21 Laser (); -
trunk/src/world_entities/projectiles/projectile.cc
r9656 r9869 22 22 #include "world_entities/weapons/weapon.h" 23 23 #include "model.h" 24 #include " util/loading/resource_manager.h"24 #include "sound/resource_sound_buffer.h" 25 25 26 26 #include "debug.h" 27 27 28 ObjectListDefinition(Projectile); 28 29 29 30 /** … … 32 33 Projectile::Projectile () : WorldEntity() 33 34 { 34 this-> setClassID(CL_PROJECTILE, "Projectile");35 this->registerObject(this, Projectile::_objectList); 35 36 36 37 this->lifeCycle = 0.0; … … 43 44 this->setDamage(1.0f); // default damage of a projectile set to 100.0 damage points 44 45 45 this->explosionBuffer = NULL;46 this->engineBuffer = NULL;47 48 46 //this->addNodeFlags(PNODE_PROHIBIT_DELETE_WITH_PARENT); 49 47 } … … 55 53 Projectile::~Projectile () 56 54 { 57 if (this->explosionBuffer != NULL)58 ResourceManager::getInstance()->unload(this->explosionBuffer);59 if (this->engineBuffer != NULL)60 ResourceManager::getInstance()->unload(this->engineBuffer);61 55 /* 62 56 do not delete the test projectModel, since it is pnode … … 69 63 void Projectile::loadExplosionSound(const std::string& explosionSound) 70 64 { 71 if (this->explosionBuffer != NULL) 72 ResourceManager::getInstance()->unload(this->explosionBuffer); 73 74 else if (!explosionSound.empty()) 75 { 76 this->explosionBuffer = (OrxSound::SoundBuffer*)ResourceManager::getInstance()->load(explosionSound, WAV); 77 if (this->explosionBuffer != NULL) 78 { 79 PRINTF(4)("Loaded sound %s to Pickup: %s.\n", explosionSound.c_str(), this->getCName()); 80 } 81 else 82 { 83 PRINTF(2)("Failed to load sound %s to explosion %s.\n.", explosionSound.c_str(), this->getCName()); 84 } 85 } 65 if (!explosionSound.empty()) 66 this->explosionBuffer = OrxSound::ResourceSoundBuffer(explosionSound); 86 67 else 87 this->explosionBuffer = NULL;68 this->explosionBuffer = OrxSound::SoundBuffer(); 88 69 } 89 70 … … 91 72 void Projectile::loadEngineSound(const std::string& engineSound) 92 73 { 93 if (this->engineBuffer != NULL) 94 ResourceManager::getInstance()->unload(this->engineBuffer); 95 96 else if (!engineSound.empty()) 97 { 98 this->engineBuffer = (OrxSound::SoundBuffer*)ResourceManager::getInstance()->load(engineSound, WAV); 99 if (this->engineBuffer != NULL) 100 { 101 PRINTF(4)("Loaded sound %s to Pickup: %s.\n", engineSound.c_str(), this->getCName()); 102 } 103 else 104 { 105 PRINTF(2)("Failed to load sound %s to engine %s.\n.", engineSound.c_str(), this->getCName()); 106 } 107 } 74 if (!engineSound.empty()) 75 this->engineBuffer = OrxSound::ResourceSoundBuffer(engineSound); 108 76 else 109 this->engineBuffer = NULL;77 this->engineBuffer = OrxSound::SoundBuffer(); 110 78 } 111 79 … … 139 107 //Vector offsetVel = 140 108 this->velocity = velocity; 141 // offsetVel.normalize();109 // offsetVel.normalize(); 142 110 //this->velocity += (offsetVel * 50.0); 143 111 } … … 148 116 { 149 117 if (this->target == NULL) 150 this->target = new PNode(target, PNODE_ PARENT_MODE_DEFAULT | PNODE_REPARENT_ON_PARENTS_REMOVE);118 this->target = new PNode(target, PNODE_REPARENT_ON_PARENTS_REMOVE | PNODE_REPARENT_TO_NULL | PNODE_PROHIBIT_DELETE_WITH_PARENT); 151 119 else 152 120 this->target->setParent(target); … … 173 141 void Projectile::destroy (WorldEntity* killer) 174 142 { 175 if (this->explosionBuffer != NULL)143 if (this->explosionBuffer.loaded()) 176 144 this->soundSource.play(this->explosionBuffer); 177 145 } -
trunk/src/world_entities/projectiles/projectile.h
r9235 r9869 11 11 12 12 #include "world_entity.h" 13 #include " fast_factory.h"13 #include "loading/fast_factory.h" 14 14 15 15 #include "sound_source.h" … … 18 18 class Projectile : public WorldEntity 19 19 { 20 ObjectListDeclaration(Projectile); 20 21 public: 21 22 Projectile (); … … 66 67 OrxSound::SoundSource soundSource; 67 68 private: 68 OrxSound::SoundBuffer *explosionBuffer;69 OrxSound::SoundBuffer *engineBuffer;69 OrxSound::SoundBuffer explosionBuffer; 70 OrxSound::SoundBuffer engineBuffer; 70 71 }; 71 72 -
trunk/src/world_entities/projectiles/rail_projectile.cc
r9406 r9869 19 19 20 20 #include "state.h" 21 #include "class_list.h"22 21 #include "model.h" 23 22 24 #include " dot_emitter.h"25 #include " sprite_particles.h"23 #include "particles/dot_emitter.h" 24 #include "particles/sprite_particles.h" 26 25 27 26 #include <cassert> … … 29 28 30 29 31 32 CREATE_FAST_FACTORY_STATIC(RailProjectile, CL_RAIL_PROJECTILE); 30 #include "class_id_DEPRECATED.h" 31 ObjectListDefinitionID(RailProjectile, CL_RAIL_PROJECTILE); 32 CREATE_FAST_FACTORY_STATIC(RailProjectile); 33 33 34 34 /** … … 37 37 RailProjectile::RailProjectile () : Projectile() 38 38 { 39 this-> setClassID(CL_RAIL_PROJECTILE, "RailProjectile");39 this->registerObject(this, RailProjectile::_objectList); 40 40 41 this->loadModel("models/projectiles/laser _projectile.obj", 100);41 this->loadModel("models/projectiles/laser.obj", 1); 42 42 43 43 this->setMinEnergy(10); … … 61 61 62 62 /* this is normaly done by World.cc by deleting the ParticleEngine */ 63 if (RailProjectile::explosionParticles != NULL && ClassList::getList(CL_RAIL_PROJECTILE)->size() <= 1)63 if (RailProjectile::explosionParticles != NULL && RailProjectile::objectList().size() <= 1) 64 64 { 65 65 //if (ClassList::exists(RailProjectile::explosionParticles, CL_PARTICLE_SYSTEM)) -
trunk/src/world_entities/projectiles/rail_projectile.h
r9235 r9869 17 17 class RailProjectile : public Projectile 18 18 { 19 ObjectListDeclaration(RailProjectile); 19 20 public: 20 21 RailProjectile (); -
trunk/src/world_entities/projectiles/rocket.cc
r9235 r9869 19 19 20 20 #include "state.h" 21 #include "class_list.h"22 21 23 #include " dot_emitter.h"24 #include " sprite_particles.h"22 #include "particles/dot_emitter.h" 23 #include "particles/sprite_particles.h" 25 24 26 25 #include "debug.h" 27 26 28 CREATE_FAST_FACTORY_STATIC(Rocket, CL_ROCKET); 27 #include "class_id_DEPRECATED.h" 28 ObjectListDefinitionID(Rocket, CL_ROCKET); 29 CREATE_FAST_FACTORY_STATIC(Rocket); 29 30 30 31 /** … … 33 34 Rocket::Rocket () : Projectile() 34 35 { 35 this-> setClassID(CL_ROCKET, "Rocket");36 this->registerObject(this, Rocket::_objectList); 36 37 37 38 this->loadModel("models/projectiles/orx-rocket.obj", .3); … … 55 56 56 57 /* this is normaly done by World.cc by deleting the ParticleEngine */ 57 if (Rocket::trailParticles != NULL && ClassList::getList(CL_ROCKET)->size() <= 1)58 if (Rocket::trailParticles != NULL && Rocket::objectList().size() <= 1) 58 59 { 59 60 /* if (ClassList::exists(Rocket::trailParticles, CL_PARTICLE_SYSTEM)) … … 61 62 Rocket::trailParticles = NULL; 62 63 } 63 if (Rocket::explosionParticles != NULL && ClassList::getList(CL_ROCKET)->size() <= 1)64 if (Rocket::explosionParticles != NULL && Rocket::objectList().size() <= 1) 64 65 { 65 66 /* if (ClassList::exists(Rocket::explosionParticles, CL_PARTICLE_SYSTEM)) -
trunk/src/world_entities/projectiles/rocket.h
r9235 r9869 9 9 #include "projectile.h" 10 10 11 class Vector;12 class Weapon;13 11 class SpriteParticles; 14 12 class ParticleEmitter; … … 17 15 class Rocket : public Projectile 18 16 { 19 public: 20 Rocket (); 21 virtual ~Rocket (); 17 ObjectListDeclaration(Rocket); 18 19 public: 20 Rocket (); 21 virtual ~Rocket (); 22 22 23 23 24 25 24 virtual void activate(); 25 virtual void deactivate(); 26 26 27 27 virtual void collidesWith(WorldEntity* entity, const Vector& location); 28 28 29 29 virtual void destroy (WorldEntity* killer); 30 30 31 32 31 virtual void tick (float time); 32 virtual void draw () const; 33 33 34 34 35 36 37 38 35 private: 36 static FastFactory* fastFactory; 37 static SpriteParticles* trailParticles; 38 static SpriteParticles* explosionParticles; 39 39 40 40 ParticleEmitter* emitter; 41 41 42 42 43 43 WorldEntity* hitEntity; // FIXME TEMPORARY 44 44 45 45 }; -
trunk/src/world_entities/projectiles/test_bullet.cc
r9235 r9869 19 19 20 20 #include "state.h" 21 #include "class_list.h"22 21 23 #include " dot_emitter.h"24 #include " sprite_particles.h"22 #include "particles/dot_emitter.h" 23 #include "particles/sprite_particles.h" 25 24 #include "debug.h" 26 25 27 CREATE_FAST_FACTORY_STATIC(TestBullet, CL_TEST_BULLET); 26 #include "class_id_DEPRECATED.h" 27 ObjectListDefinitionID(TestBullet, CL_TEST_BULLET); 28 CREATE_FAST_FACTORY_STATIC(TestBullet); 28 29 29 30 /** … … 32 33 TestBullet::TestBullet () : Projectile() 33 34 { 34 this-> setClassID(CL_TEST_BULLET, "TestBullet");35 this->registerObject(this, TestBullet::_objectList); 35 36 36 37 this->loadModel("models/projectiles/orx-rocket.obj", .3); … … 54 55 55 56 /* this is normaly done by World.cc by deleting the ParticleEngine */ 56 if (TestBullet::trailParticles != NULL && ClassList::getList(CL_TEST_BULLET)->size() <= 1)57 if (TestBullet::trailParticles != NULL && TestBullet::objectList().size() <= 1) 57 58 { 58 if ( ClassList::exists(TestBullet::trailParticles, CL_PARTICLE_SYSTEM))59 if (ParticleSystem::objectList().exists(TestBullet::trailParticles)) 59 60 delete TestBullet::trailParticles; 60 61 TestBullet::trailParticles = NULL; 61 62 } 62 if (TestBullet::explosionParticles != NULL && ClassList::getList(CL_TEST_BULLET)->size() <= 1)63 if (TestBullet::explosionParticles != NULL && TestBullet::objectList().size() <= 1) 63 64 { 64 if ( ClassList::exists(TestBullet::explosionParticles, CL_PARTICLE_SYSTEM))65 if (ParticleSystem::objectList().exists(TestBullet::explosionParticles)) 65 66 delete TestBullet::explosionParticles; 66 67 TestBullet::explosionParticles = NULL; -
trunk/src/world_entities/projectiles/test_bullet.h
r9235 r9869 17 17 class TestBullet : public Projectile 18 18 { 19 ObjectListDeclaration(TestBullet); 20 19 21 public: 20 22 TestBullet ();
Note: See TracChangeset
for help on using the changeset viewer.