Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 10648 in orxonox.OLD for branches/vs-enhencements/src/world_entities


Ignore:
Timestamp:
May 4, 2007, 9:53:07 AM (18 years ago)
Author:
nicolasc
Message:

some additional weapons, started weapons cleanup

Location:
branches/vs-enhencements/src/world_entities
Files:
13 edited
4 copied

Legend:

Unmodified
Added
Removed
  • branches/vs-enhencements/src/world_entities/WorldEntities.am

    r10645 r10648  
    3434                world_entities/weapons/acid_launcher.cc \
    3535                world_entities/weapons/rf_cannon.cc \
     36                world_entities/weapons/disruptor.cc \
     37                world_entities/weapons/nadion_laser.cc \
    3638                \
    3739                world_entities/projectiles/lbolt.cc \
     
    187189                weapons/acid_launcher.h \
    188190                weapons/rf_cannon.h \
     191                weapons/disruptor.h \
     192                weapons/nadion_laser.h \
    189193                \
    190194                projectiles/lbolt.h \
  • branches/vs-enhencements/src/world_entities/npcs/npc.cc

    r10618 r10648  
    407407      {
    408408        int slot = ws->getWeaponSlot();
    409         int side = ws->getWeaponSide();
     409//         int side = ws->getWeaponSide(); //FIXME / REMOVE: is not used
    410410        this->getWeaponManager().setSlotPosition(slot, (*it).second->getCenter());
    411411        this->getWeaponManager().setSlotDirection(slot, ws->getRelDir());
  • branches/vs-enhencements/src/world_entities/projectiles/plasma_pulse.cc

    r10646 r10648  
    2525#include "debug.h"
    2626
    27 // #include "effects/wobblegrid.h"
    28 
    29 
    3027
    3128ObjectListDefinition(PlasmaPulse);
     
    3936  this->registerObject(this, PlasmaPulse::_objectList);
    4037
    41 //   srand(time(0));   //initialize Random Nomber Generator
    42 
    43   //this->loadModel("models/projectiles/laser.obj");
    4438
    4539  this->setMinEnergy(1);
    4640  this->setHealthMax(0);
    4741  this->lifeSpan = 3.0;
    48 //   this->angle     = 0;
    4942
    5043  this->grid = new Billboard();
     
    8780  this->lifeCycle = 0.0;
    8881
    89  // this->hide();
    9082  this->grid->setVisibility(false);
    9183  this->lifeCycle = 0.0;
    9284  this->toList(OM_NULL);
    93   //this->toList(OM_DEAD);
    9485  this->removeNode();
    9586
     
    136127void PlasmaPulse::draw () const
    137128{
    138   this->grid->draw();
     129  glPushMatrix();
     130    glEnable( GL_ALPHA_TEST);
     131    glAlphaFunc( GL_GEQUAL, .5);
     132    this->grid->draw();
     133  glPopMatrix();
     134
    139135}
  • branches/vs-enhencements/src/world_entities/projectiles/plasma_pulse.h

    r10646 r10648  
    3333    static FastFactory*               fastFactory;
    3434    Billboard*                        grid;
    35 
    36 //     WorldEntity* hitEntity; // FIXME TEMPORARY
    3735};
    3836
  • branches/vs-enhencements/src/world_entities/space_ships/space_ship.cc

    r10644 r10648  
    2727#include "weapons/heavy_blaster.h"
    2828#include "weapons/rf_cannon.h"
     29#include "weapons/nadion_laser.h"
     30#include "weapons/disruptor.h"
    2931#include "weapons/swarm_launcher.h"
    3032#include "weapons/spike_thrower.h"
     
    166168  Weapon* wpLeft1 = new RFCannon ();
    167169  wpLeft1->setName( "RFCannon");
    168 
     170/*
    169171  Weapon* wpRight2 = new MediumBlaster ();
    170172  wpRight2->setName( "MediumBlaster");
    171173  Weapon* wpLeft2 = new MediumBlaster ();
    172   wpLeft2->setName( "MediumBlaster");
    173 
     174  wpLeft2->setName( "MediumBlaster");*/
     175
     176  Weapon* wpRight2 = new NadionLaser ();
     177  wpRight2->setName( "NadionLaser");
     178  Weapon* wpLeft2 = new NadionLaser ();
     179  wpLeft2->setName( "NadionLaser");
     180/*
    174181  Weapon* wpRight3 = new HeavyBlaster (1);
    175182  wpRight3->setName( "HeavyBlaster");
    176183  Weapon* wpLeft3 = new HeavyBlaster (0);
    177   wpLeft3->setName( "HeavyBlaster");
     184  wpLeft3->setName( "HeavyBlaster");*/
     185
     186  Weapon* wpRight3 = new Disruptor ();
     187  wpRight3->setName( "Disruptor");
     188  Weapon* wpLeft3 = new Disruptor ();
     189  wpLeft3->setName( "Disruptor");
    178190
    179191  Weapon* cannon = new SwarmLauncher();
  • branches/vs-enhencements/src/world_entities/weapons/disruptor.cc

    r10645 r10648  
    1515*/
    1616
    17 #include "heavy_blaster.h"
     17#include "disruptor.h"
    1818#include "world_entities/projectiles/projectile.h"
    1919
     
    2929#include "elements/glgui_energywidgetvertical.h"
    3030
    31 CREATE_FACTORY(HeavyBlaster);
    32 // ObjectListDefinition(HeavyBlaster);
     31CREATE_FACTORY(Disruptor);
     32// ObjectListDefinition(Disruptor);
    3333
    3434
     
    3737 * Standard constructor
    3838 */
    39 HeavyBlaster::HeavyBlaster (int leftRight)
     39Disruptor::Disruptor ()
    4040 : Weapon()
    4141{
    42 //     this->registerObject(this, HeavyBlaster::_objectList);
    43 
    44     this->init(leftRight);
    45 }
    46 
    47 HeavyBlaster::HeavyBlaster (const TiXmlElement* root = NULL)
     42//     this->registerObject(this, Disruptor::_objectList);
     43
     44    this->init();
     45}
     46
     47Disruptor::Disruptor (const TiXmlElement* root = NULL)
    4848 : Weapon()
    4949{
    50 //     this->registerObject(this, HeavyBlaster::_objectList);
     50//     this->registerObject(this, Disruptor::_objectList);
    5151
    5252    // TODO add leftRight to params
    53     this->init(0);
     53    this->init();
    5454    if (root != NULL)
    5555      this->loadParams(root);
     
    5959 * Default destructor
    6060 */
    61 HeavyBlaster::~HeavyBlaster()
     61Disruptor::~Disruptor()
    6262{
    6363  for (int i = 0; i < this->getBarrels(); i++)
     
    8585}
    8686
    87 void HeavyBlaster::loadParams(const TiXmlElement* root)
     87void Disruptor::loadParams(const TiXmlElement* root)
    8888{
    8989  Weapon::loadParams(root);
    9090}
    9191
    92 void HeavyBlaster::init(int leftRight)
    93 {
    94 
    95   this->leftRight = leftRight;
    96   //this->registerObject(this, HeavyBlaster::_objectList);
    97 
    98 //  this->model = (Model*)ResourceManager::getInstance()->load("models/guns/test_gun.obj", OBJ, RP_CAMPAIGN);
    99 
    100   this->loadModel("models/guns/frag_cannon2.obj", .4);
    101 
    102 
    103   this->setStateDuration(WS_SHOOTING, 0.5);   // 2 Schuss pro Sekunde
     92void Disruptor::init()
     93{
     94
     95  this->setScaling(.5);
     96
     97  this->loadModel("models/guns/disruptor.obj", this->getScaling());
     98
     99
     100  this->setStateDuration(WS_SHOOTING, 0.3333);  // 3 Shots per Second
    104101  this->setStateDuration(WS_RELOADING, 0);
    105102  this->setStateDuration(WS_ACTIVATING, .5);
     
    118115  this->prepareProjectiles(5);
    119116
    120   this->setBarrels(3);
    121   this->setSegs(2);
     117  this->setBarrels(1);
     118  this->setSegs(1);
    122119  this->activeBarrel = 0;
    123120
     
    131128    this->objComp[i] = new PNode* [this->getSegs()];
    132129    this->emissionPoint[i] = new PNode;
    133     this->emissionPoint[i]->setParent(this);             //< One EmissionPoint, that is a PNode connected to the weapon. You can set this to the exitting point of the Projectiles
     130    this->emissionPoint[i]->setParent(this);  //Parenting emissionPoint to Weapon
    134131    this->emissionPoint[i]->setName("EmissionPoint");
    135132    this->emissionPoint[i]->addNodeFlags(PNODE_PROHIBIT_DELETE_WITH_PARENT);
     
    143140  }
    144141
    145   if (this->leftRight == W_RIGHT)
    146   {
    147     this->emissionPoint[0]->setRelCoor(Vector(1.1, 0.14, 0.06));
    148     this->emissionPoint[1]->setRelCoor(Vector(1.1, -.06, 0.14));
    149     this->emissionPoint[2]->setRelCoor(Vector(1.1, 0.06, -.14));
    150   }
    151   else {
    152     this->emissionPoint[0]->setRelCoor(Vector(1.1, 0.14, -.06));
    153     this->emissionPoint[1]->setRelCoor(Vector(1.1, -.06, -.14));
    154     this->emissionPoint[2]->setRelCoor(Vector(1.1, 0.06, 0.14));
    155   }
    156 
    157 
    158   for (int i = 0; i < this->getBarrels(); i++){
    159     this->shootAnim[i][0]->addKeyFrame(Vector(0.0, 0.0, 0.0), Quaternion(), 0.05, ANIM_LINEAR, ANIM_NULL);
    160     this->shootAnim[i][0]->addKeyFrame(Vector(-0.3, 0.0, 0.0), Quaternion(), 0.9, ANIM_LINEAR, ANIM_NULL);
    161     this->shootAnim[i][0]->addKeyFrame(Vector(0.0, 0.0, 0.0), Quaternion(), 0.55, ANIM_LINEAR, ANIM_NULL);
    162 
    163     this->shootAnim[i][1]->addKeyFrame(Vector(0.0, 0.0, 0.0), Quaternion(), 0.05, ANIM_LINEAR, ANIM_NULL);
    164     this->shootAnim[i][1]->addKeyFrame(Vector(-0.4, 0.0, 0.0), Quaternion(), 1.2, ANIM_LINEAR, ANIM_NULL);
    165     this->shootAnim[i][1]->addKeyFrame(Vector(0.0, 0.0, 0.0), Quaternion(), 0.25, ANIM_LINEAR, ANIM_NULL);
    166   }
     142  this->emissionPoint[0]->setRelCoor(Vector(1.672, 0.0, 0.0) * this->getScaling());
     143
    167144
    168145  Animation3D* animation2 = this->getAnimation(WS_ACTIVATING, this);
     
    180157
    181158
    182 void HeavyBlaster::fire()
     159void Disruptor::fire()
    183160{
    184161  Projectile* pj =  this->getProjectile();
     
    197174
    198175  // initiate animation
    199   for (int i = 0; i < this->getSegs(); i++)
    200     this->shootAnim[this->activeBarrel][i]->replay();
     176//   for (int i = 0; i < this->getSegs(); i++)
     177//     this->shootAnim[this->activeBarrel][i]->replay();
    201178
    202179  // switch barrel
    203   this->activeBarrel = (this->activeBarrel + 1) % this->getBarrels();
     180//   this->activeBarrel = (this->activeBarrel + 1) % this->getBarrels();
    204181}
    205182
     
    207184 *  this activates the weapon
    208185*/
    209 void HeavyBlaster::activate()
     186void Disruptor::activate()
    210187{
    211188}
     
    214191 *  this deactivates the weapon
    215192*/
    216 void HeavyBlaster::deactivate()
    217 {
    218 }
    219 
    220 
    221 void HeavyBlaster::draw() const
     193void Disruptor::deactivate()
     194{
     195}
     196
     197
     198void Disruptor::draw() const
    222199{
    223200  glMatrixMode(GL_MODELVIEW);
     
    229206    glRotatef (this->getAbsDir().getSpacialAxisAngle(), tmpRot.x, tmpRot.y, tmpRot.z );
    230207
    231   if (this->leftRight == W_LEFT)
    232     glScalef(1.0, 1.0, -1.0);
    233 
    234   static_cast<StaticModel*>(this->getModel())->draw(6);
    235 
    236   glPushMatrix();
    237     glTranslatef (this->objComp[0][0]->getAbsCoor().x, this->objComp[0][0]->getAbsCoor().y, this->objComp[0][0]->getAbsCoor().z);
    238     static_cast<StaticModel*>(this->getModel())->draw(2);
     208  static_cast<StaticModel*>(this->getModel())->draw();
     209
    239210  glPopMatrix();
    240 
    241   glPushMatrix();
    242     glTranslatef (this->objComp[1][0]->getAbsCoor().x, this->objComp[1][0]->getAbsCoor().y, this->objComp[1][0]->getAbsCoor().z);
    243     static_cast<StaticModel*>(this->getModel())->draw(3);
    244   glPopMatrix();
    245 
    246   glPushMatrix();
    247     glTranslatef (this->objComp[2][0]->getAbsCoor().x, this->objComp[2][0]->getAbsCoor().y, this->objComp[2][0]->getAbsCoor().z);
    248     static_cast<StaticModel*>(this->getModel())->draw(1);
    249   glPopMatrix();
    250 
    251   glPushMatrix();
    252     glTranslatef (this->objComp[0][1]->getAbsCoor().x, this->objComp[0][1]->getAbsCoor().y, this->objComp[0][1]->getAbsCoor().z);
    253     static_cast<StaticModel*>(this->getModel())->draw(4);
    254   glPopMatrix();
    255 
    256   glPushMatrix();
    257     glTranslatef (this->objComp[1][1]->getAbsCoor().x, this->objComp[1][1]->getAbsCoor().y, this->objComp[1][1]->getAbsCoor().z);
    258     static_cast<StaticModel*>(this->getModel())->draw(5);
    259   glPopMatrix();
    260 
    261   glPushMatrix();
    262     glTranslatef (this->objComp[2][1]->getAbsCoor().x, this->objComp[2][1]->getAbsCoor().y, this->objComp[2][1]->getAbsCoor().z);
    263     static_cast<StaticModel*>(this->getModel())->draw(0);
    264   glPopMatrix();
    265 
    266   glPopMatrix();
    267 }
    268 
    269 void HeavyBlaster::tick(float dt)
     211}
     212
     213void Disruptor::tick(float dt)
    270214{
    271215  if (!Weapon::tickW(dt))
  • branches/vs-enhencements/src/world_entities/weapons/disruptor.h

    r10644 r10648  
    1 #ifndef HEAVY_BLASTER_H
    2 #define HEAVY_BLASTER_H
     1#ifndef DISRUPTOR_H
     2#define DISRUPTOR_H
    33
    44
    55#include "weapon.h"
    66
    7 #define    W_LEFT        0
    8 #define    W_RIGHT       1
     7// #define    W_LEFT        0
     8// #define    W_RIGHT       1
    99
    1010/**
     
    1313 *  Heavy Blaster class
    1414 */
    15 class HeavyBlaster : public Weapon
     15class Disruptor : public Weapon
    1616{
    17 //   ObjectListDeclaration(HeavyBlaster);
     17//   ObjectListDeclaration(Disruptor);
    1818  public:
    19     HeavyBlaster(int leftRight);
    20     HeavyBlaster (const TiXmlElement* root);
    21     virtual ~HeavyBlaster();
     19    Disruptor();
     20    Disruptor (const TiXmlElement* root);
     21    virtual ~Disruptor();
    2222
    23     void init(int leftRight);
     23    void init();
    2424    virtual void loadParams(const TiXmlElement* root);
    2525
     
    4040    int activeBarrel;
    4141
    42     int leftRight;
     42//     int leftRight;
    4343};
    4444
  • branches/vs-enhencements/src/world_entities/weapons/heavy_blaster.cc

    r10645 r10648  
    131131    this->objComp[i] = new PNode* [this->getSegs()];
    132132    this->emissionPoint[i] = new PNode;
    133     this->emissionPoint[i]->setParent(this);             //< One EmissionPoint, that is a PNode connected to the weapon. You can set this to the exitting point of the Projectiles
     133    this->emissionPoint[i]->setParent(this);      //Parenting emissionPoint to Weapons
    134134    this->emissionPoint[i]->setName("EmissionPoint");
    135135    this->emissionPoint[i]->addNodeFlags(PNODE_PROHIBIT_DELETE_WITH_PARENT);
  • branches/vs-enhencements/src/world_entities/weapons/laser_cannon.cc

    r10415 r10648  
    5555  this->registerObject(this, LaserCannon::_objectList);
    5656
    57 //  this->model = (Model*)ResourceManager::getInstance()->load("models/guns/laser_cannon.obj", OBJ, RP_CAMPAIGN);
     57  this->setScaling (5);
    5858
    59   this->loadModel("models/guns/lasercannon.obj", 5.0f);
     59  this->loadModel("models/guns/lasercannon.obj", this->getScaling());
    6060
    6161  this->setStateDuration(WS_SHOOTING, .1);
     
    7575  this->setProjectileTypeC("RailProjectile");
    7676  this->prepareProjectiles(100);
    77   this->setEmissionPoint(Vector(2.8,0,0) * 5.0);
     77  this->setEmissionPoint(Vector(2.8,0,0) * this->getScaling());
    7878}
    7979
  • branches/vs-enhencements/src/world_entities/weapons/light_blaster.cc

    r10645 r10648  
    106106    this->emissionPoint[i]->setName("EmissionPoint");
    107107    this->emissionPoint[i]->addNodeFlags(PNODE_PROHIBIT_DELETE_WITH_PARENT);
    108 //     this->shootAnim[i] = new Animation3D* [this->getSegs()];
    109108    for(int j = 0; j < this->getSegs(); j++)
    110109    {
     
    114113    }
    115114  }
    116 /*
    117   this->emissionPoint[0]->setRelCoor(Vector(1.19, 0.0, 0.1));
    118   this->emissionPoint[1]->setRelCoor(Vector(1.19, -0.07, -0.05));
    119   this->emissionPoint[2]->setRelCoor(Vector(1.19, 0.07, -0.05));*/
    120115
    121116  this->emissionPoint[0]->setRelCoor(Vector(2.2, 0.0, 0.1));
     
    130125  animation2->setInfinity(ANIM_INF_CONSTANT);
    131126  animation3->setInfinity(ANIM_INF_CONSTANT);
    132 
    133 //   this->setEmissionPoint(3.8, 1.2, 0);
    134 
    135 //   for (int i = 0; i < this->getBarrels(); i++){
    136 //     this->shootAnim[i][0]->addKeyFrame(Vector(), Quaternion(i * 120, Vector(1.0, 0.0, 0.0)), 0.049, ANIM_NULL, ANIM_LINEAR);
    137 //     this->shootAnim[i][0]->addKeyFrame(Vector(), Quaternion((i+1)*120, Vector(1.0, 0.0, 0.0)), 0.001, ANIM_NULL, ANIM_LINEAR);
    138 //   }
    139127
    140128
  • branches/vs-enhencements/src/world_entities/weapons/medium_blaster.cc

    r10618 r10648  
    6969void MediumBlaster::init()
    7070{
    71   this->loadModel("models/guns/blaster.obj", .33);
     71  this->setScaling(.3333);
     72
     73  this->loadModel("models/guns/blaster.obj", this->getScaling());
    7274
    7375  this->setStateDuration(WS_SHOOTING, 0.2);   // 5 Schuss pro Sekunde
     
    8284
    8385  this->setActionSound(WA_SHOOT, "sounds/guns/laser.wav");
    84   this->setActionSound(WA_ACTIVATE, "sounds/voices/lasers.wav");
     86//   this->setActionSound(WA_ACTIVATE, "sounds/voices/lasers.wav");
    8587  this->setActionSound(WA_RELOAD, "sounds/spawn/alien_generator.wav");
    8688
    8789  this->setCapability(WTYPE_ALLDIRS | WTYPE_DIRECTIONAL | WTYPE_LIGHT);
    88   this->setProjectileTypeC("MBolt");   // FIXME temp project type until the blaste class exist
     90  this->setProjectileTypeC("MBolt");
    8991  this->prepareProjectiles(100);
    9092
     
    9597
    9698  this->objComp = new PNode**[this->getBarrels()];
     99  this->emissionPoint = new PNode*[this->getBarrels()];
    97100  this->shootAnim = new Animation3D**[this->getBarrels()];
    98101  for (int i = 0; i < this->getBarrels(); i++)
    99102  {
    100103    this->objComp[i] = new PNode* [this->getSegs()];
     104    this->emissionPoint[i] = new PNode;
     105    this->emissionPoint[i]->setParent(this);  //Parenting emissionPoint to Weapon
     106    this->emissionPoint[i]->setName("EmissionPoint");
     107    this->emissionPoint[i]->addNodeFlags(PNODE_PROHIBIT_DELETE_WITH_PARENT);
    101108    this->shootAnim[i] = new Animation3D* [this->getSegs()];
    102109    for(int j = 0; j < this->getSegs(); j++)
     
    109116
    110117  for (int i = 0; i < this->getBarrels(); i++){
    111     this->shootAnim[i][0]->addKeyFrame(Vector(0.0, 0.0, 0.0), Quaternion(), 0.04, ANIM_LINEAR, ANIM_NULL);
    112     this->shootAnim[i][0]->addKeyFrame(Vector(-0.333, 0.0, 0.0), Quaternion(), 0.15, ANIM_LINEAR, ANIM_NULL);
    113     this->shootAnim[i][0]->addKeyFrame(Vector(0.0, 0.0, 0.0), Quaternion(), 0.01, ANIM_LINEAR, ANIM_NULL);
    114 
    115     this->shootAnim[i][1]->addKeyFrame(Vector(0.0, 0.0, 0.0), Quaternion(), 0.04, ANIM_LINEAR, ANIM_NULL);
    116     this->shootAnim[i][1]->addKeyFrame(Vector(.166, 0.0, 0.0), Quaternion(), 0.15, ANIM_LINEAR, ANIM_NULL);
    117     this->shootAnim[i][1]->addKeyFrame(Vector(0.0, 0.0, 0.0), Quaternion(), 0.01, ANIM_LINEAR, ANIM_NULL);
     118    this->shootAnim[i][0]->addKeyFrame(Vector(0.0, 0.0, 0.0) * this->getScaling(), Quaternion(), 0.04, ANIM_LINEAR, ANIM_NULL);
     119    this->shootAnim[i][0]->addKeyFrame(Vector(-1.0, 0.0, 0.0) * this->getScaling(), Quaternion(), 0.15, ANIM_LINEAR, ANIM_NULL);
     120    this->shootAnim[i][0]->addKeyFrame(Vector(0.0, 0.0, 0.0) * this->getScaling(), Quaternion(), 0.01, ANIM_LINEAR, ANIM_NULL);
     121
     122    this->shootAnim[i][1]->addKeyFrame(Vector(0.0, 0.0, 0.0) * this->getScaling(), Quaternion(), 0.04, ANIM_LINEAR, ANIM_NULL);
     123    this->shootAnim[i][1]->addKeyFrame(Vector(.5, 0.0, 0.0) * this->getScaling(), Quaternion(), 0.15, ANIM_LINEAR, ANIM_NULL);
     124    this->shootAnim[i][1]->addKeyFrame(Vector(0.0, 0.0, 0.0) * this->getScaling(), Quaternion(), 0.01, ANIM_LINEAR, ANIM_NULL);
    118125  }
    119126
     
    124131  animation3->setInfinity(ANIM_INF_CONSTANT);
    125132
    126 
    127   this->setEmissionPoint(1.3, 0, 0);
     133  this->emissionPoint[0]->setRelCoor(Vector(3.9, 0.0, 0.0) * this->getScaling());
    128134
    129135  animation2->addKeyFrame(Vector(0.0, -1.0, 0.0), Quaternion(), 0.3, ANIM_LINEAR, ANIM_NULL);
  • branches/vs-enhencements/src/world_entities/weapons/medium_blaster.h

    r10516 r10648  
    3333    PNode*** objComp;
    3434    Animation3D*** shootAnim;
     35    PNode** emissionPoint;
    3536
    3637    int activeBarrel;
  • branches/vs-enhencements/src/world_entities/weapons/nadion_laser.cc

    r10644 r10648  
    1515*/
    1616
    17 #include "medium_blaster.h"
     17#include "nadion_laser.h"
    1818#include "world_entities/projectiles/projectile.h"
    1919
     
    3030
    3131//
    32 //ObjectListDefinition(MediumBlaster);
    33 CREATE_FACTORY(MediumBlaster);
     32//ObjectListDefinition(NadionLaser);
     33CREATE_FACTORY(NadionLaser);
    3434/**
    3535 * Standard constructor
    3636 */
    37 MediumBlaster::MediumBlaster ()
     37NadionLaser::NadionLaser ()
    3838 : Weapon()
    3939{
     
    4141}
    4242
    43 MediumBlaster::MediumBlaster (const TiXmlElement* root = NULL)
     43NadionLaser::NadionLaser (const TiXmlElement* root = NULL)
    4444 : Weapon()
    4545{
     
    5252 * Default destructor
    5353 */
    54 MediumBlaster::~MediumBlaster()
     54NadionLaser::~NadionLaser()
    5555{
    5656      // model will be deleted from WorldEntity-destructor
     
    6262}
    6363
    64 void MediumBlaster::loadParams(const TiXmlElement* root)
     64void NadionLaser::loadParams(const TiXmlElement* root)
    6565{
    6666  Weapon::loadParams(root);
    6767}
    6868
    69 void MediumBlaster::init()
     69void NadionLaser::init()
    7070{
    71   this->loadModel("models/guns/blaster.obj", .33);
     71  this->setScaling(.45);
    7272
    73   this->setStateDuration(WS_SHOOTING, 0.2);   // 5 Schuss pro Sekunde
     73  this->loadModel("models/guns/nadion_laser.obj", this->getScaling());
     74
     75  this->setStateDuration(WS_SHOOTING, 0.1666);   // 6 Schuss pro Sekunde
    7476
    7577  this->setStateDuration(WS_RELOADING, 0);
     
    8284
    8385  this->setActionSound(WA_SHOOT, "sounds/guns/laser.wav");
    84   this->setActionSound(WA_ACTIVATE, "sounds/voices/lasers.wav");
     86//   this->setActionSound(WA_ACTIVATE, "sounds/voices/lasers.wav");
    8587  this->setActionSound(WA_RELOAD, "sounds/spawn/alien_generator.wav");
    8688
    8789  this->setCapability(WTYPE_ALLDIRS | WTYPE_DIRECTIONAL | WTYPE_LIGHT);
    88   this->setProjectileTypeC("MBolt");   // FIXME temp project type until the blaste class exist
     90  this->setProjectileTypeC("MBolt");   // FIXME temp projectile, until nadion_laser_bolt exists.
    8991  this->prepareProjectiles(100);
    9092
    9193
    9294  this->setBarrels(1);
    93   this->setSegs(2);
     95  this->setSegs(1);
    9496  this->activeBarrel = 0;
    9597
    9698  this->objComp = new PNode**[this->getBarrels()];
     99  this->emissionPoint = new PNode*[this->getBarrels()];
    97100  this->shootAnim = new Animation3D**[this->getBarrels()];
    98101  for (int i = 0; i < this->getBarrels(); i++)
    99102  {
    100103    this->objComp[i] = new PNode* [this->getSegs()];
     104    this->emissionPoint[i] = new PNode;
     105    this->emissionPoint[i]->setParent(this);  //Parenting emissionPoint to Weapon
     106    this->emissionPoint[i]->setName("EmissionPoint");
     107    this->emissionPoint[i]->addNodeFlags(PNODE_PROHIBIT_DELETE_WITH_PARENT);
    101108    this->shootAnim[i] = new Animation3D* [this->getSegs()];
    102109    for(int j = 0; j < this->getSegs(); j++)
     
    108115  }
    109116
    110   for (int i = 0; i < this->getBarrels(); i++){
    111     this->shootAnim[i][0]->addKeyFrame(Vector(0.0, 0.0, 0.0), Quaternion(), 0.04, ANIM_LINEAR, ANIM_NULL);
    112     this->shootAnim[i][0]->addKeyFrame(Vector(-0.333, 0.0, 0.0), Quaternion(), 0.15, ANIM_LINEAR, ANIM_NULL);
    113     this->shootAnim[i][0]->addKeyFrame(Vector(0.0, 0.0, 0.0), Quaternion(), 0.01, ANIM_LINEAR, ANIM_NULL);
    114 
    115     this->shootAnim[i][1]->addKeyFrame(Vector(0.0, 0.0, 0.0), Quaternion(), 0.04, ANIM_LINEAR, ANIM_NULL);
    116     this->shootAnim[i][1]->addKeyFrame(Vector(.166, 0.0, 0.0), Quaternion(), 0.15, ANIM_LINEAR, ANIM_NULL);
    117     this->shootAnim[i][1]->addKeyFrame(Vector(0.0, 0.0, 0.0), Quaternion(), 0.01, ANIM_LINEAR, ANIM_NULL);
    118   }
     117  this->emissionPoint[0]->setRelCoor(Vector(1.680, 0.0, 0.0) * this->getScaling());
    119118
    120119  Animation3D* animation2 = this->getAnimation(WS_ACTIVATING, this);
     
    123122  animation2->setInfinity(ANIM_INF_CONSTANT);
    124123  animation3->setInfinity(ANIM_INF_CONSTANT);
    125 
    126 
    127   this->setEmissionPoint(1.3, 0, 0);
    128124
    129125  animation2->addKeyFrame(Vector(0.0, -1.0, 0.0), Quaternion(), 0.3, ANIM_LINEAR, ANIM_NULL);
     
    135131
    136132
    137 void MediumBlaster::fire()
     133void NadionLaser::fire()
    138134{
    139135  Projectile* pj =  this->getProjectile();
     
    152148  pj->activate();
    153149
    154   for (int i = 0; i < this->getSegs(); i++)
    155     this->shootAnim[this->activeBarrel][i]->replay();
    156150}
    157151
     
    160154 *  this activates the weapon
    161155*/
    162 void MediumBlaster::activate()
     156void NadionLaser::activate()
    163157{
    164158}
     
    167161 *  this deactivates the weapon
    168162*/
    169 void MediumBlaster::deactivate()
     163void NadionLaser::deactivate()
    170164{
    171165}
    172166
    173 void MediumBlaster::draw() const
     167void NadionLaser::draw() const
    174168{
    175169  glMatrixMode(GL_MODELVIEW);
     
    178172    Vector tmpRot = this->getAbsDir().getSpacialAxis();
    179173    glRotatef (this->getAbsDir().getSpacialAxisAngle(), tmpRot.x, tmpRot.y, tmpRot.z );
    180     static_cast<StaticModel*>(this->getModel())->draw(0);
     174    static_cast<StaticModel*>(this->getModel())->draw();
    181175
    182   glPushMatrix();
    183     glTranslatef (this->objComp[0][0]->getAbsCoor().x, this->objComp[0][0]->getAbsCoor().y, this->objComp[0][0]->getAbsCoor().z);
    184     static_cast<StaticModel*>(this->getModel())->draw(1);
    185   glPopMatrix();
    186 
    187   glPushMatrix();
    188     glTranslatef (this->objComp[0][1]->getAbsCoor().x, this->objComp[0][1]->getAbsCoor().y, this->objComp[0][1]->getAbsCoor().z);
    189     static_cast<StaticModel*>(this->getModel())->draw(2);
    190   glPopMatrix();
    191176
    192177  glPopMatrix();
    193178}
    194179
    195 void MediumBlaster::tick(float dt)
     180void NadionLaser::tick(float dt)
    196181{
    197182  if (!Weapon::tickW(dt))
  • branches/vs-enhencements/src/world_entities/weapons/nadion_laser.h

    r10644 r10648  
    1 #ifndef MEDIUM_BLASTER_H
    2 #define MEDIUM_BLASTER_H
     1#ifndef NADION_LASER_H
     2#define NADION_LASER_H
    33
    44
    55#include "weapon.h"
    66
    7 /**
    8  *      @author Marc Schaerer <marcscha@ee.ethz.ch>
    9  * 
    10  *  Medium Blaster class
    11  */
    12 class MediumBlaster : public Weapon
     7
     8class NadionLaser : public Weapon
    139{
    14   //ObjectListDeclaration(MediumBlaster);
     10  //ObjectListDeclaration(NadionLaser);
    1511  public:
    16     MediumBlaster();
    17     MediumBlaster (const TiXmlElement* root);
    18     virtual ~MediumBlaster();
     12    NadionLaser();
     13    NadionLaser (const TiXmlElement* root);
     14    virtual ~NadionLaser();
    1915
    2016    void init();
     
    3329    PNode*** objComp;
    3430    Animation3D*** shootAnim;
     31    PNode** emissionPoint;
    3532
    3633    int activeBarrel;
  • branches/vs-enhencements/src/world_entities/weapons/rf_cannon.cc

    r10645 r10648  
    6767{
    6868
    69   this->loadModel("models/guns/rf_cannon.obj", 0.2);
     69  this->setScaling(.2);
     70
     71  this->loadModel("models/guns/rf_cannon.obj", this->getScaling());
    7072
    7173
     
    102104  }
    103105
    104   this->emissionPoint[0]->setRelCoor(Vector(1.02, 0.0, 0.15));
    105   this->emissionPoint[1]->setRelCoor(Vector(1.02, 0.09, 0.0));
    106   this->emissionPoint[2]->setRelCoor(Vector(1.02, 0.0, -0.15));
    107   this->emissionPoint[3]->setRelCoor(Vector(1.02, -0.09, 0.0));
     106  this->emissionPoint[0]->setRelCoor(Vector(4.1, 0.0, 0.75) * this->getScaling());
     107  this->emissionPoint[1]->setRelCoor(Vector(4.1, 0.45, 0.0) * this->getScaling());
     108  this->emissionPoint[2]->setRelCoor(Vector(4.1, 0.0, -0.75) * this->getScaling());
     109  this->emissionPoint[3]->setRelCoor(Vector(4.1, -0.45, 0.0) * this->getScaling());
    108110
    109111  Animation3D* animation2 = this->getAnimation(WS_ACTIVATING, this);
  • branches/vs-enhencements/src/world_entities/weapons/weapon.cc

    r10645 r10648  
    134134  for(int i = 0; i < this->barrels; i++){
    135135    this->emissionPoint[i] = new PNode;
    136     this->emissionPoint[i]->setParent(this);             //< One EmissionPoint, that is a PNode connected to the weapon. You can set this to the exitting point of the Projectiles
     136    this->emissionPoint[i]->setParent(this);  //Parenting emissionPoint to Weapons
    137137    this->emissionPoint[i]->setName("EmissionPoint");
    138138    this->emissionPoint[i]->addNodeFlags(PNODE_PROHIBIT_DELETE_WITH_PARENT);
     
    159159  //this->setSynchronized(true);
    160160}
    161 
    162 /**
    163  * needed, if there are more than one barrel or segments
    164  */
    165 /*
    166 void Weapon::init2()
    167 {
    168   if (this->barrels == 1 && this->segs == 1)
    169     return;
    170 
    171   delete this->emissionPoint[0];
    172   delete this->emissionPoint;
    173   delete this->shootAnim[0];
    174   delete this->shootAnim;
    175 
    176   this->shootAnim = new Animation3D**[this->barrels];
    177   this->emissionPoint = new PNode*[this->barrels];
    178   for(int i = 0; i < this->barrels; i++){
    179     this->emissionPoint[i] = new PNode;
    180     this->emissionPoint[i]->setParent(this);             //< One EmissionPoint, that is a PNode connected to the weapon. You can set this to the exitting point of the Projectiles
    181     this->emissionPoint[i]->setName("EmissionPoint");
    182     this->emissionPoint[i]->addNodeFlags(PNODE_PROHIBIT_DELETE_WITH_PARENT);
    183     this->shootAnim[i] = new Animation3D* [this->segs];
    184   }
    185 }*/
    186 
    187 /**
    188  * deconstructor for init2
    189  */
    190 /*
    191 void Weapon::deconstr()
    192 {
    193   for(int i = 0; i < this->barrels; i++) {
    194     delete this->emissionPoint[i];
    195     for (int j = 0; j < this->segs; j++)
    196       delete this->shootAnim[i][j];
    197     delete this->shootAnim[i];
    198   }
    199 
    200   delete this->emissionPoint;
    201   delete this->shootAnim;
    202 }*/
    203161
    204162/**
  • branches/vs-enhencements/src/world_entities/weapons/weapon.h

    r10645 r10648  
    124124    Projectile* getProjectile();
    125125
     126    inline void setScaling(float scaling) { this->scaling = scaling; };
     127    inline float getScaling() { return this->scaling; };
    126128
    127129    // EMISSION
     
    248250    PNode*               defaultTarget;                    //!< A target for targeting Weapons.
    249251
     252    float                scaling;                          //!< Local scaling factor. any scaling will be done through this vector.
     253
    250254    ////////////
    251255    // PHASES //
Note: See TracChangeset for help on using the changeset viewer.