Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Dec 19, 2006, 8:00:52 PM (18 years ago)
Author:
nicolasc
Message:

some beautifications, nothing new

Location:
branches/playability/src/world_entities/projectiles
Files:
7 edited

Legend:

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

    r10081 r10104  
    22   orxonox - the future of 3D-vertical-scrollers
    33
    4    Copyright (C) 2004 orx
     4   Copyright (C) 2004-2006 orx
    55
    66   This program is free software; you can redistribute it and/or modify
     
    1010
    1111   ### File Specific
    12    main-programmer: Patrick Boenzli
     12   main-programmer: Nicolas Schlumberger, Marc Schaerrer
    1313   co-programmer: Benjamin Grauer
    1414
     
    2929// #include "effects/billboard.h"
    3030#include "space_ships/space_ship.h"
    31 
    3231
    3332#include "class_id_DEPRECATED.h"
     
    6059  this->halo->setSize(.65, .65);
    6160  this->halo->setTexture("hbolt_halo2.png");
    62 
    6361}
    6462
     
    118116void HBolt::collidesWith(WorldEntity* entity, const Vector& location)
    119117{
    120   PRINTF(0)("Collision with HBolt\n");
    121   if (this->hitEntity != entity && entity->isA(CL_NPC))
     118  printf("Collision with HBolt\n");
     119  if (this->hitEntity != entity/* && entity->isA(CL_NPC)*/ || entity == this->target)
    122120    this->destroy( entity );
    123121  this->hitEntity = entity;
    124122  dynamic_cast<SpaceShip*>(entity)->damage( this->getPhysDamage(), this->getElecDamage());
    125   this->deactivate();
    126 }
    127 
    128 
    129 void HBolt::updateAngle (float time)
    130 {
    131   this->angle += this->rotationSpeed * time;
     123//   this->deactivate();
    132124}
    133125
     
    146138    this->deactivate();
    147139
    148   this->updateAngle(dt);
     140  this->angle += this->rotationSpeed * dt;
    149141
    150142
     
    183175  this->getModel()->draw();
    184176
    185 //   this->mat->select();
    186 /*   dynamic_cast<StaticModel*>(this->getModel())->draw();*/
    187 //   this->mat->select();
    188 //   dynamic_cast<StaticModel*>(this->getModel())->draw();
    189 //   this->mat->unselect();
    190 
    191 
    192177  glPopMatrix();
    193178}
  • branches/playability/src/world_entities/projectiles/hbolt.h

    r10074 r10104  
    3434    virtual void draw () const;
    3535
    36     virtual void updateAngle(float time);
    37     inline float getAngle() { return this->angle; };
    38 
    3936  private:
    4037    static FastFactory*               fastFactory;
  • branches/playability/src/world_entities/projectiles/lbolt.cc

    r10079 r10104  
    22   orxonox - the future of 3D-vertical-scrollers
    33
    4    Copyright (C) 2004 orx
     4   Copyright (C) 2004-2006 orx
    55
    66   This program is free software; you can redistribute it and/or modify
     
    1010
    1111   ### File Specific
    12    main-programmer: Patrick Boenzli
     12   main-programmer: Nicolas Schlumberger, Marc Schaerrer
    1313   co-programmer: Benjamin Grauer
    1414
  • branches/playability/src/world_entities/projectiles/mbolt.cc

    r10098 r10104  
    22   orxonox - the future of 3D-vertical-scrollers
    33
    4    Copyright (C) 2004 orx
     4   Copyright (C) 2004-2006 orx
    55
    66   This program is free software; you can redistribute it and/or modify
     
    1010
    1111   ### File Specific
    12    main-programmer: Patrick Boenzli
     12   main-programmer: Marc Schaerrer
    1313   co-programmer: Benjamin Grauer
    1414
  • branches/playability/src/world_entities/projectiles/projectile.cc

    r10035 r10104  
    153153
    154154
    155 void Projectile::collidesWith (SpaceShip* target, const Vector& location)
     155void Projectile::collidesWith (WorldEntity* target, const Vector& location)
    156156{
    157   target->damage(this->physDamage, this->elecDamage);
     157  dynamic_cast<SpaceShip*>(target)->damage(this->getPhysDamage(),this->getElecDamage());
     158//   this->destroy(NULL);
    158159  this->destroy(target);
    159160}
    160161
    161 
    162 /**
    163  *  this function gets called by tick to calculate the new flight direction
    164  *  @param curDirection direction vector
    165  *  @param estTargetDir target vector, pointing to where the target will be on hit
    166  *  @param angle = tick * turningSpeed
    167  *  @return normalized (new) direction vector
    168 */
    169 // Vector Projectile::newDirection(Vector curDirection, Vector estTargetDir, float angle)
    170 // {
    171 //   float tmp = angleDeg ( curDirection, estTargetDir);
    172 //   if ( unlikely(tmp == 0) ) { return curDirection; }
    173 //
    174 //   if( fabsf(angle) >  fabsf(tmp) ) { angle = tmp; }
    175 //
    176 //   Vector d = curDirection.cross(estTargetDir).cross(curDirection);
    177 //   d.normalize();
    178 //   if( unlikely( angle == 90)) { return d; }
    179 //
    180 //   Vector newDir = curDirection + d *  curDirection.len() * tan (angle);
    181 //   newDir.normalize();
    182 //   return newDir;
    183 // }
    184162
    185163
     
    190168void Projectile::tick (float dt)
    191169{
    192 /*
    193   if (target != NULL){
    194     float tti = this->target->getRelCoor().len() / this->getVelocity().len();
    195     Vector estTargetDir = (this->target->getRelCoor() + this->target->getVelocity()) * tti;
    196     this->velocity = this->newDirection(this->velocity, estTargetDir, this->turningSpeed * dt ) * this->velocity.len();
    197     Vector v = this->velocity * (dt);
    198     this->shiftCoor(v);
    199   }*/
    200 
    201170  if (this->tickLifeCycle(dt))
    202171    this->destroy( NULL );
  • branches/playability/src/world_entities/projectiles/projectile.h

    r10035 r10104  
    5050    virtual void destroy (WorldEntity* killer);
    5151
    52     virtual void collidesWith (SpaceShip* target, const Vector& location);  //!< collision handler; used against SpaceShip as most target will be
     52    virtual void collidesWith (WorldEntity* target, const Vector& location);  //!< collision handler; used against SpaceShip as most target will be
    5353
    5454
     
    8282
    8383    PNode*                  target;                   //!< A target for guided Weapons.
    84     //Vector                  targetPosition;           //!< current target position relative to projectile
    85     //Vector                  targetVelocity;           //!< current target speed and direction
    86     //float                   eta;                      //!< estimated time of arrival == time to kaboom!
    8784
    8885    OrxSound::SoundSource  soundSource;
  • branches/playability/src/world_entities/projectiles/swarm_projectile.cc

    r10095 r10104  
    33   orxonox - the future of 3D-vertical-scrollers
    44
    5    Copyright (C) 2004 orx
     5   Copyright (C) 2004-2006 orx
    66
    77   This program is free software; you can redistribute it and/or modify
     
    1111
    1212   ### File Specific
    13    main-programmer: Silvan Nellen
     13   main-programmer: Marc Schaerrer, Nicolas Schlumberger
    1414   co-programmer:
    1515
     
    5858
    5959  this->physDamage = 200;
     60  this->elecDamage = 0;
    6061
    6162  this->trail = new Trail(2.5,4,.2, this);
     
    135136    this->destroy( entity );
    136137  this->hitEntity = entity;
    137   dynamic_cast<SpaceShip*>(entity)->damage(this->getPhysDamage(),0);
     138  dynamic_cast<SpaceShip*>(entity)->damage(this->getPhysDamage(),this->getElecDamage());
     139  this->destroy(NULL);
    138140}
    139141
     
    219221//     else
    220222//       tti = (this->getAbsCoor() - this->target->getAbsCoor()).len() / sqrt ( projectileVelocity * projectileVelocity + targetVelocity * targetVelocity);
    221     Vector estTargetDir = (this->target->getAbsCoor() - this->getAbsCoor()).getNormalized() * maxVelocity;
     223    Vector estTargetDir = (this->target->getAbsCoor() - this->getAbsCoor());
     224//     estTargetDir.slerpTo(this->velocity, 1);
    222225    this->velocity = this->newDirection(this->velocity, estTargetDir, this->turningSpeed * time );
    223226  }
    224227  else
    225     if (likely(projectileVelocity != 0))
     228    if (likely(projectileVelocity != 0 || projectileVelocity != this->maxVelocity) )
    226229      this->velocity *= (this->maxVelocity / projectileVelocity); // set speed to max
    227230
     
    240243  this->lastDir = this->curDir;
    241244  this->curDir = this->velocity;
    242   if( (this->getAbsCoor() - this->target->getAbsCoor()).len() < 4)   // FIXME  Temp fake workaround for collision :)
     245  if( (this->getAbsCoor() - this->target->getAbsCoor()).len() < 1)   // FIXME  Temp fake workaround for collision :)
    243246  {
    244247    dynamic_cast<WorldEntity*>(target)->destroy( this);
     
    253256{
    254257
    255   printf("THIS SHOULD WORLk\n");
     258  printf("THIS SHOULD WORK!\n");
    256259
    257260  Projectile::destroy( killer );
     
    272275  glPushMatrix();
    273276
    274   Vector tmpDir = this->curDir *.5 + this->lastDir * .5;
     277  Vector tmpDir = this->curDir *.7 + this->lastDir * .3;
    275278
    276279  float matrix[4][4];
Note: See TracChangeset for help on using the changeset viewer.