Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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


Ignore:
Timestamp:
Jan 7, 2007, 2:50:47 PM (18 years ago)
Author:
nicolasc
Message:

updated spikeball/spike combo; still need to turn a projectile into a spaceship
swarmmissile turns again, but flickers

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

Legend:

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

    r10180 r10188  
    6060
    6161  this->angle = 0;
    62   this->rotationSpeed = 0;
     62  this->rotationSpeed = 130;
     63
     64  this->halo = new Billboard();
     65  this->halo->setSize(2, 2);
     66  this->halo->setTexture("hbolt_halo.png");
    6367/*
    64   this->halo = new Billboard();
    65   this->halo->setSize(.35, .35);
    66   this->halo->setTexture("hbolt_halo.png");*/
     68//   this->weaponMan = new WeaponManager(dynamic_cast<WorldEntity*>(this));
     69  this->weaponMan.setParentEntity(this);
     70
     71  Weapon* cannon = new SpikeLauncher();
     72  cannon->setName( "SpikeLauncher");
     73  this->weaponMan.addWeapon(cannon, 0, 0);
     74  this->weaponMan.changeWeaponConfig(0);
     75*/
     76
    6777}
    6878
     
    105115  this->setDamage(5);
    106116  this->setHealth(0);
     117  this->rotationVector = VECTOR_RAND(1);
    107118}
    108119
     
    197208  glTranslatef (this->getAbsCoor ().x, this->getAbsCoor ().y, this->getAbsCoor ().z);
    198209
    199   glRotatef(angle, 1.0, 0.0, 0.0);
     210  glRotatef(angle, this->rotationVector.x, this->rotationVector.y, this->rotationVector.z);
    200211  this->getAbsDir().matrix (matrix);
    201212  glMultMatrixf((float*)matrix);
  • branches/playability/src/world_entities/projectiles/spike_ball.h

    r10170 r10188  
    99#include "projectile.h"
    1010#include "effects/billboard.h"
     11
     12#include "../weapons/spike_launcher.h"
    1113#include "../weapons/weapon.h"
     14#include "../weapons/weapon_manager.h"
    1215
    1316class Vector;
     
    1619class ParticleEmitter;
    1720class FastFactory;
     21class WeaponManager;
     22
    1823
    1924class SpikeBall : public Projectile
     
    3540    virtual void draw () const;
    3641
     42    inline Vector getRotationVector() { return this->rotationVector; }
     43    inline float getAngle() { return this->angle; }
     44
    3745//     virtual void blow();
    3846
     
    4856    float                             angle;
    4957    float                             rotationSpeed;
     58    Vector                            rotationVector;
    5059
    5160    Billboard*                        halo;
    5261
    5362    WorldEntity* hitEntity; // FIXME TEMPORARY
     63
     64//     WeaponManager                     weaponMan;
     65
    5466};
    5567
  • branches/playability/src/world_entities/projectiles/swarm_projectile.cc

    r10168 r10188  
    268268
    269269  this->angle += this->rotationSpeed * time;
     270  while (this->angle > 360)
     271    this->angle -= 360;
    270272
    271273  this->lastDir = this->curDir;
     
    309311  glTranslatef (this->getAbsCoor ().x, this->getAbsCoor ().y, this->getAbsCoor ().z);
    310312  Vector tmpRot = this->getAbsCoor().cross(tmpDir);
    311   glRotatef (angleDeg ( this->getAbsCoor(), tmpDir), tmpRot.x, tmpRot.y, tmpRot.z );
     313  glRotatef (angleRad ( this->getAbsCoor(), tmpDir), tmpRot.x, tmpRot.y, tmpRot.z );
    312314  glRotatef(this->angle, 1.0f, 0.0f, 0.0f); //spinning missile
    313315  this->getAbsDir().matrix (matrix);
  • branches/playability/src/world_entities/space_ships/space_ship.cc

    r10173 r10188  
    200200  this->secWeaponMan.changeWeaponConfig(0);
    201201
    202   curWeaponPrimary    = 1;
     202  curWeaponPrimary    = 3;
    203203  curWeaponSecondary  = 0;
    204204
  • branches/playability/src/world_entities/weapons/heavy_blaster.cc

    r10170 r10188  
    8181
    8282  this->setCapability(WTYPE_ALLDIRS | WTYPE_DIRECTIONAL | WTYPE_LIGHT);
    83  this->setProjectileTypeC("HBolt");   // FIXME temp project type until the blaste class exist
     83  this->setProjectileTypeC("HBolt");   // FIXME temp project type until the blaste class exist
    8484//   this->setProjectileTypeC("SpikeBall");   // FIXME temp project type until the blaste class exist
    8585  this->prepareProjectiles(5);
  • branches/playability/src/world_entities/weapons/spike_launcher.cc

    r10180 r10188  
    172172}
    173173
     174void SpikeLauncher::updateFireDir(Vector v, float angle){
     175
     176  float** m = new float* [3];
     177  for( int i = 0; i < 3 ; i++)
     178    m[i] = new float;
     179
     180  float nx, ny, nz, ca, sa;
     181  nx = v.x;
     182  ny = v.y;
     183  nz = v.z;
     184
     185  ca = cos (angle);
     186  sa = sin (angle);
     187// final version below... easier to to cheat with the one above.
     188/*
     189  nx = this->getParent()->getRotationVector().x
     190  ny = this->getParent()->getRotationVector().y
     191  nz = this->getParent()->getRotationVector().z
     192
     193  ca = cos (this->getParent()->getAngle());
     194  sa = sin (this->getParent()->getAngle());*/
     195
     196  m[0][0] = nx * nx * (1 - ca) + ca;
     197  m[0][1] = nx * ny * (1 - ca) + nz * sa;
     198  m[0][2] = nx * nz * (1 - ca) - ny * sa;
     199  m[1][0] = nx * nz * (1 - ca) - nz * sa;
     200  m[1][1] = ny * ny * (1 - ca) + ca;
     201  m[1][2] = ny * nz * (1 - ca) + nx * sa;
     202  m[2][0] = nx * nz * (1 - ca) + ny * sa;
     203  m[2][1] = ny * nz * (1 - ca) - nx * sa;
     204  m[2][2] = nz * nz * (1 - ca) + ca;
     205
     206  float x, y, z;
     207  for (int i = 0; i < this->spikes;i++){
     208    x = m[0][0] * this->launcher[i].x + m[0][1] * this->launcher[i].y + m[0][2] * this->launcher[i].z;
     209    y = m[1][0] * this->launcher[i].x + m[1][1] * this->launcher[i].y + m[1][2] * this->launcher[i].z;
     210    z = m[2][0] * this->launcher[i].x + m[2][1] * this->launcher[i].y + m[2][2] * this->launcher[i].z;
     211
     212    this->launcher[i] = Vector (x, y, z);
     213  }
     214}
     215
     216
    174217void SpikeLauncher::fire()
    175218{
     219  // temporary solution to test module
     220  updateFireDir(VECTOR_RAND(1), 20);
     221
     222
    176223  Projectile* pj = NULL;
    177224//   for( ObjectList<Playable>::const_iterator eIterator = Playable::objectList().begin(); eIterator !=Playable::objectList().end(); eIterator++)
  • branches/playability/src/world_entities/weapons/spike_launcher.h

    r10180 r10188  
    2828    virtual void fire();
    2929
     30    virtual void updateFireDir(Vector v, float angle);
    3031
    3132  private:
Note: See TracChangeset for help on using the changeset viewer.