Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Dec 16, 2006, 2:12:41 AM (18 years ago)
Author:
marcscha
Message:

Some surprises for comming wednesday

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

Legend:

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

    r10079 r10081  
    122122    this->destroy( entity );
    123123  this->hitEntity = entity;
    124   dynamic_cast<SpaceShip*>(entity)->damage(this->getPhysDamage(),0);
    125 //   this->deactivate();
     124  dynamic_cast<SpaceShip*>(entity)->damage( this->getPhysDamage(), this->getElecDamage());
     125  this->deactivate();
    126126}
    127127
  • branches/playability/src/world_entities/projectiles/mbolt.cc

    r10078 r10081  
    3434#include "static_model.h"
    3535
     36#include "effects/trail.h"
     37
    3638
    3739#include "class_id_DEPRECATED.h"
     
    4648  this->registerObject(this, MBolt::_objectList);
    4749  this->loadModel("models/projectiles/mbolt.obj");
     50
    4851 
    4952  //this->loadModel("models/projectiles/laser.obj");
     
    7275  dynamic_cast<StaticModel*>(this->getModel())->addMaterial(this->mat);
    7376  dynamic_cast<StaticModel*>(this->getModel())->finalize();
     77
     78 
     79  this->trail = new Trail(6,1,.4);
     80  this->trail->setParent( this);
     81  this->trail->setTexture( "maps/laser.png");
    7482}
    7583
     
    8391  // delete this->emitter;
    8492
    85   if (MBolt::trailParticles != NULL && MBolt::objectList().size() <= 1)
    86   {
    87     if (ParticleSystem::objectList().exists(MBolt::trailParticles))
    88       delete MBolt::trailParticles;
    89     MBolt::trailParticles = NULL;
    90   }
    9193  if (MBolt::explosionParticles != NULL && MBolt::objectList().size() <= 1)
    9294  {
     
    9496      delete MBolt::explosionParticles;
    9597    MBolt::explosionParticles = NULL;
     98    PRINTF(1)("Deleting MBolt Explosion Particles\n");
    9699  }
    97 }
    98 
    99 SpriteParticles* MBolt::trailParticles = NULL;
     100 
     101}
     102
    100103SpriteParticles* MBolt::explosionParticles = NULL;
    101104
    102105void MBolt::activate()
    103106{
    104   if (unlikely(MBolt::trailParticles == NULL))
    105   {
    106     MBolt::trailParticles = new SpriteParticles(1000);
    107     MBolt::trailParticles->setName("BoomerangProjectileTrailParticles");
    108     MBolt::trailParticles->setMaterialTexture("maps/radial-trans-noise.png");
    109     MBolt::trailParticles->setLifeSpan(0.3, 0);
    110     MBolt::trailParticles->setRadius(0.0, .8);
    111     MBolt::trailParticles->setRadius(1.0, .2);
    112     MBolt::trailParticles->setColor(0.0, 1,0,0,.9);
    113     MBolt::trailParticles->setColor(0.2, .8,.2,0,.9);
    114     MBolt::trailParticles->setColor(0.5, .8,.4,.4,.8);
    115     MBolt::trailParticles->setColor(1.0, .8,.8,.8,.7);
    116   }
    117107  if (unlikely(MBolt::explosionParticles == NULL))
    118108  {
     
    128118  }
    129119
    130   this->setDamage(10);
     120  this->setPhysDamage(10);
     121  this->setElecDamage(0);
    131122  this->setHealth(0);
    132123
    133   this->emitter->setSystem(MBolt::trailParticles);
    134124
    135125  this->emitter->setSpread(0);
     
    142132void MBolt::deactivate()
    143133{
    144   assert (MBolt::trailParticles != NULL);
    145   MBolt::trailParticles->removeEmitter(this->emitter);
    146 
    147134  assert (MBolt::explosionParticles != NULL);
    148135  MBolt::explosionParticles->removeEmitter(this->emitter);
     
    157144void MBolt::collidesWith(WorldEntity* entity, const Vector& location)
    158145{
    159   if (this->hitEntity != entity && entity->isA(CL_NPC))
    160     this->destroy( entity );
    161   this->hitEntity = entity;
    162   dynamic_cast<SpaceShip*>(entity)->damage(this->getDamage(),0);
     146  PRINTF(0)("MBolt collides pretest\n");
     147  if( entity == NULL || dynamic_cast<SpaceShip*>(entity) == NULL)
     148    return;
     149
     150  PRINTF(0)("MBolt collides\n");
     151  dynamic_cast<SpaceShip*>(entity)->damage( this->getPhysDamage(), this->getElecDamage());
     152  entity->destroy(this);
     153  this->deactivate();
    163154}
    164155
     
    177168
    178169  this->angle += MBolt::rotationSpeed * dt;
     170  this->trail->tick(dt);
    179171}
    180172
     
    209201  dynamic_cast<StaticModel*>(this->getModel())->draw();
    210202  this->mat->unselect();
     203  glScalef(1/.75,4/.7,4/.7);
     204  glTranslatef(-4,0,0);
     205  this->trail->draw();
    211206  glPopMatrix();
    212207  glPopAttrib();
  • branches/playability/src/world_entities/projectiles/mbolt.h

    r10064 r10081  
    1515class ParticleEmitter;
    1616class FastFactory;
     17class Trail;
    1718
    1819class MBolt : public Projectile
     
    3738  private:
    3839    static FastFactory*               fastFactory;
    39     static SpriteParticles*           trailParticles;
    4040    static SpriteParticles*           explosionParticles;
     41
     42    Trail*                            trail;
    4143
    4244    float                             angle;
  • branches/playability/src/world_entities/projectiles/swarm_projectile.cc

    r10080 r10081  
    2424#include "particles/sprite_particles.h"
    2525#include "space_ships/space_ship.h"
     26#include "effects/trail.h"
    2627
    2728#include "debug.h"
     
    5758
    5859  this->physDamage = 200;
     60
     61  this->trail = new Trail(2.5,4,.2);
     62  this->trail->setParent( this);
     63  this->trail->setTexture( "maps/laser.png");
    5964}
    6065
     
    6671{
    6772
    68 
    69   /* this is normaly done by World.cc by deleting the ParticleEngine */
    70   if (SwarmProjectile::trailParticles != NULL && SwarmProjectile::objectList().size() <= 1)
    71   {
    72     if (ParticleSystem::objectList().exists(SwarmProjectile::trailParticles))
    73       delete SwarmProjectile::trailParticles;
    74     SwarmProjectile::trailParticles = NULL;
    75   }
    7673  if (SwarmProjectile::explosionParticles != NULL && SwarmProjectile::objectList().size() <= 1)
    7774  {
     
    8077    SwarmProjectile::explosionParticles = NULL;
    8178  }
    82   delete this->emitter;
    83 }
    84 
    85 SpriteParticles* SwarmProjectile::trailParticles = NULL;
     79  // delete this->emitter;
     80  delete this->trail;
     81}
     82
    8683SpriteParticles* SwarmProjectile::explosionParticles = NULL;
    8784
     
    9087void SwarmProjectile::activate()
    9188{
    92   if (unlikely(SwarmProjectile::trailParticles == NULL))
    93   {
    94     SwarmProjectile::trailParticles = new SpriteParticles(2000);
    95     SwarmProjectile::trailParticles->setName("SwarmProjectileTrailParticles");
    96     SwarmProjectile::trailParticles->setMaterialTexture("maps/radial-trans-noise.png");
    97     SwarmProjectile::trailParticles->setLifeSpan(.3, 0);
    98     SwarmProjectile::trailParticles->setRadius(0.0, .7);
    99     SwarmProjectile::trailParticles->setRadius(0.2, 1.3);
    100     SwarmProjectile::trailParticles->setRadius(.5, .8);
    101     SwarmProjectile::trailParticles->setRadius(1.0, 0.3);
    102     SwarmProjectile::trailParticles->setColor(0.0, 1,0,0,.7);
    103     SwarmProjectile::trailParticles->setColor(0.2, .8,.8,0,.5);
    104     SwarmProjectile::trailParticles->setColor(0.5, .8,.8,.8,.8);
    105     SwarmProjectile::trailParticles->setColor(1.0, .8,.8,.8,.0);
    106   }
    10789  if (unlikely(SwarmProjectile::explosionParticles == NULL))
    10890  {
     
    120102  }
    121103
    122   this->emitter->setSystem(SwarmProjectile::trailParticles);
    123104
    124105  this->updateNode(0);
     
    253234
    254235  this->updateAngle(time);
     236
     237  this->trail->tick(time);
    255238}
    256239
     
    291274  //glScalef(2.0, 2.0, 2.0);  // no double rescale
    292275  this->getModel()->draw();
    293 
     276  glTranslatef(-.9,0,0);
     277  this->trail->draw();
    294278  glPopMatrix();
    295 
    296 }
     279}
  • branches/playability/src/world_entities/projectiles/swarm_projectile.h

    r10080 r10081  
    1414class FastFactory;
    1515class Aim;
     16class Trail;
    1617
    1718class SwarmProjectile : public Projectile
     
    3637  private:
    3738    static FastFactory*               fastFactory;
    38     static SpriteParticles*           trailParticles;
    3939    static SpriteParticles*           explosionParticles;
     40
     41    Trail*                            trail;
    4042
    4143    ParticleEmitter*                  emitter;
Note: See TracChangeset for help on using the changeset viewer.