Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jan 17, 2007, 9:23:49 PM (17 years ago)
Author:
nicolasc
Message:

code cleanup, rebuilt spikeball

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/playability/src/world_entities/projectiles/spike_ball.cc

    r10281 r10286  
    5555  this->emitter->setEmissionVelocity(50.0);
    5656
    57 //   this->speed = 150;
    58 /*
    59   this->angle = 0;
    60   this->rotationSpeed = 130;*/
    6157  this->setRotationSpeed(130);
    6258
     
    7066
    7167  this->launcher = new Vector [this->getFragments()];
    72 
    73 //   this->fastFactory = tFastFactory<Spike>::getFastFactory(CL_SPIKE, "Spike");
    74 
    75 /*
    76   this->weaponMan = new WeaponManager(dynamic_cast<WorldEntity*>(this));
    77   this->weaponMan->setParentEntity(this);
    78   this->weaponMan->setSlotCount(1);
    79   this->weaponMan->setSlotPosition(0, Vector(0, 0, 0));
    80   this->weaponMan->setSlotCapability(0, WTYPE_ALLDIRS | WTYPE_DIRECTIONAL);
    81 
    82   Weapon* cannon = new SpikeLauncher();
    83   cannon->setName( "SpikeLauncher");
    84   this->weaponMan->addWeapon(cannon, 0, 0);
    85   this->weaponMan->changeWeaponConfig(0);
    86 
    87   this->weaponMan->getWeapon(0)->increaseEnergy(50);*/
    8868}
    8969
     
    172152  this->hitEntity = entity;
    173153  dynamic_cast<SpaceShip*>(entity)->damage(this->getDamage(),0);
    174 //   this->deactivate();
    175154}
    176155
     
    178157void SpikeBall::blow()
    179158{
     159  updateFireDir();
     160
    180161  Spike* pj = NULL;
    181 /*  printf( "KA-" );*/
    182162  for ( int i = 0; i < this->getFragments(); i++)
    183163  {
    184164    pj  = new Spike();
    185165    assert( pj );
    186 /*    printf(" %i", i);*/
    187166    pj->setParent(PNode::getNullParent());
    188167
     
    191170    pj->setParent(PNode::getNullParent());
    192171    pj->setAbsCoor(this->getAbsCoor() + this->launcher[i] * this->size);
    193     Quaternion q;
    194     pj->setAbsDir(q.lookAt(Vector(), this->launcher[i], VECTOR_RAND(1)));
     172//     Quaternion q;
     173    pj->setAbsDir(Quaternion(this->launcher[i], 0));
    195174
    196175    pj->toList(this->getOMListNumber());
    197176
    198 /*
    199     pj->setAbsCoor(this->getAbsCoor() + VECTOR_RAND(3));
    200     pj->setAbsDir(this->getAbsDir());*/
    201177    pj->activate();
    202178  }
    203 /*  printf( "BOOM\n" );*/
    204179}
    205180
     
    219194  ca = cos (this->getAngle());
    220195  sa = sin (this->getAngle());
    221 // final version below... easier to to cheat with the one above.
    222196
    223197  m[0][0] = nx * nx * (1 - ca) + ca;
     
    233207  float x, y, z;
    234208  for (int i = 0; i < this->getFragments(); i++){
    235 //     printf("%i ", i);
    236209    x = m[0][0] * this->launcher[i].x + m[0][1] * this->launcher[i].y + m[0][2] * this->launcher[i].z;
    237210    y = m[1][0] * this->launcher[i].x + m[1][1] * this->launcher[i].y + m[1][2] * this->launcher[i].z;
     
    240213    this->launcher[i] = Vector (x, y, z);
    241214  }
    242 //   printf("\n");
    243215
    244216  for( int i = 0; i < 3 ; i++)
     
    254226void SpikeBall::tick (float dt)
    255227{
    256   //Vector v = *this->flightDirection * ( this->speed * time * 1000 + 0.1);
    257   Vector v = this->getVelocity() * dt;
     228  Vector v = this->velocity * dt;
    258229  this->shiftCoor(v);
    259 
    260 //   if(this->lifeCycle > .9){
    261 // /*    printf("time to blow:  ");*/
    262 // //     this->weaponMan->fire();
    263 // /*    this->blow();*/
    264 //   }
    265230
    266231  if (this->tickLifeCycle(dt)){
     
    270235
    271236  this->updateAngle( dt );
    272 //   angle += rotationSpeed * dt;
    273237}
    274238
     
    289253{
    290254  glPushAttrib(GL_ENABLE_BIT);
    291   //glDisable(GL_LIGHTING);
    292 
    293255  glMatrixMode(GL_MODELVIEW);
    294256  glPushMatrix();
     
    305267
    306268  glPopMatrix();
    307 
    308269  glPopAttrib();
    309270}
Note: See TracChangeset for help on using the changeset viewer.