Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 10261 in orxonox.OLD for branches/playability/src


Ignore:
Timestamp:
Jan 17, 2007, 4:14:41 PM (18 years ago)
Author:
marcscha
Message:

Fixes and cleanups

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

Legend:

Unmodified
Added
Removed
  • branches/playability/src/world_entities/particles/emitter_node.cc

    r10107 r10261  
    3434  this->registerObject(this, EmitterNode::_objectList);
    3535
    36   this->toList(OM_DEAD_TICK);
     36  this->toList(OM_ENVIRON);
    3737
    3838  this->system = NULL;
     
    8787  if( this->lifeCycle >= 1.0f)
    8888  {
    89     this->removeNode();
    90     this->emitter->stop();
     89//   this->removeNode();
     90 //   this->emitter->stop();
    9191    this->emitter->setSystem(NULL);
    9292    this->started = false;
     93    this->toList(OM_NULL);
    9394
    94     this->destroy( NULL );
     95//    this->destroy( NULL );
    9596  }
    9697  this->shiftCoor(this->velocity * dt);
  • branches/playability/src/world_entities/projectiles/hbolt.cc

    r10180 r10261  
    113113}
    114114
    115 /*
    116 void HBolt::collidesWith(WorldEntity* entity, const Vector& location)
     115
     116void HBolt::hit (WorldEntity* entity, float damage)
    117117{
    118118  printf("Collision with HBolt\n");
     
    120120    this->destroy( entity );
    121121  this->hitEntity = entity;
    122   dynamic_cast<SpaceShip*>(entity)->damage( this->getPhysDamage(), this->getElecDamage());
     122 // dynamic_cast<SpaceShip*>(entity)->damage( this->getPhysDamage(), this->getElecDamage());
    123123  this->deactivate();
    124 }*/
     124}
    125125
    126126
  • branches/playability/src/world_entities/projectiles/hbolt.h

    r10180 r10261  
    2727    virtual void deactivate();
    2828
    29 //     virtual void collidesWith(WorldEntity* entity, const Vector& location);
     29    virtual void hit (WorldEntity* entity, float damage);
    3030
    3131    virtual void destroy (WorldEntity* killer);
  • branches/playability/src/world_entities/projectiles/lbolt.cc

    r10180 r10261  
    115115}
    116116
    117 /*
    118 void LBolt::collidesWith(WorldEntity* entity, const Vector& location)
     117
     118void LBolt::hit (WorldEntity* entity, float damage)
    119119{
    120120  PRINTF(0)("Collision with LBolt\n");
     
    122122    this->destroy( entity );
    123123  this->hitEntity = entity;
    124   dynamic_cast<SpaceShip*>(entity)->damage(this->getDamage(),0);
    125 //   this->deactivate();
    126 }*/
     124  this->deactivate();
     125}
    127126
    128127/**
  • branches/playability/src/world_entities/projectiles/lbolt.h

    r10180 r10261  
    2727    virtual void deactivate();
    2828
    29 //     virtual void collidesWith(WorldEntity* entity, const Vector& location);
     29    virtual void hit (WorldEntity* entity, float damage);
    3030
    3131    virtual void destroy (WorldEntity* killer);
  • branches/playability/src/world_entities/projectiles/mbolt.cc

    r10180 r10261  
    7575
    7676  dynamic_cast<StaticModel*>(this->getModel())->rebuild();
    77   this->buildObbTree(4);
     77  //this->buildObbTree(4);
    7878 
    7979  this->trail = new Trail(6, 4, .1, this);
     
    141141}
    142142
    143 /*
    144 void MBolt::collidesWith(WorldEntity* entity, const Vector& location)
     143void MBolt::hit (WorldEntity* entity, float damage)
    145144{
    146145
     
    148147    this->destroy( entity );
    149148  this->hitEntity = entity;
    150   dynamic_cast<SpaceShip*>(entity)->damage(this->getPhysDamage(),this->getElecDamage());
     149 // dynamic_cast<SpaceShip*>(entity)->damage(this->getPhysDamage(),this->getElecDamage());
    151150  //this->destroy(this);
    152151  this->deactivate();
     
    154153  return;
    155154
    156   //dynamic_cast<SpaceShip*>(entity)->damage( this->getPhysDamage(), this->getElecDamage());
    157   //entity->destroy(this);
    158   //this->deactivate();
    159 }*/
     155}
    160156
    161157/**
  • branches/playability/src/world_entities/projectiles/mbolt.h

    r10180 r10261  
    2828    virtual void deactivate();
    2929
    30 //     virtual void collidesWith(WorldEntity* entity, const Vector& location);
     30    virtual void hit (WorldEntity* entity, float damage);
    3131
    3232    virtual void destroy (WorldEntity* killer);
  • branches/playability/src/world_entities/projectiles/spike_ball.cc

    r10260 r10261  
    124124  }
    125125  this->setDamage(5);
    126   this->setHealth(0);
     126  this->setHealth(10);
    127127  this->setRotationAxis(VECTOR_RAND(1));
    128128  this->setAngle();
  • branches/playability/src/world_entities/projectiles/swarm_projectile.cc

    r10196 r10261  
    129129
    130130
    131 void SwarmProjectile::collidesWith(WorldEntity* entity, const Vector& location)
     131void SwarmProjectile::hit (WorldEntity* entity, float damage)
    132132{
    133133  if (this->hitEntity != entity)
     
    135135  this->hitEntity = entity;
    136136  //dynamic_cast<SpaceShip*>(entity)->damage(this->getPhysDamage(),this->getElecDamage());
    137   this->destroy(this);
     137 // this->destroy(this);
     138  this->deactivate();
    138139}
    139140
  • branches/playability/src/world_entities/projectiles/swarm_projectile.h

    r10132 r10261  
    2626    virtual void deactivate();
    2727
    28     virtual void collidesWith(WorldEntity* entity, const Vector& location);
     28    virtual void hit (WorldEntity* entity, float damage);
    2929
    3030    virtual void destroy (WorldEntity* killer);
  • branches/playability/src/world_entities/space_ships/space_ship.cc

    r10260 r10261  
    155155  Weapon* wpRight1 = new LightBlaster ();
    156156  wpRight1->setName( "LightBlaster");
    157   //wpRight1->setParent( this);
    158157  Weapon* wpLeft1 = new LightBlaster ();
    159158  wpLeft1->setName( "LightBlaster");
    160   //wpLeft1->setParent( this);
    161159
    162160  Weapon* wpRight2 = new MediumBlaster ();
    163161  wpRight2->setName( "MediumBlaster");
    164   //wpRight2->setParent( this);
    165162  Weapon* wpLeft2 = new MediumBlaster ();
    166163  wpLeft2->setName( "MediumBlaster");
    167   //wpLeft2->setParent( this);
    168164
    169165  Weapon* wpRight3 = new HeavyBlaster (1);
    170166  wpRight3->setName( "HeavyBlaster");
    171   //wpRight3->setParent( this);
    172167  Weapon* wpLeft3 = new HeavyBlaster (0);
    173168  wpLeft3->setName( "HeavyBlaster");
    174   //wpLeft3->setParent( this);
    175169
    176170  Weapon* cannon = new SwarmLauncher();
     
    180174  spike->setName( "SpikeThrower" );
    181175
    182   Weapon* spike2 = new SpikeLauncher();
    183   spike2->setName( "SpikeLauncher" );
     176//  Weapon* spike2 = new SpikeLauncher();
     177//  spike2->setName( "SpikeLauncher" );
    184178
    185179  this->weaponMan.addWeapon( wpLeft1, 0, 0);
     
    203197  this->secWeaponMan.addWeapon( cannon, 0, 0);
    204198  this->secWeaponMan.addWeapon( spike, 1, 1);
    205   this->secWeaponMan.addWeapon( spike2, 2, 2);
     199//  this->secWeaponMan.addWeapon( spike2, 2, 2);
    206200
    207201
    208202  this->weaponMan.changeWeaponConfig(3);
    209   this->secWeaponMan.changeWeaponConfig(1);
     203  this->secWeaponMan.changeWeaponConfig(0);
    210204
    211205  curWeaponPrimary    = 3;
     
    367361  this->setSupportedPlaymodes(Playable::Horizontal | Playable::Vertical);
    368362
    369  
    370   this->trail = new Trail( 10, 10, .2, this);
    371   //this->trail->setParent( this);
     363  /// FIXME
     364  this->trail = new Trail( 5, 10, .2, this);
    372365  this->trail->setTexture( "maps/engine.png");
    373366
    374   this->trailL = new Trail( 10, 10, .2, this);
    375   //this->trailL->setParent( this);
     367  this->trailL = new Trail( 5, 10, .2, this);
    376368  this->trailL->setTexture( "maps/engine.png");
    377369
    378   this->trailR = new Trail( 10, 10, .2, this);
    379   //this->trailR->setParent( this);
     370  this->trailR = new Trail( 5, 10, .2, this);
    380371  this->trailR->setTexture( "maps/engine.png");
    381372
     
    384375
    385376  //FIXME Just testaddition to show the wobblegrid
     377/*
    386378  this->test  = new Wobblegrid(5);
    387379  test->setTexture("maps/blub.png");
     
    389381  test->setAbsCoor( this->getAbsCoor() + Vector(0, 2, 0));
    390382  test->setParent( this);
     383*/
    391384 
    392385}
     
    448441void SpaceShip::postSpawn ()
    449442{
     443  if(this->hasPlayer())
     444    Playable::postSpawn();
     445
    450446  //setCollision(new CollisionCluster(1.0, Vector(0,0,0)));
    451447}
     
    460456
    461457WorldEntity* ref = NULL;
    462 /**
    463  *  this function is called, when two entities collide
    464  * @param entity: the world entity with whom it collides
    465  *
    466  * Implement behaviour like damage application or other miscellaneous collision stuff in this function
    467  */
    468 void SpaceShip::collidesWith(WorldEntity* entity, const Vector& location)
    469 {
    470 }
    471458
    472459/**
     
    485472  glMultMatrixf((float*)matrix);
    486473  //glScalef(2.0, 2.0, 2.0);  // no double rescale
    487  
     474  /*    // FIXME
    488475  this->trail->draw();
    489476 
     
    493480  glTranslatef(0,0,1);
    494481  this->trailR->draw();
     482*/
    495483  glPopMatrix();
    496484  //this->debug(0);
     
    503491void SpaceShip::tick (float time)
    504492{
    505   // Playable::tick(time);$
    506   this->test->tick(time);
     493  // Playable::tick(time);
     494
     495 // this->test->tick(time);
     496
    507497  // Own Tick Setup, as a different fire routine is used on the weapon manager
    508498  this->weaponMan.tick(time);
     
    552542  this->oldPos    = this->getAbsCoor();
    553543
     544//FIXME
    554545  this->trail->tick(time);
    555546  this->trailL->tick(time);
    556547  this->trailR->tick(time);
    557 
    558   this->weaponMan.setParentEntity( this);
    559   this->secWeaponMan.setParentEntity( this);
    560548
    561549  //orient the spaceship in direction of the mouse
     
    566554  //this->setAbsDirSoft(mouseDir,5);
    567555  */
    568 
    569   // this is the air friction (necessary for a smooth control)
    570   /*
    571   if(travelSpeed >= 120) velocity -= velocity.getNormalized()*travelSpeed*travelSpeed*0.0001;
    572   else if (travelSpeed <= 80) velocity -= velocity.getNormalized()*travelSpeed*0.001;
    573   */
    574 
    575   //other physics (gravity)
    576   //if(travelSpeed < 120)
    577   //move += Vector(0,-1,0)*60*time + Vector(0,1,0)*travelSpeed/2*time;
    578 
    579   //hoover effect
    580   //cycle += time;
    581   //this->shiftCoor(Vector(0,1,0)*cos(this->cycle*2.0)*0.02);
    582 
    583   //readjust
    584   //if (this->getAbsDirZ().y > 0.1) this->shiftDir(Quaternion(time*0.3, Vector(1,0,0)));
    585   //else if (this->getAbsDirZ().y < -0.1) this->shiftDir(Quaternion(-time*0.3, Vector(1,0,0)));
    586 
    587   //SDL_WarpMouse(GraphicsEngine::getInstance()->getResolutionX()/2, GraphicsEngine::getInstance()->getResolutionY()/2);
    588 
    589556  /*
    590557  this->shiftCoor(move);
     
    674641void SpaceShip::destroy( WorldEntity* killer )
    675642{
     643  if(this->hasPlayer())
     644    Playable::destroy( killer);
     645
    676646  PRINTF(5)("spaceship destroy\n");
    677  
     647
    678648  EmitterNode* node  = NULL;
    679649  DotEmitter* emitter = NULL;
     
    706676  if( !node->start())
    707677    PRINTF(0)("Explosion node not correctly started!");
    708 
    709678/*
    710679  PNode* node          = new PNode();
     
    713682  explosion->explode( node, Vector(5,5,5));
    714683*/
    715 
     684/*
    716685  if( this->hasPlayer())
    717686  {
     
    720689  }
    721690  else
    722   {
     691  {*/
    723692    this->setAbsCoor( this->getAbsCoor() + Vector(100,0,0) + Vector(1,0,0) * VECTOR_RAND(150).dot(Vector(1,0,0)));
    724   }
     693  //}
    725694
    726695}
     
    728697void SpaceShip::respawn( )
    729698{
    730   this->unhide();
    731   /*for(ObjectList<PNode>::const_iterator it = this->getNodesChildren().begin(); it != this->getNodesChildren().end(); it++)
    732   {
    733     if( dynamic_cast<WorldEntity*>(*it) != NULL)
    734       dynamic_cast<WorldEntity*>(*it)->toList( OM_GROUP_00);
    735   }*/
    736   /*
    737   if( this->hasPlayer())
    738   {
    739     this->toList( OM_GROUP_01);
    740     for(ObjectList<PNode>::const_iterator it = this->getNodesChildren().begin(); it != this->getNodesChildren().end(); it++)
    741         {
    742           if( likely( dynamic_cast<Weapon*>(*it) != NULL))
    743                 dynamic_cast<WorldEntity*>(*it)->toList( OM_GROUP_00_PROJ);
    744         }
    745   }
    746   else
    747   {
    748     this->toList( OM_GROUP_00);
    749     for(ObjectList<PNode>::const_iterator it = this->getNodesChildren().begin(); it != this->getNodesChildren().end(); it++)
    750         {
    751           if( likely( dynamic_cast<Weapon*>(*it) != NULL))
    752                 dynamic_cast<WorldEntity*>(*it)->toList( OM_GROUP_01_PROJ);
    753         }
    754   }*/
    755 
     699  Playable::respawn();
    756700}
    757701
     
    10951039{
    10961040  this->damage(killer->getDamage(),0);
    1097   killer->collidesWith( this, this->getAbsCoor());
    1098   //this->collidesWith(killer, this->getAbsCoor());
    10991041}
    11001042
  • branches/playability/src/world_entities/space_ships/space_ship.h

    r10156 r10261  
    5555    inline Vector getVelocity() { return this->velocity; };
    5656
    57     virtual void collidesWith(WorldEntity* entity, const Vector& location);
    5857    virtual void tick(float time);
    5958    virtual void draw() const;
     
    200199    Trail*                trailR;              //!< Burst trail
    201200
    202     Wobblegrid*           test;
     201//    Wobblegrid*           test;
    203202
    204203};
  • branches/playability/src/world_entities/weapons/heavy_blaster.cc

    r10260 r10261  
    3737  for (int i = 0; i < this->getBarrels(); i++)
    3838  {
     39   delete [] this->shootAnim[i];
     40   delete [] this->objComp[i];
     41  }
     42  delete [] this->emissionPoint;
     43 
     44   delete [] this->shootAnim;
     45   delete [] this->objComp;
     46/*
    3947    for(int j = 0; j < this->getSegs(); j++)
    4048    {
     
    4553    delete this->objComp[i];
    4654    delete this->emissionPoint[i];
    47   }
    48 
    49 //   this->deconstr();
     55  }*/
     56
     57//  this->deconstr();
    5058     // model will be deleted from WorldEntity-destructor
    5159}
  • branches/playability/src/world_entities/weapons/light_blaster.cc

    r10170 r10261  
    3434LightBlaster::~LightBlaster()
    3535{
     36
    3637  for (int i = 0; i < this->getBarrels(); i++)
    3738  {
     39   delete [] this->shootAnim[i];
     40   delete [] this->objComp[i];
     41  }
     42  delete [] this->emissionPoint;
     43   delete [] this->shootAnim;
     44   delete [] this->objComp;
     45/*
    3846    for(int j = 0; j < this->getSegs(); j++)
    3947    {
     
    4452    delete this->objComp[i];
    4553    delete this->emissionPoint[i];
    46   }
     54  }*/
    4755
    48   this->deconstr();
     56//  this->deconstr();
    4957      // model will be deleted from WorldEntity-destructor
    5058}
Note: See TracChangeset for help on using the changeset viewer.