Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 10196 in orxonox.OLD for branches/playability/src/world_entities


Ignore:
Timestamp:
Jan 8, 2007, 9:46:13 PM (18 years ago)
Author:
nicolasc
Message:

just another upload
GUI seems to work, but there are still some unexplainable segfaults

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

Legend:

Unmodified
Added
Removed
  • branches/playability/src/world_entities/projectiles/projectile.h

    r10104 r10196  
    8787    OrxSound::SoundBuffer  explosionBuffer;
    8888    OrxSound::SoundBuffer  engineBuffer;
    89 
    90 //     virtual Vector newDirection(Vector curDirection, Vector estTargetDir, float angle);
    9189};
    9290
  • branches/playability/src/world_entities/projectiles/spike.cc

    r10173 r10196  
    165165  float matrix[4][4];
    166166  glTranslatef (this->getAbsCoor ().x, this->getAbsCoor ().y, this->getAbsCoor ().z);
    167 
     167  Vector tmpRot = this->getAbsDir().getSpacialAxis();
     168  glRotatef (this->getAbsDir().getSpacialAxisAngle(), tmpRot.x, tmpRot.y, tmpRot.z );
    168169  glRotatef(angle, 1.0, 0.0, 0.0);
    169170  this->getAbsDir().matrix (matrix);
  • branches/playability/src/world_entities/projectiles/spike.h

    r10173 r10196  
    3434    virtual void draw () const;
    3535
    36 
     36    inline void setVelocity(Vector velocity) {this->velocity = velocity;}
    3737  private:
    3838    static FastFactory*               fastFactory;
  • branches/playability/src/world_entities/projectiles/spike_ball.cc

    r10188 r10196  
    3232
    3333#include "weapons/weapon.h"
    34 
     34#include "../weapons/weapon_manager.h"
    3535
    3636#include "class_id_DEPRECATED.h"
     
    6565  this->halo->setSize(2, 2);
    6666  this->halo->setTexture("hbolt_halo.png");
    67 /*
    68 //   this->weaponMan = new WeaponManager(dynamic_cast<WorldEntity*>(this));
    69   this->weaponMan.setParentEntity(this);
     67
     68  this->weaponMan = new WeaponManager(dynamic_cast<WorldEntity*>(this));
     69  this->weaponMan->setParentEntity(this);
    7070
    7171  Weapon* cannon = new SpikeLauncher();
    7272  cannon->setName( "SpikeLauncher");
    73   this->weaponMan.addWeapon(cannon, 0, 0);
    74   this->weaponMan.changeWeaponConfig(0);
    75 */
     73  this->weaponMan->addWeapon(cannon, 0, 0);
     74  this->weaponMan->changeWeaponConfig(0);
     75
    7676
    7777}
     
    177177
    178178  if (this->tickLifeCycle(dt)){
    179 //     this->blow();
     179    this->weaponMan->fire();
    180180    this->deactivate();
    181181  }
  • branches/playability/src/world_entities/projectiles/spike_ball.h

    r10188 r10196  
    1111
    1212#include "../weapons/spike_launcher.h"
    13 #include "../weapons/weapon.h"
    14 #include "../weapons/weapon_manager.h"
     13
     14
     15#include "extendable.h"
    1516
    1617class Vector;
     
    6263    WorldEntity* hitEntity; // FIXME TEMPORARY
    6364
    64 //     WeaponManager                     weaponMan;
     65    WeaponManager*                   weaponMan;
    6566
    6667};
  • branches/playability/src/world_entities/projectiles/swarm_projectile.cc

    r10188 r10196  
    1 
    21/*
    32   orxonox - the future of 3D-vertical-scrollers
     
    187186void SwarmProjectile::tick (float time)
    188187{
     188  if(unlikely(this->target == NULL)) /** Check whether the target still exists*/
     189    this->deactivate();
     190
    189191/*
    190192  Vector targetFarFarAway = this->getAbsCoor() + Vector(100000, 0, 0);
  • branches/playability/src/world_entities/space_ships/space_ship.cc

    r10194 r10196  
    2828#include "weapons/swarm_launcher.h"
    2929#include "weapons/spike_launcher.h"
     30#include "weapons/spike_thrower.h"
    3031#include "weapons/boomerang_gun.h"
    3132#include "weapons/turret.h"
     
    173174  Weapon* cannon = new SwarmLauncher();
    174175  cannon->setName( "SwarmLauncher");
    175   //cannon->setParent( this);
     176
     177  Weapon* spike = new SpikeLauncher();
     178  spike->setName( "SpikeThrower" );
    176179
    177180
     
    195198
    196199  this->secWeaponMan.addWeapon( cannon, 0, 0);
     200  this->secWeaponMan.addWeapon( spike, 1, 1);
    197201
    198202 
  • branches/playability/src/world_entities/weapons/spike_launcher.cc

    r10188 r10196  
    102102  this->size = 2.5;
    103103
     104  this->setEmissionPoint(0.0, 0.0, 0.0);
     105
     106
    104107  this->spikes = 26;
    105108  this->launcher = new Vector [this->spikes];
     
    128131  }
    129132
    130 //   this->setEmissionPoint(1.684, 0.472, 0);
    131133  this->getProjectileFactory()->prepare(this->spikes);  //we don't need more...
    132134
    133   this->setActionSound(WA_SHOOT, "sound/explosions/explosion_1.wav");
    134   this->setActionSound(WA_ACTIVATE, "sound/vocals/missiles.wav");
    135   this->setActionSound(WA_RELOAD, "sound/vocals/reload.wav");
     135//   this->setActionSound(WA_SHOOT, "sound/explosions/explosion_1.wav");
     136//   this->setActionSound(WA_ACTIVATE, "sound/vocals/missiles.wav");
     137//   this->setActionSound(WA_RELOAD, "sound/vocals/reload.wav");
    136138
    137139}
     
    179181
    180182  float nx, ny, nz, ca, sa;
     183
    181184  nx = v.x;
    182185  ny = v.y;
     
    187190// final version below... easier to to cheat with the one above.
    188191/*
    189   nx = this->getParent()->getRotationVector().x
    190   ny = this->getParent()->getRotationVector().y
    191   nz = this->getParent()->getRotationVector().z
     192  nx = this->getParent()->getRotationVector().x;
     193  ny = this->getParent()->getRotationVector().y;
     194  nz = this->getParent()->getRotationVector().z;
    192195
    193196  ca = cos (this->getParent()->getAngle());
     
    212215    this->launcher[i] = Vector (x, y, z);
    213216  }
     217
     218  for( int i = 0; i < 3 ; i++)
     219    delete m[i];
     220  delete m;
    214221}
    215222
     
    222229
    223230  Projectile* pj = NULL;
    224 //   for( ObjectList<Playable>::const_iterator eIterator = Playable::objectList().begin(); eIterator !=Playable::objectList().end(); eIterator++)
    225231  for (int i = 0; i < this->spikes; i++)
    226232  {
     
    230236
    231237//     pj->setVelocity(this->getVelocity()+(this->getAbsDir().apply(Vector(1,0,0))*115.0 + VECTOR_RAND(10)));
    232     pj->setVelocity(this->launcher[i] * 200.0);
     238    pj->setVelocity(this->launcher[i] * 300.0);
    233239
    234240    pj->setParent(PNode::getNullParent());
    235241    pj->setAbsCoor(this->getAbsCoor() + this->launcher[i] * this->size);
    236     pj->setAbsDir(Quaternion(this->launcher[i], 0));
     242    pj->setRelDir(0, this->launcher[i].x, this->launcher[i].y, this->launcher[i].z);
     243
     244    pj->toList(this->getOMListNumber());
    237245    pj->activate();
    238246  }
  • branches/playability/src/world_entities/weapons/spike_thrower.cc

    r10180 r10196  
    146146void SpikeThrower::fire()
    147147{
    148   bool fired  = false;
     148  Projectile* pj =  this->getProjectile();
     149  if (pj == NULL)
     150    return;
    149151
    150   Projectile* pj = NULL;
    151   for( ObjectList<Playable>::const_iterator eIterator = Playable::objectList().begin(); eIterator !=Playable::objectList().end(); eIterator++)
    152   {
    153     if( ((*eIterator)->getOMListNumber() == OM_GROUP_00) && ((*eIterator)->getClassCName() != "Weapon") && ((*eIterator)->getClassCName() != "Projectile") && ((*eIterator)->getAbsCoor() - this->getAbsCoor()).len() <= 300)
    154     {
    155       pj  = this->getProjectile();
    156       if (pj == NULL)
    157         return;
    158      
    159       fired = true;
    160       pj->setVelocity(this->getVelocity()+(this->getAbsDir().apply(Vector(1,0,0))*115.0 + VECTOR_RAND(10)));
     152  // set the owner
     153  pj->setOwner(this->getOwner());
    161154
    162       pj->setParent(PNode::getNullParent());
    163       pj->setAbsCoor(this->getEmissionPoint());
    164       pj->setAbsDir(this->getAbsDir());
    165 //       dynamic_cast<SpikeProjectile*>(pj)->setTarget( (PNode*)(*eIterator) );
    166       pj->toList(OM_GROUP_01_PROJ);
    167       pj->activate();
    168     }
    169   }
    170   if( !fired)
    171     this->increaseEnergy( this->getProjectile()->getMinEnergy());
     155  pj->setParent(PNode::getNullParent());
     156
     157  pj->setVelocity(this->getAbsDir().apply(Vector(1,0,0))*150);
     158  pj->setAbsCoor(this->getEmissionPoint());
     159
     160  pj->setAbsDir(this->getAbsDir());
     161  pj->activate();
    172162}
Note: See TracChangeset for help on using the changeset viewer.