Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 9869 in orxonox.OLD for trunk/src/world_entities/projectiles


Ignore:
Timestamp:
Oct 3, 2006, 12:19:30 AM (18 years ago)
Author:
bensch
Message:

orxonox/trunk: merged the new_class_id branche back to the trunk.
merged with command:
svn merge https://svn.orxonox.net/orxonox/branches/new_class_id trunk -r9683:HEAD
no conflicts… puh..

Location:
trunk/src/world_entities/projectiles
Files:
18 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/world_entities/projectiles/bomb.cc

    r8362 r9869  
    2020#include "primitive_model.h"
    2121
    22 #include "dot_emitter.h"
    23 #include "particle_system.h"
     22#include "particles/dot_emitter.h"
     23#include "particles/particle_system.h"
    2424
    2525#include "debug.h"
    2626
    27 CREATE_FAST_FACTORY_STATIC(Bomb, CL_BOMB);
     27#include "class_id_DEPRECATED.h"
     28ObjectListDefinitionID(Bomb, CL_BOMB);
     29CREATE_FAST_FACTORY_STATIC(Bomb);
    2830
    2931/**
     
    6769void Bomb::init()
    6870{
    69   this->setClassID(CL_BOMB, "Bomb");
     71  this->registerObject(this, Bomb::_objectList);
    7072
    7173
     
    173175}
    174176
     177
    175178void Bomb::deactivate()
    176179{
     
    182185void Bomb::detonate(float size)
    183186{
    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());
    186190    while( !detonationList.empty() )
    187191    {
    188192      detonationList.front()->collidesWith(this, Vector(0,0,0));
    189193      detonationList.pop_front();
    190     }
     194    }*/
    191195}
  • trunk/src/world_entities/projectiles/bomb.h

    r6622 r9869  
    1717class Bomb : public Projectile
    1818{
    19 
     19  ObjectListDeclaration(Bomb);
    2020 public:
    2121  Bomb(const TiXmlElement* root = NULL);
  • trunk/src/world_entities/projectiles/boomerang_projectile.cc

    r9235 r9869  
    2020
    2121#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"
    2625
    2726#include "debug.h"
    2827
    29 CREATE_FAST_FACTORY_STATIC(BoomerangProjectile, CL_BOOMERANG_PROJECTILE);
     28#include "class_id_DEPRECATED.h"
     29ObjectListDefinitionID(BoomerangProjectile, CL_BOOMERANG_PROJECTILE);
     30CREATE_FAST_FACTORY_STATIC(BoomerangProjectile);
    3031
    3132/**
     
    3435BoomerangProjectile::BoomerangProjectile () : Projectile()
    3536{
    36   this->setClassID(CL_BOOMERANG_PROJECTILE, "BoomerangProjectile");
     37  this->registerObject(this, BoomerangProjectile::_objectList);
    3738
    3839  this->loadModel("models/projectiles/orx-rocket.obj", 2.0);
     
    6061
    6162  /* 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))
    6566      delete BoomerangProjectile::trailParticles;
    6667    BoomerangProjectile::trailParticles = NULL;
    6768  }
    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))
    7172      delete BoomerangProjectile::explosionParticles;
    7273    BoomerangProjectile::explosionParticles = NULL;
  • trunk/src/world_entities/projectiles/boomerang_projectile.h

    r9235 r9869  
    1717class BoomerangProjectile : public Projectile
    1818{
     19  ObjectListDeclaration(BoomerangProjectile);
    1920  public:
    2021    BoomerangProjectile ();
  • trunk/src/world_entities/projectiles/guided_missile.cc

    r9298 r9869  
    1919
    2020#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"
    2524
    2625#include "debug.h"
    2726
    28 CREATE_FAST_FACTORY_STATIC(GuidedMissile, CL_GUIDED_MISSILE);
     27#include "class_id_DEPRECATED.h"
     28ObjectListDefinitionID(GuidedMissile, CL_GUIDED_MISSILE);
     29CREATE_FAST_FACTORY_STATIC(GuidedMissile);
    2930
    3031/**
     
    3334GuidedMissile::GuidedMissile () : Projectile()
    3435{
    35   this->setClassID(CL_GUIDED_MISSILE, "GuidedMissile");
     36  this->registerObject(this, GuidedMissile::_objectList);
    3637
    3738  this->loadModel("models/projectiles/orx-rocket.obj", 2.0);
     
    5960
    6061  /* 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))
    6465      delete GuidedMissile::trailParticles;
    6566    GuidedMissile::trailParticles = NULL;
    6667  }
    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))
    7071      delete GuidedMissile::explosionParticles;
    7172    GuidedMissile::explosionParticles = NULL;
  • trunk/src/world_entities/projectiles/guided_missile.h

    r9656 r9869  
    1616class GuidedMissile : public Projectile
    1717{
     18  ObjectListDeclaration(GuidedMissile);
    1819  public:
    1920    GuidedMissile ();
  • trunk/src/world_entities/projectiles/hyperblast.cc

    r9235 r9869  
    1919
    2020#include "state.h"
    21 #include "class_list.h"
    2221
    23 #include "box_emitter.h"
    24 #include "spark_particles.h"
     22#include "particles/box_emitter.h"
     23#include "particles/spark_particles.h"
    2524
    2625#include "debug.h"
    2726
    28 CREATE_FAST_FACTORY_STATIC(Hyperblast, CL_HYPERBLAST);
     27#include "class_id_DEPRECATED.h"
     28ObjectListDefinitionID(Hyperblast, CL_HYPERBLAST);
     29CREATE_FAST_FACTORY_STATIC(Hyperblast);
     30
    2931
    3032/**
     
    3335Hyperblast::Hyperblast () : Projectile()
    3436{
    35   this->setClassID(CL_HYPERBLAST, "Hyperblast");
     37  this->registerObject(this, Hyperblast::_objectList);
    3638
    3739  this->loadModel("models/projectiles/hyperblast.obj", 5);
     
    5557{
    5658  /* 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)
    5860  {
    5961    Hyperblast::explosionParticles = NULL;
  • trunk/src/world_entities/projectiles/hyperblast.h

    r9235 r9869  
    1717class Hyperblast : public Projectile
    1818{
     19  ObjectListDeclaration(Hyperblast);
    1920  public:
    2021    Hyperblast ();
  • trunk/src/world_entities/projectiles/laser.cc

    r9656 r9869  
    1919
    2020#include "state.h"
    21 #include "class_list.h"
    2221#include "model.h"
    2322
    24 #include "dot_emitter.h"
    25 #include "sprite_particles.h"
     23#include "particles/dot_emitter.h"
     24#include "particles/sprite_particles.h"
    2625
    2726#include <cassert>
     
    2928
    3029
    31 
    32 CREATE_FAST_FACTORY_STATIC(Laser, CL_LASER);
     30#include "class_id_DEPRECATED.h"
     31ObjectListDefinition(Laser);
     32CREATE_FAST_FACTORY_STATIC(Laser);
    3333
    3434/**
     
    3737Laser::Laser () : Projectile()
    3838{
    39   this->setClassID(CL_LASER, "Laser");
     39  this->registerObject(this, Laser::_objectList);
    4040
    4141  this->loadModel("models/projectiles/laser.obj");
     
    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 (Laser::explosionParticles != NULL && Laser::objectList().size() <= 1)
    6464  {
    6565    //if (ClassList::exists(Laser::explosionParticles, CL_PARTICLE_SYSTEM))
  • trunk/src/world_entities/projectiles/laser.h

    r9235 r9869  
    1717class Laser : public Projectile
    1818{
     19  ObjectListDeclaration(Laser);
    1920  public:
    2021    Laser ();
  • trunk/src/world_entities/projectiles/projectile.cc

    r9656 r9869  
    2222#include "world_entities/weapons/weapon.h"
    2323#include "model.h"
    24 #include "util/loading/resource_manager.h"
     24#include "sound/resource_sound_buffer.h"
    2525
    2626#include "debug.h"
    2727
     28ObjectListDefinition(Projectile);
    2829
    2930/**
     
    3233Projectile::Projectile () : WorldEntity()
    3334{
    34   this->setClassID(CL_PROJECTILE, "Projectile");
     35  this->registerObject(this, Projectile::_objectList);
    3536
    3637  this->lifeCycle = 0.0;
     
    4344  this->setDamage(1.0f); // default damage of a projectile set to 100.0 damage points
    4445
    45   this->explosionBuffer = NULL;
    46   this->engineBuffer = NULL;
    47 
    4846  //this->addNodeFlags(PNODE_PROHIBIT_DELETE_WITH_PARENT);
    4947}
     
    5553Projectile::~Projectile ()
    5654{
    57   if (this->explosionBuffer != NULL)
    58     ResourceManager::getInstance()->unload(this->explosionBuffer);
    59   if (this->engineBuffer != NULL)
    60     ResourceManager::getInstance()->unload(this->engineBuffer);
    6155  /*
    6256     do not delete the test projectModel, since it is pnode
     
    6963void Projectile::loadExplosionSound(const std::string& explosionSound)
    7064{
    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);
    8667  else
    87     this->explosionBuffer = NULL;
     68    this->explosionBuffer = OrxSound::SoundBuffer();
    8869}
    8970
     
    9172void Projectile::loadEngineSound(const std::string& engineSound)
    9273{
    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);
    10876  else
    109     this->engineBuffer = NULL;
     77    this->engineBuffer = OrxSound::SoundBuffer();
    11078}
    11179
     
    139107  //Vector offsetVel =
    140108  this->velocity = velocity;
    141  // offsetVel.normalize();
     109  // offsetVel.normalize();
    142110  //this->velocity += (offsetVel * 50.0);
    143111}
     
    148116{
    149117  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);
    151119  else
    152120    this->target->setParent(target);
     
    173141void Projectile::destroy (WorldEntity* killer)
    174142{
    175   if (this->explosionBuffer != NULL)
     143  if (this->explosionBuffer.loaded())
    176144    this->soundSource.play(this->explosionBuffer);
    177145}
  • trunk/src/world_entities/projectiles/projectile.h

    r9235 r9869  
    1111
    1212#include "world_entity.h"
    13 #include "fast_factory.h"
     13#include "loading/fast_factory.h"
    1414
    1515#include "sound_source.h"
     
    1818class Projectile : public WorldEntity
    1919{
     20  ObjectListDeclaration(Projectile);
    2021  public:
    2122    Projectile ();
     
    6667    OrxSound::SoundSource  soundSource;
    6768  private:
    68     OrxSound::SoundBuffer* explosionBuffer;
    69     OrxSound::SoundBuffer* engineBuffer;
     69    OrxSound::SoundBuffer  explosionBuffer;
     70    OrxSound::SoundBuffer  engineBuffer;
    7071};
    7172
  • trunk/src/world_entities/projectiles/rail_projectile.cc

    r9406 r9869  
    1919
    2020#include "state.h"
    21 #include "class_list.h"
    2221#include "model.h"
    2322
    24 #include "dot_emitter.h"
    25 #include "sprite_particles.h"
     23#include "particles/dot_emitter.h"
     24#include "particles/sprite_particles.h"
    2625
    2726#include <cassert>
     
    2928
    3029
    31 
    32 CREATE_FAST_FACTORY_STATIC(RailProjectile, CL_RAIL_PROJECTILE);
     30#include "class_id_DEPRECATED.h"
     31ObjectListDefinitionID(RailProjectile, CL_RAIL_PROJECTILE);
     32CREATE_FAST_FACTORY_STATIC(RailProjectile);
    3333
    3434/**
     
    3737RailProjectile::RailProjectile () : Projectile()
    3838{
    39   this->setClassID(CL_RAIL_PROJECTILE, "RailProjectile");
     39  this->registerObject(this, RailProjectile::_objectList);
    4040
    41   this->loadModel("models/projectiles/laser_projectile.obj", 100);
     41  this->loadModel("models/projectiles/laser.obj", 1);
    4242
    4343  this->setMinEnergy(10);
     
    6161
    6262  /* 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)
    6464  {
    6565    //if (ClassList::exists(RailProjectile::explosionParticles, CL_PARTICLE_SYSTEM))
  • trunk/src/world_entities/projectiles/rail_projectile.h

    r9235 r9869  
    1717class RailProjectile : public Projectile
    1818{
     19  ObjectListDeclaration(RailProjectile);
    1920  public:
    2021    RailProjectile ();
  • trunk/src/world_entities/projectiles/rocket.cc

    r9235 r9869  
    1919
    2020#include "state.h"
    21 #include "class_list.h"
    2221
    23 #include "dot_emitter.h"
    24 #include "sprite_particles.h"
     22#include "particles/dot_emitter.h"
     23#include "particles/sprite_particles.h"
    2524
    2625#include "debug.h"
    2726
    28 CREATE_FAST_FACTORY_STATIC(Rocket, CL_ROCKET);
     27#include "class_id_DEPRECATED.h"
     28ObjectListDefinitionID(Rocket, CL_ROCKET);
     29CREATE_FAST_FACTORY_STATIC(Rocket);
    2930
    3031/**
     
    3334Rocket::Rocket () : Projectile()
    3435{
    35   this->setClassID(CL_ROCKET, "Rocket");
     36  this->registerObject(this, Rocket::_objectList);
    3637
    3738  this->loadModel("models/projectiles/orx-rocket.obj", .3);
     
    5556
    5657  /* 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)
    5859  {
    5960/*    if (ClassList::exists(Rocket::trailParticles, CL_PARTICLE_SYSTEM))
     
    6162    Rocket::trailParticles = NULL;
    6263  }
    63   if (Rocket::explosionParticles != NULL && ClassList::getList(CL_ROCKET)->size() <= 1)
     64  if (Rocket::explosionParticles != NULL && Rocket::objectList().size() <= 1)
    6465  {
    6566/*    if (ClassList::exists(Rocket::explosionParticles, CL_PARTICLE_SYSTEM))
  • trunk/src/world_entities/projectiles/rocket.h

    r9235 r9869  
    99#include "projectile.h"
    1010
    11 class Vector;
    12 class Weapon;
    1311class SpriteParticles;
    1412class ParticleEmitter;
     
    1715class Rocket : public Projectile
    1816{
    19   public:
    20     Rocket ();
    21     virtual ~Rocket ();
     17  ObjectListDeclaration(Rocket);
     18
     19public:
     20  Rocket ();
     21  virtual ~Rocket ();
    2222
    2323
    24     virtual void activate();
    25     virtual void deactivate();
     24  virtual void activate();
     25  virtual void deactivate();
    2626
    27     virtual void collidesWith(WorldEntity* entity, const Vector& location);
     27  virtual void collidesWith(WorldEntity* entity, const Vector& location);
    2828
    29     virtual void destroy (WorldEntity* killer);
     29  virtual void destroy (WorldEntity* killer);
    3030
    31     virtual void tick (float time);
    32     virtual void draw () const;
     31  virtual void tick (float time);
     32  virtual void draw () const;
    3333
    3434
    35   private:
    36     static FastFactory*               fastFactory;
    37     static SpriteParticles*           trailParticles;
    38     static SpriteParticles*           explosionParticles;
     35private:
     36  static FastFactory*               fastFactory;
     37  static SpriteParticles*           trailParticles;
     38  static SpriteParticles*           explosionParticles;
    3939
    40     ParticleEmitter*                  emitter;
     40  ParticleEmitter*                  emitter;
    4141
    4242
    43     WorldEntity* hitEntity; // FIXME TEMPORARY
     43  WorldEntity* hitEntity; // FIXME TEMPORARY
    4444
    4545};
  • trunk/src/world_entities/projectiles/test_bullet.cc

    r9235 r9869  
    1919
    2020#include "state.h"
    21 #include "class_list.h"
    2221
    23 #include "dot_emitter.h"
    24 #include "sprite_particles.h"
     22#include "particles/dot_emitter.h"
     23#include "particles/sprite_particles.h"
    2524#include "debug.h"
    2625
    27 CREATE_FAST_FACTORY_STATIC(TestBullet, CL_TEST_BULLET);
     26#include "class_id_DEPRECATED.h"
     27ObjectListDefinitionID(TestBullet, CL_TEST_BULLET);
     28CREATE_FAST_FACTORY_STATIC(TestBullet);
    2829
    2930/**
     
    3233TestBullet::TestBullet () : Projectile()
    3334{
    34   this->setClassID(CL_TEST_BULLET, "TestBullet");
     35  this->registerObject(this, TestBullet::_objectList);
    3536
    3637  this->loadModel("models/projectiles/orx-rocket.obj", .3);
     
    5455
    5556  /* 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)
    5758  {
    58     if (ClassList::exists(TestBullet::trailParticles, CL_PARTICLE_SYSTEM))
     59    if (ParticleSystem::objectList().exists(TestBullet::trailParticles))
    5960      delete TestBullet::trailParticles;
    6061    TestBullet::trailParticles = NULL;
    6162  }
    62   if (TestBullet::explosionParticles != NULL && ClassList::getList(CL_TEST_BULLET)->size() <= 1)
     63  if (TestBullet::explosionParticles != NULL && TestBullet::objectList().size() <= 1)
    6364  {
    64     if (ClassList::exists(TestBullet::explosionParticles, CL_PARTICLE_SYSTEM))
     65    if (ParticleSystem::objectList().exists(TestBullet::explosionParticles))
    6566      delete TestBullet::explosionParticles;
    6667    TestBullet::explosionParticles = NULL;
  • trunk/src/world_entities/projectiles/test_bullet.h

    r9235 r9869  
    1717class TestBullet : public Projectile
    1818{
     19  ObjectListDeclaration(TestBullet);
     20
    1921  public:
    2022    TestBullet ();
Note: See TracChangeset for help on using the changeset viewer.