Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 6810 in orxonox.OLD for trunk/src/world_entities


Ignore:
Timestamp:
Jan 28, 2006, 3:30:54 PM (19 years ago)
Author:
bensch
Message:

trunk: added hyperblaster

Location:
trunk/src/world_entities
Files:
1 edited
4 copied

Legend:

Unmodified
Added
Removed
  • trunk/src/world_entities/Makefile.am

    r6731 r6810  
    3535                  world_entities/weapons/targeting_turret.cc \
    3636                  world_entities/weapons/cannon.cc \
     37                  world_entities/weapons/hyperblaster.cc \
    3738                  world_entities/weapons/aim.cc \
    3839                  world_entities/weapons/crosshair.cc \
     
    4445                  world_entities/projectiles/rocket.cc \
    4546                  world_entities/projectiles/guided_missile.cc \
     47                  world_entities/projectiles/hyperblast.cc \
    4648                  \
    4749                  world_entities/power_ups/power_up.cc \
  • trunk/src/world_entities/projectiles/hyperblast.cc

    r6807 r6810  
    1010
    1111   ### File Specific
    12    main-programmer: Patrick Boenzli
    13    co-programmer: Benjamin Grauer
     12   main-programmer: Benjamin Grauer
     13   co-programmer: ...
    1414
    1515*/
    1616#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_WEAPON
    1717
    18 #include "rocket.h"
     18#include "hyperblast.h"
    1919
    2020#include "fast_factory.h"
     
    2525#include "particle_emitter.h"
    2626#include "sprite_particles.h"
     27#include "spark_particles.h"
    2728
    2829
    2930using namespace std;
    3031
    31 CREATE_FAST_FACTORY_STATIC(Rocket, CL_ROCKET);
     32CREATE_FAST_FACTORY_STATIC(Hyperblast, CL_HYPERBLAST);
    3233
    3334/**
    3435 *  standard constructor
    3536*/
    36 Rocket::Rocket () : Projectile()
     37Hyperblast::Hyperblast () : Projectile()
    3738{
    38   this->setClassID(CL_ROCKET, "Rocket");
     39  this->setClassID(CL_HYPERBLAST, "Hyperblast");
    3940
    4041  float modelSize = .3;
    41   this->loadModel("models/projectiles/orx-rocket.obj", .3);
     42  this->loadModel("models/projectiles/orx-hyperblast.obj", .3);
    4243
    4344  this->setMinEnergy(1);
     
    5455 *  standard deconstructor
    5556*/
    56 Rocket::~Rocket ()
     57Hyperblast::~Hyperblast ()
    5758{
    58   // delete this->emitter;
    59 
    6059  /* this is normaly done by World.cc by deleting the ParticleEngine */
    61   if (Rocket::trailParticles != NULL && ClassList::getList(CL_ROCKET)->size() <= 1)
     60  if (Hyperblast::extParticles != NULL && ClassList::getList(CL_HYPERBLAST)->size() <= 1)
    6261  {
    63 /*    if (ClassList::exists(Rocket::trailParticles, CL_PARTICLE_SYSTEM))
    64       delete Rocket::trailParticles;*/
    65     Rocket::trailParticles = NULL;
     62    Hyperblast::extParticles = NULL;
    6663  }
    67   if (Rocket::explosionParticles != NULL && ClassList::getList(CL_ROCKET)->size() <= 1)
     64  if (Hyperblast::explosionParticles != NULL && ClassList::getList(CL_HYPERBLAST)->size() <= 1)
    6865  {
    69 /*    if (ClassList::exists(Rocket::explosionParticles, CL_PARTICLE_SYSTEM))
    70       delete Rocket::explosionParticles;*/
    71     Rocket::explosionParticles = NULL;
     66    Hyperblast::explosionParticles = NULL;
    7267  }
    7368
    7469}
    7570
    76 SpriteParticles* Rocket::trailParticles = NULL;
    77 SpriteParticles* Rocket::explosionParticles = NULL;
     71SpriteParticles* Hyperblast::extParticles = NULL;
     72SparkParticles* Hyperblast::explosionParticles = NULL;
    7873
    79 void Rocket::activate()
     74void Hyperblast::activate()
    8075{
    81   if (unlikely(Rocket::trailParticles == NULL))
     76  if (unlikely(Hyperblast::extParticles == NULL))
    8277  {
    83     Rocket::trailParticles = new SpriteParticles(2000);
    84     Rocket::trailParticles->setName("RocketTrailParticles");
    85     Rocket::trailParticles->setMaterialTexture("maps/radial-trans-noise.png");
    86     Rocket::trailParticles->setLifeSpan(1.0, .3);
    87     Rocket::trailParticles->setRadius(0.0, .5);
    88     Rocket::trailParticles->setRadius(0.2, 2.0);
    89     Rocket::trailParticles->setRadius(.5, .8);
    90     Rocket::trailParticles->setRadius(1.0, .8);
    91     Rocket::trailParticles->setColor(0.0, 1,0,0,.7);
    92     Rocket::trailParticles->setColor(0.2, .8,.8,0,.5);
    93     Rocket::trailParticles->setColor(0.5, .8,.8,.8,.8);
    94     Rocket::trailParticles->setColor(1.0, .8,.8,.8,.0);
     78    Hyperblast::extParticles = new SpriteParticles(2000);
     79    Hyperblast::extParticles->setName("HyperblastTrailParticles");
     80    Hyperblast::extParticles->setMaterialTexture("maps/radial-trans-noise.png");
     81    Hyperblast::extParticles->setLifeSpan(1.0, .3);
     82    Hyperblast::extParticles->setRadius(0.0, .5);
     83    Hyperblast::extParticles->setRadius(0.2, 2.0);
     84    Hyperblast::extParticles->setRadius(.5, .8);
     85    Hyperblast::extParticles->setRadius(1.0, .8);
     86    Hyperblast::extParticles->setColor(0.0, 1,0,0,.7);
     87    Hyperblast::extParticles->setColor(0.2, .8,.8,0,.5);
     88    Hyperblast::extParticles->setColor(0.5, .8,.8,.8,.8);
     89    Hyperblast::extParticles->setColor(1.0, .8,.8,.8,.0);
    9590  }
    96   if (unlikely(Rocket::explosionParticles == NULL))
     91  if (unlikely(Hyperblast::explosionParticles == NULL))
    9792  {
    98     Rocket::explosionParticles = new SpriteParticles(200);
    99     Rocket::explosionParticles->setName("RocketExplosionParticles");
    100     Rocket::explosionParticles->setMaterialTexture("maps/radial-trans-noise.png");
    101     Rocket::explosionParticles->setLifeSpan(.5, .3);
    102     Rocket::explosionParticles->setRadius(0.0, 10);
    103     Rocket::explosionParticles->setRadius(.5, 15.0);
    104     Rocket::explosionParticles->setRadius(1.0, 10.0);
    105     Rocket::explosionParticles->setColor(0.0, 0,1,0,1);
    106     Rocket::explosionParticles->setColor(0.5, .8,.8,0,.8);
    107     Rocket::explosionParticles->setColor(0.8, .8,.8,.3,.8);
    108     Rocket::explosionParticles->setColor(1.0, 1,1,1,.0);
     93    Hyperblast::explosionParticles = new SparkParticles(200);
     94    Hyperblast::explosionParticles->setName("HyperblastExplosionParticles");
     95    Hyperblast::explosionParticles->setLifeSpan(.5, .3);
     96    Hyperblast::explosionParticles->setRadius(0.0, 10);
     97    Hyperblast::explosionParticles->setRadius(.5, 15.0);
     98    Hyperblast::explosionParticles->setRadius(1.0, 10.0);
     99    Hyperblast::explosionParticles->setColor(0.0, 0,1,0,1);
     100    Hyperblast::explosionParticles->setColor(0.5, .8,.8,0,.8);
     101    Hyperblast::explosionParticles->setColor(0.8, .8,.8,.3,.8);
     102    Hyperblast::explosionParticles->setColor(1.0, 1,1,1,.0);
    109103  }
    110104
    111   this->emitter->setSystem(Rocket::trailParticles);
     105  this->emitter->setSystem(Hyperblast::extParticles);
    112106
    113107  this->updateNode(0);
     
    117111
    118112
    119 void Rocket::deactivate()
     113void Hyperblast::deactivate()
    120114{
    121115  this->emitter->setSystem(NULL);
     
    125119//  GarbageCollector::getInstance()->collect(this);
    126120  this->toList(OM_DEAD);
    127   Rocket::fastFactory->kill(this);
     121  Hyperblast::fastFactory->kill(this);
    128122}
    129123
    130124
    131 void Rocket::collidesWith(WorldEntity* entity, const Vector& location)
     125void Hyperblast::collidesWith(WorldEntity* entity, const Vector& location)
    132126{
    133127  if (this->hitEntity != entity)
     
    140134 * @param time since last tick
    141135*/
    142 void Rocket::tick (float dt)
     136void Hyperblast::tick (float dt)
    143137{
    144138  //Vector v = *this->flightDirection * ( this->speed * time * 1000 + 0.1);
     
    153147 *  the function gets called, when the projectile is destroyed
    154148*/
    155 void Rocket::destroy ()
     149void Hyperblast::destroy ()
    156150{
    157   PRINTF(5)("DESTROY Rocket\n");
     151  PRINTF(5)("DESTROY Hyperblast\n");
    158152  this->lifeCycle = .95; //!< @todo calculate this usefully.
    159   this->emitter->setSystem(Rocket::explosionParticles);
     153  this->emitter->setSystem(Hyperblast::explosionParticles);
    160154
    161155  this->emitter->setEmissionRate(1000.0);
     
    166160
    167161
    168 void Rocket::draw () const
     162void Hyperblast::draw () const
    169163{
    170164  glMatrixMode(GL_MODELVIEW);
  • trunk/src/world_entities/projectiles/hyperblast.h

    r6807 r6810  
    11/*!
    2  * @file rocket.h
    3  * @brief a Rocket Projectile
     2 * @file hyperblast.h
     3 * @brief a Hyperblast Projectile
    44*/
    55
    6 #ifndef _ROCKET_H
    7 #define _ROCKET_H
     6#ifndef _HYPERBLAST_H
     7#define _HYPERBLAST_H
    88
    99#include "projectile.h"
     
    1212class Weapon;
    1313class SpriteParticles;
     14class SparkParticles;
    1415class ParticleEmitter;
    1516class FastFactory;
    1617
    17 class Rocket : public Projectile
     18class Hyperblast : public Projectile
    1819{
    1920  public:
    20     Rocket ();
    21     virtual ~Rocket ();
     21    Hyperblast ();
     22    virtual ~Hyperblast ();
    2223
    2324
     
    3536  private:
    3637    static FastFactory*               fastFactory;
    37     static SpriteParticles*           trailParticles;
    38     static SpriteParticles*           explosionParticles;
     38    static SpriteParticles*           extParticles;
     39    static SparkParticles*            explosionParticles;
    3940
    4041    ParticleEmitter*                  emitter;
    4142
    42 
    4343    WorldEntity* hitEntity; // FIXME TEMPORARY
    44 
    4544};
    4645
    47 #endif /* _ROCKET_H */
     46#endif /* _HYPERBLAST_H */
  • trunk/src/world_entities/weapons/hyperblaster.cc

    r6807 r6810  
    1212
    1313   ### File Specific
    14    main-programmer: Patrick Boenzli
     14   main-programmer: Benjamin Grauer
    1515   co-programmer:
    1616
     
    2121#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_WEAPON
    2222
    23 #include "cannon.h"
     23#include "hyperblaster.h"
    2424
    2525#include "world_entity.h"
     
    3838using namespace std;
    3939
    40 CREATE_FACTORY(Cannon, CL_CANNON);
     40CREATE_FACTORY(Hyperblaster, CL_HYPERBLASTER);
    4141
    42 /**
    43  *  standard constructor
    44 
    45    creates a new weapon
    46 */
    47 Cannon::Cannon ()
    48   : Weapon()
    49 {
    50   this->init();
    51 }
    52 
    53 
    54 Cannon::Cannon(const TiXmlElement* root)
     42Hyperblaster::Hyperblaster(const TiXmlElement* root)
    5543{
    5644  this->init();
     
    6250 *  standard deconstructor
    6351*/
    64 Cannon::~Cannon ()
     52Hyperblaster::~Hyperblaster ()
    6553{
    6654  // model will be deleted from WorldEntity-destructor
     
    6856
    6957
    70 void Cannon::init()
     58void Hyperblaster::init()
    7159{
    72   this->setClassID(CL_CANNON, "Cannon");
     60  this->setClassID(CL_HYPERBLASTER, "Hyperblaster");
    7361
    7462//  this->model = (Model*)ResourceManager::getInstance()->load("models/guns/test_gun.obj", OBJ, RP_CAMPAIGN);
     
    7765
    7866  this->setStateDuration(WS_SHOOTING, 2.0);
    79   this->setStateDuration(WS_RELOADING, .1);
     67  this->setStateDuration(WS_RELOADING, 5.0);
    8068  this->setStateDuration(WS_ACTIVATING, .1);
    8169  this->setStateDuration(WS_DEACTIVATING, .4);
    8270
    83   this->setEnergyMax(100);
    84   this->increaseEnergy(100);
     71  this->setEnergyMax(10);
     72  this->increaseEnergy(10);
    8573  //this->minCharge = 2;
    8674
    8775  this->setActionSound(WA_SHOOT, "sound/explo.wav");
    88   this->setActionSound(WA_ACTIVATE, "sound/voices/cannon.wav");
     76  this->setActionSound(WA_ACTIVATE, "sound/voices/hyperblaster.wav");
    8977
    9078  this->setCapability(WTYPE_ALLDIRS | WTYPE_DIRECTIONAL | WTYPE_HEAVY);
    91   this->setProjectileType(CL_BOMB);
    92   this->prepareProjectiles(5);
     79  this->setProjectileType(CL_HYPERBLAST);
     80  this->prepareProjectiles(2);
    9381
    9482//  this->objectComponent1 = new PNode();
     
    10997//     animation1->addKeyFrame(Vector(0, 0, 0), Quaternion(), 0.0, ANIM_LINEAR, ANIM_NULL);
    11098
    111   animation2->addKeyFrame(Vector(0.0, -1.0, 0.0), Quaternion(), 0.3, ANIM_LINEAR, ANIM_NULL);
     99  animation2->addKeyFrame(Vector(1.0, -1.0, 0.0), Quaternion(), 0.3, ANIM_LINEAR, ANIM_NULL);
     100  animation2->addKeyFrame(Vector(1.0, 0.0, 0.0), Quaternion(), 0.3, ANIM_LINEAR, ANIM_NULL);
    112101  animation2->addKeyFrame(Vector(0.0, 0.0, 0.0), Quaternion(), 0.3, ANIM_LINEAR, ANIM_NULL);
    113102
    114103  animation3->addKeyFrame(Vector(0.0, 0.0, 0.0), Quaternion(), 0.3, ANIM_LINEAR, ANIM_NULL);
    115   animation3->addKeyFrame(Vector(0.0, -1.0, 0.0), Quaternion(), 0.3, ANIM_LINEAR, ANIM_NULL);
     104  animation3->addKeyFrame(Vector(1.0, -1.0, 0.0), Quaternion(), 0.3, ANIM_LINEAR, ANIM_NULL);
     105  animation2->addKeyFrame(Vector(1.0, -1.0, 0.0), Quaternion(), 0.3, ANIM_LINEAR, ANIM_NULL);
    116106}
    117107
    118108
    119 void Cannon::loadParams(const TiXmlElement* root)
     109void Hyperblaster::loadParams(const TiXmlElement* root)
    120110{
    121111  Weapon::loadParams(root);
     
    130120   been armed out.
    131121*/
    132 void Cannon::activate()
     122void Hyperblaster::activate()
    133123{
    134124}
     
    142132   been armed out.
    143133*/
    144 void Cannon::deactivate()
     134void Hyperblaster::deactivate()
    145135{
    146136}
     
    153143   @todo: the ObjectManager deliveres Projectiles not TestBullets! this should be diffrent
    154144*/
    155 void Cannon::fire()
     145void Hyperblaster::fire()
    156146{
    157147  Projectile* pj =  this->getProjectile();
     
    174164 * hit, it can also be destoryed.
    175165*/
    176 void Cannon::destroy ()
     166void Hyperblaster::destroy ()
    177167{}
    178 
    179 /**
    180  *  this will draw the weapon
    181 */
    182 void Cannon::draw () const
    183 {
    184   /* draw gun body */
    185   glMatrixMode(GL_MODELVIEW);
    186   glPushMatrix();
    187   glTranslatef (this->getAbsCoor ().x,
    188                 this->getAbsCoor ().y,
    189                 this->getAbsCoor ().z);
    190 
    191   Vector tmpRot = this->getAbsDir().getSpacialAxis();
    192   glRotatef (this->getAbsDir().getSpacialAxisAngle(), tmpRot.x, tmpRot.y, tmpRot.z );
    193 
    194   this->getModel()->draw();
    195   glPopMatrix();
    196 
    197   /* draw objectComponent1: gun coil - animated stuff */
    198 /*  glMatrixMode(GL_MODELVIEW);
    199   glPushMatrix();
    200   glTranslatef (this->objectComponent1->getAbsCoor ().x,
    201                 this->objectComponent1->getAbsCoor ().y,
    202                 this->objectComponent1->getAbsCoor ().z);
    203   tmpRot = this->objectComponent1->getAbsDir().getSpacialAxis();
    204   glRotatef (this->objectComponent1->getAbsDir().getSpacialAxisAngle(), tmpRot.x, tmpRot.y, tmpRot.z );
    205   this->model->draw(0);
    206 
    207   glPopMatrix();*/
    208 }
    209 
  • trunk/src/world_entities/weapons/hyperblaster.h

    r6807 r6810  
    11/*!
    2  * @file cannon.h
    3  * a weapon that is fix on top of the player to fire heavy weaponary.
     2 * @file hyperblaster.h
     3 * a weapon that to fire heavy weaponary Hyperblasts.
    44*/
    55
    66
    7 #ifndef _CANNON_H
    8 #define _CANNON_H
     7#ifndef _HYPERBLASTER_H
     8#define _HYPERBLASTER_H
    99
    1010#include "weapon.h"
    1111
    12 class Cannon : public Weapon
     12class Hyperblaster : public Weapon
    1313  {
    1414  public:
    15     Cannon ();
    16     Cannon (const TiXmlElement* root);
    17     virtual ~Cannon ();
     15    Hyperblaster (const TiXmlElement* root = NULL);
     16    virtual ~Hyperblaster ();
    1817
    1918    void init();
     
    2625    virtual void destroy();
    2726
    28     virtual void draw() const;
    29 
    3027  private:
    3128//     PNode* objectComponent1;         //<! the gun is made of multiple parts, these PNodes represent their location and orientation
    3229  };
    33 #endif /* _CANNON_H */
     30#endif /* _HYPERBLASTER_H */
Note: See TracChangeset for help on using the changeset viewer.