Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 10271 in orxonox.OLD for branches/playability/src/world_entities


Ignore:
Timestamp:
Jan 17, 2007, 6:15:21 PM (18 years ago)
Author:
nicolasc
Message:

working spikeballs

Location:
branches/playability/src/world_entities
Files:
8 edited

Legend:

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

    r10260 r10271  
    132132void Spike::tick (float dt)
    133133{
    134   //Vector v = *this->flightDirection * ( this->speed * time * 1000 + 0.1);
    135134  Vector v = this->velocity * dt;
    136135  this->shiftCoor(v);
     
    140139
    141140  angle += rotationSpeed * dt;
    142 
    143 /*  printf( "spike tick\n" );*/
    144141}
    145142
     
    160157{
    161158  glPushAttrib(GL_ENABLE_BIT);
    162   //glDisable(GL_LIGHTING);
    163 
    164159  glMatrixMode(GL_MODELVIEW);
    165160  glPushMatrix();
     
    170165  glRotatef (this->getAbsDir().getSpacialAxisAngle(), tmpRot.x, tmpRot.y, tmpRot.z );
    171166  glRotatef(angle, 1.0, 0.0, 0.0);
     167
    172168  this->getAbsDir().matrix (matrix);
    173169  glMultMatrixf((float*)matrix);
    174170  this->getModel()->draw();
    175171
    176 //   this->halo->draw();
    177 
    178172  glPopMatrix();
    179 
    180173  glPopAttrib();
    181174}
  • branches/playability/src/world_entities/projectiles/spike_ball.cc

    r10261 r10271  
    179179{
    180180  Spike* pj = NULL;
    181 /*  printf( "KA-" );*/
     181
     182  updateFireDir();
     183
    182184  for ( int i = 0; i < this->getFragments(); i++)
    183185  {
    184186    pj  = new Spike();
    185187    assert( pj );
    186 /*    printf(" %i", i);*/
    187188    pj->setParent(PNode::getNullParent());
    188189
    189     pj->setVelocity(this->launcher[i].getNormalized() * 250.0);
     190    dynamic_cast<Spike*>(pj)->setVelocity(this->launcher[i].getNormalized() * 250.0);
    190191
    191192    pj->setParent(PNode::getNullParent());
    192193    pj->setAbsCoor(this->getAbsCoor() + this->launcher[i] * this->size);
    193     Quaternion q;
    194     pj->setAbsDir(q.lookAt(Vector(), this->launcher[i], VECTOR_RAND(1)));
     194//     Quaternion q;
     195//     pj->setAbsDir(q.lookAt(Vector(), this->launcher[i], VECTOR_RAND(1)));
     196    pj->setRelDir(Quaternion(0, this->launcher[i]));
    195197
    196198    pj->toList(this->getOMListNumber());
    197199
    198 /*
    199     pj->setAbsCoor(this->getAbsCoor() + VECTOR_RAND(3));
    200     pj->setAbsDir(this->getAbsDir());*/
    201200    pj->activate();
    202201  }
    203 /*  printf( "BOOM\n" );*/
    204202}
    205203
     
    219217  ca = cos (this->getAngle());
    220218  sa = sin (this->getAngle());
    221 // final version below... easier to to cheat with the one above.
    222219
    223220  m[0][0] = nx * nx * (1 - ca) + ca;
     
    233230  float x, y, z;
    234231  for (int i = 0; i < this->getFragments(); i++){
    235 //     printf("%i ", i);
    236232    x = m[0][0] * this->launcher[i].x + m[0][1] * this->launcher[i].y + m[0][2] * this->launcher[i].z;
    237233    y = m[1][0] * this->launcher[i].x + m[1][1] * this->launcher[i].y + m[1][2] * this->launcher[i].z;
     
    240236    this->launcher[i] = Vector (x, y, z);
    241237  }
    242 //   printf("\n");
    243238
    244239  for( int i = 0; i < 3 ; i++)
     
    254249void SpikeBall::tick (float dt)
    255250{
    256   //Vector v = *this->flightDirection * ( this->speed * time * 1000 + 0.1);
    257   Vector v = this->getVelocity() * dt;
     251  Vector v = this->velocity * dt;
    258252  this->shiftCoor(v);
    259253
    260 //   if(this->lifeCycle > .9){
    261 // /*    printf("time to blow:  ");*/
    262 // //     this->weaponMan->fire();
    263 // /*    this->blow();*/
    264 //   }
    265254
    266255  if (this->tickLifeCycle(dt)){
     
    270259
    271260  this->updateAngle( dt );
    272 //   angle += rotationSpeed * dt;
    273261}
    274262
     
    289277{
    290278  glPushAttrib(GL_ENABLE_BIT);
    291   //glDisable(GL_LIGHTING);
    292 
    293279  glMatrixMode(GL_MODELVIEW);
    294280  glPushMatrix();
     
    296282  float matrix[4][4];
    297283  glTranslatef (this->getAbsCoor ().x, this->getAbsCoor ().y, this->getAbsCoor ().z);
     284
     285  this->halo->draw();
    298286
    299287  glRotatef(angle, this->getRotationAxis().x, this->getRotationAxis().y, this->getRotationAxis().z);
     
    302290  this->getModel()->draw();
    303291
    304   this->halo->draw();
    305 
    306292  glPopMatrix();
    307 
    308293  glPopAttrib();
    309294}
  • branches/playability/src/world_entities/projectiles/spike_ball.h

    r10260 r10271  
    4141    virtual void draw () const;
    4242
    43 //     inline void setVelocity(Vector velocity) { this->velocity = velocity; }
     43    inline void setVelocity(Vector velocity) { this->velocity = velocity; }
    4444
    4545//     inline Vector getRotationVector() { return this->rotationVector; }
     
    5353    ParticleEmitter*                  emitter;
    5454
    55 //     float                             speed;
    56 
    57 //     float                             angle;
    58 //     float                             rotationSpeed;
    59 //     Vector                            rotationVector;
     55    Vector                            velocity;
    6056
    6157    Billboard*                        halo;
     
    6359    WorldEntity* hitEntity; // FIXME TEMPORARY
    6460
    65 //     WeaponManager*                   weaponMan;
    66 
    6761    void updateFireDir();
    6862    virtual void blow();
    6963
    70 //     int           spikes;
    7164    Vector*       launcher;
    7265    float         size;
  • branches/playability/src/world_entities/projectiles/swarm_projectile.cc

    r10261 r10271  
    219219
    220220
    221 /** old  guiding functuion*/
     221/** old  guiding function*/
    222222
    223223  float projectileVelocity = this->getVelocity().len();
     
    229229    if (likely(projectileVelocity != 0 || projectileVelocity != this->maxVelocity) )
    230230      this->velocity *= (this->maxVelocity / projectileVelocity); // set speed to max
    231 
    232 //   printf("position: %f, %f, %f\n", this->getAbsCoor().x, this->getAbsCoor().y, this->getAbsCoor().z);
    233 //   printf("target position: %f, %f, %f\n", this->target->getAbsCoor().x, this->target->getAbsCoor().y, this->target->getAbsCoor().z);
     231/*
     232  printf("position: %f, %f, %f\n", this->getAbsCoor().x, this->getAbsCoor().y, this->getAbsCoor().z);
     233  printf("target position: %f, %f, %f\n", this->target->getAbsCoor().x, this->target->getAbsCoor().y, this->target->getAbsCoor().z);*/
    234234
    235235  this->shiftCoor(this->velocity * time);
    236236
    237 
    238237/*
     238
    239239  Vector pjV = this->getVelocity();
    240240  Vector tV = this->target->getVelocity();
     
    244244
    245245  float A = 2 * pT.len() * pT.len();
    246   float B = 2 * a.len() * tV.len();
     246  float B = 2 * a.len() * a.len();
    247247  float D = 2 * sqrt(B * B - 4 * pT.len() * pT.len() *(tV.len() * tV.len() - pjV.len() * pjV.len()));
    248248  float tti;
  • branches/playability/src/world_entities/space_ships/space_ship.cc

    r10270 r10271  
    201201
    202202  this->weaponMan.changeWeaponConfig(3);
    203   this->secWeaponMan.changeWeaponConfig(0);
     203  this->secWeaponMan.changeWeaponConfig(1);
    204204
    205205  curWeaponPrimary    = 3;
  • branches/playability/src/world_entities/weapons/heavy_blaster.cc

    r10261 r10271  
    4141  }
    4242  delete [] this->emissionPoint;
    43  
    44    delete [] this->shootAnim;
    45    delete [] this->objComp;
     43  delete [] this->shootAnim;
     44  delete [] this->objComp;
    4645/*
    4746    for(int j = 0; j < this->getSegs(); j++)
  • branches/playability/src/world_entities/weapons/spike_launcher.cc

    r10224 r10271  
    239239void SpikeLauncher::fire()
    240240{
    241   // temporary solution to test the module
    242241  updateFireDir(VECTOR_RAND(1), 20);
    243242
    244   printf("firing spikes\n");
    245243  Projectile* pj = NULL;
    246244  for (int i = 0; i < this->spikes; i++)
     
    250248      return;
    251249
    252 //     pj->setVelocity(this->getVelocity()+(this->getAbsDir().apply(Vector(1,0,0))*115.0 + VECTOR_RAND(10)));
    253250    pj->setVelocity(this->launcher[i].getNormalized() * 300.0);
    254251
     
    257254    Quaternion q;
    258255    pj->setRelDir(q.lookAt(Vector(), this->launcher[i], VECTOR_RAND(1)));
    259 //     pj->setRelDir(90, this->launcher[i].x, this->launcher[i].y, this->launcher[i].z);
    260 
    261 /*    pj->toList(this->getOMListNumber());*/
     256
    262257    pj->activate();
    263258  }
  • branches/playability/src/world_entities/weapons/spike_thrower.cc

    r10260 r10271  
    8282  animation1->addKeyFrame(Vector(0, 0, 0), Quaternion(), 0.3, ANIM_LINEAR, ANIM_CONSTANT);
    8383  animation2->addKeyFrame(Vector(0, 0, 0), Quaternion(), 0.3, ANIM_LINEAR, ANIM_CONSTANT);
    84   animation2->addKeyFrame(Vector(0, -.5, 0), Quaternion(), 0.3, ANIM_LINEAR, ANIM_CONSTANT);*/
    85 /*
     84  animation2->addKeyFrame(Vector(0, -.5, 0), Quaternion(), 0.3, ANIM_LINEAR, ANIM_CONSTANT);
     85
    8686  animation1->setInfinity(ANIM_INF_CONSTANT);
    8787  animation2->setInfinity(ANIM_INF_CONSTANT);*/
     
    104104  this->getProjectileFactory()->prepare(50);
    105105
    106 //   this->setActionSound(WA_SHOOT, "sound/explosions/explosion_1.wav");
    107 //   this->setActionSound(WA_ACTIVATE, "sound/vocals/missiles.wav");
    108 //   this->setActionSound(WA_RELOAD, "sound/vocals/reload.wav");
     106  this->setActionSound(WA_SHOOT, "sound/explosions/explosion_1.wav");
     107  this->setActionSound(WA_ACTIVATE, "sound/vocals/missiles.wav");
     108  this->setActionSound(WA_RELOAD, "sound/vocals/reload.wav");
    109109
    110110}
     
    156156  pj->setParent(PNode::getNullParent());
    157157
    158 //   pj->setVelocity(this->getParent()->getAbsDir().apply(Vector(1,0,0))*200 + this->getParent()->getParent()->getVelocity());
    159   pj->setVelocity(this->getParent()->getVelocity() + this->getAbsDir().apply(Vector(1,0,0))*160);
     158  dynamic_cast<SpikeBall*>(pj)->setVelocity(this->getAbsDir().apply(Vector(1,0,0))*110);
    160159
    161160  pj->setAbsCoor(this->getEmissionPoint());
Note: See TracChangeset for help on using the changeset viewer.