Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jan 10, 2007, 3:37:40 PM (17 years ago)
Author:
nicolasc
Message:

bump

File:
1 edited

Legend:

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

    r10196 r10217  
    108108  this->launcher = new Vector [this->spikes];
    109109
     110  this->getProjectileFactory()->prepare(this->spikes);  //we don't need more...
     111
     112//   this->setActionSound(WA_SHOOT, "sound/explosions/explosion_1.wav");
     113//   this->setActionSound(WA_ACTIVATE, "sound/vocals/missiles.wav");
     114//   this->setActionSound(WA_RELOAD, "sound/vocals/reload.wav");
     115
     116}
     117
     118void SpikeLauncher::loadParams(const TiXmlElement* root)
     119{
     120  Weapon::loadParams(root);
     121}
     122
     123void SpikeLauncher::activate()
     124{
    110125  this->launcher[0] = Vector(1.0, 0.0, 0.0);
    111126  this->launcher[1] = Vector(0.0, 1.0, 0.0);
     
    130145    this->launcher[tmp + i] =  this->launcher[i] * (-1);
    131146  }
    132 
    133   this->getProjectileFactory()->prepare(this->spikes);  //we don't need more...
    134 
    135 //   this->setActionSound(WA_SHOOT, "sound/explosions/explosion_1.wav");
    136 //   this->setActionSound(WA_ACTIVATE, "sound/vocals/missiles.wav");
    137 //   this->setActionSound(WA_RELOAD, "sound/vocals/reload.wav");
    138 
    139 }
    140 
    141 void SpikeLauncher::loadParams(const TiXmlElement* root)
    142 {
    143   Weapon::loadParams(root);
    144 }
    145 
    146 void SpikeLauncher::activate()
    147 {
    148147}
    149148
     
    196195  ca = cos (this->getParent()->getAngle());
    197196  sa = sin (this->getParent()->getAngle());*/
     197/*
     198  float * m = new float [9];
     199  m[0] = 1.0f+(1.0f-ca)*(nx*nx-1.0f);
     200  m[1] = -nz*sa+(1.0f-ca)*nx*ny;
     201  m[2] = ny*sa+(1.0f-ca)*nx*nz;
     202  m[3] = nz*sa+(1.0f-ca)*nx*ny;
     203  m[4] = 1.0f+(1.0f-ca)*(ny*ny-1.0f);
     204  m[5] = -nx*sa+(1.0f-ca)*ny*nz;
     205  m[6] = -ny*sa+(1.0f-ca)*nx*nz;
     206  m[7] = nx*sa+(1.0f-ca)*ny*nz;
     207  m[8] = 1.0f+(1.0f-ca)*(nz*nz-1.0f);*/
    198208
    199209  m[0][0] = nx * nx * (1 - ca) + ca;
     
    209219  float x, y, z;
    210220  for (int i = 0; i < this->spikes;i++){
     221
    211222    x = m[0][0] * this->launcher[i].x + m[0][1] * this->launcher[i].y + m[0][2] * this->launcher[i].z;
    212223    y = m[1][0] * this->launcher[i].x + m[1][1] * this->launcher[i].y + m[1][2] * this->launcher[i].z;
    213224    z = m[2][0] * this->launcher[i].x + m[2][1] * this->launcher[i].y + m[2][2] * this->launcher[i].z;
    214 
     225/*
     226    x = this->launcher[i].x * m[0] + this->launcher[i].y * m[1] + this->launcher[i].z * m[2];
     227    y = this->launcher[i].x * m[3] + this->launcher[i].y * m[4] + this->launcher[i].z * m[5];
     228    z = this->launcher[i].x * m[6] + this->launcher[i].y * m[7] + this->launcher[i].z * m[8];*/
    215229    this->launcher[i] = Vector (x, y, z);
    216230  }
     
    224238void SpikeLauncher::fire()
    225239{
    226   // temporary solution to test module
     240  // temporary solution to test the module
    227241  updateFireDir(VECTOR_RAND(1), 20);
    228242
    229 
     243  printf("fireing spikes\n");
    230244  Projectile* pj = NULL;
    231245  for (int i = 0; i < this->spikes; i++)
     
    240254    pj->setParent(PNode::getNullParent());
    241255    pj->setAbsCoor(this->getAbsCoor() + this->launcher[i] * this->size);
    242     pj->setRelDir(0, this->launcher[i].x, this->launcher[i].y, this->launcher[i].z);
     256//     Quaternion q;
     257//     pj->setRelDir(q.lookAt(Vector(), this->launcher[i], VECTOR_RAND(1)));
     258    pj->setRelDir(90, this->launcher[i].x, this->launcher[i].y, this->launcher[i].z);
    243259
    244260    pj->toList(this->getOMListNumber());
Note: See TracChangeset for help on using the changeset viewer.