Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 10345 in orxonox.OLD


Ignore:
Timestamp:
Jan 24, 2007, 6:13:17 PM (17 years ago)
Author:
marcscha
Message:

SegFault prevention hack in fast factory

Location:
branches/playability/src
Files:
14 edited

Legend:

Unmodified
Added
Removed
  • branches/playability/src/lib/util/loading/fast_factory.cc

    r9869 r10345  
    157157void FastFactory::flush(bool hardFLUSH)
    158158{
     159hardFLUSH = false; // HACK
    159160  FastObjectMember* tmpMember = this->deadList, *delMember = NULL;
    160161  while (tmpMember != NULL)
  • branches/playability/src/world_entities/effects/wobblegrid.cc

    r10333 r10345  
    8181
    8282  this->material = new Material();
     83  this->material->setBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
    8384  this->setAbsCoor(0, 0, 0);
    8485  //this->setVisibiliy(true);
  • branches/playability/src/world_entities/projectiles/acid_splash.cc

    r10333 r10345  
    5656
    5757
    58   int rnd = rand()/3;
     58  int rnd = int(rand() % 3);
    5959
    6060  switch (rnd){
     
    7676//     this->grid->setTexture( "maps/blub.png");
    7777
    78   this->grid->toList(OM_ENVIRON); //this->getOMListNumber());
    79   this->toList(OM_ENVIRON);
     78  this->grid->toList(OM_ENVIRON);
    8079}
    8180
     
    8988  // delete this->emitter;
    9089  //delete this->grid;
    91  
    9290  this->grid->toList(OM_DEAD);
    9391 
     
    9795void AcidSplash::activate()
    9896{
    99   this->unhide();
     97  this->origList = this->getOMListNumber();
     98  this->toList(OM_ENVIRON);
     99 // this->unhide();
    100100  this->grid->setVisibiliy(true);
    101101
     
    110110  this->lifeCycle = 0.0;
    111111
    112   this->hide();
     112 // this->hide();
    113113  this->grid->setVisibiliy(false);
    114   this->toList(OM_DEAD);
     114  this->lifeCycle = 0.0;
     115  this->toList(OM_NULL);
     116  //this->toList(OM_DEAD);
    115117  this->removeNode();
    116118 
     
    155157  for( ObjectList<Playable>::const_iterator eIterator = Playable::objectList().begin(); eIterator !=Playable::objectList().end(); eIterator++)
    156158  {
    157     if( ((*eIterator)->getOMListNumber() == (this->getOMListNumber() -1))  && ((*eIterator)->getAbsCoor() - this->getAbsCoor()).len() <= 8)
     159    if( ((*eIterator)->getOMListNumber() != (this->origList -1))  && ((*eIterator)->getAbsCoor() - this->getAbsCoor()).len() <= 8)
    158160    {
    159161      (*eIterator)->hit (this->getDamage(),this);
  • branches/playability/src/world_entities/projectiles/hbolt.cc

    r10274 r10345  
    5959  this->halo->setSize(.65, .65);
    6060  this->halo->setTexture("hbolt_halo2.png");
     61
    6162}
    6263
     
    8485void HBolt::activate()
    8586{
     87  this->origList = this->getOMListNumber();
    8688  this->toList(OM_ENVIRON);
    8789  if (unlikely(HBolt::explosionParticles == NULL))
     
    144146  for( ObjectList<Playable>::const_iterator eIterator = Playable::objectList().begin(); eIterator !=Playable::objectList().end(); eIterator++)
    145147  {
    146     if( ((*eIterator)->getOMListNumber() == OM_GROUP_00)  && ((*eIterator)->getAbsCoor() - this->getAbsCoor()).len() <= 8)
     148    if( ((*eIterator)->getOMListNumber() != (this->origList -1))   && ((*eIterator)->getAbsCoor() - this->getAbsCoor()).len() <= 8)
    147149    {
    148150      (*eIterator)->hit (this->getDamage(),this);
  • branches/playability/src/world_entities/projectiles/lbolt.cc

    r10274 r10345  
    6161  this->halo->setSize(.35, .35);
    6262  this->halo->setTexture("hbolt_halo.png");
     63
     64
    6365}
    6466
     
    8688void LBolt::activate()
    8789{
     90  this->origList = this->getOMListNumber();
    8891  this->toList(OM_ENVIRON);
    8992  if (unlikely(LBolt::explosionParticles == NULL))
     
    143146  for( ObjectList<Playable>::const_iterator eIterator = Playable::objectList().begin(); eIterator !=Playable::objectList().end(); eIterator++)
    144147  {
    145     if( ((*eIterator)->getOMListNumber() == OM_GROUP_00)  && ((*eIterator)->getAbsCoor() - this->getAbsCoor()).len() <= 8)
     148    if( ((*eIterator)->getOMListNumber() != (this->origList -1))   && ((*eIterator)->getAbsCoor() - this->getAbsCoor()).len() <= 8)
    146149    {
    147150      (*eIterator)->hit (this->getDamage(),this);
  • branches/playability/src/world_entities/projectiles/mbolt.cc

    r10274 r10345  
    8181  this->trail->setTexture( "maps/laser.png");
    8282  this->trail->setAbsCoor(this->getAbsCoor() - Vector(.7,0,0));
     83
    8384}
    8485
     
    107108void MBolt::activate()
    108109{
     110  this->origList = this->getOMListNumber();
    109111  this->toList(OM_ENVIRON);
    110112  if (unlikely(MBolt::explosionParticles == NULL))
     
    137139  this->lifeCycle = 0.0;
    138140
    139   this->toList(OM_DEAD);
     141  this->lifeCycle = 0.0;
     142  this->toList(OM_NULL);
     143  //this->toList(OM_DEAD);
    140144  this->removeNode();
    141145  MBolt::fastFactory->kill(this);
     
    174178  for( ObjectList<Playable>::const_iterator eIterator = Playable::objectList().begin(); eIterator !=Playable::objectList().end(); eIterator++)
    175179  {
    176     if( ((*eIterator)->getOMListNumber() == OM_GROUP_00) && ((*eIterator)->getAbsCoor() - this->getAbsCoor()).len() <= 8)
     180    if( ((*eIterator)->getOMListNumber() != (this->origList -1)) && ((*eIterator)->getAbsCoor() - this->getAbsCoor()).len() <= 8)
    177181    {
    178182      (*eIterator)->hit (this->getDamage(),this);
  • branches/playability/src/world_entities/projectiles/projectile.h

    r10196 r10345  
    6767  protected:
    6868    // energy
     69    int                origList;                        //!< FIXME currently a fix around the collision seg fault
    6970    float                   energyMin;                //!< The minimal Energy a Projectile needs to be emitted.
    7071    bool                    bChargeable;              //!< if the Projectile is Charegeable
  • branches/playability/src/world_entities/projectiles/spike.cc

    r10333 r10345  
    7373    //  delete Spike::explosionParticles;
    7474    PRINTF(1)("Deleting Spike Particles\n");
     75/*
     76  if (Spike::objectList().exists(Spike::explosionParticles))
     77      delete Spike::explosionParticles; */
    7578    Spike::explosionParticles = NULL;
    7679  }
     
    8588  {
    8689    Spike::explosionParticles = new SpriteParticles(1000);
    87     Spike::explosionParticles->setName("BoltExplosionParticles");
     90    Spike::explosionParticles->setName("SpikeExplosionParticles");
    8891    Spike::explosionParticles->setLifeSpan(.5, .3);
    8992    Spike::explosionParticles->setRadius(0.0, 10.0);
     
    103106{
    104107  assert (Spike::explosionParticles != NULL);
    105   Spike::explosionParticles->removeEmitter(this->emitter);
     108  //Spike::explosionParticles->removeEmitter(this->emitter);
     109  this->emitter->setSystem(NULL);
    106110  this->lifeCycle = 0.0;
    107111
     
    111115}
    112116
    113 
     117/*
    114118void Spike::collidesWith(WorldEntity* entity, const Vector& location)
    115119{
     
    120124  dynamic_cast<SpaceShip*>(entity)->damage(this->getDamage(),0);
    121125//   this->deactivate();
    122 }
     126}*/
    123127
    124128/**
  • branches/playability/src/world_entities/projectiles/spike.h

    r10289 r10345  
    2727    virtual void deactivate();
    2828
    29     virtual void collidesWith(WorldEntity* entity, const Vector& location);
     29   //virtual void collidesWith(WorldEntity* entity, const Vector& location);
    3030
    3131    virtual void destroy (WorldEntity* killer);
  • branches/playability/src/world_entities/projectiles/spike_ball.cc

    r10333 r10345  
    8282    //  delete SpikeBall::explosionParticles;
    8383    PRINTF(1)("Deleting SpikeBall Particles\n");
     84//    if (SpikeBall::objectList().exists(SpikeBall::explosionParticles))
     85//      delete SpikeBall::explosionParticles;
    8486    SpikeBall::explosionParticles = NULL;
    8587  }
     
    9496  {
    9597    SpikeBall::explosionParticles = new SpriteParticles(1000);
    96     SpikeBall::explosionParticles->setName("BoltExplosionParticles");
     98    SpikeBall::explosionParticles->setName("SpikeBallExplosionParticles");
    9799    SpikeBall::explosionParticles->setLifeSpan(.5, .3);
    98100    SpikeBall::explosionParticles->setRadius(0.0, 10.0);
     
    138140{
    139141  assert (SpikeBall::explosionParticles != NULL);
    140   SpikeBall::explosionParticles->removeEmitter(this->emitter);
     142  //SpikeBall::explosionParticles->removeEmitter(this->emitter);
     143  this->emitter->setSystem(NULL);
    141144  this->lifeCycle = 0.0;
    142145
     
    146149}
    147150
    148 
     151/*
    149152void SpikeBall::collidesWith(WorldEntity* entity, const Vector& location)
    150153{
     
    154157  this->hitEntity = entity;
    155158  dynamic_cast<SpaceShip*>(entity)->damage(this->getDamage(),0);
    156 }
     159}*/
    157160
    158161
  • branches/playability/src/world_entities/projectiles/spike_ball.h

    r10333 r10345  
    3232    virtual void deactivate();
    3333
    34     virtual void collidesWith(WorldEntity* entity, const Vector& location);
     34   // virtual void collidesWith(WorldEntity* entity, const Vector& location);
    3535
    3636    virtual void destroy (WorldEntity* killer);
  • branches/playability/src/world_entities/projectiles/swarm_projectile.cc

    r10271 r10345  
    6262  //this->trail->setParent( this);
    6363  this->trail->setTexture( "maps/laser.png");
     64
     65
     66  this->origList = this->getOMListNumber();
     67  this->toList(OM_ENVIRON);
    6468}
    6569
     
    190194    this->deactivate();
    191195
    192 /*
    193   Vector targetFarFarAway = this->getAbsCoor() + Vector(100000, 0, 0);
    194 
    195   {
    196     speed = velocity.len();
    197     diffVector = ((targetFarFarAway - this->getAbsCoor()).getNormalized());
    198 
    199     if(velocity.dot(diffVector) != 0)
    200     {
    201       correctionVector = (( ( diffVector *  (speed * speed/( velocity.dot(diffVector ) ) )) - velocity).getNormalized()) * agility;
    202 
    203       if( (diffVector *  (speed * speed/( velocity.dot(diffVector ) ) ) -velocity).len() < agility )
    204         velocity = ((diffVector *  (speed * speed/( velocity.dot(diffVector ) ) )).getNormalized())*agility;
    205       else if(velocity.dot(diffVector) > 0)
    206         velocity += correctionVector;
    207       else if (velocity.dot(diffVector) < 0)
    208         velocity -= correctionVector;
    209     }
    210     else
    211       velocity += diffVector * agility;
    212 
    213     this->setAbsDir(Quaternion(velocity, Vector(0,1,0)) * Quaternion ( -M_PI_2, Vector(0,1,0)));
    214   }
    215 
    216   velocity *= maxVelocity/velocity.len();
    217   Vector v = this->velocity * (time);
    218   this->shiftCoor(v);*/
    219196
    220197
     
    235212  this->shiftCoor(this->velocity * time);
    236213
    237 /*
    238 
    239   Vector pjV = this->getVelocity();
    240   Vector tV = this->target->getVelocity();
    241   Vector pT = this->target->getAbsCoor() - this->getAbsCoor(); // vector projectile target
    242 
    243   Vector a = tV.getNormalized() * pT.dot(tV.getNormalized());
    244 
    245   float A = 2 * pT.len() * pT.len();
    246   float B = 2 * a.len() * a.len();
    247   float D = 2 * sqrt(B * B - 4 * pT.len() * pT.len() *(tV.len() * tV.len() - pjV.len() * pjV.len()));
    248   float tti;
    249 
    250   if (A != 0){
    251     if ( B < D ) tti = ( B + D ) / A;
    252     else tti = ( B + D ) / A;
    253   }
    254   else tti = 0;
    255 
    256 
    257   Vector estTargetDir;
    258   if (tti == 0)
    259     estTargetDir = pT.getNormalized() * pjV.len();
    260   else
    261     estTargetDir = pT / tti + pjV;
    262 
    263   this->velocity = this->newDirection(this->velocity, estTargetDir, this->turningSpeed * time );
    264 
    265   this->shiftCoor(this->velocity * (this->maxVelocity * time));*/
    266 
    267214  if(this->tickLifeCycle(time))
    268215    this->deactivate();
     
    276223  this->lastDir = this->curDir;
    277224  this->curDir = this->velocity;
    278   if( (this->getAbsCoor() - this->target->getAbsCoor()).len() < 3)   // FIXME  Temp fake workaround for collision :)
     225
     226  if( this->target != NULL && (this->getAbsCoor() - this->target->getAbsCoor()).len() < 3)   // FIXME  Temp fake workaround for collision :)
    279227  {
    280     dynamic_cast<WorldEntity*>(target)->destroy( this);
    281     this->destroy( this);
     228    dynamic_cast<WorldEntity*>(target)->hit(this->getDamage(), this);
     229    this->deactivate();
    282230  }
    283231}
  • branches/playability/src/world_entities/weapons/acid_launcher.cc

    r10333 r10345  
    8484  animation2->setInfinity(ANIM_INF_CONSTANT);
    8585*/
    86   this->setStateDuration(WS_SHOOTING, .6);
     86  this->setStateDuration(WS_SHOOTING, 1.0f);
     87
    8788  this->setStateDuration(WS_RELOADING, 1.0f);
    8889  this->setStateDuration(WS_ACTIVATING, .4);
     
    9596  this->setCapability(WTYPE_ALLDIRS | WTYPE_TURRET | WTYPE_DIRECTIONAL | WTYPE_LIGHT);
    9697  this->setProjectileTypeC("AcidSplash");
    97 
    9898//   this->loadModel("models/guns/turret1.obj", 1.0);
    9999
    100100  this->setEmissionPoint(2.0, 0, 0);
    101   this->getProjectileFactory()->prepare(100);
     101  this->getProjectileFactory()->prepare(10);
    102102
    103103  this->setActionSound(WA_SHOOT, "sound/explosions/explosion_1.wav");
     
    148148
    149149  Projectile* pj = NULL;
    150   for( int i=0; i < 5; i++)
     150  for( int i=0; i < 1; i++)
    151151  {
    152152      pj  = this->getProjectile();
     
    155155
    156156      fired = true;
    157       pj->setVelocity(this->getVelocity()+(this->getAbsDir().apply(Vector(1,0,0))*115.0 + VECTOR_RAND(10)));
     157      pj->setVelocity(this->getVelocity()+(this->getAbsDir().apply(Vector(1,0,0))*165.0 + VECTOR_RAND(10)));
    158158
    159159      pj->setParent(PNode::getNullParent());
  • branches/playability/src/world_entities/weapons/swarm_launcher.cc

    r10179 r10345  
    150150  for( ObjectList<Playable>::const_iterator eIterator = Playable::objectList().begin(); eIterator !=Playable::objectList().end(); eIterator++)
    151151  {
    152     if( ((*eIterator)->getOMListNumber() == OM_GROUP_00) && ((*eIterator)->getClassCName() != "Weapon") && ((*eIterator)->getClassCName() != "Projectile") && ((*eIterator)->getAbsCoor() - this->getAbsCoor()).len() <= 300)
     152    if( ((*eIterator)->getOMListNumber() != (this->getOMListNumber() -1)) && ((*eIterator)->getClassCName() != "Weapon") && ((*eIterator)->getClassCName() != "Projectile") && ((*eIterator)->getAbsCoor() - this->getAbsCoor()).len() <= 300)
    153153    {
    154154      pj  = this->getProjectile();
Note: See TracChangeset for help on using the changeset viewer.