Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 5968 in orxonox.OLD for branches/network/src/world_entities/weapons


Ignore:
Timestamp:
Dec 7, 2005, 4:16:51 PM (19 years ago)
Author:
patrick
Message:

network: merged the trunk into the network with the command svn merge -r5824:HEAD ../trunk network, changes changed… bla bla..

Location:
branches/network/src/world_entities/weapons
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • branches/network/src/world_entities/weapons/aiming_turret.cc

    r5819 r5968  
    2626
    2727#include "animation3d.h"
    28 #include "sound_engine.h"
    2928
    3029#include "factory.h"
     
    9392
    9493  this->setCapability(WTYPE_ALLDIRS | WTYPE_TURRET);
    95   this->setProjectileType(CL_ROCKET);
     94  this->setProjectileType(CL_GUIDED_MISSILE);
    9695
    9796
     
    142141    return;
    143142
    144     pj->setVelocity(/*this->getVelocity()+*/(this->getAbsDir().apply(Vector(1,0,0))*250.0 + VECTOR_RAND(13)
     143  pj->setVelocity(/*this->getVelocity()+*/(this->getAbsDir().apply(Vector(1,0,0))*250.0 + VECTOR_RAND(13)
    145144            /*target->getAbsCoor() - this->getAbsCoor()*/)*.5);//this->getVelocity());
    146145
     146  pj->setTarget(this->target->getParent());
    147147  pj->setParent(NullParent::getInstance());
    148148  pj->setAbsCoor(this->getEmissionPoint());
  • branches/network/src/world_entities/weapons/bomb.cc

    r5769 r5968  
    1717#include "glincl.h"
    1818#include "state.h"
     19#include "model.h"
     20#include "primitive_model.h"
     21
     22#include "fast_factory.h"
    1923#include "list.h"
    20 #include "model.h"
    21 #include "vector.h"
    22 #include "fast_factory.h"
    2324
     25#include "object_manager.h"
    2426
    2527#include "particle_engine.h"
     
    5961Bomb::~Bomb ()
    6062{
     63  delete this->detonationSphere;
     64  delete this->detonationMaterial;
    6165
    6266}
     
    7175  this->setClassID(CL_BOMB, "Bomb");
    7276
     77
     78  this->detonationSphere = new PrimitiveModel(PRIM_SPHERE);
     79  this->detonationMaterial = new Material();
     80  this->detonationMaterial->setDiffuse(1, 0, 0);
     81  //   this->detonationMaterial->setTransparency(.1);
    7382  /**
    7483   * @todo: Write CL_PROTO_WORLD_ENTITY INTO THE src/defs/class_id.h (your own definition)
     
    101110void Bomb::tick(float time)
    102111{
    103   //Vector v = *this->flightDirection * ( this->speed * time * 1000 + 0.1);
    104   Vector v = this->velocity * (time);
    105   this->shiftCoor(v);
    106 
    107112  this->lifeCycle += time/this->lifeSpan;
    108113  if( this->lifeCycle >= 1.0)
     
    114119      this->deactivate();
    115120    }
     121  else if (this->lifeCycle > 0.9f)
     122    this->detonate ((this->lifeCycle-.89) *1000.0);
     123  else
     124  {
     125    Vector v = this->velocity * (time);
     126    this->shiftCoor(v);
     127  }
    116128}
    117129
     
    133145  glMultMatrixf((float*)matrix);
    134146
    135   if (model)
    136     model->draw();
     147  if (this->lifeCycle < .9)
     148  {
     149    if (model)
     150      model->draw();
     151  }
     152  else
     153  {
     154    glScalef((this->lifeCycle-.89) *1000.0,
     155              (this->lifeCycle-.89) *1000.0,
     156              (this->lifeCycle-.89) *1000.0);
     157    this->detonationMaterial->select();
     158    this->detonationSphere->draw();
     159  }
    137160  glPopMatrix();
    138161}
     
    145168void Bomb::collidesWith (WorldEntity* entity, const Vector& location)
    146169{
    147         this->detonate();
     170  if (this->lifeCycle < .9f && entity->isA(CL_NPC))
     171    this->lifeCycle = 0.9f;
    148172}
    149173
     
    157181{
    158182  State::getWorldEntityList()->remove(this);
     183  this->lifeCycle = 0.0f;
    159184  Bomb::fastFactory->kill(this);
    160185}
    161186
    162 void Bomb::detonate()
     187void Bomb::detonate(float size)
    163188{
    164   tIterator<WorldEntity>* it = State::getWorldEntityList()->getIterator();
    165   WorldEntity* lm = it->firstElement();
    166 
    167   while(lm != NULL)
     189  std::list<WorldEntity*>* detonationList = ObjectManager::distanceFromObject(*this, size, CL_NPC);
     190  if (detonationList != NULL)
    168191  {
    169 
    170     lm = it->nextElement();
     192    while( !detonationList->empty() )
     193    {
     194      detonationList->front()->collidesWith(this, Vector(0,0,0));
     195      detonationList->pop_front();
     196    }
     197    delete detonationList;
    171198  }
    172199}
  • branches/network/src/world_entities/weapons/bomb.h

    r5750 r5968  
    88
    99#include "projectile.h"
     10
    1011class FastFactory;
    1112class ParticleSystem;
    1213class ParticleEmitter;
     14class Material;
    1315
    1416//! A Class to ...
     
    3133  virtual void collidesWith (WorldEntity* entity, const Vector& location);
    3234  virtual void activate();
    33   virtual void detonate();
    3435  virtual void deactivate();
     36
     37  void detonate(float size);
    3538
    3639 private:
     
    4043
    4144  ParticleEmitter*                  emitter;
    42 
     45  Model*                            detonationSphere;
     46  Material*                         detonationMaterial;
    4347};
    4448
  • branches/network/src/world_entities/weapons/cannon.cc

    r5819 r5968  
    3232#include "list.h"
    3333#include "animation3d.h"
    34 #include "sound_engine.h"
    3534
    3635#include "null_parent.h"
     
    8382  this->setStateDuration(WS_DEACTIVATING, .4);
    8483
    85   this->setMaximumEnergy(100, 1);
    86   this->increaseEnergy(30);
     84  this->setMaximumEnergy(100, 20);
     85  this->increaseEnergy(100);
    8786  //this->minCharge = 2;
    8887
  • branches/network/src/world_entities/weapons/ground_turret.cc

    r5819 r5968  
    145145void GroundTurret::collidesWith (WorldEntity* entity, const Vector& location)
    146146{
    147 
     147  if (entity->isA(CL_PROJECTILE))
     148    this->setAbsDirSoft(Quaternion(-90, Vector(0,0,1)), 90);
    148149}
    149150
  • branches/network/src/world_entities/weapons/guided_missile.cc

    r5779 r5968  
    4848  this->energyMin = 1;
    4949  this->energyMax = 10;
    50   this->lifeSpan = 5;
    51   this->agility = 5;
     50  this->lifeSpan = 5.0;
     51  this->agility = 5.0;
    5252  this->maxVelocity = 100;
    5353
  • branches/network/src/world_entities/weapons/test_gun.cc

    r5819 r5968  
    3232#include "list.h"
    3333#include "animation3d.h"
    34 #include "sound_engine.h"
    3534
    3635#include "null_parent.h"
  • branches/network/src/world_entities/weapons/turret.cc

    r5819 r5968  
    2626#include "list.h"
    2727#include "animation3d.h"
    28 #include "sound_engine.h"
    2928
    3029#include "factory.h"
  • branches/network/src/world_entities/weapons/weapon.cc

    r5750 r5968  
    2828#include "load_param.h"
    2929#include "state.h"
    30 #include "sound_engine.h"
    3130#include "animation3d.h"
    3231#include "vector.h"
     32
     33#include "sound_source.h"
     34#include "sound_buffer.h"
    3335
    3436////////////////////
  • branches/network/src/world_entities/weapons/weapon_manager.cc

    r5779 r5968  
    110110  this->crossHairSizeAnim->addKeyFrame(100, .05, ANIM_LINEAR);
    111111  this->crossHairSizeAnim->addKeyFrame(50, .01, ANIM_LINEAR);
    112 
    113   this->targetIterator = NULL;
    114112}
    115113
     
    337335    }
    338336  }
    339 }
    340 
    341 
    342 /**
    343  * Selects an Entity from the NPC-list, and returns the Target
    344  */
    345 PNode* WeaponManager::getSomeTarget()
    346 {
    347    if (this->targetIterator == NULL)
    348    {
    349      std::list<BaseObject*>* npcList = ClassList::getList(CL_NPC);
    350      if (npcList != NULL)
    351      {
    352        this->targetIterator = npcList->begin();
    353      }
    354      else
    355        return NULL;
    356    }
    357 
    358    ///FIXME
    359 //   this->targetIterator++;
    360    PNode* retNode = dynamic_cast<PNode*>((*targetIterator));
    361 //   if (retNode == NULL && this->targetIterator->getList()->getSize() > 0)
    362 //     retNode =  dynamic_cast<PNode*>(targetIterator->firstElement());
    363 
    364    return retNode;
    365 }
    366 
    367 
    368 /**
    369  * Selects an Entity from the Entity-List, that is near of the carrier PNode.
    370  * @param carrier: The PNode from which the distance should be measured
    371  * @param distance: The Maximum Distance to Return.
    372  */
    373 PNode* WeaponManager::getDistanceTarget(const PNode* carrier, float distance)
    374 {
    375   std::list<BaseObject*>* npcList = ClassList::getList(CL_NPC);
    376   if (npcList != NULL)
    377   {
    378     list<BaseObject*>::iterator node;
    379     for (node= npcList->begin(); node != npcList->end(); node++)
    380       if ((carrier->getAbsCoor() - dynamic_cast<PNode*>(*node)->getAbsCoor()).len() < distance)
    381         return dynamic_cast<PNode*>(*node);
    382   }
    383   return this->getFixedTarget();
    384337}
    385338
  • branches/network/src/world_entities/weapons/weapon_manager.h

    r5779 r5968  
    8080    /** @returns a fixed target namely the Crosshair's 3D position */
    8181    inline PNode* getFixedTarget() const { return this->crosshair; };
    82     PNode* getSomeTarget();
    83     PNode* getDistanceTarget(const PNode* carrier, float distance);
    8482
    8583    void fire();
     
    109107    Crosshair*              crosshair;                                //!< an aim.
    110108    tAnimation<Crosshair>*  crossHairSizeAnim;                        //!< An animation for the crosshair (scaling)
    111 
    112     std::list<BaseObject*>::iterator  targetIterator;                           //!< An iterator for traversion lists of enemies.
    113109};
Note: See TracChangeset for help on using the changeset viewer.