Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 10516 in orxonox.OLD for trunk/src/world_entities/weapons


Ignore:
Timestamp:
Jan 30, 2007, 9:17:21 PM (17 years ago)
Author:
patrick
Message:

merged playability back to trunk

Location:
trunk/src/world_entities/weapons
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/world_entities/weapons/acid_launcher.cc

    r10419 r10516  
    3232
    3333#include "util/loading/factory.h"
     34
     35#include "elements/glgui_energywidgetvertical.h"
    3436
    3537
     
    122124void AcidLauncher::tick(float dt)
    123125{
     126  if (this->energyWidget != NULL && !this->isEnergyWidgetInitialized)
     127  {
     128    this->energyWidget->setDisplayedImage("textures/gui/gui_acid.png");
     129    this->isEnergyWidgetInitialized = true;
     130  }
     131
    124132  if (!Weapon::tickW(dt))
    125133    return;
  • trunk/src/world_entities/weapons/heavy_blaster.cc

    r10499 r10516  
    1010
    1111#include "loading/fast_factory.h"
     12
     13#include "elements/glgui_energywidgetvertical.h"
    1214
    1315CREATE_FACTORY(HeavyBlaster);
     
    9395
    9496  this->setActionSound(WA_SHOOT, "sounds/guns/laser.wav");
    95   this->setActionSound(WA_ACTIVATE, "sounds/voices/lasers.wav");
     97//   this->setActionSound(WA_ACTIVATE, "sounds/voices/lasers.wav");
    9698  this->setActionSound(WA_RELOAD, "sounds/spawn/alien_generator.wav");
    9799
    98100  this->setCapability(WTYPE_ALLDIRS | WTYPE_DIRECTIONAL | WTYPE_LIGHT);
    99   this->setProjectileTypeC("HBolt");   // FIXME temp project type until the blaste class exist
    100 //   this->setProjectileTypeC("SpikeBall");   // FIXME temp project type until the blaste class exist
     101  this->setProjectileTypeC("HBolt");
    101102  this->prepareProjectiles(5);
    102103
     
    104105  this->setSegs(2);
    105106  this->activeBarrel = 0;
    106 //   this->init2();
    107107
    108108
     
    239239  glPushMatrix();
    240240    glTranslatef (this->objComp[0][0]->getAbsCoor().x, this->objComp[0][0]->getAbsCoor().y, this->objComp[0][0]->getAbsCoor().z);
     241    static_cast<StaticModel*>(this->getModel())->draw(2);
     242  glPopMatrix();
     243
     244  glPushMatrix();
     245    glTranslatef (this->objComp[1][0]->getAbsCoor().x, this->objComp[1][0]->getAbsCoor().y, this->objComp[1][0]->getAbsCoor().z);
     246    static_cast<StaticModel*>(this->getModel())->draw(3);
     247  glPopMatrix();
     248
     249  glPushMatrix();
     250    glTranslatef (this->objComp[2][0]->getAbsCoor().x, this->objComp[2][0]->getAbsCoor().y, this->objComp[2][0]->getAbsCoor().z);
    241251    static_cast<StaticModel*>(this->getModel())->draw(1);
    242   glPopMatrix();
    243 
    244   glPushMatrix();
    245     glTranslatef (this->objComp[1][0]->getAbsCoor().x, this->objComp[1][0]->getAbsCoor().y, this->objComp[1][0]->getAbsCoor().z);
    246     static_cast<StaticModel*>(this->getModel())->draw(2);
    247   glPopMatrix();
    248 
    249   glPushMatrix();
    250     glTranslatef (this->objComp[2][0]->getAbsCoor().x, this->objComp[2][0]->getAbsCoor().y, this->objComp[2][0]->getAbsCoor().z);
    251     static_cast<StaticModel*>(this->getModel())->draw(0);
    252252  glPopMatrix();
    253253
     
    264264  glPushMatrix();
    265265    glTranslatef (this->objComp[2][1]->getAbsCoor().x, this->objComp[2][1]->getAbsCoor().y, this->objComp[2][1]->getAbsCoor().z);
    266     static_cast<StaticModel*>(this->getModel())->draw(3);
    267   glPopMatrix();
    268 
    269   glPopMatrix();
    270 }
     266    static_cast<StaticModel*>(this->getModel())->draw(0);
     267  glPopMatrix();
     268
     269  glPopMatrix();
     270}
     271
     272void HeavyBlaster::tick(float dt)
     273{
     274  if (this->energyWidget != NULL && !this->isEnergyWidgetInitialized)
     275  {
     276    this->energyWidget->setDisplayedImage("textures/gui/gui_heavy_bolt.png");
     277    this->setEnergyWidgetInitialized(true);
     278  }
     279}
  • trunk/src/world_entities/weapons/heavy_blaster.h

    r10499 r10516  
    2929    virtual void fire();
    3030
     31    virtual void tick(float dt);
     32
    3133    virtual void draw() const;
    3234
  • trunk/src/world_entities/weapons/light_blaster.cc

    r10471 r10516  
    1010
    1111#include "loading/fast_factory.h"
     12
     13#include "elements/glgui_energywidgetvertical.h"
    1214
    1315CREATE_FACTORY(LightBlaster);
     
    4345   delete [] this->shootAnim;
    4446   delete [] this->objComp;
    45 /*
    46     for(int j = 0; j < this->getSegs(); j++)
    47     {
    48       delete this->shootAnim[i][j];
    49       delete this->objComp[i][j];
    50     }
    51     delete this->shootAnim[i];
    52     delete this->objComp[i];
    53     delete this->emissionPoint[i];
    54   }*/
    5547
    56 //  this->deconstr();
    57       // model will be deleted from WorldEntity-destructor
    5848}
    5949
     
    7969
    8070  this->setActionSound(WA_SHOOT, "sounds/guns/laser.wav");
    81   this->setActionSound(WA_ACTIVATE, "sounds/voices/lasers.wav");
     71//   this->setActionSound(WA_ACTIVATE, "sounds/voices/lasers.wav");
    8272  this->setActionSound(WA_RELOAD, "sounds/spawn/alien_generator.wav");
    8373
    8474  this->setCapability(WTYPE_ALLDIRS | WTYPE_DIRECTIONAL | WTYPE_LIGHT);
    85   //this->setProjectileTypeC("RailProjectile");   // FIXME temp project type until the blaste class exist
    86   this->setProjectileTypeC("LBolt");   // Working; FIXME: add textures
    87 //   this->setProjectileTypeC("Spike");   // Working; FIXME: add textures
     75  this->setProjectileTypeC("LBolt");
    8876  this->prepareProjectiles(100);
    8977
     
    137125}
    138126
    139 
    140127void LightBlaster::fire()
    141128{
     
    187174    static_cast<StaticModel*>(this->getModel())->draw();
    188175  glPopMatrix();
     176
    189177}
     178
     179void LightBlaster::tick(float dt)
     180{
     181  if (this->energyWidget != NULL && !this->isEnergyWidgetInitialized)
     182  {
     183    this->energyWidget->setDisplayedImage("textures/gui/gui_light_bolt.png");
     184    this->setEnergyWidgetInitialized(true);
     185  }
     186}
  • trunk/src/world_entities/weapons/light_blaster.h

    r10368 r10516  
    2626    virtual void fire();
    2727
     28    virtual void tick(float dt);
     29
    2830    virtual void draw() const;
    2931
  • trunk/src/world_entities/weapons/medium_blaster.cc

    r10415 r10516  
    1010
    1111#include "loading/fast_factory.h"
     12
     13#include "elements/glgui_energywidgetvertical.h"
    1214
    1315//
     
    138140}
    139141
     142
    140143/**
    141144 *  this activates the weapon
     
    158161  glTranslatef (this->getAbsCoor ().x, this->getAbsCoor ().y, this->getAbsCoor ().z);
    159162
    160   static_cast<StaticModel*>(this->getModel())->draw(2);
     163  static_cast<StaticModel*>(this->getModel())->draw(0);
    161164
    162165  glPushMatrix();
     
    167170  glPushMatrix();
    168171    glTranslatef (this->objComp[0][1]->getAbsCoor().x, this->objComp[0][1]->getAbsCoor().y, this->objComp[0][1]->getAbsCoor().z);
    169     static_cast<StaticModel*>(this->getModel())->draw(0);
     172    static_cast<StaticModel*>(this->getModel())->draw(2);
    170173  glPopMatrix();
    171174
    172175  glPopMatrix();
    173176}
     177
     178void MediumBlaster::tick(float dt)
     179{
     180  if (this->energyWidget != NULL && !this->isEnergyWidgetInitialized)
     181  {
     182    this->energyWidget->setDisplayedImage("textures/gui/gui_medium_bold.png");
     183    this->setEnergyWidgetInitialized(true);
     184  }
     185}
  • trunk/src/world_entities/weapons/medium_blaster.h

    r10368 r10516  
    2626    virtual void fire();
    2727
     28    virtual void tick(float dt);
     29
    2830    virtual void draw() const;
    2931
  • trunk/src/world_entities/weapons/spike_thrower.cc

    r10419 r10516  
    3434
    3535#include "util/loading/factory.h"
     36
     37#include "elements/glgui_energywidgetvertical.h"
    3638
    3739
     
    125127void SpikeThrower::tick(float dt)
    126128{
     129  if (this->energyWidget != NULL && !this->isEnergyWidgetInitialized)
     130  {
     131    this->energyWidget->setDisplayedImage("textures/gui/gui_spikeball.png");
     132    this->isEnergyWidgetInitialized = true;
     133  }
     134
    127135  if (!Weapon::tickW(dt))
    128136    return;
  • trunk/src/world_entities/weapons/swarm_launcher.cc

    r10419 r10516  
    3333
    3434#include "util/loading/factory.h"
     35
     36#include "elements/glgui_energywidgetvertical.h"
    3537
    3638
     
    141143
    142144  this->setAbsDirSoft(quat, 5);
     145
     146  if (this->energyWidget != NULL && !this->isEnergyWidgetInitialized)
     147  {
     148    this->energyWidget->setDisplayedImage("textures/gui/gui_swarm_missiles.png");
     149    this->setEnergyWidgetInitialized(true);
     150  }
    143151}
    144152
  • trunk/src/world_entities/weapons/weapon.cc

    r10443 r10516  
    154154
    155155  this->energyWidget = NULL;
     156  isEnergyWidgetInitialized = false;
    156157
    157158  // set this object to be synchronized over network
  • trunk/src/world_entities/weapons/weapon.h

    r10443 r10516  
    190190    inline int getPreferedSlot() { return this->preferedSlot; }
    191191
     192    inline void setEnergyWidgetInitialized(bool b) {this->isEnergyWidgetInitialized = b;};
     193
    192194
    193195  protected:
     
    207209
    208210    void setPreferedSlot(int slot, int side) { this->preferedSlot = slot; this->preferedSide = side; }
     211
     212    //gui
     213    OrxGui::GLGuiEnergyWidgetVertical* energyWidget;
     214    bool  isEnergyWidgetInitialized;
    209215
    210216
     
    238244    float                maxCharge;                        //!< The maximal energy to be loaded onto one projectile (this is only availible if chargeable is enabled)
    239245
    240     OrxGui::GLGuiEnergyWidgetVertical* energyWidget;
     246    //OrxGui::GLGuiEnergyWidgetVertical* energyWidget;
    241247
    242248    PNode*               defaultTarget;                    //!< A target for targeting Weapons.
Note: See TracChangeset for help on using the changeset viewer.