Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 10042 in orxonox.OLD


Ignore:
Timestamp:
Dec 12, 2006, 3:35:25 PM (17 years ago)
Author:
marcscha
Message:

mBolt related

Location:
branches/playability/src
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • branches/playability/src/util/hud.cc

    r10030 r10042  
    237237  std::list<OrxGui::GLGuiWidget*>::iterator weaponWidget;
    238238  Vector2D pos(0.3, .9);
    239   for (weaponWidget = this->weaponsWidgets.begin(); weaponWidget != this->weaponsWidgets.end(); weaponWidget++, pos.x+=.2)
     239  for (weaponWidget = this->weaponsWidgets.begin(); weaponWidget != this->weaponsWidgets.end(); weaponWidget++, pos.x+=.1)
    240240  {
    241241    if (pos.x > .8)
  • branches/playability/src/world_entities/projectiles/mbolt.cc

    r10036 r10042  
    2929#include "debug.h"
    3030
     31#include "static_model.h"
     32
    3133
    3234#include "class_id_DEPRECATED.h"
     
    3941{
    4042
    41   //this->loadModel("models/projectiles/mbolt.obj");   //!< Model not yet in repo
    42   this->loadModel("models/projectiles/laser.obj");
     43  this->loadModel("models/projectiles/mbolt.obj",0.25);
     44  //this->loadModel("models/projectiles/laser.obj");
    4345
    4446  this->setMinEnergy(4);
    4547  this->setHealthMax(0);
    4648  this->lifeSpan = 5.0;
    47 
    48   this->emitter = new DotEmitter(100, 5, M_2_PI);
     49  this->angle     = 0;
     50
     51  this->emitter = new DotEmitter(40, 0, M_2_PI);
    4952  this->emitter->setParent(this);
    5053  this->emitter->setSpread(M_PI, M_PI);
    5154  this->emitter->setEmissionRate(300.0);
    5255  this->emitter->setEmissionVelocity(50.0);
     56
     57  this->mat = new Material("mBolt");
     58  //this->mat->setBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
     59  this->mat->setBlendFunc(GL_SRC_ALPHA,GL_ONE);
     60  this->mat->setDiffuse(1,1,1);
     61  this->mat->setDiffuseMap("laser.png");
     62  this->mat->setDiffuseMap("laser.png",1);
     63  dynamic_cast<StaticModel*>(this->getModel())->addMaterial(this->mat);
     64  dynamic_cast<StaticModel*>(this->getModel())->finalize();
    5365}
    5466
     
    5668/**
    5769 *  standard deconstructor
     70
     71/**
    5872*/
    5973MBolt::~MBolt ()
     
    6175  // delete this->emitter;
    6276
    63   /* this is normaly done by World.cc by deleting the ParticleEngine */
     77  if (MBolt::trailParticles != NULL && MBolt::objectList().size() <= 1)
     78  {
     79    if (ParticleSystem::objectList().exists(MBolt::trailParticles))
     80      delete MBolt::trailParticles;
     81    MBolt::trailParticles = NULL;
     82  }
    6483  if (MBolt::explosionParticles != NULL && MBolt::objectList().size() <= 1)
    6584  {
    66     //if (ClassList::exists(MBolt::explosionParticles, CL_PARTICLE_SYSTEM))
    67     //  delete MBolt::explosionParticles;
    68     PRINTF(1)("Deleting MBolt Particles\n");
     85    if (ParticleSystem::objectList().exists(MBolt::explosionParticles))
     86      delete MBolt::explosionParticles;
    6987    MBolt::explosionParticles = NULL;
    7088  }
    71 
    72 }
    73 
     89}
     90
     91SpriteParticles* MBolt::trailParticles = NULL;
    7492SpriteParticles* MBolt::explosionParticles = NULL;
    7593
    7694void MBolt::activate()
    7795{
     96  if (unlikely(MBolt::trailParticles == NULL))
     97  {
     98    MBolt::trailParticles = new SpriteParticles(3000);
     99    MBolt::trailParticles->setName("BoomerangProjectileTrailParticles");
     100    MBolt::trailParticles->setMaterialTexture("maps/radial-trans-noise.png");
     101    MBolt::trailParticles->setLifeSpan(1, 0);
     102    MBolt::trailParticles->setRadius(0.0, 1);
     103    MBolt::trailParticles->setRadius(1.0, 1);
     104    MBolt::trailParticles->setColor(0.0, 1,0,0,.9);
     105    MBolt::trailParticles->setColor(0.2, .8,.2,0,.9);
     106    MBolt::trailParticles->setColor(0.5, .8,.4,0,.8);
     107    MBolt::trailParticles->setColor(1.0, .8,.8,0,.7);
     108  }
    78109  if (unlikely(MBolt::explosionParticles == NULL))
    79110  {
     
    91122  this->setDamage(50);
    92123  this->setHealth(0);
     124
     125  this->emitter->setSystem(MBolt::trailParticles);
     126
     127  this->updateNode(0);
     128  this->emitter->setSpread(0);
     129  this->emitter->setEmissionRate(20.0);
     130  this->emitter->setEmissionVelocity(this->velocity.len());
    93131}
    94132
     
    96134void MBolt::deactivate()
    97135{
     136  assert (MBolt::trailParticles != NULL);
     137  MBolt::trailParticles->removeEmitter(this->emitter);
     138
    98139  assert (MBolt::explosionParticles != NULL);
    99140  MBolt::explosionParticles->removeEmitter(this->emitter);
     
    125166  if (this->tickLifeCycle(dt))
    126167    this->deactivate();
     168
     169  this->angle += MBolt::rotationSpeed * dt;
    127170}
    128171
     
    145188  glDisable(GL_LIGHTING);
    146189
    147   WorldEntity::draw();
    148 
     190  glPushMatrix();
     191
     192  float matrix[4][4];
     193  glTranslatef (this->getAbsCoor ().x, this->getAbsCoor ().y, this->getAbsCoor ().z);
     194  glRotatef(this->angle, 1.0f, 0.0f, 0.0f); //spinning missile
     195  this->getAbsDir().matrix (matrix);
     196  glMultMatrixf((float*)matrix);
     197
     198  glScalef(3.0, 0.7, 0.7);  // no double rescale
     199
     200  this->mat->select();
     201  dynamic_cast<StaticModel*>(this->getModel())->draw();
     202  this->mat->unselect();
     203  glPopMatrix();
    149204  glPopAttrib();
    150 }
    151 
     205
     206
     207}
     208
  • branches/playability/src/world_entities/projectiles/mbolt.h

    r9999 r10042  
    88
    99#include "projectile.h"
     10#include "material.h"
    1011
    1112class Vector;
     
    3637  private:
    3738    static FastFactory*               fastFactory;
    38 
     39    static SpriteParticles*           trailParticles;
    3940    static SpriteParticles*           explosionParticles;
    4041
     42    float                             angle;
     43    static const float                rotationSpeed = 540;
     44
    4145    ParticleEmitter*                  emitter;
     46
     47    Material*                         mat;
    4248
    4349
  • branches/playability/src/world_entities/weapons/medium_blaster.cc

    r10036 r10042  
    9696  pj->setParent(PNode::getNullParent());
    9797
    98   pj->setVelocity(this->getAbsDir().apply(Vector(1,0,0))*250 + VECTOR_RAND(5));
     98  pj->setVelocity(this->getAbsDir().apply(Vector(1,0,0))*150);
    9999
    100100  pj->setAbsCoor(this->getEmissionPoint());
Note: See TracChangeset for help on using the changeset viewer.