Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 10081 in orxonox.OLD


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

Some surprises for comming wednesday

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

Legend:

Unmodified
Added
Removed
  • branches/playability/src/world_entities/Makefile.am

    r9970 r10081  
    1111                                        extendable.cc           power_ups/power_up.cc           power_ups/param_power_up.cc \
    1212                        power_ups/weapon_power_up.cc                            spawning_point.cc                                               effects/explosion.cc            effects/billboard.cc \
    13                                                         elements/glgui_energywidget.cc
     13                        effects/trail.cc                                elements/glgui_energywidget.cc
    1414
    1515
     
    1818                        weapons/weapon.h                weapons/ammo_container.h                projectiles/projectile.h \
    1919                                        power_ups/power_up.h            power_ups/param_power_up.h              power_ups/weapon_power_up.h \
    20                                         spawning_point.h                                                effects/explosion.h             effects/billboard.h \
     20                                        spawning_point.h                                                effects/explosion.h             effects/billboard.h             effects/trail.h \
    2121                                                                        elements/glgui_energywidget.h                                   
    2222
  • 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;
  • branches/playability/src/world_entities/space_ships/space_ship.cc

    r10078 r10081  
    3434#include "particles/emitter_node.h"
    3535#include "particles/sprite_particles.h"
     36#include "effects/explosion.h"
     37#include "effects/trail.h"
    3638
    3739#include "util/loading/factory.h"
     
    120122{
    121123  this->init();
     124  //this->setParentMode(PNODE_REPARENT_DELETE_CHILDREN);
    122125  if (root != NULL)
    123126    this->loadParams(root);
     
    139142  PRINTF(4)("SPACESHIP INIT\n");
    140143
    141   secWeaponMan.showCrosshair();
    142 
    143144  //weapons:
    144 
     145  /*
    145146  Weapon* wpRight1 = new LightBlaster ();
    146147  wpRight1->setName( "LightBlaster");
     
    148149  Weapon* wpLeft1 = new LightBlaster ();
    149150  wpLeft1->setName( "LightBlaster");
    150   wpLeft1->setParent( this);
     151  wpLeft1->setParent( this);*/
    151152
    152153  Weapon* wpRight2 = new MediumBlaster ();
     
    156157  wpLeft2->setName( "MediumBlaster");
    157158  wpLeft2->setParent( this);
    158 
     159  /*
    159160  Weapon* wpRight3 = new HeavyBlaster ();
    160161  wpRight3->setName( "HeavyBlaster");
     
    162163  Weapon* wpLeft3 = new HeavyBlaster ();
    163164  wpLeft3->setName( "HeavyBlaster");
    164   wpLeft3->setParent( this);
     165  wpLeft3->setParent( this);*/
    165166
    166167  Weapon* cannon = new SwarmLauncher();
     
    169170
    170171
    171   this->weaponMan.addWeapon( wpLeft1, 0, 0);
    172   this->weaponMan.addWeapon( wpRight1, 0, 1);
     172  //this->weaponMan.addWeapon( wpLeft1, 0, 0);
     173  //this->weaponMan.addWeapon( wpRight1, 0, 1);
    173174  this->weaponMan.addWeapon( wpLeft2, 0, 2);
    174175  this->weaponMan.addWeapon( wpRight2, 0, 3);
    175   this->weaponMan.addWeapon( wpLeft3, 0, 4);
    176   this->weaponMan.addWeapon( wpRight3, 0, 5);
     176  //this->weaponMan.addWeapon( wpLeft3, 0, 4);
     177  //this->weaponMan.addWeapon( wpRight3, 0, 5);
    177178
    178179  this->secWeaponMan.addWeapon( cannon, 1, 0);
     
    181182  this->secWeaponMan.changeWeaponConfig(1);
    182183
    183   wpRight1->requestAction(WA_ACTIVATE);
    184   wpLeft1->requestAction(WA_ACTIVATE);
     184  //wpRight1->requestAction(WA_ACTIVATE);
     185  //wpLeft1->requestAction(WA_ACTIVATE);
    185186  wpRight2->requestAction(WA_ACTIVATE);
    186187  wpLeft2->requestAction(WA_ACTIVATE);
    187   wpRight3->requestAction(WA_ACTIVATE);
    188   wpLeft3->requestAction(WA_ACTIVATE);
     188  //wpRight3->requestAction(WA_ACTIVATE);
     189  //wpLeft3->requestAction(WA_ACTIVATE);
    189190
    190191  cannon->requestAction(WA_ACTIVATE);
     
    301302  dynamic_cast<Element2D*>(this->weaponMan.getFixedTarget())->setVisibility( false);
    302303
    303   this->burstEmitter = new DotEmitter(800, 0.0, .01);
    304   this->burstEmitter->setParent(this);
    305   this->burstEmitter->setRelCoor(-1, .5, 0);
    306   this->burstEmitter->setName("SpaceShip_Burst_emitter");
    307   this->burstEmitter->setEmissionRate(800);
    308 
    309   this->burstSystem = new SpriteParticles(400);
    310   this->burstSystem->addEmitter(this->burstEmitter);
    311   this->burstSystem->setName("SpaceShip_Burst_System");
    312   ((SpriteParticles*)this->burstSystem)->setMaterialTexture("maps/radial-trans-noise.png");
    313   this->burstSystem->setLifeSpan(0.3, .3);
    314   this->burstSystem->setRadius(0.0, 1.0);
    315   this->burstSystem->setRadius(0.05, 1.0);
    316   this->burstSystem->setRadius(.5, .6);
    317   this->burstSystem->setRadius(1.0, 0);
    318   this->burstSystem->setColor(0.0, .7,.7,1,.5);
    319   this->burstSystem->setColor(0.2, 0,0,0.8,.7);
    320   this->burstSystem->setColor(0.5, .5,.5,.8,.8);
    321   this->burstSystem->setColor(1.0, .8,.8,.8,.0);
    322304
    323305  registerVar( new SynchronizeableBool( &bForward, &bForward, "bForward", PERMISSION_OWNER ) );
     
    342324
    343325  this->setSupportedPlaymodes(Playable::Horizontal | Playable::Vertical);
     326
     327 
     328  this->trail = new Trail( 15, 10, .2);
     329  this->trail->setParent( this);
     330  this->trail->setTexture( "maps/engine.png");
     331
     332  this->trailL = new Trail( 15, 10, .2);
     333  this->trailL->setParent( this);
     334  this->trailL->setTexture( "maps/engine.png");
     335
     336  this->trailR = new Trail( 15, 10, .2);
     337  this->trailR->setParent( this);
     338  this->trailR->setTexture( "maps/engine.png");
    344339}
    345340
     
    376371{
    377372  this->secWeaponMan.showCrosshair();
     373  /*for(ObjectList<PNode>::const_iterator it = this->getNodesChildren().begin(); it != this->getNodesChildren().end(); it++)
     374  {
     375    if( likely( dynamic_cast<WorldEntity*>(*it) != NULL))
     376      dynamic_cast<WorldEntity*>(*it)->toList( OM_GROUP_01);
     377  }*/
    378378  this->toList( OM_GROUP_01 );
    379   /*for(ObjectList<WorldEntity>::const_iterator it = WorldEntity::objectList().begin(); it != WorldEntity::objectList().end(); it++)
    380   {
    381     (*it)->toList( OM_GROUP_01);
    382   }*/
    383379  //dynamic_cast<Element2D*>(this->secWeaponMan.getFixedTarget())->setVisibility( true);
    384380  //this->attachCamera();
     
    389385{
    390386  this->secWeaponMan.hideCrosshair();
     387  /*for(ObjectList<PNode>::const_iterator it = this->getNodesChildren().begin(); it != this->getNodesChildren().end(); it++)
     388  {
     389    if( likely(dynamic_cast<WorldEntity*>(*it) != NULL))
     390      dynamic_cast<WorldEntity*>(*it)->toList( OM_GROUP_00);
     391  }*/
    391392  this->toList( OM_GROUP_00);
    392   /*for(ObjectList<WorldEntity>::const_iterator it = WorldEntity::objectList().begin(); it != WorldEntity::objectList().end(); it++)
    393   {
    394     (*it)->toList( OM_GROUP_00);
    395   }*/
    396393  //dynamic_cast<Element2D*>(this->secWeaponMan.getFixedTarget())->setVisibility( false);
    397394  //this->detachCamera();
     
    424421void SpaceShip::collidesWith(WorldEntity* entity, const Vector& location)
    425422{
     423  PRINTF(0)("SPACESHIP COLLIDED WITH %s\n",entity->getCName());
    426424}
    427425
     
    433431  WorldEntity::draw();
    434432
     433  glMatrixMode(GL_MODELVIEW);
     434  glPushMatrix();
     435
     436  float matrix[4][4];
     437  glTranslatef (this->getAbsCoor ().x-1, this->getAbsCoor ().y-.2, this->getAbsCoor ().z);
     438  this->getAbsDir().matrix (matrix);
     439  glMultMatrixf((float*)matrix);
     440  //glScalef(2.0, 2.0, 2.0);  // no double rescale
     441 
     442  this->trail->draw();
     443 
     444  glTranslatef(0,0,-.5);
     445  this->trailL->draw();
     446
     447  glTranslatef(0,0,1);
     448  this->trailR->draw();
     449  glPopMatrix();
    435450  //this->debug(0);
    436451}
     
    512527  this->cameraNode.setRelDirSoft(this->getAbsDir(), 30.0f);
    513528
    514   this->burstEmitter->setEmissionRate(this->cameraSpeed + (velocity.z>0)*velocity.z);
    515   this->burstEmitter->setEmissionVelocity(this->cameraSpeed + (velocity.z>0)*velocity.z, travelSpeed *.1);
    516 
     529  this->trail->tick(time);
     530  this->trailL->tick(time);
     531  this->trailR->tick(time);
    517532  //orient the spaceship in direction of the mouse
    518533  /*
     
    585600{
    586601  PRINTF(0)("spaceship destroy\n");
    587 
     602  /*
    588603  EmitterNode* node  = NULL;
    589604  DotEmitter* emitter = NULL;
     
    613628  node->setVelocity( this->getParent()->getVelocity());
    614629  node->setAbsCoor( this->getAbsCoor());
    615   node->start();
     630  node->start();*/
     631  PNode* node          = new PNode();
     632  node->setAbsCoor(this->getAbsCoor());
     633  Explosion* explosion = new Explosion();
     634  explosion->explode( node, Vector(5,5,5));
    616635
    617636  this->setAbsCoor(Vector(-10000,10000,10000));
     
    619638
    620639  this->toList( OM_DEAD);
    621   /*for(ObjectList<WorldEntity>::const_iterator it = WorldEntity::objectList().begin(); it != WorldEntity::objectList().end(); it++)
     640  /*for(ObjectList<PNode>::const_iterator it = this->getNodesChildren().begin(); it != this->getNodesChildren().end(); it++)
    622641  {
    623     (*it)->toList( OM_DEAD);
     642    if( dynamic_cast<WorldEntity*>(*it) != NULL)
     643      dynamic_cast<WorldEntity*>(*it)->toList( OM_DEAD);
    624644  }*/
    625645    PRINTF(0)("spaceship destroy == ship translated \n");
     
    628648void SpaceShip::respawn( )
    629649{
    630   //this->show();
    631   //this->toList( OM_GROUP_00);
     650  this->unhide();
     651  /*for(ObjectList<PNode>::const_iterator it = this->getNodesChildren().begin(); it != this->getNodesChildren().end(); it++)
     652  {
     653    if( dynamic_cast<WorldEntity*>(*it) != NULL)
     654      dynamic_cast<WorldEntity*>(*it)->toList( OM_GROUP_00);
     655  }*/
     656  /*if( this->hasPlayer())
     657    this->toList( OM_GROUP_01);
     658  else
     659    this->toList( OM_GROUP_00);*/
     660
    632661}
    633662
    634663
    635664void SpaceShip::damage(float pDamage, float eDamage){
    636   PRINTF(0)("ship hit");
    637   printf("Shit hit");
     665  PRINTF(0)("ship hit for (%f,%f) \n",pDamage,eDamage);
     666  PRINTF(0)("SHIP HIT - SHIP HIT - SHIP HIT\n");
     667
    638668  if( this->shieldActive) {
    639669    if( this->shieldCur > pDamage) {
     
    643673      this->shieldCur -=pDamage;
    644674      this->shieldActive = false; //shield collapses
    645       pDamage = pDamage - this->shieldCur;
     675      pDamage += this->shieldCur;
    646676      if( !this->shieldActive) {
    647677        this->armorCur -= pDamage / 2; // remaining damages hits armor at half rate
  • branches/playability/src/world_entities/space_ships/space_ship.h

    r10078 r10081  
    1919class ParticleEmitter;
    2020class ParticleSystem;
     21class Trail;
    2122
    2223class SpaceShip : public Playable
     
    177178    byte                  oldMask;            //!< used for synchronisation
    178179
    179     ParticleEmitter*      burstEmitter;
    180     ParticleSystem*       burstSystem;
     180    Trail*                trail;              //!< Burst trail
     181    Trail*                trailL;              //!< Burst trail
     182    Trail*                trailR;              //!< Burst trail
     183
    181184};
    182185
Note: See TracChangeset for help on using the changeset viewer.