Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jan 4, 2007, 10:29:09 PM (17 years ago)
Author:
nicolasc
Message:

bump

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/playability/src/world_entities/weapons/spike_launcher.cc

    r10170 r10180  
    6767SpikeLauncher::~SpikeLauncher ()
    6868{
     69  delete this->launcher;
     70
    6971  // model will be deleted from WorldEntity-destructor
    7072}
     
    9597
    9698  this->setCapability(WTYPE_ALLDIRS | WTYPE_TURRET | WTYPE_DIRECTIONAL | WTYPE_LIGHT);
    97   this->setProjectileTypeC("SpikeBall");
     99  this->setProjectileTypeC("Spike");
    98100
    99   this->loadModel("models/guns/turret1.obj", 1.0);
     101//   this->loadModel("models/guns/turret1.obj", 1.0);
     102  this->size = 2.5;
    100103
    101   this->setEmissionPoint(1.684, 0.472, 0);
    102   this->getProjectileFactory()->prepare(50);
     104  this->spikes = 26;
     105  this->launcher = new Vector [this->spikes];
     106
     107  this->launcher[0] = Vector(1.0, 0.0, 0.0);
     108  this->launcher[1] = Vector(0.0, 1.0, 0.0);
     109  this->launcher[2] = Vector(0.0, 0.0, 1.0);
     110
     111  this->launcher[3] = Vector(1.0, 1.0, 0.0);
     112  this->launcher[4] = Vector(0.0, 1.0, 1.0);
     113  this->launcher[5] = Vector(1.0, 0.0, 1.0);
     114  this->launcher[6] = Vector(1.0, -1.0, 0.0);
     115  this->launcher[7] = Vector(0.0, 1.0, -1.0);
     116  this->launcher[8] = Vector(-1.0, 0.0, 1.0);
     117
     118  this->launcher[9] = Vector(-1.0, 1.0, 1.0);
     119  this->launcher[10] = Vector(1.0, 1.0, 1.0);
     120  this->launcher[11] = Vector(1.0, -1.0, 1.0);
     121  this->launcher[12] = Vector(-1.0, -1.0, 1.0);
     122
     123  int tmp = this->spikes / 2;
     124  for (int i = 0; i < tmp; i++)
     125  {
     126    this->launcher[i].normalize();
     127    this->launcher[tmp + i] =  this->launcher[i] * (-1);
     128  }
     129
     130//   this->setEmissionPoint(1.684, 0.472, 0);
     131  this->getProjectileFactory()->prepare(this->spikes);  //we don't need more...
    103132
    104133  this->setActionSound(WA_SHOOT, "sound/explosions/explosion_1.wav");
     
    145174void SpikeLauncher::fire()
    146175{
    147   bool fired  = false;
     176  Projectile* pj = NULL;
     177//   for( ObjectList<Playable>::const_iterator eIterator = Playable::objectList().begin(); eIterator !=Playable::objectList().end(); eIterator++)
     178  for (int i = 0; i < this->spikes; i++)
     179  {
     180    pj  = this->getProjectile();
     181    if (pj == NULL) // if true, we do have a problem!!
     182      return;
    148183
    149   Projectile* pj = NULL;
    150   for( ObjectList<Playable>::const_iterator eIterator = Playable::objectList().begin(); eIterator !=Playable::objectList().end(); eIterator++)
    151   {
    152     if( ((*eIterator)->getOMListNumber() == OM_GROUP_00) && ((*eIterator)->getClassCName() != "Weapon") && ((*eIterator)->getClassCName() != "Projectile") && ((*eIterator)->getAbsCoor() - this->getAbsCoor()).len() <= 300)
    153     {
    154       pj  = this->getProjectile();
    155       if (pj == NULL)
    156         return;
    157      
    158       fired = true;
    159       pj->setVelocity(this->getVelocity()+(this->getAbsDir().apply(Vector(1,0,0))*115.0 + VECTOR_RAND(10)));
     184//     pj->setVelocity(this->getVelocity()+(this->getAbsDir().apply(Vector(1,0,0))*115.0 + VECTOR_RAND(10)));
     185    pj->setVelocity(this->launcher[i] * 200.0);
    160186
    161       pj->setParent(PNode::getNullParent());
    162       pj->setAbsCoor(this->getEmissionPoint());
    163       pj->setAbsDir(this->getAbsDir());
    164 //       dynamic_cast<SpikeProjectile*>(pj)->setTarget( (PNode*)(*eIterator) );
    165       pj->toList(OM_GROUP_01_PROJ);
    166       pj->activate();
    167     }
     187    pj->setParent(PNode::getNullParent());
     188    pj->setAbsCoor(this->getAbsCoor() + this->launcher[i] * this->size);
     189    pj->setAbsDir(Quaternion(this->launcher[i], 0));
     190    pj->activate();
    168191  }
    169   if( !fired)
    170     this->increaseEnergy( this->getProjectile()->getMinEnergy());
    171192}
Note: See TracChangeset for help on using the changeset viewer.